Plugin Directory

Changeset 3393637


Ignore:
Timestamp:
11/11/2025 12:23:17 PM (5 weeks ago)
Author:
samdani
Message:

Version 3.3.2 - Nov 11, 2025

  • [Fixed]: File Name Uncaught Error.
Location:
gs-testimonial/trunk/includes
Files:
3 moved

Legend:

Unmodified
Added
Removed
  • gs-testimonial/trunk/includes/columns.php

    r3393636 r3393637  
    33namespace GSTM;
    44
    5 // if direct access than exit the file.
    6 defined('ABSPATH') || exit;
     5/**
     6 * Protect direct access
     7 */
     8if ( ! defined( 'ABSPATH' ) ) exit;
    79
    8 /**
    9  * Customize necenssary plugin post columns.
    10  *
    11  * @since 1.0.0
    12  */
    1310class Columns {
    1411
     
    2118       
    2219        add_filter( 'manage_gs_testimonial_posts_columns', [ $this, 'gs_testimonial_screen_columns' ] );
    23         add_action( 'manage_gs_testimonial_posts_custom_column', array( $this, 'gs_t_populate_columns' ), 10, 2 );
    24        
     20        add_action( 'manage_gs_testimonial_posts_custom_column', [ $this, 'gs_t_populate_columns' ], 10, 2 );       
    2521    }
    2622
     
    3632
    3733        $new_columns = [
    38             'cb'                            => $columns['cb'],
    39             'title'                         => $columns['title'],
    40             'featured_image'                => __( 'Author Image', 'gst' ),
    41             'gs_t_client_name'              => __( 'Author Name', 'gst' ),
    42             'gs_t_client_company'           => __( 'Company', 'gst' ),
    43             'gs_t_client_design'            => __( 'Designation', 'gst' ),
    44             'gs_t_client_rating'            => __( 'Rating', 'gst' ),
    45             'taxonomy-testimonial_category' => $columns['taxonomy-testimonial_category'],
    46             'date'                          =>  $columns['date']
     34            'cb'                               => $columns['cb'],
     35            'title'                            => $columns['title'],
     36            'featured_image'                   => __( 'Author Image', 'gs-testimonial' ),
     37            'gs_t_client_name'                 => __( 'Author Name', 'gs-testimonial' ),
     38            'gs_t_client_company'              => __( 'Company', 'gs-testimonial' ),
     39            'gs_t_client_design'               => __( 'Designation', 'gs-testimonial' ),
     40            'gs_t_client_rating'               => __( 'Rating', 'gs-testimonial' ),
     41            'taxonomy-gs_testimonial_category' => $columns['taxonomy-gs_testimonial_category'],
     42            'date'                             =>  $columns['date']
    4743        ];
    4844
     
    6157
    6258        if ( 'featured_image' === $column ) {
    63             $image = gstm()->helpers->getFeaturedImage( $postId );
     59            $image = get_featured_image( $postId );
    6460
    6561            if ( $image ) {
     
    9288        }
    9389    }
    94 
    9590}
  • gs-testimonial/trunk/includes/cpt.php

    r3393636 r3393637  
    1010 * @since 1.0.0
    1111 */
    12 class CPT
    13 {
     12class Cpt {
    1413    /**
    1514     * Class constructor.
     
    1716     * @since 1.0.0
    1817     */
    19     public function __construct()
    20     {
    21         add_action( 'init', [ $this, 'GS_Testimonial_Slider' ] );
    22         add_action( 'after_setup_theme', [ $this, 'gs_testimonial_theme_support' ] );
    23         add_action( 'init', array( $this, 'gs_testimonial_category' ), 0 );
     18    public function __construct() {
     19        add_action( 'init', [$this, 'register'] );
     20        add_action( 'after_setup_theme', [$this, 'theme_support'] );
     21        add_action( 'init', array($this, 'register_taxonomies'), 0 );
    2422    }
    25    
     23
    2624    /**
    2725     * Registers a new post type
     
    3230     * @return object|WP_Error the registered post type object, or an error object
    3331     */
    34     public function GS_Testimonial_Slider()
    35     {
     32    public function register() {
    3633        $labels = [
    37             'name'                  => _x( 'Testimonials', 'gst' ),
    38             'singular_name'         => _x( 'Testimonial', 'gst' ),
    39             'menu_name'             => _x( 'Solid Testimonials', 'admin menu', 'gst' ),
    40             'name_admin_bar'        => _x( 'Solid Testimonial', 'add new on admin bar', 'gst' ),
    41             'add_new'               => _x( 'Add New', 'Testimonial', 'gst' ),
    42             'add_new_item'          => __( 'Add New Testimonial', 'gst' ),
    43             'new_item'              => __( 'New Testimonial', 'gst' ),
    44             'edit_item'             => __( 'Edit Testimonial', 'gst' ),
    45             'view_item'             => __( 'View Testimonial', 'gst' ),
    46             'all_items'             => __( 'All Testimonials', 'gst' ),
    47             'search_items'          => __( 'Search Testimonials', 'gst' ),
    48             'parent_item_colon'     => __( 'Parent Testimonials:', 'gst' ),
    49             'not_found'             => __( 'No Testimonials found.', 'gst' ),
    50             'not_found_in_trash'    => __( 'No Testimonials found in Trash.', 'gst' ),
    51             'featured_image'        => __( 'Reviewer Image', 'gst' ),
    52             'set_featured_image'    => __( 'Set Reviewer Image', 'gst' ),
    53             'remove_featured_image' => __( 'Remove Reviewer Image', 'gst' ),
    54             'use_featured_image'    => __( 'Use as Reviewer Image', 'gst' ),
     34            'name'                  => _x( 'Testimonials', 'gs-testimonial' ),
     35            'singular_name'         => _x( 'Testimonial', 'gs-testimonial' ),
     36            'menu_name'             => _x( 'Solid Testimonials', 'admin menu', 'gs-testimonial' ),
     37            'name_admin_bar'        => _x( 'Solid Testimonials', 'add new on admin bar', 'gs-testimonial' ),
     38            'add_new'               => _x( 'Add New', 'Testimonial', 'gs-testimonial' ),
     39            'add_new_item'          => __( 'Add New Testimonial', 'gs-testimonial' ),
     40            'new_item'              => __( 'New Testimonial', 'gs-testimonial' ),
     41            'edit_item'             => __( 'Edit Testimonial', 'gs-testimonial' ),
     42            'view_item'             => __( 'View Testimonial', 'gs-testimonial' ),
     43            'all_items'             => __( 'All Testimonials', 'gs-testimonial' ),
     44            'search_items'          => __( 'Search Testimonials', 'gs-testimonial' ),
     45            'parent_item_colon'     => __( 'Parent Testimonials:', 'gs-testimonial' ),
     46            'not_found'             => __( 'No Testimonials found.', 'gs-testimonial' ),
     47            'not_found_in_trash'    => __( 'No Testimonials found in Trash.', 'gs-testimonial' ),
     48            'featured_image'        => __( 'Reviewer Image', 'gs-testimonial' ),
     49            'set_featured_image'    => __( 'Set Reviewer Image', 'gs-testimonial' ),
     50            'remove_featured_image' => __( 'Remove Reviewer Image', 'gs-testimonial' ),
     51            'use_featured_image'    => __( 'Use as Reviewer Image', 'gs-testimonial' ),
    5552        ];
    5653        $args = [
    5754            'labels'             => $labels,
    5855            'public'             => true,
    59             'publicly_queryable' => true,
     56            'publicly_queryable' => false,
    6057            'show_ui'            => true,
    6158            'show_in_menu'       => true,
    6259            'query_var'          => true,
    63             'rewrite'            => [
    64             'slug' => 'gs_testimonials',
    65         ],
     60            'rewrite'            => false,
    6661            'capability_type'    => 'post',
    6762            'has_archive'        => true,
    6863            'hierarchical'       => false,
    6964            'menu_position'      => GSTM_MENU_POSITION,
    70             'menu_icon'          => GSTM_PLUGIN_URI . 'assets/img/icon.svg',
    71             'supports'           => [ 'title', 'editor', 'thumbnail' ],
     65            'menu_icon'          => GSTM_PLUGIN_URI . '/assets/img/icon.svg',
     66            'supports'           => ['title', 'editor', 'thumbnail'],
    7267        ];
     68        if ( plugin()->builder->get( 'enable_single_page' ) ) {
     69            $args['publicly_queryable'] = true;
     70            $args['rewrite'] = [
     71                'slug' => 'gs-testimonial',
     72            ];
     73        }
    7374        register_post_type( 'gs_testimonial', $args );
    7475    }
    75    
     76
    7677    /**
    7778     * Add post type theme support.
     
    7980     * @since 1.0.0
    8081     */
    81     public function gs_testimonial_theme_support()
    82     {
     82    public function theme_support() {
    8383        // TODO: check if the pro is not enabled
    84         add_theme_support( 'post-thumbnails', [ 'gs_testimonial' ] );
     84        add_theme_support( 'post-thumbnails', ['gs_testimonial'] );
    8585        add_filter( 'widget_text', 'do_shortcode' );
    8686    }
    87    
     87
    8888    // Register Custom Taxonomy For Testimonial Slider
    89     public function gs_testimonial_category()
    90     {
     89    public function register_taxonomies() {
    9190        $labels = array(
    92             'name'                       => _x( 'Testimonial Categories', 'Taxonomy General Name', 'gst' ),
    93             'singular_name'              => _x( 'Testimonial Category', 'Taxonomy Singular Name', 'gst' ),
    94             'menu_name'                  => __( 'Category', 'gst' ),
    95             'all_items'                  => __( 'All Testimonial Category', 'gst' ),
    96             'parent_item'                => __( 'Parent Testimonial Category', 'gst' ),
    97             'parent_item_colon'          => __( 'Parent Testimonial Category:', 'gst' ),
    98             'new_item_name'              => __( 'New Testimonial Category', 'gst' ),
    99             'add_new_item'               => __( 'Add New Testimonial Category', 'gst' ),
    100             'edit_item'                  => __( 'Edit Testimonial Category', 'gst' ),
    101             'update_item'                => __( 'Update Testimonial Category', 'gst' ),
    102             'separate_items_with_commas' => __( 'Separate Testimonial Category with commas', 'gst' ),
    103             'search_items'               => __( 'Search Testimonial Category', 'gst' ),
    104             'add_or_remove_items'        => __( 'Add or remove Testimonial Category', 'gst' ),
    105             'choose_from_most_used'      => __( 'Choose from the most used Testimonial Categories', 'gst' ),
    106             'not_found'                  => __( 'Not Found', 'gst' ),
     91            'name'                       => _x( 'Testimonial Categories', 'Taxonomy General Name', 'gs-testimonial' ),
     92            'singular_name'              => _x( 'Testimonial Category', 'Taxonomy Singular Name', 'gs-testimonial' ),
     93            'menu_name'                  => __( 'Category', 'gs-testimonial' ),
     94            'all_items'                  => __( 'All Testimonial Category', 'gs-testimonial' ),
     95            'parent_item'                => __( 'Parent Testimonial Category', 'gs-testimonial' ),
     96            'parent_item_colon'          => __( 'Parent Testimonial Category:', 'gs-testimonial' ),
     97            'new_item_name'              => __( 'New Testimonial Category', 'gs-testimonial' ),
     98            'add_new_item'               => __( 'Add New Testimonial Category', 'gs-testimonial' ),
     99            'edit_item'                  => __( 'Edit Testimonial Category', 'gs-testimonial' ),
     100            'update_item'                => __( 'Update Testimonial Category', 'gs-testimonial' ),
     101            'separate_items_with_commas' => __( 'Separate Testimonial Category with commas', 'gs-testimonial' ),
     102            'search_items'               => __( 'Search Testimonial Category', 'gs-testimonial' ),
     103            'add_or_remove_items'        => __( 'Add or remove Testimonial Category', 'gs-testimonial' ),
     104            'choose_from_most_used'      => __( 'Choose from the most used Testimonial Categories', 'gs-testimonial' ),
     105            'not_found'                  => __( 'Not Found', 'gs-testimonial' ),
    107106        );
    108107        $rewrite = array(
    109             'slug'         => 'testimonial-category',
     108            'slug'         => 'gs-testimonial-category',
    110109            'with_front'   => true,
    111110            'hierarchical' => false,
     
    121120            'rewrite'           => $rewrite,
    122121        );
    123         register_taxonomy( 'testimonial_category', array( 'gs_testimonial' ), $args );
     122        register_taxonomy( 'gs_testimonial_category', array('gs_testimonial'), $args );
    124123    }
    125124
  • gs-testimonial/trunk/includes/scripts.php

    r3393636 r3393637  
    1010 * @since 1.2.11
    1111 */
    12 class Scripts
    13 {
     12class Scripts {
    1413    /**
    1514     * Contains styles handlers and paths.
     
    1716     * @since 1.0.0
    1817     */
    19     public  $styles = array() ;
     18    public $styles = [];
     19
    2020    /**
    2121     * Contains scripts handlers and paths.
     
    2323     * @since 1.0.0
    2424     */
    25     public  $scripts = array() ;
     25    public $scripts = [];
     26
    2627    /**
    2728     * Class constructor.
     
    2930     * @since 1.0.0
    3031     */
    31     public function __construct()
    32     {
     32    public function __construct() {
    3333        $this->add_assets();
    34         add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_frontend_scripts' ], 9999 );
    35         add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ], 9999 );
    36         add_action( 'admin_head', [ $this, 'print_plugin_icon_css' ] );
     34        add_action( 'wp_enqueue_scripts', [$this, 'enqueue_frontend_scripts'], 9999 );
     35        add_action( 'admin_enqueue_scripts', [$this, 'admin_enqueue_scripts'], 9999 );
     36        add_action( 'admin_head', [$this, 'print_plugin_icon_css'] );
    3737        return $this;
    3838    }
    39    
     39
    4040    /**
    4141     * Adding assets on the $this->styles[] array.
     
    4343     * @since 1.0.0
    4444     */
    45     public function add_assets()
    46     {
     45    public function add_assets() {
    4746        // Styles
    4847        $this->add_style(
    49             'gs-font-awesome',
    50             GSTM_PLUGIN_URI . 'assets/libs/font-awesome/css/font-awesome.min.css',
     48            'gs-font-awesome-5',
     49            GSTM_PLUGIN_URI . '/assets/libs/font-awesome/css/font-awesome.min.css',
    5150            [],
    5251            GSTM_VERSION
     
    5453        $this->add_style(
    5554            'gs-swiper',
    56             GSTM_PLUGIN_URI . 'assets/libs/swiper-js/swiper.min.css',
     55            GSTM_PLUGIN_URI . '/assets/libs/swiper-js/swiper.min.css',
    5756            [],
    5857            GSTM_VERSION
     
    6059        $this->add_style(
    6160            'gs-bootstrap-grid',
    62             GSTM_PLUGIN_URI . 'assets/libs/bootstrap-grid/bootstrap-grid.min.css',
     61            GSTM_PLUGIN_URI . '/assets/libs/bootstrap-grid/bootstrap-grid.min.css',
    6362            [],
    6463            GSTM_VERSION
     
    6665        $this->add_style(
    6766            'gs-magnific-popup',
    68             GSTM_PLUGIN_URI . 'assets/libs/magnific-popup/magnific-popup.min.css',
     67            GSTM_PLUGIN_URI . '/assets/libs/magnific-popup/magnific-popup.min.css',
    6968            [],
    7069            GSTM_VERSION
     
    7271        $this->add_style(
    7372            'gs-testimonial-public',
    74             GSTM_PLUGIN_URI . 'assets/css/public.min.css',
    75             [ 'gs-font-awesome', 'gs-bootstrap-grid' ],
     73            GSTM_PLUGIN_URI . '/assets/css/public.min.css',
     74            ['gs-font-awesome-5', 'gs-bootstrap-grid'],
    7675            GSTM_VERSION
    7776        );
     
    7978        $this->add_script(
    8079            'gs-swiper',
    81             GSTM_PLUGIN_URI . 'assets/libs/swiper-js/swiper.min.js',
    82             [ 'jquery' ],
     80            GSTM_PLUGIN_URI . '/assets/libs/swiper-js/swiper.min.js',
     81            ['jquery'],
    8382            GSTM_VERSION,
    8483            true
     
    8685        $this->add_script(
    8786            'gs-magnific-popup',
    88             GSTM_PLUGIN_URI . 'assets/libs/magnific-popup/magnific-popup.min.js',
    89             [ 'jquery' ],
     87            GSTM_PLUGIN_URI . '/assets/libs/magnific-popup/magnific-popup.min.js',
     88            ['jquery'],
    9089            GSTM_VERSION,
    9190            true
     
    9392        $this->add_script(
    9493            'gs-isotope',
    95             GSTM_PLUGIN_URI . 'assets/libs/isotope/isotope.min.js',
    96             [ 'jquery' ],
     94            GSTM_PLUGIN_URI . '/assets/libs/isotope/isotope.min.js',
     95            ['jquery'],
     96            GSTM_VERSION,
     97            true
     98        );
     99        $this->add_script(
     100            'gs-ticker',
     101            GSTM_PLUGIN_URI . '/assets/libs/carousel-ticker/carouselTicker.min.js',
     102            ['jquery'],
    97103            GSTM_VERSION,
    98104            true
     
    100106        $this->add_script(
    101107            'gs-testimonial-public',
    102             GSTM_PLUGIN_URI . 'assets/js/public.min.js',
    103             [ 'jquery' ],
    104             GSTM_VERSION,
    105             true
    106         );
    107     }
    108    
     108            GSTM_PLUGIN_URI . '/assets/js/public.min.js',
     109            ['jquery'],
     110            GSTM_VERSION,
     111            true
     112        );
     113    }
     114
    109115    /**
    110116     * Store styles on the $this->styles[] queue.
     
    122128        $handler,
    123129        $src,
    124         $deps = array(),
     130        $deps = [],
    125131        $ver = false,
    126132        $media = 'all'
    127     )
    128     {
     133    ) {
    129134        $this->styles[$handler] = [
    130135            'src'   => $src,
     
    134139        ];
    135140    }
    136    
     141
    137142    /**
    138143     * Store scripts on the $this->scripts[] queue.
     
    150155        $handler,
    151156        $src,
    152         $deps = array(),
     157        $deps = [],
    153158        $ver = false,
    154159        $in_footer = false
    155     )
    156     {
     160    ) {
    157161        $this->scripts[$handler] = [
    158162            'src'       => $src,
     
    162166        ];
    163167    }
    164    
     168
    165169    /**
    166170     * Return style if exits on the $this->styles[] list.
     
    169173     * @param string $handler The style name.
    170174     */
    171     public function get_style( $handler )
    172     {
    173         if ( empty($style = $this->styles[$handler]) ) {
     175    public function get_style( $handler ) {
     176        if ( empty( $style = $this->styles[$handler] ) ) {
    174177            return false;
    175178        }
    176179        return $style;
    177180    }
    178    
     181
    179182    /**
    180183     * Return the script if exits on the $this->scripts[] list.
     
    183186     * @param string $handler The script name.
    184187     */
    185     public function get_script( $handler )
    186     {
    187         if ( empty($script = $this->scripts[$handler]) ) {
     188    public function get_script( $handler ) {
     189        if ( empty( $script = $this->scripts[$handler] ) ) {
    188190            return false;
    189191        }
    190192        return $script;
    191193    }
    192    
     194
    193195    /**
    194196     * A wrapper for registering styles.
     
    199201     * @return boolean|void          If it gets the stylesheet then register it or false.
    200202     */
    201     public function wp_register_style( $handler )
    202     {
     203    public function wp_register_style( $handler ) {
    203204        $style = $this->get_style( $handler );
    204205        if ( !$style ) {
     
    214215        );
    215216    }
    216    
     217
    217218    /**
    218219     * A wrapper for registering scripts.
     
    224225     * @return boolean|void          If it gets the script then register it or false.
    225226     */
    226     public function wp_register_script( $handler )
    227     {
     227    public function wp_register_script( $handler ) {
    228228        $script = $this->get_script( $handler );
    229229        if ( !$script ) {
     
    239239        );
    240240    }
    241    
     241
    242242    /**
    243243     * Returns all publicly enqueuable stylesheets.
     
    247247     * @return array List of publicly enqueuable stylesheets.
    248248     */
    249     public function _get_public_style_all()
    250     {
    251         return (array) apply_filters( 'gs_testimonial_public_style_all', [
     249    public function _get_public_style_all() {
     250        $styles = [
    252251            'gs-swiper',
    253252            'gs-bootstrap-grid',
    254             'gs-magnific-popup',
    255             'gs-font-awesome',
     253            'gs-font-awesome-5',
    256254            'gs-testimonial-public'
    257         ] );
    258     }
    259    
     255        ];
     256        return (array) apply_filters( 'gs_testimonial_public_style_all', $styles );
     257    }
     258
    260259    /**
    261260     * Returns all publicly enqueuable scripts.
     
    265264     * @return array List of publicly enqueuable scripts.
    266265     */
    267     public function _get_public_script_all()
    268     {
    269         return (array) apply_filters( 'gs_testimonial_public_script_all', [
    270             'gs-swiper',
    271             'gs-isotope',
    272             'gs-magnific-popup',
    273             'gs-testimonial-public'
    274         ] );
    275     }
    276    
    277     public function _get_assets_all( $asset_type, $group, $excludes = array() )
    278     {
    279         if ( !in_array( $asset_type, [ 'style', 'script' ] ) || !in_array( $group, [ 'public' ] ) ) {
     266    public function _get_public_script_all() {
     267        $scripts = ['gs-swiper', 'gs-testimonial-public'];
     268        return (array) apply_filters( 'gs_testimonial_public_script_all', $scripts );
     269    }
     270
     271    public function _get_assets_all( $asset_type, $group, $excludes = [] ) {
     272        if ( !in_array( $asset_type, ['style', 'script'] ) || !in_array( $group, ['public'] ) ) {
    280273            return;
    281274        }
    282275        $get_assets = sprintf( '_get_%s_%s_all', $group, $asset_type );
    283276        $assets = $this->{$get_assets}();
    284         if ( !empty($excludes) ) {
     277        if ( !empty( $excludes ) ) {
    285278            $assets = array_diff( $assets, $excludes );
    286279        }
    287280        return (array) apply_filters( sprintf( 'gs_testimonial_%s__%s_all', $group, $asset_type ), $assets );
    288281    }
    289    
     282
    290283    public function _wp_load_assets_all(
    291284        $function,
    292285        $asset_type,
    293286        $group,
    294         $excludes = array()
    295     )
    296     {
    297         if ( !in_array( $function, [ 'enqueue', 'register' ] ) || !in_array( $asset_type, [ 'style', 'script' ] ) ) {
     287        $excludes = []
     288    ) {
     289        if ( !in_array( $function, ['enqueue', 'register'] ) || !in_array( $asset_type, ['style', 'script'] ) ) {
    298290            return;
    299291        }
     
    304296        }
    305297    }
    306    
    307     public function wp_register_style_all( $group, $excludes = array() )
    308     {
     298
     299    public function wp_register_style_all( $group, $excludes = [] ) {
    309300        $this->_wp_load_assets_all(
    310301            'register',
     
    314305        );
    315306    }
    316    
    317     public function wp_enqueue_style_all( $group, $excludes = array() )
    318     {
     307
     308    public function wp_enqueue_style_all( $group, $excludes = [] ) {
    319309        $this->_wp_load_assets_all(
    320310            'enqueue',
     
    324314        );
    325315    }
    326    
    327     public function wp_register_script_all( $group, $excludes = array() )
    328     {
     316
     317    public function wp_register_script_all( $group, $excludes = [] ) {
    329318        $this->_wp_load_assets_all(
    330319            'register',
     
    334323        );
    335324    }
    336    
    337     public function wp_enqueue_script_all( $group, $excludes = array() )
    338     {
     325
     326    public function wp_enqueue_script_all( $group, $excludes = [] ) {
    339327        $this->_wp_load_assets_all(
    340328            'enqueue',
     
    344332        );
    345333    }
    346    
     334
    347335    // Use to direct enqueue
    348     public function wp_enqueue_style( $handler )
    349     {
     336    public function wp_enqueue_style( $handler ) {
    350337        $style = $this->get_style( $handler );
    351338        if ( !$style ) {
     
    361348        );
    362349    }
    363    
    364     public function wp_enqueue_script( $handler )
    365     {
     350
     351    public function wp_enqueue_script( $handler ) {
    366352        $script = $this->get_script( $handler );
    367353        if ( !$script ) {
     
    377363        );
    378364    }
    379    
    380     public function print_plugin_icon_css()
    381     {
    382         echo  '<style>#adminmenu .toplevel_page_gs-testimonial .wp-menu-image img,#adminmenu .menu-icon-gs_testimonial .wp-menu-image img{padding-top:7px;width:20px;opacity:.8;height:auto}#menu-posts-gs_testimonial li{clear:both}#menu-posts-gs_testimonial li a[href^="edit.php?post_type=gs_testimonial&page=gs-testimonial-plugins-help"]:after,#menu-posts-gs_testimonial li:nth-last-child(3) a:after{border-bottom:1px solid hsla(0,0%,100%,.2);display:block;float:left;margin:13px -15px 8px;content:"";width:calc(100% + 26px)}</style>' ;
    383     }
    384    
     365
     366    public function print_plugin_icon_css() {
     367        echo '<style>#adminmenu .toplevel_page_gs-testimonial .wp-menu-image img,#adminmenu .menu-icon-gs_testimonial .wp-menu-image img{padding-top:7px;width:20px;opacity:.8;height:auto}#menu-posts-gs_testimonial li{clear:both}#menu-posts-gs_testimonial li a[href^="edit.php?post_type=gs_testimonial&page=gs-testimonial-plugins-help"]:after,#menu-posts-gs_testimonial li:nth-last-child(3) a:after{border-bottom:1px solid hsla(0,0%,100%,.2);display:block;float:left;margin:13px -15px 8px;content:"";width:calc(100% + 26px)}</style>';
     368    }
     369
    385370    /**
    386371     * Enqueue assets for the plugin based on all dep checks and only
     
    391376     * @return void
    392377     */
    393     public function enqueue_frontend_scripts()
    394     {
     378    public function enqueue_frontend_scripts() {
    395379        // Register Styles
    396380        $this->wp_register_style_all( 'public' );
     
    398382        $this->wp_register_script_all( 'public' );
    399383        // Enqueue for Single & Archive Pages
    400         if ( is_singular( 'gs_testimonial' ) || is_post_type_archive( 'gs_testimonial' ) || is_tax( [ 'testimonial_category' ] ) ) {
     384        if ( is_singular( 'gs_testimonial' ) || is_post_type_archive( 'gs_testimonial' ) || is_tax( ['gs_testimonial_category'] ) ) {
    401385            wp_enqueue_style( 'gs-testimonial-public' );
    402386        }
     
    405389        do_action( 'gs_testimonial_assets_loaded' );
    406390    }
    407    
    408     public function admin_enqueue_scripts( $hook )
    409     {
    410         global  $post ;
     391
     392    public function admin_enqueue_scripts( $hook ) {
     393        global $post;
    411394        $load_script = false;
     395        if ( $hook == 'gs_testimonial_page_sort_gs_testimonial' ) {
     396            $load_script = true;
     397        }
     398        if ( $hook == 'gs_testimonial_page_sort_group_gs_testimonial' ) {
     399            $load_script = true;
     400        }
    412401        if ( $hook == 'gs_testimonial_page_gst-shortcodes' ) {
    413402            $load_script = true;
    414403        }
    415         // Allow scripts loading in new gs_team member page
    416         if ( $hook == 'post-new.php' && $_GET['post_type'] == 'gs_testimonial' ) {
    417             $load_script = true;
    418         }
    419         // Allow scripts loading in gs_team member edit page
     404        // Allow scripts loading in new gs_testimonial member page
     405        if ( $hook == 'post-new.php' && $post->post_type == 'gs_testimonial' ) {
     406            $load_script = true;
     407        }
     408        // Allow scripts loading in gs_testimonial member edit page
    420409        if ( $hook == 'post.php' && $post->post_type == 'gs_testimonial' ) {
    421410            $load_script = true;
    422411        }
    423         // Allow scripts loading in gs_team member edit page
    424         if ( $hook == 'edit-tags.php' && $_GET['post_type'] == 'gs_testimonial' ) {
    425             $load_script = true;
    426         }
    427         if ( $hook == 'term.php' && $_GET['post_type'] == 'gs_testimonial' ) {
     412        // Allow scripts loading in gs_testimonial member edit page
     413        if ( $hook == 'edit-tags.php' && $_GET['taxonomy'] == 'gs_testimonial_category' ) {
     414            $load_script = true;
     415        }
     416        if ( $hook == 'term.php' && $_GET['taxonomy'] == 'gs_testimonial_category' ) {
    428417            $load_script = true;
    429418        }
     
    432421            return;
    433422        }
    434         wp_register_style(
    435             'gs_free_plugins_css',
    436             GSTM_PLUGIN_URI . 'assets/css/gs_free_plugins.css',
    437             '',
    438             GSTM_VERSION
    439         );
    440423        wp_enqueue_script(
    441424            'gstm-star-rating',
    442             GSTM_PLUGIN_URI . 'assets/rateit-js/jquery.rateit.min.js',
    443             array( 'jquery' ),
     425            GSTM_PLUGIN_URI . '/assets/rateit-js/jquery.rateit.min.js',
     426            array('jquery'),
    444427            GSTM_VERSION,
    445428            true
     
    447430        wp_enqueue_style(
    448431            'gstm-star-rating',
    449             GSTM_PLUGIN_URI . 'assets/rateit-js/rateit.css',
    450             '',
     432            GSTM_PLUGIN_URI . '/assets/rateit-js/rateit.css',
     433            [],
    451434            GSTM_VERSION
    452435        );
    453436        wp_enqueue_style(
    454             'gs-font-awesome',
    455             GSTM_PLUGIN_URI . 'assets/libs/font-awesome/css/font-awesome.min.css',
    456             '',
     437            'gs-font-awesome-5',
     438            GSTM_PLUGIN_URI . '/assets/libs/font-awesome/css/font-awesome.min.css',
     439            [],
    457440            GSTM_VERSION
    458441        );
    459442        wp_enqueue_style(
    460443            'gstm-metabox',
    461             GSTM_PLUGIN_URI . 'assets/css/gstm-metabox.css',
    462             '',
     444            GSTM_PLUGIN_URI . '/assets/css/gstm-metabox.css',
     445            [],
    463446            GSTM_VERSION
    464447        );
    465448        wp_enqueue_style(
    466449            'gstm-form',
    467             GSTM_PLUGIN_URI . 'assets/form/index.css',
    468             '',
    469             GSTM_VERSION
    470         );
    471     }
    472    
    473     public static function add_dependency_scripts( $handle, $scripts )
    474     {
    475         add_action( 'wp_footer', function () use( $handle, $scripts ) {
    476             global  $wp_scripts ;
    477             if ( empty($scripts) || empty($handle) ) {
     450            GSTM_PLUGIN_URI . '/assets/form/index.css',
     451            [],
     452            GSTM_VERSION
     453        );
     454    }
     455
     456    public static function add_dependency_scripts( $handle, $scripts ) {
     457        add_action( 'wp_footer', function () use($handle, $scripts) {
     458            global $wp_scripts;
     459            if ( empty( $scripts ) || empty( $handle ) ) {
    478460                return;
    479461            }
     
    484466        } );
    485467    }
    486    
    487     public static function add_dependency_styles( $handle, $styles )
    488     {
    489         global  $wp_styles ;
    490         if ( empty($styles) || empty($handle) ) {
     468
     469    public static function add_dependency_styles( $handle, $styles ) {
     470        global $wp_styles;
     471        if ( empty( $styles ) || empty( $handle ) ) {
    491472            return;
    492473        }
Note: See TracChangeset for help on using the changeset viewer.