Changeset 3085399
- Timestamp:
- 05/13/2024 05:12:16 AM (3 months ago)
- Location:
- swatchly
- Files:
-
- 2 added
- 2 deleted
- 26 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
swatchly/tags/1.2.8/assets/css/admin.css
r2757572 r3085399 96 96 left: 0; 97 97 margin-left: 50% !important; 98 98 99 } 99 100 #TB_window #TB_title { -
swatchly/tags/1.2.8/includes/Admin.php
r3072081 r3085399 13 13 new Admin\Attribute_Taxonomy_Metabox(); 14 14 new Admin\Product_Metabox(); 15 new Admin\Rating_Notice();16 15 new Admin\Install_Manager\Install_Manager(); 16 17 17 18 18 // Add a top-level custom menu called "Swatchly" for the plugin … … 29 29 30 30 add_action('admin_footer', array( $this, 'pro_version_notice' )); 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 31 67 } 32 68 … … 58 94 function enqueue_admin_head_scripts() { 59 95 printf( '<style>%s</style>', '#adminmenu #toplevel_page_swatchly-admin a.swatchly-upgrade-pro { font-weight: 600; background-color: #ff6e30; color: #ffffff; text-align: center; margin-top: 8px;}' ); 60 $script ='(function ($) {96 '(function ($) { 61 97 $("#toplevel_page_swatchly-admin .wp-submenu a").each(function() { 62 98 if($(this)[0].href === "https://hasthemes.com/plugins/swatchly-product-variation-swatches-for-woocommerce-products/?utm_source=admin&utm_medium=mainmenu&utm_campaign=free#pricing") { … … 64 100 } 65 101 }) 66 })(jQuery);'; 67 printf( '<script>%s</script>', $script ); 102 })(jQuery);' ); 68 103 } 69 104 … … 109 144 110 145 // inline js for the settings submenu 111 $is_swatchly_setting = isset( $_GET['page'] ) ? sanitize_text_field($_GET['page']) : ''; 146 $is_swatchly_setting = isset( $_GET['page'] ) ? sanitize_text_field($_GET['page']) : ''; 112 147 $is_swatchly_setting = $is_swatchly_setting == 'swatchly-admin' ? 1 : 0; 113 148 wp_add_inline_script( 'swatchly-admin', 'var swatchly_is_settings_page = '. esc_js( $is_swatchly_setting ) .';'); -
swatchly/tags/1.2.8/includes/Admin/Attribute_Taxonomy_Metabox.php
r3072081 r3085399 18 18 */ 19 19 public function settings() { 20 $taxonomy = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : ''; 20 $taxonomy = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : ''; 21 21 $swatch_type = $this->get_taxonomy_swatch_type( $taxonomy ); 22 22 … … 80 80 'title' => esc_html__( 'Tooltip Image Size', 'swatchly' ), 81 81 'after' => sprintf( 82 82 83 esc_html__('Place the image size name here. WordPress default image sizes are: thumbnail, medium, medium_large, large and full. Custom image size also can be used. Leave it empty to use the vlaue from %s.', 'swatchly'), 83 84 '<a href="'. esc_url(admin_url('admin.php?page=swatchly-admin#tab=general-settings/global')) .'">' . esc_html__('global settings', 'swatchly') . '</a>' … … 134 135 135 136 $attr = substr( $taxonomy, 3 ); 136 $attr = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attr ) ); 137 $attr = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attr ) ); 137 138 $swatch_type = isset($attr->attribute_type) ? $attr->attribute_type : ''; 138 139 -
swatchly/tags/1.2.8/includes/Admin/Diagnostic_Data.php
r3072081 r3085399 99 99 }, 0 ); 100 100 101 add_action( 'plugins_loaded', function(){102 $agreed = ( isset( $_GET['swatchly_diagnostic_data_agreed'] ) ? sanitize_key( $_GET['swatchly_diagnostic_data_agreed'] ) : '' );103 101 add_action({ 102 ' ); 103 $agreed = isset( $_POST['agreed'] ) ? sanitize_key( $_POST['agreed'] ) : '' ; 104 104 if( $agreed === 'yes' ){ 105 $this->process_data( $agreed );105 $this->process_data( $agreed ); 106 106 } elseif( $agreed === 'no' ) { 107 $this->process_data( $agreed );107 $this->process_data( $agreed ); 108 108 } 109 }); 109 } ); 110 111 add_action('init', function () { 112 if (isset($_GET['action']) && $_GET['action'] === 'swatchly_diagnostic_data' && isset($_GET['_wpnonce'])) { 113 check_ajax_referer( 'swatchly-diagnostic-data-ajax-request' ); 114 $agreed = isset( $_GET['swatchly_diagnostic_data_agreed'] ) ? sanitize_key( $_GET['swatchly_diagnostic_data_agreed'] ) : ''; 115 if( $agreed === '1' ){ 116 $this->process_data( 'yes' ); 117 } elseif( $agreed === '0' ) { 118 $this->process_data( 'no' ); 119 } 120 } 121 } ); 110 122 } 111 123 … … 170 182 * Process data. 171 183 */ 172 private function process_data($agreed ) {184 private function process_data($agreed) { 173 185 $notice = 'no'; 174 186 … … 188 200 update_option( 'swatchly_diagnostic_data_agreed', $agreed ); 189 201 update_option( 'swatchly_diagnostic_data_notice', $notice ); 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 190 217 } 191 218 … … 470 497 */ 471 498 private function show_core_notice() { 472 499 $ajax_nonce = wp_create_nonce( "swatchly-diagnostic-data-ajax-request" ); 500 $ajax_url = admin_url( 'admin-ajax.php' ); 501 502 /* 503 * translators: %1$s: project name 504 * translators: %2$s: strong start tag 505 * translators: %3$s: strong end tag 506 * translators: %4$s: a tag start 507 * translators: %5$s: a tag end 508 */ 473 509 $message_l1 = sprintf( esc_html__( 'At %2$s%1$s%3$s, we prioritize continuous improvement and compatibility. To achieve this, we gather non-sensitive diagnostic information and details about plugin usage. This includes your site\'s URL, the versions of WordPress and PHP you\'re using, and a list of your installed plugins and themes. We also require your email address to provide you with exclusive discount coupons and updates. This data collection is crucial for ensuring that %2$s%1$s%3$s remains up-to-date and compatible with the most widely-used plugins and themes. Rest assured, your privacy is our priority – no spam, guaranteed. %4$sPrivacy Policy%5$s', 'swatchly' ), esc_html( $this->project_name ), '<strong>', '</strong>', '<a target="_blank" href="' . esc_url( $this->privacy_policy ) . '">', '</a>', '<h4 class="swatchly-diagnostic-data-title">', '</h4>' ); 474 510 511 512 513 514 475 515 $message_l2 = sprintf( esc_html__( 'Server information (Web server, PHP version, MySQL version), WordPress information, site name, site URL, number of plugins, number of users, your name, and email address. You can rest assured that no sensitive data will be collected or tracked. %1$sLearn more%2$s.', 'swatchly' ), '<a target="_blank" href="' . esc_url( $this->privacy_policy ) . '">', '</a>' ); 476 516 477 517 $button_text_1 = esc_html__( 'Count Me In', 'swatchly' ); 478 $button_link_1 = add_query_arg( array( 'swatchly_diagnostic_data_agreed' => 'yes') );518 $button_link_1 = add_query_arg( array( 'swatchly_diagnostic_data_agreed' => ) ); 479 519 480 520 $button_text_2 = esc_html__( 'No, Thanks', 'swatchly' ); 481 $button_link_2 = add_query_arg( array( 'swatchly_diagnostic_data_agreed' => 'no') );521 $button_link_2 = add_query_arg( array( 'swatchly_diagnostic_data_agreed' => ) ); 482 522 ?> 483 523 <div class="swatchly-diagnostic-data-style"><style>.swatchly-diagnostic-data-notice,.woocommerce-embed-page .swatchly-diagnostic-data-notice{padding-top:.75em;padding-bottom:.75em;}.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-buttons,.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-list,.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-message{padding:.25em 2px;margin:0;}.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-list{display:none;color:#646970;}.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-buttons{padding-top:.75em;}.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-buttons .button{margin-right:5px;box-shadow:none;}.swatchly-diagnostic-data-loading{position:relative;}.swatchly-diagnostic-data-loading::before{position:absolute;content:"";width:100%;height:100%;top:0;left:0;background-color:rgba(255,255,255,.5);z-index:999;}.swatchly-diagnostic-data-disagree{border-width:0px !important;background-color: transparent!important; padding: 0!important;}h4.swatchly-diagnostic-data-title {margin: 0 0 10px 0;font-size: 1.04em;font-weight: 600;}</style></div> 484 524 <div class="swatchly-diagnostic-data-notice notice notice-success"> 485 <h4 class="swatchly-diagnostic-data-title"><?php echo sprintf( esc_html__('🌟 Enhance Your %1$s Experience as a Valued Contributor!','swatchly'), esc_html( $this->project_name )); ?></h4> 525 <h4 class="swatchly-diagnostic-data-title"><?php 526 /* translators: %1$s: project name */ 527 echo sprintf( esc_html__('🌟 Enhance Your %1$s Experience as a Valued Contributor!','swatchly'), esc_html( $this->project_name )); 528 ?></h4> 486 529 <p class="swatchly-diagnostic-data-message"><?php echo wp_kses_post( $message_l1 ); ?></p> 487 530 <p class="swatchly-diagnostic-data-list"><?php echo wp_kses_post( $message_l2 ); ?></p> … … 491 534 </p> 492 535 </div> 536 493 537 <?php 538 539 540 541 542 543 544 545 546 547 494 548 } 495 549 -
swatchly/tags/1.2.8/includes/Admin/Global_Settings.php
r3072081 r3085399 217 217 'type' => 'image_select', 218 218 'title' => esc_html__('Shape Style', 'swatchly'), 219 'label' => esc_html__('', 'swatchly'),219 'label' => , 220 220 'options' => array( 221 221 'squared' => SWATCHLY_ASSETS . '/images/sqared.png', … … 263 263 'title' => esc_html__('Variation Label Separator', 'swatchly'), 264 264 'default' => esc_html__(' : ', 'swatchly'), 265 'after' => esc_html__('', 'swatchly'), 265 'after' => esc_html__('', 'swatchly'), 266 266 'dependency' => array( 'show_selected_attribute_name', '==', '1' ), 267 267 ), … … 392 392 'type' => 'image_select', 393 393 'title' => esc_html__('Shape Style', 'swatchly'), 394 'label' => esc_html__('', 'swatchly'),394 'label' => , 395 395 'options' => array( 396 396 'squared' => SWATCHLY_ASSETS . '/images/sqared.png', … … 443 443 'title' => esc_html__('Variation Label Separator', 'swatchly'), 444 444 'default' => esc_html__(' : ', 'swatchly'), 445 'after' => esc_html__('', 'swatchly'),445 'after' => , 446 446 'dependency' => array('sp_override_global|sp_show_selected_attribute_name', '==|==', '1|1') 447 447 ), … … 574 574 'type' => 'image_select', 575 575 'title' => esc_html__('Shape Style', 'swatchly'), 576 'label' => esc_html__('', 'swatchly'),576 'label' => , 577 577 'options' => array( 578 578 'squared' => SWATCHLY_ASSETS . '/images/sqared.png', … … 794 794 'type' => 'submessage', 795 795 'style' => 'info', 796 'content' => __( '<strong>Ajax Add to Cart Behaviour</strong>', 'swatchly' ),796 'content' => , 797 797 ), 798 798 array( -
swatchly/tags/1.2.8/includes/Admin/Install_Manager/Install_Manager.php
r2757572 r3085399 63 63 */ 64 64 public function activate_plugin(){ 65 if ( !current_user_can( 'install_plugins' ) || !isset( $_POST['location'] ) || !$_POST['location'] ) { 65 if ( !current_user_can( 'install_plugins' ) || !isset( $_POST['location'] ) || !$_POST['location'] ) { 66 66 wp_send_json_error( 67 67 array( … … 72 72 } 73 73 74 $plugin_file = ( isset( $_POST['location'] ) ) ? esc_attr( $_POST['location'] ) : ''; 74 $plugin_file = ( isset( $_POST['location'] ) ) ? esc_attr( $_POST['location'] ) : ''; 75 75 $activate = activate_plugin( $plugin_file, '', false, true ); 76 76 -
swatchly/tags/1.2.8/includes/Admin/Product_Metabox.php
r2850861 r3085399 79 79 } 80 80 81 if(isset( $_REQUEST['swatchly_product_meta'] )){ 82 $meta_data = map_deep( wp_unslash( $_REQUEST['swatchly_product_meta'] ), 'sanitize_text_field' ); 81 if(isset( $_REQUEST['swatchly_product_meta'] )){ 82 $meta_data = map_deep( wp_unslash( $_REQUEST['swatchly_product_meta'] ), 'sanitize_text_field' ); 83 83 update_post_meta( $product_id, '_swatchly_product_meta', $meta_data ); 84 84 } … … 218 218 <?php 219 219 if( $tooltip_image_id2 ){ 220 echo '<img src="'. wp_get_attachment_image_url($tooltip_image_id2, 'thumbnail') .'" />';220 echo '<img src="'. ) .'" />'; 221 221 } 222 222 ?> … … 237 237 <input type="text" name="swatchly_product_meta[<?php echo esc_attr($tax_name) ?>][tooltip_image_size]" id="swatchly_tooltip_image_size" class="short" value="<?php echo esc_attr($tooltip_image_size2) ?>"> 238 238 <?php 239 echo w c_help_tip( $tooltip_image_size_content);239 echo w); 240 240 ?> 241 241 </td> … … 328 328 <?php 329 329 if( $tooltip_image_id ){ 330 echo '<img src="'. wp_get_attachment_image_url($tooltip_image_id, 'thumbnail') .'" />';330 echo '<img src="'. ) .'" />'; 331 331 } 332 332 ?> … … 347 347 <input type="text" name="swatchly_product_meta[<?php echo esc_attr($tax_name) ?>][terms][<?php echo esc_attr($term_id) ?>][tooltip_image_size]" id="swatchly_tooltip_image_size" class="short" value="<?php echo esc_attr($tooltip_image_size) ?>"> 348 348 <?php 349 echo w c_help_tip( $tooltip_image_size_content);349 echo w); 350 350 ?> 351 351 </td> … … 378 378 <?php 379 379 if( $image_id ){ 380 echo '<img src="'. wp_get_attachment_image_url($image_id, 'thumbnail') .'" />';380 echo '<img src="'. ) .'" />'; 381 381 } 382 382 ?> … … 397 397 <input type="text" name="swatchly_product_meta[<?php echo esc_attr($tax_name) ?>][terms][<?php echo esc_attr($term_id) ?>][image_size]" id="swatchly_image_size" class="short" value="<?php echo esc_attr($image_size) ?>"> 398 398 <?php 399 echo w c_help_tip( $tooltip_image_size_content);399 echo w); 400 400 ?> 401 401 </td> -
swatchly/tags/1.2.8/includes/Admin/Woo_Config.php
r2555867 r3085399 15 15 16 16 // Swatch type preview column 17 $taxonomy = isset($_GET['taxonomy']) ? sanitize_title( $_GET['taxonomy'] ) : ''; 17 $taxonomy = isset($_GET['taxonomy']) ? sanitize_title( $_GET['taxonomy'] ) : ''; 18 18 add_filter( 'manage_edit-'. $taxonomy .'_columns', array( $this, 'add_new_attribute_column') ); 19 19 add_filter( 'manage_'. $taxonomy .'_custom_column', array( $this, 'add_swatch_preview_markup' ), 10, 3 ); … … 43 43 public function add_new_attribute_column( $columns ){ 44 44 global $taxnow; 45 $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : ''; 45 $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : ''; 46 46 if($request_taxonomy !== $taxnow){ 47 47 return $columns; … … 68 68 public function add_swatch_preview_markup( $columns, $column, $term_id ){ 69 69 global $taxnow; 70 $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : ''; 70 $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : ''; 71 71 if( ($request_taxonomy !== $taxnow) || ('thumb' !== $column)){ 72 72 return $columns; -
swatchly/tags/1.2.8/includes/Admin/recommendations/Recommended_Plugins.php
r2896476 r3085399 67 67 68 68 // Initialize properties 69 $this->text_domain = !empty( $args['text_domain'] ) ? $args['text_domain'] : 'htrp';69 $this->text_domain = !empty( $args['text_domain'] ) ? $args['text_domain'] : 'htrp'; 70 70 $this->parent_menu_slug = !empty( $args['parent_menu_slug'] ) ? $args['parent_menu_slug'] : 'plugins.php'; 71 $this->menu_label = !empty( $args['menu_label'] ) ? $args['menu_label'] : esc_html__( 'Recommendations', $this->text_domain);71 $this->menu_label = !empty( $args['menu_label'] ) ? $args['menu_label'] : esc_html__( 'Recommendations', ); 72 72 $this->menu_capability = !empty( $args['menu_capability'] ) ? $args['menu_capability'] : 'manage_options'; 73 $this->menu_page_slug = !empty( $args['menu_page_slug'] ) ? $args['menu_page_slug'] : $this->text_domain . '_extensions';73 $this->menu_page_slug = !empty( $args['menu_page_slug'] ) ? $args['menu_page_slug'] : _extensions'; 74 74 $this->priority = !empty( $args['priority'] ) ? $args['priority'] : 100; 75 75 $this->hook_suffix = !empty( $args['hook_suffix'] ) ? $args['hook_suffix'] : ''; … … 82 82 83 83 // Ajax Action 84 add_action( 'wp_ajax_ '.$this->text_domain.'_ajax_plugin_activation', [ $this, 'plugin_activation' ] );84 add_action( 'wp_ajax__ajax_plugin_activation', [ $this, 'plugin_activation' ] ); 85 85 86 86 } … … 118 118 119 119 $localize_vars['ajaxurl'] = admin_url('admin-ajax.php'); 120 $localize_vars['text_domain'] = sanitize_title_with_dashes( $this->text_domain);120 $localize_vars['text_domain'] = sanitize_title_with_dashes( ); 121 121 $localize_vars['nonce'] = wp_create_nonce('htrp_nonce'); 122 122 $localize_vars['buttontxt'] = array( 123 'buynow' => esc_html__( 'Buy Now', $this->text_domain),124 'preview' => esc_html__( 'Preview', $this->text_domain),125 'installing' => esc_html__( 'Installing..', $this->text_domain),126 'activating' => esc_html__( 'Activating..', $this->text_domain),127 'active' => esc_html__( 'Activated', $this->text_domain),123 'buynow' => esc_html__( 'Buy Now', ), 124 'preview' => esc_html__( 'Preview', ), 125 'installing' => esc_html__( 'Installing..', ), 126 'activating' => esc_html__( 'Activating..', ), 127 'active' => esc_html__( 'Activated', ), 128 128 ); 129 129 wp_localize_script( 'htrp-plugin-install-manager', 'htrp_params', $localize_vars ); … … 159 159 ?> 160 160 <div class="wrap"> 161 <h2><?php echo get_admin_page_title(); ?></h2>161 <h2><?php echo ); ?></h2> 162 162 <style> 163 163 .htrp-admin-tab-pane{ … … 218 218 $title = wp_kses( $title, $this->plugins_allowedtags ); 219 219 $image_url = $this->plugin_icon( $plugins_type, $prepare_plugin[$data['slug']]['icons'] ); 220 $description = strip_tags( $prepare_plugin[$data['slug']]['description'] );220 $description = _tags( $prepare_plugin[$data['slug']]['description'] ); 221 221 $author_name = wp_kses( $prepare_plugin[$data['slug']]['author'], $this->plugins_allowedtags ); 222 222 $details_link = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] .'&TB_iframe=true&width=772&height=577'); … … 229 229 $image_url = $this->plugin_icon( $plugins_type, $plugin['slug'] ); 230 230 $description = isset($plugin['description']) ? $plugin['description'] : ''; 231 $author_name = esc_html__( 'HasTheme', $this->text_domain);231 $author_name = esc_html__( 'HasTheme', ); 232 232 $author_link = isset($plugin['author_link']) ? $plugin['author_link'] : ''; 233 233 $details_link = isset($plugin['link']) ? $plugin['link'] : ''; 234 $button_text = esc_html__('Buy Now', $this->text_domain);234 $button_text = esc_html__('Buy Now', ); 235 235 $button_classes = 'button button-primary'; 236 236 $target = '_blank'; … … 244 244 245 245 $button_classes = 'button activate-now button-primary'; 246 $button_text = esc_html__( 'Activate', $this->text_domain);246 $button_text = esc_html__( 'Activate', ); 247 247 248 248 // Not Installed. … … 250 250 251 251 $button_classes = 'button install-now'; 252 $button_text = esc_html__( 'Install Now', $this->text_domain);252 $button_text = esc_html__( 'Install Now', ); 253 253 254 254 // Active. 255 255 } else { 256 256 $button_classes = 'button disabled'; 257 $button_text = esc_html__( 'Activated', $this->text_domain);257 $button_text = esc_html__( 'Activated', ); 258 258 } 259 259 … … 263 263 <div class="name column-name" style="margin-right: 0;"> 264 264 <h3> 265 <a href="<?php echo esc_url( $details_link ) ?>" target="<?php echo esc_attr( $target ) ?>" <?php echo $modal_class; ?>>265 <a href="<?php echo esc_url( $details_link ) ?>" target="<?php echo esc_attr( $target ) ?>" <?php echo ; ?>> 266 266 <?php echo esc_html( $title ) ?> 267 267 <img src="<?php echo esc_url( $image_url ) ?>" class="plugin-icon" alt="<?php echo esc_attr( $title ) ?>"> … … 270 270 </div> 271 271 <div class="desc column-description" style="margin-right: 0;"> 272 <p><?php echo wp_ trim_words( $description, 23, '....'); ?></p>272 <p><?php echo wp_); ?></p> 273 273 <p class="authors"> 274 <cite><?php echo esc_html__( 'By ', $this->text_domain); ?>274 <cite><?php echo esc_html__( 'By ', ); ?> 275 275 <?php if( $plugins_type == 'free' ): ?> 276 <?php echo $author_name; ?>276 <?php echo ; ?> 277 277 <?php else: ?> 278 <a href="<?php echo esc_url( $author_link ); ?>" target="_blank" ><?php echo $author_name; ?></a>278 <a href="<?php echo esc_url( $author_link ); ?>" target="_blank" ><?php echo ; ?></a> 279 279 <?php endif; ?> 280 280 </cite> … … 286 286 <?php 287 287 if (! file_exists( WP_PLUGIN_DIR . '/' . $data['location'] ) && $plugins_type == 'pro' ) { 288 echo '<a class="button button-primary" href="'.esc_url( $details_link ).'" target="'.esc_attr( $target ).'">'.esc_html__( 'Buy Now', $this->text_domain).'</a>';288 echo '<a class="button button-primary" href="'.esc_url( $details_link ).'" target="'.esc_attr( $target ).'">'.esc_html__( 'Buy Now', ).'</a>'; 289 289 }else{ 290 290 ?> 291 <button class="<?php echo $button_classes; ?>" data-pluginopt='<?php echo wp_json_encode( $data ); ?>'><?php echo $button_text; ?></button>291 <button class="<?php echo ; ?></button> 292 292 293 293 <?php } ?> 294 294 </div> 295 295 <div class="column-downloaded"> 296 <a href="<?php echo esc_url( $details_link ) ?>" target="<?php echo esc_attr( $target ) ?>" <?php echo $modal_class; ?>><?php echo esc_html__('More Details', $this->text_domain) ?></a>296 <a href="<?php echo esc_url( $details_link ) ?>" target="<?php echo esc_attr( $target ) ?>" <?php echo ) ?></a> 297 297 <span class="downloaded-count"> 298 298 <?php 299 299 if( $plugins_type == 'free' ){ 300 300 /* translators: %s: Number of installations. */ 301 printf( __( '%s Active Installations' ), $this->active_install_count( $prepare_plugin[$data['slug']]['active_installs']) );301 printf( ) ); 302 302 } 303 303 ?> … … 397 397 array( 398 398 'success' => false, 399 'message' => esc_html__( 'Plugin Not Found', $this->text_domain),399 'message' => esc_html__( 'Plugin Not Found', ), 400 400 ) 401 401 ); … … 417 417 array( 418 418 'success' => true, 419 'message' => esc_html__( 'Plugin Successfully Activated', $this->text_domain),419 'message' => esc_html__( 'Plugin Successfully Activated', ), 420 420 ) 421 421 ); -
swatchly/tags/1.2.8/includes/Frontend/Woo_Config.php
r2893238 r3085399 608 608 global $product; 609 609 610 $request_data = wp_unslash($_REQUEST); 610 $request_data = wp_unslash($_REQUEST); 611 611 $is_elementor_preview = isset($request_data['elementor-preview']) || (isset($request_data['action']) && $request_data['action'] == 'elementor' ) || is_admin(); 612 612 … … 648 648 ob_start(); 649 649 ?> 650 <form class="swatchly_loop_variation_form variations_form swatchly_align_<?php echo esc_attr($align); ?>" data-product_variations="<?php echo esc_attr( $variations_json ); ?>" data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo $variations_attr; // WPCS: XSS ok. ?>">650 <form class="swatchly_loop_variation_form variations_form swatchly_align_<?php echo esc_attr($align); ?>" data-product_variations="<?php echo esc_attr( $variations_json ); ?>" data-product_id="<?php echo ; // WPCS: XSS ok. ?>"> 651 651 652 652 <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?> … … 658 658 <tr> 659 659 <?php if(swatchly_get_option('pl_show_swatches_label')): ?> 660 <td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name); // WPCS: XSS ok. ?></label></td>660 <td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo ); // WPCS: XSS ok. ?></label></td> 661 661 <?php endif; ?> 662 662 … … 716 716 $variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true ); 717 717 ?> 718 <div class="swatchly_loop_variation_form variations_form swatchly_align_<?php echo esc_attr($align); ?>" data-product_variations="<?php echo esc_attr( $variations_json ); ?>" data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo $variations_attr; // WPCS: XSS ok. ?>">718 <div class="swatchly_loop_variation_form variations_form swatchly_align_<?php echo esc_attr($align); ?>" data-product_variations="<?php echo esc_attr( $variations_json ); ?>" data-product_id="<?php echo ; // WPCS: XSS ok. ?>"> 719 719 720 720 <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?> … … 726 726 <tr> 727 727 <?php if(swatchly_get_option('pl_show_swatches_label')): ?> 728 <td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name); // WPCS: XSS ok. ?></label></td>728 <td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo ); // WPCS: XSS ok. ?></label></td> 729 729 <?php endif; ?> 730 730 -
swatchly/tags/1.2.8/includes/ajax-actions.php
r2757572 r3085399 3 3 exit; // Exit if accessed directly. 4 4 } 5 6 /**7 * Ajax WooCommerce notices.8 */9 function swatchly_ajax_add_to_cart_notice() {10 wc_print_notices();11 wp_die();12 }13 14 if( swatchly_get_option('pl_enable_ajax_add_to_cart') && swatchly_get_option('pl_enable_cart_popup_notice') ){15 // generate ajax add to cart notice16 add_action( 'wp_ajax_swatchly_ajax_add_to_cart_notice', 'swatchly_ajax_add_to_cart_notice' );17 add_action( 'wp_ajax_nopriv_swatchly_ajax_add_to_cart_notice', 'swatchly_ajax_add_to_cart_notice' );18 }19 20 /**21 * AJAX add to cart.22 */23 function swatchly_ajax_add_to_cart() {24 if ( ! isset( $_POST['product_id'] ) ) {25 return;26 }27 28 $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_POST['product_id'] ) );29 $product_title = get_the_title( $product_id );30 $quantity = ! empty( $_POST['quantity'] ) ? wc_stock_amount( absint( $_POST['quantity'] ) ) : 1;31 $product_status = get_post_status( $product_id );32 $variation_id = ! empty( $_POST['variation_id'] ) ? absint( $_POST['variation_id'] ) : 0;33 $variation = ! empty( $_POST['variation'] ) ? array_map( 'sanitize_text_field', $_POST['variation'] ) : array();34 $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variation );35 $cart_page_url = wc_get_cart_url();36 37 if ( $passed_validation && false !== WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variation ) && 'publish' === $product_status ) {38 39 do_action( 'woocommerce_ajax_added_to_cart', $product_id );40 41 if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {42 wc_add_to_cart_message( array( $product_id => $quantity ), true );43 } else {44 $added_to_cart_notice = sprintf(45 /* translators: %s: Product title */46 esc_html__( '"%1$s" has been added to your cart. %2$s', 'swatchly' ),47 esc_html( $product_title ),48 '<a href="' . esc_url( $cart_page_url ) . '">' . esc_html__( 'View Cart', 'swatchly' ) . '</a>'49 );50 51 wc_add_notice( $added_to_cart_notice );52 }53 54 WC_AJAX::get_refreshed_fragments();55 56 } else {57 58 // If there was an error adding to the cart, redirect to the product page to show any errors.59 $data = array(60 'error' => true,61 'product_url' => apply_filters( 'woocommerce_cart_redirect_after_error', get_permalink( $product_id ), $product_id ),62 );63 64 wp_send_json( $data );65 }66 }67 add_action( 'wp_ajax_swatchly_ajax_add_to_cart', 'swatchly_ajax_add_to_cart' );68 add_action( 'wp_ajax_nopriv_swatchly_ajax_add_to_cart', 'swatchly_ajax_add_to_cart' );69 5 70 6 /** -
swatchly/tags/1.2.8/includes/functions.php
r2757572 r3085399 121 121 122 122 $attr = substr( $taxonomy, 3 ); 123 $attr = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attr ) ); 123 $attr = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attr ) ); 124 124 $swatch_type = isset($attr->attribute_type) ? $attr->attribute_type : ''; 125 125 -
swatchly/tags/1.2.8/swatchly.php
r3073087 r3085399 4 4 * Plugin URI: https://plugindemo.hasthemes.com/swatchly/ 5 5 * Description: Variation Swatches for WooCommerce Products 6 * Version: 1.2. 76 * Version: 1.2. 7 7 * Author: HasThemes 8 8 * Author URI: https://hasthemes.com … … 30 30 * @since 1.0.0 31 31 */ 32 public $version = '1.2. 7';32 public $version = '1.2.'; 33 33 34 34 /** … … 109 109 require_once SWATCHLY_PATH .'/includes/Admin/recommendations/init.php'; 110 110 require_once SWATCHLY_PATH .'/includes/Admin/Diagnostic_Data.php'; 111 111 112 } 112 113 } … … 176 177 delete_transient( 'swatchly_do_activation_redirect' ); 177 178 178 exit( wp_redirect("admin.php?page=swatchly-welcome") );179 exit( ) ); 179 180 } 180 181 } … … 224 225 ); 225 226 226 printf( '<div class="notice notice-warning"><p>%1$s</p></div>', $message);227 printf( '<div class="notice notice-warning"><p>%1$s</p></div>', ); 227 228 } 228 229 -
swatchly/trunk/assets/css/admin.css
r2757572 r3085399 96 96 left: 0; 97 97 margin-left: 50% !important; 98 98 99 } 99 100 #TB_window #TB_title { -
swatchly/trunk/includes/Admin.php
r3072081 r3085399 13 13 new Admin\Attribute_Taxonomy_Metabox(); 14 14 new Admin\Product_Metabox(); 15 new Admin\Rating_Notice();16 15 new Admin\Install_Manager\Install_Manager(); 16 17 17 18 18 // Add a top-level custom menu called "Swatchly" for the plugin … … 29 29 30 30 add_action('admin_footer', array( $this, 'pro_version_notice' )); 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 31 67 } 32 68 … … 58 94 function enqueue_admin_head_scripts() { 59 95 printf( '<style>%s</style>', '#adminmenu #toplevel_page_swatchly-admin a.swatchly-upgrade-pro { font-weight: 600; background-color: #ff6e30; color: #ffffff; text-align: center; margin-top: 8px;}' ); 60 $script ='(function ($) {96 '(function ($) { 61 97 $("#toplevel_page_swatchly-admin .wp-submenu a").each(function() { 62 98 if($(this)[0].href === "https://hasthemes.com/plugins/swatchly-product-variation-swatches-for-woocommerce-products/?utm_source=admin&utm_medium=mainmenu&utm_campaign=free#pricing") { … … 64 100 } 65 101 }) 66 })(jQuery);'; 67 printf( '<script>%s</script>', $script ); 102 })(jQuery);' ); 68 103 } 69 104 … … 109 144 110 145 // inline js for the settings submenu 111 $is_swatchly_setting = isset( $_GET['page'] ) ? sanitize_text_field($_GET['page']) : ''; 146 $is_swatchly_setting = isset( $_GET['page'] ) ? sanitize_text_field($_GET['page']) : ''; 112 147 $is_swatchly_setting = $is_swatchly_setting == 'swatchly-admin' ? 1 : 0; 113 148 wp_add_inline_script( 'swatchly-admin', 'var swatchly_is_settings_page = '. esc_js( $is_swatchly_setting ) .';'); -
swatchly/trunk/includes/Admin/Attribute_Taxonomy_Metabox.php
r3072081 r3085399 18 18 */ 19 19 public function settings() { 20 $taxonomy = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : ''; 20 $taxonomy = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : ''; 21 21 $swatch_type = $this->get_taxonomy_swatch_type( $taxonomy ); 22 22 … … 80 80 'title' => esc_html__( 'Tooltip Image Size', 'swatchly' ), 81 81 'after' => sprintf( 82 82 83 esc_html__('Place the image size name here. WordPress default image sizes are: thumbnail, medium, medium_large, large and full. Custom image size also can be used. Leave it empty to use the vlaue from %s.', 'swatchly'), 83 84 '<a href="'. esc_url(admin_url('admin.php?page=swatchly-admin#tab=general-settings/global')) .'">' . esc_html__('global settings', 'swatchly') . '</a>' … … 134 135 135 136 $attr = substr( $taxonomy, 3 ); 136 $attr = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attr ) ); 137 $attr = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attr ) ); 137 138 $swatch_type = isset($attr->attribute_type) ? $attr->attribute_type : ''; 138 139 -
swatchly/trunk/includes/Admin/Diagnostic_Data.php
r3072081 r3085399 99 99 }, 0 ); 100 100 101 add_action( 'plugins_loaded', function(){102 $agreed = ( isset( $_GET['swatchly_diagnostic_data_agreed'] ) ? sanitize_key( $_GET['swatchly_diagnostic_data_agreed'] ) : '' );103 101 add_action({ 102 ' ); 103 $agreed = isset( $_POST['agreed'] ) ? sanitize_key( $_POST['agreed'] ) : '' ; 104 104 if( $agreed === 'yes' ){ 105 $this->process_data( $agreed );105 $this->process_data( $agreed ); 106 106 } elseif( $agreed === 'no' ) { 107 $this->process_data( $agreed );107 $this->process_data( $agreed ); 108 108 } 109 }); 109 } ); 110 111 add_action('init', function () { 112 if (isset($_GET['action']) && $_GET['action'] === 'swatchly_diagnostic_data' && isset($_GET['_wpnonce'])) { 113 check_ajax_referer( 'swatchly-diagnostic-data-ajax-request' ); 114 $agreed = isset( $_GET['swatchly_diagnostic_data_agreed'] ) ? sanitize_key( $_GET['swatchly_diagnostic_data_agreed'] ) : ''; 115 if( $agreed === '1' ){ 116 $this->process_data( 'yes' ); 117 } elseif( $agreed === '0' ) { 118 $this->process_data( 'no' ); 119 } 120 } 121 } ); 110 122 } 111 123 … … 170 182 * Process data. 171 183 */ 172 private function process_data($agreed ) {184 private function process_data($agreed) { 173 185 $notice = 'no'; 174 186 … … 188 200 update_option( 'swatchly_diagnostic_data_agreed', $agreed ); 189 201 update_option( 'swatchly_diagnostic_data_notice', $notice ); 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 190 217 } 191 218 … … 470 497 */ 471 498 private function show_core_notice() { 472 499 $ajax_nonce = wp_create_nonce( "swatchly-diagnostic-data-ajax-request" ); 500 $ajax_url = admin_url( 'admin-ajax.php' ); 501 502 /* 503 * translators: %1$s: project name 504 * translators: %2$s: strong start tag 505 * translators: %3$s: strong end tag 506 * translators: %4$s: a tag start 507 * translators: %5$s: a tag end 508 */ 473 509 $message_l1 = sprintf( esc_html__( 'At %2$s%1$s%3$s, we prioritize continuous improvement and compatibility. To achieve this, we gather non-sensitive diagnostic information and details about plugin usage. This includes your site\'s URL, the versions of WordPress and PHP you\'re using, and a list of your installed plugins and themes. We also require your email address to provide you with exclusive discount coupons and updates. This data collection is crucial for ensuring that %2$s%1$s%3$s remains up-to-date and compatible with the most widely-used plugins and themes. Rest assured, your privacy is our priority – no spam, guaranteed. %4$sPrivacy Policy%5$s', 'swatchly' ), esc_html( $this->project_name ), '<strong>', '</strong>', '<a target="_blank" href="' . esc_url( $this->privacy_policy ) . '">', '</a>', '<h4 class="swatchly-diagnostic-data-title">', '</h4>' ); 474 510 511 512 513 514 475 515 $message_l2 = sprintf( esc_html__( 'Server information (Web server, PHP version, MySQL version), WordPress information, site name, site URL, number of plugins, number of users, your name, and email address. You can rest assured that no sensitive data will be collected or tracked. %1$sLearn more%2$s.', 'swatchly' ), '<a target="_blank" href="' . esc_url( $this->privacy_policy ) . '">', '</a>' ); 476 516 477 517 $button_text_1 = esc_html__( 'Count Me In', 'swatchly' ); 478 $button_link_1 = add_query_arg( array( 'swatchly_diagnostic_data_agreed' => 'yes') );518 $button_link_1 = add_query_arg( array( 'swatchly_diagnostic_data_agreed' => ) ); 479 519 480 520 $button_text_2 = esc_html__( 'No, Thanks', 'swatchly' ); 481 $button_link_2 = add_query_arg( array( 'swatchly_diagnostic_data_agreed' => 'no') );521 $button_link_2 = add_query_arg( array( 'swatchly_diagnostic_data_agreed' => ) ); 482 522 ?> 483 523 <div class="swatchly-diagnostic-data-style"><style>.swatchly-diagnostic-data-notice,.woocommerce-embed-page .swatchly-diagnostic-data-notice{padding-top:.75em;padding-bottom:.75em;}.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-buttons,.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-list,.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-message{padding:.25em 2px;margin:0;}.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-list{display:none;color:#646970;}.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-buttons{padding-top:.75em;}.swatchly-diagnostic-data-notice .swatchly-diagnostic-data-buttons .button{margin-right:5px;box-shadow:none;}.swatchly-diagnostic-data-loading{position:relative;}.swatchly-diagnostic-data-loading::before{position:absolute;content:"";width:100%;height:100%;top:0;left:0;background-color:rgba(255,255,255,.5);z-index:999;}.swatchly-diagnostic-data-disagree{border-width:0px !important;background-color: transparent!important; padding: 0!important;}h4.swatchly-diagnostic-data-title {margin: 0 0 10px 0;font-size: 1.04em;font-weight: 600;}</style></div> 484 524 <div class="swatchly-diagnostic-data-notice notice notice-success"> 485 <h4 class="swatchly-diagnostic-data-title"><?php echo sprintf( esc_html__('🌟 Enhance Your %1$s Experience as a Valued Contributor!','swatchly'), esc_html( $this->project_name )); ?></h4> 525 <h4 class="swatchly-diagnostic-data-title"><?php 526 /* translators: %1$s: project name */ 527 echo sprintf( esc_html__('🌟 Enhance Your %1$s Experience as a Valued Contributor!','swatchly'), esc_html( $this->project_name )); 528 ?></h4> 486 529 <p class="swatchly-diagnostic-data-message"><?php echo wp_kses_post( $message_l1 ); ?></p> 487 530 <p class="swatchly-diagnostic-data-list"><?php echo wp_kses_post( $message_l2 ); ?></p> … … 491 534 </p> 492 535 </div> 536 493 537 <?php 538 539 540 541 542 543 544 545 546 547 494 548 } 495 549 -
swatchly/trunk/includes/Admin/Global_Settings.php
r3072081 r3085399 217 217 'type' => 'image_select', 218 218 'title' => esc_html__('Shape Style', 'swatchly'), 219 'label' => esc_html__('', 'swatchly'),219 'label' => , 220 220 'options' => array( 221 221 'squared' => SWATCHLY_ASSETS . '/images/sqared.png', … … 263 263 'title' => esc_html__('Variation Label Separator', 'swatchly'), 264 264 'default' => esc_html__(' : ', 'swatchly'), 265 'after' => esc_html__('', 'swatchly'), 265 'after' => esc_html__('', 'swatchly'), 266 266 'dependency' => array( 'show_selected_attribute_name', '==', '1' ), 267 267 ), … … 392 392 'type' => 'image_select', 393 393 'title' => esc_html__('Shape Style', 'swatchly'), 394 'label' => esc_html__('', 'swatchly'),394 'label' => , 395 395 'options' => array( 396 396 'squared' => SWATCHLY_ASSETS . '/images/sqared.png', … … 443 443 'title' => esc_html__('Variation Label Separator', 'swatchly'), 444 444 'default' => esc_html__(' : ', 'swatchly'), 445 'after' => esc_html__('', 'swatchly'),445 'after' => , 446 446 'dependency' => array('sp_override_global|sp_show_selected_attribute_name', '==|==', '1|1') 447 447 ), … … 574 574 'type' => 'image_select', 575 575 'title' => esc_html__('Shape Style', 'swatchly'), 576 'label' => esc_html__('', 'swatchly'),576 'label' => , 577 577 'options' => array( 578 578 'squared' => SWATCHLY_ASSETS . '/images/sqared.png', … … 794 794 'type' => 'submessage', 795 795 'style' => 'info', 796 'content' => __( '<strong>Ajax Add to Cart Behaviour</strong>', 'swatchly' ),796 'content' => , 797 797 ), 798 798 array( -
swatchly/trunk/includes/Admin/Install_Manager/Install_Manager.php
r2757572 r3085399 63 63 */ 64 64 public function activate_plugin(){ 65 if ( !current_user_can( 'install_plugins' ) || !isset( $_POST['location'] ) || !$_POST['location'] ) { 65 if ( !current_user_can( 'install_plugins' ) || !isset( $_POST['location'] ) || !$_POST['location'] ) { 66 66 wp_send_json_error( 67 67 array( … … 72 72 } 73 73 74 $plugin_file = ( isset( $_POST['location'] ) ) ? esc_attr( $_POST['location'] ) : ''; 74 $plugin_file = ( isset( $_POST['location'] ) ) ? esc_attr( $_POST['location'] ) : ''; 75 75 $activate = activate_plugin( $plugin_file, '', false, true ); 76 76 -
swatchly/trunk/includes/Admin/Product_Metabox.php
r2850861 r3085399 79 79 } 80 80 81 if(isset( $_REQUEST['swatchly_product_meta'] )){ 82 $meta_data = map_deep( wp_unslash( $_REQUEST['swatchly_product_meta'] ), 'sanitize_text_field' ); 81 if(isset( $_REQUEST['swatchly_product_meta'] )){ 82 $meta_data = map_deep( wp_unslash( $_REQUEST['swatchly_product_meta'] ), 'sanitize_text_field' ); 83 83 update_post_meta( $product_id, '_swatchly_product_meta', $meta_data ); 84 84 } … … 218 218 <?php 219 219 if( $tooltip_image_id2 ){ 220 echo '<img src="'. wp_get_attachment_image_url($tooltip_image_id2, 'thumbnail') .'" />';220 echo '<img src="'. ) .'" />'; 221 221 } 222 222 ?> … … 237 237 <input type="text" name="swatchly_product_meta[<?php echo esc_attr($tax_name) ?>][tooltip_image_size]" id="swatchly_tooltip_image_size" class="short" value="<?php echo esc_attr($tooltip_image_size2) ?>"> 238 238 <?php 239 echo w c_help_tip( $tooltip_image_size_content);239 echo w); 240 240 ?> 241 241 </td> … … 328 328 <?php 329 329 if( $tooltip_image_id ){ 330 echo '<img src="'. wp_get_attachment_image_url($tooltip_image_id, 'thumbnail') .'" />';330 echo '<img src="'. ) .'" />'; 331 331 } 332 332 ?> … … 347 347 <input type="text" name="swatchly_product_meta[<?php echo esc_attr($tax_name) ?>][terms][<?php echo esc_attr($term_id) ?>][tooltip_image_size]" id="swatchly_tooltip_image_size" class="short" value="<?php echo esc_attr($tooltip_image_size) ?>"> 348 348 <?php 349 echo w c_help_tip( $tooltip_image_size_content);349 echo w); 350 350 ?> 351 351 </td> … … 378 378 <?php 379 379 if( $image_id ){ 380 echo '<img src="'. wp_get_attachment_image_url($image_id, 'thumbnail') .'" />';380 echo '<img src="'. ) .'" />'; 381 381 } 382 382 ?> … … 397 397 <input type="text" name="swatchly_product_meta[<?php echo esc_attr($tax_name) ?>][terms][<?php echo esc_attr($term_id) ?>][image_size]" id="swatchly_image_size" class="short" value="<?php echo esc_attr($image_size) ?>"> 398 398 <?php 399 echo w c_help_tip( $tooltip_image_size_content);399 echo w); 400 400 ?> 401 401 </td> -
swatchly/trunk/includes/Admin/Woo_Config.php
r2555867 r3085399 15 15 16 16 // Swatch type preview column 17 $taxonomy = isset($_GET['taxonomy']) ? sanitize_title( $_GET['taxonomy'] ) : ''; 17 $taxonomy = isset($_GET['taxonomy']) ? sanitize_title( $_GET['taxonomy'] ) : ''; 18 18 add_filter( 'manage_edit-'. $taxonomy .'_columns', array( $this, 'add_new_attribute_column') ); 19 19 add_filter( 'manage_'. $taxonomy .'_custom_column', array( $this, 'add_swatch_preview_markup' ), 10, 3 ); … … 43 43 public function add_new_attribute_column( $columns ){ 44 44 global $taxnow; 45 $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : ''; 45 $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : ''; 46 46 if($request_taxonomy !== $taxnow){ 47 47 return $columns; … … 68 68 public function add_swatch_preview_markup( $columns, $column, $term_id ){ 69 69 global $taxnow; 70 $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : ''; 70 $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : ''; 71 71 if( ($request_taxonomy !== $taxnow) || ('thumb' !== $column)){ 72 72 return $columns; -
swatchly/trunk/includes/Admin/recommendations/Recommended_Plugins.php
r2896476 r3085399 67 67 68 68 // Initialize properties 69 $this->text_domain = !empty( $args['text_domain'] ) ? $args['text_domain'] : 'htrp';69 $this->text_domain = !empty( $args['text_domain'] ) ? $args['text_domain'] : 'htrp'; 70 70 $this->parent_menu_slug = !empty( $args['parent_menu_slug'] ) ? $args['parent_menu_slug'] : 'plugins.php'; 71 $this->menu_label = !empty( $args['menu_label'] ) ? $args['menu_label'] : esc_html__( 'Recommendations', $this->text_domain);71 $this->menu_label = !empty( $args['menu_label'] ) ? $args['menu_label'] : esc_html__( 'Recommendations', ); 72 72 $this->menu_capability = !empty( $args['menu_capability'] ) ? $args['menu_capability'] : 'manage_options'; 73 $this->menu_page_slug = !empty( $args['menu_page_slug'] ) ? $args['menu_page_slug'] : $this->text_domain . '_extensions';73 $this->menu_page_slug = !empty( $args['menu_page_slug'] ) ? $args['menu_page_slug'] : _extensions'; 74 74 $this->priority = !empty( $args['priority'] ) ? $args['priority'] : 100; 75 75 $this->hook_suffix = !empty( $args['hook_suffix'] ) ? $args['hook_suffix'] : ''; … … 82 82 83 83 // Ajax Action 84 add_action( 'wp_ajax_ '.$this->text_domain.'_ajax_plugin_activation', [ $this, 'plugin_activation' ] );84 add_action( 'wp_ajax__ajax_plugin_activation', [ $this, 'plugin_activation' ] ); 85 85 86 86 } … … 118 118 119 119 $localize_vars['ajaxurl'] = admin_url('admin-ajax.php'); 120 $localize_vars['text_domain'] = sanitize_title_with_dashes( $this->text_domain);120 $localize_vars['text_domain'] = sanitize_title_with_dashes( ); 121 121 $localize_vars['nonce'] = wp_create_nonce('htrp_nonce'); 122 122 $localize_vars['buttontxt'] = array( 123 'buynow' => esc_html__( 'Buy Now', $this->text_domain),124 'preview' => esc_html__( 'Preview', $this->text_domain),125 'installing' => esc_html__( 'Installing..', $this->text_domain),126 'activating' => esc_html__( 'Activating..', $this->text_domain),127 'active' => esc_html__( 'Activated', $this->text_domain),123 'buynow' => esc_html__( 'Buy Now', ), 124 'preview' => esc_html__( 'Preview', ), 125 'installing' => esc_html__( 'Installing..', ), 126 'activating' => esc_html__( 'Activating..', ), 127 'active' => esc_html__( 'Activated', ), 128 128 ); 129 129 wp_localize_script( 'htrp-plugin-install-manager', 'htrp_params', $localize_vars ); … … 159 159 ?> 160 160 <div class="wrap"> 161 <h2><?php echo get_admin_page_title(); ?></h2>161 <h2><?php echo ); ?></h2> 162 162 <style> 163 163 .htrp-admin-tab-pane{ … … 218 218 $title = wp_kses( $title, $this->plugins_allowedtags ); 219 219 $image_url = $this->plugin_icon( $plugins_type, $prepare_plugin[$data['slug']]['icons'] ); 220 $description = strip_tags( $prepare_plugin[$data['slug']]['description'] );220 $description = _tags( $prepare_plugin[$data['slug']]['description'] ); 221 221 $author_name = wp_kses( $prepare_plugin[$data['slug']]['author'], $this->plugins_allowedtags ); 222 222 $details_link = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] .'&TB_iframe=true&width=772&height=577'); … … 229 229 $image_url = $this->plugin_icon( $plugins_type, $plugin['slug'] ); 230 230 $description = isset($plugin['description']) ? $plugin['description'] : ''; 231 $author_name = esc_html__( 'HasTheme', $this->text_domain);231 $author_name = esc_html__( 'HasTheme', ); 232 232 $author_link = isset($plugin['author_link']) ? $plugin['author_link'] : ''; 233 233 $details_link = isset($plugin['link']) ? $plugin['link'] : ''; 234 $button_text = esc_html__('Buy Now', $this->text_domain);234 $button_text = esc_html__('Buy Now', ); 235 235 $button_classes = 'button button-primary'; 236 236 $target = '_blank'; … … 244 244 245 245 $button_classes = 'button activate-now button-primary'; 246 $button_text = esc_html__( 'Activate', $this->text_domain);246 $button_text = esc_html__( 'Activate', ); 247 247 248 248 // Not Installed. … … 250 250 251 251 $button_classes = 'button install-now'; 252 $button_text = esc_html__( 'Install Now', $this->text_domain);252 $button_text = esc_html__( 'Install Now', ); 253 253 254 254 // Active. 255 255 } else { 256 256 $button_classes = 'button disabled'; 257 $button_text = esc_html__( 'Activated', $this->text_domain);257 $button_text = esc_html__( 'Activated', ); 258 258 } 259 259 … … 263 263 <div class="name column-name" style="margin-right: 0;"> 264 264 <h3> 265 <a href="<?php echo esc_url( $details_link ) ?>" target="<?php echo esc_attr( $target ) ?>" <?php echo $modal_class; ?>>265 <a href="<?php echo esc_url( $details_link ) ?>" target="<?php echo esc_attr( $target ) ?>" <?php echo ; ?>> 266 266 <?php echo esc_html( $title ) ?> 267 267 <img src="<?php echo esc_url( $image_url ) ?>" class="plugin-icon" alt="<?php echo esc_attr( $title ) ?>"> … … 270 270 </div> 271 271 <div class="desc column-description" style="margin-right: 0;"> 272 <p><?php echo wp_ trim_words( $description, 23, '....'); ?></p>272 <p><?php echo wp_); ?></p> 273 273 <p class="authors"> 274 <cite><?php echo esc_html__( 'By ', $this->text_domain); ?>274 <cite><?php echo esc_html__( 'By ', ); ?> 275 275 <?php if( $plugins_type == 'free' ): ?> 276 <?php echo $author_name; ?>276 <?php echo ; ?> 277 277 <?php else: ?> 278 <a href="<?php echo esc_url( $author_link ); ?>" target="_blank" ><?php echo $author_name; ?></a>278 <a href="<?php echo esc_url( $author_link ); ?>" target="_blank" ><?php echo ; ?></a> 279 279 <?php endif; ?> 280 280 </cite> … … 286 286 <?php 287 287 if (! file_exists( WP_PLUGIN_DIR . '/' . $data['location'] ) && $plugins_type == 'pro' ) { 288 echo '<a class="button button-primary" href="'.esc_url( $details_link ).'" target="'.esc_attr( $target ).'">'.esc_html__( 'Buy Now', $this->text_domain).'</a>';288 echo '<a class="button button-primary" href="'.esc_url( $details_link ).'" target="'.esc_attr( $target ).'">'.esc_html__( 'Buy Now', ).'</a>'; 289 289 }else{ 290 290 ?> 291 <button class="<?php echo $button_classes; ?>" data-pluginopt='<?php echo wp_json_encode( $data ); ?>'><?php echo $button_text; ?></button>291 <button class="<?php echo ; ?></button> 292 292 293 293 <?php } ?> 294 294 </div> 295 295 <div class="column-downloaded"> 296 <a href="<?php echo esc_url( $details_link ) ?>" target="<?php echo esc_attr( $target ) ?>" <?php echo $modal_class; ?>><?php echo esc_html__('More Details', $this->text_domain) ?></a>296 <a href="<?php echo esc_url( $details_link ) ?>" target="<?php echo esc_attr( $target ) ?>" <?php echo ) ?></a> 297 297 <span class="downloaded-count"> 298 298 <?php 299 299 if( $plugins_type == 'free' ){ 300 300 /* translators: %s: Number of installations. */ 301 printf( __( '%s Active Installations' ), $this->active_install_count( $prepare_plugin[$data['slug']]['active_installs']) );301 printf( ) ); 302 302 } 303 303 ?> … … 397 397 array( 398 398 'success' => false, 399 'message' => esc_html__( 'Plugin Not Found', $this->text_domain),399 'message' => esc_html__( 'Plugin Not Found', ), 400 400 ) 401 401 ); … … 417 417 array( 418 418 'success' => true, 419 'message' => esc_html__( 'Plugin Successfully Activated', $this->text_domain),419 'message' => esc_html__( 'Plugin Successfully Activated', ), 420 420 ) 421 421 ); -
swatchly/trunk/includes/Frontend/Woo_Config.php
r2893238 r3085399 608 608 global $product; 609 609 610 $request_data = wp_unslash($_REQUEST); 610 $request_data = wp_unslash($_REQUEST); 611 611 $is_elementor_preview = isset($request_data['elementor-preview']) || (isset($request_data['action']) && $request_data['action'] == 'elementor' ) || is_admin(); 612 612 … … 648 648 ob_start(); 649 649 ?> 650 <form class="swatchly_loop_variation_form variations_form swatchly_align_<?php echo esc_attr($align); ?>" data-product_variations="<?php echo esc_attr( $variations_json ); ?>" data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo $variations_attr; // WPCS: XSS ok. ?>">650 <form class="swatchly_loop_variation_form variations_form swatchly_align_<?php echo esc_attr($align); ?>" data-product_variations="<?php echo esc_attr( $variations_json ); ?>" data-product_id="<?php echo ; // WPCS: XSS ok. ?>"> 651 651 652 652 <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?> … … 658 658 <tr> 659 659 <?php if(swatchly_get_option('pl_show_swatches_label')): ?> 660 <td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name); // WPCS: XSS ok. ?></label></td>660 <td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo ); // WPCS: XSS ok. ?></label></td> 661 661 <?php endif; ?> 662 662 … … 716 716 $variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true ); 717 717 ?> 718 <div class="swatchly_loop_variation_form variations_form swatchly_align_<?php echo esc_attr($align); ?>" data-product_variations="<?php echo esc_attr( $variations_json ); ?>" data-product_id="<?php echo absint( $product->get_id() ); ?>" data-product_variations="<?php echo $variations_attr; // WPCS: XSS ok. ?>">718 <div class="swatchly_loop_variation_form variations_form swatchly_align_<?php echo esc_attr($align); ?>" data-product_variations="<?php echo esc_attr( $variations_json ); ?>" data-product_id="<?php echo ; // WPCS: XSS ok. ?>"> 719 719 720 720 <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?> … … 726 726 <tr> 727 727 <?php if(swatchly_get_option('pl_show_swatches_label')): ?> 728 <td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo wc_attribute_label( $attribute_name); // WPCS: XSS ok. ?></label></td>728 <td class="label"><label for="<?php echo esc_attr( sanitize_title( $attribute_name ) ); ?>"><?php echo ); // WPCS: XSS ok. ?></label></td> 729 729 <?php endif; ?> 730 730 -
swatchly/trunk/includes/ajax-actions.php
r2757572 r3085399 3 3 exit; // Exit if accessed directly. 4 4 } 5 6 /**7 * Ajax WooCommerce notices.8 */9 function swatchly_ajax_add_to_cart_notice() {10 wc_print_notices();11 wp_die();12 }13 14 if( swatchly_get_option('pl_enable_ajax_add_to_cart') && swatchly_get_option('pl_enable_cart_popup_notice') ){15 // generate ajax add to cart notice16 add_action( 'wp_ajax_swatchly_ajax_add_to_cart_notice', 'swatchly_ajax_add_to_cart_notice' );17 add_action( 'wp_ajax_nopriv_swatchly_ajax_add_to_cart_notice', 'swatchly_ajax_add_to_cart_notice' );18 }19 20 /**21 * AJAX add to cart.22 */23 function swatchly_ajax_add_to_cart() {24 if ( ! isset( $_POST['product_id'] ) ) {25 return;26 }27 28 $product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_POST['product_id'] ) );29 $product_title = get_the_title( $product_id );30 $quantity = ! empty( $_POST['quantity'] ) ? wc_stock_amount( absint( $_POST['quantity'] ) ) : 1;31 $product_status = get_post_status( $product_id );32 $variation_id = ! empty( $_POST['variation_id'] ) ? absint( $_POST['variation_id'] ) : 0;33 $variation = ! empty( $_POST['variation'] ) ? array_map( 'sanitize_text_field', $_POST['variation'] ) : array();34 $passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variation );35 $cart_page_url = wc_get_cart_url();36 37 if ( $passed_validation && false !== WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variation ) && 'publish' === $product_status ) {38 39 do_action( 'woocommerce_ajax_added_to_cart', $product_id );40 41 if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {42 wc_add_to_cart_message( array( $product_id => $quantity ), true );43 } else {44 $added_to_cart_notice = sprintf(45 /* translators: %s: Product title */46 esc_html__( '"%1$s" has been added to your cart. %2$s', 'swatchly' ),47 esc_html( $product_title ),48 '<a href="' . esc_url( $cart_page_url ) . '">' . esc_html__( 'View Cart', 'swatchly' ) . '</a>'49 );50 51 wc_add_notice( $added_to_cart_notice );52 }53 54 WC_AJAX::get_refreshed_fragments();55 56 } else {57 58 // If there was an error adding to the cart, redirect to the product page to show any errors.59 $data = array(60 'error' => true,61 'product_url' => apply_filters( 'woocommerce_cart_redirect_after_error', get_permalink( $product_id ), $product_id ),62 );63 64 wp_send_json( $data );65 }66 }67 add_action( 'wp_ajax_swatchly_ajax_add_to_cart', 'swatchly_ajax_add_to_cart' );68 add_action( 'wp_ajax_nopriv_swatchly_ajax_add_to_cart', 'swatchly_ajax_add_to_cart' );69 5 70 6 /** -
swatchly/trunk/includes/functions.php
r2757572 r3085399 121 121 122 122 $attr = substr( $taxonomy, 3 ); 123 $attr = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attr ) ); 123 $attr = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name = %s", $attr ) ); 124 124 $swatch_type = isset($attr->attribute_type) ? $attr->attribute_type : ''; 125 125 -
swatchly/trunk/swatchly.php
r3073087 r3085399 4 4 * Plugin URI: https://plugindemo.hasthemes.com/swatchly/ 5 5 * Description: Variation Swatches for WooCommerce Products 6 * Version: 1.2. 76 * Version: 1.2. 7 7 * Author: HasThemes 8 8 * Author URI: https://hasthemes.com … … 30 30 * @since 1.0.0 31 31 */ 32 public $version = '1.2. 7';32 public $version = '1.2.'; 33 33 34 34 /** … … 109 109 require_once SWATCHLY_PATH .'/includes/Admin/recommendations/init.php'; 110 110 require_once SWATCHLY_PATH .'/includes/Admin/Diagnostic_Data.php'; 111 111 112 } 112 113 } … … 176 177 delete_transient( 'swatchly_do_activation_redirect' ); 177 178 178 exit( wp_redirect("admin.php?page=swatchly-welcome") );179 exit( ) ); 179 180 } 180 181 } … … 224 225 ); 225 226 226 printf( '<div class="notice notice-warning"><p>%1$s</p></div>', $message);227 printf( '<div class="notice notice-warning"><p>%1$s</p></div>', ); 227 228 } 228 229
Note: See TracChangeset
for help on using the changeset viewer.