PluginProbe ʕ •ᴥ•ʔ
Media Cleaner: Clean your WordPress! / 5.5.2
Media Cleaner: Clean your WordPress! v5.5.2
7.1.1 7.1.0 7.0.9 7.0.8 trunk 3.6.8 3.6.9 3.7.0 3.8.0 3.9.0 4.0.0 4.0.2 4.0.4 4.0.6 4.0.7 4.1.0 4.2.0 4.2.2 4.2.3 4.2.4 4.2.5 4.4.0 4.4.2 4.4.4 4.4.6 4.4.7 4.4.8 4.5.0 4.5.4 4.5.6 4.5.7 4.5.8 4.6.2 4.6.3 4.8.0 4.8.4 5.0.0 5.0.1 5.1.0 5.1.1 5.1.3 5.2.0 5.2.1 5.2.4 5.4.0 5.4.1 5.4.2 5.4.3 5.4.4 5.4.5 5.4.6 5.4.9 5.5.0 5.5.1 5.5.2 5.5.3 5.5.4 5.5.7 5.5.8 5.6.1 5.6.2 5.6.3 5.6.4 6.0.1 6.0.2 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9 6.1.2 6.1.3 6.1.4 6.1.5 6.1.6 6.1.7 6.1.8 6.1.9 6.2.0 6.2.1 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.2.8 6.3.0 6.3.1 6.3.2 6.3.4 6.3.5 6.3.7 6.3.8 6.3.9 6.4.0 6.4.1 6.4.2 6.4.3 6.4.4 6.4.5 6.4.6 6.4.7 6.4.8 6.4.9 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.5.8 6.5.9 6.6.1 6.6.2 6.6.3 6.6.4 6.6.5 6.6.6 6.6.7 6.6.8 6.6.9 6.7.0 6.7.1 6.7.2 6.7.3 6.7.4 6.7.5 6.7.6 6.7.7 6.7.8 6.7.9 6.8.0 6.8.1 6.8.2 6.8.3 6.8.4 6.8.5 6.8.6 6.8.7 6.8.8 6.8.9 6.9.0 6.9.1 6.9.2 6.9.3 6.9.4 6.9.5 6.9.6 6.9.7 6.9.8 6.9.9 7.0.0 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.0.6 7.0.7
media-cleaner / common / admin.php
media-cleaner / common Last commit date
img 7 years ago admin.css 6 years ago admin.php 6 years ago
admin.php
574 lines
1 <?php
2
3 if ( !class_exists( 'MeowApps_Admin' ) ) {
4
5 class MeowApps_Admin {
6
7 public static $logo = 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB2aWV3Qm94PSIwIDAgMTY1IDE2NSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+CiAgICAuc3Qye2ZpbGw6IzgwNDYyNX0uc3Qze2ZpbGw6I2ZkYTk2MH0KICA8L3N0eWxlPgogIDxwYXRoIGQ9Ik03MiA3YTc2IDc2IDAgMCAxIDg0IDkxQTc1IDc1IDAgMSAxIDcyIDd6IiBmaWxsPSIjNGE2YjhjIi8+CiAgPHBhdGggZD0iTTQ4IDQ4YzIgNSAyIDEwIDUgMTQgNSA4IDEzIDE3IDIyIDIwbDEtMTBjMS0yIDMtMyA1LTNoMTNjMiAwIDQgMSA1IDNsMyA5IDQtMTBjMi0zIDYtMiA5LTJoMTFjMyAyIDMgNSAzIDhsMiAzN2MwIDMtMSA3LTQgOGgtMTJjLTIgMC0zLTItNS00LTEgMS0yIDMtNCAzLTUgMS05IDEtMTMtMS0zIDItNSAyLTkgMnMtOSAxLTEwLTNjLTItNC0xLTggMC0xMi04LTMtMTUtNy0yMi0xMi03LTctMTUtMTQtMjAtMjMtMy00LTUtOC01LTEzIDEtNCAzLTEwIDYtMTMgNC0zIDEyLTIgMTUgMnoiIGZpbGw9IiMxMDEwMTAiLz4KICA8cGF0aCBjbGFzcz0ic3QyIiBkPSJNNDMgNTFsNCAxMS02IDVoLTZjLTMtNS0zLTExIDAtMTYgMi0yIDYtMyA4IDB6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTQ3IDYybDMgNmMwIDMgMCA0LTIgNnMtNCAyLTcgMmwtNi05aDZsNi01eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik01MCA2OGw4IDljLTMgMy01IDYtOSA4bC04LTljMyAwIDUgMCA3LTJzMy0zIDItNnoiLz4KICA8cGF0aCBkPSJNODIgNzRoMTJsNSAxOCAzIDExIDgtMjloMTNsMiA0MmgtOGwtMS0yLTEtMzEtMTAgMzItNyAxLTktMzMtMSAyOS0xIDRoLThsMy00MnoiIGZpbGw9IiNmZmYiLz4KICA8cGF0aCBjbGFzcz0ic3QzIiBkPSJNNTggNzdsNSA1Yy0xIDQtMiA4LTcgOGwtNy01YzQtMiA2LTUgOS04eiIvPgogIDxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik02MyA4Mmw5IDUtNiA5LTEwLTZjNSAwIDYtNCA3LTh6Ii8+CiAgPHBhdGggY2xhc3M9InN0MyIgZD0iTTcyIDg3bDMgMS0xIDExLTgtMyA2LTEweiIvPgo8L3N2Zz4K';
8
9 public static $loaded = false;
10 public static $admin_version = "2.4";
11
12 public $prefix; // prefix used for actions, filters (mfrh)
13 public $mainfile; // plugin main file (media-file-renamer.php)
14 public $domain; // domain used for translation (media-file-renamer)
15
16 public function __construct( $prefix, $mainfile, $domain, $disableReview = false ) {
17
18 // Core Admin (used by all Meow Apps plugins)
19 if ( !MeowApps_Admin::$loaded ) {
20 if ( is_admin() ) {
21 add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
22 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
23 add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
24 add_action( 'wp_ajax_meow_perf_load', array( $this, 'wp_ajax_meow_perf_load' ) );
25 add_action( 'wp_ajax_meow_file_check', array( $this, 'wp_ajax_meow_file_check' ) );
26 if ( isset( $_GET['page'] ) && $_GET['page'] === 'meowapps-main-menu' ) {
27 add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 100000, 1 );
28 }
29 }
30 MeowApps_Admin::$loaded = true;
31 }
32
33 // Variables for this plugin
34 $this->prefix = $prefix;
35 $this->mainfile = $mainfile;
36 $this->domain = $domain;
37 $this->is_theme = ( strpos( $this->mainfile, '-theme' ) !== false );
38
39 // If there is no mainfile, it's either a Pro only Plugin (with no Free version available) or a Theme.
40 if ( !$this->is_theme ) {
41 register_activation_hook( $mainfile, array( $this, 'show_meowapps_create_rating_date' ) );
42 if ( is_admin() ) {
43 $license = get_option( $this->prefix . '_license', "" );
44 if ( ( !empty( $license ) ) && !file_exists( plugin_dir_path( $this->mainfile ) . 'common/meowapps/admin.php' ) ) {
45 add_action( 'admin_notices', array( $this, 'admin_notices_licensed_free' ) );
46 }
47 if ( !$disableReview ) {
48 $rating_date = $this->create_rating_date();
49 if ( time() > $rating_date ) {
50 add_action( 'admin_notices', array( $this, 'admin_notices_rating' ) );
51 }
52 }
53 }
54 }
55
56 add_filter( 'edd_sl_api_request_verify_ssl', array( $this, 'request_verify_ssl' ), 10, 0 );
57 }
58
59 function wp_ajax_meow_perf_load() {
60 return 'Did nothing but a blank request.';
61 }
62
63 function wp_ajax_meow_file_check() {
64 $tmpfile = wp_tempnam();
65 unlink( $tmpfile );
66 return "Created and deleted $tmpfile.";
67 }
68
69 function request_verify_ssl() {
70 return get_option( 'force_sslverify', false );
71 }
72
73 function show_meowapps_create_rating_date() {
74 delete_option( 'meowapps_hide_meowapps' );
75 $this->create_rating_date();
76 }
77
78 function create_rating_date() {
79 $rating_date = get_option( $this->prefix . '_rating_date' );
80 if ( empty( $rating_date ) ) {
81 $two_months = strtotime( '+2 months' );
82 $six_months = strtotime( '+4 months' );
83 $rating_date = mt_rand( $two_months, $six_months );
84 update_option( $this->prefix . '_rating_date', $rating_date, false );
85 }
86 return $rating_date;
87 }
88
89 function admin_notices_rating() {
90 if ( isset( $_POST[$this->prefix . '_remind_me'] ) ) {
91 $two_weeks = strtotime( '+2 weeks' );
92 $six_weeks = strtotime( '+6 weeks' );
93 $future_date = mt_rand( $two_weeks, $six_weeks );
94 update_option( $this->prefix . '_rating_date', $future_date, false );
95 return;
96 }
97 else if ( isset( $_POST[$this->prefix . '_never_remind_me'] ) ) {
98 $twenty_years = strtotime( '+5 years' );
99 update_option( $this->prefix . '_rating_date', $twenty_years, false );
100 return;
101 }
102 else if ( isset( $_POST[$this->prefix . '_did_it'] ) ) {
103 $twenty_years = strtotime( '+10 years' );
104 update_option( $this->prefix . '_rating_date', $twenty_years, false );
105 return;
106 }
107 $rating_date = get_option( $this->prefix . '_rating_date' );
108 echo '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">';
109 echo '<p style="font-size: 100%;">You have been using <b>' . $this->nice_name_from_file( $this->mainfile ) . '</b> for some time now. Thank you! Could you kindly share your opinion with me, along with, maybe, features you would like to see implemented? Then, please <a style="font-weight: bold; color: #b926ff;" target="_blank" href="https://wordpress.org/support/plugin/' . $this->nice_short_url_from_file( $this->mainfile ) . '/reviews/?rate=5#new-post">write a little review</a>. That will also bring me joy and motivation, and I will get back to you :) <u>In the case you already have written a review</u>, please check again. Many reviews got removed from WordPress recently.';
110 echo '<p>
111 <form method="post" action="" style="float: right;">
112 <input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
113 <input type="submit" name="submit" id="submit" class="button button-red" value="Never remind me!">
114 </form>
115 <form method="post" action="" style="float: right; margin-right: 10px;">
116 <input type="hidden" name="' . $this->prefix . '_remind_me" value="true">
117 <input type="submit" name="submit" id="submit" class="button button-primary" value="Remind me in a few weeks...">
118 </form>
119 <form method="post" action="" style="float: right; margin-right: 10px;">
120 <input type="hidden" name="' . $this->prefix . '_did_it" value="true">
121 <input type="submit" name="submit" id="submit" class="button button-primary" value="Yes, I did it!">
122 </form>
123 <div style="clear: both;"></div>
124 </p>
125 ';
126 echo '</div>';
127 }
128
129 function nice_short_url_from_file( $file ) {
130 $info = pathinfo( $file );
131 if ( !empty( $info ) ) {
132 $info['filename'] = str_replace( '-pro', '', $info['filename'] );
133 return $info['filename'];
134 }
135 return "";
136 }
137
138 function nice_name_from_file( $file ) {
139 $info = pathinfo( $file );
140 if ( !empty( $info ) ) {
141 if ( $info['filename'] == 'wplr-sync' ) {
142 return "WP/LR Sync";
143 }
144 $info['filename'] = str_replace( '-', ' ', $info['filename'] );
145 $file = ucwords( $info['filename'] );
146 }
147 return $file;
148 }
149
150 function admin_notices_licensed_free() {
151 if ( isset( $_POST[$this->prefix . '_reset_sub'] ) ) {
152 delete_option( $this->prefix . '_pro_serial' );
153 delete_option( $this->prefix . '_license' );
154 return;
155 }
156 echo '<div class="error">';
157 echo '<p>It looks like you are using the free version of the plugin (<b>' . $this->nice_name_from_file( $this->mainfile ) . '</b>) but a license for the Pro version was also found. The Pro version might have been replaced by the Free version during an update (might be caused by a temporarily issue). If it is the case, <b>please download it again</b> from the <a target="_blank" href="https://store.meowapps.com">Meow Store</a>. If you wish to continue using the free version and clear this message, click on this button.';
158 echo '<p>
159 <form method="post" action="">
160 <input type="hidden" name="' . $this->prefix . '_reset_sub" value="true">
161 <input type="submit" name="submit" id="submit" class="button" value="Remove the license">
162 </form>
163 </p>
164 ';
165 echo '</div>';
166 }
167
168 function display_ads() {
169 return !get_option( 'meowapps_hide_ads', false );
170 }
171
172 function display_title( $title = "Meow Apps",
173 $author = "By <a style='text-decoration: none;' href='https://meowapps.com' target='_blank'>Jordy Meow</a>" ) {
174 if ( !empty( $this->prefix ) && $title !== "Meow Apps" )
175 $title = apply_filters( $this->prefix . '_plugin_title', $title );
176 if ( $this->display_ads() ) {
177 }
178 ?>
179 <h1 style="line-height: 16px;">
180 <img width="42" style="margin-right: 10px; float: left; position: relative; top: -5px;"
181 src="<?php echo MeowApps_Admin::$logo ?>"><?php echo $title; ?><br />
182 <span style="font-size: 12px"><?php echo $author; ?></span>
183 </h1>
184 <div style="clear: both;"></div>
185 <?php
186 }
187
188 function admin_enqueue_scripts() {
189 wp_register_style( 'meowapps-core-css', $this->common_url( 'admin.css' ) );
190 wp_enqueue_style( 'meowapps-core-css' );
191 }
192
193 function admin_menu_start() {
194 if ( get_option( 'meowapps_hide_meowapps', false ) ) {
195 register_setting( 'general', 'meowapps_hide_meowapps' );
196 add_settings_field( 'meowapps_hide_ads', 'Meow Apps Menu', array( $this, 'meowapps_hide_dashboard_callback' ), 'general' );
197 return;
198 }
199
200 // Creates standard menu if it does NOT exist
201 global $submenu;
202 if ( !isset( $submenu[ 'meowapps-main-menu' ] ) ) {
203 add_menu_page( 'Meow Apps', '<img style="width: 24px; margin-left: -30px; position: absolute; margin-top: -3px;" src="' . MeowApps_Admin::$logo . '" />Meow Apps', 'manage_options', 'meowapps-main-menu',
204 array( $this, 'admin_meow_apps' ), '', 82 );
205 add_submenu_page( 'meowapps-main-menu', __( 'Dashboard', 'meowapps' ),
206 __( 'Dashboard', 'meowapps' ), 'manage_options',
207 'meowapps-main-menu', array( $this, 'admin_meow_apps' ) );
208 }
209
210 add_settings_section( 'meowapps_common_settings', null, null, 'meowapps_common_settings-menu' );
211 add_settings_field( 'meowapps_hide_meowapps', "Main Menu",
212 array( $this, 'meowapps_hide_dashboard_callback' ),
213 'meowapps_common_settings-menu', 'meowapps_common_settings' );
214 add_settings_field( 'meowapps_force_sslverify', "SSL Verify",
215 array( $this, 'meowapps_force_sslverify_callback' ),
216 'meowapps_common_settings-menu', 'meowapps_common_settings' );
217 // add_settings_field( 'meowapps_hide_ads', "Ads",
218 // array( $this, 'meowapps_hide_ads_callback' ),
219 // 'meowapps_common_settings-menu', 'meowapps_common_settings' );
220 register_setting( 'meowapps_common_settings', 'force_sslverify' );
221 register_setting( 'meowapps_common_settings', 'meowapps_hide_meowapps' );
222 register_setting( 'meowapps_common_settings', 'meowapps_hide_ads' );
223 }
224
225 function meowapps_hide_ads_callback() {
226 $value = get_option( 'meowapps_hide_ads', null );
227 $html = '<input type="checkbox" id="meowapps_hide_ads" name="meowapps_hide_ads" value="1" ' .
228 checked( 1, get_option( 'meowapps_hide_ads' ), false ) . '/>';
229 $html .= __( '<label>Hide</label><br /><small>Doesn\'t display the ads.</small>', 'meowapps' );
230 echo $html;
231 }
232
233 function meowapps_hide_dashboard_callback() {
234 $value = get_option( 'meowapps_hide_meowapps', null );
235 $html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
236 checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
237 $html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a cleaner admin. This option will be reset if a new Meow Apps plugin is installed. <b>Once activated, an option will be added in your General settings to display it again.</b></small>', 'meowapps' );
238 echo $html;
239 }
240
241 function meowapps_force_sslverify_callback() {
242 $value = get_option( 'force_sslverify', null );
243 $html = '<input type="checkbox" id="force_sslverify" name="force_sslverify" value="1" ' .
244 checked( 1, get_option( 'force_sslverify' ), false ) . '/>';
245 $html .= __( '<label>Force</label><br /><small>Updates and licenses checks are usually made without checking SSL certificates and it is actually fine this way. But if you are intransigent when it comes to SSL matters, this option will force it.</small>', 'meowapps' );
246 echo $html;
247 }
248
249 function display_serialkey_box( $url = "https://meowapps.com/" ) {
250 $html = '<div class="meow-box">';
251 $html .= '<h3 class="' . ( $this->is_registered( $this->prefix ) ? 'meow-bk-blue' : 'meow-bk-red' ) . '">Pro Version ' .
252 ( $this->is_registered( $this->prefix ) ? '(enabled)' : '(disabled)' ) . '</h3>';
253 $html .= '<div class="inside">';
254 echo $html;
255 $html = apply_filters( $this->prefix . '_meowapps_license_input', ( 'More information about the Pro version here:
256 <a target="_blank" href="' . $url . '">' . $url . '</a>. If you actually bought the Pro version already, please remove the current plugin and download the Pro version from your account at the <a target="_blank" href="https://store.meowapps.com/account/downloads/">Meow Apps Store</a>.' ), $url );
257 $html .= '</div>';
258 $html .= '</div>';
259 echo $html;
260 }
261
262 function is_registered() {
263 return apply_filters( $this->prefix . '_meowapps_is_registered', false, $this->prefix );
264 }
265
266 function check_install( $plugin ) {
267 $pro = false;
268
269 $pluginpath = trailingslashit( plugin_dir_path( __FILE__ ) ) . '../../' . $plugin . '-pro';
270 if ( !file_exists( $pluginpath ) ) {
271 $pluginpath = trailingslashit( plugin_dir_path( __FILE__ ) ) . '../../' . $plugin;
272 if ( !file_exists( $pluginpath ) ) {
273 $url = wp_nonce_url( "update.php?action=install-plugin&plugin=$plugin", "install-plugin_$plugin" );
274 return "<a href='$url'><small><span class='' style='float: right;'>install</span></small></a>";
275 }
276 }
277 else {
278 $pro = true;
279 $plugin = $plugin . "-pro";
280 }
281
282 $plugin_file = $plugin . '/' . $plugin . '.php';
283 if ( is_plugin_active( $plugin_file ) ) {
284 if ( $plugin == 'wplr-sync' )
285 $pro = true;
286 if ( $pro )
287 return "<small><span style='float: right;'><span class='dashicons dashicons-heart' style='color: rgba(255, 63, 0, 1); font-size: 30px !important; margin-right: 10px;'></span></span></small>";
288 else
289 return "<small><span style='float: right;'><span class='dashicons dashicons-yes' style='color: #00b4ff; font-size: 30px !important; margin-right: 10px;'></span></span></small>";
290 }
291 else {
292 $url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $plugin_file ),
293 'activate-plugin_' . $plugin_file );
294 return '<small><span style="color: black; float: right;">off
295 (<a style="color: rgba(30,140,190,1); text-decoration: none;" href="' .
296 $url . '">enable</a>)</span></small>';
297 }
298 }
299
300 function common_url( $file ) {
301 die( "Meow Apps: The function common_url( \$file ) needs to be overriden." );
302 // Normally, this should be used:
303 // return plugin_dir_url( __FILE__ ) . ( '\/common\/' . $file );
304 }
305
306 function meowapps_logo_url() {
307 return $this->common_url( 'img/meowapps.png' );
308 }
309
310 function plugins_loaded() {
311 if ( isset( $_GET[ 'tool' ] ) && $_GET[ 'tool' ] == 'error_log' ) {
312 $sec = "5";
313 header( "Refresh: $sec;" );
314 }
315 }
316
317 function admin_meow_apps() {
318
319 echo '<div class="wrap meow-dashboard">';
320 if ( isset( $_GET['tool'] ) && $_GET['tool'] == 'phpinfo' ) {
321 echo "<a href=\"javascript:history.go(-1)\">< Go back</a><br /><br />";
322 echo '<div id="phpinfo">';
323 ob_start();
324 phpinfo();
325 $pinfo = ob_get_contents();
326 ob_end_clean();
327 $pinfo = preg_replace( '%^.*<body>(.*)</body>.*$%ms','$1', $pinfo );
328 echo $pinfo;
329 echo "</div>";
330 }
331 else if ( isset( $_GET['tool'] ) && $_GET['tool'] == 'error_log' ) {
332 $log_msg = '=== MEOW APPS DEBUG (This is not an error) ===';
333 if ( isset( $_POST['write_logs'] ) ) {
334 error_log( $log_msg );
335 }
336 $errorpath = ini_get( 'error_log' );
337 echo "<a href=\"javascript:history.go(-1)\">< Go back</a><br /><br />";
338 echo '
339 <form method="post">
340 <input type="hidden" name="write_logs" value="true">
341 <input class="button button-primary" type="submit" value="Write in the Error Logs">
342 </form><br />';
343 echo '<div id="error_log">';
344 if ( file_exists( $errorpath ) ) {
345 echo "Now (auto-reload every 5 seconds): [" . date( "d-M-Y H:i:s", time() ) . " UTC]<br /><br /><h2 style='margin: 0px;'>Errors (order by latest)</h2>";
346 $errors = file_get_contents( $errorpath );
347 $errors = explode( "\n", $errors );
348 $errors = array_reverse( $errors );
349 $errors = implode( "<br />", $errors );
350 echo $errors;
351 }
352 else {
353 echo "The PHP Error Logs cannot be found. Please ask your hosting service for it.";
354 }
355 echo "</div>";
356
357 }
358 else {
359
360 ?>
361 <?php $this->display_title( 'Meow Apps' ); ?>
362 <p>
363 <?php _e( 'Meow Apps is run by Jordy Meow, a photographer and software developer living in Japan (and taking <a target="_blank" href="http://offbeatjapan.org">a lot of photos</a>). Meow Apps is a suite of plugins focusing on photography, imaging, optimization and it teams up with the best players in the community (other themes and plugins developers). For more information, please check <a href="http://meowapps.com" target="_blank">Meow Apps</a>.', 'meowapps' )
364 ?>
365 </p>
366
367 <h2 style="margin-bottom: 0px; margin-top: 25px;">Featured Plugins</h2>
368 <div class="meow-row meow-featured-plugins">
369 <div class="meow-box meow-col meow-span_1_of_2">
370 <ul class="">
371 <li><img src='<?= $this->common_url( 'img/media-cleaner.jpg' ) ?>' />
372 <a href='https://meowapps.com/plugin/media-cleaner/'><b>Media Cleaner</b></a>
373 <?php echo $this->check_install( 'media-cleaner' ) ?><br />
374 Detect the files which are not in use.</li>
375 <li><img src='<?= $this->common_url( 'img/media-file-renamer.jpg' ) ?>' />
376 <a href='https://meowapps.com/plugin/media-file-renamer/'><b>Media File Renamer</b></a>
377 <?php echo $this->check_install( 'media-file-renamer' ) ?><br />
378 For nicer filenames and a better SEO.</li>
379 <li><img src='<?= $this->common_url( 'img/default.png' ) ?>' />
380 <a href='https://meowapps.com/plugin/contact-form-block/'><b>Contact Form Block</b></a>
381 <?php echo $this->check_install( 'contact-form-block' ) ?><br />
382 A simpler, nicer, prettier contact form.</li>
383 <!--li><img src='<?= $this->common_url( 'img/wp-retina-2x.jpg' ) ?>' />
384 <a href='https://meowapps.com/plugin/wp-retina-2x/'><b>WP Retina 2x</b></a>
385 <?php echo $this->check_install( 'wp-retina-2x' ) ?><br />
386 The famous plugin that adds Retina support.</li-->
387
388 </ul>
389 </div>
390 <div class="meow-box meow-col meow-span_1_of_2 ">
391 <ul class="">
392 <li><img src='<?= $this->common_url( 'img/meow-gallery.jpg' ) ?>' />
393 <a href='https://meowapps.com/plugin/meow-gallery/'><b>Meow Gallery</b></a>
394 <?php echo $this->check_install( 'meow-gallery' ) ?><br />
395 Beautiful but lightweight gallery with many layouts. The only one that allows you to uninstall it without losing anything.</li>
396 <li><img src='<?= $this->common_url( 'img/meow-lightbox.jpg' ) ?>' />
397 <a href='https://meowapps.com/plugin/meow-lightbox/'><b>Meow Lightbox</b></a>
398 <?php echo $this->check_install( 'meow-lightbox' ) ?><br />
399 Pretty and ultra-optimized Lightbox which can also display your EXIF data. You will love it.</li>
400 <li><img src='<?= $this->common_url( 'img/wplr-sync.jpg' ) ?>' />
401 <a href='https://meowapps.com/plugin/wplr-sync/'><b>WP/LR Sync</b></a>
402 <?php echo $this->check_install( 'wplr-sync' ) ?><br />
403 Synchronize your Lightroom to your WordPress. This plugin is loved by all the photographers using Lightroom and WordPress.</li>
404 </ul>
405 </div>
406 </div>
407
408 <h2>WordPress Performance & Recommendations</h2>
409 <div style="background: white; padding: 5px 15px 5px 15px; box-shadow: 2px 2px 1px rgba(0,0,0,.02); margin-bottom: 15px;">
410 <p><?php _e( 'The <b>Empty Request Time</b> helps you analyzing the raw performance of your install by giving you the average time it takes to run an empty request to your server. You can try to disable some plugins (or change their options) then and click on Reset to see how it influences the results. With <b>File Operation Time</b>, you will find out if your server is slow with files. An excellent install would have an Empty Request Time of less than 500 ms. Keep it absolutely under 2,000 ms. File Operation Time should take only a few milliseconds more than the Empty Request Time. For more information about this, <a href="https://meowapps.com/clean-optimize-wordpress/#Optimize_your_Empty_Request_Time" target="_blank">click here</a>.', 'meowapps' ); ?></p>
411 </div>
412
413 <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
414 <div style='font-size: 14px; line-height: 14px; margin-bottom: 20px;'>Empty Request Time</div>
415 <div style='font-size: 32px; line-height: 32px; margin-bottom: 10px;' id='meow-perf-load-average'>N/A</div>
416 <div style='font-size: 12px; line-height: 12px; margin-bottom: 20px;'>Based on
417 <span id='meow-perf-load-count'>0</span> request(s)
418 </div>
419 <input type='submit' style='text-align: center; width: 100%;' id="meow-perf-reset" value="Reset" class="button button-primary">
420 </div>
421
422 <div style="float: left; margin-right: 10px; text-align: center; padding: 10px; background: white; width: 200px; border: 1px solid #e2e2e2;">
423 <div style='font-size: 14px; line-height: 14px; margin-bottom: 20px;'>File Operation Time</div>
424 <div style='font-size: 32px; line-height: 32px; margin-bottom: 10px;' id='meow-file-check-time'>N/A</div>
425 <div style='font-size: 12px; line-height: 12px; margin-bottom: 20px;'>Create temporary file and delete it.</div>
426 <input type='submit' style='text-align: center; width: 100%;' id="meow-file-check-start" value="Check" class="button button-primary">
427 </div>
428
429 <div style="clear: both;"></div>
430
431 <script>
432 (function ($) {
433 var calls = 0;
434 var times = [];
435
436 $('#meow-perf-reset').on('click', function () {
437 calls = 0;
438 times = [];
439 $('#meow-perf-load-average').text('N/A');
440 $('#meow-perf-load-count').text('0');
441 });
442
443 function perfLoad() {
444 var start = new Date().getTime();
445 $.ajax(ajaxurl, {
446 method: 'post',
447 dataType: 'json',
448 data: {
449 action: 'meow_perf_load',
450 }
451 }).done(function (response) {
452 var end = new Date().getTime();
453 var time = end - start;
454 calls++;
455 times.push(time);
456 var sum = times.reduce(function(a, b) { return a + b; });
457 var avg = Math.ceil(sum / times.length);
458 $('#meow-perf-load-average').text(avg + ' ms');
459 $('#meow-perf-load-count').text(calls);
460 setTimeout(perfLoad, 5000);
461 });
462 };
463
464 function perfFile() {
465 var start = new Date().getTime();
466 $.ajax(ajaxurl, {
467 method: 'post',
468 dataType: 'json',
469 data: {
470 action: 'meow_file_check',
471 }
472 }).done(function (response) {
473 var end = new Date().getTime();
474 var time = end - start;
475 $('#meow-file-check-time').text(time + ' ms');
476 $('#meow-file-check-start').text('Check');
477 });
478 };
479
480 $('#meow-file-check-start').on('click', function () {
481 $('#meow-file-check-start').text('...');
482 perfFile();
483 });
484
485 setTimeout(perfLoad, 1500);
486
487 })(jQuery);
488 </script>
489
490 <div style="background: white; padding: 5px 15px 5px 15px; box-shadow: 2px 2px 1px rgba(0,0,0,.02); margin-top: 15px;">
491 <p>
492 <?php _e( 'Too many WordPress installs are blown-up with useless and/or huge plugins, and bad practices. But that is because most users are overwhelmed by the diversity and immensity of the WordPress jungle. One rule of thumb is to keep your install the simplest as possible, with the least number of plugins (avoiding heavy ones too) and a good hosting service (avoid VPS except if you know exactly what you are doing). Articles are kept being updated on the Meow Apps website, with all the latest recommendations: ', 'meowapps' )?>
493 <a href='https://meowapps.com/debugging-wordpress/' target='_blank'>
494 How To Debug</a>,
495 <a href='https://meowapps.com/seo-optimization/' target='_blank'>
496 SEO Checklist & Optimization</a>,
497 <a href='https://meowapps.com/clean-optimize-wordpress/' target='_blank'>
498 Clean Up and Optimize</a>,
499 <a href='https://meowapps.com/optimize-images-cdn/' target='_blank'>
500 Optimize Images</a>,
501 <a href='https://meowapps.com/best-hosting-services-wordpress/' target='_blank'>
502 Best Hosting Services</a>.
503 </p>
504 </div>
505
506 <h2 style="margin-bottom: 0px; margin-top: 25px;">Common Options & Tools</h2>
507 <div class="meow-row">
508 <div class="meow-box meow-col meow-span_2_of_3">
509 <h3><span class="dashicons dashicons-admin-tools"></span> Common</h3>
510 <div class="inside">
511 <form method="post" action="options.php">
512 <?php settings_fields( 'meowapps_common_settings' ); ?>
513 <?php do_settings_sections( 'meowapps_common_settings-menu' ); ?>
514 <?php submit_button(); ?>
515 </form>
516 </div>
517 </div>
518
519 <div class="meow-box meow-col meow-span_1_of_3">
520 <h3><span class="dashicons dashicons-admin-tools"></span> Debug</h3>
521 <div class="inside">
522 <ul>
523 <li><a href="?page=meowapps-main-menu&amp;tool=error_log">Display Error Log</a></li>
524 <li><a href="?page=meowapps-main-menu&amp;tool=phpinfo">Display PHP Info</a></li>
525 </ul>
526 </div>
527 </div>
528
529 <div class="meow-box meow-col meow-span_1_of_3">
530 <h3><span class="dashicons dashicons-admin-tools"></span> Post Types (used by this install)</h3>
531 <div class="inside">
532 <?php
533 global $wpdb;
534 // Maybe we could avoid to check more post_types.
535 // SELECT post_type, COUNT(*) FROM `wp_posts` GROUP BY post_type
536 $types = $wpdb->get_results( "SELECT post_type as 'type', COUNT(*) as 'count' FROM $wpdb->posts GROUP BY post_type" );
537 $result = array();
538 foreach( $types as $type )
539 array_push( $result, "{$type->type} ({$type->count})" );
540 echo implode( $result, ', ' );
541 ?>
542 </div>
543 </div>
544 </div>
545
546 <?php
547 }
548 }
549
550 function admin_footer_text( $current ) {
551 return "Thanks for using <a href='https://meowapps.com'>Meow Apps</a>! This is the Meow Admin " .
552 MeowApps_Admin::$admin_version . ". <br /><i>Loaded from " . __FILE__ . "</i>";
553 }
554
555 // HELPERS
556
557 static function size_shortname( $name ) {
558 $name = preg_split( '[_-]', $name );
559 $short = strtoupper( substr( $name[0], 0, 1 ) );
560 if ( count( $name ) > 1 )
561 $short .= strtoupper( substr( $name[1], 0, 1 ) );
562 return $short;
563 }
564
565 }
566
567 }
568
569 if ( file_exists( plugin_dir_path( __FILE__ ) . '/meowapps/admin.php' ) ) {
570 require( 'meowapps/admin.php' );
571 }
572
573 ?>
574