Changeset 3831228
- Timestamp:
- 11/28/2026 10:35:50 AM (less than one hour ago)
- Location:
- freesoul-deactivate-plugins/trunk
- Files:
-
- 31 edited
-
admin/classes/abstracts/class-eos-fdp-matrix-page.php (modified) (1 diff)
-
admin/classes/class-fdp-archives.php (modified) (1 diff)
-
admin/classes/class-fdp-custom-rows.php (modified) (1 diff)
-
admin/classes/class-fdp-frontend-singles.php (modified) (12 diffs)
-
admin/classes/class-fdp-license-manager.php (modified) (4 diffs)
-
admin/classes/class-fdp-load-addons.php (modified) (1 diff)
-
admin/classes/class-fdp-plugin-factory.php (modified) (2 diffs)
-
admin/classes/class-fdp-submenu-item.php (modified) (1 diff)
-
admin/classes/class-fdp-terms-archives.php (modified) (3 diffs)
-
admin/eos-dp-ajax.php (modified) (39 diffs)
-
admin/eos-dp-helper.php (modified) (9 diffs)
-
admin/fdp-admin-base.php (modified) (2 diffs)
-
admin/fdp-admin.php (modified) (19 diffs)
-
admin/templates/pages/eos-dp-help.php (modified) (1 diff)
-
admin/templates/pages/eos-dp-integration.php (modified) (1 diff)
-
admin/templates/partials/eos-dp-footer.php (modified) (2 diffs)
-
admin/templates/partials/eos-dp-navigation.php (modified) (5 diffs)
-
admin/templates/partials/eos-dp-table-head.php (modified) (1 diff)
-
admin/templates/partials/nav-menu-items/menu-item-archives.php (modified) (1 diff)
-
admin/templates/partials/nav-menu-items/menu-item-device.php (modified) (1 diff)
-
admin/templates/partials/nav-menu-items/menu-item-singles.php (modified) (1 diff)
-
admin/templates/partials/nav-menu-items/menu-item-term-archives.php (modified) (1 diff)
-
fdp-load.php (modified) (11 diffs)
-
freesoul-deactivate-plugins.php (modified) (2 diffs)
-
inc/fdp-main.php (modified) (1 diff)
-
inc/fdp-metaboxes.php (modified) (1 diff)
-
inc/fdp-woocommerce.php (modified) (4 diffs)
-
integrations/index.php (modified) (1 diff)
-
mu-plugins/eos-deactivate-plugins.php (modified) (50 diffs)
-
readme.txt (modified) (2 diffs)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
freesoul-deactivate-plugins/trunk/admin/classes/abstracts/class-eos-fdp-matrix-page.php
r3432060 r3831228 71 71 <th class="fdp-legend" style="vertical-align:bottom;border-style:none;text-align:initial;padding-left:20px;margin-left:-20px"> 72 72 <?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'] ) ) ) ); ?> 74 74 <?php $this->legend(); ?> 75 75 <div> -
freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-archives.php
r3443290 r3831228 149 149 continue; 150 150 } 151 $labels = get_post_type_labels( get_post_type_object( $post_type ) );151 $labels = $postTypeObj->labels; 152 152 $labels_name = isset( $labels->name ) ? $labels->name : $post_type; 153 153 $post_type_obj = get_post_type_object( $post_type ); -
freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-custom-rows.php
r3598276 r3831228 171 171 <tr> 172 172 <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> 174 174 </td> 175 175 </tr> -
freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-frontend-singles.php
r3443290 r3831228 164 164 $this->order = 'ASC'; 165 165 $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'] ) ) ); 171 171 } 172 172 else{ 173 173 $this->posts_per_page = $default_posts_per_page; 174 174 } 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'; 176 176 $this->title = isset( $_GET['eos_dp_relevant_pages'] ) && 'true' === $_GET['eos_dp_relevant_pages'] ? esc_html__( 'Relevant Pages', 'freesoul-deactivate-plugins' ) : $this->active_label; 177 177 $this->dataset = ' data-post_type="' . esc_attr( $this->post_type ) . '"'; … … 189 189 $current_labels_name = ''; 190 190 $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; 192 192 $args = array( 193 193 'post_type' => $this->post_type, … … 197 197 ); 198 198 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'] ) ) ); 200 200 } 201 201 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'] ) ) ); 203 203 } 204 204 else { … … 207 207 208 208 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'] ) ) ); 210 210 } 211 211 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'] ) ) ); 213 213 } 214 214 else { … … 220 220 $this->is_hierarchical = is_post_type_hierarchical( $this->post_type ); 221 221 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'] ) ) ) ); 223 223 } 224 224 if ( isset( $_GET['eos_post_title'] ) ) { 225 225 ?><h2><?php 226 226 // 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> 228 228 <?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. 230 230 // No need for sanitization, esc_attr used after urldecode. 231 231 } … … 239 239 printf( esc_html__( 'Results for %s', 'freesoul-deactivate-plugins' ), esc_html( $cat ) ); ?></h2> 240 240 <?php 241 $args['category'] = sanitize_title( $_GET['eos_cat']);241 $args['category'] = sanitize_title( wp_unslash( $_GET['eos_cat'] ) ); 242 242 } 243 243 if ( isset( $_GET['tax_name'] ) && isset( $_GET['term_slug'] ) ) { 244 244 $args['tax_query'] = array( // phpcs:ignore WordPress.DB.SlowDBQuery -- This query is absolutely needed and it's the faster way. 245 245 array( 246 'taxonomy' => esc_attr( sanitize_text_field( $_GET['tax_name']) ),246 'taxonomy' => esc_attr( sanitize_text_field( wp_unslash( $_GET['tax_name'] ) ) ), 247 247 'field' => 'slug', 248 'terms' => esc_attr( sanitize_text_field( $_GET['term_slug']) ),248 'terms' => esc_attr( sanitize_text_field( wp_unslash( $_GET['term_slug'] ) ) ), 249 249 ), 250 250 ); … … 263 263 $this->important_pages = eos_dp_important_pages(); 264 264 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; 266 266 if ( isset( $_GET['eos_dp_home'] ) && 'true' === $_GET['eos_dp_home'] ) { 267 267 $this->show_on_front = eos_dp_get_option( 'show_on_front' ); … … 280 280 $this->posts = ! $this->is_home ? get_posts( $args ) : array( get_post( $this->page_on_front ) ); 281 281 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 )] ) ) ); 283 283 $new_order = $new_posts = array(); 284 284 $found = $not_found = 0; … … 301 301 } 302 302 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'] ) ) ); 304 304 if ( $this->fdp_is_single_post && ! isset( $_GET['eos_dp_post_in'] ) ) { 305 305 $single_post = $this->posts[0]; 306 306 $this->single_post_id = $single_post->ID; 307 307 } 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; 309 309 $taxs = get_taxonomies( array(), 'objects' ); 310 310 } … … 316 316 $published_posts = $count_posts->publish + $count_posts->future + $count_posts->draft + $count_posts->pending + $count_posts->private; 317 317 $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; 319 319 ?> 320 320 <div id="eos-dp-pagination-wrp" class="right"> … … 358 358 <h4 style="margin-bottom:0"><?php esc_html_e( 'Device', 'freesoul-deactivate-plugins' ); ?></h4> 359 359 <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> 363 363 </select> 364 364 </div> … … 404 404 $published_posts = $count_posts->publish + $count_posts->future + $count_posts->draft + $count_posts->pending + $count_posts->private; 405 405 $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; 407 407 if ( $this->fdp_is_single_post ) { 408 408 add_filter( 'admin_footer_text', '__return_false', 999999 ); -
freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-license-manager.php
r3443290 r3831228 38 38 update_option( '_site_transient_update_themes', '' ); 39 39 set_site_transient( 'update_themes', null ); 40 wp_ redirect( admin_url( 'plugins.php' ) );40 wp_safe_redirect( admin_url( 'plugins.php' ) ); 41 41 exit; 42 42 } … … 78 78 } 79 79 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'] ) ) ) : ''; 81 81 switch ( $type ) { 82 82 case 'rl': // remove license, … … 293 293 $password = $this->key; 294 294 } 295 $plainText = rand( 10, 99 ) . $plainText .rand( 10, 99 );295 $plainText = wp_rand( 10, 99 ) . $plainText . wp_rand( 10, 99 ); 296 296 $method = 'aes-256-cbc'; 297 297 $key = substr( hash( 'sha256', $password, true ), 0, 32 ); … … 330 330 } elseif( isset( $_SERVER['HTTP_HOST'] ) && isset( $_SERVER['SCRIPT_NAME'] ) ) { 331 331 $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'] ) ) ); 334 334 335 335 return $base_url; -
freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-load-addons.php
r3443290 r3831228 131 131 */ 132 132 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_' ) ) { 134 134 return; 135 135 } 136 $addon_slug = ltrim( sanitize_text_field ( $_GET['page']), 'eos_dp_' );136 $addon_slug = ltrim( sanitize_text_field ( wp_unslash( $_GET['page'] ) ), 'eos_dp_' ); 137 137 fdp_add_plugins_settings_page( sanitize_key( sanitize_text_field( $addon_slug ) ), $this->titles[ esc_attr( $addon_slug ) ] ); 138 138 } -
freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-plugin-factory.php
r3443290 r3831228 43 43 ?> 44 44 <section id="fdp-create-plugin-wrp"> 45 <?php if ( !is_writable( WP_PLUGIN_DIR ) ) { ?>45 <?php if ( ! eos_dp_is_writable( WP_PLUGIN_DIR ) ) { ?> 46 46 <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> 47 47 <?php } ?> … … 112 112 ?> 113 113 <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> 115 115 <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> 116 116 <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 25 25 } 26 26 $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'; 28 28 add_filter( 29 29 'fdp_pages', -
freesoul-deactivate-plugins/trunk/admin/classes/class-fdp-terms-archives.php
r3443290 r3831228 28 28 $this->section_id = 'eos-dp-by-archive-section'; 29 29 $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'; 31 31 $this->tax = get_taxonomy( $this->current_tax ); 32 32 $this->terms = get_terms( … … 150 150 $active = false; 151 151 $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'] ) ) ) ) { 153 153 --$row; 154 154 continue; … … 203 203 $values = array_fill( 0, count( $this->active_plugins ), ',' ); 204 204 } 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; 206 206 ?> 207 207 <tr class="eos-dp-archive-row eos-dp-post-row<?php -
freesoul-deactivate-plugins/trunk/admin/eos-dp-ajax.php
r3665736 r3831228 14 14 function eos_dp_save_settings() { 15 15 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' ); 16 17 if ( isset( $_POST['eos_dp_setts'] ) && ! empty( $_POST['eos_dp_setts'] ) ) { 17 18 $opts = $_POST['eos_dp_setts']; // @codingStandardsIgnoreLine. … … 89 90 function eos_dp_save_archives_settings() { 90 91 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' ); 91 93 if ( isset( $_POST['archivesUrls'] ) && ! empty( $_POST['archivesUrls'] ) ) { 92 94 foreach ( $_POST['archivesUrls'] as $archive_path => $arr ) { // @codingStandardsIgnoreLine. We sanitize later. … … 134 136 function eos_dp_save_post_type_settings() { 135 137 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' ); 136 139 if ( isset( $_POST['eos_dp_pt_setts'] ) && ! empty( $_POST['eos_dp_pt_setts'] ) ) { 137 140 $opts = eos_dp_get_updated_plugins_table(); … … 159 162 function eos_dp_save_url_settings() { 160 163 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' ); 162 166 $rows = json_decode( str_replace( '\\', '', sanitize_text_field( wp_unslash( $_POST['setts'] ) ) ), true ); 163 167 $n = 0; … … 209 213 function eos_dp_save_one_col_settings() { 210 214 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' ); 212 217 if ( isset( $_POST['data'] ) && ! empty( $_POST['data'] ) ) { 213 218 $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 ); 215 220 echo 1; 216 221 die(); … … 225 230 function eos_dp_save_admin_settings() { 226 231 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 } 227 237 $opts = json_decode( str_replace( '\\', '', sanitize_text_field( wp_unslash( $_POST['eos_dp_admin_setts'] ) ) ), true ); 228 238 eos_dp_update_option( 'eos_dp_new_plugin_activated', false ); … … 261 271 exit; 262 272 } 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'] ) ) ) ) ); 265 276 echo 1; 266 277 die(); … … 272 283 function eos_dp_save_integration_actions_settings() { 273 284 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 } 274 290 $opts = json_decode( str_replace( '\\', '', sanitize_text_field( wp_unslash( $_POST['integration_plugins'] ) ) ), true ); 275 291 eos_dp_update_option( 'eos_dp_new_plugin_activated', false ); … … 306 322 function eos_dp_save_firing_order() { 307 323 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' ); 308 325 if ( empty( $_POST['eos_dp_plugins'] ) || ! is_array( $_POST['eos_dp_plugins'] ) ) { 309 326 echo 0; … … 328 345 // Prepare the transient for the preview. 329 346 function 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 } 332 356 eos_dp_check_intentions_and_rights( $nonceStr ); 333 357 if ( isset( $_POST['plugin_path'] ) && isset( $_POST['microtime'] ) ) { … … 347 371 set_transient( 'fdp_test_' . $admin_page_key . '_' . $microtime, sanitize_text_field( wp_unslash( $_POST['plugin_path'] ) ), 60 ); 348 372 } 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 ); 351 375 } 352 376 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 ); 354 378 } 355 379 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 ); 357 381 } 358 382 if ( isset( $_POST['page_speed_insights'] ) && 'true' === sanitize_text_field( wp_unslash( $_POST['page_speed_insights'] ) ) ) { … … 369 393 function eos_dp_check_single_padlock() { 370 394 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' ); 371 396 if ( isset( $_POST['post_type'] ) ) { 372 397 $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'] ) ) ]; 374 399 echo ! isset( $arr[0] ) || $arr[0] == '1' ? 'override' : 'not-override'; 375 400 die(); … … 397 422 398 423 } 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']; 401 431 $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 }405 432 if ( ! isset( $post_args['post_id'] ) && ! isset( $post_args['post_type'] ) && ! isset( $post_args['tax'] ) ) { 406 433 echo 0; … … 456 483 $args['fdp_post_type'] = esc_attr( $post_args['post_type'] ); 457 484 } 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 } 459 491 $transient_name = 'fdp_test_' . $cron . sanitize_key( $post_args['tax'] ) . '_'; 460 492 $args['fdp_tax'] = esc_attr( sanitize_text_field( $post_args['tax'] ) ); … … 574 606 // Auto settings New. 575 607 function 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 } 577 616 $post_args = json_decode( stripslashes( sanitize_text_field( wp_unslash( $_POST['data'] ) ) ), true ); 578 617 } 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']; 580 622 $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 }584 623 if ( ! isset( $post_args['post_id'] ) && ! isset( $post_args['post_type'] ) && ! isset( $post_args['tax'] ) ) { 585 624 echo 0; … … 633 672 $args['fdp_post_type'] = esc_attr( $post_args['post_type'] ); 634 673 } 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 } 636 680 $transient_name = 'fdp_test_' . $cron . sanitize_key( $post_args['tax'] ) . '_'; 637 681 $args['fdp_tax'] = esc_attr( sanitize_text_field( $post_args['tax'] ) ); … … 753 797 // Auto settings. 754 798 function 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; 757 802 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']; 759 805 $time0 = time(); 760 806 $maxExeTime = absint( ini_get( 'max_execution_time' ) ); … … 857 903 // Retrieves the body HTML given the URL. 858 904 function 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 } 859 908 $url = add_query_arg( 860 909 array( … … 870 919 $args = eos_dp_user_headers( $args, true ); 871 920 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. 872 923 $response = wp_remote_request( $url, $args ); 873 924 if ( ! is_wp_error( $response ) ) { … … 960 1011 $home_url = $home_urlA[1]; 961 1012 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 ) ); 963 1014 $url_class = str_replace( '-'.$subfolder, '', $url_class ); 964 1015 } … … 1001 1052 function eos_dp_debug_options() { 1002 1053 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' ); 1003 1055 if ( ! isset( $_POST['url'] ) || ! class_exists( 'DOMDocument' ) ) { 1004 1056 echo 0; … … 1051 1103 function eos_dp_msg_never_again() { 1052 1104 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' ); 1053 1106 if ( ! isset( $_POST['msg'] ) ) { 1054 1107 echo 0; … … 1063 1116 $user_opts = get_site_option( 'eos_dp_user_options' ); 1064 1117 $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' ); 1066 1119 update_site_option( 'eos_dp_user_options', $user_opts ); 1067 1120 die(); … … 1071 1124 // Check for intentions and rights. 1072 1125 function 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 } 1073 1133 if ( isset( $_REQUEST['eos_dp_advanced_setup'] ) || isset( $GLOBALS['eos_dp_advanced_setup'] ) ) { 1074 1134 $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'] ) ); … … 1079 1139 } 1080 1140 } 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; 1091 1144 } 1092 1145 … … 1116 1169 } 1117 1170 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 ) ) { 1119 1173 echo json_encode( array( 'error' => esc_html__( 'No write permissions', 'freesoul-deactivate-plugins' ) ) ); 1120 1174 die(); … … 1131 1185 $txt .= PHP_EOL . 'Description: ' . sanitize_text_field( $description ); 1132 1186 $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'] ) ) { 1134 1188 $txt .= PHP_EOL . 'Author URI: ' . esc_url( sanitize_text_field( wp_unslash( $_REQUEST['plugin_author_uri'] ) ) ); 1135 1189 } … … 1241 1295 exit; 1242 1296 } 1243 $url = wp_get_attachment_url( absint( $_REQUEST['id']) );1297 $url = wp_get_attachment_url( absint( wp_unslash( $_REQUEST['id'] ) ) ); 1244 1298 if ( $url ) { 1245 1299 $file = str_replace( get_home_url(), ABSPATH, $url ); … … 1272 1326 exit; 1273 1327 } 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. 1275 1329 if ( ! isset( $data['nonce'] ) || ! isset( $data['plugins'] ) || ! wp_verify_nonce( esc_attr( $data['nonce'] ), 'fdp_export_plugins_list' ) ) { 1276 1330 die(); … … 1319 1373 return; 1320 1374 } 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. 1322 1376 if ( ! isset( $data->opts_key ) || ! isset( $data->nonce ) || ! wp_verify_nonce( esc_attr( $data->nonce ), 'fdp_setts_nonce' ) ) { 1323 1377 die(); … … 1342 1396 $headers = array(); 1343 1397 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. 1345 1399 } 1346 1400 eos_dp_update_fdp_admin_menu( … … 1364 1418 return; 1365 1419 } 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. 1367 1421 if ( ! isset( $data->opts_key ) || ! isset( $data->nonce ) || ! wp_verify_nonce( esc_attr( $data->nonce ), sanitize_key( $data->opts_key ) ) ) { 1368 1422 die(); … … 1399 1453 // Save Code Profiler preferences. 1400 1454 function 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' ) ) { 1402 1456 die(); 1403 1457 exit; … … 1406 1460 $opts = eos_dp_get_option( 'fdp_code_profiler' ); 1407 1461 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( 1409 1463 'fdp_code_profiler', 1410 1464 array( … … 1658 1712 return; 1659 1713 } 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. 1661 1715 if ( ! isset( $data->license_code ) || ! isset( $data->license_email ) || ! isset( $data->nonce ) || ! wp_verify_nonce( esc_attr( $data->nonce ), 'fdp_check_license_status' ) ) { 1662 1716 die(); … … 1707 1761 exit; 1708 1762 } 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. 1710 1764 if ( isset( $data['key'] ) ) { 1711 1765 $user_id = get_current_user_id(); … … 1727 1781 function eos_dp_move_option_to_filesystem() { 1728 1782 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' ); 1729 1784 $opts = eos_dp_get_option( 'eos_dp_opts' ); 1730 1785 if ( isset( $opts['filesystem_last_status'] ) && 'ok' === $opts['filesystem_last_status'] ) { … … 1743 1798 function eos_dp_reset_fdp() { 1744 1799 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' ); 1745 1801 if ( isset( $_REQUEST['data'] ) && 'reset' === sanitize_text_field( wp_unslash( $_REQUEST['data'] ) ) ) { 1746 1802 define( 'FDP_RESET_SETTINGS', true ); … … 1764 1820 } 1765 1821 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' ); 1766 1823 $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. 1768 1825 $option = sanitize_key( $arr['option'] ); 1769 1826 $to = sanitize_key( $arr['to'] ); -
freesoul-deactivate-plugins/trunk/admin/eos-dp-helper.php
r3665736 r3831228 300 300 <?php 301 301 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. 303 303 } 304 304 ?> … … 343 343 array( 'eos_dp_menu', __( 'Experiments', 'freesoul-deactivate-plugins' ), __( 'Experiments', 'freesoul-deactivate-plugins' ), $capability, 'eos_dp_experiments', 'eos_dp_experiments_callback', 250 ), 344 344 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 ),346 345 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 ), 347 346 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 ), … … 788 787 'eos_dp_firing_order', 789 788 'eos_dp_help', 790 'eos_dp_addons',791 789 'eos_dp_hooks', 792 790 'eos_dp_reset_settings', … … 834 832 return false; 835 833 } 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. 837 835 } 838 836 … … 969 967 global $wpdb; 970 968 if ( is_array( $ids ) ) { 971 $ids = implode( ',', array_map( 'absint', $ids ));969 $ids = array_map( 'absint', $ids ); 972 970 } 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 ); 979 986 } 980 987 … … 1191 1198 // Delete options folder. 1192 1199 function 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 ); 1214 1214 } 1215 1215 } … … 1221 1221 $url .= sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ); 1222 1222 if ( isset( $_SERVER['QUERY_STRING'] ) ) { 1223 $url .= '?' . sanitize_text_field( $_SERVER['QUERY_STRING']);1223 $url .= '?' . sanitize_text_field( wp_unslash( $_SERVER['QUERY_STRING'] ) ); 1224 1224 } 1225 1225 return esc_url( $url ); 1226 1226 } 1227 1227 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 */ 1238 function 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 ); 1228 1261 } 1229 1262 … … 1237 1270 } 1238 1271 $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. 1241 1275 // Sanitization applied after stripslashes. 1242 1276 } … … 1246 1280 if ( isset( $_SERVER['HTTP_AUTHORIZATION'] ) && ! empty( $_SERVER['HTTP_AUTHORIZATION'] ) ) { 1247 1281 $args['headers'] = array( 1248 'Authorization' => sanitize_text_field( $_SERVER['HTTP_AUTHORIZATION']),1282 'Authorization' => sanitize_text_field( wp_unslash( $_SERVER['HTTP_AUTHORIZATION'] ) ), 1249 1283 ); 1250 1284 } 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 91 91 $path .= '/opts.json'; 92 92 $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 } 93 102 if( 'trash' === $action ) { 94 103 // 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 ); 97 106 } 98 107 $post_meta = get_post_meta( $post_id,'_eos_deactive_plugins_key',true ); … … 102 111 elseif( 'untrash' === $action ) { 103 112 // 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 ); 106 115 } 107 116 $post_meta = get_post_meta( $post_id,'_eos_deactive_plugins_key_trashed',true ); -
freesoul-deactivate-plugins/trunk/admin/fdp-admin.php
r3617393 r3831228 12 12 define( 'FDP_STORE_URL', 'https://shop.freesoul-deactivate-plugins.com/' ); 13 13 14 if ( isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( $_REQUEST['action']), array( 'edit', 'editpost' ) ) ) {14 if ( isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ), array( 'edit', 'editpost' ) ) ) { 15 15 add_action( 16 16 'admin_init', … … 79 79 'nocache_headers', 80 80 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 ); 82 82 $domain = str_replace( $scheme . '://', '', get_home_url() ); 83 83 $domain = false !== strpos( $domain, '/' ) ? stristr( $domain, '/', true ) : $domain; … … 122 122 array( array( 'eos_dp_experiments' ), 'pages/eos-dp-experiments.php' ), 123 123 array( array( 'eos_dp_help' ), 'pages/eos-dp-help.php' ), 124 array( array( 'eos_dp_addons' ), 'pages/eos-dp-addons.php' ),125 124 array( array( 'eos_dp_create_plugin' ), 'pages/eos-dp-create-plugin.php' ), 126 125 array( array( 'eos_dp_favorite_plugins' ), 'pages/eos-dp-favorite-plugins.php' ), … … 198 197 $label = ''; 199 198 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' ] ) ) ); 201 200 if( $post_type ){ 202 201 $label = ' | ' . $post_type->labels->name; … … 204 203 } 205 204 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' ] ) ) ); 207 206 if( $tax ){ 208 207 $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' ] ) ) ); 210 209 if( $post_type ){ 211 210 $label .= ' (' . $post_type->labels->name . ')'; … … 215 214 if ( isset( $_GET['asset_type'] ) && in_array( $_GET['asset_type'], array_keys( $labels ) ) ) { 216 215 // 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'] ) ) ] ) ); 218 217 } 219 218 if ( isset( $_GET['page'] ) && in_array( $_GET['page'], array_keys( $titles ) ) ) { … … 223 222 if ( isset( $_GET['tab'] ) ) { 224 223 // translators: %1$s is the page title, %2$s is the tab title. 225 return '🔌 ' . 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 '🔌 ' . esc_html( $titles[ sanitize_text_field( $_GET['page']) ] . apply_filters( 'fdp_after_admin_title', $label ) );224 return '🔌 ' . 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 '🔌 ' . esc_html( $titles[ sanitize_text_field( wp_unslash( $_GET['page'] ) ) ] . apply_filters( 'fdp_after_admin_title', $label ) ); 228 227 } 229 228 if ( isset( $_GET['eos_dp_info'] ) && 'true' == $_GET['eos_dp_info'] ) { … … 300 299 if ( isset( $_GET['page'] ) && eos_dp_is_fdp_page() || isset( $_GET['fdp_add_favorites'] ) || ( isset( $_GET['page'] ) && 'eos_dp_code_browser' === $_GET['page'] ) ) { 301 300 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'] ) ) ) : ''; 303 302 $classes .= ' fdp'; 304 303 $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 ) ); … … 320 319 $classes .= ' eos-dp-less-than-15-plugins'; 321 320 } 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'] ) ) ) : ''; 323 322 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' ) ) ) { 324 323 $classes .= ' fdp-one-column'; … … 383 382 admin_url( 'admin.php?page=eos_dp_menu' ) 384 383 ); 385 wp_ redirect( $redirect );384 wp_safe_redirect( $redirect ); 386 385 exit; 387 386 } … … 437 436 remove_menu_page( 'options-general.php' ); 438 437 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' ) ); 440 439 exit; 441 440 } … … 454 453 add_action( 'admin_head', 'eos_dp_firing_order_inline' ); 455 454 } 456 if ( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( $_GET['page']), 'eos_dp_' ) || ( isset( $_GET['fdp_add_favorites'] ) ) ) {455 if ( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ), 'eos_dp_' ) || ( isset( $_GET['fdp_add_favorites'] ) ) ) { 457 456 // Clean FDP backend pages and add inline style. 458 457 add_action( … … 864 863 function() { 865 864 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'] ) ) ) { 868 867 global $menu,$submenu,$eos_dp_paths,$admin_page_hooks; 869 868 $parent_plugin_pages = array(); … … 884 883 ) 885 884 ); 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'] ) ) ); 887 886 die(); 888 887 exit; … … 1132 1131 'admin_page_access_denied', 1133 1132 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_' ) ) { 1135 1134 $die = '<p>' . esc_html__( 'Sorry, you are not allowed to access this page.', 'freesoul-deactivate-plugins' ) . '</p>'; 1136 1135 if( defined( 'EOS_DP_PRO_FDP_MIN_VERSION' ) && version_compare( EOS_DP_PRO_FDP_MIN_VERSION, EOS_DP_MU_VERSION ) > 0 ){ … … 1215 1214 // Save FDP user preferences. 1216 1215 function 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' ) ) { 1218 1217 return; 1219 1218 } … … 1264 1263 'admin_init', 1265 1264 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' ) ) { 1267 1266 if( function_exists( 'eos_dp_update_fdp_cache' ) ) { 1268 1267 eos_dp_update_fdp_cache( 'nav', '', true ); … … 1289 1288 'admin_bar_menu', 1290 1289 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_' ) ) { 1292 1291 $nonce = wp_create_nonce( 'fdp_clear_cache' ); 1293 1292 $url = admin_url( 'admin.php' ); … … 1309 1308 // Redirects to settings page if it's an FDP page. 1310 1309 function 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' ) ) { 1312 1311 wp_safe_redirect( esc_url( add_query_arg( $_GET, admin_url( 'admin.php' ) ) ) ); 1313 1312 } -
freesoul-deactivate-plugins/trunk/admin/templates/pages/eos-dp-help.php
r3443290 r3831228 19 19 eos_dp_navigation(); 20 20 $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'; 22 22 if ( function_exists( 'eos_dp_help_' . sanitize_key( $tab ) . '_section' ) ) { 23 23 call_user_func( 'eos_dp_help_' . sanitize_key( $tab ) . '_section' ); -
freesoul-deactivate-plugins/trunk/admin/templates/pages/eos-dp-integration.php
r3443290 r3831228 20 20 $int_plugin = 'wordpress-core'; 21 21 } else { 22 $int_plugin = sanitize_text_field( $_GET['int_plugin']);22 $int_plugin = sanitize_text_field( wp_unslash( $_GET['int_plugin'] ) ); 23 23 } 24 24 if ( ! isset( $plugins_integration[ $int_plugin ] ) ) { -
freesoul-deactivate-plugins/trunk/admin/templates/partials/eos-dp-footer.php
r3617393 r3831228 19 19 $permalinks_label = __( 'Permalinks are set to "Numeric"', 'freesoul-deactivate-plugins' ); 20 20 } 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 ) ) ) { 22 22 $extra_class = ' eos-no-events'; 23 23 // translators: %s is the permalink structure label. … … 31 31 $dir = is_rtl() ? 'left' : 'right'; 32 32 $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'] ) ) : ''; 34 34 if ( current_user_can( 'activate_plugins' ) ) { 35 35 ?> -
freesoul-deactivate-plugins/trunk/admin/templates/partials/eos-dp-navigation.php
r3617393 r3831228 140 140 } 141 141 $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, 144 145 apply_filters( 145 146 'fdp_plugin_filter_pages', … … 161 162 'eos_dp_plugin_conflicts' 162 163 ) 163 ) 164 ), 165 true 164 166 ) ) { 165 if ( ! in_array( $ _GET['page'], array( 'eos_dp_integration' )) ) {167 if ( ! in_array( $current_page, array( 'eos_dp_integration' ), true ) ) { 166 168 ++$active_plugins; 167 169 } … … 193 195 isset( $globally_active[ $lin - 1 ] ) 194 196 && '' !== $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 ] ) ) 196 198 ) { 197 199 ?> … … 209 211 $l = $n; } 210 212 if ( in_array( 211 $ _GET['page'],213 $current_page, 212 214 apply_filters( 213 215 'fdp_theme_filter_pages', … … 220 222 'eos_dp_ajax', 221 223 ) 222 ) 224 ), 225 true 223 226 ) ) { 224 227 $tn = 1 + $active_plugins; -
freesoul-deactivate-plugins/trunk/admin/templates/partials/eos-dp-table-head.php
r3443290 r3831228 18 18 <th class="fdp-legend" style="vertical-align:bottom;border-style:none;text-align:initial;padding-left:20px;margin-left:-20px"> 19 19 <?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 ?> 21 25 <?php if ( $reset ) : ?> 22 26 <div style="margin-top:8px;margin-bottom:16px"> -
freesoul-deactivate-plugins/trunk/admin/templates/partials/nav-menu-items/menu-item-archives.php
r3432060 r3831228 28 28 $show = true; 29 29 $postTypeObj = get_post_type_object( $term_post_type ); 30 $labels = $postTypeObj ? get_post_type_labels( $postTypeObj ): false;30 $labels = $postTypeObj ? $postTypeObj->labels : false; 31 31 $labels_names[] = $labels && isset( $labels->name ) ? $labels->name : $term_post_type; 32 32 } -
freesoul-deactivate-plugins/trunk/admin/templates/partials/nav-menu-items/menu-item-device.php
r2985629 r3831228 12 12 <li id="fdp-menu-desktop" data-section="eos-dp-desktop" class="hover 13 13 <?php 14 echo $_GET['page'] === 'eos_dp_desktop'? ' eos-active' : '';14 echo ( isset( $_GET['page'] ) && 'eos_dp_desktop' === $_GET['page'] ) ? ' eos-active' : ''; 15 15 echo '' === $pro ? ' fdp-pro-feature fdp-dismiss-pro-notice' : ''; 16 16 ?> -
freesoul-deactivate-plugins/trunk/admin/templates/partials/nav-menu-items/menu-item-singles.php
r3432060 r3831228 19 19 $postTypeObj = get_post_type_object( $pt ); 20 20 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; 22 22 $labels_name = isset( $labels->name ) ? $labels->name : esc_html( $pt ); 23 23 ?> -
freesoul-deactivate-plugins/trunk/admin/templates/partials/nav-menu-items/menu-item-term-archives.php
r3432060 r3831228 19 19 20 20 $postTypeObj = get_post_type_object( $term_post_type ); 21 $labels = get_post_type_labels( $postTypeObj );21 $labels = $postTypeObj->labels; 22 22 $labels_names[] = isset( $labels->name ) ? $labels->name : $term_post_type; 23 23 } -
freesoul-deactivate-plugins/trunk/fdp-load.php
r3665736 r3831228 6 6 */ 7 7 8 defined( 'EOS_DP_PLUGIN_DIR' ) || exit; 8 defined( 'ABSPATH' ) || exit; 9 defined( 'EOS_DP_PLUGIN_DIR' ) || exit; 9 10 10 11 if ( isset( $_REQUEST['eos_dp_preview'] ) || is_admin() || wp_doing_ajax() ) { … … 44 45 } 45 46 if ( is_admin() ) { 46 $pass = md5( uniqid( microtime() . mt_rand(), true ) );47 $pass = md5( uniqid( microtime() . wp_rand(), true ) ); 47 48 set_site_transient( 'eos_dp_pro_unique_id', $pass, 60 * 60 * 24 ); 48 49 } … … 99 100 function() { 100 101 $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 } 102 105 $classes[] = 'fdp-autosuggestion-class-end'; 103 106 return $classes; … … 277 280 function eos_dp_get_wp_filesystem() { 278 281 if ( ! function_exists( 'get_filesystem_method' ) ) { 279 re turn 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() ) { 282 285 return false; 283 286 } … … 288 291 global $wp_filesystem; 289 292 if ( empty( $wp_filesystem ) ) { 290 require_once ABSPATH . '/wp-admin/includes/file.php';291 293 WP_Filesystem(); 292 294 } 293 295 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 */ 305 function 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; 294 314 } 295 315 … … 305 325 return false; 306 326 } 307 return is_writable( $dest_dir );327 return eos_dp_is_writable( $dest_dir ); 308 328 } 309 329 … … 343 363 $installed = false; 344 364 $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 ); 346 366 $wp_filesystem = eos_dp_get_wp_filesystem(); 347 $contents = f ile_get_contents( $source );367 $contents = false; 348 368 $chmod = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : 0644; 369 370 if ( $wp_filesystem ) { 371 $contents = $wp_filesystem->get_contents( $source ); 372 } 349 373 350 374 if ( false === $contents || '' === $contents ) { … … 356 380 } 357 381 358 if ( ! $ dir_writable && ! $file_writable) {382 if ( ! $wp_filesystem || ( ! $dir_writable && ! $file_writable ) ) { 359 383 if ( $update_info ) { 360 384 set_transient( 'freesoul-dp-notice-fail', true, DAY_IN_SECONDS ); … … 367 391 if ( $dir_writable ) { 368 392 $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 ); 386 398 } 387 399 } … … 389 401 // Fallback: overwrite the destination file when the directory is not writable for temp files. 390 402 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 ); 396 404 } 397 405 … … 496 504 do_action( 'fdp_get_plugin_info', $file_data, $plugin ); 497 505 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] ) ) ); 499 507 } 500 508 return 'Plugin Name' === $regex ? str_replace( '-',' ',dirname( sanitize_text_field( $plugin ) ) ) : false; -
freesoul-deactivate-plugins/trunk/freesoul-deactivate-plugins.php
r3828268 r3831228 8 8 * Domain Path: /languages/ 9 9 * Text Domain: freesoul-deactivate-plugins 10 * Requires at least: 4.9 10 11 * Requires PHP: 7.4 11 12 * Requires CP: 1.4 12 13 * 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 14 17 * 15 18 * @package Freesoul Deactivate Plugins … … 40 43 41 44 // Definitions. 42 define( 'EOS_DP_VERSION', '2.8. 0' );45 define( 'EOS_DP_VERSION', '2.8.2' ); 43 46 define( 'FDP_PLUGIN_FILE', __FILE__ ); 44 47 define( 'EOS_DP_PLUGIN_DIR', untrailingslashit( dirname( __FILE__ ) ) ); -
freesoul-deactivate-plugins/trunk/inc/fdp-main.php
r3443290 r3831228 102 102 <style id="fdp-clean-screen-css" type="text/css"> 103 103 <?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'] ) ) ) { ?> 105 105 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} 106 106 #wpcontent{margin-left:0 !important;margin-right:0 !important}body{margin-top:-30px !important} -
freesoul-deactivate-plugins/trunk/inc/fdp-metaboxes.php
r3443290 r3831228 244 244 */ 245 245 function 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 } 246 249 if ( ! isset( $_POST['eos_dp_admin_meta'] ) ) { 247 250 return; 248 251 } 249 252 // * 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' => '' ) ); 251 254 // * Sanitize in the next cicle. 252 255 foreach ( (array) $data as $key => $value ) { -
freesoul-deactivate-plugins/trunk/inc/fdp-woocommerce.php
r3592210 r3831228 447 447 448 448 $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>'; 451 451 $cart_items_html .= '</li>'; 452 452 } … … 477 477 </style> 478 478 <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"> 480 480 <span style="font-size: 20px;">🛒</span> 481 481 <?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> 483 483 <?php endif; ?> 484 484 </a> … … 486 486 <div class="fdp-cart-dropdown"> 487 487 <?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> 490 499 <div class="fdp-buttons-container"> 491 500 <a href="<?php echo esc_url($cart_url); ?>" class="fdp-btn button btn fdp-btn-view-cart">View Cart</a> … … 549 558 */ 550 559 function 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 3 3 Plugin Name: freesoul deactivate plugins [fdp] 4 4 Description: mu-plugin automatically installed by freesoul deactivate plugins 5 Version: 2.8. 05 Version: 2.8.2 6 6 Plugin URI: https://freesoul-deactivate-plugins.com/ 7 7 Author: Jose Mortellaro … … 40 40 } 41 41 42 if( is_admin() && isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( $_REQUEST['action']),array( 'activate-selected','deactivate-selected', 'activate-plugin' ) ) ){42 if( is_admin() && isset( $_REQUEST['action'] ) && in_array( sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ),array( 'activate-selected','deactivate-selected', 'activate-plugin' ) ) ){ 43 43 return; 44 44 } 45 45 46 define( 'EOS_DP_MU_VERSION','2.8. 0' );46 define( 'EOS_DP_MU_VERSION','2.8.2' ); 47 47 define( 'EOS_DP_MU_PLUGIN_DIR',untrailingslashit( dirname( __FILE__ ) ) ); 48 48 … … 142 142 if( 'rewrite_rules' === $option && $value !== $old_value ) { 143 143 $fdp_rewrite = true; 144 $plugindir = defined( PLUGINDIR ) ? PLUGINDIR.'/' : 'wp-content/plugins/';144 $plugindir = trailingslashit( WP_PLUGIN_DIR ); 145 145 $themedir = str_replace( ABSPATH,'',get_theme_root() ); 146 146 $trace = debug_backtrace(); … … 185 185 } 186 186 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 ); 188 189 if( $line && $file ){ 189 190 $output .= eos_dp_get_code_extract( $line,$file ); … … 244 245 } 245 246 } 246 if( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( $_GET['page']),'eos_dp_' ) ){247 if( isset( $_GET['page'] ) && false !== strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ),'eos_dp_' ) ){ 247 248 if( !defined( 'QM_DISABLED' ) ){ 248 249 define( 'QM_DISABLED',true ); … … 257 258 258 259 if( $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 ); 260 261 if( !isset( $_GET['fdp-dev'] ) || $dev !== $_GET['fdp-dev'] ){ 261 262 if( !is_admin() && !defined( 'FDP_OFF' ) ){ … … 297 298 $post_types_matrix = eos_dp_get_option( 'eos_post_types_plugins' ); 298 299 $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'] ) ) ) ) ); 300 301 $GLOBALS['fdp_uri'] = $uri; 301 302 if( defined( 'FDP_SKIP_URLS' ) && is_array( FDP_SKIP_URLS ) && !empty( FDP_SKIP_URLS ) ){ … … 312 313 if( $opts && isset( $opts['general_bloat'] ) ){ 313 314 $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'] ) ) ) ){ 315 316 add_action( 'muplugins_loaded',function() { 316 317 eos_dp_filter_active_plugins( '__return_empty_array',0,1 ); … … 356 357 ( !empty( $_POST ) && ( !defined( 'EOS_DP_ALLOW_POST' ) || false === EOS_DP_ALLOW_POST ) && ( !defined( 'FDP_ALLOW_POST' ) || false === FDP_ALLOW_POST ) ) 357 358 || 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/' ) ) 359 360 ){ 360 361 $option = 'eos_dp_by_rest_api'; … … 429 430 } 430 431 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'] ) ) ); 432 433 } 433 434 if( !defined( 'FDP_FORCE_DB_READING' ) || true !== FDP_FORCE_DB_READING ){ … … 581 582 } 582 583 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'] ) ); 584 585 $p = get_page( $eos_page_id ); 585 586 global $eos_page_id; … … 595 596 if( $eos_page_id || ( isset( $_REQUEST['test_id'] ) && isset( $_REQUEST['eos_dp_preview'] ) ) ){ 596 597 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'] ) ); 598 599 $eos_dp_paths = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) ); 599 600 delete_transient( $transient_name ); 600 601 } 601 602 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'] ) ); 603 604 $eos_dp_paths = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) ); 604 605 delete_transient( $transient_name ); 605 606 } 606 607 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'] ) ); 608 609 $cron = isset( $_REQUEST['internal_call'] ) && 'true' === $_REQUEST['internal_call'] ? 'cron_' : ''; 609 610 $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'] ) ) ); 612 613 $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 ){ 615 616 delete_transient( $transient_name ); 616 617 } … … 618 619 } 619 620 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'] ) ); 621 622 $eos_dp_paths = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) ); 622 623 delete_transient( $transient_name ); … … 830 831 $remove = false; 831 832 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 ) ) ) { 833 834 $remove = true; 834 835 break; … … 916 917 */ 917 918 function 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'] ) ) ); 920 921 $disabled = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) ); 921 922 delete_transient( $transient_name ); 922 923 } 923 924 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'] ) ); 925 926 $disabled = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) ); 926 927 delete_transient( $transient_name ); 927 928 } 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'] ) ); 930 931 $cron = isset( $_REQUEST['internal_call'] ) && 'true' === $_REQUEST['internal_call'] ? 'cron_' : ''; 931 932 $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'] ) ) ); 934 935 $disabled = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) ); 935 936 delete_transient( $transient_name ); … … 952 953 */ 953 954 function 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'] ) ); 959 960 } 960 961 return 0; … … 1031 1032 * 1032 1033 */ 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; 1034 1035 } ); 1035 1036 add_action( 'muplugins_loaded',function() { … … 1046 1047 $adminTheme = eos_dp_get_option( 'eos_dp_admin_theme' ); 1047 1048 $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 ); 1049 1052 $admin_post_type = eos_dp_get_post_type_from_request(); 1050 1053 if( $admin_post_type ){ … … 1054 1057 eos_dp_disable_theme(); 1055 1058 } 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'] ) )] ) { 1057 1060 eos_dp_disable_theme(); 1058 1061 } … … 1093 1096 } 1094 1097 } 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_' ) ){ 1096 1099 $disable_on_fdp_pageA = array( 1097 1100 'query-monitor/query-monitor.php', … … 1140 1143 if( !defined( 'EOS_ADMIN_'.$const.'_ACTIVE' ) ) define( 'EOS_ADMIN_'.$const.'_ACTIVE','true' ); 1141 1144 } 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'] ) ){ 1143 1146 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; 1145 1148 } ); 1146 $GLOBALS['eos_dp_all_plugins'] = array_filter( $all_plugins );1149 $GLOBALS['eos_dp_all_plugins'] = eos_dp_existing_plugin_paths( $all_plugins ); 1147 1150 register_shutdown_function( 'eos_dp_display_usage' ); 1148 1151 if( isset( $_REQUEST['eos_dp_debug'] ) ){ … … 1151 1154 } 1152 1155 } 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'] ) ) ); 1154 1157 $disabled_plugins = explode( ';pn:',esc_attr( get_transient( $transient_name ) ) ); 1155 1158 delete_transient( $transient_name ); … … 1184 1187 return $plugins; 1185 1188 } 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' ) ); 1189 1194 } 1190 1195 $admin_page = false !== strpos( $base_url,'.php' ) ? admin_url( $base_url ) : admin_url( 'admin.php'.$base_url ); … … 1212 1217 } 1213 1218 if( !$from_admin_url ){ 1214 $urlArr = parse_url( $base_url );1219 $urlArr = wp_parse_url( $base_url ); 1215 1220 if( isset( $urlArr['path'] ) && 'edit.php' === sanitize_text_field( $urlArr['path'] ) && isset( $urlArr['query'] ) ){ 1216 1221 if( isset( $urlArr['query'] ) && 'post_type=post' === $urlArr['query'] ){ … … 1218 1223 } 1219 1224 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'] ) ); 1221 1226 } 1222 1227 } … … 1231 1236 } 1232 1237 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'] ) )]; 1235 1240 } 1236 1241 else{ … … 1323 1328 } 1324 1329 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 ); 1326 1331 if( isset( $_REQUEST['eos_dp_debug'] ) ){ 1327 1332 if( 'no_error' === $_REQUEST['eos_dp_debug'] ){ … … 1335 1340 } 1336 1341 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; 1338 1343 } ); 1339 1344 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 ) ); 1341 1347 if( isset( $themeA[1] ) ){ 1342 1348 $themeA = explode( '&',$themeA[1] ); … … 1359 1365 } 1360 1366 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 ) ) ) ) ){ 1362 1368 $GLOBALS['eos_dp_user_can_preview'] = true; 1363 1369 add_action( 'wp_footer','eos_dp_print_disabled_plugins',9999 ); … … 1449 1455 * 1450 1456 */ 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 */ 1464 function 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 1451 1484 function eos_dp_filter_paths( $eos_dp_paths,$plugins ){ 1452 1485 $eos_dp_paths = eos_dp_prevent_disabling_wrong_plugins( $eos_dp_paths ); 1453 1486 $e = 0; 1454 1487 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' ) ) ){ 1456 1489 unset( $eos_dp_paths[array_search( 'woocommerce/woocommerce.php',$eos_dp_paths )] ); 1457 1490 } … … 1597 1630 } 1598 1631 } 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; 1601 1634 if( $nonce ){ 1602 1635 if( 1000*absint( time()/1000 ) === absint( $nonce ) ){ … … 1609 1642 echo '<p>Log out, log in, and try again.</p>'; 1610 1643 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>'; 1612 1645 } 1613 1646 else{ … … 1652 1685 'queries' => array( 'Number of database queries','Q',$wpdb->num_queries ), 1653 1686 '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' ), 1655 1688 '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 ).'%' ) ) 1656 1689 ); … … 1668 1701 } 1669 1702 } 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]'; 1676 1709 } 1677 1710 } … … 1770 1803 'queries' => sprintf( 'Queries: %s',$wpdb->num_queries ), 1771 1804 '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' ), 1773 1806 'memory' => sprintf( 'Memory Usage: %s %s (%s)',round( $memory_usage, $precision ),'M',round( 100*$memory_usage/absint( ini_get( 'memory_limit' ) ),1 ).'%' ) 1774 1807 ); … … 1885 1918 function eos_dp_is_mobile() { 1886 1919 if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) return false; 1887 if ( strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT']) ),'mobile' ) !== false1888 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT']) ),'android' ) !== false1889 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT']) ),'silk/' ) !== false1890 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT']) ),'kindle' ) !== false1891 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT']) ),'blackBerry' ) !== false1892 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT']) ),'opera mini' ) !== false1893 || strpos( strtolower( sanitize_text_field( $_SERVER['HTTP_USER_AGENT']) ),'opera mobi' ) !== false1920 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 1894 1927 ) { 1895 1928 return true; … … 1999 2032 $GLOBALS['eos_dp_paths'] = $disabled_on_search; 2000 2033 } 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'] ) ) ) ) ){ 2002 2035 $GLOBALS['eos_dp_user_can_preview'] = true; 2003 2036 add_action( 'wp_footer','eos_dp_print_disabled_plugins',9999 ); … … 2011 2044 $action = false; 2012 2045 if( isset( $_REQUEST['action'] ) ){ 2013 $action = sanitize_text_field( $_REQUEST['action']);2046 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); 2014 2047 } 2015 2048 elseif( isset( $_REQUEST['wc-ajax'] ) ){ 2016 $action = sanitize_text_field( $_REQUEST['wc-ajax']);2049 $action = sanitize_text_field( wp_unslash( $_REQUEST['wc-ajax'] ) ); 2017 2050 } 2018 2051 if( $action && false !== strpos( $action,'eos_dp_' ) ){ … … 2056 2089 $action = false; 2057 2090 if( isset( $_REQUEST['action'] ) ){ 2058 $action = sanitize_text_field( $_REQUEST['action']);2091 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); 2059 2092 } 2060 2093 elseif( isset( $_REQUEST['wc-ajax'] ) ){ 2061 $action = sanitize_text_field( $_REQUEST['wc-ajax']);2094 $action = sanitize_text_field( wp_unslash( $_REQUEST['wc-ajax'] ) ); 2062 2095 } 2063 2096 if( $action && is_array( $plugins_actions ) && in_array( $action,array_keys( $plugins_actions ) ) && isset( $plugins_actions[$action] ) ){ … … 2113 2146 $disabled_on_ajax = eos_dp_disabled_plugins_on_ajax(); 2114 2147 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_' ) ){ 2116 2149 if( in_array( 'freesoul-deactivate-plugins/freesoul-deactivate-plugins.php',$disabled_on_ajax ) ){ 2117 2150 unset( $disabled_on_ajax[array_search( 'freesoul-deactivate-plugins/freesoul-deactivate-plugins.php',$disabled_on_ajax )] ); … … 2149 2182 $action = false; 2150 2183 if( isset( $_REQUEST['action'] ) ){ 2151 $action = sanitize_text_field( $_REQUEST['action']);2184 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); 2152 2185 } 2153 2186 elseif( isset( $_REQUEST['wc-ajax'] ) ) { 2154 $action = sanitize_text_field( $_REQUEST['wc-ajax']);2187 $action = sanitize_text_field( wp_unslash( $_REQUEST['wc-ajax'] ) ); 2155 2188 } 2156 2189 if( ! $action ){ … … 2215 2248 $action = false; 2216 2249 if( isset( $_REQUEST['action'] ) ){ 2217 $action = sanitize_text_field( $_REQUEST['action']);2250 $action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); 2218 2251 } 2219 2252 elseif( isset( $_REQUEST['wc-ajax'] ) ){ 2220 $action = sanitize_text_field( $_REQUEST['wc-ajax']);2253 $action = sanitize_text_field( wp_unslash( $_REQUEST['wc-ajax'] ) ); 2221 2254 } 2222 2255 if( ! $action ){ … … 2430 2463 $parts = explode( '/', trim( $page_path, '/' ) ); 2431 2464 $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 ); 2444 2477 foreach( (array) $pages as &$page ){ 2445 2478 if( $page->post_name !== basename( $page_path ) ){ … … 2459 2492 $foundid = 0; 2460 2493 $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'] ) ) : '' ); 2462 2495 foreach ( (array) $pages as $page ) { 2463 2496 $arr[] = isset( $page->post_parent_name ) ? $page->post_parent_name : $page->post_name; 2464 2497 } 2465 $requestA = explode( '/', sanitize_text_field( $_SERVER['REQUEST_URI'] ));2498 $requestA = explode( '/', isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '' ); 2466 2499 if( isset( $requestA[1] ) ){ 2467 2500 $arr[] = $requestA[1]; … … 2494 2527 */ 2495 2528 function 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_' ) ){ 2497 2530 unset( $plugins[array_search( 'woocommerce/woocommerce.php',$plugins)] ); 2498 2531 } … … 2635 2668 */ 2636 2669 function 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'] ) ){ 2638 2671 return true; 2639 2672 } … … 3068 3101 function eos_dp_is_maybe_ajax(){ 3069 3102 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'] ) ) ) ){ 3071 3104 return true; 3072 3105 } … … 3171 3204 $n = $eos_dp_paths ? count( array_unique( array_filter( $eos_dp_paths ) ) ) : 'none'; 3172 3205 $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' ) ); 3174 3207 }, 100 ); 3175 3208 … … 3203 3236 ); 3204 3237 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'] ) ); 3206 3239 } 3207 3240 set_site_transient( 'fdp_plugin_disabledd_fatal_error',$arr,60*60*2 ); … … 3673 3706 */ 3674 3707 function 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']; 3677 3710 if( $post && is_object( $post ) ) { 3678 3711 $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 === 2 2 3 3 Contributors: giuse 4 Requires at least: 4. 64 Requires at least: 4.9 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 2.8. 07 Stable tag: 2.8.2 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 221 221 == Changelog == 222 222 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. 228 225 229 226 *<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 56 56 $dirPath = $upload_dirs['basedir'] . '/FDP/fdp-single-options'; 57 57 if ( 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'; 78 60 } 79 rmdir( $dirPath ); 61 if ( WP_Filesystem() ) { 62 global $wp_filesystem; 63 $wp_filesystem->rmdir( $dirPath, true ); 64 } 80 65 } 81 66 delete_metadata( 'user', 0, 'fdp_toplevel_admin_menu', '', true );
Note:
See TracChangeset
for help on using the changeset viewer.