Plugin Directory

Changeset 3261595


Ignore:
Timestamp:
03/25/2025 02:14:56 PM (11 months ago)
Author:
goodlayers
Message:

Improve Security
Scan Plugin With "Plugin Check"

Location:
goodlayers-blocks
Files:
25 added
4 edited

Legend:

Unmodified
Added
Removed
  • goodlayers-blocks/trunk/category-filter.php

    r2879881 r3261595  
    44    if( !function_exists('glgu_category_filter_render_callback') ){
    55        function glgu_category_filter_render_callback( $atts, $content ){
    6            
     6            global $glgu_cat, $glgu_section, $glgu_post_type;
     7
    78            // initialize
    89            if( !isset($atts['style']) ) $atts['style'] = 'dot-top';
     
    2930
    3031            $active_cat = '';
    31             if( !empty($_GET['glguSection']) && $_GET['glguSection'] == $atts['sectionId'] &&
    32                 !empty($_GET['glguPostType']) && $_GET['glguPostType'] == $atts['postType'] && !empty($_GET['glguCat']) ){
     32            if( !empty($glgu_section) && $glgu_section == $atts['sectionId'] &&
     33                !empty($glgu_post_type) && $glgu_post_type == $atts['postType'] && !empty($glgu_cat) ){
    3334                 
    34                 $active_cat = sanitize_key($_GET['glguCat']);
     35                $active_cat = sanitize_key($glgu_cat);
    3536            }
    3637
     
    6768    if( !function_exists('glgu_category_filter_ajax') ){
    6869        function glgu_category_filter_ajax(){
     70            global $glgu_cat, $glgu_section, $glgu_post_type;
     71
    6972            if( !empty($_GET['glguCat']) && !empty($_GET['glguSection']) && !empty($_GET['glguPostType']) ){
    70                 echo $_GET['glguCat'] . ' ' . $_GET['glguSection'] . ' ' . $_GET['glguPostType'];
     73
     74                // verify nonce
     75                if( isset($_GET['security']) ){
     76                    $nonce = sanitize_text_field(wp_unslash($_GET['security']));
     77                    if( !wp_verify_nonce($nonce, 'glgu_nonce') ){
     78                        die();
     79                    }
     80                }else{
     81                    die();
     82                }
     83
     84                $glgu_cat = sanitize_text_field(wp_unslash($_GET['glguCat']));
     85                $glgu_section = sanitize_text_field(wp_unslash($_GET['glguSection']));
     86                $glgu_post_type = sanitize_text_field(wp_unslash($_GET['glguPostType']));
     87               
     88                // get data
    7189                add_filter('render_block_data', 'glgu_category_filter_block_full', 20, 3);
    7290            }
     
    7694    if( !function_exists('glgu_category_filter_block_full') ){
    7795        function glgu_category_filter_block_full($parsed_block, $source_block, $parent_block){
     96            global $glgu_cat, $glgu_section, $glgu_post_type;
    7897
    7998            // search for block with id = section_id
    80 
    81             $search_id = 'id="' . sanitize_key($_GET['glguSection']) . '"';
     99            $search_id = empty($glgu_section)? '': 'id="' . sanitize_key($glgu_section) . '"';
    82100            if( strpos($parsed_block['innerHTML'], $search_id) !== false ){
    83101                $target_block = $parsed_block;
     
    88106
    89107                $categories = array();
    90                 if( $_GET['glguPostType'] == 'product' ){
    91                     if( $_GET['glguCat'] != 'all' ){
    92                         $term = get_term_by('slug', sanitize_key($_GET['glguCat']), 'product_cat');
     108                if( !empty($glgu_post_type) && $glgu_post_type == 'product' ){
     109                    if( !empty($glgu_cat) && $glgu_cat != 'all' ){
     110                        $term = get_term_by('slug', sanitize_key($glgu_cat), 'product_cat');
    93111                        if( !empty($term) ){
    94112                            $categories[] = $term->term_id;
     
    98116                    }
    99117           
    100                 }else if($_GET['glguPostType'] == 'post'){
     118                }else if( !empty($glgu_post_type) && $glgu_post_type == 'post' ){
    101119
    102120                }
     
    191209                $.ajax({
    192210                    url: url,
    193                     data: {glguCat: cat, glguSection: section_id, glguPostType: post_type},
     211                    data: {
     212                        glguCat: cat,
     213                        glguSection: section_id,
     214                        glguPostType: post_type,
     215                        security: '<?php echo esc_js(wp_create_nonce("glgu_nonce")); ?>'
     216                    },
    194217                    method: 'GET',
    195218                    dataType: 'text',
  • goodlayers-blocks/trunk/goodlayers-blocks.php

    r2900104 r3261595  
    44 * Plugin URI:        https://wordpress.org/plugins/
    55 * Description:       Extra useful elements for theme styling
    6  * Version:           1.0.2
     6 * Version:           1.0.3
    77 * Author:            Goodlayers
    88 * Author URI:        https://goodlayers.com/
     
    2626            /* accordion */
    2727            $block_accordion_asset = include(GLGU_LOCAL . '/js/dist/accordion.asset.php');
    28             wp_register_script('glgu-accordion', GLGU_URL . '/js/dist/accordion.js', $block_accordion_asset['dependencies'], $block_accordion_asset['version']);
     28            wp_register_script('glgu-accordion', GLGU_URL . '/js/dist/accordion.js', $block_accordion_asset['dependencies'], $block_accordion_asset['version'], true);
    2929            register_block_type('glgu/accordion', array(
    3030                'editor_script' => 'glgu-accordion'
     
    3333            /* rating */
    3434            $block_rating_asset = include(GLGU_LOCAL . '/js/dist/rating.asset.php');
    35             wp_register_script('glgu-rating', GLGU_URL . '/js/dist/rating.js', $block_rating_asset['dependencies'], $block_rating_asset['version']);
     35            wp_register_script('glgu-rating', GLGU_URL . '/js/dist/rating.js', $block_rating_asset['dependencies'], $block_rating_asset['version'], true);
    3636            register_block_type('glgu/rating', array(
    3737                'editor_script' => 'glgu-rating'
     
    4040            // slider controls
    4141            $slider_controls_asset = include(GLGU_LOCAL . '/js/dist/slider-controls.asset.php');
    42             wp_register_script('glgu-slider-controls', GLGU_URL . '/js/dist/slider-controls.js', $slider_controls_asset['dependencies'], $slider_controls_asset['version']);
     42            wp_register_script('glgu-slider-controls', GLGU_URL . '/js/dist/slider-controls.js', $slider_controls_asset['dependencies'], $slider_controls_asset['version'], true);
    4343            register_block_type('glgu/slider-controls', array(
    4444                'editor_script' => 'glgu-slider-controls'
     
    4747            /* group custom */
    4848            $group_custom_asset = include(GLGU_LOCAL . '/js/dist/group-custom.asset.php');
    49             wp_register_script('glgu-group-custom', GLGU_URL . '/js/dist/group-custom.js', $group_custom_asset['dependencies'], $group_custom_asset['version']);
     49            wp_register_script('glgu-group-custom', GLGU_URL . '/js/dist/group-custom.js', $group_custom_asset['dependencies'], $group_custom_asset['version'], true);
    5050            wp_localize_script('glgu-group-custom', 'glguGroupCustom', array(
    5151                'enableCarousel' => get_theme_support('glgu-group-custom-carousel'),
     
    5757            // fa social
    5858            $fa_social_asset = include(GLGU_LOCAL . '/js/dist/fa-social.asset.php');
    59             wp_register_script('glgu-fa-social', GLGU_URL . '/js/dist/fa-social.js', $fa_social_asset['dependencies'], $fa_social_asset['version']);
     59            wp_register_script('glgu-fa-social', GLGU_URL . '/js/dist/fa-social.js', $fa_social_asset['dependencies'], $fa_social_asset['version'], true);
    6060            register_block_type('glgu/fa-social', array(
    6161                'editor_script' => 'glgu-fa-social'
     
    6464            // shape divider
    6565            $shape_divider = include(GLGU_LOCAL . '/js/dist/shape-divider.asset.php');
    66             wp_register_script('glgu-shape-divider', GLGU_URL . '/js/dist/shape-divider.js', $shape_divider['dependencies'], $shape_divider['version']);
     66            wp_register_script('glgu-shape-divider', GLGU_URL . '/js/dist/shape-divider.js', $shape_divider['dependencies'], $shape_divider['version'], true);
    6767            register_block_type('glgu/shape-divider', array(
    6868                'editor_script' => 'glgu-shape-divider'
     
    7171            // category filter
    7272            $category_filter = include(GLGU_LOCAL . '/js/dist/category-filter.asset.php');
    73             wp_register_script('glgu-category-filter', GLGU_URL . '/js/dist/category-filter.js', $category_filter['dependencies'], $category_filter['version']);
     73            wp_register_script('glgu-category-filter', GLGU_URL . '/js/dist/category-filter.js', $category_filter['dependencies'], $category_filter['version'], true);
    7474            wp_localize_script('glgu-category-filter', 'GLGU_CAT', array(
    7575                'all' => esc_html__('All', 'goodlayers-blocks'),
     
    8484            /* product-category */
    8585            $product_category_asset = include(GLGU_LOCAL . '/js/dist/product-category.asset.php');
    86             wp_register_script('glgu-product-category', GLGU_URL . '/js/dist/product-category.js', $product_category_asset['dependencies'], $product_category_asset['version']);
     86            wp_register_script('glgu-product-category', GLGU_URL . '/js/dist/product-category.js', $product_category_asset['dependencies'], $product_category_asset['version'], true);
    8787            wp_localize_script('glgu-product-category', 'GLGU_THUMBNAIL', glgu_get_thumbnail_sizes());
    8888            register_block_type('glgu/product-category', array(
     
    228228    background: var(--category-filter-text-indicator, #000);
    229229    -webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%; }
     230@media only screen and (max-width: 768px){
     231    .glgu-category-filter{ flex-wrap: wrap; }
     232    .glgu-category-filter .glgu-slide-bar{ display: none; }
     233}
    230234
    231235/* product category */
     
    326330                array(
    327331                    'value' => 'full',
    328                     'label' => esc_html__('full size', 'goodlayers-core')
     332                    'label' => esc_html__('full size', 'goodlayers-blocks')
    329333
    330334                )
  • goodlayers-blocks/trunk/readme.txt

    r2900104 r3261595  
    22Tags: blocks, accordion, group, social, responsive
    33Requires at least: 6.0
    4 Tested up to: 6.0
     4Tested up to: 6.7
    55Requires PHP: 7.0
    6 Stable tag: 1.0.1
     6Stable tag: 1.0.3
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • goodlayers-blocks/trunk/util.php

    r2841668 r3261595  
    4141    if( !function_exists('glgu_current_year_shortcode') ){
    4242        function glgu_current_year_shortcode($atts, $content = ''){
    43             return date('Y');
     43            return current_time('Y');
    4444        }
    4545    }
     
    6464            $ret = array();
    6565            if( !empty($with_all) ){
    66                 $ret[$cat] = esc_html__('All', 'goodlayers-core');
     66                $ret[$cat] = esc_html__('All', 'goodlayers-blocks');
    6767            }
    6868
Note: See TracChangeset for help on using the changeset viewer.