Changeset 3393637
- Timestamp:
- 11/11/2025 12:23:17 PM (5 weeks ago)
- Location:
- gs-testimonial/trunk/includes
- Files:
-
- 3 moved
-
columns.php (moved) (moved from gs-testimonial/trunk/includes/Columns.php) (5 diffs)
-
cpt.php (moved) (moved from gs-testimonial/trunk/includes/CPT.php) (5 diffs)
-
scripts.php (moved) (moved from gs-testimonial/trunk/includes/Scripts.php) (38 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gs-testimonial/trunk/includes/columns.php
r3393636 r3393637 3 3 namespace GSTM; 4 4 5 // if direct access than exit the file. 6 defined('ABSPATH') || exit; 5 /** 6 * Protect direct access 7 */ 8 if ( ! defined( 'ABSPATH' ) ) exit; 7 9 8 /**9 * Customize necenssary plugin post columns.10 *11 * @since 1.0.012 */13 10 class Columns { 14 11 … … 21 18 22 19 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 ); 25 21 } 26 22 … … 36 32 37 33 $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'] 47 43 ]; 48 44 … … 61 57 62 58 if ( 'featured_image' === $column ) { 63 $image = g stm()->helpers->getFeaturedImage( $postId );59 $image = get_featured_image( $postId ); 64 60 65 61 if ( $image ) { … … 92 88 } 93 89 } 94 95 90 } -
gs-testimonial/trunk/includes/cpt.php
r3393636 r3393637 10 10 * @since 1.0.0 11 11 */ 12 class CPT 13 { 12 class Cpt { 14 13 /** 15 14 * Class constructor. … … 17 16 * @since 1.0.0 18 17 */ 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 ); 24 22 } 25 23 26 24 /** 27 25 * Registers a new post type … … 32 30 * @return object|WP_Error the registered post type object, or an error object 33 31 */ 34 public function GS_Testimonial_Slider() 35 { 32 public function register() { 36 33 $labels = [ 37 'name' => _x( 'Testimonials', 'gs t' ),38 'singular_name' => _x( 'Testimonial', 'gs t' ),39 'menu_name' => _x( 'Solid Testimonials', 'admin menu', 'gs t' ),40 'name_admin_bar' => _x( 'Solid Testimonial ', 'add new on admin bar', 'gst' ),41 'add_new' => _x( 'Add New', 'Testimonial', 'gs t' ),42 'add_new_item' => __( 'Add New Testimonial', 'gs t' ),43 'new_item' => __( 'New Testimonial', 'gs t' ),44 'edit_item' => __( 'Edit Testimonial', 'gs t' ),45 'view_item' => __( 'View Testimonial', 'gs t' ),46 'all_items' => __( 'All Testimonials', 'gs t' ),47 'search_items' => __( 'Search Testimonials', 'gs t' ),48 'parent_item_colon' => __( 'Parent Testimonials:', 'gs t' ),49 'not_found' => __( 'No Testimonials found.', 'gs t' ),50 'not_found_in_trash' => __( 'No Testimonials found in Trash.', 'gs t' ),51 'featured_image' => __( 'Reviewer Image', 'gs t' ),52 'set_featured_image' => __( 'Set Reviewer Image', 'gs t' ),53 'remove_featured_image' => __( 'Remove Reviewer Image', 'gs t' ),54 'use_featured_image' => __( 'Use as Reviewer Image', 'gs t' ),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' ), 55 52 ]; 56 53 $args = [ 57 54 'labels' => $labels, 58 55 'public' => true, 59 'publicly_queryable' => true,56 'publicly_queryable' => false, 60 57 'show_ui' => true, 61 58 'show_in_menu' => true, 62 59 'query_var' => true, 63 'rewrite' => [ 64 'slug' => 'gs_testimonials', 65 ], 60 'rewrite' => false, 66 61 'capability_type' => 'post', 67 62 'has_archive' => true, 68 63 'hierarchical' => false, 69 64 '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'], 72 67 ]; 68 if ( plugin()->builder->get( 'enable_single_page' ) ) { 69 $args['publicly_queryable'] = true; 70 $args['rewrite'] = [ 71 'slug' => 'gs-testimonial', 72 ]; 73 } 73 74 register_post_type( 'gs_testimonial', $args ); 74 75 } 75 76 76 77 /** 77 78 * Add post type theme support. … … 79 80 * @since 1.0.0 80 81 */ 81 public function gs_testimonial_theme_support() 82 { 82 public function theme_support() { 83 83 // TODO: check if the pro is not enabled 84 add_theme_support( 'post-thumbnails', [ 'gs_testimonial'] );84 add_theme_support( 'post-thumbnails', ['gs_testimonial'] ); 85 85 add_filter( 'widget_text', 'do_shortcode' ); 86 86 } 87 87 88 88 // Register Custom Taxonomy For Testimonial Slider 89 public function gs_testimonial_category() 90 { 89 public function register_taxonomies() { 91 90 $labels = array( 92 'name' => _x( 'Testimonial Categories', 'Taxonomy General Name', 'gs t' ),93 'singular_name' => _x( 'Testimonial Category', 'Taxonomy Singular Name', 'gs t' ),94 'menu_name' => __( 'Category', 'gs t' ),95 'all_items' => __( 'All Testimonial Category', 'gs t' ),96 'parent_item' => __( 'Parent Testimonial Category', 'gs t' ),97 'parent_item_colon' => __( 'Parent Testimonial Category:', 'gs t' ),98 'new_item_name' => __( 'New Testimonial Category', 'gs t' ),99 'add_new_item' => __( 'Add New Testimonial Category', 'gs t' ),100 'edit_item' => __( 'Edit Testimonial Category', 'gs t' ),101 'update_item' => __( 'Update Testimonial Category', 'gs t' ),102 'separate_items_with_commas' => __( 'Separate Testimonial Category with commas', 'gs t' ),103 'search_items' => __( 'Search Testimonial Category', 'gs t' ),104 'add_or_remove_items' => __( 'Add or remove Testimonial Category', 'gs t' ),105 'choose_from_most_used' => __( 'Choose from the most used Testimonial Categories', 'gs t' ),106 'not_found' => __( 'Not Found', 'gs t' ),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' ), 107 106 ); 108 107 $rewrite = array( 109 'slug' => ' testimonial-category',108 'slug' => 'gs-testimonial-category', 110 109 'with_front' => true, 111 110 'hierarchical' => false, … … 121 120 'rewrite' => $rewrite, 122 121 ); 123 register_taxonomy( ' testimonial_category', array( 'gs_testimonial'), $args );122 register_taxonomy( 'gs_testimonial_category', array('gs_testimonial'), $args ); 124 123 } 125 124 -
gs-testimonial/trunk/includes/scripts.php
r3393636 r3393637 10 10 * @since 1.2.11 11 11 */ 12 class Scripts 13 { 12 class Scripts { 14 13 /** 15 14 * Contains styles handlers and paths. … … 17 16 * @since 1.0.0 18 17 */ 19 public $styles = array() ; 18 public $styles = []; 19 20 20 /** 21 21 * Contains scripts handlers and paths. … … 23 23 * @since 1.0.0 24 24 */ 25 public $scripts = array() ; 25 public $scripts = []; 26 26 27 /** 27 28 * Class constructor. … … 29 30 * @since 1.0.0 30 31 */ 31 public function __construct() 32 { 32 public function __construct() { 33 33 $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'] ); 37 37 return $this; 38 38 } 39 39 40 40 /** 41 41 * Adding assets on the $this->styles[] array. … … 43 43 * @since 1.0.0 44 44 */ 45 public function add_assets() 46 { 45 public function add_assets() { 47 46 // Styles 48 47 $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', 51 50 [], 52 51 GSTM_VERSION … … 54 53 $this->add_style( 55 54 'gs-swiper', 56 GSTM_PLUGIN_URI . ' assets/libs/swiper-js/swiper.min.css',55 GSTM_PLUGIN_URI . '/assets/libs/swiper-js/swiper.min.css', 57 56 [], 58 57 GSTM_VERSION … … 60 59 $this->add_style( 61 60 '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', 63 62 [], 64 63 GSTM_VERSION … … 66 65 $this->add_style( 67 66 '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', 69 68 [], 70 69 GSTM_VERSION … … 72 71 $this->add_style( 73 72 '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'], 76 75 GSTM_VERSION 77 76 ); … … 79 78 $this->add_script( 80 79 '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'], 83 82 GSTM_VERSION, 84 83 true … … 86 85 $this->add_script( 87 86 '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'], 90 89 GSTM_VERSION, 91 90 true … … 93 92 $this->add_script( 94 93 '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'], 97 103 GSTM_VERSION, 98 104 true … … 100 106 $this->add_script( 101 107 '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 109 115 /** 110 116 * Store styles on the $this->styles[] queue. … … 122 128 $handler, 123 129 $src, 124 $deps = array(),130 $deps = [], 125 131 $ver = false, 126 132 $media = 'all' 127 ) 128 { 133 ) { 129 134 $this->styles[$handler] = [ 130 135 'src' => $src, … … 134 139 ]; 135 140 } 136 141 137 142 /** 138 143 * Store scripts on the $this->scripts[] queue. … … 150 155 $handler, 151 156 $src, 152 $deps = array(),157 $deps = [], 153 158 $ver = false, 154 159 $in_footer = false 155 ) 156 { 160 ) { 157 161 $this->scripts[$handler] = [ 158 162 'src' => $src, … … 162 166 ]; 163 167 } 164 168 165 169 /** 166 170 * Return style if exits on the $this->styles[] list. … … 169 173 * @param string $handler The style name. 170 174 */ 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] ) ) { 174 177 return false; 175 178 } 176 179 return $style; 177 180 } 178 181 179 182 /** 180 183 * Return the script if exits on the $this->scripts[] list. … … 183 186 * @param string $handler The script name. 184 187 */ 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] ) ) { 188 190 return false; 189 191 } 190 192 return $script; 191 193 } 192 194 193 195 /** 194 196 * A wrapper for registering styles. … … 199 201 * @return boolean|void If it gets the stylesheet then register it or false. 200 202 */ 201 public function wp_register_style( $handler ) 202 { 203 public function wp_register_style( $handler ) { 203 204 $style = $this->get_style( $handler ); 204 205 if ( !$style ) { … … 214 215 ); 215 216 } 216 217 217 218 /** 218 219 * A wrapper for registering scripts. … … 224 225 * @return boolean|void If it gets the script then register it or false. 225 226 */ 226 public function wp_register_script( $handler ) 227 { 227 public function wp_register_script( $handler ) { 228 228 $script = $this->get_script( $handler ); 229 229 if ( !$script ) { … … 239 239 ); 240 240 } 241 241 242 242 /** 243 243 * Returns all publicly enqueuable stylesheets. … … 247 247 * @return array List of publicly enqueuable stylesheets. 248 248 */ 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 = [ 252 251 'gs-swiper', 253 252 'gs-bootstrap-grid', 254 'gs-magnific-popup', 255 'gs-font-awesome', 253 'gs-font-awesome-5', 256 254 'gs-testimonial-public' 257 ] ); 258 } 259 255 ]; 256 return (array) apply_filters( 'gs_testimonial_public_style_all', $styles ); 257 } 258 260 259 /** 261 260 * Returns all publicly enqueuable scripts. … … 265 264 * @return array List of publicly enqueuable scripts. 266 265 */ 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'] ) ) { 280 273 return; 281 274 } 282 275 $get_assets = sprintf( '_get_%s_%s_all', $group, $asset_type ); 283 276 $assets = $this->{$get_assets}(); 284 if ( !empty( $excludes) ) {277 if ( !empty( $excludes ) ) { 285 278 $assets = array_diff( $assets, $excludes ); 286 279 } 287 280 return (array) apply_filters( sprintf( 'gs_testimonial_%s__%s_all', $group, $asset_type ), $assets ); 288 281 } 289 282 290 283 public function _wp_load_assets_all( 291 284 $function, 292 285 $asset_type, 293 286 $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'] ) ) { 298 290 return; 299 291 } … … 304 296 } 305 297 } 306 307 public function wp_register_style_all( $group, $excludes = array() ) 308 { 298 299 public function wp_register_style_all( $group, $excludes = [] ) { 309 300 $this->_wp_load_assets_all( 310 301 'register', … … 314 305 ); 315 306 } 316 317 public function wp_enqueue_style_all( $group, $excludes = array() ) 318 { 307 308 public function wp_enqueue_style_all( $group, $excludes = [] ) { 319 309 $this->_wp_load_assets_all( 320 310 'enqueue', … … 324 314 ); 325 315 } 326 327 public function wp_register_script_all( $group, $excludes = array() ) 328 { 316 317 public function wp_register_script_all( $group, $excludes = [] ) { 329 318 $this->_wp_load_assets_all( 330 319 'register', … … 334 323 ); 335 324 } 336 337 public function wp_enqueue_script_all( $group, $excludes = array() ) 338 { 325 326 public function wp_enqueue_script_all( $group, $excludes = [] ) { 339 327 $this->_wp_load_assets_all( 340 328 'enqueue', … … 344 332 ); 345 333 } 346 334 347 335 // Use to direct enqueue 348 public function wp_enqueue_style( $handler ) 349 { 336 public function wp_enqueue_style( $handler ) { 350 337 $style = $this->get_style( $handler ); 351 338 if ( !$style ) { … … 361 348 ); 362 349 } 363 364 public function wp_enqueue_script( $handler ) 365 { 350 351 public function wp_enqueue_script( $handler ) { 366 352 $script = $this->get_script( $handler ); 367 353 if ( !$script ) { … … 377 363 ); 378 364 } 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 385 370 /** 386 371 * Enqueue assets for the plugin based on all dep checks and only … … 391 376 * @return void 392 377 */ 393 public function enqueue_frontend_scripts() 394 { 378 public function enqueue_frontend_scripts() { 395 379 // Register Styles 396 380 $this->wp_register_style_all( 'public' ); … … 398 382 $this->wp_register_script_all( 'public' ); 399 383 // 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'] ) ) { 401 385 wp_enqueue_style( 'gs-testimonial-public' ); 402 386 } … … 405 389 do_action( 'gs_testimonial_assets_loaded' ); 406 390 } 407 408 public function admin_enqueue_scripts( $hook ) 409 { 410 global $post ; 391 392 public function admin_enqueue_scripts( $hook ) { 393 global $post; 411 394 $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 } 412 401 if ( $hook == 'gs_testimonial_page_gst-shortcodes' ) { 413 402 $load_script = true; 414 403 } 415 // Allow scripts loading in new gs_te ammember page416 if ( $hook == 'post-new.php' && $ _GET['post_type']== 'gs_testimonial' ) {417 $load_script = true; 418 } 419 // Allow scripts loading in gs_te ammember edit page404 // 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 420 409 if ( $hook == 'post.php' && $post->post_type == 'gs_testimonial' ) { 421 410 $load_script = true; 422 411 } 423 // Allow scripts loading in gs_te ammember edit page424 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' ) { 428 417 $load_script = true; 429 418 } … … 432 421 return; 433 422 } 434 wp_register_style(435 'gs_free_plugins_css',436 GSTM_PLUGIN_URI . 'assets/css/gs_free_plugins.css',437 '',438 GSTM_VERSION439 );440 423 wp_enqueue_script( 441 424 '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'), 444 427 GSTM_VERSION, 445 428 true … … 447 430 wp_enqueue_style( 448 431 'gstm-star-rating', 449 GSTM_PLUGIN_URI . ' assets/rateit-js/rateit.css',450 '',432 GSTM_PLUGIN_URI . '/assets/rateit-js/rateit.css', 433 [], 451 434 GSTM_VERSION 452 435 ); 453 436 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 [], 457 440 GSTM_VERSION 458 441 ); 459 442 wp_enqueue_style( 460 443 'gstm-metabox', 461 GSTM_PLUGIN_URI . ' assets/css/gstm-metabox.css',462 '',444 GSTM_PLUGIN_URI . '/assets/css/gstm-metabox.css', 445 [], 463 446 GSTM_VERSION 464 447 ); 465 448 wp_enqueue_style( 466 449 '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 ) ) { 478 460 return; 479 461 } … … 484 466 } ); 485 467 } 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 ) ) { 491 472 return; 492 473 }
Note: See TracChangeset
for help on using the changeset viewer.