Plugin Directory

Changeset 3436498


Ignore:
Timestamp:
01/10/2026 09:28:16 AM (8 weeks ago)
Author:
mpol
Message:

Tested up to: 6.9

Location:
related
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • related/tags/3.5.0/readme.txt

    r3299254 r3436498  
    33Tags: related, related post, related posts, linked post, linked posts
    44Requires at least: 4.1
    5 Tested up to: 6.8
     5Tested up to: 6.9
    66Stable tag: 3.5.0
    77License: GPLv2 or later
  • related/trunk/adminpages/page-related.php

    r3164466 r3436498  
    3030            $verified = false;
    3131            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' );
    3333            }
    3434            if ( $verified == false ) {
     
    4444                }
    4545                $showkeys = json_encode($showkeys);
    46                 update_option( 'related_show', $showkeys );
     46                update_option( 'related_show', $showkeys, false );
    4747                echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>';
    4848            }
     
    5353            $verified = false;
    5454            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' );
    5656            }
    5757            if ( $verified == false ) {
     
    6767                }
    6868                $listkeys = json_encode($listkeys);
    69                 update_option( 'related_list', $listkeys );
     69                update_option( 'related_list', $listkeys, false );
    7070                echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>';
    7171            }
     
    7777            $verified = false;
    7878            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' );
    8080            }
    8181            if ( $verified == false ) {
     
    8585                if ( isset( $_POST['related_content'] ) ) {
    8686                    if ($_POST['related_content'] === 'on') {
    87                         update_option('related_content', 1);
     87                        update_option( 'related_content', 1, true );
    8888                    } 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 );
    9393                }
    9494                if ( isset( $_POST['related_content_all'] ) ) {
    9595                    if ($_POST['related_content_all'] === 'on') {
    96                         update_option('related_content_all', 1);
     96                        update_option( 'related_content_all', 1, true );
    9797                    } 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 );
    102102                }
    103103                if ( isset( $_POST['related_content_rss'] ) ) {
    104104                    if ($_POST['related_content_rss'] === 'on') {
    105                         update_option('related_content_rss', 1);
     105                        update_option( 'related_content_rss', 1, true );
    106106                    } 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 );
    111111                }
    112112                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 );
    114114                } else {
    115115                    delete_option( 'related_content_title' );
     
    117117                if ( isset( $_POST['related_content_extended'] ) ) {
    118118                    if ($_POST['related_content_extended'] === 'on') {
    119                         update_option('related_content_extended', 1);
     119                        update_option( 'related_content_extended', 1, true );
    120120                    } 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 );
    125125                }
    126126
     
    134134            $verified = false;
    135135            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' );
    137137            }
    138138            if ( $verified == false ) {
     
    142142                if ( isset( $_POST['related_double_plugin'] ) ) {
    143143                    if ($_POST['related_double_plugin'] === 'on') {
    144                         update_option('related_double_plugin', 1);
     144                        update_option( 'related_double_plugin', 1, true );
    145145                    } 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 );
    150150                }
    151151
     
    158158            $verified = false;
    159159            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' );
    161161            }
    162162            if ( $verified == false ) {
     
    237237                            $checked = '';
    238238                            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' ) {
    240242                                    continue;
    241243                                }
     
    299301                        $post_types = get_post_types( '', 'names' );
    300302                        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' ) {
    302306                                continue;
    303307                            }
     
    311315                            <li><label for="list_<?php echo esc_attr( $post_type ); ?>">
    312316                                <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 ); ?>
    314318                            </label></li>
    315319                            <?php
     
    564568 * Add the options to WordPress if they don't exist.
    565569 */
    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 
     570add_option( 'related_show', json_encode(array( 'post' )), '', false );
     571add_option( 'related_list', json_encode(array( 'post' )), '', false );
     572
  • related/trunk/adminpages/page-related_du.php

    r3164466 r3436498  
    2929            $verified = false;
    3030            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' );
    3232            }
    3333            if ( $verified == false ) {
     
    4343                }
    4444                $showkeys = json_encode($showkeys);
    45                 update_option( 'related_du_show', $showkeys );
     45                update_option( 'related_du_show', $showkeys, false );
    4646                echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>';
    4747            }
     
    5353            $verified = false;
    5454            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' );
    5656            }
    5757            if ( $verified == false ) {
     
    6767                }
    6868                $listkeys = json_encode($listkeys);
    69                 update_option( 'related_du_list', $listkeys );
     69                update_option( 'related_du_list', $listkeys, false );
    7070                echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>';
    7171            }
     
    7676            $verified = false;
    7777            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' );
    7979            }
    8080            if ( $verified == false ) {
     
    8484                if ( isset( $_POST['related_content'] ) ) {
    8585                    if ($_POST['related_content'] === 'on') {
    86                         update_option('related_du_content', 1);
     86                        update_option( 'related_du_content', 1, true );
    8787                    } 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 );
    9292                }
    9393                if ( isset( $_POST['related_du_content_all'] ) ) {
    9494                    if ($_POST['related_du_content_all'] === 'on') {
    95                         update_option('related_du_content_all', 1);
     95                        update_option( 'related_du_content_all', 1, true );
    9696                    } 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 );
    101101                }
    102102                if ( isset( $_POST['related_du_content_rss'] ) ) {
    103103                    if ($_POST['related_du_content_rss'] === 'on') {
    104                         update_option('related_du_content_rss', 1);
     104                        update_option( 'related_du_content_rss', 1, true );
    105105                    } 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 );
    110110                }
    111111                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 );
    113113                } else {
    114114                    delete_option( 'related_du_content_title' );
     
    116116                if ( isset( $_POST['related_du_content_extended'] ) ) {
    117117                    if ($_POST['related_du_content_extended'] === 'on') {
    118                         update_option('related_du_content_extended', 1);
     118                        update_option( 'related_du_content_extended', 1, true );
    119119                    } 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 );
    124124                }
    125125                echo '<div id="message" class="updated fade notice is-dismissible"><p>' . esc_html__('Settings updated successfully.', 'related') . '</p></div>';
     
    177177                            $checked = '';
    178178                            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' ) {
    180182                                    continue;
    181183                                }
     
    241243                            $post_types = get_post_types( '', 'names' );
    242244                            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' ) {
    244248                                    continue;
    245249                                }
     
    253257                                <li><label for="list_<?php echo esc_attr( $post_type ); ?>">
    254258                                    <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 ); ?>
    256260                                </label></li>
    257261                                <?php
     
    327331}
    328332
     333/*
     334 * Add the options to WordPress if they don't exist.
     335 * File only gets included if enabled in options.
     336 */
     337add_option( 'related_du_show', json_encode(array( 'post' )), '', false );
     338add_option( 'related_du_list', json_encode(array( 'post' )), '', false );
  • related/trunk/readme.txt

    r3299254 r3436498  
    33Tags: related, related post, related posts, linked post, linked posts
    44Requires at least: 4.1
    5 Tested up to: 6.8
     5Tested up to: 6.9
    66Stable tag: 3.5.0
    77License: GPLv2 or later
     
    187187== Changelog ==
    188188
     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
    189196= 3.5.0 =
    190197* 2025-03-07
  • related/trunk/related.php

    r3299254 r3436498  
    22/*
    33Plugin Name: Manual Related Posts
    4 Plugin URI: https://wordpress.org/plugins/related/
     4Plugin URI: https://timelord.nl
    55Description: A simple 'related posts' plugin that lets you select related posts manually.
    66Version: 3.5.0
     
    9090            define('RELATED_VERSION', '3.5.0');
    9191            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__ ));
    9393            define('RELATED_URLPATH', plugins_url() . '/' . plugin_basename( __DIR__ ));
    9494        }
     
    169169            $verified = false;
    170170            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' );
    172172            }
    173173            if ( $verified == false ) {
  • related/trunk/related_du.php

    r3252079 r3436498  
    4040        protected function define_constants() {
    4141            define('RELATED_DU_FILE', plugin_basename( __DIR__ ));
    42             define('RELATED_DU_ABSPATH', str_replace('\\', '/', WP_PLUGIN_DIR . '/' . plugin_basename( __DIR__ )));
    4342        }
    4443
     
    9998            $verified = false;
    10099            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' );
    102101            }
    103102            if ( $verified == false ) {
     
    414413        $active = is_plugin_active( 'related/related_du.php' ); // bool; true or false
    415414        if ( $active ) {
    416             update_option('related_double_plugin', 1);
     415            update_option( 'related_double_plugin', 1, true );
    417416            deactivate_plugins( 'related/related_du.php' );
    418417        } else {
    419             update_option('related_double_plugin', 0);
     418            update_option( 'related_double_plugin', 0, true );
    420419        }
    421420    }
Note: See TracChangeset for help on using the changeset viewer.