@@ -118,6 +118,10 @@ |
||
118 | 118 | * |
119 | 119 | * @since 1.0 |
120 | 120 | */ |
121 | + |
|
122 | + /** |
|
123 | + * @param string $button_classes |
|
124 | + */ |
|
121 | 125 | public static function render_template($plugin, $api, $button_text, $button_classes){ |
122 | 126 | ?> |
123 | 127 | <div class="plugin"> |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | |
18 | 18 | class Connekt_Plugin_Installer { |
19 | 19 | |
20 | - public function start(){ |
|
20 | + public function start(){ |
|
21 | 21 | if(!defined('CNKT_INSTALLER_PATH')){ |
22 | 22 | // Update this constant to use outside the plugins directory |
23 | 23 | define('CNKT_INSTALLER_PATH', plugins_url('/', __FILE__)); |
24 | 24 | } |
25 | - add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_scripts' )); // Enqueue scripts and Localize |
|
26 | - add_action( 'wp_ajax_cnkt_plugin_installer', array(&$this, 'cnkt_plugin_installer' )); // Install plugin |
|
27 | - add_action( 'wp_ajax_cnkt_plugin_activation', array(&$this, 'cnkt_plugin_activation' )); // Activate plugin |
|
25 | + add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_scripts' )); // Enqueue scripts and Localize |
|
26 | + add_action( 'wp_ajax_cnkt_plugin_installer', array(&$this, 'cnkt_plugin_installer' )); // Install plugin |
|
27 | + add_action( 'wp_ajax_cnkt_plugin_activation', array(&$this, 'cnkt_plugin_activation' )); // Activate plugin |
|
28 | 28 | |
29 | - } |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /* |
|
34 | + /* |
|
35 | 35 | * init |
36 | 36 | * Initialize the display of the plugins. |
37 | 37 | * |
@@ -40,68 +40,68 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - public static function init($plugins){ ?> |
|
43 | + public static function init($plugins){ ?> |
|
44 | 44 | |
45 | 45 | <div class="cnkt-plugin-installer"> |
46 | 46 | <?php |
47 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
47 | + require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
48 | 48 | |
49 | 49 | foreach($plugins as $plugin) : |
50 | 50 | |
51 | - $button_classes = 'install button'; |
|
52 | - $button_text = __('Install Now', 'framework'); |
|
53 | - |
|
54 | - $api = plugins_api( 'plugin_information', |
|
55 | - array( |
|
56 | - 'slug' => sanitize_file_name($plugin['slug']), |
|
57 | - 'fields' => array( |
|
58 | - 'short_description' => true, |
|
59 | - 'sections' => false, |
|
60 | - 'requires' => false, |
|
61 | - 'downloaded' => true, |
|
62 | - 'last_updated' => false, |
|
63 | - 'added' => false, |
|
64 | - 'tags' => false, |
|
65 | - 'compatibility' => false, |
|
66 | - 'homepage' => false, |
|
67 | - 'donate_link' => false, |
|
68 | - 'icons' => true, |
|
69 | - 'banners' => true, |
|
70 | - ), |
|
71 | - ) |
|
72 | - ); |
|
73 | - |
|
74 | - //echo '<pre>'; |
|
75 | - //print_r($api); |
|
76 | - //echo '</pre>'; |
|
51 | + $button_classes = 'install button'; |
|
52 | + $button_text = __('Install Now', 'framework'); |
|
53 | + |
|
54 | + $api = plugins_api( 'plugin_information', |
|
55 | + array( |
|
56 | + 'slug' => sanitize_file_name($plugin['slug']), |
|
57 | + 'fields' => array( |
|
58 | + 'short_description' => true, |
|
59 | + 'sections' => false, |
|
60 | + 'requires' => false, |
|
61 | + 'downloaded' => true, |
|
62 | + 'last_updated' => false, |
|
63 | + 'added' => false, |
|
64 | + 'tags' => false, |
|
65 | + 'compatibility' => false, |
|
66 | + 'homepage' => false, |
|
67 | + 'donate_link' => false, |
|
68 | + 'icons' => true, |
|
69 | + 'banners' => true, |
|
70 | + ), |
|
71 | + ) |
|
72 | + ); |
|
73 | + |
|
74 | + //echo '<pre>'; |
|
75 | + //print_r($api); |
|
76 | + //echo '</pre>'; |
|
77 | 77 | |
78 | 78 | |
79 | 79 | if ( !is_wp_error( $api ) ) { // confirm error free |
80 | 80 | |
81 | - $main_plugin_file = Connekt_Plugin_Installer::get_plugin_file($plugin['slug']); // Get main plugin file |
|
82 | - //echo $main_plugin_file; |
|
83 | - if(self::check_file_extension($main_plugin_file)){ // check file extension |
|
84 | - if(is_plugin_active($main_plugin_file)){ |
|
85 | - // plugin activation, confirmed! |
|
86 | - $button_classes = 'button disabled'; |
|
87 | - $button_text = __('Activated', 'framework'); |
|
88 | - } else { |
|
89 | - // It's installed, let's activate it |
|
90 | - $button_classes = 'activate button button-primary'; |
|
91 | - $button_text = __('Activate', 'framework'); |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - // Send plugin data to template |
|
96 | - self::render_template($plugin, $api, $button_text, $button_classes); |
|
97 | - |
|
98 | - } |
|
81 | + $main_plugin_file = Connekt_Plugin_Installer::get_plugin_file($plugin['slug']); // Get main plugin file |
|
82 | + //echo $main_plugin_file; |
|
83 | + if(self::check_file_extension($main_plugin_file)){ // check file extension |
|
84 | + if(is_plugin_active($main_plugin_file)){ |
|
85 | + // plugin activation, confirmed! |
|
86 | + $button_classes = 'button disabled'; |
|
87 | + $button_text = __('Activated', 'framework'); |
|
88 | + } else { |
|
89 | + // It's installed, let's activate it |
|
90 | + $button_classes = 'activate button button-primary'; |
|
91 | + $button_text = __('Activate', 'framework'); |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + // Send plugin data to template |
|
96 | + self::render_template($plugin, $api, $button_text, $button_classes); |
|
97 | + |
|
98 | + } |
|
99 | 99 | |
100 | 100 | endforeach; |
101 | 101 | ?> |
102 | 102 | </div> |
103 | 103 | <?php |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | 106 | |
107 | 107 | |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @since 1.0 |
120 | 120 | */ |
121 | - public static function render_template($plugin, $api, $button_text, $button_classes){ |
|
122 | - ?> |
|
121 | + public static function render_template($plugin, $api, $button_text, $button_classes){ |
|
122 | + ?> |
|
123 | 123 | <div class="plugin"> |
124 | 124 | <div class="plugin-wrap"> |
125 | 125 | <img src="<?php echo $api->icons['1x']; ?>" alt=""> |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | </ul> |
146 | 146 | </div> |
147 | 147 | <?php |
148 | - } |
|
148 | + } |
|
149 | 149 | |
150 | 150 | |
151 | 151 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | wp_die( __( 'Error - unable to verify nonce, please try again.', 'framework') ); |
172 | 172 | |
173 | 173 | |
174 | - // Include required libs for installation |
|
174 | + // Include required libs for installation |
|
175 | 175 | require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
176 | 176 | require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
177 | 177 | require_once( ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php' ); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | die( __( 'Error - unable to verify nonce, please try again.', 'framework' ) ); |
243 | 243 | |
244 | 244 | |
245 | - // Include required libs for activation |
|
245 | + // Include required libs for activation |
|
246 | 246 | require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
247 | 247 | require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
248 | 248 | require_once( ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php' ); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | |
296 | 296 | |
297 | - /* |
|
297 | + /* |
|
298 | 298 | * get_plugin_file |
299 | 299 | * A method to get the main plugin file. |
300 | 300 | * |
@@ -305,23 +305,23 @@ discard block |
||
305 | 305 | * @since 1.0 |
306 | 306 | */ |
307 | 307 | |
308 | - public static function get_plugin_file( $plugin_slug ) { |
|
309 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); // Load plugin lib |
|
310 | - $plugins = get_plugins(); |
|
308 | + public static function get_plugin_file( $plugin_slug ) { |
|
309 | + require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); // Load plugin lib |
|
310 | + $plugins = get_plugins(); |
|
311 | 311 | |
312 | - foreach( $plugins as $plugin_file => $plugin_info ) { |
|
312 | + foreach( $plugins as $plugin_file => $plugin_info ) { |
|
313 | 313 | |
314 | - // Get the basename of the plugin e.g. [askismet]/askismet.php |
|
315 | - $slug = dirname( plugin_basename( $plugin_file ) ); |
|
314 | + // Get the basename of the plugin e.g. [askismet]/askismet.php |
|
315 | + $slug = dirname( plugin_basename( $plugin_file ) ); |
|
316 | 316 | |
317 | - if($slug){ |
|
318 | - if ( $slug == $plugin_slug ) { |
|
319 | - return $plugin_file; // If $slug = $plugin_name |
|
320 | - } |
|
321 | - } |
|
322 | - } |
|
323 | - return null; |
|
324 | - } |
|
317 | + if($slug){ |
|
318 | + if ( $slug == $plugin_slug ) { |
|
319 | + return $plugin_file; // If $slug = $plugin_name |
|
320 | + } |
|
321 | + } |
|
322 | + } |
|
323 | + return null; |
|
324 | + } |
|
325 | 325 | |
326 | 326 | |
327 | 327 | |
@@ -356,19 +356,19 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 1.0 |
358 | 358 | */ |
359 | - public function enqueue_scripts(){ |
|
360 | - wp_enqueue_script( 'plugin-installer', CNKT_INSTALLER_PATH. 'assets/installer.js', array( 'jquery' )); |
|
359 | + public function enqueue_scripts(){ |
|
360 | + wp_enqueue_script( 'plugin-installer', CNKT_INSTALLER_PATH. 'assets/installer.js', array( 'jquery' )); |
|
361 | 361 | wp_localize_script( 'plugin-installer', 'cnkt_installer_localize', array( |
362 | - 'ajax_url' => admin_url('admin-ajax.php'), |
|
363 | - 'admin_nonce' => wp_create_nonce('cnkt_installer_nonce'), |
|
364 | - 'install_now' => __('Are you sure you want to install this plugin?', 'framework'), |
|
365 | - 'install_btn' => __('Install Now', 'framework'), |
|
366 | - 'activate_btn' => __('Activate', 'framework'), |
|
367 | - 'installed_btn' => __('Activated', 'framework') |
|
368 | - )); |
|
362 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
363 | + 'admin_nonce' => wp_create_nonce('cnkt_installer_nonce'), |
|
364 | + 'install_now' => __('Are you sure you want to install this plugin?', 'framework'), |
|
365 | + 'install_btn' => __('Install Now', 'framework'), |
|
366 | + 'activate_btn' => __('Activate', 'framework'), |
|
367 | + 'installed_btn' => __('Activated', 'framework') |
|
368 | + )); |
|
369 | 369 | |
370 | - wp_enqueue_style( 'plugin-installer', CNKT_INSTALLER_PATH. 'assets/installer.css'); |
|
371 | - } |
|
370 | + wp_enqueue_style( 'plugin-installer', CNKT_INSTALLER_PATH. 'assets/installer.css'); |
|
371 | + } |
|
372 | 372 | |
373 | 373 | } |
374 | 374 |
@@ -9,22 +9,22 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | |
12 | -if (!defined('ABSPATH')) exit; |
|
12 | +if ( ! defined('ABSPATH')) exit; |
|
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | -if( !class_exists('Connekt_Plugin_Installer') ) { |
|
16 | +if ( ! class_exists('Connekt_Plugin_Installer')) { |
|
17 | 17 | |
18 | 18 | class Connekt_Plugin_Installer { |
19 | 19 | |
20 | - public function start(){ |
|
21 | - if(!defined('CNKT_INSTALLER_PATH')){ |
|
20 | + public function start() { |
|
21 | + if ( ! defined('CNKT_INSTALLER_PATH')) { |
|
22 | 22 | // Update this constant to use outside the plugins directory |
23 | 23 | define('CNKT_INSTALLER_PATH', plugins_url('/', __FILE__)); |
24 | 24 | } |
25 | - add_action( 'admin_enqueue_scripts', array(&$this, 'enqueue_scripts' )); // Enqueue scripts and Localize |
|
26 | - add_action( 'wp_ajax_cnkt_plugin_installer', array(&$this, 'cnkt_plugin_installer' )); // Install plugin |
|
27 | - add_action( 'wp_ajax_cnkt_plugin_activation', array(&$this, 'cnkt_plugin_activation' )); // Activate plugin |
|
25 | + add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts')); // Enqueue scripts and Localize |
|
26 | + add_action('wp_ajax_cnkt_plugin_installer', array(&$this, 'cnkt_plugin_installer')); // Install plugin |
|
27 | + add_action('wp_ajax_cnkt_plugin_activation', array(&$this, 'cnkt_plugin_activation')); // Activate plugin |
|
28 | 28 | |
29 | 29 | } |
30 | 30 | |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - public static function init($plugins){ ?> |
|
43 | + public static function init($plugins) { ?> |
|
44 | 44 | |
45 | 45 | <div class="cnkt-plugin-installer"> |
46 | 46 | <?php |
47 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
47 | + require_once(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
48 | 48 | |
49 | - foreach($plugins as $plugin) : |
|
49 | + foreach ($plugins as $plugin) : |
|
50 | 50 | |
51 | 51 | $button_classes = 'install button'; |
52 | 52 | $button_text = __('Install Now', 'framework'); |
53 | 53 | |
54 | - $api = plugins_api( 'plugin_information', |
|
54 | + $api = plugins_api('plugin_information', |
|
55 | 55 | array( |
56 | 56 | 'slug' => sanitize_file_name($plugin['slug']), |
57 | 57 | 'fields' => array( |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | //echo '</pre>'; |
77 | 77 | |
78 | 78 | |
79 | - if ( !is_wp_error( $api ) ) { // confirm error free |
|
79 | + if ( ! is_wp_error($api)) { // confirm error free |
|
80 | 80 | |
81 | 81 | $main_plugin_file = Connekt_Plugin_Installer::get_plugin_file($plugin['slug']); // Get main plugin file |
82 | 82 | //echo $main_plugin_file; |
83 | - if(self::check_file_extension($main_plugin_file)){ // check file extension |
|
84 | - if(is_plugin_active($main_plugin_file)){ |
|
83 | + if (self::check_file_extension($main_plugin_file)) { // check file extension |
|
84 | + if (is_plugin_active($main_plugin_file)) { |
|
85 | 85 | // plugin activation, confirmed! |
86 | 86 | $button_classes = 'button disabled'; |
87 | 87 | $button_text = __('Activated', 'framework'); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @since 1.0 |
120 | 120 | */ |
121 | - public static function render_template($plugin, $api, $button_text, $button_classes){ |
|
121 | + public static function render_template($plugin, $api, $button_text, $button_classes) { |
|
122 | 122 | ?> |
123 | 123 | <div class="plugin"> |
124 | 124 | <div class="plugin-wrap"> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | <a class="<?php echo $button_classes; ?>" |
134 | 134 | data-slug="<?php echo $api->slug; ?>" |
135 | 135 | data-name="<?php echo $api->name; ?>" |
136 | - href="<?php echo get_admin_url(); ?>/update.php?action=install-plugin&plugin=<?php echo $api->slug; ?>&_wpnonce=<?php echo wp_create_nonce('install-plugin_'. $api->slug) ?>"> |
|
136 | + href="<?php echo get_admin_url(); ?>/update.php?action=install-plugin&plugin=<?php echo $api->slug; ?>&_wpnonce=<?php echo wp_create_nonce('install-plugin_'.$api->slug) ?>"> |
|
137 | 137 | <?php echo $button_text; ?> |
138 | 138 | </a> |
139 | 139 | </li> |
@@ -158,27 +158,27 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @since 1.0 |
160 | 160 | */ |
161 | - public function cnkt_plugin_installer(){ |
|
161 | + public function cnkt_plugin_installer() { |
|
162 | 162 | |
163 | - if ( ! current_user_can('install_plugins') ) |
|
164 | - wp_die( __( 'Sorry, you are not allowed to install plugins on this site.', 'framework' ) ); |
|
163 | + if ( ! current_user_can('install_plugins')) |
|
164 | + wp_die(__('Sorry, you are not allowed to install plugins on this site.', 'framework')); |
|
165 | 165 | |
166 | 166 | $nonce = $_POST["nonce"]; |
167 | 167 | $plugin = $_POST["plugin"]; |
168 | 168 | |
169 | 169 | // Check our nonce, if they don't match then bounce! |
170 | - if (! wp_verify_nonce( $nonce, 'cnkt_installer_nonce' )) |
|
171 | - wp_die( __( 'Error - unable to verify nonce, please try again.', 'framework') ); |
|
170 | + if ( ! wp_verify_nonce($nonce, 'cnkt_installer_nonce')) |
|
171 | + wp_die(__('Error - unable to verify nonce, please try again.', 'framework')); |
|
172 | 172 | |
173 | 173 | |
174 | 174 | // Include required libs for installation |
175 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
176 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
177 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php' ); |
|
178 | - require_once( ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php' ); |
|
175 | + require_once(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
176 | + require_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
177 | + require_once(ABSPATH.'wp-admin/includes/class-wp-ajax-upgrader-skin.php'); |
|
178 | + require_once(ABSPATH.'wp-admin/includes/class-plugin-upgrader.php'); |
|
179 | 179 | |
180 | 180 | // Get Plugin Info |
181 | - $api = plugins_api( 'plugin_information', |
|
181 | + $api = plugins_api('plugin_information', |
|
182 | 182 | array( |
183 | 183 | 'slug' => $plugin, |
184 | 184 | 'fields' => array( |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | ); |
200 | 200 | |
201 | 201 | $skin = new WP_Ajax_Upgrader_Skin(); |
202 | - $upgrader = new Plugin_Upgrader( $skin ); |
|
202 | + $upgrader = new Plugin_Upgrader($skin); |
|
203 | 203 | $upgrader->install($api->download_link); |
204 | 204 | |
205 | - if($api->name){ |
|
205 | + if ($api->name) { |
|
206 | 206 | $status = 'success'; |
207 | - $msg = $api->name .' successfully installed.'; |
|
207 | + $msg = $api->name.' successfully installed.'; |
|
208 | 208 | } else { |
209 | 209 | $status = 'failed'; |
210 | - $msg = 'There was an error installing '. $api->name .'.'; |
|
210 | + $msg = 'There was an error installing '.$api->name.'.'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $json = array( |
@@ -230,26 +230,26 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @since 1.0 |
232 | 232 | */ |
233 | - public function cnkt_plugin_activation(){ |
|
234 | - if ( ! current_user_can('install_plugins') ) |
|
235 | - wp_die( __( 'Sorry, you are not allowed to activate plugins on this site.', 'framework' ) ); |
|
233 | + public function cnkt_plugin_activation() { |
|
234 | + if ( ! current_user_can('install_plugins')) |
|
235 | + wp_die(__('Sorry, you are not allowed to activate plugins on this site.', 'framework')); |
|
236 | 236 | |
237 | 237 | $nonce = $_POST["nonce"]; |
238 | 238 | $plugin = $_POST["plugin"]; |
239 | 239 | |
240 | 240 | // Check our nonce, if they don't match then bounce! |
241 | - if (! wp_verify_nonce( $nonce, 'cnkt_installer_nonce' )) |
|
242 | - die( __( 'Error - unable to verify nonce, please try again.', 'framework' ) ); |
|
241 | + if ( ! wp_verify_nonce($nonce, 'cnkt_installer_nonce')) |
|
242 | + die(__('Error - unable to verify nonce, please try again.', 'framework')); |
|
243 | 243 | |
244 | 244 | |
245 | 245 | // Include required libs for activation |
246 | - require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); |
|
247 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
248 | - require_once( ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php' ); |
|
246 | + require_once(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
247 | + require_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
248 | + require_once(ABSPATH.'wp-admin/includes/class-plugin-upgrader.php'); |
|
249 | 249 | |
250 | 250 | |
251 | 251 | // Get Plugin Info |
252 | - $api = plugins_api( 'plugin_information', |
|
252 | + $api = plugins_api('plugin_information', |
|
253 | 253 | array( |
254 | 254 | 'slug' => $plugin, |
255 | 255 | 'fields' => array( |
@@ -270,16 +270,16 @@ discard block |
||
270 | 270 | ); |
271 | 271 | |
272 | 272 | |
273 | - if($api->name){ |
|
273 | + if ($api->name) { |
|
274 | 274 | $main_plugin_file = Connekt_Plugin_Installer::get_plugin_file($plugin); |
275 | 275 | $status = 'success'; |
276 | - if($main_plugin_file){ |
|
276 | + if ($main_plugin_file) { |
|
277 | 277 | activate_plugin($main_plugin_file); |
278 | - $msg = $api->name .' successfully activated.'; |
|
278 | + $msg = $api->name.' successfully activated.'; |
|
279 | 279 | } |
280 | 280 | } else { |
281 | 281 | $status = 'failed'; |
282 | - $msg = 'There was an error activating '. $api->name .'.'; |
|
282 | + $msg = 'There was an error activating '.$api->name.'.'; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | $json = array( |
@@ -305,17 +305,17 @@ discard block |
||
305 | 305 | * @since 1.0 |
306 | 306 | */ |
307 | 307 | |
308 | - public static function get_plugin_file( $plugin_slug ) { |
|
309 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); // Load plugin lib |
|
308 | + public static function get_plugin_file($plugin_slug) { |
|
309 | + require_once(ABSPATH.'/wp-admin/includes/plugin.php'); // Load plugin lib |
|
310 | 310 | $plugins = get_plugins(); |
311 | 311 | |
312 | - foreach( $plugins as $plugin_file => $plugin_info ) { |
|
312 | + foreach ($plugins as $plugin_file => $plugin_info) { |
|
313 | 313 | |
314 | 314 | // Get the basename of the plugin e.g. [askismet]/askismet.php |
315 | - $slug = dirname( plugin_basename( $plugin_file ) ); |
|
315 | + $slug = dirname(plugin_basename($plugin_file)); |
|
316 | 316 | |
317 | - if($slug){ |
|
318 | - if ( $slug == $plugin_slug ) { |
|
317 | + if ($slug) { |
|
318 | + if ($slug == $plugin_slug) { |
|
319 | 319 | return $plugin_file; // If $slug = $plugin_name |
320 | 320 | } |
321 | 321 | } |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @since 1.0 |
338 | 338 | */ |
339 | - public static function check_file_extension( $filename ) { |
|
340 | - if( substr( strrchr($filename, '.' ), 1 ) === 'php' ){ |
|
339 | + public static function check_file_extension($filename) { |
|
340 | + if (substr(strrchr($filename, '.'), 1) === 'php') { |
|
341 | 341 | // has .php exension |
342 | 342 | return true; |
343 | 343 | } else { |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 1.0 |
358 | 358 | */ |
359 | - public function enqueue_scripts(){ |
|
360 | - wp_enqueue_script( 'plugin-installer', CNKT_INSTALLER_PATH. 'assets/installer.js', array( 'jquery' )); |
|
361 | - wp_localize_script( 'plugin-installer', 'cnkt_installer_localize', array( |
|
359 | + public function enqueue_scripts() { |
|
360 | + wp_enqueue_script('plugin-installer', CNKT_INSTALLER_PATH.'assets/installer.js', array('jquery')); |
|
361 | + wp_localize_script('plugin-installer', 'cnkt_installer_localize', array( |
|
362 | 362 | 'ajax_url' => admin_url('admin-ajax.php'), |
363 | 363 | 'admin_nonce' => wp_create_nonce('cnkt_installer_nonce'), |
364 | 364 | 'install_now' => __('Are you sure you want to install this plugin?', 'framework'), |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | 'installed_btn' => __('Activated', 'framework') |
368 | 368 | )); |
369 | 369 | |
370 | - wp_enqueue_style( 'plugin-installer', CNKT_INSTALLER_PATH. 'assets/installer.css'); |
|
370 | + wp_enqueue_style('plugin-installer', CNKT_INSTALLER_PATH.'assets/installer.css'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | } |
@@ -9,7 +9,9 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | |
12 | -if (!defined('ABSPATH')) exit; |
|
12 | +if (!defined('ABSPATH')) { |
|
13 | + exit; |
|
14 | +} |
|
13 | 15 | |
14 | 16 | |
15 | 17 | |
@@ -160,15 +162,17 @@ discard block |
||
160 | 162 | */ |
161 | 163 | public function cnkt_plugin_installer(){ |
162 | 164 | |
163 | - if ( ! current_user_can('install_plugins') ) |
|
164 | - wp_die( __( 'Sorry, you are not allowed to install plugins on this site.', 'framework' ) ); |
|
165 | + if ( ! current_user_can('install_plugins') ) { |
|
166 | + wp_die( __( 'Sorry, you are not allowed to install plugins on this site.', 'framework' ) ); |
|
167 | + } |
|
165 | 168 | |
166 | 169 | $nonce = $_POST["nonce"]; |
167 | 170 | $plugin = $_POST["plugin"]; |
168 | 171 | |
169 | 172 | // Check our nonce, if they don't match then bounce! |
170 | - if (! wp_verify_nonce( $nonce, 'cnkt_installer_nonce' )) |
|
171 | - wp_die( __( 'Error - unable to verify nonce, please try again.', 'framework') ); |
|
173 | + if (! wp_verify_nonce( $nonce, 'cnkt_installer_nonce' )) { |
|
174 | + wp_die( __( 'Error - unable to verify nonce, please try again.', 'framework') ); |
|
175 | + } |
|
172 | 176 | |
173 | 177 | |
174 | 178 | // Include required libs for installation |
@@ -231,15 +235,17 @@ discard block |
||
231 | 235 | * @since 1.0 |
232 | 236 | */ |
233 | 237 | public function cnkt_plugin_activation(){ |
234 | - if ( ! current_user_can('install_plugins') ) |
|
235 | - wp_die( __( 'Sorry, you are not allowed to activate plugins on this site.', 'framework' ) ); |
|
238 | + if ( ! current_user_can('install_plugins') ) { |
|
239 | + wp_die( __( 'Sorry, you are not allowed to activate plugins on this site.', 'framework' ) ); |
|
240 | + } |
|
236 | 241 | |
237 | 242 | $nonce = $_POST["nonce"]; |
238 | 243 | $plugin = $_POST["plugin"]; |
239 | 244 | |
240 | 245 | // Check our nonce, if they don't match then bounce! |
241 | - if (! wp_verify_nonce( $nonce, 'cnkt_installer_nonce' )) |
|
242 | - die( __( 'Error - unable to verify nonce, please try again.', 'framework' ) ); |
|
246 | + if (! wp_verify_nonce( $nonce, 'cnkt_installer_nonce' )) { |
|
247 | + die( __( 'Error - unable to verify nonce, please try again.', 'framework' ) ); |
|
248 | + } |
|
243 | 249 | |
244 | 250 | |
245 | 251 | // Include required libs for activation |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Auto_Load_Next_Post_Integrations' ) ) { |
|
19 | +if ( ! class_exists('Auto_Load_Next_Post_Integrations')) { |
|
20 | 20 | |
21 | 21 | class Auto_Load_Next_Post_Integrations { |
22 | 22 | |
@@ -34,15 +34,15 @@ discard block |
||
34 | 34 | * @access public |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - do_action( 'auto_load_next_post_integrations_init' ); |
|
37 | + do_action('auto_load_next_post_integrations_init'); |
|
38 | 38 | |
39 | - $load_integrations = apply_filters( 'auto_load_next_post_integrations', array() ); |
|
39 | + $load_integrations = apply_filters('auto_load_next_post_integrations', array()); |
|
40 | 40 | |
41 | 41 | // Load integration classes. |
42 | - foreach ( $load_integrations as $integration ) { |
|
42 | + foreach ($load_integrations as $integration) { |
|
43 | 43 | $load_integration = new $integration(); |
44 | 44 | |
45 | - $this->integrations[ $load_integration->id ] = $load_integration; |
|
45 | + $this->integrations[$load_integration->id] = $load_integration; |
|
46 | 46 | } |
47 | 47 | } // END __construct() |
48 | 48 |
@@ -10,12 +10,12 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | <div class="block credits"> |
18 | - <h4><?php esc_html_e( 'Created & maintained by', 'auto-load-next-post' ); ?></h4> |
|
18 | + <h4><?php esc_html_e('Created & maintained by', 'auto-load-next-post'); ?></h4> |
|
19 | 19 | <ul> |
20 | 20 | <li> |
21 | 21 | <a href="https://profiles.wordpress.org/sebd86" target="_blank"> |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | ?> |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -$tab_exists = isset( $tabs[ $current_tab ] ) || has_action( 'auto_load_next_post_sections_' . $current_tab ) || has_action( 'auto_load_next_post_settings_' . $current_tab ) || has_action( 'auto_load_next_post_settings_tabs_' . $current_tab ); |
|
19 | -$current_tab_label = isset( $tabs[ $current_tab ] ) ? $tabs[ $current_tab ] : ''; |
|
18 | +$tab_exists = isset($tabs[$current_tab]) || has_action('auto_load_next_post_sections_'.$current_tab) || has_action('auto_load_next_post_settings_'.$current_tab) || has_action('auto_load_next_post_settings_tabs_'.$current_tab); |
|
19 | +$current_tab_label = isset($tabs[$current_tab]) ? $tabs[$current_tab] : ''; |
|
20 | 20 | |
21 | -if ( ! $tab_exists ) { |
|
22 | - wp_safe_redirect( admin_url( 'options-general.php?page=auto-load-next-post-settings' ) ); |
|
21 | +if ( ! $tab_exists) { |
|
22 | + wp_safe_redirect(admin_url('options-general.php?page=auto-load-next-post-settings')); |
|
23 | 23 | exit; |
24 | 24 | } |
25 | 25 | ?> |
@@ -27,30 +27,30 @@ discard block |
||
27 | 27 | <form method="post" id="mainform" action="" enctype="multipart/form-data"> |
28 | 28 | <nav class="nav-tab-wrapper"> |
29 | 29 | <?php |
30 | - foreach ( $tabs as $slug => $label ) { |
|
31 | - echo '<a href="' . esc_html( admin_url( 'options-general.php?page=auto-load-next-post-settings&tab=' . esc_attr( $slug ) ) ) . '" class="nav-tab ' . ( $current_tab === $slug ? 'nav-tab-active' : '' ) . '">' . esc_html( $label ) . '</a>'; |
|
30 | + foreach ($tabs as $slug => $label) { |
|
31 | + echo '<a href="'.esc_html(admin_url('options-general.php?page=auto-load-next-post-settings&tab='.esc_attr($slug))).'" class="nav-tab '.($current_tab === $slug ? 'nav-tab-active' : '').'">'.esc_html($label).'</a>'; |
|
32 | 32 | } |
33 | 33 | |
34 | - do_action( 'auto_load_next_post_settings_tabs' ); |
|
34 | + do_action('auto_load_next_post_settings_tabs'); |
|
35 | 35 | ?> |
36 | 36 | </nav> |
37 | - <h1 class="screen-reader-text"><?php echo esc_html( $current_tab_label ); ?></h1> |
|
37 | + <h1 class="screen-reader-text"><?php echo esc_html($current_tab_label); ?></h1> |
|
38 | 38 | <?php |
39 | - do_action( 'auto_load_next_post_sections_' . $current_tab ); |
|
39 | + do_action('auto_load_next_post_sections_'.$current_tab); |
|
40 | 40 | |
41 | 41 | self::show_messages(); |
42 | 42 | |
43 | - do_action( 'auto_load_next_post_settings_' . $current_tab ); |
|
43 | + do_action('auto_load_next_post_settings_'.$current_tab); |
|
44 | 44 | ?> |
45 | 45 | <p class="submit"> |
46 | - <?php submit_button( esc_attr__( 'Save Changes', 'auto-load-next-post' ), 'button-primary', esc_attr__( 'Save Changes', 'auto-load-next-post' ), false, array( 'id' => 'save' ) ); ?> |
|
47 | - <?php wp_nonce_field( 'auto-load-next-post-settings' ); ?> |
|
46 | + <?php submit_button(esc_attr__('Save Changes', 'auto-load-next-post'), 'button-primary', esc_attr__('Save Changes', 'auto-load-next-post'), false, array('id' => 'save')); ?> |
|
47 | + <?php wp_nonce_field('auto-load-next-post-settings'); ?> |
|
48 | 48 | </p> |
49 | 49 | </form> |
50 | 50 | |
51 | 51 | <div class="alnp-sidebar"> |
52 | 52 | <?php |
53 | - do_action( 'auto_load_next_post_sidebar', $current_tab ); |
|
53 | + do_action('auto_load_next_post_sidebar', $current_tab); |
|
54 | 54 | ?> |
55 | 55 | </div> |
56 | 56 | </div> |
@@ -11,61 +11,61 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | ?> |
18 | 18 | <div class="alnp-upgrade-details"> |
19 | - <h1><?php esc_html_e( 'Pro Coming Soon', 'auto-load-next-post' ); ?></h1> |
|
19 | + <h1><?php esc_html_e('Pro Coming Soon', 'auto-load-next-post'); ?></h1> |
|
20 | 20 | |
21 | 21 | <ul> |
22 | - <li><?php echo wptexturize( esc_html__( 'Load the Next Post or Next Post with same Category or New Posts or Related Posts or by Custom Query', 'auto-load-next-post' ) ); ?></li> |
|
23 | - <li><?php echo wptexturize( esc_html__( 'Page and Media Attachment Support', 'auto-load-next-post' ) ); ?></li> |
|
24 | - <li><?php echo wptexturize( esc_html__( 'Custom Post Type Support', 'auto-load-next-post' ) ); ?></li> |
|
25 | - <li><?php echo wptexturize( esc_html__( 'Paginated Posts Supported', 'auto-load-next-post' ) ); ?></li> |
|
26 | - <li><?php echo wptexturize( esc_html__( 'Exclude Post Formats', 'auto-load-next-post' ) ); ?></li> |
|
27 | - <li><?php echo wptexturize( esc_html__( 'Limit Posts per Session', 'auto-load-next-post' ) ); ?></li> |
|
28 | - <li><?php echo wptexturize( esc_html__( 'Query Posts by Category and Tag', 'auto-load-next-post' ) ); ?></li> |
|
29 | - <li><?php echo wptexturize( esc_html__( 'Exclude User Roles and Specific Users', 'auto-load-next-post' ) ); ?></li> |
|
30 | - <li><?php echo wptexturize( esc_html__( 'Pre-Query Posts Ready to Load', 'auto-load-next-post' ) ); ?></li> |
|
31 | - <li><?php echo wptexturize( esc_html__( 'Hide Comments and Show by Toggle Button', 'auto-load-next-post' ) ); ?></li> |
|
32 | - <li><?php echo wptexturize( sprintf( esc_html__( 'Multilingual Support for %1$s and %2$s', 'auto-load-next-post' ), 'WPML', 'Polylang' ) ); ?></li> |
|
33 | - <li><?php echo wptexturize( esc_html__( 'Email Support', 'auto-load-next-post' ) ); ?></li> |
|
22 | + <li><?php echo wptexturize(esc_html__('Load the Next Post or Next Post with same Category or New Posts or Related Posts or by Custom Query', 'auto-load-next-post')); ?></li> |
|
23 | + <li><?php echo wptexturize(esc_html__('Page and Media Attachment Support', 'auto-load-next-post')); ?></li> |
|
24 | + <li><?php echo wptexturize(esc_html__('Custom Post Type Support', 'auto-load-next-post')); ?></li> |
|
25 | + <li><?php echo wptexturize(esc_html__('Paginated Posts Supported', 'auto-load-next-post')); ?></li> |
|
26 | + <li><?php echo wptexturize(esc_html__('Exclude Post Formats', 'auto-load-next-post')); ?></li> |
|
27 | + <li><?php echo wptexturize(esc_html__('Limit Posts per Session', 'auto-load-next-post')); ?></li> |
|
28 | + <li><?php echo wptexturize(esc_html__('Query Posts by Category and Tag', 'auto-load-next-post')); ?></li> |
|
29 | + <li><?php echo wptexturize(esc_html__('Exclude User Roles and Specific Users', 'auto-load-next-post')); ?></li> |
|
30 | + <li><?php echo wptexturize(esc_html__('Pre-Query Posts Ready to Load', 'auto-load-next-post')); ?></li> |
|
31 | + <li><?php echo wptexturize(esc_html__('Hide Comments and Show by Toggle Button', 'auto-load-next-post')); ?></li> |
|
32 | + <li><?php echo wptexturize(sprintf(esc_html__('Multilingual Support for %1$s and %2$s', 'auto-load-next-post'), 'WPML', 'Polylang')); ?></li> |
|
33 | + <li><?php echo wptexturize(esc_html__('Email Support', 'auto-load-next-post')); ?></li> |
|
34 | 34 | </ul> |
35 | 35 | |
36 | 36 | <p> |
37 | - <a href="https://autoloadnextpost.com/pro/?utm_source=plugin&utm_medium=link&utm_campaign=alnp-settings-page"><?php esc_html_e( 'Visit autoloadnextpost.com →', 'auto-load-next-post' ); ?></a> |
|
37 | + <a href="https://autoloadnextpost.com/pro/?utm_source=plugin&utm_medium=link&utm_campaign=alnp-settings-page"><?php esc_html_e('Visit autoloadnextpost.com →', 'auto-load-next-post'); ?></a> |
|
38 | 38 | </p> |
39 | 39 | |
40 | 40 | </div> |
41 | 41 | |
42 | 42 | <form method="post" action="https://sebastiendumont.us1.list-manage.com/subscribe/post?u=48ead612ad85b23fe2239c6e3&id=79e97b5275" name="mc-embedded-subscribe-form" target="_blank" class="subscribe block"> |
43 | - <h2><?php esc_html_e( 'Sign up to pre-order first', 'auto-load-next-post' ); ?></h2> |
|
43 | + <h2><?php esc_html_e('Sign up to pre-order first', 'auto-load-next-post'); ?></h2> |
|
44 | 44 | |
45 | 45 | <p class="intro"> |
46 | - <?php echo wptexturize( esc_html__( 'Submit your name and email and be the first to know when you can pre-order Auto Load Next Post Pro and keep up to date with my developments plus a 10% discount.', 'auto-load-next-post' ) ); ?> |
|
46 | + <?php echo wptexturize(esc_html__('Submit your name and email and be the first to know when you can pre-order Auto Load Next Post Pro and keep up to date with my developments plus a 10% discount.', 'auto-load-next-post')); ?> |
|
47 | 47 | </p> |
48 | 48 | |
49 | 49 | <div class="field"> |
50 | - <input type="email" name="EMAIL" value="" placeholder="<?php esc_html_e( 'Your Email Address', 'auto-load-next-post' ); ?>"/> |
|
50 | + <input type="email" name="EMAIL" value="" placeholder="<?php esc_html_e('Your Email Address', 'auto-load-next-post'); ?>"/> |
|
51 | 51 | </div> |
52 | 52 | |
53 | 53 | <div class="field"> |
54 | - <input type="text" name="FNAME" value="" placeholder="<?php esc_html_e( 'First Name', 'auto-load-next-post' ); ?>"/> |
|
54 | + <input type="text" name="FNAME" value="" placeholder="<?php esc_html_e('First Name', 'auto-load-next-post'); ?>"/> |
|
55 | 55 | </div> |
56 | 56 | |
57 | 57 | <div class="field"> |
58 | - <input type="text" name="LNAME" value="" placeholder="<?php esc_html_e( 'Last Name', 'auto-load-next-post' ); ?>"/> |
|
58 | + <input type="text" name="LNAME" value="" placeholder="<?php esc_html_e('Last Name', 'auto-load-next-post'); ?>"/> |
|
59 | 59 | </div> |
60 | 60 | |
61 | 61 | <input type="hidden" name="group[35169][1]" value="1"> |
62 | 62 | |
63 | 63 | <div class="field submit-button"> |
64 | 64 | <div style="position: absolute; left: -9999px;" aria-hidden="true"><input type="text" name="b_48ead612ad85b23fe2239c6e3_79e97b5275" tabindex="-1" value=""></div> |
65 | - <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_html_e( 'Sign me up', 'auto-load-next-post' ); ?>"/> |
|
65 | + <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" value="<?php esc_html_e('Sign me up', 'auto-load-next-post'); ?>"/> |
|
66 | 66 | </div> |
67 | 67 | |
68 | 68 | <p class="promise"> |
69 | - <?php esc_html_e( 'I promise I will not use your email for anything else and you can unsubscribe with 1-click anytime.', 'auto-load-next-post' ); ?> |
|
69 | + <?php esc_html_e('I promise I will not use your email for anything else and you can unsubscribe with 1-click anytime.', 'auto-load-next-post'); ?> |
|
70 | 70 | </p> |
71 | 71 | </form> |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Auto_Load_Next_Post_Settings_Misc_Tab' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Misc_Tab')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Settings_Misc_Tab extends Auto_Load_Next_Post_Settings_Page { |
21 | 21 | |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | 32 | $this->id = 'misc'; |
33 | - $this->label = esc_html__( 'Misc', 'auto-load-next-post' ); |
|
33 | + $this->label = esc_html__('Misc', 'auto-load-next-post'); |
|
34 | 34 | |
35 | 35 | parent::__construct(); |
36 | 36 | |
37 | - add_filter( 'auto_load_next_post_misc_settings', array( __CLASS__, 'lock_js_in_footer' ), 0, 1 ); |
|
38 | - add_action( 'auto_load_next_post_sections_misc', array( __CLASS__, 'no_comment_selector_set' ), 10 ); |
|
37 | + add_filter('auto_load_next_post_misc_settings', array(__CLASS__, 'lock_js_in_footer'), 0, 1); |
|
38 | + add_action('auto_load_next_post_sections_misc', array(__CLASS__, 'no_comment_selector_set'), 10); |
|
39 | 39 | } // END __construct() |
40 | 40 | |
41 | 41 | /** |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * @since 1.5.0 |
47 | 47 | */ |
48 | 48 | public static function no_comment_selector_set() { |
49 | - $comments_container = get_option( 'auto_load_next_post_comments_container' ); |
|
50 | - $remove_comments = get_option( 'auto_load_next_post_remove_comments' ); |
|
49 | + $comments_container = get_option('auto_load_next_post_comments_container'); |
|
50 | + $remove_comments = get_option('auto_load_next_post_remove_comments'); |
|
51 | 51 | |
52 | - if ( empty( $comments_container ) && ! empty( $remove_comments ) ) { |
|
53 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-no-comment-selector.php' ); |
|
52 | + if (empty($comments_container) && ! empty($remove_comments)) { |
|
53 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-no-comment-selector.php'); |
|
54 | 54 | } |
55 | 55 | } // END no_comment_selector_set() |
56 | 56 | |
@@ -66,19 +66,19 @@ discard block |
||
66 | 66 | * @param array $settings |
67 | 67 | * @return array $settings |
68 | 68 | */ |
69 | - public static function lock_js_in_footer( $settings ) { |
|
70 | - $js_locked_in_footer = get_option( 'auto_load_next_post_lock_js_in_footer' ); |
|
69 | + public static function lock_js_in_footer($settings) { |
|
70 | + $js_locked_in_footer = get_option('auto_load_next_post_lock_js_in_footer'); |
|
71 | 71 | |
72 | - if ( !empty( $js_locked_in_footer ) && $js_locked_in_footer == 'yes' ) { |
|
72 | + if ( ! empty($js_locked_in_footer) && $js_locked_in_footer == 'yes') { |
|
73 | 73 | // Setting key to look for. |
74 | 74 | $key = 'load_js_in_footer'; |
75 | 75 | |
76 | 76 | // Find the setting. |
77 | - $find_setting = array_search( $key, $settings ); |
|
77 | + $find_setting = array_search($key, $settings); |
|
78 | 78 | |
79 | 79 | // Does the setting exist? |
80 | - if ( is_bool( $find_setting ) === true ) { |
|
81 | - unset( $settings[$key] ); |
|
80 | + if (is_bool($find_setting) === true) { |
|
81 | + unset($settings[$key]); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
@@ -99,45 +99,45 @@ discard block |
||
99 | 99 | 'title' => array( |
100 | 100 | 'title' => $this->label, |
101 | 101 | 'type' => 'title', |
102 | - 'desc' => sprintf( esc_html__( 'Here you set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
102 | + 'desc' => sprintf(esc_html__('Here you set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
103 | 103 | 'id' => 'misc_options' |
104 | 104 | ), |
105 | 105 | |
106 | 106 | 'remove_comments' => array( |
107 | - 'title' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
|
108 | - 'desc' => esc_html__( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ), |
|
107 | + 'title' => esc_html__('Remove Comments', 'auto-load-next-post'), |
|
108 | + 'desc' => esc_html__('Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post'), |
|
109 | 109 | 'id' => 'auto_load_next_post_remove_comments', |
110 | 110 | 'default' => 'yes', |
111 | 111 | 'type' => 'checkbox' |
112 | 112 | ), |
113 | 113 | |
114 | 114 | 'google_analytics' => array( |
115 | - 'title' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
|
116 | - 'desc' => esc_html__( 'Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post' ), |
|
115 | + 'title' => esc_html__('Update Google Analytics', 'auto-load-next-post'), |
|
116 | + 'desc' => esc_html__('Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post'), |
|
117 | 117 | 'id' => 'auto_load_next_post_google_analytics', |
118 | 118 | 'default' => 'no', |
119 | 119 | 'type' => 'checkbox' |
120 | 120 | ), |
121 | 121 | |
122 | 122 | 'load_js_in_footer' => array( |
123 | - 'title' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
|
124 | - 'desc' => esc_html__( 'Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site or if the current theme requires it.', 'auto-load-next-post' ), |
|
123 | + 'title' => esc_html__('JavaScript in Footer?', 'auto-load-next-post'), |
|
124 | + 'desc' => esc_html__('Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site or if the current theme requires it.', 'auto-load-next-post'), |
|
125 | 125 | 'id' => 'auto_load_next_post_load_js_in_footer', |
126 | 126 | 'default' => 'no', |
127 | 127 | 'type' => 'checkbox' |
128 | 128 | ), |
129 | 129 | |
130 | 130 | 'reset_data' => array( |
131 | - 'title' => esc_html__( 'Reset all data?', 'auto-load-next-post' ), |
|
132 | - 'desc' => esc_html__( 'Press the reset button to clear all settings for this plugin and re-install the default settings.', 'auto-load-next-post' ), |
|
131 | + 'title' => esc_html__('Reset all data?', 'auto-load-next-post'), |
|
132 | + 'desc' => esc_html__('Press the reset button to clear all settings for this plugin and re-install the default settings.', 'auto-load-next-post'), |
|
133 | 133 | 'id' => 'auto_load_next_post_reset_data', |
134 | 134 | 'default' => 'no', |
135 | 135 | 'type' => 'reset_data' |
136 | 136 | ), |
137 | 137 | |
138 | 138 | 'uninstall' => array( |
139 | - 'title' => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ), |
|
140 | - 'desc' => esc_html__( 'If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post' ), |
|
139 | + 'title' => esc_html__('Remove all data on uninstall?', 'auto-load-next-post'), |
|
140 | + 'desc' => esc_html__('If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post'), |
|
141 | 141 | 'id' => 'auto_load_next_post_uninstall_data', |
142 | 142 | 'default' => 'no', |
143 | 143 | 'type' => 'checkbox' |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | * @since 1.5.0 |
158 | 158 | * @param mixed $settings |
159 | 159 | */ |
160 | - public function customize_button( $settings ) { |
|
160 | + public function customize_button($settings) { |
|
161 | 161 | ?> |
162 | 162 | <tr valign="top"> |
163 | - <th scope="row" class="titledesc"><?php echo $settings['title'];?></th> |
|
164 | - <td class="forminp forminp-<?php echo sanitize_title( $settings['type'] ) ?>"> |
|
165 | - <a href="<?php echo $settings['link']; ?>" class="button-secondary <?php echo esc_attr( $settings['class'] ); ?>"> |
|
163 | + <th scope="row" class="titledesc"><?php echo $settings['title']; ?></th> |
|
164 | + <td class="forminp forminp-<?php echo sanitize_title($settings['type']) ?>"> |
|
165 | + <a href="<?php echo $settings['link']; ?>" class="button-secondary <?php echo esc_attr($settings['class']); ?>"> |
|
166 | 166 | <?php echo $settings['button_text']; ?> |
167 | 167 | </a> |
168 | - <span class="description"><?php echo $settings['desc'];?></span> |
|
168 | + <span class="description"><?php echo $settings['desc']; ?></span> |
|
169 | 169 | </td> |
170 | 170 | </tr> |
171 | 171 | <?php |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | public function output() { |
183 | 183 | $settings = $this->get_settings(); |
184 | 184 | |
185 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
185 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
186 | 186 | } // END output() |
187 | 187 | |
188 | 188 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | public function save() { |
195 | 195 | $settings = $this->get_settings(); |
196 | 196 | |
197 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings ); |
|
197 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings); |
|
198 | 198 | } // END save() |
199 | 199 | |
200 | 200 | } // END class |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | * @license GPL-2.0+ |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined('ABSPATH') ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; // Exit if accessed directly. |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'Auto_Load_Next_Post_Settings_Page' ) ) { |
|
17 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Page')) { |
|
18 | 18 | |
19 | 19 | abstract class Auto_Load_Next_Post_Settings_Page { |
20 | 20 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @version 1.6.0 |
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | - add_filter( 'auto_load_next_post_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
46 | - add_action( 'auto_load_next_post_settings_' . $this->id, array( $this, 'need_help' ), 0 ); |
|
47 | - add_action( 'auto_load_next_post_sections_' . $this->id, array( $this, 'output_sections' ) ); |
|
48 | - add_action( 'auto_load_next_post_settings_' . $this->id, array( $this, 'output' ), 10 ); |
|
49 | - add_action( 'auto_load_next_post_settings_save_' . $this->id, array( $this, 'save' ) ); |
|
45 | + add_filter('auto_load_next_post_settings_tabs_array', array($this, 'add_settings_page'), 20); |
|
46 | + add_action('auto_load_next_post_settings_'.$this->id, array($this, 'need_help'), 0); |
|
47 | + add_action('auto_load_next_post_sections_'.$this->id, array($this, 'output_sections')); |
|
48 | + add_action('auto_load_next_post_settings_'.$this->id, array($this, 'output'), 10); |
|
49 | + add_action('auto_load_next_post_settings_save_'.$this->id, array($this, 'save')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param array $pages |
80 | 80 | * @return array $pages |
81 | 81 | */ |
82 | - public function add_settings_page( $pages ) { |
|
82 | + public function add_settings_page($pages) { |
|
83 | 83 | $pages[$this->id] = $this->label; |
84 | 84 | |
85 | 85 | return $pages; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param array $pages |
94 | 94 | * @return array $pages |
95 | 95 | */ |
96 | - public function add_menu_page( $pages ) { |
|
96 | + public function add_menu_page($pages) { |
|
97 | 97 | $pages[$this->id] = $this->label; |
98 | 98 | |
99 | 99 | return $pages; |
@@ -133,16 +133,16 @@ discard block |
||
133 | 133 | |
134 | 134 | $sections = $this->get_sections(); |
135 | 135 | |
136 | - if ( empty( $sections ) || 1 === sizeof( $sections ) ) { |
|
136 | + if (empty($sections) || 1 === sizeof($sections)) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | 140 | echo '<ul class="subsubsub">'; |
141 | 141 | |
142 | - $array_keys = array_keys( $sections ); |
|
142 | + $array_keys = array_keys($sections); |
|
143 | 143 | |
144 | - foreach ( $sections as $id => $label ) { |
|
145 | - echo '<li><a href="' . admin_url( 'options-general.php?page=auto-load-next-post-settings&tab=' . $this->id . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
144 | + foreach ($sections as $id => $label) { |
|
145 | + echo '<li><a href="'.admin_url('options-general.php?page=auto-load-next-post-settings&tab='.$this->id.'§ion='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | echo '</ul><br class="clear" />'; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | public function output() { |
158 | 158 | $settings = $this->get_settings(); |
159 | 159 | |
160 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
160 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
161 | 161 | } // END output() |
162 | 162 | |
163 | 163 | /** |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | |
174 | 174 | $settings = $this->get_settings(); |
175 | 175 | |
176 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings ); |
|
176 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings); |
|
177 | 177 | |
178 | - if ( $current_section ) { |
|
179 | - do_action( 'auto_load_next_post_update_options_' . $this->id . '_' . $current_section ); |
|
178 | + if ($current_section) { |
|
179 | + do_action('auto_load_next_post_update_options_'.$this->id.'_'.$current_section); |
|
180 | 180 | } |
181 | 181 | } // END save() |
182 | 182 | |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | global $current_tab; |
195 | 195 | |
196 | 196 | // If theme is already supported then don't show help button for theme selectors. |
197 | - if ( is_alnp_supported() && $current_tab == 'theme-selectors' ) { |
|
197 | + if (is_alnp_supported() && $current_tab == 'theme-selectors') { |
|
198 | 198 | return; |
199 | 199 | } |
200 | 200 | |
201 | - echo '<a href="#" class="need-help trigger-help" data-tab="' . $current_tab . '"><span class="sonar-dot"></span> ' . esc_html( 'Need Help?', 'auto-load-next-post' ) . '</a>'; |
|
201 | + echo '<a href="#" class="need-help trigger-help" data-tab="'.$current_tab.'"><span class="sonar-dot"></span> '.esc_html('Need Help?', 'auto-load-next-post').'</a>'; |
|
202 | 202 | } // END need_help() |
203 | 203 | |
204 | 204 | } // END class |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Auto_Load_Next_Post_Extensions' ) ) { |
|
19 | +if ( ! class_exists('Auto_Load_Next_Post_Extensions')) { |
|
20 | 20 | |
21 | 21 | class Auto_Load_Next_Post_Extensions { |
22 | 22 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | 37 | $this->id = 'extensions'; |
38 | - $this->label = esc_html__( 'Extensions', 'auto-load-next-post' ); |
|
38 | + $this->label = esc_html__('Extensions', 'auto-load-next-post'); |
|
39 | 39 | |
40 | 40 | // Below are extensions hosted on WordPress.org |
41 | 41 | self::$extensions = array( |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | |
47 | - include_once( AUTO_LOAD_NEXT_POST_FILE_PATH . '/vendor/connekt-plugin-installer/class-connekt-plugin-installer.php'); // Plugin Installer |
|
47 | + include_once(AUTO_LOAD_NEXT_POST_FILE_PATH.'/vendor/connekt-plugin-installer/class-connekt-plugin-installer.php'); // Plugin Installer |
|
48 | 48 | |
49 | - add_filter( 'auto_load_next_post_settings_tabs_array', array( $this, 'add_extensions_page' ), 99 ); |
|
50 | - add_action( 'auto_load_next_post_settings_end', array( $this, 'output' ), 10, 2 ); |
|
49 | + add_filter('auto_load_next_post_settings_tabs_array', array($this, 'add_extensions_page'), 99); |
|
50 | + add_action('auto_load_next_post_settings_end', array($this, 'output'), 10, 2); |
|
51 | 51 | } // END __construct() |
52 | 52 | |
53 | 53 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param array $pages |
58 | 58 | * @return array $pages |
59 | 59 | */ |
60 | - public function add_extensions_page( $pages ) { |
|
60 | + public function add_extensions_page($pages) { |
|
61 | 61 | $pages[$this->id] = $this->label; |
62 | 62 | |
63 | 63 | return $pages; |
@@ -70,30 +70,30 @@ discard block |
||
70 | 70 | * @param string $current_tab |
71 | 71 | * @param array $tabs |
72 | 72 | */ |
73 | - public function output( $current_tab, $tabs ) { |
|
74 | - if ( $current_tab !== 'extensions' ) { |
|
73 | + public function output($current_tab, $tabs) { |
|
74 | + if ($current_tab !== 'extensions') { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | - $tab_exists = isset( $tabs[ $current_tab ] ) || has_action( 'auto_load_next_post_sections_' . $current_tab ) || has_action( 'auto_load_next_post_settings_' . $current_tab ) || has_action( 'auto_load_next_post_settings_tabs_' . $current_tab ); |
|
79 | - $current_tab_label = isset( $tabs[ $current_tab ] ) ? $tabs[ $current_tab ] : ''; |
|
78 | + $tab_exists = isset($tabs[$current_tab]) || has_action('auto_load_next_post_sections_'.$current_tab) || has_action('auto_load_next_post_settings_'.$current_tab) || has_action('auto_load_next_post_settings_tabs_'.$current_tab); |
|
79 | + $current_tab_label = isset($tabs[$current_tab]) ? $tabs[$current_tab] : ''; |
|
80 | 80 | ?> |
81 | 81 | <div class="wrap auto-load-next-post"> |
82 | 82 | <nav class="nav-tab-wrapper"> |
83 | 83 | <?php |
84 | - foreach ( $tabs as $slug => $label ) { |
|
85 | - echo '<a href="' . esc_html( admin_url( 'options-general.php?page=auto-load-next-post-settings&tab=' . esc_attr( $slug ) ) ) . '" class="nav-tab ' . ( $current_tab === $slug ? 'nav-tab-active' : '' ) . '">' . esc_html( $label ) . '</a>'; |
|
84 | + foreach ($tabs as $slug => $label) { |
|
85 | + echo '<a href="'.esc_html(admin_url('options-general.php?page=auto-load-next-post-settings&tab='.esc_attr($slug))).'" class="nav-tab '.($current_tab === $slug ? 'nav-tab-active' : '').'">'.esc_html($label).'</a>'; |
|
86 | 86 | } |
87 | 87 | |
88 | - do_action( 'auto_load_next_post_settings_tabs' ); |
|
88 | + do_action('auto_load_next_post_settings_tabs'); |
|
89 | 89 | ?> |
90 | 90 | </nav> |
91 | - <h1 class="screen-reader-text"><?php echo esc_html( $current_tab_label ); ?></h1> |
|
91 | + <h1 class="screen-reader-text"><?php echo esc_html($current_tab_label); ?></h1> |
|
92 | 92 | </div> |
93 | 93 | |
94 | 94 | <?php |
95 | - if ( class_exists( 'Connekt_Plugin_Installer' ) ) { |
|
96 | - Connekt_Plugin_Installer::init( self::$extensions ); |
|
95 | + if (class_exists('Connekt_Plugin_Installer')) { |
|
96 | + Connekt_Plugin_Installer::init(self::$extensions); |
|
97 | 97 | } |
98 | 98 | } // END output() |
99 | 99 |