| @@ -2,9 +2,9 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | Plugin Name: WP-Optimize - Clean, Compress, Cache |
| 4 | 4 | Plugin URI: https://teamupdraft.com/wp-optimize |
| 5 | 5 | Description: WP-Optimize makes your site fast and efficient. It cleans the database, compresses images and caches pages. Fast sites attract more traffic and users. |
| 6 | -Version: 4.5.3 | |
| 6 | +Version: 4.7.0 | |
| 7 | 7 | Requires at least: 4.9 |
| 8 | 8 | Requires PHP: 7.2 |
| 9 | 9 | Update URI: https://wordpress.org/plugins/wp-optimize/ |
| 10 | 10 | Author: TeamUpdraft, DavidAnderson |
| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | if (!defined('ABSPATH')) die('No direct access allowed'); |
| 18 | 18 | |
| 19 | 19 | // Check to make sure if WP_Optimize is already call and returns. |
| 20 | 20 | if (!class_exists('WP_Optimize')) : |
| 21 | -define('WPO_VERSION', '4.5.3'); | |
| 21 | +define('WPO_VERSION', '4.7.0'); | |
| 22 | 22 | define('WPO_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 23 | 23 | define('WPO_PLUGIN_MAIN_PATH', plugin_dir_path(__FILE__)); |
| 24 | 24 | define('WPO_PLUGIN_SLUG', plugin_basename(__FILE__)); |
| 25 | 25 | define('WPO_PREMIUM_NOTIFICATION', false); |
| @@ -90,9 +90,8 @@ | ||
| 90 | 90 | WPO_Page_Optimizer::instance()->maybe_initialise(); |
| 91 | 91 | |
| 92 | 92 | $this->load_admin(); |
| 93 | 93 | add_action('admin_init', array($this, 'admin_init')); |
| 94 | - add_action('admin_bar_menu', array($this, 'cache_admin_bar'), 100, 1); | |
| 95 | 94 | |
| 96 | 95 | add_filter("plugin_action_links_".plugin_basename(__FILE__), array($this, 'plugin_settings_link')); |
| 97 | 96 | add_action('wpo_cron_event2', array($this, 'cron_action')); |
| 98 | 97 | add_filter('cron_schedules', array($this, 'cron_schedules')); |
| @@ -121,9 +120,9 @@ | ||
| 121 | 120 | * Add action for display Images > Compress images tab. |
| 122 | 121 | */ |
| 123 | 122 | add_action('wp_optimize_admin_page_wpo_images_smush', array($this, 'admin_page_wpo_images_smush')); |
| 124 | 123 | |
| 125 | - include_once(WPO_PLUGIN_MAIN_PATH.'includes/updraftcentral.php'); | |
| 124 | + include_once(WPO_PLUGIN_MAIN_PATH.'includes/updraftcentral/updraftcentral.php'); | |
| 126 | 125 | |
| 127 | 126 | include_once(WPO_PLUGIN_MAIN_PATH.'includes/backward-compatibility-functions.php'); |
| 128 | 127 | |
| 129 | 128 | register_shutdown_function(array($this, 'log_fatal_errors')); |
| @@ -221,9 +220,9 @@ | ||
| 221 | 220 | * Autoloads classes. |
| 222 | 221 | * |
| 223 | 222 | * @param string $class_name The name of the class. |
| 224 | 223 | */ |
| 225 | - private function loader($class_name) { | |
| 224 | + public function loader($class_name) { | |
| 226 | 225 | $dirs = $this->get_class_directories(); |
| 227 | 226 | |
| 228 | 227 | foreach ($dirs as $dir) { |
| 229 | 228 | $class_file = WPO_PLUGIN_MAIN_PATH . trailingslashit($dir) . 'class-' . str_replace('_', '-', strtolower($class_name)) . '.php'; |
| @@ -247,9 +246,9 @@ | ||
| 247 | 246 | require_once($class_file); |
| 248 | 247 | return; |
| 249 | 248 | } |
| 250 | 249 | } |
| 251 | - | |
| 250 | + | |
| 252 | 251 | if ('Minify_HTML' === $class_name) { |
| 253 | 252 | require_once WPO_PLUGIN_MAIN_PATH.'vendor/mrclay/minify/lib/Minify/HTML.php'; |
| 254 | 253 | } |
| 255 | 254 | } |
| @@ -265,12 +264,15 @@ | ||
| 265 | 264 | 'compatibility', |
| 266 | 265 | 'includes', |
| 267 | 266 | 'includes/tables', |
| 268 | 267 | 'includes/list-tables', |
| 268 | + 'includes/dashboard', | |
| 269 | 269 | 'includes/gravatars', |
| 270 | + 'includes/lcp', | |
| 270 | 271 | 'minify', |
| 271 | 272 | 'optimizations', |
| 272 | 273 | 'webp', |
| 274 | + 'includes/updraftcentral', | |
| 273 | 275 | ); |
| 274 | 276 | } |
| 275 | 277 | |
| 276 | 278 | /** |
| @@ -364,9 +366,9 @@ | ||
| 364 | 366 | |
| 365 | 367 | public function admin_page_wpo_images_smush() { |
| 366 | 368 | $options = Updraft_Smush_Manager()->get_smush_options(); |
| 367 | 369 | $custom = 90 >= $options['image_quality'] && 65 <= $options['image_quality']; |
| 368 | - $sites = WP_Optimize()->get_sites(); | |
| 370 | + $sites = $this->get_sites(); | |
| 369 | 371 | $compression_server_hint = Updraft_Smush_Manager()->get_compression_server_hint(); |
| 370 | 372 | $this->include_template('images/smush.php', false, array('smush_options' => $options, 'custom' => $custom, 'sites' => $sites, 'does_server_allow_local_webp_conversion' => $this->get_server_compatibility_instance()->does_server_allow_local_webp_conversion(), 'compression_server_hint' => $compression_server_hint)); |
| 371 | 373 | $this->add_smush_popup_template(); |
| 372 | 374 | } |
| @@ -385,13 +387,18 @@ | ||
| 385 | 387 | /** |
| 386 | 388 | * Adds 3rd party plugin compatibilities. |
| 387 | 389 | */ |
| 388 | 390 | public function load_compatibilities() { |
| 391 | + global $wp_version; | |
| 389 | 392 | |
| 390 | 393 | if (class_exists('Polylang')) { |
| 391 | 394 | WPO_Polylang_Compatibility::instance(); |
| 392 | 395 | } |
| 393 | 396 | |
| 397 | + if (version_compare($wp_version, '5.2', '<')) { | |
| 398 | + WPO_WP_Kses_Compatibility::instance(); | |
| 399 | + } | |
| 400 | + | |
| 394 | 401 | WPO_Page_Builder_Compatibility::instance(); |
| 395 | 402 | WPO_KD_Submissions_Compatibility::instance(); |
| 396 | 403 | |
| 397 | 404 | if (class_exists('Custom_Permalinks')) { |
| @@ -549,8 +556,17 @@ | ||
| 549 | 556 | wp_enqueue_style('wp-optimize-global', WPO_PLUGIN_URL.'css/wp-optimize-global'.$min_or_not_internal.'.css', array(), $enqueue_version); |
| 550 | 557 | |
| 551 | 558 | // load scripts and styles only on WP-Optimize pages. |
| 552 | 559 | if (!$this->is_wpo_page()) return; |
| 560 | + | |
| 561 | + wp_enqueue_script( 'jquery-ui-tooltip' ); | |
| 562 | + // Defeat other plugins/themes which dump their jQuery UI CSS onto our settings page | |
| 563 | + wp_deregister_style('jquery-ui'); | |
| 564 | + wp_enqueue_style('jquery-ui', WPO_PLUGIN_URL.'css/jquery-ui.custom' . $min_or_not_internal . '.css', array(), $enqueue_version); | |
| 565 | + | |
| 566 | + | |
| 567 | + wp_enqueue_script('select2', WPO_PLUGIN_URL . 'js/select2/select2' . $min_or_not . '.js', array('jquery'), $enqueue_version); | |
| 568 | + wp_enqueue_style('select2', WPO_PLUGIN_URL . 'css/select2/select2' . $min_or_not . '.css', array(), $enqueue_version); | |
| 553 | 569 | |
| 554 | 570 | wp_enqueue_script('jquery-serialize-json', WPO_PLUGIN_URL.'js/serialize-json/jquery.serializejson'.$min_or_not.'.js', array('jquery'), $enqueue_version); |
| 555 | 571 | |
| 556 | 572 | wp_register_script('updraft-queue-js', WPO_PLUGIN_URL.'js/queue'.$min_or_not_internal.'.js', array(), $enqueue_version); |
| @@ -568,9 +584,9 @@ | ||
| 568 | 584 | |
| 569 | 585 | $js_variables = $this->wpo_js_translations(); |
| 570 | 586 | $js_variables['loggers_classes_info'] = $this->get_loggers_classes_info(); |
| 571 | 587 | wp_localize_script('wp-optimize-admin-js', 'wpoptimize', $js_variables); |
| 572 | - | |
| 588 | + | |
| 573 | 589 | do_action('wpo_premium_scripts_styles', $min_or_not_internal, $min_or_not, $enqueue_version); |
| 574 | 590 | |
| 575 | 591 | $status_report_dependencies = array('wp-optimize-admin-js'); |
| 576 | 592 | |
| @@ -590,11 +606,11 @@ | ||
| 590 | 606 | * |
| 591 | 607 | * @return void |
| 592 | 608 | */ |
| 593 | 609 | public function frontend_enqueue_scripts() { |
| 594 | - if (!current_user_can('manage_options') || !is_admin_bar_showing()) return; | |
| 610 | + if (!$this->current_user_can('manage_options') || !is_admin_bar_showing()) return; | |
| 595 | 611 | $enqueue_version = $this->get_enqueue_version(); |
| 596 | - $min_or_not_internal = WP_Optimize()->get_min_or_not_internal_string(); | |
| 612 | + $min_or_not_internal = $this->get_min_or_not_internal_string(); | |
| 597 | 613 | |
| 598 | 614 | // Register or enqueue common scripts |
| 599 | 615 | wp_enqueue_style('wp-optimize-global', WPO_PLUGIN_URL.'css/wp-optimize-global'.$min_or_not_internal.'.css', array(), $enqueue_version); |
| 600 | 616 | } |
| @@ -691,9 +707,9 @@ | ||
| 691 | 707 | WPO_Deactivation::actions(); |
| 692 | 708 | return; |
| 693 | 709 | } |
| 694 | 710 | |
| 695 | - if (is_admin() && current_user_can($this->capability_required())) { | |
| 711 | + if (is_admin() && $this->current_user_can()) { | |
| 696 | 712 | WP_Optimize_Heartbeat::get_instance(); |
| 697 | 713 | } |
| 698 | 714 | |
| 699 | 715 | if ($this->get_server_compatibility_instance()->does_server_handle_cache()) { |
| @@ -718,9 +734,9 @@ | ||
| 718 | 734 | add_action('auto_option_settings', array($this->get_options(), 'auto_option_settings')); |
| 719 | 735 | } |
| 720 | 736 | |
| 721 | 737 | // load defaults |
| 722 | - WP_Optimize()->get_options()->set_default_options(); | |
| 738 | + $this->get_options()->set_default_options(); | |
| 723 | 739 | |
| 724 | 740 | // Initialize loggers. |
| 725 | 741 | add_action('init', array($this, 'setup_loggers')); |
| 726 | 742 | |
| @@ -911,9 +927,9 @@ | ||
| 911 | 927 | $pagenow = $GLOBALS['pagenow']; |
| 912 | 928 | |
| 913 | 929 | $this->register_template_directories(); |
| 914 | 930 | |
| 915 | - if (('index.php' === $pagenow && current_user_can('update_plugins')) || ('index.php' === $pagenow && defined('WP_OPTIMIZE_FORCE_DASHNOTICE') && WP_OPTIMIZE_FORCE_DASHNOTICE)) { | |
| 931 | + if (('index.php' === $pagenow && $this->current_user_can('update_plugins')) || ('index.php' === $pagenow && defined('WP_OPTIMIZE_FORCE_DASHNOTICE') && WP_OPTIMIZE_FORCE_DASHNOTICE)) { | |
| 916 | 932 | $options = $this->get_options(); |
| 917 | 933 | |
| 918 | 934 | $dismissed_until = $options->get_option('dismiss_dash_notice_until', 0); |
| 919 | 935 | |
| @@ -985,14 +1001,35 @@ | ||
| 985 | 1001 | * |
| 986 | 1002 | * @return string |
| 987 | 1003 | */ |
| 988 | 1004 | public function capability_required() { |
| 989 | - $capability = 'manage_options'; | |
| 1005 | + $capability = is_multisite() ? 'manage_network_options' : 'manage_options'; | |
| 1006 | + | |
| 990 | 1007 | $filtered_capability = apply_filters('wp_optimize_capability_required', $capability); |
| 1008 | + | |
| 991 | 1009 | return is_string($filtered_capability) ? $filtered_capability : $capability; |
| 992 | 1010 | } |
| 993 | 1011 | |
| 994 | 1012 | /** |
| 1013 | + * Check if the current user has a given capability. | |
| 1014 | + * If no capability is provided, it checks for the default capability required to access WP-Optimize. | |
| 1015 | + * | |
| 1016 | + * @param string|null $capability The capability to check. Null = use default. | |
| 1017 | + * @return bool | |
| 1018 | + */ | |
| 1019 | + public function current_user_can($capability = null) { | |
| 1020 | + if (null === $capability) { | |
| 1021 | + $capability = $this->capability_required(); // falls back to default | |
| 1022 | + } | |
| 1023 | + | |
| 1024 | + if (current_user_can($capability)) { | |
| 1025 | + return true; | |
| 1026 | + } | |
| 1027 | + | |
| 1028 | + return false; | |
| 1029 | + } | |
| 1030 | + | |
| 1031 | + /** | |
| 995 | 1032 | * Returns array of translations used in javascript code. |
| 996 | 1033 | * |
| 997 | 1034 | * @return array |
| 998 | 1035 | */ |
| @@ -1063,12 +1100,21 @@ | ||
| 1063 | 1100 | 'hide' => __('Hide', 'wp-optimize'), |
| 1064 | 1101 | 'please_wait' => __('Please wait a moment...', 'wp-optimize'), |
| 1065 | 1102 | 'clipboard_failed' => __('Copy to clipboard failed, please do it manually', 'wp-optimize'), |
| 1066 | 1103 | 'clipboard_success' => __('System status has been copied to the clipboard', 'wp-optimize'), |
| 1104 | + 'high_table_count_threshold' => WP_Optimizer::HIGH_TABLE_COUNT_THRESHOLD, | |
| 1105 | + // translators: 1: starting table count, 2: ending table count | |
| 1106 | + 'loading_tables_in_batches' => esc_html__('Loading tables %1$s to %2$s', 'wp-optimize'), | |
| 1107 | + // translators: %s time to finish | |
| 1108 | + 'time_left' => esc_html__('Aproximate time to finish: %s', 'wp-optimize'), | |
| 1109 | + 'done_reloading' => esc_html__('Done, reloading', 'wp-optimize'), | |
| 1067 | 1110 | 'show_information' => __('Show information', 'wp-optimize'), |
| 1068 | 1111 | 'hide_information' => __('Hide information', 'wp-optimize'), |
| 1069 | 1112 | 'data_not_available' => __('Not available', 'wp-optimize'), |
| 1070 | - 'something_wrong_try_again' => __('Something went wrong; please try again.', 'wp-optimize') | |
| 1113 | + 'something_wrong_try_again' => __('Something went wrong; please try again.', 'wp-optimize'), | |
| 1114 | + 'db_tables_scan_pending_list' => __('Your database tables need to be scanned before they can be listed.', 'wp-optimize'), | |
| 1115 | + 'db_tables_scan_pending_optimize' => __('Your database tables need to be scanned before they can be optimized.', 'wp-optimize'), | |
| 1116 | + 'db_tables_scan_button' => __('Scan tables', 'wp-optimize') | |
| 1071 | 1117 | ); |
| 1072 | 1118 | $filtered_translations = apply_filters('wpo_js_translations', $translations); |
| 1073 | 1119 | return is_array($filtered_translations) ? $filtered_translations : $translations; |
| 1074 | 1120 | } |
| @@ -1073,41 +1119,8 @@ | ||
| 1073 | 1119 | return is_array($filtered_translations) ? $filtered_translations : $translations; |
| 1074 | 1120 | } |
| 1075 | 1121 | |
| 1076 | 1122 | /** |
| 1077 | - * Manages the admin bar menu for caching (currently page and minify) | |
| 1078 | - */ | |
| 1079 | - public function cache_admin_bar($wp_admin_bar) { | |
| 1080 | - | |
| 1081 | - $options = $this->get_options(); | |
| 1082 | - if (!$options->get_option('enable_cache_in_admin_bar', true)) return; | |
| 1083 | - | |
| 1084 | - /** | |
| 1085 | - * The "purge cache" menu items | |
| 1086 | - * | |
| 1087 | - * @param array $menu_items - The menu items, in the format required by $wp_admin_bar->add_menu() | |
| 1088 | - * @param object $wp_admin_bar | |
| 1089 | - */ | |
| 1090 | - $menu_items = apply_filters('wpo_cache_admin_bar_menu_items', array(), $wp_admin_bar); | |
| 1091 | - | |
| 1092 | - if (empty($menu_items) || !is_array($menu_items)) return; | |
| 1093 | - | |
| 1094 | - $wp_admin_bar->add_menu(array( | |
| 1095 | - 'id' => 'wpo_purge_cache', | |
| 1096 | - 'title' => __('Purge cache', 'wp-optimize'), | |
| 1097 | - 'href' => '#', | |
| 1098 | - 'meta' => array( | |
| 1099 | - 'title' => __('Purge cache', 'wp-optimize'), | |
| 1100 | - ), | |
| 1101 | - 'parent' => false, | |
| 1102 | - )); | |
| 1103 | - | |
| 1104 | - foreach ($menu_items as $item) { | |
| 1105 | - $wp_admin_bar->add_menu($item); | |
| 1106 | - } | |
| 1107 | - } | |
| 1108 | - | |
| 1109 | - /** | |
| 1110 | 1123 | * Add settings link on plugin page |
| 1111 | 1124 | * |
| 1112 | 1125 | * @param array $links Passing through the URL to be used within the HREF. |
| 1113 | 1126 | * @return array Returns the Links. |
| @@ -1115,19 +1128,24 @@ | ||
| 1115 | 1128 | public function plugin_settings_link($links) { |
| 1116 | 1129 | |
| 1117 | 1130 | $admin_page_url = $this->get_options()->admin_page_url(); |
| 1118 | 1131 | $settings_page_url = $this->get_options()->admin_page_url('wpo_settings'); |
| 1132 | + $database_page_url = $this->get_options()->admin_page_url('wpo_database'); | |
| 1119 | 1133 | |
| 1120 | 1134 | if (!self::is_premium()) { |
| 1121 | - $premium_link = '<a href="' . esc_url($this->premium_version_link) . '&utm_content=plugin-page' . '" target="_blank">' . __('Premium', 'wp-optimize') . '</a>'; | |
| 1135 | + $premium_link = '<a href="' . esc_url($this->premium_version_link) . '&utm_content=plugin-page' . '" target="_blank">' . esc_html__('Premium', 'wp-optimize') . '</a>'; | |
| 1122 | 1136 | array_unshift($links, $premium_link); |
| 1123 | 1137 | } |
| 1124 | 1138 | |
| 1125 | - $settings_link = '<a href="' . esc_url($settings_page_url) . '">' . __('Settings', 'wp-optimize') . '</a>'; | |
| 1139 | + $settings_link = '<a href="' . esc_url($settings_page_url) . '">' . esc_html__('Settings', 'wp-optimize') . '</a>'; | |
| 1126 | 1140 | array_unshift($links, $settings_link); |
| 1127 | 1141 | |
| 1128 | - $optimize_link = '<a href="' . esc_url($admin_page_url) . '">' . __('Optimize', 'wp-optimize') . '</a>'; | |
| 1142 | + $optimize_link = '<a href="' . esc_url($database_page_url) . '">' . esc_html__('Optimize', 'wp-optimize') . '</a>'; | |
| 1129 | 1143 | array_unshift($links, $optimize_link); |
| 1144 | + | |
| 1145 | + $dashboard_link = '<a href="' . esc_url($admin_page_url) . '">' . esc_html__('Overview', 'wp-optimize') . '</a>'; | |
| 1146 | + array_unshift($links, $dashboard_link); | |
| 1147 | + | |
| 1130 | 1148 | return $links; |
| 1131 | 1149 | } |
| 1132 | 1150 | |
| 1133 | 1151 | /** |
| @@ -1230,15 +1248,15 @@ | ||
| 1230 | 1248 | } |
| 1231 | 1249 | |
| 1232 | 1250 | add_action('wpo_cron_event2', array($this, 'cron_action')); |
| 1233 | 1251 | $result = wp_schedule_event((current_time("timestamp", 0) + $this_time - $gmt_offset), $schedule_type, 'wpo_cron_event2'); |
| 1234 | - WP_Optimize()->log('running wp_schedule_event()'); | |
| 1252 | + $this->log('running wp_schedule_event()'); | |
| 1235 | 1253 | if (is_wp_error($result)) { |
| 1236 | 1254 | $error_msg = $result->get_error_message(); |
| 1237 | - WP_Optimize()->log($error_msg); | |
| 1238 | - WP_Optimize()->log(print_r($result, true)); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r -- Using for debugging purpose, logged into separate file | |
| 1255 | + $this->log($error_msg); | |
| 1256 | + $this->log(print_r($result, true)); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r -- Using for debugging purpose, logged into separate file | |
| 1239 | 1257 | } else { |
| 1240 | - WP_Optimize()->log($result); | |
| 1258 | + $this->log($result); | |
| 1241 | 1259 | } |
| 1242 | 1260 | } |
| 1243 | 1261 | } |
| 1244 | 1262 | } |
| @@ -1244,13 +1262,31 @@ | ||
| 1244 | 1262 | } |
| 1245 | 1263 | } |
| 1246 | 1264 | |
| 1247 | 1265 | /** |
| 1248 | - * Clears all cron events | |
| 1266 | + * Unschedules WP-Optimize cron events on deactivation. | |
| 1249 | 1267 | * |
| 1250 | 1268 | * @return void |
| 1251 | 1269 | */ |
| 1252 | 1270 | public function wpo_cron_deactivate() { |
| 1271 | + if (is_multisite()) { | |
| 1272 | + $sites = $this->get_sites(); | |
| 1273 | + foreach ($sites as $site) { | |
| 1274 | + switch_to_blog($site->blog_id); | |
| 1275 | + $this->unschedule_wpo_cron_jobs(); | |
| 1276 | + restore_current_blog(); | |
| 1277 | + } | |
| 1278 | + } else { | |
| 1279 | + $this->unschedule_wpo_cron_jobs(); | |
| 1280 | + } | |
| 1281 | + } | |
| 1282 | + | |
| 1283 | + /** | |
| 1284 | + * Unschedules all WP-Optimize cron jobs on the current site. | |
| 1285 | + * | |
| 1286 | + * @return void | |
| 1287 | + */ | |
| 1288 | + private function unschedule_wpo_cron_jobs() { | |
| 1253 | 1289 | $cron_jobs = _get_cron_array(); |
| 1254 | 1290 | foreach ($cron_jobs as $job) { |
| 1255 | 1291 | foreach (array_keys($job) as $hook) { |
| 1256 | 1292 | if (preg_match('/^wpo_/', $hook)) wp_unschedule_hook($hook); |
| @@ -1296,8 +1332,12 @@ | ||
| 1296 | 1332 | /** |
| 1297 | 1333 | * Run updates on plugin activation. |
| 1298 | 1334 | */ |
| 1299 | 1335 | public function run_updates() { |
| 1336 | + | |
| 1337 | + if (!defined('WPO_CACHE_FILES_DIR')) define('WPO_CACHE_FILES_DIR', untrailingslashit(WP_CONTENT_DIR).'/cache/wpo-cache'); | |
| 1338 | + | |
| 1339 | + require_once(WPO_PLUGIN_MAIN_PATH . 'cache/file-based-page-cache-functions.php'); | |
| 1300 | 1340 | include_once(WPO_PLUGIN_MAIN_PATH.'includes/class-wp-optimize-updates.php'); |
| 1301 | 1341 | WP_Optimize_Updates::check_updates(); |
| 1302 | 1342 | } |
| 1303 | 1343 | |
| @@ -2019,9 +2059,9 @@ | ||
| 2019 | 2059 | /** |
| 2020 | 2060 | * Adds compress popup template |
| 2021 | 2061 | */ |
| 2022 | 2062 | public function add_smush_popup_template() { |
| 2023 | - if (current_user_can($this->capability_required())) { | |
| 2063 | + if ($this->current_user_can()) { | |
| 2024 | 2064 | $compression_server_hint = Updraft_Smush_Manager()->get_compression_server_hint(); |
| 2025 | 2065 | $this->include_template('images/smush-popup.php', false, array('compression_server_hint' => $compression_server_hint)); |
| 2026 | 2066 | } |
| 2027 | 2067 | } |