@@ -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); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @since 1.0.0 |
112 | 112 | * @access public |
113 | 113 | * @param mixed $class |
114 | - * @return void |
|
114 | + * @return boolean|null |
|
115 | 115 | */ |
116 | 116 | public function autoload( $class ) { |
117 | 117 | $path = null; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @param string $name The ID to register with WordPress. |
257 | 257 | * @param string $file_path The path to the actual file. |
258 | 258 | * @param bool $is_script Optional, argument for if the incoming file_path is a JavaScript source file. |
259 | - * @param array $support Optional, for requiring other javascripts for the source file you are calling. |
|
259 | + * @param string[] $support Optional, for requiring other javascripts for the source file you are calling. |
|
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 | */ |
@@ -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 | } |
@@ -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(); |
@@ -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. |
@@ -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' ) ) { |
|
19 | +if ( ! class_exists('Auto_Load_Next_Post_Admin')) { |
|
20 | 20 | |
21 | 21 | class Auto_Load_Next_Post_Admin { |
22 | 22 | |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | 31 | // Actions |
32 | - add_action( 'admin_init', array( $this, 'includes' ), 10 ); |
|
33 | - add_action( 'admin_init', array( $this, 'admin_scripts' ), 100 ); |
|
32 | + add_action('admin_init', array($this, 'includes'), 10); |
|
33 | + add_action('admin_init', array($this, 'admin_scripts'), 100); |
|
34 | 34 | |
35 | 35 | // Add settings page. |
36 | - add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); |
|
36 | + add_action('admin_menu', array($this, 'admin_menu'), 9); |
|
37 | 37 | |
38 | 38 | // Filters |
39 | - add_filter( 'plugin_action_links_' . plugin_basename( AUTO_LOAD_NEXT_POST_FILE ), array( $this, 'plugin_action_links' ) ); |
|
40 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta'), 10, 3 ); |
|
41 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); |
|
42 | - add_filter( 'update_footer', array( $this, 'update_footer'), 15 ); |
|
39 | + add_filter('plugin_action_links_'.plugin_basename(AUTO_LOAD_NEXT_POST_FILE), array($this, 'plugin_action_links')); |
|
40 | + add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 3); |
|
41 | + add_filter('admin_footer_text', array($this, 'admin_footer_text')); |
|
42 | + add_filter('update_footer', array($this, 'update_footer'), 15); |
|
43 | 43 | } // END __construct() |
44 | 44 | |
45 | 45 | /** |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function includes() { |
52 | 52 | // Classes we only need if the ajax is not-ajax |
53 | - if ( ! auto_load_next_post_is_ajax() ) { |
|
54 | - include( dirname( __FILE__ ) . '/class-auto-load-next-post-admin-notices.php' ); // Plugin Notices |
|
55 | - include( dirname( __FILE__ ) . '/class-auto-load-next-post-admin-help.php' ); // Plugin Help Tab |
|
53 | + if ( ! auto_load_next_post_is_ajax()) { |
|
54 | + include(dirname(__FILE__).'/class-auto-load-next-post-admin-notices.php'); // Plugin Notices |
|
55 | + include(dirname(__FILE__).'/class-auto-load-next-post-admin-help.php'); // Plugin Help Tab |
|
56 | 56 | } |
57 | 57 | } // END includes() |
58 | 58 | |
@@ -65,22 +65,22 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function admin_scripts() { |
67 | 67 | // Auto Load Next Post Main Javascript |
68 | - Auto_Load_Next_Post::load_file( AUTO_LOAD_NEXT_POST_SLUG . '_admin_script', '/assets/js/admin/auto-load-next-post' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
68 | + Auto_Load_Next_Post::load_file(AUTO_LOAD_NEXT_POST_SLUG.'_admin_script', '/assets/js/admin/auto-load-next-post'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
69 | 69 | |
70 | 70 | // Chosen |
71 | - Auto_Load_Next_Post::load_file( 'chosen', '/assets/js/libs/chosen/chosen.jquery' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
71 | + Auto_Load_Next_Post::load_file('chosen', '/assets/js/libs/chosen/chosen.jquery'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
72 | 72 | |
73 | 73 | // TipTip |
74 | - Auto_Load_Next_Post::load_file( 'jquery-tiptip', '/assets/js/libs/jquery-tiptip/jquery.tipTip' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
74 | + Auto_Load_Next_Post::load_file('jquery-tiptip', '/assets/js/libs/jquery-tiptip/jquery.tipTip'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
75 | 75 | |
76 | 76 | // Variables for Admin JavaScripts |
77 | - wp_localize_script( AUTO_LOAD_NEXT_POST_SLUG . '_admin_script', 'auto_load_next_post_admin_params', array( |
|
78 | - 'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post' ), |
|
77 | + wp_localize_script(AUTO_LOAD_NEXT_POST_SLUG.'_admin_script', 'auto_load_next_post_admin_params', array( |
|
78 | + 'i18n_nav_warning' => __('The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post'), |
|
79 | 79 | )); |
80 | 80 | |
81 | 81 | // Stylesheets |
82 | - Auto_Load_Next_Post::load_file( AUTO_LOAD_NEXT_POST_SLUG . '_admin_style', '/assets/css/admin/auto-load-next-post' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.css' ); |
|
83 | - Auto_Load_Next_Post::load_file( AUTO_LOAD_NEXT_POST_SLUG.'_chosen_style', '/assets/css/libs/chosen' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.css' ); |
|
82 | + Auto_Load_Next_Post::load_file(AUTO_LOAD_NEXT_POST_SLUG.'_admin_style', '/assets/css/admin/auto-load-next-post'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.css'); |
|
83 | + Auto_Load_Next_Post::load_file(AUTO_LOAD_NEXT_POST_SLUG.'_chosen_style', '/assets/css/libs/chosen'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.css'); |
|
84 | 84 | } // END admin_scripts() |
85 | 85 | |
86 | 86 | /** |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function admin_menu() { |
94 | 94 | $settings_page = add_options_page( |
95 | - sprintf( __( '%s Settings', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
96 | - esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), |
|
95 | + sprintf(__('%s Settings', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
96 | + esc_html__('Auto Load Next Post', 'auto-load-next-post'), |
|
97 | 97 | 'manage_options', |
98 | 98 | 'auto-load-next-post-settings', |
99 | - array( $this, 'settings_page' ) |
|
99 | + array($this, 'settings_page') |
|
100 | 100 | ); |
101 | 101 | |
102 | - add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) ); |
|
102 | + add_action('load-'.$settings_page, array($this, 'settings_page_init')); |
|
103 | 103 | } // END admin_menu() |
104 | 104 | |
105 | 105 | /** |
@@ -113,29 +113,29 @@ discard block |
||
113 | 113 | global $current_tab, $current_section; |
114 | 114 | |
115 | 115 | // Include settings pages. |
116 | - include_once( dirname( __FILE__ ) . '/class-auto-load-next-post-admin-settings.php' ); |
|
116 | + include_once(dirname(__FILE__).'/class-auto-load-next-post-admin-settings.php'); |
|
117 | 117 | |
118 | 118 | Auto_Load_Next_Post_Admin_Settings::get_settings_pages(); |
119 | 119 | |
120 | 120 | // Get current tab/section. |
121 | - $current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( wp_unslash( $_GET['tab'] ) ); |
|
122 | - $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) ); |
|
121 | + $current_tab = empty($_GET['tab']) ? 'general' : sanitize_title(wp_unslash($_GET['tab'])); |
|
122 | + $current_section = empty($_REQUEST['section']) ? '' : sanitize_title(wp_unslash($_REQUEST['section'])); |
|
123 | 123 | |
124 | 124 | // Save settings if data has been posted. |
125 | - if ( apply_filters( '' !== $current_section ? "auto_load_next_post_save_settings_{$current_tab}_{$current_section}" : "auto_load_next_post_save_settings_{$current_tab}", ! empty( $_POST ) ) ) { |
|
125 | + if (apply_filters('' !== $current_section ? "auto_load_next_post_save_settings_{$current_tab}_{$current_section}" : "auto_load_next_post_save_settings_{$current_tab}", ! empty($_POST))) { |
|
126 | 126 | Auto_Load_Next_Post_Admin_Settings::save(); |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Add any posted messages. |
130 | - if ( ! empty( $_GET['auto_load_next_post_error'] ) ) { |
|
131 | - Auto_Load_Next_Post_Admin_Settings::add_error( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_error'] ) ) ); |
|
130 | + if ( ! empty($_GET['auto_load_next_post_error'])) { |
|
131 | + Auto_Load_Next_Post_Admin_Settings::add_error(wp_kses_post(wp_unslash($_GET['auto_load_next_post_error']))); |
|
132 | 132 | } |
133 | 133 | |
134 | - if ( ! empty( $_GET['auto_load_next_post_message'] ) ) { |
|
135 | - Auto_Load_Next_Post_Admin_Settings::add_message( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_message'] ) ) ); |
|
134 | + if ( ! empty($_GET['auto_load_next_post_message'])) { |
|
135 | + Auto_Load_Next_Post_Admin_Settings::add_message(wp_kses_post(wp_unslash($_GET['auto_load_next_post_message']))); |
|
136 | 136 | } |
137 | 137 | |
138 | - do_action( 'auto_load_next_post_settings_page_init' ); |
|
138 | + do_action('auto_load_next_post_settings_page_init'); |
|
139 | 139 | } // END settings_page_init() |
140 | 140 | |
141 | 141 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @since 1.0.0 |
146 | 146 | */ |
147 | 147 | public function settings_page() { |
148 | - include_once( dirname( __FILE__ ) . '/class-auto-load-next-post-admin-settings.php' ); |
|
148 | + include_once(dirname(__FILE__).'/class-auto-load-next-post-admin-settings.php'); |
|
149 | 149 | |
150 | 150 | Auto_Load_Next_Post_Admin_Settings::output(); |
151 | 151 | } // END settings_page() |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | * @param array $links |
160 | 160 | * @return array $links |
161 | 161 | */ |
162 | - public function plugin_action_links( $links ) { |
|
162 | + public function plugin_action_links($links) { |
|
163 | 163 | $plugin_action_links = array(); |
164 | 164 | |
165 | - if ( current_user_can( 'manage_options' ) ) { |
|
165 | + if (current_user_can('manage_options')) { |
|
166 | 166 | // Checks if Auto Load Next Post Pro has been installed. |
167 | - if ( ! is_alnp_pro_version_installed() ) { |
|
168 | - $plugin_action_links['go-pro'] = '<a href="' . esc_url( 'https://autoloadnextpost.com/pro/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page' ) . '" target="_blank" style="color:green; font-weight:bold;">' . __( 'Upgrade to Pro', 'auto-load-next-post' ) . '</a>'; |
|
167 | + if ( ! is_alnp_pro_version_installed()) { |
|
168 | + $plugin_action_links['go-pro'] = '<a href="'.esc_url('https://autoloadnextpost.com/pro/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page').'" target="_blank" style="color:green; font-weight:bold;">'.__('Upgrade to Pro', 'auto-load-next-post').'</a>'; |
|
169 | 169 | } |
170 | 170 | |
171 | - $plugin_action_links['settings'] = '<a href="' . admin_url( 'options-general.php?page=auto-load-next-post-settings' ) . '">' . __( 'Settings', 'auto-load-next-post' ) . '</a>'; |
|
171 | + $plugin_action_links['settings'] = '<a href="'.admin_url('options-general.php?page=auto-load-next-post-settings').'">'.__('Settings', 'auto-load-next-post').'</a>'; |
|
172 | 172 | |
173 | - return array_merge( $plugin_action_links, $links ); |
|
173 | + return array_merge($plugin_action_links, $links); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | return $links; |
@@ -187,17 +187,17 @@ discard block |
||
187 | 187 | * @param array $data Plugin Information |
188 | 188 | * @return array $links |
189 | 189 | */ |
190 | - public function plugin_row_meta( $links, $file, $data ) { |
|
191 | - if ( $file == plugin_basename( AUTO_LOAD_NEXT_POST_FILE ) ) { |
|
192 | - $links[ 1 ] = sprintf( __( 'Developed By %s', 'auto-load-next-post' ), '<a href="' . $data[ 'AuthorURI' ] . '">' . $data[ 'Author' ] . '</a>' ); |
|
190 | + public function plugin_row_meta($links, $file, $data) { |
|
191 | + if ($file == plugin_basename(AUTO_LOAD_NEXT_POST_FILE)) { |
|
192 | + $links[1] = sprintf(__('Developed By %s', 'auto-load-next-post'), '<a href="'.$data['AuthorURI'].'">'.$data['Author'].'</a>'); |
|
193 | 193 | |
194 | 194 | $row_meta = array( |
195 | - 'docs' => '<a href="' . esc_url( 'https://autoloadnextpost.com/documentation/' ) . '" target="_blank">' . __( 'Documentation', 'auto-load-next-post' ) . '</a>', |
|
196 | - 'community' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/auto-load-next-post' ) . '" target="_blank">' . __( 'Community Support', 'auto-load-next-post' ) . '</a>', |
|
197 | - 'theme-support' => '<a href="' . esc_url( 'https://autoloadnextpost.com/product/theme-support/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page' ) . '" target="_blank">' . __( 'Theme Support', 'auto-load-next-post' ) . '</a>', |
|
195 | + 'docs' => '<a href="'.esc_url('https://autoloadnextpost.com/documentation/').'" target="_blank">'.__('Documentation', 'auto-load-next-post').'</a>', |
|
196 | + 'community' => '<a href="'.esc_url('https://wordpress.org/support/plugin/auto-load-next-post').'" target="_blank">'.__('Community Support', 'auto-load-next-post').'</a>', |
|
197 | + 'theme-support' => '<a href="'.esc_url('https://autoloadnextpost.com/product/theme-support/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page').'" target="_blank">'.__('Theme Support', 'auto-load-next-post').'</a>', |
|
198 | 198 | ); |
199 | 199 | |
200 | - $links = array_merge( $links, $row_meta ); |
|
200 | + $links = array_merge($links, $row_meta); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return $links; |
@@ -213,16 +213,16 @@ discard block |
||
213 | 213 | * @param string $text |
214 | 214 | * @return string $text |
215 | 215 | */ |
216 | - public function admin_footer_text( $text ) { |
|
216 | + public function admin_footer_text($text) { |
|
217 | 217 | $current_screen = get_current_screen(); |
218 | 218 | |
219 | - if ( isset( $current_screen->id ) && $current_screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
219 | + if (isset($current_screen->id) && $current_screen->id == 'settings_page_auto-load-next-post-settings') { |
|
220 | 220 | // Rating and Review |
221 | 221 | return sprintf( |
222 | 222 | /* translators: 1: Auto Load Next Post 2:: five stars */ |
223 | - __( 'If you like %1$s, please leave a %2$s rating. A huge thank you in advance!', 'auto-load-next-post' ), |
|
224 | - sprintf( '<strong>%1$s</strong>', esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
225 | - '<a href="https://wordpress.org/support/plugin/auto-load-next-post/reviews?rate=5#new-post" target="_blank" data-rated="' . esc_attr__( 'Thanks :)', 'auto-load-next-post' ) . '">★★★★★</a>' |
|
223 | + __('If you like %1$s, please leave a %2$s rating. A huge thank you in advance!', 'auto-load-next-post'), |
|
224 | + sprintf('<strong>%1$s</strong>', esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
225 | + '<a href="https://wordpress.org/support/plugin/auto-load-next-post/reviews?rate=5#new-post" target="_blank" data-rated="'.esc_attr__('Thanks :)', 'auto-load-next-post').'">★★★★★</a>' |
|
226 | 226 | ); |
227 | 227 | } |
228 | 228 | |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @param string $text |
240 | 240 | * @return string $text |
241 | 241 | */ |
242 | - public function update_footer( $text ) { |
|
242 | + public function update_footer($text) { |
|
243 | 243 | $screen = get_current_screen(); |
244 | 244 | |
245 | - if ( $screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
246 | - return '<p class="alignright">' . sprintf( __( '%s Version', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . ' ' . esc_attr( AUTO_LOAD_NEXT_POST_VERSION ) . '</p>'; |
|
245 | + if ($screen->id == 'settings_page_auto-load-next-post-settings') { |
|
246 | + return '<p class="alignright">'.sprintf(__('%s Version', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).' '.esc_attr(AUTO_LOAD_NEXT_POST_VERSION).'</p>'; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | return $text; |