Changeset 2678714
- Timestamp:
- 02/14/2022 10:09:36 PM (4 years ago)
- Location:
- plugin-optimizer/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (1 diff)
-
includes/class-po-mu.php (modified) (9 diffs)
-
plugin-optimizer.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
plugin-optimizer/trunk/README.txt
r2652772 r2678714 4 4 Requires at least: 5.0 5 5 Tested up to: 5.7 6 Stable tag: 1.2. 16 Stable tag: 1.2.0 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later -
plugin-optimizer/trunk/includes/class-po-mu.php
r2652772 r2678714 202 202 function filter_active_plugins_option_value( $active_plugins ) { 203 203 204 /*205 */206 204 if( ! empty( $this->all_plugins ) ){ 207 205 return $active_plugins; … … 216 214 $this->original_active_plugins = $active_plugins; 217 215 218 if( in_array( "plugin-optimizer-premium/plugin-optimizer-premium.php", $this->original_active_plugins ) ){219 220 $this->has_premium = true;221 }222 223 //if( in_array( "plugin-optimizer-agent/plugin-optimizer-agent.php", $this->original_active_plugins ) ){224 if( is_plugin_active("plugin-optimizer-agent/plugin-optimizer-agent.php") ){225 226 $this->has_agent = true;227 }228 229 216 $active_plugins_on_menu_save = get_option( "active_plugins_on_menu_save" ); 230 217 … … 243 230 $this->blocked_plugins = array_intersect( $this->original_active_plugins, $this->plugins_to_block ); 244 231 245 246 //return $this->filtered_active_plugins; 247 return $active_plugins; 248 } 249 250 function update_worklist_if_needed(){ 251 252 if( $this->is_skipped === false && $this->is_being_filtered === false && ! $this->is_po_default_page ){ /* not doing anything */ 253 254 if( ! is_admin() ){ 255 256 257 // TODO we need to add endpoints to the Worklist here 258 259 } 260 261 // $this->write_log( ( is_admin() ? "Back end" : "Front end" ) . ": " . var_export( trim( $this->current_wp_relative_url ), true ), "update_worklist_if_needed-REQUEST_URI" ); 262 } 232 return $this->filtered_active_plugins; 263 233 } 264 234 … … 289 259 290 260 return false; 291 }292 293 function po_get_filters_exclude_premium(){294 global $wpdb;295 $main_query = "296 SELECT297 `p`.`ID`,298 `p`.`post_title`,299 (SELECT `meta_value` FROM {$wpdb->prefix}postmeta WHERE `meta_key` = 'endpoints' AND `post_id` = `p`.`ID`) as endpoints,300 (SELECT `meta_value` FROM {$wpdb->prefix}postmeta WHERE `meta_key` = 'filter_type' AND `post_id` = `p`.`ID`) as filter_type,301 (SELECT `meta_value` FROM {$wpdb->prefix}postmeta WHERE `meta_key` = 'dict_id' AND `post_id` = `p`.`ID`) as filter_id,302 (SELECT `meta_value` FROM {$wpdb->prefix}postmeta WHERE `meta_key` = 'plugins_to_block' AND `post_id` = `p`.`ID`) as plugins_to_block,303 (SELECT `meta_value` FROM {$wpdb->prefix}postmeta WHERE `meta_key` = 'belongs_to' AND `post_id` = `p`.`ID`) as belongsTo,304 (SELECT `user_email` FROM {$wpdb->prefix}users as u WHERE `u`.`ID` = `p`.`post_author`) as author305 FROM {$wpdb->prefix}posts as p306 JOIN {$wpdb->prefix}postmeta as pm307 ON pm.post_id = p.ID308 WHERE `p`.`post_type`='plgnoptmzr_filter'309 AND `p`.`post_status` = 'publish'310 AND `pm`.`meta_key` = 'premium_filter'311 AND `pm`.`meta_value` != 'true'312 ";313 $results = $wpdb->get_results($main_query);314 return $results;315 261 } 316 262 … … 328 274 (SELECT `user_email` FROM {$wpdb->prefix}users as u WHERE `u`.`ID` = `p`.`post_author`) as author 329 275 FROM {$wpdb->prefix}posts as p WHERE `post_type`='plgnoptmzr_filter' AND `post_status` = 'publish'"; 330 $results = $wpdb->get_results($main_query); 331 return $ results;276 277 return $wpdb->get_results($main_query); 332 278 } 333 279 … … 356 302 357 303 $block_plugins = array_diff( $this->original_active_plugins, $this->po_plugins ); 358 359 if( $this->has_premium ){ 360 361 $filters = $this->po_get_filters(); 362 363 } else { 364 365 $filters = $this->po_get_filters_exclude_premium(); 366 } 304 305 $filters = $this->po_get_filters(); 367 306 368 307 foreach( $filters as $filter ){ … … 452 391 453 392 // --- Get plugins to block from all the filters 454 if( $this->has_premium ){ 455 $filters = $this->po_get_filters(); 456 457 } else { 458 459 $filters = $this->po_get_filters_exclude_premium(); 460 } 393 $filters = $this->po_get_filters(); 461 394 462 395 foreach( $filters as $filter ){ … … 502 435 503 436 // Check if there's a path ex /blog or /about-us 504 if( !empty($parsed_endpoint['path']) && !empty($this->current_url_params)){437 if( !empty($parsed_endpoint['path']) ){ 505 438 506 439 // Compare the paths of current url and in the filter endpoint 507 440 if( $parsed_endpoint['path'] == $this->current_url_path ){ 508 441 509 510 442 // Are there query params? 511 if( isset($parsed_endpoint['query']) &&!empty($parsed_endpoint['query']) ){443 if( !empty($parsed_endpoint['query']) ){ 512 444 513 445 // convert endpoint params to array … … 556 488 557 489 return $this->plugins_to_block; 490 } 491 492 function update_worklist_if_needed(){ 493 494 if( $this->is_skipped === false && $this->is_being_filtered === false && ! $this->is_po_default_page ){ /* not doing anything */ 495 496 if( ! is_admin() ){ 497 498 499 // TODO we need to add endpoints to the Worklist here 500 501 } 502 503 // $this->write_log( ( is_admin() ? "Back end" : "Front end" ) . ": " . var_export( trim( $this->current_wp_relative_url ), true ), "update_worklist_if_needed-REQUEST_URI" ); 504 } 558 505 } 559 506 -
plugin-optimizer/trunk/plugin-optimizer.php
r2652772 r2678714 5 5 * Plugin URI: https://pluginoptimizer.com 6 6 * Description: The Most Powerful Performance Plugin for WordPress is now available for FREE. 7 * Version: 1.2. 17 * Version: 1.2.0 8 8 * Author: Plugin Optimizer 9 9 * Author URI: https://pluginoptimizer.com/about/
Note: See TracChangeset
for help on using the changeset viewer.