Plugin Directory

Changeset 3831228


Ignore:
Timestamp:
11/28/2026 10:35:50 AM (less than one hour ago)
Author:
giuse
Message:
  1. 2.8.2
Location:
freesoul-deactivate-plugins/trunk
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • freesoul-deactivate-plugins/trunk/admin/classes/abstracts/class-eos-fdp-matrix-page.php

    r3432060 r3831228  
    7171                  <th class="fdp-legend" style="vertical-align:bottom;border-style:none;text-align:initial;padding-left:20px;margin-left:-20px">
    7272                        <?php do_action( 'fdp_table_head_first_col' ); ?>
    73                         <?php if( isset( $_GET['page'] ) ) do_action( 'fdp_table_head_first_col_' . esc_attr( sanitize_text_field( $_GET['page'] ) ) ); ?>
     73                        <?php if( isset( $_GET['page'] ) ) do_action( 'fdp_table_head_first_col_' . esc_attr( sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) ); ?>
    7474                        <?php $this->legend(); ?>
    7575                <div>
  • freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-archives.php

    r3443290 r3831228  
    149149                                        continue;
    150150                                }
    151                                 $labels        = get_post_type_labels( get_post_type_object( $post_type ) );
     151                                $labels        = $postTypeObj->labels;
    152152                                $labels_name   = isset( $labels->name ) ? $labels->name : $post_type;
    153153                                $post_type_obj = get_post_type_object( $post_type );
  • freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-custom-rows.php

    r3598276 r3831228  
    171171        <tr>
    172172          <td colspan="<?php echo count( $this->active_plugins ) + 2; ?>" id="eos-dp-url-actions" style="border:none;padding:0">
    173                 <button id="eos-dp-add-url" style="margin-top:16px"><?php echo apply_filters( 'fdp_add_url_button_text', esc_html__( 'Add URL', 'freesoul-deactivate-plugins' ) ); ?></button>
     173                <button id="eos-dp-add-url" style="margin-top:16px"><?php echo esc_html( apply_filters( 'fdp_add_url_button_text', __( 'Add URL', 'freesoul-deactivate-plugins' ) ) ); ?></button>
    174174          </td>
    175175        </tr>
  • freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-frontend-singles.php

    r3443290 r3831228  
    164164                $this->order = 'ASC';
    165165                $default_posts_per_page = ! wp_is_mobile() ? 30 : 15;
    166                 if( isset( $_REQUEST['posts_per_page'] ) && absint( $_REQUEST['posts_per_page'] ) > 0 ) {
    167                         $this->posts_per_page = esc_attr( sanitize_text_field( $_REQUEST['posts_per_page'] ) );
    168                 }
    169                 elseif( isset( $_COOKIE['fdp_posts_per_page'] ) && absint( $_COOKIE['fdp_posts_per_page'] ) > 0 ) {
    170                         $this->posts_per_page = absint( sanitize_text_field( $_COOKIE['fdp_posts_per_page'] ) );
     166                if( isset( $_REQUEST['posts_per_page'] ) && absint( wp_unslash( $_REQUEST['posts_per_page'] ) ) > 0 ) {
     167                        $this->posts_per_page = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['posts_per_page'] ) ) );
     168                }
     169                elseif( isset( $_COOKIE['fdp_posts_per_page'] ) && absint( wp_unslash( $_COOKIE['fdp_posts_per_page'] ) ) > 0 ) {
     170                        $this->posts_per_page = absint( sanitize_text_field( wp_unslash( $_COOKIE['fdp_posts_per_page'] ) ) );
    171171                }
    172172                else{
    173173                        $this->posts_per_page = $default_posts_per_page;
    174174                }
    175                 $this->post_type        = isset( $_GET['eos_dp_post_type'] ) ? esc_attr( sanitize_text_field( $_GET['eos_dp_post_type'] ) ) : 'page';
     175                $this->post_type        = isset( $_GET['eos_dp_post_type'] ) ? esc_attr( sanitize_text_field( wp_unslash( $_GET['eos_dp_post_type'] ) ) ) : 'page';
    176176                $this->title            = isset( $_GET['eos_dp_relevant_pages'] ) && 'true' === $_GET['eos_dp_relevant_pages'] ? esc_html__( 'Relevant Pages', 'freesoul-deactivate-plugins' ) : $this->active_label;
    177177                $this->dataset          = ' data-post_type="' . esc_attr( $this->post_type ) . '"';
    … …  
    189189                $current_labels_name        = '';
    190190                $need_custom_url            = array();
    191                 $ofs                        = isset( $_GET['eos_page'] ) && absint( $_GET['eos_page'] ) > 0 ? ( absint( $_GET['eos_page'] ) - 1 ) * $this->posts_per_page : 0;
     191                $ofs                        = isset( $_GET['eos_page'] ) && absint( wp_unslash( $_GET['eos_page'] ) ) > 0 ? ( absint( wp_unslash( $_GET['eos_page'] ) ) - 1 ) * $this->posts_per_page : 0;
    192192                $args                       = array(
    193193                        'post_type'      => $this->post_type,
    … …  
    197197                );
    198198                if( isset( $_REQUEST['orderby'] ) ) {
    199                         $args['orderby'] = $this->orderby = esc_attr( sanitize_text_field( $_REQUEST['orderby'] ) );
     199                        $args['orderby'] = $this->orderby = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ) );
    200200                }
    201201                elseif( isset( $_COOKIE['fdp_orderby'] ) ) {
    202                         $args['orderby'] = $this->orderby = esc_attr( sanitize_text_field( $_COOKIE['fdp_orderby'] ) );
     202                        $args['orderby'] = $this->orderby = esc_attr( sanitize_text_field( wp_unslash( $_COOKIE['fdp_orderby'] ) ) );
    203203                }
    204204                else {
    … …  
    207207
    208208                if( isset( $_REQUEST['order'] ) ) {
    209                         $args['order'] =$this->order = esc_attr( sanitize_text_field( $_REQUEST['order'] ) );
     209                        $args['order'] =$this->order = esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) );
    210210                }
    211211                elseif( isset( $_COOKIE['fdp_order'] ) ) {
    212                         $args['order'] = $this->order = esc_attr( sanitize_text_field( $_COOKIE['fdp_order'] ) );
     212                        $args['order'] = $this->order = esc_attr( sanitize_text_field( wp_unslash( $_COOKIE['fdp_order'] ) ) );
    213213                }
    214214                else {
    … …  
    220220                $this->is_hierarchical = is_post_type_hierarchical( $this->post_type );
    221221                if ( isset( $_GET['eos_dp_post_in'] ) && '' !== $_GET['eos_dp_post_in'] ) {
    222                         $args['post__in'] = explode( '-', esc_attr( sanitize_text_field( $_GET['eos_dp_post_in'] ) ) );
     222                        $args['post__in'] = explode( '-', esc_attr( sanitize_text_field( wp_unslash( $_GET['eos_dp_post_in'] ) ) ) );
    223223                }
    224224                if ( isset( $_GET['eos_post_title'] ) ) {
    225225                        ?><h2><?php
    226226                        // translators: %s is the post title.
    227                         printf( esc_html__( 'Results for %s', 'freesoul-deactivate-plugins' ), esc_html( sanitize_text_field( $_GET['eos_post_title'] ) ) ); ?></h2>
     227                        printf( esc_html__( 'Results for %s', 'freesoul-deactivate-plugins' ), esc_html( sanitize_text_field( wp_unslash( $_GET['eos_post_title'] ) ) ) ); ?></h2>
    228228                        <?php
    229                         $args['s'] = esc_attr( urldecode( $_GET['eos_post_title'] ) ); //@codingStandardsIgnoreLine.
     229                        $args['s'] = esc_attr( urldecode( wp_unslash( $_GET['eos_post_title'] ) ) ); //@codingStandardsIgnoreLine.
    230230                        // No need for sanitization, esc_attr used after urldecode.
    231231                }
    … …  
    239239                printf( esc_html__( 'Results for %s', 'freesoul-deactivate-plugins' ), esc_html( $cat ) ); ?></h2>
    240240                        <?php
    241                         $args['category'] = sanitize_title( $_GET['eos_cat'] );
     241                        $args['category'] = sanitize_title( wp_unslash( $_GET['eos_cat'] ) );
    242242                }
    243243                if ( isset( $_GET['tax_name'] ) && isset( $_GET['term_slug'] ) ) {
    244244                        $args['tax_query'] = array( // phpcs:ignore WordPress.DB.SlowDBQuery -- This query is absolutely needed and it's the faster way.
    245245                                array(
    246                                         'taxonomy' => esc_attr( sanitize_text_field( $_GET['tax_name'] ) ),
     246                                        'taxonomy' => esc_attr( sanitize_text_field( wp_unslash( $_GET['tax_name'] ) ) ),
    247247                                        'field'    => 'slug',
    248                                         'terms'    => esc_attr( sanitize_text_field( $_GET['term_slug'] ) ),
     248                                        'terms'    => esc_attr( sanitize_text_field( wp_unslash( $_GET['term_slug'] ) ) ),
    249249                                ),
    250250                        );
    … …  
    263263                $this->important_pages   = eos_dp_important_pages();
    264264               
    265                 $pagination = isset( $_GET['eos_page'] ) && absint( $_GET['eos_page'] ) > 0 ? absint( $_GET['eos_page'] ) : 1;
     265                $pagination = isset( $_GET['eos_page'] ) && absint( wp_unslash( $_GET['eos_page'] ) ) > 0 ? absint( wp_unslash( $_GET['eos_page'] ) ) : 1;
    266266                if ( isset( $_GET['eos_dp_home'] ) && 'true' === $_GET['eos_dp_home'] ) {
    267267                        $this->show_on_front = eos_dp_get_option( 'show_on_front' );
    … …  
    280280                $this->posts              = ! $this->is_home ? get_posts( $args ) : array( get_post( $this->page_on_front ) );
    281281                if( 'custom_order' === $this->orderby && isset( $_COOKIE['fdp_single_rows_order_' . esc_attr( $pagination )] ) && ! empty( $_COOKIE['fdp_single_rows_order_' . esc_attr( $pagination )] ) ) {
    282                         $saved_order = explode( ',', sanitize_text_field( $_COOKIE['fdp_single_rows_order_' . esc_attr( $pagination )] ) );
     282                        $saved_order = explode( ',', sanitize_text_field( wp_unslash( $_COOKIE['fdp_single_rows_order_' . esc_attr( $pagination )] ) ) );
    283283                        $new_order = $new_posts = array();
    284284                        $found = $not_found = 0;
    … …  
    301301                }
    302302               
    303                 $this->fdp_is_single_post = 1 === count( $this->posts ) || ( isset( $_GET['eos_dp_post_in'] ) && absint( $_GET['eos_dp_post_in'] ) > 0 && isset( $_GET['single_post'] ) && 1 === absint( $_GET['single_post'] ) );
     303                $this->fdp_is_single_post = 1 === count( $this->posts ) || ( isset( $_GET['eos_dp_post_in'] ) && absint( wp_unslash( $_GET['eos_dp_post_in'] ) ) > 0 && isset( $_GET['single_post'] ) && 1 === absint( wp_unslash( $_GET['single_post'] ) ) );
    304304                if ( $this->fdp_is_single_post && ! isset( $_GET['eos_dp_post_in'] ) ) {
    305305                        $single_post          = $this->posts[0];
    306306                        $this->single_post_id = $single_post->ID;
    307307                } else {
    308                         $this->single_post_id = isset( $_GET['eos_dp_post_in'] ) ? absint( $_GET['eos_dp_post_in'] ) : false;
     308                        $this->single_post_id = isset( $_GET['eos_dp_post_in'] ) ? absint( wp_unslash( $_GET['eos_dp_post_in'] ) ) : false;
    309309                        $taxs                 = get_taxonomies( array(), 'objects' );
    310310                }
    … …  
    316316                        $published_posts = $count_posts->publish + $count_posts->future + $count_posts->draft + $count_posts->pending + $count_posts->private;
    317317                        $pagesN          = ceil( $published_posts / max( 1, $this->posts_per_page ) );
    318                         $current_page    = isset( $_GET['eos_page'] ) ? sanitize_text_field( $_GET['eos_page'] ) : 1;
     318                        $current_page    = isset( $_GET['eos_page'] ) ? sanitize_text_field( wp_unslash( $_GET['eos_page'] ) ) : 1;
    319319                        ?>
    320320          <div id="eos-dp-pagination-wrp" class="right">
    … …  
    358358                                        <h4 style="margin-bottom:0"><?php esc_html_e( 'Device', 'freesoul-deactivate-plugins' ); ?></h4>
    359359                                        <select id="eos-dp-device">
    360                                                 <option value="all"<?php echo isset( $_REQUEST['device'] ) && strtolower( sanitize_text_field( $_REQUEST['device'] ) ) === 'all' ? ' selected' : ''; ?>><?php esc_html_e( 'All devices', 'freesoul-deactivate-plugins' ); ?></option>
    361                                                 <option value="desktop"<?php echo isset( $_REQUEST['device'] ) && strtolower( sanitize_text_field( $_REQUEST['device'] ) ) === 'desktop' ? ' selected' : ''; ?>><?php esc_html_e( 'Desktop devices', 'freesoul-deactivate-plugins' ); ?></option>
    362                                                 <option value="mobile"<?php echo isset( $_REQUEST['device'] ) && strtolower( sanitize_text_field( $_REQUEST['device'] ) ) === 'mobile' ? ' selected' : ''; ?>><?php esc_html_e( 'Mobile devices', 'freesoul-deactivate-plugins' ); ?></option>
     360                                                <option value="all"<?php echo isset( $_REQUEST['device'] ) && strtolower( sanitize_text_field( wp_unslash( $_REQUEST['device'] ) ) ) === 'all' ? ' selected' : ''; ?>><?php esc_html_e( 'All devices', 'freesoul-deactivate-plugins' ); ?></option>
     361                                                <option value="desktop"<?php echo isset( $_REQUEST['device'] ) && strtolower( sanitize_text_field( wp_unslash( $_REQUEST['device'] ) ) ) === 'desktop' ? ' selected' : ''; ?>><?php esc_html_e( 'Desktop devices', 'freesoul-deactivate-plugins' ); ?></option>
     362                                                <option value="mobile"<?php echo isset( $_REQUEST['device'] ) && strtolower( sanitize_text_field( wp_unslash( $_REQUEST['device'] ) ) ) === 'mobile' ? ' selected' : ''; ?>><?php esc_html_e( 'Mobile devices', 'freesoul-deactivate-plugins' ); ?></option>
    363363                                        </select>
    364364                                </div>
    … …  
    404404                $published_posts = $count_posts->publish + $count_posts->future + $count_posts->draft + $count_posts->pending + $count_posts->private;
    405405                $pagesN          = ceil( $published_posts / max( 1, $this->posts_per_page ) );
    406                 $current_page    = isset( $_GET['eos_page'] ) ? sanitize_text_field( $_GET['eos_page'] ) : 1;
     406                $current_page    = isset( $_GET['eos_page'] ) ? sanitize_text_field( wp_unslash( $_GET['eos_page'] ) ) : 1;
    407407                if ( $this->fdp_is_single_post ) {
    408408                        add_filter( 'admin_footer_text', '__return_false', 999999 );
  • freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-license-manager.php

    r3443290 r3831228  
    3838                                                        update_option( '_site_transient_update_themes', '' );
    3939                                                        set_site_transient( 'update_themes', null );
    40                                                         wp_redirect( admin_url( 'plugins.php' ) );
     40                                                        wp_safe_redirect( admin_url( 'plugins.php' ) );
    4141                                                        exit;
    4242                                                }
    … …  
    7878                }
    7979                function handleServerRequest() {
    80                         $type = isset( $_GET['type'] ) ? strtolower( sanitize_text_field( $_GET['type'] ) ) : '';
     80                        $type = isset( $_GET['type'] ) ? strtolower( sanitize_text_field( wp_unslash( $_GET['type'] ) ) ) : '';
    8181                        switch ( $type ) {
    8282                                case 'rl': // remove license,
    … …  
    293293                                $password = $this->key;
    294294                        }
    295                         $plainText = rand( 10, 99 ) . $plainText . rand( 10, 99 );
     295                        $plainText = wp_rand( 10, 99 ) . $plainText . wp_rand( 10, 99 );
    296296                        $method    = 'aes-256-cbc';
    297297                        $key       = substr( hash( 'sha256', $password, true ), 0, 32 );
    … …  
    330330                        } elseif( isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['SCRIPT_NAME'] ) ) {
    331331                                $base_url  = ( ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' ) ? 'https' : 'http' );
    332                                 $base_url .= '://' . sanitize_text_field( $_SERVER['HTTP_HOST'] );
    333                                 $base_url .= str_replace( basename( sanitize_text_field( $_SERVER['SCRIPT_NAME'] ) ), '', sanitize_text_field( $_SERVER['SCRIPT_NAME'] ) );
     332                                $base_url .= '://' . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) );
     333                                $base_url .= str_replace( basename( sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_NAME'] ) ) ), '', sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_NAME'] ) ) );
    334334
    335335                                return $base_url;
  • freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-load-addons.php

    r3443290 r3831228  
    131131     */
    132132    public function do_settings_page() {
    133         if( ! isset( $_GET['page'] ) || false === strpos( sanitize_text_field( $_GET['page'] ), 'eos_dp_' ) ) {
     133        if( ! isset( $_GET['page'] ) || false === strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ), 'eos_dp_' ) ) {
    134134            return;
    135135        }
    136         $addon_slug = ltrim( sanitize_text_field ( $_GET['page'] ), 'eos_dp_' );
     136        $addon_slug = ltrim( sanitize_text_field ( wp_unslash( $_GET['page'] ) ), 'eos_dp_' );
    137137        fdp_add_plugins_settings_page( sanitize_key( sanitize_text_field( $addon_slug ) ), $this->titles[ esc_attr( $addon_slug ) ] );
    138138    }
  • freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-plugin-factory.php

    r3443290 r3831228  
    4343                ?>
    4444                <section id="fdp-create-plugin-wrp">
    45                         <?php if( ! is_writable( WP_PLUGIN_DIR ) ) { ?>
     45                        <?php if ( ! eos_dp_is_writable( WP_PLUGIN_DIR ) ) { ?>
    4646                        <div class="eos-dp-notice notice notice-warning" style="padding:10px;font-size:20px"><?php esc_html_e( 'It looks like you do not have write permissions for the plugins folder. New plugins cannot be created until the plugins folder is writable.', 'freesoul-deactivate-plugins' ); ?></div>
    4747                        <?php } ?>
    … …  
    112112                ?>
    113113                <div id="fdp-create-plugins-instructions">
    114                         <p style="margin-top:32px"><span id="fdp-create-plugin" class="button<?php echo  ! is_writable( WP_PLUGIN_DIR ) ? ' eos-no-events' : ''; ?>"><span class="dashicons dashicons-admin-plugins" style="margin:4px 0"></span><?php esc_html_e( 'Create plugin', 'freesoul-deactivate-plugins' ); ?></span></p>
     114                        <p style="margin-top:32px"><span id="fdp-create-plugin" class="button<?php echo ! eos_dp_is_writable( WP_PLUGIN_DIR ) ? ' eos-no-events' : ''; ?>"><span class="dashicons dashicons-admin-plugins" style="margin:4px 0"></span><?php esc_html_e( 'Create plugin', 'freesoul-deactivate-plugins' ); ?></span></p>
    115115                        <p><?php esc_html_e( 'When you click the button, FDP will create an empty new plugin for your custom code.', 'freesoul-deactivate-plugins' ); ?></p>
    116116                        <p><?php esc_html_e( 'You will need to activate the new plugin as you do for other plugins.', 'freesoul-deactivate-plugins' ); ?></p>
  • freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-submenu-item.php

    r2973443 r3831228  
    2525                }
    2626                $this->capability = apply_filters( 'eos_dp_settings_capability', $capability );
    27                 $this->callback   = isset( $_GET['page'] ) && $fdp_subitem_slug === sanitize_text_field( $_GET['page'] ) ? $callback : '__return_false';
     27                $this->callback   = isset( $_GET['page'] ) && $fdp_subitem_slug === sanitize_text_field( wp_unslash( $_GET['page'] ) ) ? $callback : '__return_false';
    2828                add_filter(
    2929                        'fdp_pages',
  • freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-terms-archives.php

    r3443290 r3831228  
    2828                $this->section_id          = 'eos-dp-by-archive-section';
    2929                $this->default_language    = eos_dp_default_language();
    30                 $this->current_tax         = isset( $_GET['eos_dp_tax'] ) ? sanitize_key( $_GET['eos_dp_tax'] ) : 'category';
     30                $this->current_tax         = isset( $_GET['eos_dp_tax'] ) ? sanitize_key( wp_unslash( $_GET['eos_dp_tax'] ) ) : 'category';
    3131                $this->tax                 = get_taxonomy( $this->current_tax );
    3232                $this->terms               = get_terms(
    … …  
    150150                                $active      = false;
    151151                                $labels_name = isset( $term->name ) ? $term->name : 'unkown';
    152                                 if ( isset( $_GET['l'] ) && strtolower( sanitize_text_field( $_GET['l'] ) ) !== strtolower( mb_substr( $labels_name, 0, 1 ) ) && 'all' !== strtolower( sanitize_text_field( $_GET['l'] ) ) ) {
     152                                if ( isset( $_GET['l'] ) && strtolower( sanitize_text_field( wp_unslash( $_GET['l'] ) ) ) !== strtolower( mb_substr( $labels_name, 0, 1 ) ) && 'all' !== strtolower( sanitize_text_field( wp_unslash( $_GET['l'] ) ) ) ) {
    153153                                        --$row;
    154154                                        continue;
    … …  
    203203                                                $values = array_fill( 0, count( $this->active_plugins ), ',' );
    204204                                        }
    205                                         if( $row > 1 && isset( $_GET['only-all'] ) && '1' === sanitize_text_field( $_GET['only-all'] ) ) break;
     205                                        if( $row > 1 && isset( $_GET['only-all'] ) && '1' === sanitize_text_field( wp_unslash( $_GET['only-all'] ) ) ) break;
    206206                                        ?>
    207207                  <tr class="eos-dp-archive-row eos-dp-post-row<?php
  • freesoul-deactivate-plugins/trunk/admin/eos-dp-ajax.php

    r3665736 r3831228  
    1414function eos_dp_save_settings() {
    1515        eos_dp_check_intentions_and_rights( 'eos_dp_setts' );
     16        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_setts' );
    1617        if ( isset( $_POST['eos_dp_setts'] ) && ! empty( $_POST['eos_dp_setts'] ) ) {
    1718                $opts      = $_POST['eos_dp_setts']; // @codingStandardsIgnoreLine.
    … …  
    8990function eos_dp_save_archives_settings() {
    9091        eos_dp_check_intentions_and_rights( 'eos_dp_arch_setts' );
     92        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_arch_setts' );
    9193        if ( isset( $_POST['archivesUrls'] ) && ! empty( $_POST['archivesUrls'] ) ) {
    9294                foreach ( $_POST['archivesUrls'] as $archive_path => $arr ) { // @codingStandardsIgnoreLine. We sanitize later.
    … …  
    134136function eos_dp_save_post_type_settings() {
    135137        eos_dp_check_intentions_and_rights( 'eos_dp_pt_setts' );
     138        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_pt_setts' );
    136139        if ( isset( $_POST['eos_dp_pt_setts'] ) && ! empty( $_POST['eos_dp_pt_setts'] ) ) {
    137140                $opts = eos_dp_get_updated_plugins_table();
    … …  
    159162function eos_dp_save_url_settings() {
    160163        if ( isset( $_POST['page_slug'] ) && isset( $_POST['setts'] ) && ! empty( $_POST['setts'] ) ) {
    161                 eos_dp_check_intentions_and_rights( sanitize_key( $_POST['page_slug'] ) . '_setts' );
     164                eos_dp_check_intentions_and_rights( sanitize_key( wp_unslash( $_POST['page_slug'] ) ) . '_setts' );
     165                wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', sanitize_key( wp_unslash( $_POST['page_slug'] ) ) . '_setts' );
    162166                $rows  = json_decode( str_replace( '\\', '', sanitize_text_field( wp_unslash( $_POST['setts'] ) ) ), true );
    163167                $n     = 0;
    … …  
    209213function eos_dp_save_one_col_settings() {
    210214        if ( isset( $_POST['opt_name'] ) ) {
    211                 eos_dp_check_intentions_and_rights( 'eos_dp_' . sanitize_key( $_POST['opt_name'] ) . '_setts' );
     215                eos_dp_check_intentions_and_rights( 'eos_dp_' . sanitize_key( wp_unslash( $_POST['opt_name'] ) ) . '_setts' );
     216                wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_' . sanitize_key( wp_unslash( $_POST['opt_name'] ) ) . '_setts' );
    212217                if ( isset( $_POST['data'] ) && ! empty( $_POST['data'] ) ) {
    213218                        $opts = array_filter( explode( ',', sanitize_text_field( wp_unslash( $_POST['data'] ) ) ) );
    214                         eos_dp_update_option( 'eos_dp_' . sanitize_key( $_POST['opt_name'] ), $opts );
     219                        eos_dp_update_option( 'eos_dp_' . sanitize_key( wp_unslash( $_POST['opt_name'] ) ), $opts );
    215220                        echo 1;
    216221                        die();
    … …  
    225230function eos_dp_save_admin_settings() {
    226231        eos_dp_check_intentions_and_rights( 'eos_dp_admin_setts' );
     232        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_admin_setts' );
     233        if ( ! isset( $_POST['eos_dp_admin_setts'] ) ) {
     234                die();
     235                exit;
     236        }
    227237        $opts = json_decode( str_replace( '\\', '', sanitize_text_field( wp_unslash( $_POST['eos_dp_admin_setts'] ) ) ), true );
    228238        eos_dp_update_option( 'eos_dp_new_plugin_activated', false );
    … …  
    261271                exit;
    262272        }
    263         eos_dp_check_intentions_and_rights( sanitize_key( $_POST['page_slug'] ) . '_nonce' );
    264         eos_dp_update_option( sanitize_key( $_POST['page_slug'] ), stripslashes( str_replace( get_home_url(), '[home]', sanitize_text_field( wp_unslash( $_POST['data'] ) ) ) ) );
     273        eos_dp_check_intentions_and_rights( sanitize_key( wp_unslash( $_POST['page_slug'] ) ) . '_nonce' );
     274        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', sanitize_key( wp_unslash( $_POST['page_slug'] ) ) . '_nonce' );
     275        eos_dp_update_option( sanitize_key( wp_unslash( $_POST['page_slug'] ) ), stripslashes( str_replace( get_home_url(), '[home]', sanitize_text_field( wp_unslash( $_POST['data'] ) ) ) ) );
    265276        echo 1;
    266277        die();
    … …  
    272283function eos_dp_save_integration_actions_settings() {
    273284        eos_dp_check_intentions_and_rights( 'eos_dp_integration_actions_setts' );
     285        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_integration_actions_setts' );
     286        if ( ! isset( $_POST['integration_plugins'] ) ) {
     287                die();
     288                exit;
     289        }
    274290        $opts = json_decode( str_replace( '\\', '', sanitize_text_field( wp_unslash( $_POST['integration_plugins'] ) ) ), true );
    275291        eos_dp_update_option( 'eos_dp_new_plugin_activated', false );
    … …  
    306322function eos_dp_save_firing_order() {
    307323        eos_dp_check_intentions_and_rights( 'eos_dp_firing_order_setts' );
     324        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_firing_order_setts' );
    308325        if ( empty( $_POST['eos_dp_plugins'] ) || ! is_array( $_POST['eos_dp_plugins'] ) ) {
    309326                echo 0;
    … …  
    328345// Prepare the transient for the preview.
    329346function eos_dp_preview() {
    330         $nonceStr = isset( $_POST['post_id'] ) ? 'eos_dp_setts' : 'eos_dp_arch_setts';
    331         $nonceStr = isset( $_POST['admin_page'] ) ? 'eos_dp_admin_setts' : $nonceStr;
     347        $nonce    = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '';
     348        $nonceStr = 'eos_dp_arch_setts';
     349        if ( wp_verify_nonce( $nonce, 'eos_dp_admin_setts' ) ) {
     350                $nonceStr = 'eos_dp_admin_setts';
     351        } elseif ( wp_verify_nonce( $nonce, 'eos_dp_setts' ) ) {
     352                $nonceStr = 'eos_dp_setts';
     353        } elseif ( wp_verify_nonce( $nonce, 'eos_dp_arch_setts' ) ) {
     354                $nonceStr = 'eos_dp_arch_setts';
     355        }
    332356        eos_dp_check_intentions_and_rights( $nonceStr );
    333357        if ( isset( $_POST['plugin_path'] ) && isset( $_POST['microtime'] ) ) {
    … …  
    347371                        set_transient( 'fdp_test_' . $admin_page_key . '_' . $microtime, sanitize_text_field( wp_unslash( $_POST['plugin_path'] ) ), 60 );
    348372                }
    349                 if ( isset( $_POST['post_id'] ) && absint( $_POST['post_id'] ) > 0 ) {
    350                         set_transient( 'fdp_test_' . sanitize_key( $_POST['post_id'] ) . '_' . $microtime, sanitize_text_field( wp_unslash( $_POST['plugin_path'] ) ), 60 );
     373                if ( isset( $_POST['post_id'] ) && absint( wp_unslash( $_POST['post_id'] ) ) > 0 ) {
     374                        set_transient( 'fdp_test_' . sanitize_key( wp_unslash( $_POST['post_id'] ) ) . '_' . $microtime, sanitize_text_field( wp_unslash( $_POST['plugin_path'] ) ), 60 );
    351375                }
    352376                if ( isset( $_POST['post_type'] ) && '' !== $_POST['post_type'] ) {
    353                         set_transient( 'fdp_test_' . sanitize_key( $_POST['post_type'] ) . '_' . $microtime, sanitize_text_field( wp_unslash( $_POST['plugin_path'] ) ), 60 );
     377                        set_transient( 'fdp_test_' . sanitize_key( wp_unslash( $_POST['post_type'] ) ) . '_' . $microtime, sanitize_text_field( wp_unslash( $_POST['plugin_path'] ) ), 60 );
    354378                }
    355379                if ( isset( $_POST['tax'] ) && '' !== $_POST['tax'] ) {
    356                         set_transient( 'fdp_test_' . sanitize_key( $_POST['tax'] ) . '_' . $microtime, sanitize_text_field( wp_unslash( $_POST['plugin_path'] ) ), 60 );
     380                        set_transient( 'fdp_test_' . sanitize_key( wp_unslash( $_POST['tax'] ) ) . '_' . $microtime, sanitize_text_field( wp_unslash( $_POST['plugin_path'] ) ), 60 );
    357381                }
    358382                if ( isset( $_POST['page_speed_insights'] ) && 'true' === sanitize_text_field( wp_unslash( $_POST['page_speed_insights'] ) ) ) {
    … …  
    369393function eos_dp_check_single_padlock() {
    370394        eos_dp_check_intentions_and_rights( 'eos_dp_setts' );
     395        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_setts' );
    371396        if ( isset( $_POST['post_type'] ) ) {
    372397                        $plugins_table = eos_dp_plugins_table();
    373                         $arr           = $plugins_table[ sanitize_key( $_POST['post_type'] ) ];
     398                        $arr           = $plugins_table[ sanitize_key( wp_unslash( $_POST['post_type'] ) ) ];
    374399                        echo ! isset( $arr[0] ) || $arr[0] == '1' ? 'override' : 'not-override';
    375400                        die();
    … …  
    397422
    398423        }
    399         $post_args     = $post_args ? $post_args : $_POST;
    400         $internal_call = isset( $post_args['internal_call'] ) && true === $post_args['internal_call'];
     424        // Only trust internal_call when a PHP caller passed an array (never from request body / AJAX payload).
     425        $trusted_php_call = is_array( $post_args );
     426        $post_args        = $trusted_php_call ? $post_args : $_POST;
     427        // Always authorize AJAX and PHP entry points; never skip via a request field such as nonce_checked.
     428        eos_dp_check_intentions_and_rights( 'eos_dp_pro_auto_settings' );
     429        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_pro_auto_settings' );
     430        $internal_call = $trusted_php_call && isset( $post_args['internal_call'] ) && true === $post_args['internal_call'];
    401431        $cron          = $internal_call ? 'cron_' : '';
    402         if ( ! isset( $post_args['nonce_checked'] ) || true !== $post_args['nonce_checked'] ) {
    403                 eos_dp_check_intentions_and_rights( 'eos_dp_pro_auto_settings' );
    404         }
    405432        if ( ! isset( $post_args['post_id'] ) && ! isset( $post_args['post_type'] ) && ! isset( $post_args['tax'] ) ) {
    406433                echo 0;
    … …  
    456483                $args['fdp_post_type'] = esc_attr( $post_args['post_type'] );
    457484        } elseif ( isset( $post_args['term_type'] ) && isset( $post_args['tax'] ) && isset( $post_args['href'] ) ) {
    458                 $permalink       = esc_url( sanitize_text_field( $post_args['href'] ) );
     485                $permalink = esc_url_raw( sanitize_text_field( $post_args['href'] ) );
     486                if ( ! eos_dp_is_same_site_url( $permalink ) ) {
     487                        echo 'error';
     488                        die();
     489                        exit;
     490                }
    459491                $transient_name  = 'fdp_test_' . $cron . sanitize_key( $post_args['tax'] ) . '_';
    460492                $args['fdp_tax'] = esc_attr( sanitize_text_field( $post_args['tax'] ) );
    … …  
    574606// Auto settings New.
    575607function eos_dp_auto_settings( $post_args = false, $plugins = false ) {
    576         if ( ! $post_args ) {
     608        // Only trust internal_call when a PHP caller passed an array (never from request body / AJAX payload).
     609        $trusted_php_call = is_array( $post_args );
     610        if ( ! $trusted_php_call ) {
     611                if ( ! isset( $_POST['data'] ) ) {
     612                        echo 0;
     613                        die();
     614                        exit;
     615                }
    577616                $post_args = json_decode( stripslashes( sanitize_text_field( wp_unslash( $_POST['data'] ) ) ), true );
    578617        }
    579         $internal_call = isset( $post_args['internal_call'] ) && true === $post_args['internal_call'];
     618        // Always authorize; never skip via a request field such as nonce_checked.
     619        eos_dp_check_intentions_and_rights( 'eos_dp_pro_auto_settings' );
     620        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_pro_auto_settings' );
     621        $internal_call = $trusted_php_call && isset( $post_args['internal_call'] ) && true === $post_args['internal_call'];
    580622        $cron          = $internal_call ? 'cron_' : '';
    581         if ( ! isset( $post_args['nonce_checked'] ) || true !== $post_args['nonce_checked'] ) {
    582                 eos_dp_check_intentions_and_rights( 'eos_dp_pro_auto_settings' );
    583         }
    584623        if ( ! isset( $post_args['post_id'] ) && ! isset( $post_args['post_type'] ) && ! isset( $post_args['tax'] ) ) {
    585624                echo 0;
    … …  
    633672                $args['fdp_post_type'] = esc_attr( $post_args['post_type'] );
    634673        } elseif ( isset( $post_args['term_type'] ) && isset( $post_args['tax'] ) && isset( $post_args['href'] ) ) {
    635                 $permalink       = esc_url( sanitize_text_field( $post_args['href'] ) );
     674                $permalink = esc_url_raw( sanitize_text_field( $post_args['href'] ) );
     675                if ( ! eos_dp_is_same_site_url( $permalink ) ) {
     676                        echo 'error';
     677                        die();
     678                        exit;
     679                }
    636680                $transient_name  = 'fdp_test_' . $cron . sanitize_key( $post_args['tax'] ) . '_';
    637681                $args['fdp_tax'] = esc_attr( sanitize_text_field( $post_args['tax'] ) );
    … …  
    753797// Auto settings.
    754798function eos_dp_pro_auto_settings_admin( $post_args = false, $plugins = false ) {
    755         $post_args = $post_args ? $post_args : $_POST;
    756         $offset    = isset( $post_args['offset'] ) ? absint( $post_args['offset'] ) : 0;
     799        $trusted_php_call = is_array( $post_args );
     800        $post_args        = $trusted_php_call ? $post_args : $_POST;
     801        $offset           = isset( $post_args['offset'] ) ? absint( $post_args['offset'] ) : 0;
    757802        eos_dp_check_intentions_and_rights( 'eos_dp_pro_auto_settings_admin' );
    758         $internal_call     = isset( $post_args['internal_call'] ) && true === $post_args['internal_call'];
     803        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_pro_auto_settings_admin' );
     804        $internal_call     = $trusted_php_call && isset( $post_args['internal_call'] ) && true === $post_args['internal_call'];
    759805        $time0             = time();
    760806        $maxExeTime        = absint( ini_get( 'max_execution_time' ) );
    … …  
    857903// Retrieves the body HTML given the URL.
    858904function eos_dp_pro_count_by_url( $url, $plugin, $admin = false, $headers = false, $sleep_time = 300000 ) {
     905        if ( ! eos_dp_is_same_site_url( $url ) ) {
     906                return 'error';
     907        }
    859908        $url      = add_query_arg(
    860909                array(
    … …  
    870919        $args     = eos_dp_user_headers( $args, true );
    871920        usleep( absint( $sleep_time ) ); // Sleep to don't stress too much the CPU.
     921        // Same-site URLs may use localhost/private IPs in local setups; wp_safe_remote_request would reject those.
     922        // After eos_dp_is_same_site_url(), wp_remote_request cannot be abused for arbitrary-host SSRF.
    872923        $response = wp_remote_request( $url, $args );
    873924        if ( ! is_wp_error( $response ) ) {
    … …  
    9601011                                                                $home_url = $home_urlA[1];
    9611012                                                                if( str_replace( '/', '', $home_url ) !== $_SERVER['HTTP_HOST'] ){
    962                                                                         $subfolder = sanitize_text_field( substr( $home_url, strpos( $home_url, $_SERVER['HTTP_HOST'] ) + strlen( $_SERVER['HTTP_HOST'] ) + 1 ) );
     1013                                                                        $subfolder = sanitize_text_field( substr( $home_url, strpos( $home_url, wp_unslash( $_SERVER['HTTP_HOST'] ) ) + strlen( wp_unslash( $_SERVER['HTTP_HOST'] ) ) + 1 ) );
    9631014                                                                        $url_class = str_replace( '-'.$subfolder, '', $url_class );
    9641015                                                                }
    … …  
    10011052function eos_dp_debug_options() {
    10021053        eos_dp_check_intentions_and_rights( 'eos_dp_debug_options' );
     1054        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_debug_options' );
    10031055        if ( ! isset( $_POST['url'] ) || ! class_exists( 'DOMDocument' ) ) {
    10041056                echo 0;
    … …  
    10511103function eos_dp_msg_never_again() {
    10521104        eos_dp_check_intentions_and_rights( 'eos_dp_never_again_msg_user' );
     1105        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_never_again_msg_user' );
    10531106        if ( ! isset( $_POST['msg'] ) ) {
    10541107                echo 0;
    … …  
    10631116        $user_opts                                      = get_site_option( 'eos_dp_user_options' );
    10641117        $user_opts                                      = is_array( $user_opts ) && ! empty( $user_opts ) ? $user_opts : array();
    1065         $user_opts[ sanitize_key( $user->user_login ) ] = array( sanitize_key( $_POST['msg'] ) => 'never_again' );
     1118        $user_opts[ sanitize_key( $user->user_login ) ] = array( sanitize_key( wp_unslash( $_POST['msg'] ) ) => 'never_again' );
    10661119        update_site_option( 'eos_dp_user_options', $user_opts );
    10671120        die();
    … …  
    10711124// Check for intentions and rights.
    10721125function eos_dp_check_intentions_and_rights( $nonce_action ) {
     1126        if (
     1127                isset( $_POST['nonce'] )
     1128                && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), $nonce_action )
     1129                && current_user_can( 'activate_plugins' )
     1130        ) {
     1131                return;
     1132        }
    10731133        if ( isset( $_REQUEST['eos_dp_advanced_setup'] ) || isset( $GLOBALS['eos_dp_advanced_setup'] ) ) {
    10741134                $eos_dp_advanced_setup = isset( $GLOBALS['eos_dp_advanced_setup'] ) ? $GLOBALS['eos_dp_advanced_setup'] : sanitize_text_field( wp_unslash( $_REQUEST['eos_dp_advanced_setup'] ) );
    … …  
    10791139                }
    10801140        }
    1081         $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : false;
    1082         if (
    1083                 false === $nonce
    1084                 || ! wp_verify_nonce( $nonce, $nonce_action ) // check for intentions.
    1085                 || ! current_user_can( 'activate_plugins' ) // check for rights.
    1086         ) {
    1087                 echo 0;
    1088                 die();
    1089                 exit;
    1090         }
     1141        echo 0;
     1142        die();
     1143        exit;
    10911144}
    10921145
    … …  
    11161169        }
    11171170        eos_dp_check_intentions_and_rights( 'fdp_create_plugin' );
    1118         if ( ! is_writable( WP_PLUGIN_DIR ) ) {
     1171        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'fdp_create_plugin' );
     1172        if ( ! eos_dp_is_writable( WP_PLUGIN_DIR ) ) {
    11191173                echo json_encode( array( 'error' => esc_html__( 'No write permissions', 'freesoul-deactivate-plugins' ) ) );
    11201174                die();
    … …  
    11311185        $txt        .= PHP_EOL . 'Description: ' . sanitize_text_field( $description );
    11321186        $txt        .= PHP_EOL . 'Author: ' . sanitize_text_field( ucfirst( $author ) );
    1133         if ( isset( $_REQUEST['plugin_author_uri'] ) && '' !== $_REQUEST['plugin_author_uri'] && esc_url( sanitize_text_field( wp_unslash( $_REQUEST['plugin_author_uri'] ) ) ) === $_REQUEST['plugin_author_uri'] ) {
     1187        if ( isset( $_REQUEST['plugin_author_uri'] ) && '' !== $_REQUEST['plugin_author_uri'] && esc_url( sanitize_text_field( wp_unslash( $_REQUEST['plugin_author_uri'] ) ) ) === wp_unslash( $_REQUEST['plugin_author_uri'] ) ) {
    11341188                $txt .= PHP_EOL . 'Author URI: ' . esc_url( sanitize_text_field( wp_unslash( $_REQUEST['plugin_author_uri'] ) ) );
    11351189        }
    … …  
    12411295                exit;
    12421296        }
    1243         $url = wp_get_attachment_url( absint( $_REQUEST['id'] ) );
     1297        $url = wp_get_attachment_url( absint( wp_unslash( $_REQUEST['id'] ) ) );
    12441298        if ( $url ) {
    12451299                $file = str_replace( get_home_url(), ABSPATH, $url );
    … …  
    12721326                exit;
    12731327        }
    1274         $data = json_decode( sanitize_text_field( stripslashes( $_REQUEST['data'] ) ), true ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
     1328        $data = json_decode( sanitize_text_field( stripslashes( wp_unslash( $_REQUEST['data'] ) ) ), true ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
    12751329        if ( ! isset( $data['nonce'] ) || ! isset( $data['plugins'] ) || ! wp_verify_nonce( esc_attr( $data['nonce'] ), 'fdp_export_plugins_list' ) ) {
    12761330                die();
    … …  
    13191373                return;
    13201374        }
    1321         $data = json_decode( sanitize_text_field( stripslashes( $_POST['data'] ) ) ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
     1375        $data = json_decode( sanitize_text_field( stripslashes( wp_unslash( $_POST['data'] ) ) ) ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
    13221376        if ( ! isset( $data->opts_key ) || ! isset( $data->nonce ) || ! wp_verify_nonce( esc_attr( $data->nonce ), 'fdp_setts_nonce' ) ) {
    13231377                die();
    … …  
    13421396                $headers = array();
    13431397                if ( isset( $_POST['headers'] ) && ! empty( $_POST['headers'] ) ) {
    1344                         $headers = json_decode( sanitize_text_field( stripslashes( $_POST['headers'] ) ), true ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
     1398                        $headers = json_decode( sanitize_text_field( stripslashes( wp_unslash( $_POST['headers'] ) ) ), true ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
    13451399                }
    13461400                eos_dp_update_fdp_admin_menu(
    … …  
    13641418                return;
    13651419        }
    1366         $data = json_decode( sanitize_text_field( stripslashes( $_POST['data'] ) ) ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
     1420        $data = json_decode( sanitize_text_field( stripslashes( wp_unslash( $_POST['data'] ) ) ) ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
    13671421        if ( ! isset( $data->opts_key ) || ! isset( $data->nonce ) || ! wp_verify_nonce( esc_attr( $data->nonce ), sanitize_key( $data->opts_key ) ) ) {
    13681422                die();
    … …  
    13991453// Save Code Profiler preferences.
    14001454function eos_dp_code_profiler_save() {
    1401         if ( ! isset( $_POST['plugins'] ) || ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'fdp-cp-nonce' ) ) {
     1455        if ( ! isset( $_POST['plugins'] ) || ! isset( $_POST['fdp_cp'] ) || ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'fdp-cp-nonce' ) ) {
    14021456                die();
    14031457                exit;
    … …  
    14061460        $opts    = eos_dp_get_option( 'fdp_code_profiler' );
    14071461        echo esc_attr(
    1408                 ( $opts['fdp_cp'] === $_POST['fdp_cp'] && $opts['plugins'] === $plugins ) || eos_dp_update_option(
     1462                ( isset( $opts['fdp_cp'] ) && $opts['fdp_cp'] === $_POST['fdp_cp'] && isset( $opts['plugins'] ) && $opts['plugins'] === $plugins ) || eos_dp_update_option(
    14091463                        'fdp_code_profiler',
    14101464                        array(
    … …  
    16581712                return;
    16591713        }
    1660         $data = json_decode( sanitize_text_field( stripslashes( $_POST['data'] ) ) ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
     1714        $data = json_decode( sanitize_text_field( stripslashes( wp_unslash( $_POST['data'] ) ) ) ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
    16611715        if ( ! isset( $data->license_code ) || ! isset( $data->license_email ) || ! isset( $data->nonce ) || ! wp_verify_nonce( esc_attr( $data->nonce ), 'fdp_check_license_status' ) ) {
    16621716                die();
    … …  
    17071761                exit;
    17081762        }
    1709         $data = json_decode( sanitize_text_field( stripcslashes( $_POST['data'] ) ), true ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
     1763        $data = json_decode( sanitize_text_field( stripcslashes( wp_unslash( $_POST['data'] ) ) ), true ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
    17101764        if ( isset( $data['key'] ) ) {
    17111765                $user_id   = get_current_user_id();
    … …  
    17271781function eos_dp_move_option_to_filesystem() {
    17281782        eos_dp_check_intentions_and_rights( 'eos_dp_move_option_to_filesystem' );
     1783        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_move_option_to_filesystem' );
    17291784        $opts = eos_dp_get_option( 'eos_dp_opts' );
    17301785        if ( isset( $opts['filesystem_last_status'] ) && 'ok' === $opts['filesystem_last_status'] ) {
    … …  
    17431798function eos_dp_reset_fdp() {
    17441799        eos_dp_check_intentions_and_rights( 'eos_dp_reset_fdp' );
     1800        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_reset_fdp' );
    17451801        if ( isset( $_REQUEST['data'] ) && 'reset' === sanitize_text_field( wp_unslash( $_REQUEST['data'] ) ) ) {
    17461802                define( 'FDP_RESET_SETTINGS', true );
    … …  
    17641820        }
    17651821        eos_dp_check_intentions_and_rights( 'eos_dp_filesystem_db' );
     1822        wp_verify_nonce( isset( $_POST['nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['nonce'] ) ) : '', 'eos_dp_filesystem_db' );
    17661823        $opts   = eos_dp_get_option( 'eos_dp_opts' );
    1767         $arr    = json_decode( sanitize_text_field( stripslashes( wp_json_encode( $_POST['data'] ) ) ), true ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
     1824        $arr    = json_decode( sanitize_text_field( stripslashes( wp_json_encode( wp_unslash( $_POST['data'] ) ) ) ), true ); // @codingStandardsIgnoreLine. We sanitize after stripslashes.
    17681825        $option = sanitize_key( $arr['option'] );
    17691826        $to     = sanitize_key( $arr['to'] );
  • freesoul-deactivate-plugins/trunk/admin/eos-dp-helper.php

    r3665736 r3831228  
    300300        <?php
    301301        if( isset( $_GET['open-notification'] ) && sanitize_text_field( wp_unslash( $_GET['open-notification'] ) ) === esc_attr( sanitize_text_field( wp_unslash( $_GET['open-notification'] ) ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification -- No nonce needed here.
    302                 echo 'document.getElementById("' . esc_attr( $_GET['open-notification'] ) . '").className=document.getElementById("' . esc_js( esc_attr( $_GET['open-notification'] ) ) . '").className.replace("eos-hidden","eos-auto-shown");'; // phpcs:ignore WordPress.Security.NonceVerification -- No nonce needed here.
     302                echo 'document.getElementById("' . esc_attr( wp_unslash( $_GET['open-notification'] ) ) . '").className=document.getElementById("' . esc_js( esc_attr( wp_unslash( $_GET['open-notification'] ) ) ) . '").className.replace("eos-hidden","eos-auto-shown");'; // phpcs:ignore WordPress.Security.NonceVerification -- No nonce needed here.
    303303        }
    304304        ?>     
    … …  
    343343                array( 'eos_dp_menu', __( 'Experiments', 'freesoul-deactivate-plugins' ), __( 'Experiments', 'freesoul-deactivate-plugins' ), $capability, 'eos_dp_experiments', 'eos_dp_experiments_callback', 250 ),
    344344                array( 'eos_dp_menu', __( 'Help', 'freesoul-deactivate-plugins' ), __( 'Help', 'freesoul-deactivate-plugins' ), $capability, 'eos_dp_help', 'eos_dp_help_callback', 250 ),
    345                 array( 'eos_dp_menu', __( 'Add-ons', 'freesoul-deactivate-plugins' ), __( 'Add-ons', 'freesoul-deactivate-plugins' ), $capability, 'eos_dp_addons', 'eos_dp_addons_callback', 250 ),
    346345                array( 'fdp_hidden_menu', __( 'Deactivate by post type', 'freesoul-deactivate-plugins' ), __( 'Post Types', 'freesoul-deactivate-plugins' ), $capability, 'eos_dp_by_post_type', 'eos_dp_by_post_type_callback', 20 ),
    347346                array( 'fdp_hidden_menu', __( 'Deactivate by Archive', 'freesoul-deactivate-plugins' ), __( 'Archives', 'freesoul-deactivate-plugins' ), $capability, 'eos_dp_by_archive', 'eos_dp_by_archive_callback', 30 ),
    … …  
    788787                                'eos_dp_firing_order',
    789788                                'eos_dp_help',
    790                                 'eos_dp_addons',
    791789                                'eos_dp_hooks',
    792790                                'eos_dp_reset_settings',
    … …  
    834832                return false;
    835833        }
    836         return sanitize_key( $_GET['page'] ); // @codingStandardsIgnoreLine. Var already checked before calling the function.
     834        return sanitize_key( wp_unslash( $_GET['page'] ) ); // @codingStandardsIgnoreLine. Var already checked before calling the function.
    837835}
    838836
    … …  
    969967        global $wpdb;
    970968        if ( is_array( $ids ) ) {
    971                 $ids = implode( ',', array_map( 'absint', $ids ) );
     969                $ids = array_map( 'absint', $ids );
    972970        } elseif ( is_string( $ids ) ) {
    973                 $ids = implode( ',', array_map( 'absint', explode( ',', $ids ) ) );
    974         }
    975         $ids      = esc_sql( $ids );
    976         $meta_key = esc_sql( $meta_key );
    977         $sql      = "SELECT post_id,meta_value FROM $wpdb->postmeta WHERE post_id IN ($ids) AND meta_key='$meta_key';";
    978         return $wpdb->get_results( $sql, OBJECT ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- Values are escaped before they are used.
     971                $ids = array_map( 'absint', explode( ',', $ids ) );
     972        } else {
     973                return false;
     974        }
     975        $ids = array_values( array_filter( $ids ) );
     976        if ( empty( $ids ) ) {
     977                return false;
     978        }
     979        return $wpdb->get_results(
     980                $wpdb->prepare(
     981                        "SELECT post_id,meta_value FROM {$wpdb->postmeta} WHERE post_id IN (" . implode( ',', array_fill( 0, count( $ids ), '%d' ) ) . ') AND meta_key=%s',
     982                        array_merge( $ids, array( $meta_key ) )
     983                ),
     984                OBJECT
     985        );
    979986}
    980987
    … …  
    11911198// Delete options folder.
    11921199function eos_dp_delete_folder( $dirPath ) {
    1193         if ( is_dir( $dirPath ) ) {
    1194                 $files = array();
    1195                 $n     = 1;
    1196                 do {
    1197                         $files_n = glob( $dirPath . implode( '', array_fill( 0, $n, '/*' ) ) );
    1198                         if ( ! empty( $files_n ) ) {
    1199                                 $files[ $n - 1 ] = $files_n;
    1200                         }
    1201                         ++$n;
    1202                 } while ( ! empty( $files_n ) );
    1203                 $files = array_reverse( $files );
    1204                 foreach ( $files as $k => $values ) {
    1205                         foreach ( $values as $value ) {
    1206                                 if ( is_dir( $value ) ) {
    1207                                         rmdir( $value );
    1208                                 } else {
    1209                                         wp_delete_file( $value );
    1210                                 }
    1211                         }
    1212                 }
    1213                 rmdir( $dirPath );
     1200        if ( ! is_dir( $dirPath ) ) {
     1201                return;
     1202        }
     1203        $wp_filesystem = function_exists( 'eos_dp_get_wp_filesystem' ) ? eos_dp_get_wp_filesystem() : false;
     1204        if ( ! $wp_filesystem ) {
     1205                if ( ! function_exists( 'WP_Filesystem' ) ) {
     1206                        require_once ABSPATH . 'wp-admin/includes/file.php';
     1207                }
     1208                if ( WP_Filesystem() ) {
     1209                        global $wp_filesystem;
     1210                }
     1211        }
     1212        if ( $wp_filesystem ) {
     1213                $wp_filesystem->rmdir( $dirPath, true );
    12141214        }
    12151215}
    … …  
    12211221                $url .= sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) );
    12221222                if ( isset( $_SERVER['QUERY_STRING'] ) ) {
    1223                         $url .= '?' . sanitize_text_field( $_SERVER['QUERY_STRING'] );
     1223                        $url .= '?' . sanitize_text_field( wp_unslash( $_SERVER['QUERY_STRING'] ) );
    12241224                }
    12251225                return esc_url( $url );
    12261226        }
    12271227        return false;
     1228}
     1229
     1230/**
     1231 * Whether a URL targets this site (home or site host), for preview/SSRF hardening.
     1232 *
     1233 * Relative paths (no host) are treated as same-site. Only http/https are allowed.
     1234 *
     1235 * @param string $url URL to validate.
     1236 * @return bool
     1237 */
     1238function eos_dp_is_same_site_url( $url ) {
     1239        if ( empty( $url ) || ! is_string( $url ) ) {
     1240                return false;
     1241        }
     1242        $parsed = wp_parse_url( $url );
     1243        if ( false === $parsed || ! is_array( $parsed ) ) {
     1244                return false;
     1245        }
     1246        if ( ! empty( $parsed['scheme'] ) && ! in_array( strtolower( $parsed['scheme'] ), array( 'http', 'https' ), true ) ) {
     1247                return false;
     1248        }
     1249        if ( empty( $parsed['host'] ) ) {
     1250                return isset( $parsed['path'] ) && is_string( $parsed['path'] ) && '/' === substr( $parsed['path'], 0, 1 );
     1251        }
     1252        $url_host = strtolower( $parsed['host'] );
     1253        $allowed  = array();
     1254        foreach ( array( home_url(), site_url() ) as $base ) {
     1255                $host = wp_parse_url( $base, PHP_URL_HOST );
     1256                if ( $host ) {
     1257                        $allowed[] = strtolower( $host );
     1258                }
     1259        }
     1260        return in_array( $url_host, array_unique( $allowed ), true );
    12281261}
    12291262
    … …  
    12371270        }
    12381271        $headers = false;
    1239         if ( isset( $_POST['headers'] ) && ! empty( $_POST['headers'] ) ) {
    1240                 $headers = json_decode( sanitize_text_field( stripslashes( $_POST['headers'] ) ), true ); //@codingStandardsIgnoreLine.
     1272        // Only privileged users may supply request headers (prevents header injection via AJAX).
     1273        if ( current_user_can( 'activate_plugins' ) && isset( $_POST['headers'] ) && ! empty( $_POST['headers'] ) ) {
     1274                $headers = json_decode( sanitize_text_field( stripslashes( wp_unslash( $_POST['headers'] ) ) ), true ); //@codingStandardsIgnoreLine.
    12411275                // Sanitization applied after stripslashes.
    12421276        }
    … …  
    12461280                if ( isset( $_SERVER['HTTP_AUTHORIZATION'] ) && ! empty( $_SERVER['HTTP_AUTHORIZATION'] ) ) {
    12471281                        $args['headers'] = array(
    1248                                 'Authorization' => sanitize_text_field( $_SERVER['HTTP_AUTHORIZATION'] ),
     1282                                'Authorization' => sanitize_text_field( wp_unslash( $_SERVER['HTTP_AUTHORIZATION'] ) ),
    12491283                        );
    12501284                } elseif ( isset( $_SERVER['PHP_AUTH_USER'] ) && isset( $_SERVER['PHP_AUTH_PW'] ) && ! empty( $_SERVER['PHP_AUTH_USER'] ) ) {
  • freesoul-deactivate-plugins/trunk/admin/fdp-admin-base.php

    r3324562 r3831228  
    9191        $path .= '/opts.json';
    9292        $trashed_path = str_replace( 'opts.json', 'opts-trashed.json', $path );
     93        $wp_filesystem = function_exists( 'eos_dp_get_wp_filesystem' ) ? eos_dp_get_wp_filesystem() : false;
     94        if ( ! $wp_filesystem ) {
     95                if ( ! function_exists( 'WP_Filesystem' ) ) {
     96                        require_once ABSPATH . 'wp-admin/includes/file.php';
     97                }
     98                if ( WP_Filesystem() ) {
     99                        global $wp_filesystem;
     100                }
     101        }
    93102        if( 'trash' === $action ) {
    94103                // Transition from untrashed to trashed.
    95                 if( file_exists( $path ) ) {
    96                         rename( $path, $trashed_path );
     104                if ( $wp_filesystem && $wp_filesystem->exists( $path ) ) {
     105                        $wp_filesystem->move( $path, $trashed_path, true );
    97106                }
    98107                $post_meta = get_post_meta( $post_id,'_eos_deactive_plugins_key',true );
    … …  
    102111        elseif( 'untrash' === $action ) {
    103112                // Transition from trashed to untrashed.
    104                 if( file_exists( $trashed_path ) ) {
    105                         rename( $trashed_path, $path );
     113                if ( $wp_filesystem && $wp_filesystem->exists( $trashed_path ) ) {
     114                        $wp_filesystem->move( $trashed_path, $path, true );
    106115                }
    107116                $post_meta = get_post_meta( $post_id,'_eos_deactive_plugins_key_trashed',true );
  • freesoul-deactivate-plugins/trunk/admin/fdp-admin.php

    r3617393 r3831228  
    1212define( 'FDP_STORE_URL', 'https://shop.freesoul-deactivate-plugins.com/' );
    1313
    14 if ( isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( $_REQUEST['action'] ), array( 'edit', 'editpost' ) ) ) {
     14if ( isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ), array( 'edit', 'editpost' ) ) ) {
    1515        add_action(
    1616                'admin_init',
    … …  
    7979                        'nocache_headers',
    8080                        function( $headers ) {
    81                                 $scheme = is_ssl() ? 'https' : parse_url( get_home_url(), PHP_URL_SCHEME );
     81                                $scheme = is_ssl() ? 'https' : wp_parse_url( get_home_url(), PHP_URL_SCHEME );
    8282                                $domain = str_replace( $scheme . '://', '', get_home_url() );
    8383                                $domain = false !== strpos( $domain, '/' ) ? stristr( $domain, '/', true ) : $domain;
    … …  
    122122                array( array( 'eos_dp_experiments' ), 'pages/eos-dp-experiments.php' ),
    123123                array( array( 'eos_dp_help' ), 'pages/eos-dp-help.php' ),
    124                 array( array( 'eos_dp_addons' ), 'pages/eos-dp-addons.php' ),
    125124                array( array( 'eos_dp_create_plugin' ), 'pages/eos-dp-create-plugin.php' ),
    126125                array( array( 'eos_dp_favorite_plugins' ), 'pages/eos-dp-favorite-plugins.php' ),
    … …  
    198197        $label = '';
    199198        if( isset( $_GET['eos_dp_post_type' ] ) ){
    200                 $post_type = get_post_type_object( sanitize_text_field( $_GET['eos_dp_post_type' ] ) );
     199                $post_type = get_post_type_object( sanitize_text_field( wp_unslash( $_GET['eos_dp_post_type' ] ) ) );
    201200                if( $post_type ){
    202201                        $label = ' | ' . $post_type->labels->name;
    … …  
    204203        }
    205204        elseif( isset( $_GET['eos_dp_tax' ] ) && isset( $_GET['tpt'] ) ){
    206                 $tax = get_taxonomy( sanitize_text_field( $_GET['eos_dp_tax' ] ) );
     205                $tax = get_taxonomy( sanitize_text_field( wp_unslash( $_GET['eos_dp_tax' ] ) ) );
    207206                if( $tax ){
    208207                        $label = ' | ' . $tax->label;
    209                         $post_type = get_post_type_object( sanitize_text_field( $_GET['tpt' ] ) );
     208                        $post_type = get_post_type_object( sanitize_text_field( wp_unslash( $_GET['tpt' ] ) ) );
    210209                        if( $post_type ){
    211210                                $label .= ' (' . $post_type->labels->name . ')';
    … …  
    215214        if ( isset( $_GET['asset_type'] ) && in_array( $_GET['asset_type'], array_keys( $labels ) ) ) {
    216215                // translators: %s is the asset type label.
    217                 $titles['eos_dp_pro_assets'] = sprintf( esc_attr__( 'Assets | %s', 'freesoul-deactivate-plugins' ), esc_html( $labels[ sanitize_text_field( $_GET['asset_type'] ) ] ) );
     216                $titles['eos_dp_pro_assets'] = sprintf( esc_attr__( 'Assets | %s', 'freesoul-deactivate-plugins' ), esc_html( $labels[ sanitize_text_field( wp_unslash( $_GET['asset_type'] ) ) ] ) );
    218217        }
    219218        if ( isset( $_GET['page'] ) && in_array( $_GET['page'], array_keys( $titles ) ) ) {
    … …  
    223222                if ( isset( $_GET['tab'] ) ) {
    224223                        // translators: %1$s is the page title, %2$s is the tab title.
    225                         return '&#128268; ' . esc_html( sprintf( esc_attr__( '%1$s | %2$s', 'freesoul-deactivate-plugins' ), $titles[ sanitize_text_field( $_GET['page'] ) ], $titles[ sanitize_text_field( $_GET['tab'] ) ] ) . apply_filters( 'fdp_after_admin_title', $label ) );
    226                 }
    227                 return '&#128268; ' . esc_html( $titles[ sanitize_text_field( $_GET['page'] ) ] . apply_filters( 'fdp_after_admin_title', $label ) );
     224                        return '&#128268; ' . esc_html( sprintf( esc_attr__( '%1$s | %2$s', 'freesoul-deactivate-plugins' ), $titles[ sanitize_text_field( wp_unslash( $_GET['page'] ) ) ], $titles[ sanitize_text_field( wp_unslash( $_GET['tab'] ) ) ] ) . apply_filters( 'fdp_after_admin_title', $label ) );
     225                }
     226                return '&#128268; ' . esc_html( $titles[ sanitize_text_field( wp_unslash( $_GET['page'] ) ) ] . apply_filters( 'fdp_after_admin_title', $label ) );
    228227        }
    229228        if ( isset( $_GET['eos_dp_info'] ) && 'true' == $_GET['eos_dp_info'] ) {
    … …  
    300299        if ( isset( $_GET['page'] ) && eos_dp_is_fdp_page() || isset( $_GET['fdp_add_favorites'] ) || ( isset( $_GET['page'] ) && 'eos_dp_code_browser' === $_GET['page'] ) ) {
    301300                global $fdp_plugins_count;
    302                 $classes .= isset( $_GET['page'] ) ? ' eos-dp-' . esc_attr( sanitize_text_field( $_GET['page'] ) ) : '';
     301                $classes .= isset( $_GET['page'] ) ? ' eos-dp-' . esc_attr( sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) : '';
    303302                $classes .= ' fdp';
    304303                $classes .= defined( 'EOS_DP_PRO_VERSION' ) ? ' fdp-pro fdp-pro-' . esc_attr( str_replace( '.', '-', EOS_DP_PRO_VERSION ) ) : ' fdp-free fdp-free-' . esc_attr( str_replace( '.', '-', EOS_DP_VERSION ) );
    … …  
    320319                        $classes .= ' eos-dp-less-than-15-plugins';
    321320                }
    322                 $classes .= isset( $_GET['page'] ) ? ' fdp-' . esc_attr( sanitize_text_field( $_GET['page'] ) ) : '';
     321                $classes .= isset( $_GET['page'] ) ? ' fdp-' . esc_attr( sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) : '';
    323322                if ( isset( $_GET['page'] ) && in_array( $_GET['page'], array( 'eos_dp_one_place', 'eos_dp_browser', 'eos_dp_mobile', 'eos_dp_desktop', 'eos_dp_search' ) ) ) {
    324323                        $classes .= ' fdp-one-column';
    … …  
    383382                        admin_url( 'admin.php?page=eos_dp_menu' )
    384383                );
    385                 wp_redirect( $redirect );
     384                wp_safe_redirect( $redirect );
    386385                exit;
    387386        }
    … …  
    437436                remove_menu_page( 'options-general.php' );
    438437                if ( ( isset( $GLOBALS['pagenow'] ) && 'plugins.php' === $GLOBALS['pagenow'] ) || ( isset( $_GET['page'] ) && 'eos_dp_create_plugin' === $_GET['page'] ) ) {
    439                         wp_redirect( admin_url( 'admin.php?page=eos_dp_by_post_type' ) );
     438                        wp_safe_redirect( admin_url( 'admin.php?page=eos_dp_by_post_type' ) );
    440439                        exit;
    441440                }
    … …  
    454453        add_action( 'admin_head', 'eos_dp_firing_order_inline' );
    455454}
    456 if ( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( $_GET['page'] ), 'eos_dp_' ) || ( isset( $_GET['fdp_add_favorites'] ) ) ) {
     455if ( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ), 'eos_dp_' ) || ( isset( $_GET['fdp_add_favorites'] ) ) ) {
    457456        // Clean FDP backend pages and add inline style.
    458457        add_action(
    … …  
    864863        function() {
    865864                if ( isset( $_REQUEST['fdp_query_menu'] ) && 'true' === $_REQUEST['fdp_query_menu'] && isset( $_REQUEST['nonce'] ) && isset( $_REQUEST['id'] ) ) {
    866                         $transient_nonce = get_site_transient( 'fdp_query_menu_nonce_' . sanitize_text_field( $_REQUEST['id'] ) );
    867                         if ( $transient_nonce && sanitize_text_field( $transient_nonce ) === sanitize_text_field( $_REQUEST['nonce'] ) ) {
     865                        $transient_nonce = get_site_transient( 'fdp_query_menu_nonce_' . sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) );
     866                        if ( $transient_nonce && sanitize_text_field( $transient_nonce ) === sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) ) {
    868867                                global $menu,$submenu,$eos_dp_paths,$admin_page_hooks;
    869868                                $parent_plugin_pages = array();
    … …  
    884883                                        )
    885884                                );
    886                                 delete_site_transient( 'fdp_query_menu_nonce_' . sanitize_text_field( $_REQUEST['id'] ) );
     885                                delete_site_transient( 'fdp_query_menu_nonce_' . sanitize_text_field( wp_unslash( $_REQUEST['id'] ) ) );
    887886                                die();
    888887                                exit;
    … …  
    11321131        'admin_page_access_denied',
    11331132        function() {
    1134                 if( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( $_GET['page'] ), 'eos_dp_' ) ) {
     1133                if( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ), 'eos_dp_' ) ) {
    11351134                        $die  = '<p>' . esc_html__( 'Sorry, you are not allowed to access this page.', 'freesoul-deactivate-plugins' ) . '</p>';
    11361135                        if( defined( 'EOS_DP_PRO_FDP_MIN_VERSION' ) && version_compare( EOS_DP_PRO_FDP_MIN_VERSION, EOS_DP_MU_VERSION ) > 0 ){
    … …  
    12151214// Save FDP user preferences.
    12161215function eos_dp_save_user_preferences( $user_id ) {
    1217         if ( ! isset( $_POST['fdp_user_preferences'] ) || ! current_user_can( 'edit_user', $user_id ) || ! wp_verify_nonce( sanitize_text_field( $_POST['fdp_user_preferences'] ), 'fdp_user_preferences' ) ) {
     1216        if ( ! isset( $_POST['fdp_user_preferences'] ) || ! current_user_can( 'edit_user', $user_id ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['fdp_user_preferences'] ) ), 'fdp_user_preferences' ) ) {
    12181217                 return;
    12191218        }
    … …  
    12641263        'admin_init',
    12651264        function() {
    1266                 if ( isset( $_GET['clear-fdp-cache'] ) && wp_verify_nonce( sanitize_text_field( $_GET['clear-fdp-cache'] ), 'fdp_clear_cache' ) ) {
     1265                if ( isset( $_GET['clear-fdp-cache'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['clear-fdp-cache'] ) ), 'fdp_clear_cache' ) ) {
    12671266                        if( function_exists( 'eos_dp_update_fdp_cache' ) ) {
    12681267                                eos_dp_update_fdp_cache( 'nav', '', true );
    … …  
    12891288        'admin_bar_menu',
    12901289        function( $wp_admin_bar ) {
    1291                 if ( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( $_GET['page'] ), 'eos_dp_' ) ) {
     1290                if ( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ), 'eos_dp_' ) ) {
    12921291                        $nonce = wp_create_nonce( 'fdp_clear_cache' );
    12931292                        $url   = admin_url( 'admin.php' );
    … …  
    13091308// Redirects to settings page if it's an FDP page.
    13101309function eos_dp_redirect_to_fdp_page() {
    1311         if ( eos_dp_is_fdp_page() && isset( $_SERVER['REQUEST_URI'] ) && false !== strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/wp-admin/plugins.php' ) ) {
     1310        if ( eos_dp_is_fdp_page() && isset( $_SERVER['REQUEST_URI'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/wp-admin/plugins.php' ) ) {
    13121311                wp_safe_redirect( esc_url( add_query_arg( $_GET, admin_url( 'admin.php' ) ) ) );
    13131312        }
  • freesoul-deactivate-plugins/trunk/admin/templates/pages/eos-dp-help.php

    r3443290 r3831228  
    1919        eos_dp_navigation();
    2020        $dir = is_rtl() ? 'left' : 'right';
    21         $tab = isset( $_GET['tab'] ) ? str_replace( '-', '_', sanitize_text_field( $_GET['tab'] ) ) : 'home';
     21        $tab = isset( $_GET['tab'] ) ? str_replace( '-', '_', sanitize_text_field( wp_unslash( $_GET['tab'] ) ) ) : 'home';
    2222        if ( function_exists( 'eos_dp_help_' . sanitize_key( $tab ) . '_section' ) ) {
    2323                call_user_func( 'eos_dp_help_' . sanitize_key( $tab ) . '_section' );
  • freesoul-deactivate-plugins/trunk/admin/templates/pages/eos-dp-integration.php

    r3443290 r3831228  
    2020                $int_plugin = 'wordpress-core';
    2121        } else {
    22                 $int_plugin = sanitize_text_field( $_GET['int_plugin'] );
     22                $int_plugin = sanitize_text_field( wp_unslash( $_GET['int_plugin'] ) );
    2323        }
    2424        if ( ! isset( $plugins_integration[ $int_plugin ] ) ) {
  • freesoul-deactivate-plugins/trunk/admin/templates/partials/eos-dp-footer.php

    r3617393 r3831228  
    1919                $permalinks_label = __( 'Permalinks are set to "Numeric"', 'freesoul-deactivate-plugins' );
    2020        }
    21         if ( false === strpos( basename( $permalink_structure ), '%postname%' ) && ! in_array( $_GET['page'], array( 'eos_dp_admin', 'eos_dp_admin_by_post_type', 'eos_dp_admin_url', 'eos_dp_url' ), true ) ) {
     21        if ( false === strpos( basename( $permalink_structure ), '%postname%' ) && ( ! isset( $_GET['page'] ) || ! in_array( $_GET['page'], array( 'eos_dp_admin', 'eos_dp_admin_by_post_type', 'eos_dp_admin_url', 'eos_dp_url' ), true ) ) ) {
    2222                        $extra_class = ' eos-no-events';
    2323                        // translators: %s is the permalink structure label.
    … …  
    3131        $dir     = is_rtl() ? 'left' : 'right';
    3232        $antiDir = is_rtl() ? 'right' : 'left';
    33         $page    = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
     33        $page    = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
    3434        if ( current_user_can( 'activate_plugins' ) ) {
    3535                ?>
  • freesoul-deactivate-plugins/trunk/admin/templates/partials/eos-dp-navigation.php

    r3617393 r3831228  
    140140        }
    141141        $active_plugins  = absint( count( $globally_active ) );
    142         if ( in_array(
    143                 $_GET['page'],
     142        $current_page    = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
     143        if ( $current_page && in_array(
     144                $current_page,
    144145                apply_filters(
    145146                        'fdp_plugin_filter_pages',
    … …  
    161162                                'eos_dp_plugin_conflicts'
    162163                        )
    163                 )
     164                ),
     165                true
    164166        ) ) {
    165                 if ( ! in_array( $_GET['page'], array( 'eos_dp_integration' ) ) ) {
     167                if ( ! in_array( $current_page, array( 'eos_dp_integration' ), true ) ) {
    166168                        ++$active_plugins;
    167169                }
    … …  
    193195                                                        isset( $globally_active[ $lin - 1 ] )
    194196                                                        && '' !== $globally_active[ $lin - 1 ]
    195                                                         && ( ! isset( $_GET['int_plugin'] ) || sanitize_text_field( $_GET['int_plugin'] ) !== dirname( $globally_active[ $lin - 1 ] ) )
     197                                                        && ( ! isset( $_GET['int_plugin'] ) || sanitize_text_field( wp_unslash( $_GET['int_plugin'] ) ) !== dirname( $globally_active[ $lin - 1 ] ) )
    196198                                                ) {
    197199                                                        ?>
    … …  
    209211                                        $l = $n; }
    210212                                if ( in_array(
    211                                         $_GET['page'],
     213                                        $current_page,
    212214                                        apply_filters(
    213215                                                'fdp_theme_filter_pages',
    … …  
    220222                                                        'eos_dp_ajax',
    221223                                                )
    222                                         )
     224                                        ),
     225                                        true
    223226                                ) ) {
    224227                                        $tn = 1 + $active_plugins;
  • freesoul-deactivate-plugins/trunk/admin/templates/partials/eos-dp-table-head.php

    r3443290 r3831228  
    1818                <th class="fdp-legend" style="vertical-align:bottom;border-style:none;text-align:initial;padding-left:20px;margin-left:-20px">
    1919                        <?php do_action( 'fdp_table_head_first_col' ); ?>
    20                         <?php do_action( 'fdp_table_head_first_col_' . esc_attr( sanitize_text_field( $_GET['page'] ) ) ); ?>
     20                        <?php
     21                        if ( isset( $_GET['page'] ) ) {
     22                                do_action( 'fdp_table_head_first_col_' . esc_attr( sanitize_text_field( wp_unslash( $_GET['page'] ) ) ) );
     23                        }
     24                        ?>
    2125                        <?php if ( $reset ) : ?>
    2226                        <div style="margin-top:8px;margin-bottom:16px">
  • freesoul-deactivate-plugins/trunk/admin/templates/partials/nav-menu-items/menu-item-archives.php

    r3432060 r3831228  
    2828                                        $show           = true;
    2929                                        $postTypeObj    = get_post_type_object( $term_post_type );
    30                                         $labels         = $postTypeObj ? get_post_type_labels( $postTypeObj ) : false;
     30                                        $labels         = $postTypeObj ? $postTypeObj->labels : false;
    3131                                        $labels_names[] = $labels && isset( $labels->name ) ? $labels->name : $term_post_type;
    3232                                }
  • freesoul-deactivate-plugins/trunk/admin/templates/partials/nav-menu-items/menu-item-device.php

    r2985629 r3831228  
    1212<li id="fdp-menu-desktop" data-section="eos-dp-desktop" class="hover
    1313<?php
    14 echo $_GET['page'] === 'eos_dp_desktop' ? ' eos-active' : '';
     14echo ( isset( $_GET['page'] ) && 'eos_dp_desktop' === $_GET['page'] ) ? ' eos-active' : '';
    1515echo '' === $pro ? ' fdp-pro-feature fdp-dismiss-pro-notice' : '';
    1616?>
  • freesoul-deactivate-plugins/trunk/admin/templates/partials/nav-menu-items/menu-item-singles.php

    r3432060 r3831228  
    1919                $postTypeObj = get_post_type_object( $pt );
    2020                if ( 'page' === $pt || ( ! in_array( $pt, array( 'attachment' ) ) && is_object( $postTypeObj ) && isset( $postTypeObj->publicly_queryable ) && $postTypeObj->publicly_queryable ) ) {
    21                         $labels      = get_post_type_labels( $postTypeObj );
     21                        $labels      = $postTypeObj->labels;
    2222                        $labels_name = isset( $labels->name ) ? $labels->name : esc_html( $pt );
    2323                        ?>
  • freesoul-deactivate-plugins/trunk/admin/templates/partials/nav-menu-items/menu-item-term-archives.php

    r3432060 r3831228  
    1919
    2020                                        $postTypeObj    = get_post_type_object( $term_post_type );
    21                                         $labels         = get_post_type_labels( $postTypeObj );
     21                                        $labels         = $postTypeObj->labels;
    2222                                        $labels_names[] = isset( $labels->name ) ? $labels->name : $term_post_type;
    2323                                }
  • freesoul-deactivate-plugins/trunk/fdp-load.php

    r3665736 r3831228  
    66 */
    77
    8  defined( 'EOS_DP_PLUGIN_DIR' ) || exit;
     8defined( 'ABSPATH' ) || exit;
     9defined( 'EOS_DP_PLUGIN_DIR' ) || exit;
    910
    1011if ( isset( $_REQUEST['eos_dp_preview'] ) || is_admin() || wp_doing_ajax() ) {
    … …  
    4445        }
    4546        if ( is_admin() ) {
    46                 $pass = md5( uniqid( microtime() . mt_rand(), true ) );
     47                $pass = md5( uniqid( microtime() . wp_rand(), true ) );
    4748                set_site_transient( 'eos_dp_pro_unique_id', $pass, 60 * 60 * 24 );
    4849        }
    … …  
    99100                function() {
    100101                        $classes[] = 'fdp-autosuggestion-class-start';
    101                         $classes[] = esc_attr( str_replace( '/', '-', strtok( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '?' ) ) );
     102                        if ( isset( $_SERVER['REQUEST_URI'] ) ) {
     103                                $classes[] = esc_attr( str_replace( '/', '-', strtok( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '?' ) ) );
     104                        }
    102105                        $classes[] = 'fdp-autosuggestion-class-end';
    103106                        return $classes;
    … …  
    277280function eos_dp_get_wp_filesystem() {
    278281        if ( ! function_exists( 'get_filesystem_method' ) ) {
    279                 return false;
    280         }
    281         if ( 'direct' !== get_filesystem_method() ) {
     282                require_once ABSPATH . 'wp-admin/includes/file.php';
     283        }
     284        if ( ! function_exists( 'get_filesystem_method' ) || 'direct' !== get_filesystem_method() ) {
    282285                return false;
    283286        }
    … …  
    288291        global $wp_filesystem;
    289292        if ( empty( $wp_filesystem ) ) {
    290                 require_once ABSPATH . '/wp-admin/includes/file.php';
    291293                WP_Filesystem();
    292294        }
    293295        return $wp_filesystem;
     296}
     297
     298/**
     299 * Check if a path is writable via WP_Filesystem when available.
     300 *
     301 * @param string $path Path to check.
     302 * @since 2.8.1
     303 *
     304 */
     305function eos_dp_is_writable( $path ) {
     306        $wp_filesystem = eos_dp_get_wp_filesystem();
     307        if ( $wp_filesystem ) {
     308                return $wp_filesystem->is_writable( $path );
     309        }
     310        if ( function_exists( 'wp_is_writable' ) ) {
     311                return wp_is_writable( $path );
     312        }
     313        return false;
    294314}
    295315
    … …  
    305325                return false;
    306326        }
    307         return is_writable( $dest_dir );
     327        return eos_dp_is_writable( $dest_dir );
    308328}
    309329
    … …  
    343363        $installed     = false;
    344364        $dir_writable  = eos_dp_mu_plugin_dir_is_writable( $dest_dir );
    345         $file_writable = ! file_exists( $destination ) || is_writable( $destination );
     365        $file_writable = ! file_exists( $destination ) || eos_dp_is_writable( $destination );
    346366        $wp_filesystem = eos_dp_get_wp_filesystem();
    347         $contents      = file_get_contents( $source );
     367        $contents      = false;
    348368        $chmod         = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : 0644;
     369
     370        if ( $wp_filesystem ) {
     371                $contents = $wp_filesystem->get_contents( $source );
     372        }
    349373
    350374        if ( false === $contents || '' === $contents ) {
    … …  
    356380        }
    357381
    358         if ( ! $dir_writable && ! $file_writable ) {
     382        if ( ! $wp_filesystem || ( ! $dir_writable && ! $file_writable ) ) {
    359383                if ( $update_info ) {
    360384                        set_transient( 'freesoul-dp-notice-fail', true, DAY_IN_SECONDS );
    … …  
    367391        if ( $dir_writable ) {
    368392                $temp_file = trailingslashit( $dest_dir ) . 'eos-deactivate-plugins.php.fdp-install-' . wp_generate_password( 8, false );
    369                 if ( $wp_filesystem ) {
    370                         if ( $wp_filesystem->put_contents( $temp_file, $contents, $chmod ) ) {
    371                                 $installed = $wp_filesystem->move( $temp_file, $destination, true );
    372                         }
    373                         if ( ! $installed && $wp_filesystem->exists( $temp_file ) ) {
    374                                 $wp_filesystem->delete( $temp_file );
    375                         }
    376                 } else {
    377                         if ( false !== file_put_contents( $temp_file, $contents ) ) {
    378                                 if ( file_exists( $destination ) ) {
    379                                         wp_delete_file( $destination );
    380                                 }
    381                                 $installed = rename( $temp_file, $destination );
    382                         }
    383                         if ( ! $installed && file_exists( $temp_file ) ) {
    384                                 wp_delete_file( $temp_file );
    385                         }
     393                if ( $wp_filesystem->put_contents( $temp_file, $contents, $chmod ) ) {
     394                        $installed = $wp_filesystem->move( $temp_file, $destination, true );
     395                }
     396                if ( ! $installed && $wp_filesystem->exists( $temp_file ) ) {
     397                        $wp_filesystem->delete( $temp_file );
    386398                }
    387399        }
    … …  
    389401        // Fallback: overwrite the destination file when the directory is not writable for temp files.
    390402        if ( ! $installed && $file_writable ) {
    391                 if ( $wp_filesystem ) {
    392                         $installed = (bool) $wp_filesystem->put_contents( $destination, $contents, $chmod );
    393                 } else {
    394                         $installed = false !== file_put_contents( $destination, $contents );
    395                 }
     403                $installed = (bool) $wp_filesystem->put_contents( $destination, $contents, $chmod );
    396404        }
    397405
    … …  
    496504        do_action( 'fdp_get_plugin_info', $file_data, $plugin );
    497505        if ( preg_match( '/^(?:[ \t]*<\?php)?[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
    498                 return sanitize_text_field( _cleanup_header_comment( $match[1] ) );
     506                return sanitize_text_field( trim( preg_replace( '/\s*(?:\*\/|\?>).*/', '', $match[1] ) ) );
    499507        }
    500508        return 'Plugin Name' === $regex ? str_replace( '-',' ',dirname( sanitize_text_field( $plugin ) ) ) : false;
  • freesoul-deactivate-plugins/trunk/freesoul-deactivate-plugins.php

    r3828268 r3831228  
    88 * Domain Path: /languages/
    99 * Text Domain: freesoul-deactivate-plugins
     10 * Requires at least: 4.9
    1011 * Requires PHP: 7.4
    1112 * Requires CP:  1.4
    1213 * Premium URI:  https://freesoul-deactivate-plugins.com/
    13  * Version: 2.8.0
     14 * Version: 2.8.2
     15 * License: GPLv2 or later
     16 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1417 *
    1518 * @package Freesoul Deactivate Plugins
    … …  
    4043
    4144// Definitions.
    42 define( 'EOS_DP_VERSION', '2.8.0' );
     45define( 'EOS_DP_VERSION', '2.8.2' );
    4346define( 'FDP_PLUGIN_FILE', __FILE__ );
    4447define( 'EOS_DP_PLUGIN_DIR', untrailingslashit( dirname( __FILE__ ) ) );
  • freesoul-deactivate-plugins/trunk/inc/fdp-main.php

    r3443290 r3831228  
    102102        <style id="fdp-clean-screen-css" type="text/css">
    103103        <?php echo $menu_item; //phpcs:ignore WordPress.Security.EscapeOutput -- No need to escape an hardcoded value. ?>
    104         <?php if( isset( $_GET['fdp-iframe'] ) && 'true' === sanitize_text_field( $_GET['fdp-iframe'] ) ) { ?>
     104        <?php if( isset( $_GET['fdp-iframe'] ) && 'true' === sanitize_text_field( wp_unslash( $_GET['fdp-iframe'] ) ) ) { ?>
    105105        div#templateside,#wpadminbar,div#wpwrap> div:not(#wpcontent),div#wpbody-content>div:not(.wrap),.fileedit-sub,h1,#dolly,label#theme-plugin-editor-label{display:none !important}
    106106        #wpcontent{margin-left:0 !important;margin-right:0 !important}body{margin-top:-30px !important}
  • freesoul-deactivate-plugins/trunk/inc/fdp-metaboxes.php

    r3443290 r3831228  
    244244 */
    245245function eos_dp_save_meta_box_data( $post_id, $post ) {
     246        if ( ! isset( $_POST['eos_dp_meta_boxes_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['eos_dp_meta_boxes_nonce'] ) ), 'eos_dp_meta_boxes' ) ) {
     247                return;
     248        }
    246249        if ( ! isset( $_POST['eos_dp_admin_meta'] ) ) {
    247250                return;
    248251        }
    249252        // * Merge user submitted options with fallback defaults.
    250         $data = wp_parse_args( $_POST['eos_dp_admin_meta'], array( '_eos_deactive_plugins_key' => '' ) ); //@codingStandardsIgnoreLine.
     253        $data = wp_parse_args( wp_unslash( $_POST['eos_dp_admin_meta'] ), array( '_eos_deactive_plugins_key' => '' ) );
    251254        // * Sanitize in the next cicle.
    252255        foreach ( (array) $data as $key => $value ) {
  • freesoul-deactivate-plugins/trunk/inc/fdp-woocommerce.php

    r3592210 r3831228  
    447447
    448448                            $cart_items_html .= '<li style="display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; border-bottom: 1px solid #eee;">';
    449                             $cart_items_html .= '<span style="font-size:13px;">' . esc_html($product_title) . ' <strong>x' . $qty . '</strong></span>';
    450                             $cart_items_html .= '<span style="font-size:13px; font-weight:bold;">' . number_format($price * $qty, 2) . '€</span>';
     449                            $cart_items_html .= '<span style="font-size:13px;">' . esc_html( $product_title ) . ' <strong>x' . esc_html( (string) $qty ) . '</strong></span>';
     450                            $cart_items_html .= '<span style="font-size:13px; font-weight:bold;">' . esc_html( number_format( (float) $price * $qty, 2 ) ) . '€</span>';
    451451                            $cart_items_html .= '</li>';
    452452                        }
    … …  
    477477    </style>
    478478    <div class="fdp-mini-cart">
    479         <a href="<?php echo get_permalink(get_option('woocommerce_cart_page_id')); ?>" class="fdp-cart-link">
     479        <a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_cart_page_id' ) ) ); ?>" class="fdp-cart-link">
    480480            <span style="font-size: 20px;">🛒</span>
    481481            <?php if ( $total_count > 0 ) : ?>
    482                 <span class="badge"><?php echo $total_count; ?></span>
     482                <span class="badge"><?php echo esc_html( $total_count ); ?></span>
    483483            <?php endif; ?>
    484484        </a>
    … …  
    486486        <div class="fdp-cart-dropdown">
    487487            <?php if ( $total_count > 0 ) : ?>
    488                 <ul><?php echo $cart_items_html; ?></ul>
    489                 <div class="fdp-total">Total: <?php echo number_format($total_price, 2); ?> €</div>
     488                <ul><?php
     489                                echo wp_kses(
     490                                        $cart_items_html,
     491                                        array(
     492                                                'li'     => array( 'style' => true ),
     493                                                'span'   => array( 'style' => true ),
     494                                                'strong' => array(),
     495                                        )
     496                                );
     497                                ?></ul>
     498                <div class="fdp-total">Total: <?php echo esc_html( number_format( (float) $total_price, 2 ) ); ?> €</div>
    490499                                <div class="fdp-buttons-container">
    491500                    <a href="<?php echo esc_url($cart_url); ?>" class="fdp-btn button btn fdp-btn-view-cart">View Cart</a>
    … …  
    549558*/
    550559function fdp_ajax_update_mini_cart() {
    551     echo fdp_emulate_woocommerce_mini_cart();
    552     wp_die();
    553 }
     560        $allowed_html = array(
     561                'style'  => array(),
     562                'script' => array( 'type' => true ),
     563                'div'    => array(
     564                        'class' => true,
     565                        'id'    => true,
     566                        'style' => true,
     567                ),
     568                'a'      => array(
     569                        'href'  => true,
     570                        'class' => true,
     571                        'style' => true,
     572                ),
     573                'span'   => array(
     574                        'class' => true,
     575                        'style' => true,
     576                ),
     577                'ul'     => array(),
     578                'li'     => array( 'style' => true ),
     579                'p'      => array( 'style' => true ),
     580                'strong' => array(),
     581        );
     582        echo wp_kses( fdp_emulate_woocommerce_mini_cart(), $allowed_html );
     583        wp_die();
     584}
  • freesoul-deactivate-plugins/trunk/integrations/index.php

    r2683247 r3831228  
     1<?php
     2// Silence is golden.
  • freesoul-deactivate-plugins/trunk/mu-plugins/eos-deactivate-plugins.php

    r3828268 r3831228  
    33  Plugin Name: freesoul deactivate plugins [fdp]
    44  Description: mu-plugin automatically installed by freesoul deactivate plugins
    5   Version: 2.8.0
     5  Version: 2.8.2
    66  Plugin URI: https://freesoul-deactivate-plugins.com/
    77  Author: Jose Mortellaro
    … …  
    4040}
    4141
    42 if( is_admin() && isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( $_REQUEST['action'] ),array( 'activate-selected','deactivate-selected', 'activate-plugin' ) ) ){
     42if( is_admin() && isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ),array( 'activate-selected','deactivate-selected', 'activate-plugin' ) ) ){
    4343        return;
    4444}
    4545
    46 define( 'EOS_DP_MU_VERSION','2.8.0' );
     46define( 'EOS_DP_MU_VERSION','2.8.2' );
    4747define( 'EOS_DP_MU_PLUGIN_DIR',untrailingslashit( dirname( __FILE__ ) ) );
    4848
    … …  
    142142                  if( 'rewrite_rules' === $option && $value !== $old_value ) {
    143143                                $fdp_rewrite = true;
    144                                 $plugindir = defined( PLUGINDIR ) ? PLUGINDIR.'/' : 'wp-content/plugins/';
     144                                $plugindir = trailingslashit( WP_PLUGIN_DIR );
    145145                                $themedir = str_replace( ABSPATH,'',get_theme_root() );
    146146                                $trace = debug_backtrace();
    … …  
    185185                    }
    186186                        if( $cause && '' !== $output ){
    187                                 $output .= PHP_EOL.PHP_EOL.sprintf( 'The rewrite rules where updated requesting %s', '/' === $_SERVER['REQUEST_URI'] ? 'the homepage' : sanitize_text_field( $_SERVER['REQUEST_URI'] ) );
     187                                $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
     188                                $output .= PHP_EOL.PHP_EOL.sprintf( 'The rewrite rules where updated requesting %s', '/' === $request_uri ? 'the homepage' : $request_uri );
    188189                                if( $line && $file ){
    189190                                        $output .= eos_dp_get_code_extract( $line,$file );
    … …  
    244245        }
    245246}
    246 if( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( $_GET['page'] ),'eos_dp_' ) ){
     247if( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ),'eos_dp_' ) ){
    247248        if( !defined( 'QM_DISABLED' ) ){
    248249                define( 'QM_DISABLED',true );
    … …  
    257258
    258259if( $opts && isset(  $opts['eos_dp_general_setts'] ) && isset(  $opts['eos_dp_general_setts']['dev_mode'] ) && '1' ===  $opts['eos_dp_general_setts']['dev_mode'] && !isset( $_GET['fdp-assets'] ) ){
    259         $dev = substr( md5( sanitize_text_field( $_SERVER['HTTP_HOST'] ) ),0,8 );
     260        $dev = substr( md5( sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) ),0,8 );
    260261        if( !isset( $_GET['fdp-dev'] ) || $dev !== $_GET['fdp-dev'] ){
    261262                if( !is_admin() && !defined( 'FDP_OFF' ) ){
    … …  
    297298        $post_types_matrix = eos_dp_get_option( 'eos_post_types_plugins' );
    298299        $post_types = is_array( $post_types_matrix ) ? array_keys( $post_types_matrix ) : array();
    299         $uri = remove_query_arg( 'show_disabled_plugins',remove_query_arg( 'eos_dp_debug_options',apply_filters( 'fdp_request_uri',sanitize_text_field( $_SERVER['HTTP_HOST'] ).sanitize_text_field(  $_SERVER['REQUEST_URI'] ) ) ) );
     300        $uri = remove_query_arg( 'show_disabled_plugins',remove_query_arg( 'eos_dp_debug_options',apply_filters( 'fdp_request_uri',sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ).sanitize_text_field(  wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ) );
    300301        $GLOBALS['fdp_uri'] = $uri;
    301302        if( defined( 'FDP_SKIP_URLS' ) && is_array( FDP_SKIP_URLS ) && !empty( FDP_SKIP_URLS ) ){
    … …  
    312313        if( $opts && isset( $opts['general_bloat'] ) ){
    313314                $bloat = $opts['general_bloat'];
    314                 if( isset( $bloat['favicon'] ) && 'false' === $bloat['favicon'] && 'favicon.ico' === str_replace( '/','',sanitize_text_field( $_SERVER['REQUEST_URI'] ) ) ){
     315                if( isset( $bloat['favicon'] ) && 'false' === $bloat['favicon'] && 'favicon.ico' === str_replace( '/','',sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ){
    315316                        add_action( 'muplugins_loaded',function() {
    316317                                eos_dp_filter_active_plugins( '__return_empty_array',0,1 );
    … …  
    356357                        ( !empty( $_POST ) && ( !defined( 'EOS_DP_ALLOW_POST' ) || false === EOS_DP_ALLOW_POST ) && ( !defined( 'FDP_ALLOW_POST' ) || false === FDP_ALLOW_POST ) )
    357358                 || defined( 'REST_REQUEST' )
    358                  || ( isset( $_SERVER['REQUEST_URI'] ) && false !== strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ),'/wp-json/' ) )
     359                 || ( isset( $_SERVER['REQUEST_URI'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ),'/wp-json/' ) )
    359360         ){
    360361                        $option = 'eos_dp_by_rest_api';
    … …  
    429430                                        }
    430431                                        if( $wpml_lang_query ){
    431                                                 $after_home_uri .= '/?lang='.esc_attr( sanitize_text_field( $_GET['lang'] ) );
     432                                                $after_home_uri .= '/?lang='.esc_attr( sanitize_text_field( wp_unslash( $_GET['lang'] ) ) );
    432433                                        }
    433434                                        if( !defined( 'FDP_FORCE_DB_READING' ) || true !== FDP_FORCE_DB_READING ){
    … …  
    581582                        }
    582583                        else{
    583                                 $eos_page_id = isset( $_GET['page_id'] ) ? absint( $_GET['page_id'] ) : absint( $_GET['p'] );
     584                                $eos_page_id = isset( $_GET['page_id'] ) ? absint( wp_unslash( $_GET['page_id'] ) ) : absint( wp_unslash( $_GET['p'] ) );
    584585                                $p = get_page( $eos_page_id );
    585586                                global $eos_page_id;
    … …  
    595596                        if( $eos_page_id || ( isset( $_REQUEST['test_id'] ) && isset( $_REQUEST['eos_dp_preview'] ) ) ){
    596597                                if( isset( $_GET['fdp_post_type'] ) ){
    597                                         $transient_name = 'fdp_test_'.sanitize_key( $_GET['fdp_post_type'] ).'_'.sanitize_text_field( $_REQUEST['test_id'] );
     598                                        $transient_name = 'fdp_test_'.sanitize_key( wp_unslash( $_GET['fdp_post_type'] ) ).'_'.sanitize_text_field( wp_unslash( $_REQUEST['test_id'] ) );
    598599                                        $eos_dp_paths = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) );
    599600                                        delete_transient( $transient_name );
    600601                                }
    601602                                elseif( isset( $_GET['fdp_tax'] ) && isset( $_GET['eos_dp_preview'] ) ){
    602                                         $transient_name = 'fdp_test_'.sanitize_key( $_GET['fdp_tax'] ).'_'.sanitize_text_field( $_REQUEST['test_id'] );
     603                                        $transient_name = 'fdp_test_'.sanitize_key( wp_unslash( $_GET['fdp_tax'] ) ).'_'.sanitize_text_field( wp_unslash( $_REQUEST['test_id'] ) );
    603604                                        $eos_dp_paths = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) );
    604605                                        delete_transient( $transient_name );
    605606                                }
    606607                                elseif( isset( $_REQUEST['fdp_post_id'] ) && isset( $_REQUEST['eos_dp_preview'] ) ){
    607                                         $eos_page_id = absint( $_REQUEST['fdp_post_id'] );
     608                                        $eos_page_id = absint( wp_unslash( $_REQUEST['fdp_post_id'] ) );
    608609                                        $cron = isset( $_REQUEST['internal_call'] ) && 'true' === $_REQUEST['internal_call'] ? 'cron_' : '';
    609610                                        $after_save = isset( $_REQUEST['after_save'] ) && 'true' === $_REQUEST['after_save'] ? 'after_save_' : '';
    610                                         $tool = isset( $_REQUEST['tool'] ) && in_array( $_REQUEST['tool'],array( 'gtmetrix','gpsi' ) ) ? sanitize_key( $_REQUEST['tool'] ) : '';
    611                                         $transient_name = 'fdp_test_'.$after_save.$cron.$tool.sanitize_key( $_REQUEST['fdp_post_id'].'_'.sanitize_text_field( $_REQUEST['test_id'] ) );
     611                                        $tool = isset( $_REQUEST['tool'] ) && in_array( $_REQUEST['tool'],array( 'gtmetrix','gpsi' ) ) ? sanitize_key( wp_unslash( $_REQUEST['tool'] ) ) : '';
     612                                        $transient_name = 'fdp_test_'.$after_save.$cron.$tool.sanitize_key( wp_unslash( $_REQUEST['fdp_post_id'] ).'_'.sanitize_text_field( wp_unslash( $_REQUEST['test_id'] ) ) );
    612613                                        $eos_dp_paths = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) );
    613                                         if( isset( $_SERVER['HTTP_REFERER'] ) && 0 === strpos( esc_url( sanitize_text_field( $_SERVER['HTTP_REFERER'] ) ),get_home_url() ) ){
    614                                                 if( !isset( $_REQUEST['is_home'] ) || '1' !== sanitize_text_field( $_REQUEST['is_home'] ) && '' === $tool ){
     614                                        if( isset( $_SERVER['HTTP_REFERER'] ) && 0 === strpos( esc_url( sanitize_text_field( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) ),get_home_url() ) ){
     615                                                if( !isset( $_REQUEST['is_home'] ) || '1' !== sanitize_text_field( wp_unslash( $_REQUEST['is_home'] ) ) && '' === $tool ){
    615616                                                        delete_transient( $transient_name );
    616617                                                }
    … …  
    618619                                }
    619620                                elseif( isset( $_REQUEST['test_id'] ) && isset( $_REQUEST['eos_dp_preview'] ) && isset( $_REQUEST['tool'] ) ){
    620                                         $transient_name = 'fdp_test_'.sanitize_key( $_REQUEST['tool'] ).'_'.sanitize_text_field( $_REQUEST['test_id'] );
     621                                        $transient_name = 'fdp_test_'.sanitize_key( wp_unslash( $_REQUEST['tool'] ) ).'_'.sanitize_text_field( wp_unslash( $_REQUEST['test_id'] ) );
    621622                                        $eos_dp_paths = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) );
    622623                                        delete_transient( $transient_name );
    … …  
    830831                                $remove = false;
    831832                                foreach( $user_agents as $user_agent ) {
    832                                         if( ! empty( $user_agent ) && false !== strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ), strtolower( $user_agent ) ) ) {
     833                                        if( ! empty( $user_agent ) && false !== strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ), strtolower( $user_agent ) ) ) {
    833834                                                $remove = true;
    834835                                                break;
    … …  
    916917 */
    917918function eos_dp_code_profiler( $plugins ){
    918         if( isset( $_REQUEST['eos_dp_preview'] ) && isset( $_REQUEST['admin_page_key'] ) ){
    919                 $transient_name = 'fdp_test_'.sanitize_key( $_REQUEST['admin_page_key'] ).'_'.esc_attr( sanitize_text_field( $_REQUEST['test_id'] ) );
     919        if( isset( $_REQUEST['eos_dp_preview'] ) && isset( $_REQUEST['admin_page_key'] ) && isset( $_REQUEST['test_id'] ) ){
     920                $transient_name = 'fdp_test_'.sanitize_key( wp_unslash( $_REQUEST['admin_page_key'] ) ).'_'.esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['test_id'] ) ) );
    920921                $disabled = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) );
    921922                delete_transient( $transient_name );
    922923        }
    923924        elseif( isset( $_REQUEST['fdp_tax'] ) && isset( $_REQUEST['eos_dp_preview'] ) && isset( $_REQUEST['test_id'] ) ){
    924                 $transient_name = 'fdp_test_'.sanitize_key( $_REQUEST['fdp_tax'] ).'_'.sanitize_text_field( $_REQUEST['test_id'] );
     925                $transient_name = 'fdp_test_'.sanitize_key( wp_unslash( $_REQUEST['fdp_tax'] ) ).'_'.sanitize_text_field( wp_unslash( $_REQUEST['test_id'] ) );
    925926                $disabled = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) );
    926927                delete_transient( $transient_name );
    927928        }
    928         elseif( isset( $_REQUEST['fdp_post_id'] ) && isset( $_REQUEST['eos_dp_preview'] ) ){
    929                 $eos_page_id = absint( $_REQUEST['fdp_post_id'] );
     929        elseif( isset( $_REQUEST['fdp_post_id'] ) && isset( $_REQUEST['eos_dp_preview'] ) && isset( $_REQUEST['test_id'] ) ){
     930                $eos_page_id = absint( wp_unslash( $_REQUEST['fdp_post_id'] ) );
    930931                $cron = isset( $_REQUEST['internal_call'] ) && 'true' === $_REQUEST['internal_call'] ? 'cron_' : '';
    931932                $after_save = isset( $_REQUEST['after_save'] ) && 'true' === $_REQUEST['after_save'] ? 'after_save_' : '';
    932                 $tool = isset( $_REQUEST['tool'] ) && in_array( $_REQUEST['tool'],array( 'gtmetrix','gpsi' ) ) ? sanitize_key( $_REQUEST['tool'] ) : '';
    933                 $transient_name = 'fdp_test_'.$after_save.$cron.$tool.sanitize_key( $_REQUEST['fdp_post_id'].'_'.sanitize_text_field( $_REQUEST['test_id'] ) );
     933                $tool = isset( $_REQUEST['tool'] ) && in_array( $_REQUEST['tool'],array( 'gtmetrix','gpsi' ) ) ? sanitize_key( wp_unslash( $_REQUEST['tool'] ) ) : '';
     934                $transient_name = 'fdp_test_'.$after_save.$cron.$tool.sanitize_key( wp_unslash( $_REQUEST['fdp_post_id'] ).'_'.sanitize_text_field( wp_unslash( $_REQUEST['test_id'] ) ) );
    934935                $disabled = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) );
    935936                delete_transient( $transient_name );
    … …  
    952953 */
    953954function eos_dp_get_admin_post_id_from_request(){
    954         if( isset( $_GET['post'] ) && absint( $_GET['post'] ) > 0 ){
    955                 return absint( $_GET['post'] );
    956         }
    957         if( ( defined( 'FDP_ALLOW_POST' ) && FDP_ALLOW_POST ) && isset( $_POST['post_ID'] ) && absint( $_POST['post_ID'] ) > 0 ){
    958                 return absint( $_POST['post_ID'] );
     955        if( isset( $_GET['post'] ) && absint( wp_unslash( $_GET['post'] ) ) > 0 ){
     956                return absint( wp_unslash( $_GET['post'] ) );
     957        }
     958        if( ( defined( 'FDP_ALLOW_POST' ) && FDP_ALLOW_POST ) && isset( $_POST['post_ID'] ) && absint( wp_unslash( $_POST['post_ID'] ) ) > 0 ){
     959                return absint( wp_unslash( $_POST['post_ID'] ) );
    959960        }
    960961        return 0;
    … …  
    10311032                 *
    10321033                 */
    1033                 $GLOBALS['eos_dp_wp_loaded'] = round( microtime(true) - sanitize_text_field( $_SERVER['REQUEST_TIME_FLOAT'] ),2 );
     1034                $GLOBALS['eos_dp_wp_loaded'] = isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? round( microtime( true ) - (float) wp_unslash( $_SERVER['REQUEST_TIME_FLOAT'] ), 2 ) : 0;
    10341035        } );
    10351036        add_action( 'muplugins_loaded',function() {
    … …  
    10461047        $adminTheme = eos_dp_get_option( 'eos_dp_admin_theme' );
    10471048        $adminThemeUrl = eos_dp_get_option( 'eos_dp_admin_url_theme' );
    1048         $base_url = basename( sanitize_text_field( $_SERVER['HTTP_HOST'] ).sanitize_text_field( $_SERVER['REQUEST_URI'] ) );
     1049        $http_host   = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
     1050        $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
     1051        $base_url    = basename( $http_host . $request_uri );
    10491052        $admin_post_type = eos_dp_get_post_type_from_request();
    10501053        if( $admin_post_type ){
    … …  
    10541057                eos_dp_disable_theme();
    10551058        }
    1056         elseif( isset( $_GET['page'] ) && 'admin.php?page=' . sanitize_text_field( $_GET['page'] ) === $base_url && isset( $adminTheme[sanitize_text_field( $_GET['page'] )] ) && ! $adminTheme[sanitize_text_field( $_GET['page'] )] ) {
     1059        elseif( isset( $_GET['page'] ) && 'admin.php?page=' . sanitize_text_field( wp_unslash( $_GET['page'] ) ) === $base_url && isset( $adminTheme[sanitize_text_field( wp_unslash( $_GET['page'] ) )] ) && ! $adminTheme[sanitize_text_field( wp_unslash( $_GET['page'] ) )] ) {
    10571060                eos_dp_disable_theme();
    10581061        }
    … …  
    10931096                }
    10941097        }
    1095         if( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( $_GET['page'] ),'eos_dp_' ) ){
     1098        if( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ),'eos_dp_' ) ){
    10961099                $disable_on_fdp_pageA = array(
    10971100                        'query-monitor/query-monitor.php',
    … …  
    11401143                if( !defined( 'EOS_ADMIN_'.$const.'_ACTIVE' ) ) define( 'EOS_ADMIN_'.$const.'_ACTIVE','true' );
    11411144        }
    1142         if( isset( $_REQUEST['eos_dp_preview'] ) && isset( $_REQUEST['admin_page_key'] ) ){
     1145        if( isset( $_REQUEST['eos_dp_preview'] ) && isset( $_REQUEST['admin_page_key'] ) && isset( $_REQUEST['test_id'] ) ){
    11431146                add_action( 'wp_loaded',function(){
    1144                         $GLOBALS['eos_dp_wp_loaded'] = round( microtime(true) - sanitize_text_field( $_SERVER['REQUEST_TIME_FLOAT'] ),2 );
     1147                        $GLOBALS['eos_dp_wp_loaded'] = isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? round( microtime( true ) - (float) wp_unslash( $_SERVER['REQUEST_TIME_FLOAT'] ), 2 ) : 0;
    11451148                } );
    1146                 $GLOBALS['eos_dp_all_plugins'] = array_filter( $all_plugins );
     1149                $GLOBALS['eos_dp_all_plugins'] = eos_dp_existing_plugin_paths( $all_plugins );
    11471150                register_shutdown_function( 'eos_dp_display_usage' );
    11481151                if( isset( $_REQUEST['eos_dp_debug'] ) ){
    … …  
    11511154                        }
    11521155                }
    1153                 $transient_name = 'fdp_test_'.sanitize_key( $_REQUEST['admin_page_key'] ).'_'.esc_attr( sanitize_text_field( $_REQUEST['test_id'] ) );
     1156                $transient_name = 'fdp_test_'.sanitize_key( wp_unslash( $_REQUEST['admin_page_key'] ) ).'_'.esc_attr( sanitize_text_field( wp_unslash( $_REQUEST['test_id'] ) ) );
    11541157                $disabled_plugins = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) );
    11551158                delete_transient( $transient_name );
    … …  
    11841187                return $plugins;
    11851188        }
    1186         $base_url = basename( sanitize_text_field( $_SERVER['HTTP_HOST'] ).sanitize_text_field( $_SERVER['REQUEST_URI'] ) );
    1187         if( 'wp-admin' === str_replace( '/','', sanitize_text_field( $_SERVER['REQUEST_URI'] ) ) ){
    1188                 $base_url = str_replace( '//','/',basename( sanitize_text_field(  $_SERVER['HTTP_HOST'] ).sanitize_text_field( $_SERVER['REQUEST_URI'] ).'/index.php' ) );
     1189        $http_host   = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
     1190        $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
     1191        $base_url    = basename( $http_host . $request_uri );
     1192        if ( 'wp-admin' === str_replace( '/', '', $request_uri ) ) {
     1193                $base_url = str_replace( '//', '/', basename( $http_host . $request_uri . '/index.php' ) );
    11891194        }
    11901195        $admin_page = false !== strpos( $base_url,'.php' ) ?  admin_url( $base_url ) : admin_url( 'admin.php'.$base_url );
    … …  
    12121217        }
    12131218        if( !$from_admin_url ){
    1214                 $urlArr =  parse_url( $base_url );
     1219                $urlArr = wp_parse_url( $base_url );
    12151220                if( isset( $urlArr['path'] ) && 'edit.php' === sanitize_text_field( $urlArr['path'] ) && isset( $urlArr['query'] ) ){
    12161221                        if( isset(  $urlArr['query'] ) && 'post_type=post' === $urlArr['query'] ){
    … …  
    12181223                        }
    12191224                        if( isset( $_GET['s'] ) && isset( $_GET['post_status'] ) && isset( $_GET['post_type'] ) ){
    1220                                 $base_url = 'post' === $_GET['post_type'] ? $urlArr['path'] : $urlArr['path'].'?post_type='.sanitize_text_field( $_GET['post_type'] );
     1225                                $base_url = 'post' === $_GET['post_type'] ? $urlArr['path'] : $urlArr['path'].'?post_type='.sanitize_text_field( wp_unslash( $_GET['post_type'] ) );
    12211226                        }
    12221227                }
    … …  
    12311236        }
    12321237        if( isset( $_GET['page'] ) || isset( $admin_plugins[$admin_page] ) || isset( $admin_plugins[$base_url] ) ){
    1233                 if( isset( $_GET['page'] ) && isset( $admin_plugins[ sanitize_text_field( $_GET['page'] ) ] ) ){
    1234                         $key = $admin_plugins[sanitize_text_field( $_GET['page'] )];
     1238                if( isset( $_GET['page'] ) && isset( $admin_plugins[ sanitize_text_field( wp_unslash( $_GET['page'] ) ) ] ) ){
     1239                        $key = $admin_plugins[sanitize_text_field( wp_unslash( $_GET['page'] ) )];
    12351240                }
    12361241                else{
    … …  
    13231328        }
    13241329        if( isset( $_REQUEST['eos_dp_preview'] ) ){
    1325                 $GLOBALS['eos_dp_all_plugins'] = $plugins;
     1330                $GLOBALS['eos_dp_all_plugins'] = eos_dp_existing_plugin_paths( $plugins );
    13261331                if( isset( $_REQUEST['eos_dp_debug'] ) ){
    13271332                        if( 'no_error' === $_REQUEST['eos_dp_debug'] ){
    … …  
    13351340                }
    13361341                add_action( 'wp_loaded',function(){
    1337                         $GLOBALS['eos_dp_wp_loaded'] = round( microtime(true) - sanitize_text_field( $_SERVER['REQUEST_TIME_FLOAT'] ),2 );
     1342                        $GLOBALS['eos_dp_wp_loaded'] = isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? round( microtime( true ) - (float) wp_unslash( $_SERVER['REQUEST_TIME_FLOAT'] ), 2 ) : 0;
    13381343                } );
    13391344                register_shutdown_function( 'eos_dp_display_usage' );
    1340                 $themeA = explode( '&theme=',parse_url( urldecode( basename( sanitize_text_field( $_SERVER['REQUEST_URI'] ) ) ),PHP_URL_QUERY ) );
     1345                $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
     1346                $themeA = explode( '&theme=', wp_parse_url( urldecode( basename( $request_uri ) ), PHP_URL_QUERY ) );
    13411347                if( isset( $themeA[1] ) ){
    13421348                        $themeA = explode( '&',$themeA[1] );
    … …  
    13591365        }
    13601366        else{
    1361                 if( defined( 'EOS_DP_DEBUG' ) && true === EOS_DP_DEBUG || ( isset( $_SERVER['REMOTE_ADDR'] ) && isset( $_GET['show_disabled_plugins'] ) && $_GET['show_disabled_plugins'] === md5( sanitize_text_field( $_SERVER['REMOTE_ADDR'] ).( absint( time()/1000 ) ) ) ) ){
     1367                if( defined( 'EOS_DP_DEBUG' ) && true === EOS_DP_DEBUG || ( isset( $_SERVER['REMOTE_ADDR'] ) && isset( $_GET['show_disabled_plugins'] ) && $_GET['show_disabled_plugins'] === md5( sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ).( absint( time()/1000 ) ) ) ) ){
    13621368                        $GLOBALS['eos_dp_user_can_preview'] = true;
    13631369                        add_action( 'wp_footer','eos_dp_print_disabled_plugins',9999 );
    … …  
    14491455 *
    14501456 */
     1457/**
     1458 * Keep only plugin paths whose main file still exists on disk.
     1459 *
     1460 * @param array $plugins Plugin paths relative to WP_PLUGIN_DIR.
     1461 * @return array
     1462 * @since 2.8.1
     1463 */
     1464function eos_dp_existing_plugin_paths( $plugins ) {
     1465        if ( ! is_array( $plugins ) ) {
     1466                return array();
     1467        }
     1468        $plugin_dir = defined( 'WP_PLUGIN_DIR' ) ? WP_PLUGIN_DIR : ( defined( 'ABSPATH' ) ? ABSPATH . 'wp-content/plugins' : '' );
     1469        if ( '' === $plugin_dir ) {
     1470                return array_values( array_filter( $plugins ) );
     1471        }
     1472        $existing = array();
     1473        foreach ( $plugins as $plugin ) {
     1474                if ( ! is_string( $plugin ) || '' === $plugin || false === strpos( $plugin, '/' ) ) {
     1475                        continue;
     1476                }
     1477                if ( file_exists( $plugin_dir . '/' . $plugin ) ) {
     1478                        $existing[] = $plugin;
     1479                }
     1480        }
     1481        return $existing;
     1482}
     1483
    14511484function eos_dp_filter_paths( $eos_dp_paths,$plugins ){
    14521485        $eos_dp_paths = eos_dp_prevent_disabling_wrong_plugins( $eos_dp_paths );
    14531486        $e = 0;
    14541487        if( $eos_dp_paths && is_array( $eos_dp_paths ) && in_array( 'woocommerce/woocommerce.php',$eos_dp_paths ) ){
    1455                 if( isset( $_GET['download_link'] ) || ( isset( $_GET['order'] ) && false !== strpos( sanitize_text_field( $_GET['order'] ),'wc_order' ) ) ){
     1488                if( isset( $_GET['download_link'] ) || ( isset( $_GET['order'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_GET['order'] ) ),'wc_order' ) ) ){
    14561489                        unset( $eos_dp_paths[array_search( 'woocommerce/woocommerce.php',$eos_dp_paths )] );
    14571490                }
    … …  
    15971630                }
    15981631        }
    1599         if( !wp_verify_nonce( sanitize_text_field( $_REQUEST['eos_dp_preview'] ),'eos_dp_preview' ) ){
    1600                 $nonce = get_transient( 'fdp_testing_nonce_'.sanitize_key( $_REQUEST['fdp_post_id'] ) );
     1632        if ( ! isset( $_REQUEST['eos_dp_preview'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['eos_dp_preview'] ) ), 'eos_dp_preview' ) ) {
     1633                $nonce = isset( $_REQUEST['fdp_post_id'] ) ? get_transient( 'fdp_testing_nonce_' . sanitize_key( wp_unslash( $_REQUEST['fdp_post_id'] ) ) ) : false;
    16011634                if( $nonce ){
    16021635                        if( 1000*absint( time()/1000 ) === absint( $nonce ) ){
    … …  
    16091642                echo '<p>Log out, log in, and try again.</p>';
    16101643                if( isset( $_SERVER['SERVER_NAME'] ) ){
    1611                         echo '<p>Delete all the cookies written by '.esc_html( sanitize_text_field( $_SERVER['SERVER_NAME'] ) ).' and then log in again.</p>';
     1644                        echo '<p>Delete all the cookies written by '.esc_html( sanitize_text_field( wp_unslash( $_SERVER['SERVER_NAME'] ) ) ).' and then log in again.</p>';
    16121645                }
    16131646                else{
    … …  
    16521685                'queries' => array( 'Number of database queries','Q',$wpdb->num_queries ),
    16531686                'wp_loaded' => array( 'Initialization Time. At this time WordPress, all plugins, and the theme are fully loaded and instantiated','IT',$GLOBALS['eos_dp_wp_loaded'].'s' ),
    1654                 'loading_time' => array( 'Page Generation Time. At this time the server has generated the entire HTML.','PGT',( strval( round(microtime(true) - sanitize_text_field( $_SERVER['REQUEST_TIME_FLOAT'] ),2 ) ) ).'s' ),
     1687                'loading_time' => array( 'Page Generation Time. At this time the server has generated the entire HTML.','PGT',( strval( isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? round( microtime( true ) - (float) wp_unslash( $_SERVER['REQUEST_TIME_FLOAT'] ), 2 ) : 0 ) ).'s' ),
    16551688                'memory' => array( 'Memory Usage. This is the memory consumed for generating the entire HTML.','MU',sprintf( '%s %s (%s)',round( $memory_usage, $precision ),'M',round( 100*$memory_usage/absint( ini_get( 'memory_limit' ) ),1 ).'%' ) )
    16561689        );
    … …  
    16681701                }
    16691702        }
    1670         if( is_array( $eos_dp_all_plugins ) && array( $eos_dp_paths ) ){
    1671                 $still_enable = array_diff( $eos_dp_all_plugins,$eos_dp_paths );
    1672                 $plugins_str .= '[br][br][p]ACTIVE PLUGINS ('.count( $still_enable ).'):[pp]';
    1673                 foreach( $still_enable as $plugin ){
    1674                         if( false === strpos( $plugin,'freesoul-deactivate-plugins' ) ){
    1675                                 $plugins_str .= '[p]'.ucwords( eos_dp_get_plugin_name_by_slug( $plugin ) ).'[pp]';
     1703        if ( is_array( $eos_dp_all_plugins ) && is_array( $eos_dp_paths ) ) {
     1704                $still_enable = array_diff( eos_dp_existing_plugin_paths( $eos_dp_all_plugins ), $eos_dp_paths );
     1705                $plugins_str .= '[br][br][p]ACTIVE PLUGINS (' . count( $still_enable ) . '):[pp]';
     1706                foreach ( $still_enable as $plugin ) {
     1707                        if ( false === strpos( $plugin, 'freesoul-deactivate-plugins' ) ) {
     1708                                $plugins_str .= '[p]' . ucwords( eos_dp_get_plugin_name_by_slug( $plugin ) ) . '[pp]';
    16761709                        }
    16771710                }
    … …  
    17701803                'queries' => sprintf( 'Queries: %s',$wpdb->num_queries ),
    17711804                'wp_loaded' => sprintf( 'Initialization Time: %s %s',$GLOBALS['eos_dp_wp_loaded'],'s' ),
    1772                 'loading_time' => sprintf( 'Page Generation Time: %s %s',strval( round(microtime(true) - sanitize_text_field( $_SERVER['REQUEST_TIME_FLOAT'] ),2 ) ),'s' ),
     1805                'loading_time' => sprintf( 'Page Generation Time: %s %s', strval( isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? round( microtime( true ) - (float) wp_unslash( $_SERVER['REQUEST_TIME_FLOAT'] ), 2 ) : 0 ), 's' ),
    17731806                'memory' => sprintf( 'Memory Usage: %s %s (%s)',round( $memory_usage, $precision ),'M',round( 100*$memory_usage/absint( ini_get( 'memory_limit' ) ),1 ).'%' )
    17741807        );
    … …  
    18851918function eos_dp_is_mobile() {
    18861919        if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) return false;
    1887         if ( strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ),'mobile' ) !== false
    1888                 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ),'android' ) !== false
    1889                 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ),'silk/' ) !== false
    1890                 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ),'kindle' ) !== false
    1891                 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ),'blackBerry' ) !== false
    1892                 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ),'opera mini' ) !== false
    1893                 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) ),'opera mobi' ) !== false
     1920        if ( strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ),'mobile' ) !== false
     1921                || strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ),'android' ) !== false
     1922                || strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ),'silk/' ) !== false
     1923                || strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ),'kindle' ) !== false
     1924                || strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ),'blackBerry' ) !== false
     1925                || strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ),'opera mini' ) !== false
     1926                || strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ),'opera mobi' ) !== false
    18941927        ) {
    18951928                return true;
    … …  
    19992032                        $GLOBALS['eos_dp_paths'] = $disabled_on_search;
    20002033                }
    2001                 if( defined( 'EOS_DP_DEBUG' ) && true === EOS_DP_DEBUG || ( isset( $_SERVER['REMOTE_ADDR'] ) && isset( $_GET['show_disabled_plugins'] ) && $_GET['show_disabled_plugins'] === md5( sanitize_text_field( $_SERVER['REMOTE_ADDR'] ) ) ) ){
     2034                if( defined( 'EOS_DP_DEBUG' ) && true === EOS_DP_DEBUG || ( isset( $_SERVER['REMOTE_ADDR'] ) && isset( $_GET['show_disabled_plugins'] ) && $_GET['show_disabled_plugins'] === md5( sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) ) ) ){
    20022035                        $GLOBALS['eos_dp_user_can_preview'] = true;
    20032036                        add_action( 'wp_footer','eos_dp_print_disabled_plugins',9999 );
    … …  
    20112044        $action = false;
    20122045        if( isset( $_REQUEST['action'] ) ){
    2013                 $action = sanitize_text_field( $_REQUEST['action'] );
     2046                $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) );
    20142047        }
    20152048        elseif( isset( $_REQUEST['wc-ajax'] ) ){
    2016                 $action = sanitize_text_field( $_REQUEST['wc-ajax'] );
     2049                $action = sanitize_text_field( wp_unslash( $_REQUEST['wc-ajax'] ) );
    20172050        }
    20182051        if( $action && false !== strpos( $action,'eos_dp_' ) ){
    … …  
    20562089                $action = false;
    20572090                if( isset( $_REQUEST['action'] ) ){
    2058                         $action = sanitize_text_field( $_REQUEST['action'] );
     2091                        $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) );
    20592092                }
    20602093                elseif( isset( $_REQUEST['wc-ajax'] ) ){
    2061                         $action = sanitize_text_field( $_REQUEST['wc-ajax'] );
     2094                        $action = sanitize_text_field( wp_unslash( $_REQUEST['wc-ajax'] ) );
    20622095                }
    20632096                if( $action && is_array( $plugins_actions ) && in_array( $action,array_keys( $plugins_actions ) ) && isset( $plugins_actions[$action] ) ){
    … …  
    21132146                $disabled_on_ajax = eos_dp_disabled_plugins_on_ajax();
    21142147                if( is_array( $plugins ) && $disabled_on_ajax ){
    2115                         if( isset( $_REQUEST['action'] ) && false !== strpos( sanitize_text_field( $_REQUEST['action'] ),'eos_dp_' ) ){
     2148                        if( isset( $_REQUEST['action'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ),'eos_dp_' ) ){
    21162149                                if( in_array( 'freesoul-deactivate-plugins/freesoul-deactivate-plugins.php',$disabled_on_ajax ) ){
    21172150                                        unset( $disabled_on_ajax[array_search( 'freesoul-deactivate-plugins/freesoul-deactivate-plugins.php',$disabled_on_ajax )] );
    … …  
    21492182                $action = false;
    21502183                if( isset( $_REQUEST['action'] ) ){
    2151                         $action = sanitize_text_field( $_REQUEST['action'] );
     2184                        $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) );
    21522185                }
    21532186                elseif( isset( $_REQUEST['wc-ajax'] ) ) {
    2154                         $action = sanitize_text_field( $_REQUEST['wc-ajax'] );
     2187                        $action = sanitize_text_field( wp_unslash( $_REQUEST['wc-ajax'] ) );
    21552188                }
    21562189                if( ! $action ){
    … …  
    22152248        $action = false;
    22162249        if( isset( $_REQUEST['action'] ) ){
    2217                 $action = sanitize_text_field( $_REQUEST['action'] );
     2250                $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) );
    22182251        }
    22192252        elseif( isset( $_REQUEST['wc-ajax'] ) ){
    2220                 $action = sanitize_text_field( $_REQUEST['wc-ajax'] );
     2253                $action = sanitize_text_field( wp_unslash( $_REQUEST['wc-ajax'] ) );
    22212254        }
    22222255        if( ! $action ){
    … …  
    24302463    $parts         = explode( '/', trim( $page_path, '/' ) );
    24312464    $parts         = array_map( 'sanitize_title_for_query', $parts );
    2432     $escaped_parts = esc_sql( $parts );
    2433     $in_string = "'" . implode( "','", $escaped_parts ) . "'";
    2434     $post_types          = esc_sql( $post_types );
    2435     $post_type_in_string = "'" . implode( "','", $post_types ) . "'";
    2436     $sql                 = "
    2437         SELECT ID, post_name, post_parent, post_type
    2438         FROM $wpdb->posts
    2439         WHERE post_name IN ($in_string)
    2440         AND post_type IN ($post_type_in_string)
    2441     ";
    2442         $unsets = array();
    2443     $pages = $wpdb->get_results( $sql, OBJECT_K ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
     2465        if ( empty( $parts ) || empty( $post_types ) ) {
     2466                return false;
     2467        }
     2468        $post_types = array_values( (array) $post_types );
     2469        $unsets     = array();
     2470        $pages      = $wpdb->get_results(
     2471                $wpdb->prepare(
     2472                        "SELECT ID, post_name, post_parent, post_type FROM {$wpdb->posts} WHERE post_name IN (" . implode( ',', array_fill( 0, count( $parts ), '%s' ) ) . ') AND post_type IN (' . implode( ',', array_fill( 0, count( $post_types ), '%s' ) ) . ')',
     2473                        array_merge( $parts, $post_types )
     2474                ),
     2475                OBJECT_K
     2476        );
    24442477        foreach( (array) $pages as &$page ){
    24452478                if( $page->post_name !== basename( $page_path ) ){
    … …  
    24592492    $foundid = 0;
    24602493        $foundids = array();
    2461         $arr = array( sanitize_text_field( $_SERVER['HTTP_HOST'] ) );
     2494        $arr = array( isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '' );
    24622495    foreach ( (array) $pages as $page ) {
    24632496                $arr[] = isset( $page->post_parent_name ) ? $page->post_parent_name : $page->post_name;
    24642497    }
    2465         $requestA = explode( '/',sanitize_text_field( $_SERVER['REQUEST_URI'] ) );
     2498        $requestA = explode( '/', isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '' );
    24662499        if( isset( $requestA[1] ) ){
    24672500                $arr[] = $requestA[1];
    … …  
    24942527 */
    24952528function eos_dp_prevent_disabling_wrong_plugins( $plugins ){
    2496         if( in_array( 'woocommerce/woocommerce.php',$plugins ) && isset( $_REQUEST['order'] ) && 0 === strpos( sanitize_text_field( $_GET['order'] ),'wc_order_' ) ){
     2529        if( in_array( 'woocommerce/woocommerce.php',$plugins ) && isset( $_REQUEST['order'] ) && isset( $_GET['order'] ) && 0 === strpos( sanitize_text_field( wp_unslash( $_GET['order'] ) ),'wc_order_' ) ){
    24972530                unset( $plugins[array_search( 'woocommerce/woocommerce.php',$plugins)] );
    24982531        }
    … …  
    26352668 */
    26362669function eos_dp_request_has_basic_auth(){
    2637         if( isset( $_SERVER['PHP_AUTH_USER'] ) && '' !== (string) $_SERVER['PHP_AUTH_USER'] ){
     2670        if( isset( $_SERVER['PHP_AUTH_USER'] ) && '' !== (string) wp_unslash( $_SERVER['PHP_AUTH_USER'] ) ){
    26382671                return true;
    26392672        }
    … …  
    30683101function eos_dp_is_maybe_ajax(){
    30693102        if( wp_doing_ajax() || isset( $_REQUEST['wc-ajax'] ) ) return true;
    3070         if( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && !empty($_SERVER['HTTP_X_REQUESTED_WITH'] ) && 'xmlhttprequest' === strtolower( sanitize_text_field( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) ){
     3103        if( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && !empty($_SERVER['HTTP_X_REQUESTED_WITH'] ) && 'xmlhttprequest' === strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) ) ){
    30713104                return true;
    30723105        }
    … …  
    31713204        $n = $eos_dp_paths ? count( array_unique( array_filter( $eos_dp_paths ) ) ) : 'none';
    31723205        $pro = defined( 'FDP_PRO_ACTIVE' ) && FDP_PRO_ACTIVE ? '-pro' : '';
    3173         header( 'Disabled-plugins' . esc_attr( $pro ) . ': '.absint( $n ).' on '.date( 'Y-m-d h:i:s' ) );
     3206        header( 'Disabled-plugins' . esc_attr( $pro ) . ': ' . absint( $n ) . ' on ' . gmdate( 'Y-m-d H:i:s' ) );
    31743207}, 100 );
    31753208
    … …  
    32033236                        );
    32043237                        if( isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['REQUEST_URI'] ) ){
    3205                                 $arr['url'] = is_ssl() ? 'https://'.sanitize_text_field( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ) : 'http://'.sanitize_text_field( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] );
     3238                                $arr['url'] = is_ssl() ? 'https://'.sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) . wp_unslash( $_SERVER['REQUEST_URI'] ) ) : 'http://'.sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) . wp_unslash( $_SERVER['REQUEST_URI'] ) );
    32063239                        }
    32073240                        set_site_transient( 'fdp_plugin_disabledd_fatal_error',$arr,60*60*2 );
    … …  
    36733706 */
    36743707function eos_dp_admin_top_bar( $admin_top_bar ) {
    3675         if( isset( $_GET['post'] ) && absint( $_GET['post'] ) > 0 || ( isset( $GLOBALS['post'] ) && function_exists( 'is_singular' ) && is_singular() ) && current_user_can( 'activate_plugins' ) ) {
    3676                 $post = isset( $_GET['post'] ) && absint( $_GET['post'] ) > 0 ? get_post( absint( $_GET['post'] ) ) : $GLOBALS['post'];
     3708        if( isset( $_GET['post'] ) && absint( wp_unslash( $_GET['post'] ) ) > 0 || ( isset( $GLOBALS['post'] ) && function_exists( 'is_singular' ) && is_singular() ) && current_user_can( 'activate_plugins' ) ) {
     3709                $post = isset( $_GET['post'] ) && absint( wp_unslash( $_GET['post'] ) ) > 0 ? get_post( absint( wp_unslash( $_GET['post'] ) ) ) : $GLOBALS['post'];
    36773710                if( $post && is_object( $post ) ) {
    36783711                        $admin_top_bar->add_menu( array(
  • freesoul-deactivate-plugins/trunk/readme.txt

    r3828268 r3831228  
    1 === Freesoul Deactivate Plugins - Disable plugins on individual WordPress pages ===
     1=== Freesoul Deactivate Plugins ===
    22
    33Contributors:      giuse
    4 Requires at least: 4.6
     4Requires at least: 4.9
    55Tested up to: 7.1
    66Requires PHP:      7.4
    7 Stable tag:        2.8.0
     7Stable tag:        2.8.2
    88License:           GPLv2 or later
    99License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    221221== Changelog ==
    222222
    223 = 2.8.0 =
    224 * Fixed: REST API requests authenticated with an application password were treated as logged out. The current user is no longer resolved before WordPress recognizes the request as REST, so a valid application password authenticates and an unknown username returns invalid_username.
    225 * Fixed: A term archive is no longer treated as a single post when a post has the same slug. Rewrite rules are checked before applying the single settings.
    226 * Fixed: WooCommerce Ajax actions not recognized (PRO version).
    227 * Fixed: Code Profiler action button missing in the row actions when FDP PRO loads before the free version.
     223= 2.8.2 =
     224* Security: Auto-settings AJAX always requires nonce + activate_plugins; auth can no longer be skipped via a request flag. Preview fetches are limited to same-site URLs; POST headers are accepted only from users who can activate plugins.
    228225
    229226*<a href="https://freesoul-deactivate-plugins.com/how-deactivate-plugins-on-specific-pages/change-log/">Complete Change Log</a>
  • freesoul-deactivate-plugins/trunk/uninstall.php

    r3665736 r3831228  
    5656$dirPath     = $upload_dirs['basedir'] . '/FDP/fdp-single-options';
    5757if ( is_dir( $dirPath ) ) {
    58         $files = array();
    59         $n     = 1;
    60         do {
    61                 $files_n = glob( $dirPath . implode( '', array_fill( 0, $n, '/*' ) ) );
    62                 if ( ! empty( $files_n ) ) {
    63                         $files[ $n - 1 ] = $files_n;
    64                 }
    65                 ++$n;
    66         } while ( ! empty( $files_n ) );
    67         $files = array_reverse( $files );
    68         foreach ( $files as $k => $values ) {
    69                 foreach ( $values as $value ) {
    70                         if ( is_dir( $value ) ) {
    71                                 rmdir( $value );
    72                         } else {
    73                                 if ( file_exists( $value ) ) {
    74                                         wp_delete_file( $value );
    75                                 }
    76                         }
    77                 }
     58        if ( ! function_exists( 'WP_Filesystem' ) ) {
     59                require_once ABSPATH . 'wp-admin/includes/file.php';
    7860        }
    79         rmdir( $dirPath );
     61        if ( WP_Filesystem() ) {
     62                global $wp_filesystem;
     63                $wp_filesystem->rmdir( $dirPath, true );
     64        }
    8065}
    8166delete_metadata( 'user', 0, 'fdp_toplevel_admin_menu', '', true );
Note: See TracChangeset for help on using the changeset viewer.