PluginProbe
Autoptimize / 3.0.3
Autoptimize v3.0.3
2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 All 107 releases
← All changes | classes/autoptimizeToolbar.php +11 -5 2.7.73.0.3 View file →
@@ -16,15 +16,20 @@
16 16 return;
17 17 }
18 18
19 19 // Load admin toolbar feature once WordPress, all plugins, and the theme are fully loaded and instantiated.
20 - add_action( 'wp_loaded', array( $this, 'load_toolbar' ) );
20 + if ( is_admin() ) {
21 + add_action( 'wp_loaded', array( $this, 'load_toolbar' ) );
22 + } else {
23 + // to avoid AMP complaining about the AMP conditional being checked too early.
24 + add_action( 'wp', array( $this, 'load_toolbar' ) );
25 + }
21 26 }
22 27
23 28 public function load_toolbar()
24 29 {
25 30 // Check permissions and that toolbar is not hidden via filter.
26 - if ( current_user_can( 'manage_options' ) && apply_filters( 'autoptimize_filter_toolbar_show', true ) ) {
31 + if ( current_user_can( 'manage_options' ) && apply_filters( 'autoptimize_filter_toolbar_show', true ) && ! autoptimizeMain::is_amp_markup('') ) {
27 32
28 33 // Create a handler for the AJAX toolbar requests.
29 34 add_action( 'wp_ajax_autoptimize_delete_cache', array( $this, 'delete_cache' ) );
30 35
@@ -73,11 +78,12 @@
73 78 $color = ( 100 == $percentage ) ? 'red' : ( ( $percentage > 80 ) ? 'orange' : 'green' );
74 79
75 80 // Create or add new items into the Admin Toolbar.
76 81 // Main "Autoptimize" node.
82 + $_my_name = apply_filters( 'autoptimize_filter_settings_is_pro', false ) ? __( 'Autoptimize Pro', 'autoptimize' ) : __( 'Autoptimize', 'autoptimize' );
77 83 $wp_admin_bar->add_node( array(
78 84 'id' => 'autoptimize',
79 - 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'Autoptimize', 'autoptimize' ) . '</span>',
85 + 'title' => '<span class="ab-icon"></span><span class="ab-label">' . $_my_name . '</span>',
80 86 'href' => admin_url( 'options-general.php?page=autoptimize' ),
81 87 'meta' => array( 'class' => 'bullet-' . $color ),
82 88 ));
83 89
@@ -83,9 +89,9 @@
83 89
84 90 // "Cache Info" node.
85 91 $wp_admin_bar->add_node( array(
86 92 'id' => 'autoptimize-cache-info',
87 - 'title' => '<p>' . __( 'Cache Info', 'autoptimize' ) . '</p>' .
93 + 'title' => '<p>' . __( 'CSS/ JS Cache Info', 'autoptimize' ) . '</p>' .
88 94 '<div class="autoptimize-radial-bar" percentage="' . $percentage . '">' .
89 95 '<div class="autoptimize-circle">' .
90 96 '<div class="mask full"><div class="fill bg-' . $color . '"></div></div>' .
91 97 '<div class="mask half"><div class="fill bg-' . $color . '"></div></div>' .
@@ -102,9 +108,9 @@
102 108
103 109 // "Delete Cache" node.
104 110 $wp_admin_bar->add_node( array(
105 111 'id' => 'autoptimize-delete-cache',
106 - 'title' => __( 'Delete Cache', 'autoptimize' ),
112 + 'title' => __( 'Clear CSS/ JS Cache', 'autoptimize' ),
107 113 'parent' => 'autoptimize',
108 114 ));
109 115 }
110 116