Plugin Directory

Changeset 3085399

Timestamp:
05/13/2024 05:12:16 AM (3 months ago)
Author:
hasthemes
Message:

Update to version 1.2.8 from GitHub

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  
    9696    left: 0;
    9797    margin-left: 50% !important;
     98
    9899}
    99100#TB_window #TB_title {
  • swatchly/tags/1.2.8/includes/Admin.php

    r3072081 r3085399  
    1313        new Admin\Attribute_Taxonomy_Metabox();
    1414        new Admin\Product_Metabox();
    15         new Admin\Rating_Notice();
    1615        new Admin\Install_Manager\Install_Manager();
     16
    1717
    1818        // Add a top-level custom menu called "Swatchly" for the plugin
     
    2929
    3030        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
    3167    }
    3268
     
    5894    function enqueue_admin_head_scripts() {
    5995        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 ($) {
    6197            $("#toplevel_page_swatchly-admin .wp-submenu a").each(function() {
    6298                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") {
     
    64100                }
    65101            })
    66         })(jQuery);';
    67         printf( '<script>%s</script>', $script );
     102        })(jQuery);' );
    68103    }
    69104
     
    109144
    110145            // 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']) : '';
    112147            $is_swatchly_setting = $is_swatchly_setting == 'swatchly-admin' ? 1 : 0;
    113148            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  
    1818     */
    1919    public function settings() {
    20         $taxonomy    = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : '';
     20        $taxonomy    = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : '';
    2121        $swatch_type = $this->get_taxonomy_swatch_type( $taxonomy );
    2222
     
    8080                'title'      => esc_html__( 'Tooltip Image Size', 'swatchly' ),
    8181                'after'   => sprintf(
     82
    8283                    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'),
    8384                    '<a href="'. esc_url(admin_url('admin.php?page=swatchly-admin#tab=general-settings/global')) .'">' . esc_html__('global settings', 'swatchly') . '</a>'
     
    134135
    135136        $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 ) );
    137138        $swatch_type = isset($attr->attribute_type) ? $attr->attribute_type : '';
    138139
  • swatchly/tags/1.2.8/includes/Admin/Diagnostic_Data.php

    r3072081 r3085399  
    9999            }, 0 );
    100100
    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'] ) : '' ;
    104104                if( $agreed === 'yes' ){
    105                     $this->process_data( $agreed );
     105                    $this->process_data( $agreed );
    106106                } elseif( $agreed === 'no' ) {
    107                     $this->process_data( $agreed );
     107                    $this->process_data( $agreed );
    108108                }
    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            } );
    110122        }
    111123
     
    170182         * Process data.
    171183         */
    172         private function process_data($agreed) {
     184        private function process_data($agreed) {
    173185            $notice = 'no';
    174186
     
    188200            update_option( 'swatchly_diagnostic_data_agreed', $agreed );
    189201            update_option( 'swatchly_diagnostic_data_notice', $notice );
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
    190217        }
    191218
     
    470497         */
    471498        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            */
    473509            $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>' );
    474510
     511
     512
     513
     514
    475515            $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>' );
    476516
    477517            $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' => ) );
    479519
    480520            $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' => ) );
    482522            ?>
    483523            <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>
    484524            <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>
    486529                <p class="swatchly-diagnostic-data-message"><?php echo wp_kses_post( $message_l1 ); ?></p>
    487530                <p class="swatchly-diagnostic-data-list"><?php echo wp_kses_post( $message_l2 ); ?></p>
     
    491534                </p>
    492535            </div>
     536
    493537            <?php
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
    494548        }
    495549
  • swatchly/tags/1.2.8/includes/Admin/Global_Settings.php

    r3072081 r3085399  
    217217                    'type'  => 'image_select',
    218218                    'title' => esc_html__('Shape Style', 'swatchly'),
    219                     'label' => esc_html__('', 'swatchly'),
     219                    'label' => ,
    220220                    'options' => array(
    221221                        'squared' => SWATCHLY_ASSETS . '/images/sqared.png',
     
    263263                    'title'      => esc_html__('Variation Label Separator', 'swatchly'),
    264264                    'default'    => esc_html__(' : ', 'swatchly'),
    265                     'after'      => esc_html__('', 'swatchly'),
     265                    'after'      => esc_html__('', 'swatchly'),
    266266                    'dependency' => array( 'show_selected_attribute_name', '==', '1' ),
    267267                ),
     
    392392                    'type'  => 'image_select',
    393393                    'title' => esc_html__('Shape Style', 'swatchly'),
    394                     'label' => esc_html__('', 'swatchly'),
     394                    'label' => ,
    395395                    'options' => array(
    396396                        'squared' => SWATCHLY_ASSETS . '/images/sqared.png',
     
    443443                    'title'      => esc_html__('Variation Label Separator', 'swatchly'),
    444444                    'default'    => esc_html__(' : ', 'swatchly'),
    445                     'after'      => esc_html__('', 'swatchly'),
     445                    'after'      => ,
    446446                    'dependency'  => array('sp_override_global|sp_show_selected_attribute_name',  '==|==', '1|1')
    447447                ),
     
    574574                    'type'  => 'image_select',
    575575                    'title' => esc_html__('Shape Style', 'swatchly'),
    576                     'label' => esc_html__('', 'swatchly'),
     576                    'label' => ,
    577577                    'options' => array(
    578578                        'squared' => SWATCHLY_ASSETS . '/images/sqared.png',
     
    794794                    'type'       => 'submessage',
    795795                    'style'      => 'info',
    796                     'content'    => __( '<strong>Ajax Add to Cart Behaviour</strong>', 'swatchly' ),
     796                    'content'    => ,
    797797                ),
    798798                array(
  • swatchly/tags/1.2.8/includes/Admin/Install_Manager/Install_Manager.php

    r2757572 r3085399  
    6363     */
    6464    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'] ) {
    6666            wp_send_json_error(
    6767                array(
     
    7272        }
    7373
    74         $plugin_file = ( isset( $_POST['location'] ) ) ? esc_attr( $_POST['location'] ) : '';
     74        $plugin_file = ( isset( $_POST['location'] ) ) ? esc_attr( $_POST['location'] ) : '';
    7575        $activate    = activate_plugin( $plugin_file, '', false, true );
    7676
  • swatchly/tags/1.2.8/includes/Admin/Product_Metabox.php

    r2850861 r3085399  
    7979        }
    8080       
    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' );
    8383            update_post_meta( $product_id, '_swatchly_product_meta', $meta_data );
    8484        }
     
    218218                                            <?php
    219219                                                if( $tooltip_image_id2 ){
    220                                                     echo '<img src="'. wp_get_attachment_image_url($tooltip_image_id2, 'thumbnail') .'" />';
     220                                                    echo '<img src="'. ) .'" />';
    221221                                                }
    222222                                            ?>
     
    237237                                    <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) ?>">
    238238                                    <?php 
    239                                         echo wc_help_tip( $tooltip_image_size_content );
     239                                        echo w);
    240240                                    ?>
    241241                                </td>
     
    328328                                                                    <?php
    329329                                                                        if( $tooltip_image_id ){
    330                                                                             echo '<img src="'. wp_get_attachment_image_url($tooltip_image_id, 'thumbnail') .'" />';
     330                                                                            echo '<img src="'. ) .'" />';
    331331                                                                        }
    332332                                                                    ?>
     
    347347                                                            <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) ?>">
    348348                                                            <?php 
    349                                                                 echo wc_help_tip( $tooltip_image_size_content );
     349                                                                echo w);
    350350                                                            ?>
    351351                                                        </td>
     
    378378                                                                    <?php
    379379                                                                        if( $image_id ){
    380                                                                             echo '<img src="'. wp_get_attachment_image_url($image_id, 'thumbnail') .'" />';
     380                                                                            echo '<img src="'. ) .'" />';
    381381                                                                        }
    382382                                                                    ?>
     
    397397                                                            <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) ?>">
    398398                                                            <?php
    399                                                                 echo wc_help_tip( $tooltip_image_size_content );
     399                                                                echo w);
    400400                                                            ?>
    401401                                                        </td>
  • swatchly/tags/1.2.8/includes/Admin/Woo_Config.php

    r2555867 r3085399  
    1515
    1616        // Swatch type preview column
    17         $taxonomy = isset($_GET['taxonomy']) ? sanitize_title( $_GET['taxonomy'] ) : '';
     17        $taxonomy = isset($_GET['taxonomy']) ? sanitize_title( $_GET['taxonomy'] ) : '';
    1818        add_filter( 'manage_edit-'. $taxonomy .'_columns', array( $this, 'add_new_attribute_column') );
    1919        add_filter( 'manage_'. $taxonomy .'_custom_column', array( $this, 'add_swatch_preview_markup' ), 10, 3 );
     
    4343    public function add_new_attribute_column( $columns ){
    4444        global $taxnow;
    45         $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : '';
     45        $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : '';
    4646        if($request_taxonomy !== $taxnow){
    4747            return $columns;
     
    6868    public function add_swatch_preview_markup( $columns, $column, $term_id ){
    6969        global $taxnow;
    70         $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : '';
     70        $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : '';
    7171        if( ($request_taxonomy !== $taxnow) || ('thumb' !== $column)){
    7272            return $columns;
  • swatchly/tags/1.2.8/includes/Admin/recommendations/Recommended_Plugins.php

    r2896476 r3085399  
    6767
    6868        // 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';
    7070        $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', );
    7272        $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';
    7474        $this->priority          =  !empty( $args['priority'] ) ? $args['priority'] : 100;
    7575        $this->hook_suffix       =  !empty( $args['hook_suffix'] ) ? $args['hook_suffix'] : '';
     
    8282
    8383        // 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' ] );
    8585
    8686    }
     
    118118
    119119        $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( );
    121121        $localize_vars['nonce'] = wp_create_nonce('htrp_nonce');
    122122        $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', ),
    128128        );
    129129        wp_localize_script( 'htrp-plugin-install-manager', 'htrp_params', $localize_vars );
     
    159159        ?>
    160160            <div class="wrap">
    161                 <h2><?php echo get_admin_page_title(); ?></h2>
     161                <h2><?php echo ); ?></h2>
    162162                <style>
    163163                    .htrp-admin-tab-pane{
     
    218218                                    $title        = wp_kses( $title, $this->plugins_allowedtags );
    219219                                    $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'] );
    221221                                    $author_name  = wp_kses( $prepare_plugin[$data['slug']]['author'], $this->plugins_allowedtags );
    222222                                    $details_link = self_admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .'&amp;TB_iframe=true&amp;width=772&amp;height=577');
     
    229229                                    $image_url      = $this->plugin_icon( $plugins_type, $plugin['slug'] );
    230230                                    $description    = isset($plugin['description']) ? $plugin['description'] : '';
    231                                     $author_name    = esc_html__( 'HasTheme', $this->text_domain );
     231                                    $author_name    = esc_html__( 'HasTheme', );
    232232                                    $author_link    = isset($plugin['author_link']) ? $plugin['author_link'] : '';
    233233                                    $details_link   = isset($plugin['link']) ? $plugin['link'] : '';
    234                                     $button_text    = esc_html__('Buy Now', $this->text_domain );
     234                                    $button_text    = esc_html__('Buy Now', );
    235235                                    $button_classes = 'button button-primary';
    236236                                    $target         = '_blank';
     
    244244
    245245                                        $button_classes = 'button activate-now button-primary';
    246                                         $button_text    = esc_html__( 'Activate', $this->text_domain );
     246                                        $button_text    = esc_html__( 'Activate', );
    247247
    248248                                    // Not Installed.
     
    250250
    251251                                        $button_classes = 'button install-now';
    252                                         $button_text    = esc_html__( 'Install Now', $this->text_domain );
     252                                        $button_text    = esc_html__( 'Install Now', );
    253253
    254254                                    // Active.
    255255                                    } else {
    256256                                        $button_classes = 'button disabled';
    257                                         $button_text    = esc_html__( 'Activated', $this->text_domain );
     257                                        $button_text    = esc_html__( 'Activated', );
    258258                                    }
    259259
     
    263263                                            <div class="name column-name" style="margin-right: 0;">
    264264                                                <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 ; ?>>
    266266                                                        <?php echo esc_html( $title ) ?>
    267267                                                        <img src="<?php echo esc_url( $image_url ) ?>" class="plugin-icon" alt="<?php echo esc_attr( $title ) ?>">
     
    270270                                            </div>
    271271                                            <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>
    273273                                                <p class="authors">
    274                                                     <cite><?php echo esc_html__( 'By ', $this->text_domain ); ?>
     274                                                    <cite><?php echo esc_html__( 'By ', ); ?>
    275275                                                        <?php if( $plugins_type == 'free' ): ?>
    276                                                             <?php echo $author_name; ?>
     276                                                            <?php echo ; ?>
    277277                                                        <?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>
    279279                                                        <?php endif; ?>
    280280                                                    </cite>
     
    286286                                                <?php
    287287                                                    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>';
    289289                                                    }else{
    290290                                                ?>
    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>
    292292                                                   
    293293                                                <?php } ?>
    294294                                            </div>
    295295                                            <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>
    297297                                                <span class="downloaded-count">
    298298                                                    <?php
    299299                                                        if( $plugins_type == 'free' ){
    300300                                                            /* translators: %s: Number of installations. */
    301                                                             printf( __( '%s Active Installations' ), $this->active_install_count( $prepare_plugin[$data['slug']]['active_installs'] ) );
     301                                                            printf( ) );
    302302                                                        }
    303303                                                    ?>
     
    397397                array(
    398398                    'success' => false,
    399                     'message' => esc_html__( 'Plugin Not Found', $this->text_domain ),
     399                    'message' => esc_html__( 'Plugin Not Found', ),
    400400                )
    401401            );
     
    417417            array(
    418418                'success' => true,
    419                 'message' => esc_html__( 'Plugin Successfully Activated', $this->text_domain ),
     419                'message' => esc_html__( 'Plugin Successfully Activated', ),
    420420            )
    421421        );
  • swatchly/tags/1.2.8/includes/Frontend/Woo_Config.php

    r2893238 r3085399  
    608608        global $product;
    609609
    610         $request_data         = wp_unslash($_REQUEST);
     610        $request_data         = wp_unslash($_REQUEST);
    611611        $is_elementor_preview = isset($request_data['elementor-preview']) || (isset($request_data['action']) && $request_data['action'] == 'elementor' ) || is_admin();
    612612
     
    648648        ob_start();
    649649        ?>
    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. ?>">
    651651
    652652                <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?>
     
    658658                                <tr>
    659659                                    <?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>
    661661                                    <?php endif; ?>
    662662
     
    716716        $variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true );
    717717        ?>
    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. ?>">
    719719
    720720                <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?>
     
    726726                                <tr>
    727727                                    <?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>
    729729                                    <?php endif; ?>
    730730
  • swatchly/tags/1.2.8/includes/ajax-actions.php

    r2757572 r3085399  
    33    exit; // Exit if accessed directly.
    44}
    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 notice
    16     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' );
    695
    706/**
  • swatchly/tags/1.2.8/includes/functions.php

    r2757572 r3085399  
    121121
    122122        $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 ) );
    124124        $swatch_type = isset($attr->attribute_type) ? $attr->attribute_type : '';
    125125
  • swatchly/tags/1.2.8/swatchly.php

    r3073087 r3085399  
    44 * Plugin URI:  https://plugindemo.hasthemes.com/swatchly/
    55 * Description: Variation Swatches for WooCommerce Products
    6  * Version:     1.2.7
     6 * Version:     1.2.
    77 * Author:      HasThemes
    88 * Author URI:  https://hasthemes.com
     
    3030     * @since 1.0.0
    3131     */
    32     public $version = '1.2.7';
     32    public $version = '1.2.';
    3333
    3434    /**
     
    109109            require_once SWATCHLY_PATH .'/includes/Admin/recommendations/init.php';
    110110            require_once SWATCHLY_PATH .'/includes/Admin/Diagnostic_Data.php';
     111
    111112        }
    112113    }
     
    176177            delete_transient( 'swatchly_do_activation_redirect' );
    177178           
    178             exit( wp_redirect("admin.php?page=swatchly-welcome") );
     179            exit( ) );
    179180        }
    180181    }
     
    224225        );
    225226
    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>', );
    227228    }
    228229
  • swatchly/trunk/assets/css/admin.css

    r2757572 r3085399  
    9696    left: 0;
    9797    margin-left: 50% !important;
     98
    9899}
    99100#TB_window #TB_title {
  • swatchly/trunk/includes/Admin.php

    r3072081 r3085399  
    1313        new Admin\Attribute_Taxonomy_Metabox();
    1414        new Admin\Product_Metabox();
    15         new Admin\Rating_Notice();
    1615        new Admin\Install_Manager\Install_Manager();
     16
    1717
    1818        // Add a top-level custom menu called "Swatchly" for the plugin
     
    2929
    3030        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
    3167    }
    3268
     
    5894    function enqueue_admin_head_scripts() {
    5995        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 ($) {
    6197            $("#toplevel_page_swatchly-admin .wp-submenu a").each(function() {
    6298                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") {
     
    64100                }
    65101            })
    66         })(jQuery);';
    67         printf( '<script>%s</script>', $script );
     102        })(jQuery);' );
    68103    }
    69104
     
    109144
    110145            // 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']) : '';
    112147            $is_swatchly_setting = $is_swatchly_setting == 'swatchly-admin' ? 1 : 0;
    113148            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  
    1818     */
    1919    public function settings() {
    20         $taxonomy    = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : '';
     20        $taxonomy    = isset( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : '';
    2121        $swatch_type = $this->get_taxonomy_swatch_type( $taxonomy );
    2222
     
    8080                'title'      => esc_html__( 'Tooltip Image Size', 'swatchly' ),
    8181                'after'   => sprintf(
     82
    8283                    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'),
    8384                    '<a href="'. esc_url(admin_url('admin.php?page=swatchly-admin#tab=general-settings/global')) .'">' . esc_html__('global settings', 'swatchly') . '</a>'
     
    134135
    135136        $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 ) );
    137138        $swatch_type = isset($attr->attribute_type) ? $attr->attribute_type : '';
    138139
  • swatchly/trunk/includes/Admin/Diagnostic_Data.php

    r3072081 r3085399  
    9999            }, 0 );
    100100
    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'] ) : '' ;
    104104                if( $agreed === 'yes' ){
    105                     $this->process_data( $agreed );
     105                    $this->process_data( $agreed );
    106106                } elseif( $agreed === 'no' ) {
    107                     $this->process_data( $agreed );
     107                    $this->process_data( $agreed );
    108108                }
    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            } );
    110122        }
    111123
     
    170182         * Process data.
    171183         */
    172         private function process_data($agreed) {
     184        private function process_data($agreed) {
    173185            $notice = 'no';
    174186
     
    188200            update_option( 'swatchly_diagnostic_data_agreed', $agreed );
    189201            update_option( 'swatchly_diagnostic_data_notice', $notice );
     202
     203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
    190217        }
    191218
     
    470497         */
    471498        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            */
    473509            $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>' );
    474510
     511
     512
     513
     514
    475515            $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>' );
    476516
    477517            $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' => ) );
    479519
    480520            $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' => ) );
    482522            ?>
    483523            <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>
    484524            <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>
    486529                <p class="swatchly-diagnostic-data-message"><?php echo wp_kses_post( $message_l1 ); ?></p>
    487530                <p class="swatchly-diagnostic-data-list"><?php echo wp_kses_post( $message_l2 ); ?></p>
     
    491534                </p>
    492535            </div>
     536
    493537            <?php
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
    494548        }
    495549
  • swatchly/trunk/includes/Admin/Global_Settings.php

    r3072081 r3085399  
    217217                    'type'  => 'image_select',
    218218                    'title' => esc_html__('Shape Style', 'swatchly'),
    219                     'label' => esc_html__('', 'swatchly'),
     219                    'label' => ,
    220220                    'options' => array(
    221221                        'squared' => SWATCHLY_ASSETS . '/images/sqared.png',
     
    263263                    'title'      => esc_html__('Variation Label Separator', 'swatchly'),
    264264                    'default'    => esc_html__(' : ', 'swatchly'),
    265                     'after'      => esc_html__('', 'swatchly'),
     265                    'after'      => esc_html__('', 'swatchly'),
    266266                    'dependency' => array( 'show_selected_attribute_name', '==', '1' ),
    267267                ),
     
    392392                    'type'  => 'image_select',
    393393                    'title' => esc_html__('Shape Style', 'swatchly'),
    394                     'label' => esc_html__('', 'swatchly'),
     394                    'label' => ,
    395395                    'options' => array(
    396396                        'squared' => SWATCHLY_ASSETS . '/images/sqared.png',
     
    443443                    'title'      => esc_html__('Variation Label Separator', 'swatchly'),
    444444                    'default'    => esc_html__(' : ', 'swatchly'),
    445                     'after'      => esc_html__('', 'swatchly'),
     445                    'after'      => ,
    446446                    'dependency'  => array('sp_override_global|sp_show_selected_attribute_name',  '==|==', '1|1')
    447447                ),
     
    574574                    'type'  => 'image_select',
    575575                    'title' => esc_html__('Shape Style', 'swatchly'),
    576                     'label' => esc_html__('', 'swatchly'),
     576                    'label' => ,
    577577                    'options' => array(
    578578                        'squared' => SWATCHLY_ASSETS . '/images/sqared.png',
     
    794794                    'type'       => 'submessage',
    795795                    'style'      => 'info',
    796                     'content'    => __( '<strong>Ajax Add to Cart Behaviour</strong>', 'swatchly' ),
     796                    'content'    => ,
    797797                ),
    798798                array(
  • swatchly/trunk/includes/Admin/Install_Manager/Install_Manager.php

    r2757572 r3085399  
    6363     */
    6464    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'] ) {
    6666            wp_send_json_error(
    6767                array(
     
    7272        }
    7373
    74         $plugin_file = ( isset( $_POST['location'] ) ) ? esc_attr( $_POST['location'] ) : '';
     74        $plugin_file = ( isset( $_POST['location'] ) ) ? esc_attr( $_POST['location'] ) : '';
    7575        $activate    = activate_plugin( $plugin_file, '', false, true );
    7676
  • swatchly/trunk/includes/Admin/Product_Metabox.php

    r2850861 r3085399  
    7979        }
    8080       
    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' );
    8383            update_post_meta( $product_id, '_swatchly_product_meta', $meta_data );
    8484        }
     
    218218                                            <?php
    219219                                                if( $tooltip_image_id2 ){
    220                                                     echo '<img src="'. wp_get_attachment_image_url($tooltip_image_id2, 'thumbnail') .'" />';
     220                                                    echo '<img src="'. ) .'" />';
    221221                                                }
    222222                                            ?>
     
    237237                                    <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) ?>">
    238238                                    <?php 
    239                                         echo wc_help_tip( $tooltip_image_size_content );
     239                                        echo w);
    240240                                    ?>
    241241                                </td>
     
    328328                                                                    <?php
    329329                                                                        if( $tooltip_image_id ){
    330                                                                             echo '<img src="'. wp_get_attachment_image_url($tooltip_image_id, 'thumbnail') .'" />';
     330                                                                            echo '<img src="'. ) .'" />';
    331331                                                                        }
    332332                                                                    ?>
     
    347347                                                            <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) ?>">
    348348                                                            <?php 
    349                                                                 echo wc_help_tip( $tooltip_image_size_content );
     349                                                                echo w);
    350350                                                            ?>
    351351                                                        </td>
     
    378378                                                                    <?php
    379379                                                                        if( $image_id ){
    380                                                                             echo '<img src="'. wp_get_attachment_image_url($image_id, 'thumbnail') .'" />';
     380                                                                            echo '<img src="'. ) .'" />';
    381381                                                                        }
    382382                                                                    ?>
     
    397397                                                            <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) ?>">
    398398                                                            <?php
    399                                                                 echo wc_help_tip( $tooltip_image_size_content );
     399                                                                echo w);
    400400                                                            ?>
    401401                                                        </td>
  • swatchly/trunk/includes/Admin/Woo_Config.php

    r2555867 r3085399  
    1515
    1616        // Swatch type preview column
    17         $taxonomy = isset($_GET['taxonomy']) ? sanitize_title( $_GET['taxonomy'] ) : '';
     17        $taxonomy = isset($_GET['taxonomy']) ? sanitize_title( $_GET['taxonomy'] ) : '';
    1818        add_filter( 'manage_edit-'. $taxonomy .'_columns', array( $this, 'add_new_attribute_column') );
    1919        add_filter( 'manage_'. $taxonomy .'_custom_column', array( $this, 'add_swatch_preview_markup' ), 10, 3 );
     
    4343    public function add_new_attribute_column( $columns ){
    4444        global $taxnow;
    45         $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : '';
     45        $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : '';
    4646        if($request_taxonomy !== $taxnow){
    4747            return $columns;
     
    6868    public function add_swatch_preview_markup( $columns, $column, $term_id ){
    6969        global $taxnow;
    70         $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : '';
     70        $request_taxonomy = isset($_GET['taxonomy']) ? sanitize_title($_GET['taxonomy']) : '';
    7171        if( ($request_taxonomy !== $taxnow) || ('thumb' !== $column)){
    7272            return $columns;
  • swatchly/trunk/includes/Admin/recommendations/Recommended_Plugins.php

    r2896476 r3085399  
    6767
    6868        // 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';
    7070        $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', );
    7272        $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';
    7474        $this->priority          =  !empty( $args['priority'] ) ? $args['priority'] : 100;
    7575        $this->hook_suffix       =  !empty( $args['hook_suffix'] ) ? $args['hook_suffix'] : '';
     
    8282
    8383        // 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' ] );
    8585
    8686    }
     
    118118
    119119        $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( );
    121121        $localize_vars['nonce'] = wp_create_nonce('htrp_nonce');
    122122        $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', ),
    128128        );
    129129        wp_localize_script( 'htrp-plugin-install-manager', 'htrp_params', $localize_vars );
     
    159159        ?>
    160160            <div class="wrap">
    161                 <h2><?php echo get_admin_page_title(); ?></h2>
     161                <h2><?php echo ); ?></h2>
    162162                <style>
    163163                    .htrp-admin-tab-pane{
     
    218218                                    $title        = wp_kses( $title, $this->plugins_allowedtags );
    219219                                    $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'] );
    221221                                    $author_name  = wp_kses( $prepare_plugin[$data['slug']]['author'], $this->plugins_allowedtags );
    222222                                    $details_link = self_admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .'&amp;TB_iframe=true&amp;width=772&amp;height=577');
     
    229229                                    $image_url      = $this->plugin_icon( $plugins_type, $plugin['slug'] );
    230230                                    $description    = isset($plugin['description']) ? $plugin['description'] : '';
    231                                     $author_name    = esc_html__( 'HasTheme', $this->text_domain );
     231                                    $author_name    = esc_html__( 'HasTheme', );
    232232                                    $author_link    = isset($plugin['author_link']) ? $plugin['author_link'] : '';
    233233                                    $details_link   = isset($plugin['link']) ? $plugin['link'] : '';
    234                                     $button_text    = esc_html__('Buy Now', $this->text_domain );
     234                                    $button_text    = esc_html__('Buy Now', );
    235235                                    $button_classes = 'button button-primary';
    236236                                    $target         = '_blank';
     
    244244
    245245                                        $button_classes = 'button activate-now button-primary';
    246                                         $button_text    = esc_html__( 'Activate', $this->text_domain );
     246                                        $button_text    = esc_html__( 'Activate', );
    247247
    248248                                    // Not Installed.
     
    250250
    251251                                        $button_classes = 'button install-now';
    252                                         $button_text    = esc_html__( 'Install Now', $this->text_domain );
     252                                        $button_text    = esc_html__( 'Install Now', );
    253253
    254254                                    // Active.
    255255                                    } else {
    256256                                        $button_classes = 'button disabled';
    257                                         $button_text    = esc_html__( 'Activated', $this->text_domain );
     257                                        $button_text    = esc_html__( 'Activated', );
    258258                                    }
    259259
     
    263263                                            <div class="name column-name" style="margin-right: 0;">
    264264                                                <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 ; ?>>
    266266                                                        <?php echo esc_html( $title ) ?>
    267267                                                        <img src="<?php echo esc_url( $image_url ) ?>" class="plugin-icon" alt="<?php echo esc_attr( $title ) ?>">
     
    270270                                            </div>
    271271                                            <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>
    273273                                                <p class="authors">
    274                                                     <cite><?php echo esc_html__( 'By ', $this->text_domain ); ?>
     274                                                    <cite><?php echo esc_html__( 'By ', ); ?>
    275275                                                        <?php if( $plugins_type == 'free' ): ?>
    276                                                             <?php echo $author_name; ?>
     276                                                            <?php echo ; ?>
    277277                                                        <?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>
    279279                                                        <?php endif; ?>
    280280                                                    </cite>
     
    286286                                                <?php
    287287                                                    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>';
    289289                                                    }else{
    290290                                                ?>
    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>
    292292                                                   
    293293                                                <?php } ?>
    294294                                            </div>
    295295                                            <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>
    297297                                                <span class="downloaded-count">
    298298                                                    <?php
    299299                                                        if( $plugins_type == 'free' ){
    300300                                                            /* translators: %s: Number of installations. */
    301                                                             printf( __( '%s Active Installations' ), $this->active_install_count( $prepare_plugin[$data['slug']]['active_installs'] ) );
     301                                                            printf( ) );
    302302                                                        }
    303303                                                    ?>
     
    397397                array(
    398398                    'success' => false,
    399                     'message' => esc_html__( 'Plugin Not Found', $this->text_domain ),
     399                    'message' => esc_html__( 'Plugin Not Found', ),
    400400                )
    401401            );
     
    417417            array(
    418418                'success' => true,
    419                 'message' => esc_html__( 'Plugin Successfully Activated', $this->text_domain ),
     419                'message' => esc_html__( 'Plugin Successfully Activated', ),
    420420            )
    421421        );
  • swatchly/trunk/includes/Frontend/Woo_Config.php

    r2893238 r3085399  
    608608        global $product;
    609609
    610         $request_data         = wp_unslash($_REQUEST);
     610        $request_data         = wp_unslash($_REQUEST);
    611611        $is_elementor_preview = isset($request_data['elementor-preview']) || (isset($request_data['action']) && $request_data['action'] == 'elementor' ) || is_admin();
    612612
     
    648648        ob_start();
    649649        ?>
    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. ?>">
    651651
    652652                <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?>
     
    658658                                <tr>
    659659                                    <?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>
    661661                                    <?php endif; ?>
    662662
     
    716716        $variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true );
    717717        ?>
    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. ?>">
    719719
    720720                <?php if ( empty( $available_variations ) && false !== $available_variations ) : ?>
     
    726726                                <tr>
    727727                                    <?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>
    729729                                    <?php endif; ?>
    730730
  • swatchly/trunk/includes/ajax-actions.php

    r2757572 r3085399  
    33    exit; // Exit if accessed directly.
    44}
    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 notice
    16     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' );
    695
    706/**
  • swatchly/trunk/includes/functions.php

    r2757572 r3085399  
    121121
    122122        $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 ) );
    124124        $swatch_type = isset($attr->attribute_type) ? $attr->attribute_type : '';
    125125
  • swatchly/trunk/swatchly.php

    r3073087 r3085399  
    44 * Plugin URI:  https://plugindemo.hasthemes.com/swatchly/
    55 * Description: Variation Swatches for WooCommerce Products
    6  * Version:     1.2.7
     6 * Version:     1.2.
    77 * Author:      HasThemes
    88 * Author URI:  https://hasthemes.com
     
    3030     * @since 1.0.0
    3131     */
    32     public $version = '1.2.7';
     32    public $version = '1.2.';
    3333
    3434    /**
     
    109109            require_once SWATCHLY_PATH .'/includes/Admin/recommendations/init.php';
    110110            require_once SWATCHLY_PATH .'/includes/Admin/Diagnostic_Data.php';
     111
    111112        }
    112113    }
     
    176177            delete_transient( 'swatchly_do_activation_redirect' );
    177178           
    178             exit( wp_redirect("admin.php?page=swatchly-welcome") );
     179            exit( ) );
    179180        }
    180181    }
     
    224225        );
    225226
    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>', );
    227228    }
    228229
Note: See TracChangeset for help on using the changeset viewer.