@@ -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 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * The main instance of the plugin. |
27 | 27 | */ |
28 | -if ( ! class_exists( 'Auto_Load_Next_Post' ) ) { |
|
28 | +if ( ! class_exists('Auto_Load_Next_Post')) { |
|
29 | 29 | |
30 | 30 | class Auto_Load_Next_Post { |
31 | 31 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return Auto_Load_Next_Post Single instance. |
60 | 60 | */ |
61 | 61 | public static function instance() { |
62 | - if ( is_null( self::$_instance ) ) { |
|
62 | + if (is_null(self::$_instance)) { |
|
63 | 63 | self::$_instance = new self(); |
64 | 64 | } |
65 | 65 | return self::$_instance; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function __clone() { |
76 | 76 | // Cloning instances of the class is forbidden |
77 | - _doing_it_wrong( __FUNCTION__, __( 'Cloning this object is forbidden.', 'auto-load-next-post' ), self::$version ); |
|
77 | + _doing_it_wrong(__FUNCTION__, __('Cloning this object is forbidden.', 'auto-load-next-post'), self::$version); |
|
78 | 78 | } // END __clone() |
79 | 79 | |
80 | 80 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | public function __wakeup() { |
88 | - _doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'auto-load-next-post' ), self::$version ); |
|
88 | + _doing_it_wrong(__FUNCTION__, __('Unserializing instances of this class is forbidden.', 'auto-load-next-post'), self::$version); |
|
89 | 89 | } // END __wakeup() |
90 | 90 | |
91 | 91 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Auto Load Next Post is fully loaded. |
106 | 106 | */ |
107 | - do_action( 'auto_load_next_post_loaded' ); |
|
107 | + do_action('auto_load_next_post_loaded'); |
|
108 | 108 | } // END __construct() |
109 | 109 | |
110 | 110 | /** |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function init_hooks() { |
117 | 117 | // Load translation files. |
118 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
118 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
119 | 119 | |
120 | 120 | // Load Auto Load Next Post scripts on the frontend. |
121 | - add_action( 'wp_enqueue_scripts', array( $this, 'alnp_enqueue_scripts' ) ); |
|
121 | + add_action('wp_enqueue_scripts', array($this, 'alnp_enqueue_scripts')); |
|
122 | 122 | } // END init_hooks() |
123 | 123 | |
124 | 124 | /** |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | $this->define('AUTO_LOAD_NEXT_POST_FILE', __FILE__); |
134 | 134 | $this->define('AUTO_LOAD_NEXT_POST_SLUG', 'auto-load-next-post'); |
135 | 135 | |
136 | - $this->define('AUTO_LOAD_NEXT_POST_URL_PATH', untrailingslashit( plugins_url( '/', __FILE__ ) ) ); |
|
137 | - $this->define('AUTO_LOAD_NEXT_POST_FILE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
|
136 | + $this->define('AUTO_LOAD_NEXT_POST_URL_PATH', untrailingslashit(plugins_url('/', __FILE__))); |
|
137 | + $this->define('AUTO_LOAD_NEXT_POST_FILE_PATH', untrailingslashit(plugin_dir_path(__FILE__))); |
|
138 | 138 | $this->define('AUTO_LOAD_NEXT_POST_TEMPLATE_PATH', 'auto-load-next-post/'); |
139 | 139 | |
140 | 140 | $this->define('AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE', '4.4'); |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @access private |
159 | 159 | * @since 1.4.3 |
160 | 160 | */ |
161 | - private function define( $name, $value ) { |
|
162 | - if ( ! defined( $name ) ) { |
|
163 | - define( $name, $value ); |
|
161 | + private function define($name, $value) { |
|
162 | + if ( ! defined($name)) { |
|
163 | + define($name, $value); |
|
164 | 164 | } |
165 | 165 | } // END define() |
166 | 166 | |
@@ -173,26 +173,26 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function includes() { |
176 | - include_once( dirname( __FILE__ ) . '/includes/class-alnp-autoloader.php' ); // Autoloader. |
|
177 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-conditional-functions.php' ); // Conditional functions. |
|
178 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-formatting-functions.php' ); // Formatting functions. |
|
179 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-themes-supported.php' ); // Handles all supported themes out of the box. |
|
180 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-core-functions.php' ); // Contains core functions for the front/back end. |
|
176 | + include_once(dirname(__FILE__).'/includes/class-alnp-autoloader.php'); // Autoloader. |
|
177 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-conditional-functions.php'); // Conditional functions. |
|
178 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-formatting-functions.php'); // Formatting functions. |
|
179 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-themes-supported.php'); // Handles all supported themes out of the box. |
|
180 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
181 | 181 | |
182 | 182 | // Include theme support. |
183 | 183 | alnp_include_theme_support(); |
184 | 184 | |
185 | 185 | // Customizer. |
186 | - include_once( dirname( __FILE__ ) . '/includes/customizer/class-alnp-customizer.php' ); |
|
187 | - include_once( dirname( __FILE__ ) . '/includes/customizer/class-alnp-customizer-scripts.php' ); |
|
186 | + include_once(dirname(__FILE__).'/includes/customizer/class-alnp-customizer.php'); |
|
187 | + include_once(dirname(__FILE__).'/includes/customizer/class-alnp-customizer-scripts.php'); |
|
188 | 188 | |
189 | 189 | // Include admin class to handle all back-end functions. |
190 | - if ( is_admin() ) { |
|
191 | - include_once( dirname( __FILE__ ) . '/includes/admin/class-alnp-admin.php' ); // Admin section. |
|
190 | + if (is_admin()) { |
|
191 | + include_once(dirname(__FILE__).'/includes/admin/class-alnp-admin.php'); // Admin section. |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | // Install. |
195 | - require_once( dirname( __FILE__ ) . '/includes/class-alnp-install.php' ); |
|
195 | + require_once(dirname(__FILE__).'/includes/class-alnp-install.php'); |
|
196 | 196 | } // END includes() |
197 | 197 | |
198 | 198 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return void |
208 | 208 | */ |
209 | 209 | public function load_plugin_textdomain() { |
210 | - load_plugin_textdomain( 'auto-load-next-post', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
210 | + load_plugin_textdomain('auto-load-next-post', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
211 | 211 | } // END load_plugin_textdomain() |
212 | 212 | |
213 | 213 | /** |
@@ -219,32 +219,32 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function alnp_enqueue_scripts() { |
221 | 221 | // Load the Javascript if found as a singluar post and the user is not a bot. |
222 | - if ( !alnp_is_bot() && is_singular() && get_post_type() == 'post' ) { |
|
222 | + if ( ! alnp_is_bot() && is_singular() && get_post_type() == 'post') { |
|
223 | 223 | // This helps the plugin decide to load the JavaScript in the footer or not. |
224 | - $load_in_footer = get_option( 'auto_load_next_post_js_footer' ); |
|
224 | + $load_in_footer = get_option('auto_load_next_post_js_footer'); |
|
225 | 225 | |
226 | - $this->load_file( 'auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy.min.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer ); |
|
226 | + $this->load_file('auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy.min.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer); |
|
227 | 227 | |
228 | 228 | // Only load History.js when not in the customizer. |
229 | - if ( ! is_customize_preview() ) { |
|
230 | - $this->load_file( 'auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer ); |
|
229 | + if ( ! is_customize_preview()) { |
|
230 | + $this->load_file('auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer); |
|
231 | 231 | } |
232 | 232 | |
233 | - $this->load_file( 'auto-load-next-post-script', '/assets/js/frontend/auto-load-next-post' . AUTO_LOAD_NEXT_POST_DEBUG_MODE.AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('auto-load-next-post-scrollspy'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer ); |
|
233 | + $this->load_file('auto-load-next-post-script', '/assets/js/frontend/auto-load-next-post'.AUTO_LOAD_NEXT_POST_DEBUG_MODE.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('auto-load-next-post-scrollspy'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer); |
|
234 | 234 | |
235 | 235 | // Variables for the JavaScript |
236 | - wp_localize_script( 'auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
236 | + wp_localize_script('auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
237 | 237 | 'alnp_version' => AUTO_LOAD_NEXT_POST_VERSION, |
238 | - 'alnp_content_container' => get_option( 'auto_load_next_post_content_container' ), |
|
239 | - 'alnp_title_selector' => get_option( 'auto_load_next_post_title_selector' ), |
|
240 | - 'alnp_navigation_container' => get_option( 'auto_load_next_post_navigation_container' ), |
|
241 | - 'alnp_comments_container' => get_option( 'auto_load_next_post_comments_container' ), |
|
242 | - 'alnp_remove_comments' => get_option( 'auto_load_next_post_remove_comments' ), |
|
243 | - 'alnp_google_analytics' => get_option( 'auto_load_next_post_google_analytics' ), |
|
244 | - 'alnp_event_on_load' => get_option( 'auto_load_next_post_on_load_event' ), |
|
245 | - 'alnp_event_on_entering' => get_option( 'auto_load_next_post_on_entering_event' ), |
|
238 | + 'alnp_content_container' => get_option('auto_load_next_post_content_container'), |
|
239 | + 'alnp_title_selector' => get_option('auto_load_next_post_title_selector'), |
|
240 | + 'alnp_navigation_container' => get_option('auto_load_next_post_navigation_container'), |
|
241 | + 'alnp_comments_container' => get_option('auto_load_next_post_comments_container'), |
|
242 | + 'alnp_remove_comments' => get_option('auto_load_next_post_remove_comments'), |
|
243 | + 'alnp_google_analytics' => get_option('auto_load_next_post_google_analytics'), |
|
244 | + 'alnp_event_on_load' => get_option('auto_load_next_post_on_load_event'), |
|
245 | + 'alnp_event_on_entering' => get_option('auto_load_next_post_on_entering_event'), |
|
246 | 246 | 'alnp_is_customizer' => $this->is_alnp_using_customizer(), |
247 | - ) ); |
|
247 | + )); |
|
248 | 248 | } // END if is_singular() && get_post_type() |
249 | 249 | } // END alnp_enqueue_scripts() |
250 | 250 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return string|boolean |
258 | 258 | */ |
259 | 259 | public static function is_alnp_using_customizer() { |
260 | - if ( is_customize_preview() ) { |
|
260 | + if (is_customize_preview()) { |
|
261 | 261 | return "yes"; |
262 | 262 | } |
263 | 263 | |
@@ -279,21 +279,21 @@ discard block |
||
279 | 279 | * @param bool $footer Optional, can set the JavaScript to load in the footer instead. |
280 | 280 | * @global string $wp_version |
281 | 281 | */ |
282 | - public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false ) { |
|
282 | + public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false) { |
|
283 | 283 | global $wp_version; |
284 | 284 | |
285 | - $url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file. |
|
285 | + $url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file. |
|
286 | 286 | |
287 | - if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) { |
|
288 | - if ( $is_script ) { |
|
289 | - if ( !wp_script_is( $name, 'registered' ) ) { |
|
290 | - wp_register_script( $name, $url, $support, $version, $footer ); |
|
291 | - wp_enqueue_script( $name ); |
|
287 | + if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) { |
|
288 | + if ($is_script) { |
|
289 | + if ( ! wp_script_is($name, 'registered')) { |
|
290 | + wp_register_script($name, $url, $support, $version, $footer); |
|
291 | + wp_enqueue_script($name); |
|
292 | 292 | } |
293 | 293 | } else { |
294 | - if ( !wp_style_is( $name, 'registered' ) ) { |
|
295 | - wp_register_style( $name, $url ); |
|
296 | - wp_enqueue_style( $name ); |
|
294 | + if ( ! wp_style_is($name, 'registered')) { |
|
295 | + wp_register_style($name, $url); |
|
296 | + wp_enqueue_style($name); |
|
297 | 297 | } |
298 | 298 | } // end if |
299 | 299 | } // end if |