@@ -46,25 +46,25 @@ discard block |
||
| 46 | 46 | * @param array $requirements Minimum and Recommended version of PHP. |
| 47 | 47 | */ |
| 48 | 48 | public function __construct($plugin = array(), $requirements = array()) { |
| 49 | - if ( is_array($plugin) && !empty($plugin['name']) ) { |
|
| 49 | + if (is_array($plugin) && ! empty($plugin['name'])) { |
|
| 50 | 50 | $this->plugin_name = $plugin['name']; |
| 51 | 51 | } else { |
| 52 | 52 | $this->plugin_name = ''; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if ( is_array($plugin) && !empty($plugin['textdomain']) ) { |
|
| 55 | + if (is_array($plugin) && ! empty($plugin['textdomain'])) { |
|
| 56 | 56 | $this->textdomain = $plugin['textdomain']; |
| 57 | 57 | } else { |
| 58 | 58 | $this->textdomain = 'wpupdatephp'; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if ( is_array($requirements) && !empty($requirements['recommended_version']) ) { |
|
| 61 | + if (is_array($requirements) && ! empty($requirements['recommended_version'])) { |
|
| 62 | 62 | $this->minimum_version = $requirements['minimum_version']; |
| 63 | 63 | } else { |
| 64 | 64 | $this->minimum_version = '5.3.0'; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if ( is_array($requirements) && !empty($requirements['recommended_version']) ) { |
|
| 67 | + if (is_array($requirements) && ! empty($requirements['recommended_version'])) { |
|
| 68 | 68 | $this->recommended_version = $requirements['recommended_version']; |
| 69 | 69 | } else { |
| 70 | 70 | $this->recommended_version = null; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param callable $callback Callable that displays admin notice. |
| 127 | 127 | */ |
| 128 | 128 | private function load_version_notice($callback) { |
| 129 | - if ( is_admin() && ! defined('DOING_AJAX')) { |
|
| 129 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
| 130 | 130 | add_action('admin_notices', $callback); |
| 131 | 131 | add_action('network_admin_notices', $callback); |
| 132 | 132 | } |
@@ -42,11 +42,9 @@ |
||
| 42 | 42 | |
| 43 | 43 | if ( file_exists( $child_path . 'content-partial.php' ) ) { |
| 44 | 44 | include( $child_path . 'content-partial.php' ); |
| 45 | - } |
|
| 46 | - else if( file_exists( $template_path . 'content-partial.php') ) { |
|
| 45 | + } else if( file_exists( $template_path . 'content-partial.php') ) { |
|
| 47 | 46 | include( $template_path . 'content-partial.php' ); |
| 48 | - } |
|
| 49 | - else if( file_exists( $default_path . '/template/content-partial.php' ) ) { |
|
| 47 | + } else if( file_exists( $default_path . '/template/content-partial.php' ) ) { |
|
| 50 | 48 | include( $default_path . '/template/content-partial.php' ); |
| 51 | 49 | } |
| 52 | 50 | |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | // Exit if accessed directly. |
| 16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | +if ( ! defined('ABSPATH')) { |
|
| 17 | 17 | exit; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | // Include core functions |
| 21 | -include( dirname( __FILE__ ) . '/auto-load-next-post-conditional-functions.php'); |
|
| 22 | -include( dirname( __FILE__ ) . '/auto-load-next-post-formatting-functions.php'); |
|
| 21 | +include(dirname(__FILE__).'/auto-load-next-post-conditional-functions.php'); |
|
| 22 | +include(dirname(__FILE__).'/auto-load-next-post-formatting-functions.php'); |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * When the 'partial' endpoint is used on a post, retrieve only the post content. |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | global $wp_query; |
| 33 | 33 | |
| 34 | 34 | // If this is not a request for partial or a singular object then bail |
| 35 | - if ( ! isset( $wp_query->query_vars['partial'] ) || ! is_singular() ) { |
|
| 35 | + if ( ! isset($wp_query->query_vars['partial']) || ! is_singular()) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -41,23 +41,23 @@ discard block |
||
| 41 | 41 | * If theme does not have a template file for Auto Load Next Post, |
| 42 | 42 | * the plugin will load a default template. |
| 43 | 43 | */ |
| 44 | - $child_path = get_stylesheet_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
| 45 | - $template_path = get_template_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
| 44 | + $child_path = get_stylesheet_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
| 45 | + $template_path = get_template_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
| 46 | 46 | $default_path = AUTO_LOAD_NEXT_POST_FILE_PATH; |
| 47 | 47 | |
| 48 | - if ( file_exists( $child_path . 'content-partial.php' ) ) { |
|
| 49 | - include( $child_path . 'content-partial.php' ); |
|
| 48 | + if (file_exists($child_path.'content-partial.php')) { |
|
| 49 | + include($child_path.'content-partial.php'); |
|
| 50 | 50 | } |
| 51 | - else if( file_exists( $template_path . 'content-partial.php') ) { |
|
| 52 | - include( $template_path . 'content-partial.php' ); |
|
| 51 | + else if (file_exists($template_path.'content-partial.php')) { |
|
| 52 | + include($template_path.'content-partial.php'); |
|
| 53 | 53 | } |
| 54 | - else if( file_exists( $default_path . '/template/content-partial.php' ) ) { |
|
| 55 | - include( $default_path . '/template/content-partial.php' ); |
|
| 54 | + else if (file_exists($default_path.'/template/content-partial.php')) { |
|
| 55 | + include($default_path.'/template/content-partial.php'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | exit; |
| 59 | 59 | } |
| 60 | -add_action( 'template_redirect', 'auto_load_next_post_template_redirect' ); |
|
| 60 | +add_action('template_redirect', 'auto_load_next_post_template_redirect'); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Adds the comments template after the post content. |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function auto_load_next_post_comments() { |
| 69 | 69 | // If comments are open or we have at least one comment, load up the comment template. |
| 70 | - if ( comments_open() || get_comments_number() ) : |
|
| 70 | + if (comments_open() || get_comments_number()) : |
|
| 71 | 71 | comments_template(); |
| 72 | 72 | endif; |
| 73 | 73 | } |
| 74 | -add_action( 'alnp_load_after_content', 'auto_load_next_post_comments', 1, 5 ); |
|
| 74 | +add_action('alnp_load_after_content', 'auto_load_next_post_comments', 1, 5); |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * Adds the post navigation for the previous link only after the post content. |
@@ -86,4 +86,4 @@ discard block |
||
| 86 | 86 | </nav> |
| 87 | 87 | <?php |
| 88 | 88 | } |
| 89 | -add_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 ); |
|
| 89 | +add_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10); |
|
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $template_location = apply_filters('alnp_template_location', ''); // e.g. "template-parts/post/" |
| 9 | 9 | |
| 10 | -if ( have_posts() ) : |
|
| 10 | +if (have_posts()) : |
|
| 11 | 11 | |
| 12 | 12 | // Load content before the loop. |
| 13 | 13 | do_action('alnp_load_before_loop'); |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | if (false === $post_format) { |
| 27 | 27 | // Include the standard content.php file. |
| 28 | - get_template_part($template_location . 'content'); |
|
| 28 | + get_template_part($template_location.'content'); |
|
| 29 | 29 | } else { |
| 30 | 30 | // Include the post format content. |
| 31 | - if (locate_template($template_location . 'format-'.$post_format.'.php') != '') { |
|
| 32 | - get_template_part($template_location . 'format', $post_format); |
|
| 31 | + if (locate_template($template_location.'format-'.$post_format.'.php') != '') { |
|
| 32 | + get_template_part($template_location.'format', $post_format); |
|
| 33 | 33 | } else { |
| 34 | 34 | // If no format-{post-format}.php file found then fallback to content-{post-format}.php |
| 35 | - get_template_part($template_location . 'content', $post_format); |
|
| 35 | + get_template_part($template_location.'content', $post_format); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
@@ -48,9 +48,11 @@ |
||
| 48 | 48 | // Load content after the loop. |
| 49 | 49 | do_action('alnp_load_after_loop'); |
| 50 | 50 | |
| 51 | -else : |
|
| 51 | +else { |
|
| 52 | + : |
|
| 52 | 53 | |
| 53 | 54 | // Load content if there are no more posts. |
| 54 | 55 | do_action('alnp_no_more_posts'); |
| 56 | +} |
|
| 55 | 57 | |
| 56 | 58 | endif; // END if have_posts() |
@@ -9,27 +9,27 @@ |
||
| 9 | 9 | * @package Auto Load Next Post |
| 10 | 10 | * @license GPL-2.0+ |
| 11 | 11 | */ |
| 12 | -if ( ! defined( 'ABSPATH' ) || ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH') || ! defined('WP_UNINSTALL_PLUGIN')) { |
|
| 13 | 13 | exit(); // Exit if accessed directly. |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | global $wpdb; |
| 17 | 17 | |
| 18 | 18 | // Make sure it is only a single site we are uninstalling from. |
| 19 | -if ( ! is_multisite() ) { |
|
| 20 | - $uninstall = get_option( 'auto_load_next_post_uninstall_data' ); |
|
| 19 | +if ( ! is_multisite()) { |
|
| 20 | + $uninstall = get_option('auto_load_next_post_uninstall_data'); |
|
| 21 | 21 | |
| 22 | - if ( ! empty( $uninstall ) ) { |
|
| 22 | + if ( ! empty($uninstall)) { |
|
| 23 | 23 | // Delete options |
| 24 | 24 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'auto_load_next_post_%'"); |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | // Delete Install Date |
| 29 | -delete_site_option( 'auto_load_next_post_install_date' ); |
|
| 29 | +delete_site_option('auto_load_next_post_install_date'); |
|
| 30 | 30 | |
| 31 | 31 | // Delete Uninstall Data - Just to double check it has been removed. |
| 32 | -delete_option( 'auto_load_next_post_uninstall_data' ); |
|
| 32 | +delete_option('auto_load_next_post_uninstall_data'); |
|
| 33 | 33 | |
| 34 | 34 | // Clear any cached data that has been removed. |
| 35 | 35 | wp_cache_flush(); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @version 1.4.10 |
| 29 | 29 | */ |
| 30 | -if ( ! class_exists('Auto_Load_Next_Post') ) { |
|
| 30 | +if ( ! class_exists('Auto_Load_Next_Post')) { |
|
| 31 | 31 | |
| 32 | 32 | class Auto_Load_Next_Post { |
| 33 | 33 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @return Auto_Load_Next_Post Single instance. |
| 53 | 53 | */ |
| 54 | 54 | public static function instance() { |
| 55 | - if ( is_null( self::$_instance ) ) { |
|
| 55 | + if (is_null(self::$_instance)) { |
|
| 56 | 56 | self::$_instance = new self(); |
| 57 | 57 | self::$_instance->setup_constants(); |
| 58 | 58 | self::$_instance->includes(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __clone() { |
| 71 | 71 | // Cloning instances of the class is forbidden |
| 72 | - _doing_it_wrong( __FUNCTION__, __( 'Cloning this object is forbidden.', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 72 | + _doing_it_wrong(__FUNCTION__, __('Cloning this object is forbidden.', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 73 | 73 | } // END __clone() |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @return void |
| 81 | 81 | */ |
| 82 | 82 | public function __wakeup() { |
| 83 | - _doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 83 | + _doing_it_wrong(__FUNCTION__, __('Unserializing instances of this class is forbidden.', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 84 | 84 | } // END __wakeup() |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -92,17 +92,17 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function __construct() { |
| 94 | 94 | // Auto-load classes on demand |
| 95 | - if ( function_exists("__autoload") ) { |
|
| 95 | + if (function_exists("__autoload")) { |
|
| 96 | 96 | spl_autoload_register("__autoload"); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
| 99 | + spl_autoload_register(array($this, 'autoload')); |
|
| 100 | 100 | |
| 101 | 101 | // Load translation files. |
| 102 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
| 102 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
| 103 | 103 | |
| 104 | 104 | // Load Auto Load Next Post scripts on the frontend. |
| 105 | - add_action( 'wp_enqueue_scripts', array( $this, 'alnp_scripts' ) ); |
|
| 105 | + add_action('wp_enqueue_scripts', array($this, 'alnp_scripts')); |
|
| 106 | 106 | } // END __construct() |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -113,18 +113,18 @@ discard block |
||
| 113 | 113 | * @param mixed $class |
| 114 | 114 | * @return void |
| 115 | 115 | */ |
| 116 | - public function autoload( $class ) { |
|
| 116 | + public function autoload($class) { |
|
| 117 | 117 | $path = null; |
| 118 | - $file = strtolower( 'class-' . str_replace( '_', '-', $class ) ) . '.php'; |
|
| 118 | + $file = strtolower('class-'.str_replace('_', '-', $class)).'.php'; |
|
| 119 | 119 | |
| 120 | - if ( strpos( $class, 'auto_load_next_post_admin' ) === 0 ) { |
|
| 121 | - $path = AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/admin/'; |
|
| 122 | - } else if ( strpos( $class, 'auto_load_next_post_' ) === 0 ) { |
|
| 123 | - $path = AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/'; |
|
| 120 | + if (strpos($class, 'auto_load_next_post_admin') === 0) { |
|
| 121 | + $path = AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/admin/'; |
|
| 122 | + } else if (strpos($class, 'auto_load_next_post_') === 0) { |
|
| 123 | + $path = AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/'; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( $path !== null && is_readable( $path . $file ) ) { |
|
| 127 | - include_once( $path . $file ); |
|
| 126 | + if ($path !== null && is_readable($path.$file)) { |
|
| 127 | + include_once($path.$file); |
|
| 128 | 128 | return true; |
| 129 | 129 | } |
| 130 | 130 | } // END autoload() |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | * @access private |
| 163 | 163 | * @since 1.4.3 |
| 164 | 164 | */ |
| 165 | - private function define( $name, $value ) { |
|
| 166 | - if ( ! defined( $name ) ) { |
|
| 167 | - define( $name, $value ); |
|
| 165 | + private function define($name, $value) { |
|
| 166 | + if ( ! defined($name)) { |
|
| 167 | + define($name, $value); |
|
| 168 | 168 | } |
| 169 | 169 | } // END define() |
| 170 | 170 | |
@@ -181,20 +181,20 @@ discard block |
||
| 181 | 181 | * @return void |
| 182 | 182 | */ |
| 183 | 183 | public function includes() { |
| 184 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
| 184 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
| 185 | 185 | |
| 186 | 186 | // Include admin class to handle all back-end functions. |
| 187 | - if ( is_admin() ) { |
|
| 188 | - include_once( dirname( __FILE__ ) . '/includes/admin/class-auto-load-next-post-admin.php'); // Admin section. |
|
| 187 | + if (is_admin()) { |
|
| 188 | + include_once(dirname(__FILE__).'/includes/admin/class-auto-load-next-post-admin.php'); // Admin section. |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // Install. |
| 192 | - require_once( dirname( __FILE__ ) . '/includes/class-auto-load-next-post-install.php' ); |
|
| 192 | + require_once(dirname(__FILE__).'/includes/class-auto-load-next-post-install.php'); |
|
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | 195 | * Auto Load Next Post is fully loaded. |
| 196 | 196 | */ |
| 197 | - do_action( 'auto_load_next_post_loaded' ); |
|
| 197 | + do_action('auto_load_next_post_loaded'); |
|
| 198 | 198 | } // END includes() |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return void |
| 210 | 210 | */ |
| 211 | 211 | public function load_plugin_textdomain() { |
| 212 | - load_plugin_textdomain( 'auto-load-next-post', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
| 212 | + load_plugin_textdomain('auto-load-next-post', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
| 213 | 213 | } // END load_plugin_textdomain() |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | /** |
| 224 | 224 | * Load the Javascript if found as a singluar post. |
| 225 | 225 | */ |
| 226 | - if ( supports_alnp() && is_singular() && get_post_type() == 'post' ) { |
|
| 227 | - $this->load_file( 'auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 226 | + if (supports_alnp() && is_singular() && get_post_type() == 'post') { |
|
| 227 | + $this->load_file('auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 228 | 228 | |
| 229 | 229 | // Only load History.js when not in the customizer. |
| 230 | - if ( ! is_customize_preview() ) { |
|
| 231 | - $this->load_file( 'auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
| 230 | + if ( ! is_customize_preview()) { |
|
| 231 | + $this->load_file('auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - $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 ); |
|
| 234 | + $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); |
|
| 235 | 235 | |
| 236 | 236 | // Variables for JS scripts |
| 237 | - wp_localize_script( 'auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
| 237 | + wp_localize_script('auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
| 238 | 238 | 'alnp_version' => AUTO_LOAD_NEXT_POST_VERSION, |
| 239 | 239 | 'alnp_content_container' => get_option('auto_load_next_post_content_container'), |
| 240 | 240 | 'alnp_title_selector' => get_option('auto_load_next_post_title_selector'), |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | 'alnp_remove_comments' => get_option('auto_load_next_post_remove_comments'), |
| 244 | 244 | 'alnp_google_analytics' => get_option('auto_load_next_post_google_analytics'), |
| 245 | 245 | 'alnp_is_customizer' => is_customize_preview() |
| 246 | - ) ); |
|
| 246 | + )); |
|
| 247 | 247 | } // END if is_singular() && get_post_type() |
| 248 | 248 | } // END alnp_scripts() |
| 249 | 249 | |
@@ -260,18 +260,18 @@ discard block |
||
| 260 | 260 | * @param string $version Optional, can match the version of the plugin or version of the source file. |
| 261 | 261 | * @global string $wp_version |
| 262 | 262 | */ |
| 263 | - public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '' ) { |
|
| 263 | + public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '') { |
|
| 264 | 264 | global $wp_version; |
| 265 | 265 | |
| 266 | - $url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file. |
|
| 266 | + $url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file. |
|
| 267 | 267 | |
| 268 | - if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) { |
|
| 269 | - if ( $is_script ) { |
|
| 270 | - wp_register_script( $name, $url, $support, $version ); |
|
| 271 | - wp_enqueue_script( $name ); |
|
| 268 | + if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) { |
|
| 269 | + if ($is_script) { |
|
| 270 | + wp_register_script($name, $url, $support, $version); |
|
| 271 | + wp_enqueue_script($name); |
|
| 272 | 272 | } else { |
| 273 | - wp_register_style( $name, $url ); |
|
| 274 | - wp_enqueue_style( $name ); |
|
| 273 | + wp_register_style($name, $url); |
|
| 274 | + wp_enqueue_style($name); |
|
| 275 | 275 | } // end if |
| 276 | 276 | } // end if |
| 277 | 277 | |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | } // END run_auto_load_next_post() |
| 290 | 290 | |
| 291 | 291 | // Fetch the Php version checker. |
| 292 | -if ( ! class_exists( 'WP_Update_Php' ) ) { |
|
| 293 | - require_once( dirname( __FILE__ ) . '/wp-update-php/wp-update-php.php' ); |
|
| 292 | +if ( ! class_exists('WP_Update_Php')) { |
|
| 293 | + require_once(dirname(__FILE__).'/wp-update-php/wp-update-php.php'); |
|
| 294 | 294 | } |
| 295 | 295 | $updatePhp = new WP_Update_Php( |
| 296 | 296 | array( |
@@ -304,6 +304,6 @@ discard block |
||
| 304 | 304 | ); |
| 305 | 305 | |
| 306 | 306 | // If the miniumum version of PHP required is available then run the plugin. |
| 307 | -if ( $updatePhp->does_it_meet_required_php_version() ) { |
|
| 307 | +if ($updatePhp->does_it_meet_required_php_version()) { |
|
| 308 | 308 | add_action('plugins_loaded', 'run_auto_load_next_post', 20); |
| 309 | 309 | } |
@@ -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_Admin_Settings' ) ) { |
|
| 19 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Settings')) { |
|
| 20 | 20 | |
| 21 | 21 | class Auto_Load_Next_Post_Admin_Settings { |
| 22 | 22 | |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | * @return $settings |
| 58 | 58 | */ |
| 59 | 59 | public static function get_settings_pages() { |
| 60 | - if ( empty( self::$settings ) ) { |
|
| 60 | + if (empty(self::$settings)) { |
|
| 61 | 61 | $settings = array(); |
| 62 | 62 | |
| 63 | - include_once( dirname( __FILE__ ) . '/settings/class-alnp-settings-page.php' ); |
|
| 63 | + include_once(dirname(__FILE__).'/settings/class-alnp-settings-page.php'); |
|
| 64 | 64 | |
| 65 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-general.php'); |
|
| 65 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-general.php'); |
|
| 66 | 66 | |
| 67 | - self::$settings = apply_filters( 'auto_load_next_post_get_settings_pages', $settings ); |
|
| 67 | + self::$settings = apply_filters('auto_load_next_post_get_settings_pages', $settings); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return self::$settings; |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | public static function save() { |
| 83 | 83 | global $current_tab; |
| 84 | 84 | |
| 85 | - check_admin_referer( 'auto-load-next-post-settings' ); |
|
| 85 | + check_admin_referer('auto-load-next-post-settings'); |
|
| 86 | 86 | |
| 87 | 87 | // Trigger actions |
| 88 | - do_action( 'auto_load_next_post_settings_save_' . $current_tab ); |
|
| 89 | - do_action( 'auto_load_next_post_update_options_' . $current_tab ); |
|
| 90 | - do_action( 'auto_load_next_post_update_options' ); |
|
| 88 | + do_action('auto_load_next_post_settings_save_'.$current_tab); |
|
| 89 | + do_action('auto_load_next_post_update_options_'.$current_tab); |
|
| 90 | + do_action('auto_load_next_post_update_options'); |
|
| 91 | 91 | |
| 92 | - self::add_message( __( 'Your settings have been saved.', 'auto-load-next-post' ) ); |
|
| 92 | + self::add_message(__('Your settings have been saved.', 'auto-load-next-post')); |
|
| 93 | 93 | |
| 94 | - do_action( 'auto_load_next_post_settings_saved' ); |
|
| 94 | + do_action('auto_load_next_post_settings_saved'); |
|
| 95 | 95 | } // END save() |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @since 1.0.0 |
| 103 | 103 | * @param string $text Message |
| 104 | 104 | */ |
| 105 | - public static function add_message( $text ) { |
|
| 105 | + public static function add_message($text) { |
|
| 106 | 106 | self::$messages[] = $text; |
| 107 | 107 | } // END add_message() |
| 108 | 108 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @since 1.0.0 |
| 115 | 115 | * @param string $text Error |
| 116 | 116 | */ |
| 117 | - public static function add_error( $text ) { |
|
| 117 | + public static function add_error($text) { |
|
| 118 | 118 | self::$errors[] = $text; |
| 119 | 119 | } // END add_error() |
| 120 | 120 | |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | * @return string |
| 128 | 128 | */ |
| 129 | 129 | public static function show_messages() { |
| 130 | - if ( count( self::$errors ) > 0 ) { |
|
| 131 | - foreach ( self::$errors as $error ) { |
|
| 132 | - echo '<div id="message" class="error inline"><p><strong>' . esc_html( $error ) . '</strong></p></div>'; |
|
| 130 | + if (count(self::$errors) > 0) { |
|
| 131 | + foreach (self::$errors as $error) { |
|
| 132 | + echo '<div id="message" class="error inline"><p><strong>'.esc_html($error).'</strong></p></div>'; |
|
| 133 | 133 | } |
| 134 | - } elseif ( count( self::$messages ) > 0 ) { |
|
| 135 | - foreach ( self::$messages as $message ) { |
|
| 136 | - echo '<div id="message" class="updated inline"><p><strong>' . esc_html( $message ) . '</strong></p></div>'; |
|
| 134 | + } elseif (count(self::$messages) > 0) { |
|
| 135 | + foreach (self::$messages as $message) { |
|
| 136 | + echo '<div id="message" class="updated inline"><p><strong>'.esc_html($message).'</strong></p></div>'; |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | } // END show_messages() |
@@ -155,18 +155,18 @@ discard block |
||
| 155 | 155 | public static function output() { |
| 156 | 156 | global $current_section, $current_tab; |
| 157 | 157 | |
| 158 | - do_action( 'auto_load_next_post_settings_start' ); |
|
| 158 | + do_action('auto_load_next_post_settings_start'); |
|
| 159 | 159 | |
| 160 | - wp_enqueue_script( 'auto_load_next_post_settings', AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/admin/settings' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true ); |
|
| 160 | + wp_enqueue_script('auto_load_next_post_settings', AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/js/admin/settings'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true); |
|
| 161 | 161 | |
| 162 | - wp_localize_script( 'auto_load_next_post_settings', 'auto_load_next_post_settings_params', array( |
|
| 163 | - 'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post' ), |
|
| 164 | - ) ); |
|
| 162 | + wp_localize_script('auto_load_next_post_settings', 'auto_load_next_post_settings_params', array( |
|
| 163 | + 'i18n_nav_warning' => __('The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post'), |
|
| 164 | + )); |
|
| 165 | 165 | |
| 166 | 166 | // Get tabs for the settings page |
| 167 | - $tabs = apply_filters( 'auto_load_next_post_settings_tabs_array', array() ); |
|
| 167 | + $tabs = apply_filters('auto_load_next_post_settings_tabs_array', array()); |
|
| 168 | 168 | |
| 169 | - include( dirname( __FILE__ ) . '/views/html-admin-settings.php' ); |
|
| 169 | + include(dirname(__FILE__).'/views/html-admin-settings.php'); |
|
| 170 | 170 | } // END output() |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -178,20 +178,20 @@ discard block |
||
| 178 | 178 | * @param mixed $option_name |
| 179 | 179 | * @return string |
| 180 | 180 | */ |
| 181 | - public static function get_option( $option_name, $default = '' ) { |
|
| 181 | + public static function get_option($option_name, $default = '') { |
|
| 182 | 182 | // Array value |
| 183 | - if ( strstr( $option_name, '[' ) ) { |
|
| 184 | - parse_str( $option_name, $option_array ); |
|
| 183 | + if (strstr($option_name, '[')) { |
|
| 184 | + parse_str($option_name, $option_array); |
|
| 185 | 185 | |
| 186 | 186 | // Option name is first key |
| 187 | - $option_name = current( array_keys( $option_array ) ); |
|
| 187 | + $option_name = current(array_keys($option_array)); |
|
| 188 | 188 | |
| 189 | 189 | // Get value |
| 190 | - $option_values = get_option( $option_name, '' ); |
|
| 190 | + $option_values = get_option($option_name, ''); |
|
| 191 | 191 | |
| 192 | - $key = key( $option_array[$option_name] ); |
|
| 192 | + $key = key($option_array[$option_name]); |
|
| 193 | 193 | |
| 194 | - if ( isset( $option_values[$key] ) ) { |
|
| 194 | + if (isset($option_values[$key])) { |
|
| 195 | 195 | $option_value = $option_values[$key]; |
| 196 | 196 | } else { |
| 197 | 197 | $option_value = null; |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | $option_value = get_option($option_name, null); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if ( is_array( $option_value ) ) { |
|
| 205 | - $option_value = array_map( 'stripslashes', $option_value ); |
|
| 206 | - } elseif ( ! is_null( $option_value ) ) { |
|
| 207 | - $option_value = stripslashes( $option_value ); |
|
| 204 | + if (is_array($option_value)) { |
|
| 205 | + $option_value = array_map('stripslashes', $option_value); |
|
| 206 | + } elseif ( ! is_null($option_value)) { |
|
| 207 | + $option_value = stripslashes($option_value); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | return $option_value === null ? $default : $option_value; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | if ($tip && in_array($value['type'], array('checkbox'))) { |
| 280 | 280 | $tip = '<p class="description">'.$tip.'</p>'; |
| 281 | 281 | } else if ($tip) { |
| 282 | - $tip = '<img class="help_tip" data-tip="'.esc_attr($tip).'" src="' . AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/images/help.png" height="16" width="16" />'; |
|
| 282 | + $tip = '<img class="help_tip" data-tip="'.esc_attr($tip).'" src="'.AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/images/help.png" height="16" width="16" />'; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | // Switch based on type |
@@ -526,8 +526,8 @@ discard block |
||
| 526 | 526 | * @param array $options Opens array to output |
| 527 | 527 | * @return bool |
| 528 | 528 | */ |
| 529 | - public static function save_fields( $options, $current_tab ) { |
|
| 530 | - if ( empty( $_POST ) ) { |
|
| 529 | + public static function save_fields($options, $current_tab) { |
|
| 530 | + if (empty($_POST)) { |
|
| 531 | 531 | return false; |
| 532 | 532 | } |
| 533 | 533 | |
@@ -535,21 +535,21 @@ discard block |
||
| 535 | 535 | $update_options = array(); |
| 536 | 536 | |
| 537 | 537 | // Loop options and get values to save |
| 538 | - foreach ( $options as $value ) { |
|
| 538 | + foreach ($options as $value) { |
|
| 539 | 539 | |
| 540 | - if ( ! isset( $value['id'] ) ) { |
|
| 540 | + if ( ! isset($value['id'])) { |
|
| 541 | 541 | continue; |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - $type = isset( $value['type'] ) ? sanitize_title( $value['type'] ) : ''; |
|
| 544 | + $type = isset($value['type']) ? sanitize_title($value['type']) : ''; |
|
| 545 | 545 | |
| 546 | 546 | // Get the option name |
| 547 | 547 | $option_value = null; |
| 548 | 548 | |
| 549 | - switch ( $type ) { |
|
| 549 | + switch ($type) { |
|
| 550 | 550 | // Standard types |
| 551 | 551 | case "checkbox" : |
| 552 | - if ( isset( $_POST[$value['id']] ) ) { |
|
| 552 | + if (isset($_POST[$value['id']])) { |
|
| 553 | 553 | $option_value = 'yes'; |
| 554 | 554 | } else { |
| 555 | 555 | $option_value = 'no'; |
@@ -558,8 +558,8 @@ discard block |
||
| 558 | 558 | break; |
| 559 | 559 | |
| 560 | 560 | case "textarea" : |
| 561 | - if ( isset( $_POST[$value['id']] ) ) { |
|
| 562 | - $option_value = wp_kses_post( trim( stripslashes( $_POST[$value['id']] ) ) ); |
|
| 561 | + if (isset($_POST[$value['id']])) { |
|
| 562 | + $option_value = wp_kses_post(trim(stripslashes($_POST[$value['id']]))); |
|
| 563 | 563 | } else { |
| 564 | 564 | $option_value = ''; |
| 565 | 565 | } |
@@ -571,8 +571,8 @@ discard block |
||
| 571 | 571 | case "select" : |
| 572 | 572 | case "single_select_page" : |
| 573 | 573 | case "radio" : |
| 574 | - if ( isset( $_POST[$value['id']] ) ) { |
|
| 575 | - $option_value = auto_load_next_post_clean( stripslashes( $_POST[$value['id']] ) ); |
|
| 574 | + if (isset($_POST[$value['id']])) { |
|
| 575 | + $option_value = auto_load_next_post_clean(stripslashes($_POST[$value['id']])); |
|
| 576 | 576 | } else { |
| 577 | 577 | $option_value = ''; |
| 578 | 578 | } |
@@ -582,8 +582,8 @@ discard block |
||
| 582 | 582 | // Special types |
| 583 | 583 | case "multiselect" : |
| 584 | 584 | // Get array |
| 585 | - if ( isset( $_POST[$value['id']] ) ) { |
|
| 586 | - $selected_values = array_map( 'auto_load_next_post_clean', array_map( 'stripslashes', (array) $_POST[$value['id']] ) ); |
|
| 585 | + if (isset($_POST[$value['id']])) { |
|
| 586 | + $selected_values = array_map('auto_load_next_post_clean', array_map('stripslashes', (array) $_POST[$value['id']])); |
|
| 587 | 587 | } else { |
| 588 | 588 | $selected_values = array(); |
| 589 | 589 | } |
@@ -593,19 +593,19 @@ discard block |
||
| 593 | 593 | |
| 594 | 594 | // Custom handling |
| 595 | 595 | default : |
| 596 | - do_action( 'auto_load_next_post_update_option_' . $type, $value ); |
|
| 596 | + do_action('auto_load_next_post_update_option_'.$type, $value); |
|
| 597 | 597 | |
| 598 | 598 | break; |
| 599 | 599 | } // END switch() |
| 600 | 600 | |
| 601 | - if ( ! is_null( $option_value ) ) { |
|
| 601 | + if ( ! is_null($option_value)) { |
|
| 602 | 602 | |
| 603 | 603 | // Check if option is an array |
| 604 | - if ( strstr( $value['id'], '[') ) { |
|
| 605 | - parse_str( $value['id'], $option_array ); |
|
| 604 | + if (strstr($value['id'], '[')) { |
|
| 605 | + parse_str($value['id'], $option_array); |
|
| 606 | 606 | |
| 607 | 607 | // Option name is first key |
| 608 | - $option_name = current( array_keys( $option_array ) ); |
|
| 608 | + $option_name = current(array_keys($option_array)); |
|
| 609 | 609 | |
| 610 | 610 | // Get old option value |
| 611 | 611 | if ( ! isset($update_options[$option_name])) { |
@@ -628,16 +628,16 @@ discard block |
||
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | // Custom handling |
| 631 | - do_action( 'auto_load_next_post_update_option', $value ); |
|
| 631 | + do_action('auto_load_next_post_update_option', $value); |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | // Now save the options |
| 635 | - foreach ( $update_options as $name => $value ) { |
|
| 636 | - update_option( $name, $value ); |
|
| 635 | + foreach ($update_options as $name => $value) { |
|
| 636 | + update_option($name, $value); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | // Save all options as an array. Ready for export. |
| 640 | - update_option( 'auto_load_next_post_options_' . $current_tab, $update_options ); |
|
| 640 | + update_option('auto_load_next_post_options_'.$current_tab, $update_options); |
|
| 641 | 641 | |
| 642 | 642 | return true; |
| 643 | 643 | } // END save_fields() |
@@ -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_General_Tab' ) ) { |
|
| 18 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_General_Tab')) { |
|
| 19 | 19 | |
| 20 | 20 | class Auto_Load_Next_Post_Settings_General_Tab extends Auto_Load_Next_Post_Settings_Page { |
| 21 | 21 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | 30 | $this->id = 'general'; |
| 31 | - $this->label = __( 'General', 'auto-load-next-post' ); |
|
| 31 | + $this->label = __('General', 'auto-load-next-post'); |
|
| 32 | 32 | |
| 33 | 33 | parent::__construct(); |
| 34 | 34 | } // END __construct() |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | 'auto_load_next_post_general_settings', array( |
| 46 | 46 | |
| 47 | 47 | array( |
| 48 | - 'title' => __( 'General', 'auto-load-next-post' ), |
|
| 48 | + 'title' => __('General', 'auto-load-next-post'), |
|
| 49 | 49 | 'type' => 'title', |
| 50 | - 'desc' => sprintf( __( 'Set the theme selectors below according to your active theme. All are required for %s to work. <a href="https://autoloadnextpost.com/documentation/find-theme-selectors/?utm_source=wpadmin&utm_campaign=plugin-settings-general" target="_blank">How to find my theme selectors?</a>', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
| 50 | + 'desc' => sprintf(__('Set the theme selectors below according to your active theme. All are required for %s to work. <a href="https://autoloadnextpost.com/documentation/find-theme-selectors/?utm_source=wpadmin&utm_campaign=plugin-settings-general" target="_blank">How to find my theme selectors?</a>', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
| 51 | 51 | 'id' => 'general_options' |
| 52 | 52 | ), |
| 53 | 53 | |
| 54 | 54 | array( |
| 55 | - 'title' => __( 'Content Container', 'auto-load-next-post' ), |
|
| 56 | - 'desc' => __( 'This is the primary container were the post content is loaded in. Example: <code>main.site-main</code>', 'auto-load-next-post' ), |
|
| 55 | + 'title' => __('Content Container', 'auto-load-next-post'), |
|
| 56 | + 'desc' => __('This is the primary container were the post content is loaded in. Example: <code>main.site-main</code>', 'auto-load-next-post'), |
|
| 57 | 57 | //'desc_tip' => true, |
| 58 | 58 | 'id' => 'auto_load_next_post_content_container', |
| 59 | 59 | 'default' => 'main.site-main', |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | ), |
| 64 | 64 | |
| 65 | 65 | array( |
| 66 | - 'title' => __( 'Post Title', 'auto-load-next-post' ), |
|
| 67 | - 'desc' => __( 'This is used to identify which article the user is reading and track if Google Analytics is enabled. Example: <code>h1.entry-title</code>', 'auto-load-next-post' ), |
|
| 66 | + 'title' => __('Post Title', 'auto-load-next-post'), |
|
| 67 | + 'desc' => __('This is used to identify which article the user is reading and track if Google Analytics is enabled. Example: <code>h1.entry-title</code>', 'auto-load-next-post'), |
|
| 68 | 68 | //'desc_tip' => true, |
| 69 | 69 | 'id' => 'auto_load_next_post_title_selector', |
| 70 | 70 | 'default' => 'h1.entry-title', |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | ), |
| 75 | 75 | |
| 76 | 76 | array( |
| 77 | - 'title' => __( 'Post Navigation', 'auto-load-next-post' ), |
|
| 78 | - 'desc' => __( 'The post navigation needs to be indentified to find the next post. Example: <code>nav.post-navigation</code>', 'auto-load-next-post' ), |
|
| 77 | + 'title' => __('Post Navigation', 'auto-load-next-post'), |
|
| 78 | + 'desc' => __('The post navigation needs to be indentified to find the next post. Example: <code>nav.post-navigation</code>', 'auto-load-next-post'), |
|
| 79 | 79 | //'desc_tip' => true, |
| 80 | 80 | 'id' => 'auto_load_next_post_navigation_container', |
| 81 | 81 | 'default' => 'nav.post-navigation', |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | ), |
| 86 | 86 | |
| 87 | 87 | array( |
| 88 | - 'title' => __( 'Comments Container', 'auto-load-next-post' ), |
|
| 89 | - 'desc' => __( 'This is so comments can be removed if enabled below. Example: <code>div#comments</code>', 'auto-load-next-post' ), |
|
| 88 | + 'title' => __('Comments Container', 'auto-load-next-post'), |
|
| 89 | + 'desc' => __('This is so comments can be removed if enabled below. Example: <code>div#comments</code>', 'auto-load-next-post'), |
|
| 90 | 90 | //'desc_tip' => true, |
| 91 | 91 | 'id' => 'auto_load_next_post_comments_container', |
| 92 | 92 | 'default' => 'div#comments', |
@@ -96,32 +96,32 @@ discard block |
||
| 96 | 96 | ), |
| 97 | 97 | |
| 98 | 98 | array( |
| 99 | - 'title' => __( 'Remove Comments', 'auto-load-next-post' ), |
|
| 100 | - 'desc' => __( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ), |
|
| 99 | + 'title' => __('Remove Comments', 'auto-load-next-post'), |
|
| 100 | + 'desc' => __('Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post'), |
|
| 101 | 101 | 'id' => 'auto_load_next_post_remove_comments', |
| 102 | 102 | 'default' => 'yes', |
| 103 | 103 | 'type' => 'checkbox' |
| 104 | 104 | ), |
| 105 | 105 | |
| 106 | 106 | array( |
| 107 | - 'title' => __( 'Update Google Analytics', 'auto-load-next-post' ), |
|
| 108 | - 'desc' => __( 'Each time a post has loaded and is in view it will count as a pageview. Must have reference to Google Analytics tracking code on the site.', 'auto-load-next-post' ), |
|
| 107 | + 'title' => __('Update Google Analytics', 'auto-load-next-post'), |
|
| 108 | + 'desc' => __('Each time a post has loaded and is in view it will count as a pageview. Must have reference to Google Analytics tracking code on the site.', 'auto-load-next-post'), |
|
| 109 | 109 | 'id' => 'auto_load_next_post_google_analytics', |
| 110 | 110 | 'default' => 'no', |
| 111 | 111 | 'type' => 'checkbox' |
| 112 | 112 | ), |
| 113 | 113 | |
| 114 | 114 | array( |
| 115 | - 'title' => __( 'Reset all data?', 'auto-load-next-post' ), |
|
| 116 | - 'desc' => __( 'Press the reset button to clear all settings for this plugin and re-install the default settings.', 'auto-load-next-post' ), |
|
| 115 | + 'title' => __('Reset all data?', 'auto-load-next-post'), |
|
| 116 | + 'desc' => __('Press the reset button to clear all settings for this plugin and re-install the default settings.', 'auto-load-next-post'), |
|
| 117 | 117 | 'id' => 'auto_load_next_post_reset_data', |
| 118 | 118 | 'default' => 'no', |
| 119 | 119 | 'type' => 'reset_data' |
| 120 | 120 | ), |
| 121 | 121 | |
| 122 | 122 | array( |
| 123 | - 'title' => __( 'Remove all data on uninstall?', 'auto-load-next-post' ), |
|
| 124 | - 'desc' => __( 'If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post' ), |
|
| 123 | + 'title' => __('Remove all data on uninstall?', 'auto-load-next-post'), |
|
| 124 | + 'desc' => __('If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post'), |
|
| 125 | 125 | 'id' => 'auto_load_next_post_uninstall_data', |
| 126 | 126 | 'default' => 'no', |
| 127 | 127 | 'type' => 'checkbox' |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | public function output() { |
| 144 | 144 | $settings = $this->get_settings(); |
| 145 | 145 | |
| 146 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
| 146 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
| 147 | 147 | } // END output() |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $settings = $this->get_settings(); |
| 160 | 160 | |
| 161 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings, $current_tab ); |
|
| 161 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings, $current_tab); |
|
| 162 | 162 | } // END save() |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @return array |
| 172 | 172 | */ |
| 173 | 173 | public function get_post_types() { |
| 174 | - $post_types = get_post_types( array( 'public' => true ), 'names' ); |
|
| 174 | + $post_types = get_post_types(array('public' => true), 'names'); |
|
| 175 | 175 | |
| 176 | 176 | return $post_types; |
| 177 | 177 | } // END get_post_types() |
@@ -14,7 +14,7 @@ discard block |
||
| 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 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @access protected |
| 25 | 25 | * @var string $id |
| 26 | 26 | */ |
| 27 | - protected $id = ''; |
|
| 27 | + protected $id = ''; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Setting page label. |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | * @since 1.4.10 |
| 42 | 42 | */ |
| 43 | 43 | public function __construct() { |
| 44 | - add_filter( 'auto_load_next_post_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
| 45 | - add_action( 'auto_load_next_post_settings_' . $this->id, array( $this, 'output' ) ); |
|
| 46 | - add_action( 'auto_load_next_post_settings_save_' . $this->id, array( $this, 'save' ) ); |
|
| 44 | + add_filter('auto_load_next_post_settings_tabs_array', array($this, 'add_settings_page'), 20); |
|
| 45 | + add_action('auto_load_next_post_settings_'.$this->id, array($this, 'output')); |
|
| 46 | + add_action('auto_load_next_post_settings_save_'.$this->id, array($this, 'save')); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param array $pages |
| 77 | 77 | * @return array $pages |
| 78 | 78 | */ |
| 79 | - public function add_settings_page( $pages ) { |
|
| 79 | + public function add_settings_page($pages) { |
|
| 80 | 80 | $pages[$this->id] = $this->label; |
| 81 | 81 | |
| 82 | 82 | return $pages; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param array $pages |
| 91 | 91 | * @return array $pages |
| 92 | 92 | */ |
| 93 | - public function add_menu_page( $pages ) { |
|
| 93 | + public function add_menu_page($pages) { |
|
| 94 | 94 | $pages[$this->id] = $this->label; |
| 95 | 95 | |
| 96 | 96 | return $pages; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | public function output() { |
| 117 | 117 | $settings = $this->get_settings(); |
| 118 | 118 | |
| 119 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
| 119 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
| 120 | 120 | } // END output() |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $settings = $this->get_settings(); |
| 133 | 133 | |
| 134 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings, $current_tab ); |
|
| 134 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings, $current_tab); |
|
| 135 | 135 | } // END save() |
| 136 | 136 | |
| 137 | 137 | } // END class |
@@ -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_Admin_Notices' ) ) { |
|
| 18 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Notices')) { |
|
| 19 | 19 | |
| 20 | 20 | class Auto_Load_Next_Post_Admin_Notices { |
| 21 | 21 | |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * @version 1.4.10 |
| 38 | 38 | */ |
| 39 | 39 | public function __construct() { |
| 40 | - self::$install_date = get_site_option( 'auto_load_next_post_install_date', time() ); |
|
| 40 | + self::$install_date = get_site_option('auto_load_next_post_install_date', time()); |
|
| 41 | 41 | |
| 42 | - add_action( 'admin_init', array( $this, 'check_wp' ), 12 ); |
|
| 43 | - add_action( 'admin_init', array( $this, 'dont_bug_me' ), 15 ); |
|
| 42 | + add_action('admin_init', array($this, 'check_wp'), 12); |
|
| 43 | + add_action('admin_init', array($this, 'dont_bug_me'), 15); |
|
| 44 | 44 | |
| 45 | - add_action( 'admin_notices', array( $this, 'add_notices' ), 0 ); |
|
| 45 | + add_action('admin_notices', array($this, 'add_notices'), 0); |
|
| 46 | 46 | } // END __construct() |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | public function check_wp() { |
| 57 | 57 | global $wp_version; |
| 58 | 58 | |
| 59 | - if ( ! version_compare( $wp_version, AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE, '>=' ) ) { |
|
| 60 | - add_action( 'admin_notices', array( $this, 'requirement_wp_notice' ) ); |
|
| 59 | + if ( ! version_compare($wp_version, AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE, '>=')) { |
|
| 60 | + add_action('admin_notices', array($this, 'requirement_wp_notice')); |
|
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | 63 | |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | global $current_user; |
| 76 | 76 | |
| 77 | 77 | // If the user is allowed to install plugins and requested to hide the notice then hide it for that user. |
| 78 | - if ( ! empty( $_GET['hide_auto_load_next_post_review_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 79 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true ); |
|
| 78 | + if ( ! empty($_GET['hide_auto_load_next_post_review_notice']) && current_user_can('install_plugins')) { |
|
| 79 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true); |
|
| 80 | 80 | // Redirect to the plugins page. |
| 81 | - wp_safe_redirect( admin_url( 'plugins.php' ) ); exit; |
|
| 81 | + wp_safe_redirect(admin_url('plugins.php')); exit; |
|
| 82 | 82 | } |
| 83 | 83 | } // END dont_bug_me() |
| 84 | 84 | |
@@ -96,26 +96,26 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $template = get_option('template'); |
| 98 | 98 | |
| 99 | - if ( ! supports_alnp() ) { |
|
| 99 | + if ( ! supports_alnp()) { |
|
| 100 | 100 | // If user hides theme support notice then set active theme. |
| 101 | - if ( ! empty( $_GET['hide_auto_load_next_post_theme_support_check'] ) ) { |
|
| 102 | - update_option( 'auto_load_next_post_theme_support_check', $template ); |
|
| 101 | + if ( ! empty($_GET['hide_auto_load_next_post_theme_support_check'])) { |
|
| 102 | + update_option('auto_load_next_post_theme_support_check', $template); |
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ( get_option( 'auto_load_next_post_theme_support_check' ) !== $template ) { |
|
| 107 | - add_action( 'admin_notices', array( $this, 'theme_check_notice' ) ); |
|
| 106 | + if (get_option('auto_load_next_post_theme_support_check') !== $template) { |
|
| 107 | + add_action('admin_notices', array($this, 'theme_check_notice')); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // Is admin notice hidden? |
| 112 | - $hide_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', true ); |
|
| 112 | + $hide_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', true); |
|
| 113 | 113 | |
| 114 | 114 | // Check if we need to display the review plugin notice. |
| 115 | - if ( current_user_can( 'install_plugins' ) && empty( $hide_notice ) ) { |
|
| 115 | + if (current_user_can('install_plugins') && empty($hide_notice)) { |
|
| 116 | 116 | // If it has been a week or more since activating the plugin then display the review notice. |
| 117 | - if ( ( time() - self::$install_date ) > WEEK_IN_SECONDS ) { |
|
| 118 | - add_action( 'admin_notices', array( $this, 'plugin_review_notice' ) ); |
|
| 117 | + if ((time() - self::$install_date) > WEEK_IN_SECONDS) { |
|
| 118 | + add_action('admin_notices', array($this, 'plugin_review_notice')); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | } // END add_notices() |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @since 1.4.3 |
| 128 | 128 | */ |
| 129 | 129 | public function requirement_wp_notice() { |
| 130 | - include( dirname( __FILE__ ) . '/views/html-notice-requirement-wp.php' ); |
|
| 130 | + include(dirname(__FILE__).'/views/html-notice-requirement-wp.php'); |
|
| 131 | 131 | } // END requirement_wp_notice() |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @since 1.3.2 |
| 138 | 138 | */ |
| 139 | 139 | public function theme_check_notice() { |
| 140 | - include( dirname( __FILE__ ) . '/views/html-notice-theme-support.php' ); |
|
| 140 | + include(dirname(__FILE__).'/views/html-notice-theme-support.php'); |
|
| 141 | 141 | } // END theme_check_notice() |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function plugin_review_notice() { |
| 151 | 151 | $install_date = self::$install_date; |
| 152 | 152 | |
| 153 | - include( dirname( __FILE__ ) . '/views/html-notice-please-review.php' ); |
|
| 153 | + include(dirname(__FILE__).'/views/html-notice-please-review.php'); |
|
| 154 | 154 | } // END plugin_review_notice() |
| 155 | 155 | |
| 156 | 156 | } // END class. |