⚡ NEW: Changeset/ - Uncensored 2025

Changeset 2904059


Ignore:
Timestamp:
04/25/2023 06:18:45 PM (3 years ago)
Author:
downstairsdev
Message:

Update to version 1.1 from GitHub

Location:
portfolio-post-type
Files:
33 added
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • portfolio-post-type/assets/banner-772x250.jpg

    • Property svn:mime-type changed from application/octet-stream to image/jpeg
  • portfolio-post-type/assets/icon-256x256.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • portfolio-post-type/tags/1.1/includes/class-gamajo-dashboard-glancer.php

    r2371654 r2904059  
    6464
    6565        // Register each combination of given post type and status
    66         foreach( $post_types as $post_type ) {
     66        foreach ( $post_types as $post_type ) {
    6767            foreach ( (array) $statuses as $status ) {
    6868                $this->items[] = array(
     
    106106     */
    107107    protected function unset_invalid_post_types( array $post_types ) {
    108         foreach( $post_types as $index => $post_type ) {
     108        foreach ( $post_types as $index => $post_type ) {
    109109            $post_type_object = get_post_type_object( $post_type );
    110110            if ( is_null( $post_type_object ) ) {
     
    129129    protected function get_single_item( array $item ) {
    130130        $num_posts = wp_count_posts( $item['type'] );
    131         $count = (int) $num_posts->{$item['status']};
     131        $count     = (int) $num_posts->{$item['status']};
    132132
    133133        if ( ! $count ) {
  • portfolio-post-type/tags/1.1/includes/class-portfolio-post-type-admin.php

    r2371654 r2904059  
    4242
    4343        // Add thumbnails to column view
    44         add_filter( 'manage_edit-' . $this->registration_handler->post_type . '_columns', array( $this, 'add_thumbnail_column'), 10, 1 );
     44        add_filter( 'manage_edit-' . $this->registration_handler->post_type . '_columns', array( $this, 'add_thumbnail_column' ), 10, 1 );
    4545        add_action( 'manage_posts_custom_column', array( $this, 'display_thumbnail' ), 10, 1 );
    4646
     
    118118
    119119        $tax_name         = $this->get_taxonomy_name_from_slug( $tax_slug );
    120         $current_tax_slug = isset( $_GET[$tax_slug] ) ? $_GET[$tax_slug] : false;
     120        $current_tax_slug = isset( $_GET[ $tax_slug ] ) ? $_GET[ $tax_slug ] : false;
    121121
    122122        $filter  = '<select name="' . esc_attr( $tax_slug ) . '" id="' . esc_attr( $tax_slug ) . '" class="postform">';
    123         $filter .= '<option value="0">' . esc_html( $tax_name ) .'</option>';
     123        $filter .= '<option value="0">' . esc_html( $tax_name ) . '</option>';
    124124        $filter .= $this->build_term_options( $terms, $current_tax_slug );
    125125        $filter .= '</select>';
     
    137137    protected function get_taxonomy_name_from_slug( $tax_slug ) {
    138138        $tax_obj = get_taxonomy( $tax_slug );
    139         if ( ! $tax_obj )
     139        if ( ! $tax_obj ) {
    140140            return '';
     141        }
    141142        return $tax_obj->labels->name;
    142143    }
     
    171172     */
    172173    public function add_glance_counts( $items ) {
    173         $glancer = new Gamajo_Dashboard_Glancer;
     174        $glancer = new Gamajo_Dashboard_Glancer();
    174175        $glancer->add( $this->registration_handler->post_type, array( 'publish', 'pending' ) );
    175176
     
    177178    }
    178179   
    179     /** 
     180    /** 
    180181    * Displays the portfolio icon in the glance view in the dashboard.
    181     */ 
    182     public function add_glance_icon() { 
     182    */ 
     183    public function add_glance_icon() { 
    183184            // Styling only needed on dashboard page.
    184             $screen = get_current_screen(); 
    185             if ( ! is_object( $screen ) || $screen->id !== 'dashboard' ) { 
    186                 return;
    187             }   
    188             ?> 
     185            $screen = get_current_screen(); 
     186        if ( ! is_object( $screen ) || $screen->id !== 'dashboard' ) { 
     187            return;
     188        }   
     189        ?> 
    189190            <style>
    190191                #dashboard_right_now .portfolio-count:before { 
  • portfolio-post-type/tags/1.1/includes/class-portfolio-post-type-post-type.php

    r1988321 r2904059  
    7474            'rewrite'         => array( 'slug' => 'portfolio', ), // Permalinks format
    7575            'menu_position'   => 5,
    76             'menu_icon'       => ( version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) ) ? 'dashicons-portfolio' : false ,
     76            'menu_icon'       => 'dashicons-portfolio',
    7777            'has_archive'     => true,
    7878            'show_in_rest'    => true,
     79            'show_in_graphql' => true,
     80            'graphql_single_name' => 'portfolio_item',
     81            'graphql_plural_name' => 'portfolio_items',
    7982        );
    8083
  • portfolio-post-type/tags/1.1/includes/class-portfolio-post-type-registrations.php

    r974300 r2904059  
    3535        global $portfolio_post_type_post_type, $portfolio_post_type_taxonomy_category, $portfolio_post_type_taxonomy_tag;
    3636
    37         $portfolio_post_type_post_type = new Portfolio_Post_Type_Post_Type;
     37        $portfolio_post_type_post_type = new Portfolio_Post_Type_Post_Type();
    3838        $portfolio_post_type_post_type->register();
    3939        $this->post_type = $portfolio_post_type_post_type->get_post_type();
    4040
    41         $portfolio_post_type_taxonomy_category = new Portfolio_Post_Type_Taxonomy_Category;
     41        $portfolio_post_type_taxonomy_category = new Portfolio_Post_Type_Taxonomy_Category();
    4242        $portfolio_post_type_taxonomy_category->register();
    4343        $this->taxonomies[] = $portfolio_post_type_taxonomy_category->get_taxonomy();
     
    4747        );
    4848
    49         $portfolio_post_type_taxonomy_tag = new Portfolio_Post_Type_Taxonomy_Tag;
     49        $portfolio_post_type_taxonomy_tag = new Portfolio_Post_Type_Taxonomy_Tag();
    5050        $portfolio_post_type_taxonomy_tag->register();
    5151        $this->taxonomies[] = $portfolio_post_type_taxonomy_tag->get_taxonomy();
  • portfolio-post-type/tags/1.1/includes/class-portfolio-post-type-taxonomy-category.php

    r1988321 r2904059  
    5858
    5959        $args = array(
    60             'labels'            => $labels,
    61             'public'            => true,
    62             'show_in_nav_menus' => true,
    63             'show_ui'           => true,
    64             'show_tagcloud'     => true,
    65             'hierarchical'      => true,
    66             'rewrite'           => array( 'slug' => 'portfolio_category' ),
    67             'show_admin_column' => true,
    68             'query_var'         => true,
    69             'show_in_rest'      => true,
     60            'labels'              => $labels,
     61            'public'              => true,
     62            'show_in_nav_menus'   => true,
     63            'show_ui'             => true,
     64            'show_tagcloud'       => true,
     65            'hierarchical'        => true,
     66            'rewrite'             => array( 'slug' => 'portfolio_category' ),
     67            'show_admin_column'   => true,
     68            'query_var'           => true,
     69            'show_in_rest'        => true,
     70            'show_in_graphql'     => true,
     71            'graphql_single_name' => 'portfolio_category',
     72            'graphql_plural_name' => 'portfolio_categories',
     73           
    7074        );
    7175
  • portfolio-post-type/tags/1.1/includes/class-portfolio-post-type.php

    r1988321 r2904059  
    5454        // Activate plugin when new blog is added
    5555        add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
    56 
    5756    }
    5857
     
    110109     * @since    0.7.0
    111110     *
    112      * @param   int $blog_id ID of the new blog.
     111     * @param   int $blog_id ID of the new blog.
    113112     */
    114113    public function activate_new_site( $blog_id ) {
    115         if ( 1 !== did_action( 'wpmu_new_blog' ) )
     114        if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
    116115            return;
     116        }
    117117
    118118        switch_to_blog( $blog_id );
     
    129129     * @since    0.7.0
    130130     *
    131      * @return  array|false The blog ids, false if no matches.
     131     * @return  array|false The blog ids, false if no matches.
    132132     */
    133133    private function get_blog_ids() {
     
    170170
    171171        load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
    172         load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages' );
     172        load_plugin_textdomain( $domain, false, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages' );
    173173    }
    174174
  • portfolio-post-type/tags/1.1/portfolio-post-type.php

    r2371654 r2904059  
    1414 * Description: Enables a portfolio post type and taxonomies.
    1515 * Version:     1.0.1
     16 * Requires at least: 3.8
     17 * Requires PHP: 7.0
     18 * Tested up to: 6.2
    1619 * Author:      Devin Price
    1720 * Author URI:  https://www.wptheming.com/
     
    3841
    3942// Instantiate registration class, so we can add it as a dependency to main plugin class.
    40 $portfolio_post_type_registrations = new Portfolio_Post_Type_Registrations;
     43$portfolio_post_type_registrations = new Portfolio_Post_Type_Registrations();
    4144
    4245// Instantiate main plugin file, so activation callback does not need to be static.
     
    6164    if ( is_admin() ) {
    6265        global $portfolio_post_type_admin, $portfolio_post_type_registrations;
    63         // Loads for users viewing the WordPress dashboard
     66        // Loads for users viewing the WordPress dashboard.
    6467        if ( ! class_exists( 'Gamajo_Dashboard_Glancer' ) ) {
    6568            require plugin_dir_path( __FILE__ ) . 'includes/class-gamajo-dashboard-glancer.php';  // WP 3.8
     
    6972        $portfolio_post_type_admin->init();
    7073    } else {
    71         // Loads for users viewing the front end
     74        // Loads for users viewing the front end.
    7275        if ( apply_filters( 'portfolioposttype_add_taxonomy_terms_classes', true ) ) {
    7376            if ( ! class_exists( 'Gamajo_Single_Entry_Term_Body_Classes' ) ) {
    7477                require plugin_dir_path( __FILE__ ) . 'includes/class-gamajo-single-entry-term-body-classes.php';
    7578            }
    76             $portfolio_post_type_body_classes = new Gamajo_Single_Entry_Term_Body_Classes;
     79            $portfolio_post_type_body_classes = new Gamajo_Single_Entry_Term_Body_Classes();
    7780            $portfolio_post_type_body_classes->init( 'portfolio' );
    7881        }
  • portfolio-post-type/tags/1.1/readme.txt

    r2371654 r2904059  
    3232
    3333== Changelog ==
     34
     35= 1.1 =
     36
     37* Update: GraphQL support. Props @gabacode.
     38* Update: Bump WordPress support versions.
    3439
    3540= 1.0.1 =
  • portfolio-post-type/trunk/includes/class-gamajo-dashboard-glancer.php

    r2371654 r2904059  
    6464
    6565        // Register each combination of given post type and status
    66         foreach( $post_types as $post_type ) {
     66        foreach ( $post_types as $post_type ) {
    6767            foreach ( (array) $statuses as $status ) {
    6868                $this->items[] = array(
     
    106106     */
    107107    protected function unset_invalid_post_types( array $post_types ) {
    108         foreach( $post_types as $index => $post_type ) {
     108        foreach ( $post_types as $index => $post_type ) {
    109109            $post_type_object = get_post_type_object( $post_type );
    110110            if ( is_null( $post_type_object ) ) {
     
    129129    protected function get_single_item( array $item ) {
    130130        $num_posts = wp_count_posts( $item['type'] );
    131         $count = (int) $num_posts->{$item['status']};
     131        $count     = (int) $num_posts->{$item['status']};
    132132
    133133        if ( ! $count ) {
  • portfolio-post-type/trunk/includes/class-portfolio-post-type-admin.php

    r2371654 r2904059  
    4242
    4343        // Add thumbnails to column view
    44         add_filter( 'manage_edit-' . $this->registration_handler->post_type . '_columns', array( $this, 'add_thumbnail_column'), 10, 1 );
     44        add_filter( 'manage_edit-' . $this->registration_handler->post_type . '_columns', array( $this, 'add_thumbnail_column' ), 10, 1 );
    4545        add_action( 'manage_posts_custom_column', array( $this, 'display_thumbnail' ), 10, 1 );
    4646
     
    118118
    119119        $tax_name         = $this->get_taxonomy_name_from_slug( $tax_slug );
    120         $current_tax_slug = isset( $_GET[$tax_slug] ) ? $_GET[$tax_slug] : false;
     120        $current_tax_slug = isset( $_GET[ $tax_slug ] ) ? $_GET[ $tax_slug ] : false;
    121121
    122122        $filter  = '<select name="' . esc_attr( $tax_slug ) . '" id="' . esc_attr( $tax_slug ) . '" class="postform">';
    123         $filter .= '<option value="0">' . esc_html( $tax_name ) .'</option>';
     123        $filter .= '<option value="0">' . esc_html( $tax_name ) . '</option>';
    124124        $filter .= $this->build_term_options( $terms, $current_tax_slug );
    125125        $filter .= '</select>';
     
    137137    protected function get_taxonomy_name_from_slug( $tax_slug ) {
    138138        $tax_obj = get_taxonomy( $tax_slug );
    139         if ( ! $tax_obj )
     139        if ( ! $tax_obj ) {
    140140            return '';
     141        }
    141142        return $tax_obj->labels->name;
    142143    }
     
    171172     */
    172173    public function add_glance_counts( $items ) {
    173         $glancer = new Gamajo_Dashboard_Glancer;
     174        $glancer = new Gamajo_Dashboard_Glancer();
    174175        $glancer->add( $this->registration_handler->post_type, array( 'publish', 'pending' ) );
    175176
     
    177178    }
    178179   
    179     /** 
     180    /** 
    180181    * Displays the portfolio icon in the glance view in the dashboard.
    181     */ 
    182     public function add_glance_icon() { 
     182    */ 
     183    public function add_glance_icon() { 
    183184            // Styling only needed on dashboard page.
    184             $screen = get_current_screen(); 
    185             if ( ! is_object( $screen ) || $screen->id !== 'dashboard' ) { 
    186                 return;
    187             }   
    188             ?> 
     185            $screen = get_current_screen(); 
     186        if ( ! is_object( $screen ) || $screen->id !== 'dashboard' ) { 
     187            return;
     188        }   
     189        ?> 
    189190            <style>
    190191                #dashboard_right_now .portfolio-count:before { 
  • portfolio-post-type/trunk/includes/class-portfolio-post-type-post-type.php

    r1988321 r2904059  
    7474            'rewrite'         => array( 'slug' => 'portfolio', ), // Permalinks format
    7575            'menu_position'   => 5,
    76             'menu_icon'       => ( version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) ) ? 'dashicons-portfolio' : false ,
     76            'menu_icon'       => 'dashicons-portfolio',
    7777            'has_archive'     => true,
    7878            'show_in_rest'    => true,
     79            'show_in_graphql' => true,
     80            'graphql_single_name' => 'portfolio_item',
     81            'graphql_plural_name' => 'portfolio_items',
    7982        );
    8083
  • portfolio-post-type/trunk/includes/class-portfolio-post-type-registrations.php

    r974300 r2904059  
    3535        global $portfolio_post_type_post_type, $portfolio_post_type_taxonomy_category, $portfolio_post_type_taxonomy_tag;
    3636
    37         $portfolio_post_type_post_type = new Portfolio_Post_Type_Post_Type;
     37        $portfolio_post_type_post_type = new Portfolio_Post_Type_Post_Type();
    3838        $portfolio_post_type_post_type->register();
    3939        $this->post_type = $portfolio_post_type_post_type->get_post_type();
    4040
    41         $portfolio_post_type_taxonomy_category = new Portfolio_Post_Type_Taxonomy_Category;
     41        $portfolio_post_type_taxonomy_category = new Portfolio_Post_Type_Taxonomy_Category();
    4242        $portfolio_post_type_taxonomy_category->register();
    4343        $this->taxonomies[] = $portfolio_post_type_taxonomy_category->get_taxonomy();
     
    4747        );
    4848
    49         $portfolio_post_type_taxonomy_tag = new Portfolio_Post_Type_Taxonomy_Tag;
     49        $portfolio_post_type_taxonomy_tag = new Portfolio_Post_Type_Taxonomy_Tag();
    5050        $portfolio_post_type_taxonomy_tag->register();
    5151        $this->taxonomies[] = $portfolio_post_type_taxonomy_tag->get_taxonomy();
  • portfolio-post-type/trunk/includes/class-portfolio-post-type-taxonomy-category.php

    r1988321 r2904059  
    5858
    5959        $args = array(
    60             'labels'            => $labels,
    61             'public'            => true,
    62             'show_in_nav_menus' => true,
    63             'show_ui'           => true,
    64             'show_tagcloud'     => true,
    65             'hierarchical'      => true,
    66             'rewrite'           => array( 'slug' => 'portfolio_category' ),
    67             'show_admin_column' => true,
    68             'query_var'         => true,
    69             'show_in_rest'      => true,
     60            'labels'              => $labels,
     61            'public'              => true,
     62            'show_in_nav_menus'   => true,
     63            'show_ui'             => true,
     64            'show_tagcloud'       => true,
     65            'hierarchical'        => true,
     66            'rewrite'             => array( 'slug' => 'portfolio_category' ),
     67            'show_admin_column'   => true,
     68            'query_var'           => true,
     69            'show_in_rest'        => true,
     70            'show_in_graphql'     => true,
     71            'graphql_single_name' => 'portfolio_category',
     72            'graphql_plural_name' => 'portfolio_categories',
     73           
    7074        );
    7175
  • portfolio-post-type/trunk/includes/class-portfolio-post-type.php

    r1988321 r2904059  
    5454        // Activate plugin when new blog is added
    5555        add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) );
    56 
    5756    }
    5857
     
    110109     * @since    0.7.0
    111110     *
    112      * @param   int $blog_id ID of the new blog.
     111     * @param   int $blog_id ID of the new blog.
    113112     */
    114113    public function activate_new_site( $blog_id ) {
    115         if ( 1 !== did_action( 'wpmu_new_blog' ) )
     114        if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
    116115            return;
     116        }
    117117
    118118        switch_to_blog( $blog_id );
     
    129129     * @since    0.7.0
    130130     *
    131      * @return  array|false The blog ids, false if no matches.
     131     * @return  array|false The blog ids, false if no matches.
    132132     */
    133133    private function get_blog_ids() {
     
    170170
    171171        load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
    172         load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages' );
     172        load_plugin_textdomain( $domain, false, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages' );
    173173    }
    174174
  • portfolio-post-type/trunk/portfolio-post-type.php

    r2371654 r2904059  
    1414 * Description: Enables a portfolio post type and taxonomies.
    1515 * Version:     1.0.1
     16 * Requires at least: 3.8
     17 * Requires PHP: 7.0
     18 * Tested up to: 6.2
    1619 * Author:      Devin Price
    1720 * Author URI:  https://www.wptheming.com/
     
    3841
    3942// Instantiate registration class, so we can add it as a dependency to main plugin class.
    40 $portfolio_post_type_registrations = new Portfolio_Post_Type_Registrations;
     43$portfolio_post_type_registrations = new Portfolio_Post_Type_Registrations();
    4144
    4245// Instantiate main plugin file, so activation callback does not need to be static.
     
    6164    if ( is_admin() ) {
    6265        global $portfolio_post_type_admin, $portfolio_post_type_registrations;
    63         // Loads for users viewing the WordPress dashboard
     66        // Loads for users viewing the WordPress dashboard.
    6467        if ( ! class_exists( 'Gamajo_Dashboard_Glancer' ) ) {
    6568            require plugin_dir_path( __FILE__ ) . 'includes/class-gamajo-dashboard-glancer.php';  // WP 3.8
     
    6972        $portfolio_post_type_admin->init();
    7073    } else {
    71         // Loads for users viewing the front end
     74        // Loads for users viewing the front end.
    7275        if ( apply_filters( 'portfolioposttype_add_taxonomy_terms_classes', true ) ) {
    7376            if ( ! class_exists( 'Gamajo_Single_Entry_Term_Body_Classes' ) ) {
    7477                require plugin_dir_path( __FILE__ ) . 'includes/class-gamajo-single-entry-term-body-classes.php';
    7578            }
    76             $portfolio_post_type_body_classes = new Gamajo_Single_Entry_Term_Body_Classes;
     79            $portfolio_post_type_body_classes = new Gamajo_Single_Entry_Term_Body_Classes();
    7780            $portfolio_post_type_body_classes->init( 'portfolio' );
    7881        }
  • portfolio-post-type/trunk/readme.txt

    r2371654 r2904059  
    3232
    3333== Changelog ==
     34
     35= 1.1 =
     36
     37* Update: GraphQL support. Props @gabacode.
     38* Update: Bump WordPress support versions.
    3439
    3540= 1.0.1 =
Note: See TracChangeset for help on using the changeset viewer.