Changeset 2502985
- Timestamp:
- 03/25/2021 02:52:15 AM (5 years ago)
- Location:
- plugin-optimizer
- Files:
-
- 69 added
- 7 edited
-
tags/1.0.4 (added)
-
tags/1.0.4/README.txt (added)
-
tags/1.0.4/admin (added)
-
tags/1.0.4/admin/class-po-admin-ajax.php (added)
-
tags/1.0.4/admin/class-po-admin-helper.php (added)
-
tags/1.0.4/admin/class-po-admin-pages.php (added)
-
tags/1.0.4/admin/class-po-admin.php (added)
-
tags/1.0.4/admin/css (added)
-
tags/1.0.4/admin/css/po-admin-public.css (added)
-
tags/1.0.4/admin/css/po-admin.css (added)
-
tags/1.0.4/admin/img (added)
-
tags/1.0.4/admin/img/check_mark.png (added)
-
tags/1.0.4/admin/img/noimage.png (added)
-
tags/1.0.4/admin/index.php (added)
-
tags/1.0.4/admin/js (added)
-
tags/1.0.4/admin/js/po-admin-menu-fix.js (added)
-
tags/1.0.4/admin/js/po-admin-menu-get.js (added)
-
tags/1.0.4/admin/js/po-admin.js (added)
-
tags/1.0.4/admin/pages (added)
-
tags/1.0.4/admin/pages/page-categories-edit.php (added)
-
tags/1.0.4/admin/pages/page-categories-list.php (added)
-
tags/1.0.4/admin/pages/page-filters-edit.php (added)
-
tags/1.0.4/admin/pages/page-filters-list.php (added)
-
tags/1.0.4/admin/pages/page-groups-edit.php (added)
-
tags/1.0.4/admin/pages/page-groups-list.php (added)
-
tags/1.0.4/admin/pages/page-overview-content.php (added)
-
tags/1.0.4/admin/pages/page-overview.php (added)
-
tags/1.0.4/admin/pages/page-settings.php (added)
-
tags/1.0.4/admin/pages/page-support.php (added)
-
tags/1.0.4/admin/pages/page-worklist.php (added)
-
tags/1.0.4/includes (added)
-
tags/1.0.4/includes/class-po-activator.php (added)
-
tags/1.0.4/includes/class-po-deactivator.php (added)
-
tags/1.0.4/includes/class-po-i18n.php (added)
-
tags/1.0.4/includes/class-po-loader.php (added)
-
tags/1.0.4/includes/class-po-mu.php (added)
-
tags/1.0.4/includes/class-po-woocommerce.php (added)
-
tags/1.0.4/includes/class-po.php (added)
-
tags/1.0.4/includes/index.php (added)
-
tags/1.0.4/index.php (added)
-
tags/1.0.4/languages (added)
-
tags/1.0.4/languages/plugin-optimizer.pot (added)
-
tags/1.0.4/licence.txt (added)
-
tags/1.0.4/plugin-optimizer.php (added)
-
tags/1.0.4/uninstall.php (added)
-
tags/1.0.4/vendor (added)
-
tags/1.0.4/vendor/appsero (added)
-
tags/1.0.4/vendor/appsero/client (added)
-
tags/1.0.4/vendor/appsero/client/.gitignore (added)
-
tags/1.0.4/vendor/appsero/client/composer.json (added)
-
tags/1.0.4/vendor/appsero/client/readme.md (added)
-
tags/1.0.4/vendor/appsero/client/src (added)
-
tags/1.0.4/vendor/appsero/client/src/Client.php (added)
-
tags/1.0.4/vendor/appsero/client/src/Insights.php (added)
-
tags/1.0.4/vendor/appsero/client/src/License.php (added)
-
tags/1.0.4/vendor/appsero/client/src/Updater.php (added)
-
tags/1.0.4/vendor/autoload.php (added)
-
tags/1.0.4/vendor/composer (added)
-
tags/1.0.4/vendor/composer/ClassLoader.php (added)
-
tags/1.0.4/vendor/composer/InstalledVersions.php (added)
-
tags/1.0.4/vendor/composer/LICENSE (added)
-
tags/1.0.4/vendor/composer/autoload_classmap.php (added)
-
tags/1.0.4/vendor/composer/autoload_namespaces.php (added)
-
tags/1.0.4/vendor/composer/autoload_psr4.php (added)
-
tags/1.0.4/vendor/composer/autoload_real.php (added)
-
tags/1.0.4/vendor/composer/autoload_static.php (added)
-
tags/1.0.4/vendor/composer/installed.json (added)
-
tags/1.0.4/vendor/composer/installed.php (added)
-
tags/1.0.4/vendor/composer/platform_check.php (added)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/admin/class-po-admin-helper.php (modified) (3 diffs)
-
trunk/admin/class-po-admin-pages.php (modified) (1 diff)
-
trunk/admin/js/po-admin-menu-get.js (modified) (1 diff)
-
trunk/includes/class-po-mu.php (modified) (19 diffs)
-
trunk/includes/class-po.php (modified) (1 diff)
-
trunk/plugin-optimizer.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
plugin-optimizer/trunk/README.txt
r2501831 r2502985 4 4 Requires at least: 5.0 5 5 Tested up to: 5.7 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 15 15 == Plugin Optimizer for WordPress == 16 16 17 Tired of WordPress bogging down everytime you load a page? 17 Speed up WordPress by only loading the Plugins you need in each page. 18 18 19 Are you losing time and money waiting for pages to load? 19 https://youtu.be/_s5p9mor5AU 20 20 21 Have you tried all the caching plugins but are still having issues? 21 Optimizing your WordPress site with [Plugin Optimizer](https://pluginoptimizer.com/?utm_source=po-lite&utm_campaign=wp-repo&utm_medium=readme&utm_term=pluginoptimizer) is easy and can reduce load times as much as 90%. 22 22 23 You don't need to anymore.23 Faster page load, faster wp-admin, and faster page editing. 24 24 25 Meet [Plugin Optimizer](https://pluginoptimizer.com/?utm_source=po-lite&utm_campaign=wp-repo&utm_medium=readme&utm_term=pluginoptimizer): The most innovative and affordable way to speed up your WordPress site for you, your team, and your subscribers. It makes the process easy and intuitive to remove all your load time problems. 25 Speed up your site today with by only loading the plugin code needed for any particular page. 26 27 Plugin Optimizer works completely different than any other Page Speed / Site Speed plugin or tool. 28 29 Plugin Optimizer does not affect minifying, cache, image load/size or scripts. It works by filtering the plugins and only allowing the necessary plugins for each page to load. 30 31 Once installed and configured you will see an instant boost in any optimized page. 32 33 Speed up the back-end development environment and speed up the front-end user experience. 34 35 == Features == 36 37 * Page size reduction by stripping code from unneeded plugins on each optimized page 38 * Step-by-Step Wizard for creating Filters, Groups, and Categories 39 * Custom filters for maximizing user experience 40 * Boost speed for both backend and frontend pages 41 * Speed up editing of content 42 * Instant page speed boost on optimized pages 43 * Reduction in server load - get great results with even basic shared server accounts 44 * Works great in combination with a cache plugin (e.g. WP Rocket, WP Fastest Cache, W3 Total Cache), a hosting company that offers packages with server-level caching available (e.g. WordKeeper) or a service like Cloudflare that has page caching enabled. 26 45 27 46 == Installation == … … 33 52 == Changelog == 34 53 35 = 1.0.0 = 54 = 1.0.4 = March 2021 55 * Auto Menu Update Fixed 56 * Overview and walkthrough added 57 * Other minor tweeks to the code 58 59 = 1.0.3 = March 2021 36 60 * Initial Deployment. 37 61 38 62 ## Privacy Policy 39 40 63 Plugin Optimizer uses [Appsero](https://appsero.com) SDK to collect some telemetry data upon user's confirmation. This helps us to troubleshoot problems faster & make product improvements. 41 64 Appsero SDK **does not gather any data by default.** The SDK only starts gathering basic telemetry data **when a user allows it via the admin notice**. We collect the data to ensure a great user experience for all our users. -
plugin-optimizer/trunk/admin/class-po-admin-helper.php
r2501831 r2502985 221 221 } 222 222 223 // Jake's note: implode failing on empty array; 224 if( $categories = get_post_meta( $filter->ID, 'categories', true ) ){ 225 226 if (!empty($categories)){ 227 228 $categories = implode( ',<br>', $categories ); 229 } 230 } 223 $categories = get_post_meta( $filter->ID, 'categories', true ); 224 $categories = ! empty( $categories ) ? implode( ',<br>', $categories ) : ""; 225 231 226 232 227 $date = date("Ym", strtotime( $filter->post_date ) );// 202109 … … 373 368 foreach ( $active_plugins as $plugin_id ) { 374 369 375 if( $plugin_id != "plugin-optimizer/plugin-optimizer.php"|| ! $remove_po ){370 if( ! in_array( $plugin_id, sospo_mu_plugin()->po_plugins ) || ! $remove_po ){ 376 371 $plugins_simple_list["active"][ $plugin_id ] = $all_plugins[ $plugin_id ][ 'Name' ]; 377 372 $plugins_simple_list["all"][ $plugin_id ] = $all_plugins[ $plugin_id ][ 'Name' ]; … … 389 384 foreach ( $all_plugins as $plugin_id => $plugin_data ) { 390 385 391 if( $plugin_id != "plugin-optimizer/plugin-optimizer.php"|| ! $remove_po ){386 if( ! in_array( $plugin_id, sospo_mu_plugin()->po_plugins ) || ! $remove_po ){ 392 387 $plugins_simple_list["inactive"][ $plugin_id ] = $all_plugins[ $plugin_id ][ 'Name' ]; 393 388 $plugins_simple_list["all"][ $plugin_id ] = $all_plugins[ $plugin_id ][ 'Name' ]; -
plugin-optimizer/trunk/admin/class-po-admin-pages.php
r2501831 r2502985 21 21 22 22 // add_menu_page( 'Plugin Optimizer', 'Plugin Optimizer', 'manage_options', 'plugin_optimizer', [ $this, 'render_overview_page' ], 'dashicons-sos' ); 23 add_menu_page( 'Plugin Optimizer', 'Plugin Optimizer', 'manage_options', 'plugin_optimizer', [ $this, 'render_filters_page' ], 'dashicons-sos' );24 25 23 // add_submenu_page( 'plugin_optimizer', 'Overview', 'Overview', 'manage_options', 'plugin_optimizer', [ $this, 'render_overview_page' ] ); 26 24 // add_submenu_page( 'plugin_optimizer', 'Filters', 'Filters', 'manage_options', 'plugin_optimizer_filters', [ $this, 'render_filters_page' ] ); 25 26 add_menu_page( 'Plugin Optimizer', 'Plugin Optimizer', 'manage_options', 'plugin_optimizer', [ $this, 'render_filters_page' ], 'dashicons-sos' ); 27 27 add_submenu_page( 'plugin_optimizer', 'Filters', 'Filters', 'manage_options', 'plugin_optimizer', [ $this, 'render_filters_page' ] ); 28 29 // and plugin-optimizer\admin\js\po-admin.js 30 28 31 add_submenu_page( 'plugin_optimizer', 'Filter', 'Create Filter', 'manage_options', 'plugin_optimizer_add_filters', [ $this, 'render_add_filters_page' ] ); 29 32 add_submenu_page( 'plugin_optimizer', 'Groups', 'Groups', 'manage_options', 'plugin_optimizer_groups', [ $this, 'render_groups_page' ] ); -
plugin-optimizer/trunk/admin/js/po-admin-menu-get.js
r2501831 r2502985 45 45 let new_html = $('#wp-admin-bar-new-content-default').html(); 46 46 47 // form the data object for sending 48 let data = { 49 action : 'po_save_original_menu', 50 menu_html : menu_html, 51 topbar_menu_html : topbar_menu_html, 52 new_html : new_html 53 }; 47 54 48 55 // save the menu in wp_options 49 $.post( po_object.ajax_url, { action : 'po_save_original_menu', menu_html : menu_html, topbar_menu_html : topbar_menu_html, new_html : new_html }, function( response ) {56 $.post( po_object.ajax_url, data, function( response ) { 50 57 51 58 $('#po_please_wait_message').html('Refreshing...'); 52 59 53 if( po_object.redirect_to ){ 54 55 console.log( "Redirecting to the original page..." ); 56 window.location.href = po_object.redirect_to; 57 } 60 window.location.href = po_object.redirect_to ? po_object.redirect_to : window.location.href; 58 61 59 62 }, "json"); -
plugin-optimizer/trunk/includes/class-po-mu.php
r2501831 r2502985 4 4 * Plugin URI: https://pluginoptimizer.com 5 5 * Description: This MU plugin is required by the Plugin Optimizer plugin. It will be removed upon deactivation. 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: pluginoptimizer 8 8 * Author URI: https://pluginoptimizer.com/about/ … … 15 15 protected static $instance = null; 16 16 17 public $po_plugins = []; 17 18 protected $po_pages = []; 18 19 protected $po_post_types = []; … … 29 30 public $filters_in_use = []; 30 31 31 private function __construct() {32 private function __construct() { 32 33 33 34 if( wp_doing_ajax() || wp_doing_cron() ){ … … 35 36 } 36 37 38 $this->po_plugins = [ 39 "plugin-optimizer/plugin-optimizer.php", 40 "sos_plugin_optimizer_dictionary_age/sos_plugin_optimizer_dictionary_age.php", 41 "sos_plugin_optimizer_premium/sos_plugin_optimizer_premium.php", 42 ]; 37 43 $this->po_pages = [ 38 44 "/wp-admin/admin.php?page=plugin_optimizer", … … 46 52 "/wp-admin/admin.php?page=plugin_optimizer_settings", 47 53 "/wp-admin/admin.php?page=plugin_optimizer_support", 54 "/wp-admin/admin.php?page=plugin_optimizer_agent", 55 "/wp-admin/admin.php?page=plugin_optimizer_pending", 56 "/wp-admin/admin.php?page=plugin_optimizer_approved" 48 57 ]; 49 58 $this->po_post_types = [ … … 55 64 $this->set_hooks(); 56 65 57 }66 } 58 67 59 68 static function get_instance() { … … 65 74 return self::$instance; 66 75 67 }68 69 70 function set_hooks() {71 72 add_filter( 'option_active_plugins', [ $this, 'filter_active_plugins_option_value' ], 5 );73 74 add_action( 'plugins_loaded', [ $this, 'complete_action_once_plugins_are_loaded' ], 5 );75 76 add_action( 'shutdown', [ $this, 'update_worklist_if_needed' ] );77 78 }79 80 function complete_action_once_plugins_are_loaded(){81 82 remove_filter('option_active_plugins', [ $this, 'filter_active_plugins_option_value' ], 5 );83 84 }85 86 87 function filter_active_plugins_option_value( $active_plugins ) {76 } 77 78 79 function set_hooks() { 80 81 add_filter( 'option_active_plugins', [ $this, 'filter_active_plugins_option_value' ], 5 ); 82 83 add_action( 'plugins_loaded', [ $this, 'complete_action_once_plugins_are_loaded' ], 5 ); 84 85 add_action( 'shutdown', [ $this, 'update_worklist_if_needed' ] ); 86 87 } 88 89 function complete_action_once_plugins_are_loaded(){ 90 91 remove_filter('option_active_plugins', [ $this, 'filter_active_plugins_option_value' ], 5 ); 92 93 } 94 95 96 function filter_active_plugins_option_value( $active_plugins ) { 88 97 89 98 if( ! empty( $this->all_plugins ) ){ … … 91 100 } 92 101 93 require_once ABSPATH . 'wp-admin/includes/plugin.php';102 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 94 103 95 104 remove_filter('option_active_plugins', [ $this, 'filter_active_plugins_option_value' ], 5 ); … … 98 107 99 108 $this->original_active_plugins = $active_plugins; 100 101 $this->plugins_to_block = $this->get_plugins_to_block_for_current_url(); 109 110 $active_plugins_on_menu_save = get_option( "active_plugins_on_menu_save" ); 111 112 if( $active_plugins_on_menu_save != $active_plugins ){ 113 114 // this will trigger the script that recreates the menu: 115 update_option( "active_plugins_on_menu_save", $active_plugins ); 116 $_GET["po_original_menu"] = "get"; 117 118 } 119 120 $this->plugins_to_block = $this->get_plugins_to_block_for_current_url(); 102 121 103 122 $this->filtered_active_plugins = array_diff( $this->original_active_plugins, $this->plugins_to_block ); … … 105 124 $this->blocked_plugins = array_intersect( $this->original_active_plugins, $this->plugins_to_block ); 106 125 107 sospo_mu_plugin()->write_log( $this->filtered_active_plugins, "filter_active_plugins_option_value-filtered_active_plugins" ); 108 109 return $this->filtered_active_plugins; 110 111 } 112 113 function should_skip_url( $url ) { 126 return $this->filtered_active_plugins; 127 } 128 129 function should_skip_url( $url ) { 114 130 115 131 $skip = [ … … 130 146 131 147 return false; 132 }133 134 function get_plugins_to_block_for_current_url() {135 136 $relative_url = trim( $_SERVER["REQUEST_URI"] );137 $current_url = get_home_url() . $relative_url;148 } 149 150 function get_plugins_to_block_for_current_url() { 151 152 $relative_url = trim( $_SERVER["REQUEST_URI"] ); 153 $current_url = get_home_url() . $relative_url; 138 154 139 155 // some URLs just need to be skipped … … 162 178 $this->is_po_default_page = true; 163 179 $this->is_being_filtered = true; 164 $this->plugins_to_block = array_diff( $this->original_active_plugins, [ "plugin-optimizer/plugin-optimizer.php" ]);180 $this->plugins_to_block = array_diff( $this->original_active_plugins, $this->po_plugins ); 165 181 166 182 return $this->plugins_to_block; … … 169 185 // --- Get plugins to block from all the filters 170 186 171 $filters = get_posts([172 'post_type' => 'sos_filter',173 'numberposts' => - 1,174 ]);175 176 foreach( $filters as $filter ){187 $filters = get_posts([ 188 'post_type' => 'sos_filter', 189 'numberposts' => - 1, 190 ]); 191 192 foreach( $filters as $filter ){ 177 193 178 194 if( $filter->turned_off ){ … … 183 199 // If we're on the edit post screen, filter by post type 184 200 185 if( $filter->type_filter !== '_endpoint' && $editing_post_type && $editing_post_type == $filter->type_filter ){186 187 $this->use_filter( $filter );201 if( $filter->type_filter !== '_endpoint' && $editing_post_type && $editing_post_type == $filter->type_filter ){ 202 203 $this->use_filter( $filter ); 188 204 189 205 continue; 190 }206 } 191 207 192 208 // Filter by URL … … 213 229 } 214 230 215 }216 217 return array_unique( $this->plugins_to_block );218 }231 } 232 233 return array_unique( $this->plugins_to_block ); 234 } 219 235 220 236 function use_filter( $filter ){ … … 250 266 251 267 252 function is_editing_post_type( $url ){268 function is_editing_post_type( $url ){ 253 269 254 270 $post_id = $this->url_to_postid( $url ); … … 262 278 return $post_type; 263 279 264 }265 266 function url_to_postid( $url ){280 } 281 282 function url_to_postid( $url ){ 267 283 268 284 parse_str( parse_url( $url, PHP_URL_QUERY ), $query_vars); … … 273 289 return $post_id; 274 290 275 }291 } 276 292 277 293 function write_log( $log, $text = "write_log: ", $file_name = "debug.log" ) { … … 312 328 313 329 function sospo_mu_plugin(){ 314 return SOSPO_MU::get_instance();330 return SOSPO_MU::get_instance(); 315 331 } 316 332 sospo_mu_plugin(); -
plugin-optimizer/trunk/includes/class-po.php
r2501831 r2502985 44 44 $this->version = SOSPO_VERSION; 45 45 } else { 46 $this->version = '1.0. 3';46 $this->version = '1.0.4'; 47 47 } 48 48 $this->plugin_name = 'plugin-optimizer'; -
plugin-optimizer/trunk/plugin-optimizer.php
r2501831 r2502985 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.0. 37 * Version: 1.0.4 8 8 * Author: Plugin Optimizer 9 9 * Author URI: https://pluginoptimizer.com/about/ … … 41 41 * Use SemVer - https://semver.org 42 42 */ 43 define( 'SOSPO_VERSION', '1.0. 3' );43 define( 'SOSPO_VERSION', '1.0.4' ); 44 44 45 45 /** … … 64 64 register_deactivation_hook( __FILE__, 'deactivate_plugin_optimizer' ); 65 65 66 // TODO - let's copy the file there if it's missing66 // let's install the MU plugin if it's missing and refresh 67 67 if( ! file_exists( WPMU_PLUGIN_DIR . '/class-po-mu.php') ){ 68 68 69 // TODO should we add the MU plugin at this point? 70 // copy( __DIR__ . '/class-po-mu.php', WPMU_PLUGIN_DIR . '/class-po-mu.php' ); 69 if( ! file_exists( WPMU_PLUGIN_DIR ) ){ 70 71 mkdir( WPMU_PLUGIN_DIR ); 72 chmod( WPMU_PLUGIN_DIR, 0755 ); 73 } 74 75 copy( __DIR__ . '/includes/class-po-mu.php', WPMU_PLUGIN_DIR . '/class-po-mu.php' ); 76 77 header("Refresh:0"); 71 78 72 79 return;
Note: See TracChangeset
for help on using the changeset viewer.