Changeset 3436498
- Timestamp:
- 01/10/2026 09:28:16 AM (8 weeks ago)
- Location:
- related
- Files:
-
- 1 added
- 6 edited
-
tags/3.5.0/readme.txt (modified) (1 diff)
-
trunk/adminpages/page-related.php (modified) (14 diffs)
-
trunk/adminpages/page-related_du.php (modified) (11 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/related.php (modified) (3 diffs)
-
trunk/related_du.php (modified) (3 diffs)
-
trunk/uninstall.php (added)
Legend:
- Unmodified
- Added
- Removed
-
related/tags/3.5.0/readme.txt
r3299254 r3436498 3 3 Tags: related, related post, related posts, linked post, linked posts 4 4 Requires at least: 4.1 5 Tested up to: 6. 85 Tested up to: 6.9 6 6 Stable tag: 3.5.0 7 7 License: GPLv2 or later -
related/trunk/adminpages/page-related.php
r3164466 r3436498 30 30 $verified = false; 31 31 if ( isset($_POST['related_show_nonce']) ) { 32 $verified = wp_verify_nonce( $_POST['related_show_nonce'], 'related_show_nonce' );32 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_show_nonce'] ) ), 'related_show_nonce' ); 33 33 } 34 34 if ( $verified == false ) { … … 44 44 } 45 45 $showkeys = json_encode($showkeys); 46 update_option( 'related_show', $showkeys );46 update_option( 'related_show', $showkeys, false ); 47 47 echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>'; 48 48 } … … 53 53 $verified = false; 54 54 if ( isset($_POST['related_list_nonce']) ) { 55 $verified = wp_verify_nonce( $_POST['related_list_nonce'], 'related_list_nonce' );55 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_list_nonce'] ) ), 'related_list_nonce' ); 56 56 } 57 57 if ( $verified == false ) { … … 67 67 } 68 68 $listkeys = json_encode($listkeys); 69 update_option( 'related_list', $listkeys );69 update_option( 'related_list', $listkeys, false ); 70 70 echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>'; 71 71 } … … 77 77 $verified = false; 78 78 if ( isset($_POST['related_content_nonce']) ) { 79 $verified = wp_verify_nonce( $_POST['related_content_nonce'], 'related_content_nonce' );79 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_content_nonce'] ) ), 'related_content_nonce' ); 80 80 } 81 81 if ( $verified == false ) { … … 85 85 if ( isset( $_POST['related_content'] ) ) { 86 86 if ($_POST['related_content'] === 'on') { 87 update_option( 'related_content', 1);87 update_option( 'related_content', 1, true ); 88 88 } else { 89 update_option( 'related_content', 0);90 } 91 } else { 92 update_option( 'related_content', 0);89 update_option( 'related_content', 0, true ); 90 } 91 } else { 92 update_option( 'related_content', 0, true ); 93 93 } 94 94 if ( isset( $_POST['related_content_all'] ) ) { 95 95 if ($_POST['related_content_all'] === 'on') { 96 update_option( 'related_content_all', 1);96 update_option( 'related_content_all', 1, true ); 97 97 } else { 98 update_option( 'related_content_all', 0);99 } 100 } else { 101 update_option( 'related_content_all', 0);98 update_option( 'related_content_all', 0, true ); 99 } 100 } else { 101 update_option( 'related_content_all', 0, true ); 102 102 } 103 103 if ( isset( $_POST['related_content_rss'] ) ) { 104 104 if ($_POST['related_content_rss'] === 'on') { 105 update_option( 'related_content_rss', 1);105 update_option( 'related_content_rss', 1, true ); 106 106 } else { 107 update_option( 'related_content_rss', 0);108 } 109 } else { 110 update_option( 'related_content_rss', 0);107 update_option( 'related_content_rss', 0, true ); 108 } 109 } else { 110 update_option( 'related_content_rss', 0, true ); 111 111 } 112 112 if ( isset( $_POST['related_content_title'] ) && $_POST['related_content_title'] !== '' ) { 113 update_option( 'related_content_title', sanitize_text_field($_POST['related_content_title']) );113 update_option( 'related_content_title', sanitize_text_field($_POST['related_content_title']), true ); 114 114 } else { 115 115 delete_option( 'related_content_title' ); … … 117 117 if ( isset( $_POST['related_content_extended'] ) ) { 118 118 if ($_POST['related_content_extended'] === 'on') { 119 update_option( 'related_content_extended', 1);119 update_option( 'related_content_extended', 1, true ); 120 120 } else { 121 update_option( 'related_content_extended', 0);122 } 123 } else { 124 update_option( 'related_content_extended', 0);121 update_option( 'related_content_extended', 0, true ); 122 } 123 } else { 124 update_option( 'related_content_extended', 0, true ); 125 125 } 126 126 … … 134 134 $verified = false; 135 135 if ( isset($_POST['related_double_nonce']) ) { 136 $verified = wp_verify_nonce( $_POST['related_double_nonce'], 'related_double_nonce' );136 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_double_nonce'] ) ), 'related_double_nonce' ); 137 137 } 138 138 if ( $verified == false ) { … … 142 142 if ( isset( $_POST['related_double_plugin'] ) ) { 143 143 if ($_POST['related_double_plugin'] === 'on') { 144 update_option( 'related_double_plugin', 1);144 update_option( 'related_double_plugin', 1, true ); 145 145 } else { 146 update_option( 'related_double_plugin', 0);147 } 148 } else { 149 update_option( 'related_double_plugin', 0);146 update_option( 'related_double_plugin', 0, true ); 147 } 148 } else { 149 update_option( 'related_double_plugin', 0, true ); 150 150 } 151 151 … … 158 158 $verified = false; 159 159 if ( isset($_POST['related_uninstall_nonce']) ) { 160 $verified = wp_verify_nonce( $_POST['related_uninstall_nonce'], 'related_uninstall_nonce' );160 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_uninstall_nonce'] ) ), 'related_uninstall_nonce' ); 161 161 } 162 162 if ( $verified == false ) { … … 237 237 $checked = ''; 238 238 foreach ( $post_types as $post_type ) { 239 if ( $post_type === 'revision' || $post_type === 'nav_menu_item' ) { 239 if ( $post_type === 'revision' || $post_type === 'nav_menu_item' || $post_type === 'custom_css' || $post_type === 'customize_changeset' || $post_type === 'oembed_cache' || 240 $post_type === 'wp_block' || $post_type === 'wp_template' || $post_type === 'wp_template_part' || $post_type === 'wp_global_styles' || $post_type === 'wp_navigation' || 241 $post_type === 'wp_font_family' || $post_type === 'wp_font_face' ) { 240 242 continue; 241 243 } … … 299 301 $post_types = get_post_types( '', 'names' ); 300 302 foreach ( $post_types as $post_type ) { 301 if ( $post_type === 'revision' || $post_type === 'nav_menu_item' ) { 303 if ( $post_type === 'revision' || $post_type === 'nav_menu_item' || $post_type === 'custom_css' || $post_type === 'customize_changeset' || $post_type === 'oembed_cache' || 304 $post_type === 'wp_block' || $post_type === 'wp_template' || $post_type === 'wp_template_part' || $post_type === 'wp_global_styles' || $post_type === 'wp_navigation' || 305 $post_type === 'wp_font_family' || $post_type === 'wp_font_face' ) { 302 306 continue; 303 307 } … … 311 315 <li><label for="list_<?php echo esc_attr( $post_type ); ?>"> 312 316 <input name="list_<?php echo esc_attr( $post_type ); ?>" type="checkbox" id="list_<?php echo esc_attr( $post_type ); ?>" <?php echo $checked; ?> /> 313 <?php echo $post_type; ?>317 <?php echo esc_attr( $post_type ); ?> 314 318 </label></li> 315 319 <?php … … 564 568 * Add the options to WordPress if they don't exist. 565 569 */ 566 add_option( 'related_show', json_encode(array( 'post' )) ); 567 add_option( 'related_list', json_encode(array( 'post' )) ); 568 add_option( 'related_du_show', json_encode(array( 'post' )) ); 569 add_option( 'related_du_list', json_encode(array( 'post' )) ); 570 570 add_option( 'related_show', json_encode(array( 'post' )), '', false ); 571 add_option( 'related_list', json_encode(array( 'post' )), '', false ); 572 -
related/trunk/adminpages/page-related_du.php
r3164466 r3436498 29 29 $verified = false; 30 30 if ( isset($_POST['related_show_nonce']) ) { 31 $verified = wp_verify_nonce( $_POST['related_show_nonce'], 'related_show_nonce' );31 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_show_nonce'] ) ), 'related_show_nonce' ); 32 32 } 33 33 if ( $verified == false ) { … … 43 43 } 44 44 $showkeys = json_encode($showkeys); 45 update_option( 'related_du_show', $showkeys );45 update_option( 'related_du_show', $showkeys, false ); 46 46 echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>'; 47 47 } … … 53 53 $verified = false; 54 54 if ( isset($_POST['related_list_nonce']) ) { 55 $verified = wp_verify_nonce( $_POST['related_list_nonce'], 'related_list_nonce' );55 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_list_nonce'] ) ), 'related_list_nonce' ); 56 56 } 57 57 if ( $verified == false ) { … … 67 67 } 68 68 $listkeys = json_encode($listkeys); 69 update_option( 'related_du_list', $listkeys );69 update_option( 'related_du_list', $listkeys, false ); 70 70 echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>'; 71 71 } … … 76 76 $verified = false; 77 77 if ( isset($_POST['related_content_nonce']) ) { 78 $verified = wp_verify_nonce( $_POST['related_content_nonce'], 'related_content_nonce' );78 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_content_nonce'] ) ), 'related_content_nonce' ); 79 79 } 80 80 if ( $verified == false ) { … … 84 84 if ( isset( $_POST['related_content'] ) ) { 85 85 if ($_POST['related_content'] === 'on') { 86 update_option( 'related_du_content', 1);86 update_option( 'related_du_content', 1, true ); 87 87 } else { 88 update_option( 'related_du_content', 0);89 } 90 } else { 91 update_option( 'related_du_content', 0);88 update_option( 'related_du_content', 0, true ); 89 } 90 } else { 91 update_option( 'related_du_content', 0, true ); 92 92 } 93 93 if ( isset( $_POST['related_du_content_all'] ) ) { 94 94 if ($_POST['related_du_content_all'] === 'on') { 95 update_option( 'related_du_content_all', 1);95 update_option( 'related_du_content_all', 1, true ); 96 96 } else { 97 update_option( 'related_du_content_all', 0);98 } 99 } else { 100 update_option( 'related_du_content_all', 0);97 update_option( 'related_du_content_all', 0, true ); 98 } 99 } else { 100 update_option( 'related_du_content_all', 0, true ); 101 101 } 102 102 if ( isset( $_POST['related_du_content_rss'] ) ) { 103 103 if ($_POST['related_du_content_rss'] === 'on') { 104 update_option( 'related_du_content_rss', 1);104 update_option( 'related_du_content_rss', 1, true ); 105 105 } else { 106 update_option( 'related_du_content_rss', 0);107 } 108 } else { 109 update_option( 'related_du_content_rss', 0);106 update_option( 'related_du_content_rss', 0, true ); 107 } 108 } else { 109 update_option( 'related_du_content_rss', 0, true ); 110 110 } 111 111 if ( isset( $_POST['related_du_content_title'] ) && $_POST['related_du_content_title'] !== '' ) { 112 update_option( 'related_du_content_title', sanitize_text_field($_POST['related_du_content_title']) );112 update_option( 'related_du_content_title', sanitize_text_field($_POST['related_du_content_title']), true ); 113 113 } else { 114 114 delete_option( 'related_du_content_title' ); … … 116 116 if ( isset( $_POST['related_du_content_extended'] ) ) { 117 117 if ($_POST['related_du_content_extended'] === 'on') { 118 update_option( 'related_du_content_extended', 1);118 update_option( 'related_du_content_extended', 1, true ); 119 119 } else { 120 update_option( 'related_du_content_extended', 0);121 } 122 } else { 123 update_option( 'related_du_content_extended', 0);120 update_option( 'related_du_content_extended', 0, true ); 121 } 122 } else { 123 update_option( 'related_du_content_extended', 0, true ); 124 124 } 125 125 echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>'; … … 177 177 $checked = ''; 178 178 foreach ( $post_types as $post_type ) { 179 if ( $post_type === 'revision' || $post_type === 'nav_menu_item' ) { 179 if ( $post_type === 'revision' || $post_type === 'nav_menu_item' || $post_type === 'custom_css' || $post_type === 'customize_changeset' || $post_type === 'oembed_cache' || 180 $post_type === 'wp_block' || $post_type === 'wp_template' || $post_type === 'wp_template_part' || $post_type === 'wp_global_styles' || $post_type === 'wp_navigation' || 181 $post_type === 'wp_font_family' || $post_type === 'wp_font_face' ) { 180 182 continue; 181 183 } … … 241 243 $post_types = get_post_types( '', 'names' ); 242 244 foreach ( $post_types as $post_type ) { 243 if ( $post_type === 'revision' || $post_type === 'nav_menu_item' ) { 245 if ( $post_type === 'revision' || $post_type === 'nav_menu_item' || $post_type === 'custom_css' || $post_type === 'customize_changeset' || $post_type === 'oembed_cache' || 246 $post_type === 'wp_block' || $post_type === 'wp_template' || $post_type === 'wp_template_part' || $post_type === 'wp_global_styles' || $post_type === 'wp_navigation' || 247 $post_type === 'wp_font_family' || $post_type === 'wp_font_face' ) { 244 248 continue; 245 249 } … … 253 257 <li><label for="list_<?php echo esc_attr( $post_type ); ?>"> 254 258 <input name="list_<?php echo esc_attr( $post_type ); ?>" type="checkbox" id="list_<?php echo esc_attr( $post_type ); ?>" <?php echo $checked; ?> /> 255 <?php echo $post_type; ?>259 <?php echo esc_attr( $post_type ); ?> 256 260 </label></li> 257 261 <?php … … 327 331 } 328 332 333 /* 334 * Add the options to WordPress if they don't exist. 335 * File only gets included if enabled in options. 336 */ 337 add_option( 'related_du_show', json_encode(array( 'post' )), '', false ); 338 add_option( 'related_du_list', json_encode(array( 'post' )), '', false ); -
related/trunk/readme.txt
r3299254 r3436498 3 3 Tags: related, related post, related posts, linked post, linked posts 4 4 Requires at least: 4.1 5 Tested up to: 6. 85 Tested up to: 6.9 6 6 Stable tag: 3.5.0 7 7 License: GPLv2 or later … … 187 187 == Changelog == 188 188 189 = 3.5.1 = 190 * 2025- 191 * Verify Nonces correctly. 192 * Filter more post types out of options. 193 * Add uninstall.php for cleanup of options after uninstall. 194 * Set autoload explicitly for options. 195 189 196 = 3.5.0 = 190 197 * 2025-03-07 -
related/trunk/related.php
r3299254 r3436498 2 2 /* 3 3 Plugin Name: Manual Related Posts 4 Plugin URI: https:// wordpress.org/plugins/related/4 Plugin URI: https://timelord.nl 5 5 Description: A simple 'related posts' plugin that lets you select related posts manually. 6 6 Version: 3.5.0 … … 90 90 define('RELATED_VERSION', '3.5.0'); 91 91 define('RELATED_FILE', plugin_basename( __DIR__ )); 92 define('RELATED_ABSPATH', str_replace('\\', '/', WP_PLUGIN_DIR . '/' . plugin_basename( __DIR__ )));92 define('RELATED_ABSPATH', plugin_dir_path( __FILE__ )); 93 93 define('RELATED_URLPATH', plugins_url() . '/' . plugin_basename( __DIR__ )); 94 94 } … … 169 169 $verified = false; 170 170 if ( isset($_POST['related_nonce']) ) { 171 $verified = wp_verify_nonce( $_POST['related_nonce'], 'related_nonce' );171 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_nonce'] ) ), 'related_nonce' ); 172 172 } 173 173 if ( $verified == false ) { -
related/trunk/related_du.php
r3252079 r3436498 40 40 protected function define_constants() { 41 41 define('RELATED_DU_FILE', plugin_basename( __DIR__ )); 42 define('RELATED_DU_ABSPATH', str_replace('\\', '/', WP_PLUGIN_DIR . '/' . plugin_basename( __DIR__ )));43 42 } 44 43 … … 99 98 $verified = false; 100 99 if ( isset($_POST['related_du_nonce']) ) { 101 $verified = wp_verify_nonce( $_POST['related_du_nonce'], 'related_du_nonce' );100 $verified = wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['related_du_nonce'] ) ), 'related_du_nonce' ); 102 101 } 103 102 if ( $verified == false ) { … … 414 413 $active = is_plugin_active( 'related/related_du.php' ); // bool; true or false 415 414 if ( $active ) { 416 update_option( 'related_double_plugin', 1);415 update_option( 'related_double_plugin', 1, true ); 417 416 deactivate_plugins( 'related/related_du.php' ); 418 417 } else { 419 update_option( 'related_double_plugin', 0);418 update_option( 'related_double_plugin', 0, true ); 420 419 } 421 420 }
Note: See TracChangeset
for help on using the changeset viewer.