Changeset 3415862
- Timestamp:
- 12/09/2025 11:05:05 PM (4 months ago)
- Location:
- cinza-grid
- Files:
-
- 27 added
- 4 edited
-
tags/1.2.4 (added)
-
tags/1.2.4/assets (added)
-
tags/1.2.4/assets/css (added)
-
tags/1.2.4/assets/css/animate.min.css (added)
-
tags/1.2.4/assets/css/backend-admin.css (added)
-
tags/1.2.4/assets/css/backend-dashicon.css (added)
-
tags/1.2.4/assets/css/backend-style.css (added)
-
tags/1.2.4/assets/css/frontend-style.css (added)
-
tags/1.2.4/assets/fonts (added)
-
tags/1.2.4/assets/fonts/icomoon.eot (added)
-
tags/1.2.4/assets/fonts/icomoon.svg (added)
-
tags/1.2.4/assets/fonts/icomoon.ttf (added)
-
tags/1.2.4/assets/fonts/icomoon.woff (added)
-
tags/1.2.4/assets/fonts/icomoon.woff2 (added)
-
tags/1.2.4/assets/images (added)
-
tags/1.2.4/assets/images/cinza-icon-pink.png (added)
-
tags/1.2.4/assets/images/metafizzy-icon.png (added)
-
tags/1.2.4/assets/images/razorfrog-icon-turquoise.png (added)
-
tags/1.2.4/assets/js (added)
-
tags/1.2.4/assets/js/backend-script.js (added)
-
tags/1.2.4/assets/js/frontend-script.js (added)
-
tags/1.2.4/assets/js/isotope.pkgd.min.js (added)
-
tags/1.2.4/cinza-grid.php (added)
-
tags/1.2.4/includes (added)
-
tags/1.2.4/includes/backend-cpts.php (added)
-
tags/1.2.4/includes/backend-shortcodes.php (added)
-
tags/1.2.4/readme.txt (added)
-
trunk/cinza-grid.php (modified) (2 diffs)
-
trunk/includes/backend-cpts.php (modified) (3 diffs)
-
trunk/includes/backend-shortcodes.php (modified) (15 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cinza-grid/trunk/cinza-grid.php
r3397377 r3415862 5 5 * Plugin URI: https://cinza.io/plugin/cinza-grid/ 6 6 * Description: A minimal grid plugin. 7 * Version: 1.2. 37 * Version: 1.2.4 8 8 * Requires at least: 5.2 9 9 * Requires PHP: 7.2 … … 40 40 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 41 41 42 add_action( 'admin_enqueue_scripts', ' add_script_to_cgrid_cpt' );43 function add_script_to_cgrid_cpt() {42 add_action( 'admin_enqueue_scripts', 'cgrid_add_script_to_cpt' ); 43 function cgrid_add_script_to_cpt() { 44 44 global $post_type; 45 45 -
cinza-grid/trunk/includes/backend-cpts.php
r3397377 r3415862 70 70 } 71 71 72 add_filter( 'set_custom_edit_cinza_grid_columns', ' set_custom_edit_cgrid_columns' );73 function set_custom_edit_cgrid_columns($columns) {72 add_filter( 'set_custom_edit_cinza_grid_columns', 'cgrid_set_custom_edit_columns' ); 73 function cgrid_set_custom_edit_columns($columns) { 74 74 $columns['shortcode'] = __( 'Shortcode', 'cinza-grid' ); 75 75 return $columns; 76 76 } 77 77 78 add_action( 'manage_cinza_grid_posts_custom_column' , 'c ustom_cgrid_column', 10, 2 );79 function c ustom_cgrid_column( $column, $post_id ) {78 add_action( 'manage_cinza_grid_posts_custom_column' , 'cgrid_custom_column', 10, 2 ); 79 function cgrid_custom_column( $column, $post_id ) { 80 80 switch ( $column ) { 81 81 case 'shortcode' : … … 85 85 } 86 86 87 add_filter ( 'manage_cinza_grid_posts_columns', ' add_cgrid_columns', 99, 99 );88 function add_cgrid_columns ( $columns ) {87 add_filter ( 'manage_cinza_grid_posts_columns', 'cgrid_add_columns', 99, 99 ); 88 function cgrid_add_columns ( $columns ) { 89 89 unset($columns['title']); 90 90 unset($columns['shortcode']); … … 115 115 } 116 116 117 // Remove CPT from SEO sitemap and set robots to noindex nofollow (for Rank Math SEO plugin) 118 if ( in_array( 'seo-by-rank-math/rank-math.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { 119 120 // https://rankmath.com/kb/make-theme-rank-math-compatible/#exclude-post-type-from-sitemap 121 add_filter( 'rank_math/sitemap/exclude_post_type', function ($exclude, $type) { 122 if ($type === 'cinza_grid') { 123 $exclude = true; 124 } 125 return $exclude; 126 }, 10, 2); 127 128 // https://support.rankmath.com/ticket/cpt-noindex/ 129 add_filter( 'rank_math/frontend/robots', function( $robots ) { 130 if(get_post_type() == 'cinza_grid' ) { 131 $robots['index'] = 'noindex'; 132 $robots['follow'] = 'nofollow'; 133 } 134 return $robots; 135 }); 136 } 117 // Check if Rank Math SEO plugin is active 118 function cgrid_is_rank_math_active() { 119 if ( ! function_exists( 'is_plugin_active' ) ) { 120 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 121 } 122 123 return is_plugin_active( 'seo-by-rank-math/rank-math.php' ); 124 } 125 126 // Remove CPT from sitemap and set noindex/nofollow only if Rank Math is active 127 if ( cgrid_is_rank_math_active() ) { 128 129 // Exclude CPT from Rank Math sitemap 130 add_filter( 131 'rank_math/sitemap/exclude_post_type', 132 function ( $exclude, $type ) { 133 if ( 'cinza_grid' === $type ) { 134 return true; 135 } 136 return $exclude; 137 }, 138 10, 139 2 140 ); 141 142 // Set robots to noindex/nofollow for this CPT 143 add_filter( 144 'rank_math/frontend/robots', 145 function ( $robots ) { 146 if ( 'cinza_grid' === get_post_type() ) { 147 $robots['index'] = 'noindex'; 148 $robots['follow'] = 'nofollow'; 149 } 150 return $robots; 151 } 152 ); 153 } 154 137 155 138 156 // [Possible future addition] Remove CPT from SEO sitemap (for Yoast SEO plugin) -
cinza-grid/trunk/includes/backend-shortcodes.php
r3381619 r3415862 160 160 $sort_atts = explode ("/", $sort_line); 161 161 162 // CHANGED (Security):escape labels and sanitize class key used in data-sort-by and JS map162 // escape labels and sanitize class key used in data-sort-by and JS map 163 163 $sort_key_raw = isset($sort_atts[0]) ? trim($sort_atts[0]) : ''; 164 164 $sort_label_raw = isset($sort_atts[1]) ? trim($sort_atts[1]) : ''; … … 186 186 // Filter 187 187 $filters = ''; 188 $filters_temp = isset($cgrid_options['cgrid_filters']) ? sanitize_textarea_field($cgrid_options['cgrid_filters']) : ''; // CHANGED (Security): sanitize188 $filters_temp = isset($cgrid_options['cgrid_filters']) ? sanitize_textarea_field($cgrid_options['cgrid_filters']) : ''; 189 189 190 190 if (!empty($filters_temp)) { … … 212 212 foreach ($filter_buttons as $filter_button) { 213 213 $btn_label = trim($filter_button); 214 $btn_class = sanitize_html_class( strtolower( preg_replace('/\s+/', '-', $btn_label) ) ); // CHANGED (Security)214 $btn_class = sanitize_html_class( strtolower( preg_replace('/\s+/', '-', $btn_label) ) ); 215 215 $filters .= '<button class="button" id="'. esc_attr($btn_class) .'" data-filter=".'. esc_attr($btn_class) .'">'. esc_html($btn_label) .'</button>'; 216 216 } … … 397 397 $grid_item = preg_replace_callback($pattern_date, function($matches) use ($post) { 398 398 $date_format = $matches[1]; 399 return esc_html( get_the_date($date_format, $post->ID) ); // CHANGED (Security)399 return esc_html( get_the_date($date_format, $post->ID) ); 400 400 }, $grid_item); 401 401 … … 404 404 $grid_item = preg_replace_callback($pattern_meta, function($matches) use ($post) { 405 405 $meta_field = $matches[1]; 406 // CHANGED (Security):escape meta values as text406 // escape meta values as text 407 407 return esc_html( get_post_meta($post->ID, $meta_field, true) ); 408 408 }, $grid_item); … … 410 410 if (!empty($filters_temp)) { 411 411 foreach ($filter_lines as $filter_line) { 412 $filter_classes .= filter_meta_replace($post, $filter_line);412 $filter_classes .= cgrid_filter_meta_replace($post, $filter_line); 413 413 } 414 414 } … … 431 431 if (!empty($filters_temp)) { 432 432 foreach ($filter_lines as $filter_line) { 433 $filter_classes .= filter_tax_replace($post, $filter_line);433 $filter_classes .= cgrid_filter_tax_replace($post, $filter_line); 434 434 } 435 435 } … … 476 476 $grid_item = preg_replace_callback($pattern_imgurlsize, function($matches) use ($post) { 477 477 $size = $matches[1]; 478 return esc_url( get_the_post_thumbnail_url($post->ID, $size) ); // CHANGED (Security)478 return esc_url( get_the_post_thumbnail_url($post->ID, $size) ); 479 479 }, $grid_item); 480 480 … … 501 501 502 502 $code2 = array( 503 esc_html( get_the_title($post->ID) ), // CHANGED (Security)504 esc_url( get_permalink($post->ID) ), // CHANGED (Security)505 sanitize_title( $post->post_name ), // CHANGED (Security)506 esc_html( get_the_date('F j, Y', $post->ID) ), // CHANGED (Security)503 esc_html( get_the_title($post->ID) ), 504 esc_url( get_permalink($post->ID) ), 505 sanitize_title( $post->post_name ), 506 esc_html( get_the_date('F j, Y', $post->ID) ), 507 507 get_the_post_thumbnail($post->ID,'full'), 508 esc_url( get_the_post_thumbnail_url($post->ID,'full') ), // CHANGED (Security)509 wp_kses_post( wpautop( get_post_field('post_content', $post->ID) ) ), // CHANGED (Security)510 esc_html( get_the_excerpt($post->ID) ), // CHANGED (Security)508 esc_url( get_the_post_thumbnail_url($post->ID,'full') ), 509 wp_kses_post( wpautop( get_post_field('post_content', $post->ID) ) ), 510 esc_html( get_the_excerpt($post->ID) ), 511 511 ); 512 512 … … 520 520 // Style 521 521 $style = "<style>"; 522 $style .= c ss_breakpoint($grid_id, $cgrid_breakpoint_1, $cgrid_columns_1, $cgrid_full_width, $cgrid_height_1, $cgrid_spacing_1);523 $style .= c ss_breakpoint($grid_id, $cgrid_breakpoint_2, $cgrid_columns_2, $cgrid_full_width, $cgrid_height_2, $cgrid_spacing_2);524 $style .= c ss_breakpoint($grid_id, $cgrid_breakpoint_3, $cgrid_columns_3, $cgrid_full_width, $cgrid_height_3, $cgrid_spacing_3);525 $style .= c ss_breakpoint($grid_id, $cgrid_breakpoint_4, $cgrid_columns_4, $cgrid_full_width, $cgrid_height_4, $cgrid_spacing_4);526 $style .= c ss_breakpoint($grid_id, $cgrid_breakpoint_5, $cgrid_columns_5, $cgrid_full_width, $cgrid_height_5, $cgrid_spacing_5);522 $style .= cgrid_css_breakpoint($grid_id, $cgrid_breakpoint_1, $cgrid_columns_1, $cgrid_full_width, $cgrid_height_1, $cgrid_spacing_1); 523 $style .= cgrid_css_breakpoint($grid_id, $cgrid_breakpoint_2, $cgrid_columns_2, $cgrid_full_width, $cgrid_height_2, $cgrid_spacing_2); 524 $style .= cgrid_css_breakpoint($grid_id, $cgrid_breakpoint_3, $cgrid_columns_3, $cgrid_full_width, $cgrid_height_3, $cgrid_spacing_3); 525 $style .= cgrid_css_breakpoint($grid_id, $cgrid_breakpoint_4, $cgrid_columns_4, $cgrid_full_width, $cgrid_height_4, $cgrid_spacing_4); 526 $style .= cgrid_css_breakpoint($grid_id, $cgrid_breakpoint_5, $cgrid_columns_5, $cgrid_full_width, $cgrid_height_5, $cgrid_spacing_5); 527 527 $style .= "</style>"; 528 528 … … 531 531 } 532 532 533 function filter_meta_replace($post, $filters_temp) {533 function cgrid_filter_meta_replace($post, $filters_temp) { 534 534 if (strpos($filters_temp, '%meta(') !== false) { 535 535 $meta_start_position = strpos($filters_temp, "%meta("); … … 539 539 $meta_code_args = substr($filters_temp, $meta_open_paranthesis+2, $meta_close_paranthesis-$meta_open_paranthesis-3); 540 540 $meta_formatted = get_post_meta( $post->ID, $meta_code_args, true ); 541 // CHANGED (Security):ensure valid CSS class fragment541 // ensure valid CSS class fragment 542 542 $meta_class = sanitize_html_class( strtolower( preg_replace('/\s+/', '-', $meta_formatted) ) ); 543 543 return " " . $meta_class; … … 545 545 } 546 546 547 function filter_tax_replace($post, $filters_temp) {547 function cgrid_filter_tax_replace($post, $filters_temp) { 548 548 if (strpos($filters_temp, '%tax(') !== false) { 549 549 $tax_start_position = strpos($filters_temp, "%tax("); … … 556 556 $terms_array = array(); 557 557 foreach ( $term_list as $term ) { 558 // CHANGED (Security):sanitize per-class558 // sanitize per-class 559 559 $terms_array[] = sanitize_html_class( strtolower( preg_replace('/\s+/', '-', $term->name) ) ); 560 560 } … … 565 565 } 566 566 567 function c ss_breakpoint($grid_id, $breakpoint, $col, $full_width, $height, $space) {567 function cgrid_css_breakpoint($grid_id, $breakpoint, $col, $full_width, $height, $space) { 568 568 $style = " 569 569 @media only screen and (min-width: ". intval($breakpoint) ."px) {"; -
cinza-grid/trunk/readme.txt
r3397377 r3415862 3 3 Tags: grid, post grid, display post, metafizzy, isotope 4 4 Requires at least: 5.2 5 Tested up to: 6. 85 Tested up to: 6.9 6 6 Requires PHP: 7.2 7 Stable tag: 1.2. 37 Stable tag: 1.2.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 24 24 25 25 == Changelog == 26 27 = 1.2.4 = 28 *Release Date – 9th December, 2025* 29 30 * Security fixes 31 * WP 6.9 compatibility test 26 32 27 33 = 1.2.3 =
Note: See TracChangeset
for help on using the changeset viewer.