@@ -13,7 +13,7 @@ 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 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function init() { |
32 | 32 | // Add theme support and preset the theme selectors. |
33 | - add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) ); |
|
33 | + add_action('after_setup_theme', array(__CLASS__, 'add_theme_support')); |
|
34 | 34 | |
35 | 35 | // Filters the repeater template location. |
36 | 36 | //add_filter( 'alnp_template_location', array( __CLASS__, 'alnp_understrap_template_location' ) ); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @static |
55 | 55 | */ |
56 | 56 | public static function add_theme_support() { |
57 | - add_theme_support( 'auto-load-next-post', array( |
|
57 | + add_theme_support('auto-load-next-post', array( |
|
58 | 58 | 'content_container' => 'main.site-main', |
59 | 59 | 'title_selector' => 'h1.entry-title', |
60 | 60 | 'navigation_container' => 'nav.post-navigation', |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'load_js_in_footer' => 'no', |
63 | 63 | 'lock_js_in_footer' => 'no', |
64 | 64 | 'directory_post' => 'loop-templates/' |
65 | - ) ); |
|
65 | + )); |
|
66 | 66 | } // END add_theme_support() |
67 | 67 | |
68 | 68 | } // END class |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | */ |
15 | 15 | |
16 | 16 | // Exit if accessed directly. |
17 | -if ( ! defined( 'ABSPATH' ) ) { |
|
17 | +if ( ! defined('ABSPATH')) { |
|
18 | 18 | exit; |
19 | 19 | } |
20 | 20 | |
21 | -if ( ! function_exists( 'alnp_template_location' ) ) { |
|
21 | +if ( ! function_exists('alnp_template_location')) { |
|
22 | 22 | /** |
23 | 23 | * Filters the template location for get_template_part(). |
24 | 24 | * |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | function alnp_template_location() { |
30 | 30 | $current_theme = get_option('template'); |
31 | 31 | |
32 | - switch( $current_theme ) { |
|
32 | + switch ($current_theme) { |
|
33 | 33 | case 'twentyseventeen': |
34 | 34 | $path = 'template-parts/post/'; |
35 | 35 | break; |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | break; |
44 | 44 | } |
45 | 45 | |
46 | - return apply_filters( 'alnp_template_location', $path ); |
|
46 | + return apply_filters('alnp_template_location', $path); |
|
47 | 47 | } // END alnp_template_location() |
48 | 48 | } |
49 | 49 | |
50 | -if ( ! function_exists( 'is_alnp_pro_version_installed' ) ) { |
|
50 | +if ( ! function_exists('is_alnp_pro_version_installed')) { |
|
51 | 51 | /** |
52 | 52 | * Detects if Auto Load Next Post Pro is installed. |
53 | 53 | * |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | * @return boolean |
56 | 56 | */ |
57 | 57 | function is_alnp_pro_version_installed() { |
58 | - $active_plugins = (array) get_option( 'active_plugins', array() ); |
|
58 | + $active_plugins = (array) get_option('active_plugins', array()); |
|
59 | 59 | |
60 | - if ( is_multisite() ) { |
|
61 | - $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); |
|
60 | + if (is_multisite()) { |
|
61 | + $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); |
|
62 | 62 | } |
63 | 63 | |
64 | - return in_array( 'auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins ) || array_key_exists( 'auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins ); |
|
64 | + return in_array('auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins) || array_key_exists('auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins); |
|
65 | 65 | } // END is_alnp_pro_version_installed() |
66 | 66 | } |
67 | 67 | |
68 | -if ( ! function_exists( 'is_alnp_beta' ) ) { |
|
68 | +if ( ! function_exists('is_alnp_beta')) { |
|
69 | 69 | /** |
70 | 70 | * Returns true if Auto Load Next Post is a beta/pre-release. |
71 | 71 | * |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function is_alnp_beta() { |
77 | 77 | if ( |
78 | - strpos( AUTO_LOAD_NEXT_POST_VERSION, 'beta' ) || |
|
79 | - strpos( AUTO_LOAD_NEXT_POST_VERSION, 'rc' ) |
|
78 | + strpos(AUTO_LOAD_NEXT_POST_VERSION, 'beta') || |
|
79 | + strpos(AUTO_LOAD_NEXT_POST_VERSION, 'rc') |
|
80 | 80 | ) { |
81 | 81 | return true; |
82 | 82 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } // END is_alnp_beta() |
86 | 86 | } |
87 | 87 | |
88 | -if ( ! function_exists( 'is_alnp_active_theme' ) ) { |
|
88 | +if ( ! function_exists('is_alnp_active_theme')) { |
|
89 | 89 | /** |
90 | 90 | * See if theme/s is activate or not. |
91 | 91 | * |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | * @param string|array $theme Theme name or array of theme names to check. |
94 | 94 | * @return boolean |
95 | 95 | */ |
96 | - function is_alnp_active_theme( $theme ) { |
|
97 | - return is_array( $theme ) ? in_array( get_template(), $theme, true ) : get_template() === $theme; |
|
96 | + function is_alnp_active_theme($theme) { |
|
97 | + return is_array($theme) ? in_array(get_template(), $theme, true) : get_template() === $theme; |
|
98 | 98 | } // END is_alnp_active_theme() |
99 | 99 | } |
100 | 100 | |
101 | -if ( ! function_exists( 'is_alnp_supported' ) ) { |
|
101 | +if ( ! function_exists('is_alnp_supported')) { |
|
102 | 102 | /** |
103 | 103 | * Returns true if Auto Load Next Post is supported in the theme. |
104 | 104 | * |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * @return boolean |
107 | 107 | */ |
108 | 108 | function is_alnp_supported() { |
109 | - $theme_support = current_theme_supports( 'auto-load-next-post' ); |
|
109 | + $theme_support = current_theme_supports('auto-load-next-post'); |
|
110 | 110 | |
111 | - if ( ! $theme_support ) { |
|
111 | + if ( ! $theme_support) { |
|
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } // END is_alnp_supported() |
117 | 117 | } |
118 | 118 | |
119 | -if ( ! function_exists( 'alnp_get_theme_support' ) ) { |
|
119 | +if ( ! function_exists('alnp_get_theme_support')) { |
|
120 | 120 | /** |
121 | 121 | * Return "theme support" values from the current theme, if set. |
122 | 122 | * |
@@ -125,25 +125,25 @@ discard block |
||
125 | 125 | * @param mixed $default Optional value to return if the theme does not declare support for a prop. |
126 | 126 | * @return mixed Value of prop(s). |
127 | 127 | */ |
128 | - function alnp_get_theme_support( $prop = '', $default = null ) { |
|
129 | - $theme_support = get_theme_support( 'auto-load-next-post' ); |
|
130 | - $theme_support = is_array( $theme_support ) ? $theme_support[0] : false; |
|
128 | + function alnp_get_theme_support($prop = '', $default = null) { |
|
129 | + $theme_support = get_theme_support('auto-load-next-post'); |
|
130 | + $theme_support = is_array($theme_support) ? $theme_support[0] : false; |
|
131 | 131 | |
132 | - if ( ! $theme_support ) { |
|
132 | + if ( ! $theme_support) { |
|
133 | 133 | return $default; |
134 | 134 | } |
135 | 135 | |
136 | - if ( ! empty( $prop ) ) { |
|
137 | - $prop_stack = explode( '::', $prop ); |
|
138 | - $prop_key = array_shift( $prop_stack ); |
|
136 | + if ( ! empty($prop)) { |
|
137 | + $prop_stack = explode('::', $prop); |
|
138 | + $prop_key = array_shift($prop_stack); |
|
139 | 139 | |
140 | - if ( isset( $theme_support[ $prop_key ] ) ) { |
|
141 | - $value = $theme_support[ $prop_key ]; |
|
140 | + if (isset($theme_support[$prop_key])) { |
|
141 | + $value = $theme_support[$prop_key]; |
|
142 | 142 | |
143 | - if ( count( $prop_stack ) ) { |
|
144 | - foreach ( $prop_stack as $prop_key ) { |
|
145 | - if ( is_array( $value ) && isset( $value[ $prop_key ] ) ) { |
|
146 | - $value = $value[ $prop_key ]; |
|
143 | + if (count($prop_stack)) { |
|
144 | + foreach ($prop_stack as $prop_key) { |
|
145 | + if (is_array($value) && isset($value[$prop_key])) { |
|
146 | + $value = $value[$prop_key]; |
|
147 | 147 | } else { |
148 | 148 | $value = $default; |
149 | 149 | break; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } // END alnp_get_theme_support() |
162 | 162 | } |
163 | 163 | |
164 | -if ( ! function_exists( 'alnp_is_bot' ) ) { |
|
164 | +if ( ! function_exists('alnp_is_bot')) { |
|
165 | 165 | /** |
166 | 166 | * Was the current request made by a known bot? |
167 | 167 | * |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | * @return boolean |
170 | 170 | */ |
171 | 171 | function alnp_is_bot() { |
172 | - $is_bot = alnp_is_bot_user_agent( $_SERVER['HTTP_USER_AGENT'] ); |
|
172 | + $is_bot = alnp_is_bot_user_agent($_SERVER['HTTP_USER_AGENT']); |
|
173 | 173 | |
174 | 174 | return $is_bot; |
175 | 175 | } // END alnp_is_bot() |
176 | 176 | } |
177 | 177 | |
178 | -if ( ! function_exists( 'alnp_is_bot_user_agent' ) ) { |
|
178 | +if ( ! function_exists('alnp_is_bot_user_agent')) { |
|
179 | 179 | /** |
180 | 180 | * Is the given user-agent a known bot? |
181 | 181 | * |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | * @param string A user-agent string |
184 | 184 | * @return boolean |
185 | 185 | */ |
186 | - function alnp_is_bot_user_agent( $ua = null ) { |
|
187 | - if ( empty( $ua ) ) { |
|
186 | + function alnp_is_bot_user_agent($ua = null) { |
|
187 | + if (empty($ua)) { |
|
188 | 188 | return false; |
189 | 189 | } |
190 | 190 | |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | 'livelapbot', 'germcrawler', 'domaintunocrawler', 'grapeshotcrawler', 'cloudflare-alwaysonline', |
199 | 199 | ); |
200 | 200 | |
201 | - foreach ( $bot_agents as $bot_agent ) { |
|
202 | - if ( false !== stripos( $ua, $bot_agent ) ) { |
|
201 | + foreach ($bot_agents as $bot_agent) { |
|
202 | + if (false !== stripos($ua, $bot_agent)) { |
|
203 | 203 | return true; |
204 | 204 | } |
205 | 205 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } // END alnp_is_bot_user_agent() |
209 | 209 | } |
210 | 210 | |
211 | -if ( ! function_exists( 'alnp_check_jetpack' ) ) { |
|
211 | +if ( ! function_exists('alnp_check_jetpack')) { |
|
212 | 212 | /** |
213 | 213 | * Check if Jetpack is installed. |
214 | 214 | * |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @return string |
217 | 217 | */ |
218 | 218 | function alnp_check_jetpack() { |
219 | - $jetpack_active = class_exists( 'Jetpack' ); |
|
219 | + $jetpack_active = class_exists('Jetpack'); |
|
220 | 220 | |
221 | 221 | $is_active = $jetpack_active ? 'yes' : 'no'; |
222 | 222 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } // END alnp_check_jetpack() |
225 | 225 | } |
226 | 226 | |
227 | -if ( ! function_exists( 'alnp_airplane_mode_enabled' ) ) { |
|
227 | +if ( ! function_exists('alnp_airplane_mode_enabled')) { |
|
228 | 228 | /** |
229 | 229 | * Check the current status of Airplane Mode. |
230 | 230 | * |
@@ -233,16 +233,16 @@ discard block |
||
233 | 233 | */ |
234 | 234 | function alnp_airplane_mode_enabled() { |
235 | 235 | // Bail if CLI. |
236 | - if ( defined( 'WP_CLI' ) and WP_CLI ) { |
|
236 | + if (defined('WP_CLI') and WP_CLI) { |
|
237 | 237 | return false; |
238 | 238 | } |
239 | 239 | |
240 | 240 | // Pull our status from the options table. |
241 | - $option = get_site_option( 'airplane-mode' ); |
|
241 | + $option = get_site_option('airplane-mode'); |
|
242 | 242 | |
243 | 243 | // Backup check for regular options table. |
244 | - if ( false === $option ) { |
|
245 | - $option = get_option( 'airplane-mode' ); |
|
244 | + if (false === $option) { |
|
245 | + $option = get_option('airplane-mode'); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | // Return the option flag. |
@@ -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( 'ALNP_Autoloader' ) ) { |
|
19 | +if ( ! class_exists('ALNP_Autoloader')) { |
|
20 | 20 | |
21 | 21 | class ALNP_Autoloader { |
22 | 22 | |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | * The Constructor. |
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | - if ( function_exists( '__autoload' ) ) { |
|
36 | - spl_autoload_register( '__autoload' ); |
|
35 | + if (function_exists('__autoload')) { |
|
36 | + spl_autoload_register('__autoload'); |
|
37 | 37 | } |
38 | 38 | |
39 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
39 | + spl_autoload_register(array($this, 'autoload')); |
|
40 | 40 | |
41 | - $this->include_path = untrailingslashit( plugin_dir_path( AUTO_LOAD_NEXT_POST_FILE ) ) . '/includes/'; |
|
41 | + $this->include_path = untrailingslashit(plugin_dir_path(AUTO_LOAD_NEXT_POST_FILE)).'/includes/'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @param string $class Class name. |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - private function get_file_name_from_class( $class ) { |
|
52 | - return 'class-' . str_replace( '_', '-', $class ) . '.php'; |
|
51 | + private function get_file_name_from_class($class) { |
|
52 | + return 'class-'.str_replace('_', '-', $class).'.php'; |
|
53 | 53 | } // END get_file_name_from_class() |
54 | 54 | |
55 | 55 | /** |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | * @param string $path File path. |
60 | 60 | * @return bool Successful or not. |
61 | 61 | */ |
62 | - private function load_file( $path ) { |
|
63 | - if ( $path && is_readable( $path ) ) { |
|
62 | + private function load_file($path) { |
|
63 | + if ($path && is_readable($path)) { |
|
64 | 64 | include_once $path; |
65 | 65 | return true; |
66 | 66 | } |
@@ -73,22 +73,22 @@ discard block |
||
73 | 73 | * @access public |
74 | 74 | * @param string $class Class name. |
75 | 75 | */ |
76 | - public function autoload( $class ) { |
|
77 | - $class = strtolower( $class ); |
|
76 | + public function autoload($class) { |
|
77 | + $class = strtolower($class); |
|
78 | 78 | |
79 | - if ( 0 !== strpos( $class, 'alnp_' ) ) { |
|
79 | + if (0 !== strpos($class, 'alnp_')) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | - $file = $this->get_file_name_from_class( $class ); |
|
83 | + $file = $this->get_file_name_from_class($class); |
|
84 | 84 | $path = ''; |
85 | 85 | |
86 | - if ( 0 === strpos( $class, 'alnp_admin' ) ) { |
|
87 | - $path = $this->include_path . 'admin/'; |
|
86 | + if (0 === strpos($class, 'alnp_admin')) { |
|
87 | + $path = $this->include_path.'admin/'; |
|
88 | 88 | } |
89 | 89 | |
90 | - if ( empty( $path ) || ! $this->load_file( $path . $file ) ) { |
|
91 | - $this->load_file( $this->include_path . $file ); |
|
90 | + if (empty($path) || ! $this->load_file($path.$file)) { |
|
91 | + $this->load_file($this->include_path.$file); |
|
92 | 92 | } |
93 | 93 | } // END autoload() |
94 | 94 |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'ALNP_AJAX' ) ) { |
|
17 | +if ( ! class_exists('ALNP_AJAX')) { |
|
18 | 18 | |
19 | 19 | class ALNP_AJAX { |
20 | 20 | |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | 'set_setting' => true, |
44 | 44 | ); |
45 | 45 | |
46 | - foreach ( $ajax_events as $ajax_event => $nopriv ) { |
|
47 | - add_action( 'wp_ajax_alnp_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
46 | + foreach ($ajax_events as $ajax_event => $nopriv) { |
|
47 | + add_action('wp_ajax_alnp_'.$ajax_event, array(__CLASS__, $ajax_event)); |
|
48 | 48 | |
49 | - if ( $nopriv ) { |
|
50 | - add_action( 'wp_ajax_nopriv_alnp_' . $ajax_event, array( __CLASS__, $ajax_event ) ); |
|
49 | + if ($nopriv) { |
|
50 | + add_action('wp_ajax_nopriv_alnp_'.$ajax_event, array(__CLASS__, $ajax_event)); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } // END add_ajax_events() |
@@ -60,22 +60,22 @@ discard block |
||
60 | 60 | * @return string|int |
61 | 61 | */ |
62 | 62 | public static function find_template_location() { |
63 | - $post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post'; |
|
63 | + $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : 'post'; |
|
64 | 64 | |
65 | - if ( empty( $post_type ) ) { |
|
65 | + if (empty($post_type)) { |
|
66 | 66 | wp_send_json( -1 ); |
67 | 67 | wp_die(); |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Scan directories and saves the location. |
71 | - alnp_scan_directories( $post_type ); |
|
71 | + alnp_scan_directories($post_type); |
|
72 | 72 | |
73 | 73 | // Get directory location. |
74 | - $directory = alnp_get_template_directory( $post_type ); |
|
74 | + $directory = alnp_get_template_directory($post_type); |
|
75 | 75 | |
76 | 76 | // Return if directory was saved. |
77 | - if ( ! empty( $directory ) || $directory == null ) { |
|
78 | - wp_send_json( $directory ); |
|
77 | + if ( ! empty($directory) || $directory == null) { |
|
78 | + wp_send_json($directory); |
|
79 | 79 | } else { |
80 | 80 | wp_send_json( -1 ); |
81 | 81 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | 'div.content-container' |
102 | 102 | ); |
103 | 103 | |
104 | - wp_send_json( $selectors ); |
|
104 | + wp_send_json($selectors); |
|
105 | 105 | wp_die(); |
106 | 106 | } // END get_container_selectors() |
107 | 107 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'h1' |
122 | 122 | ); |
123 | 123 | |
124 | - wp_send_json( $selectors ); |
|
124 | + wp_send_json($selectors); |
|
125 | 125 | wp_die(); |
126 | 126 | } // END get_title_selectors() |
127 | 127 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | 'nav.prev-next-nav' |
145 | 145 | ); |
146 | 146 | |
147 | - wp_send_json( $selectors ); |
|
147 | + wp_send_json($selectors); |
|
148 | 148 | wp_die(); |
149 | 149 | } // END get_post_navigation_selectors() |
150 | 150 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | 'section#comments' |
162 | 162 | ); |
163 | 163 | |
164 | - wp_send_json( $selectors ); |
|
164 | + wp_send_json($selectors); |
|
165 | 165 | wp_die(); |
166 | 166 | } // END get_comment_selectors() |
167 | 167 | |
@@ -173,17 +173,17 @@ discard block |
||
173 | 173 | * @return bool |
174 | 174 | */ |
175 | 175 | public static function set_setting() { |
176 | - $setting = isset( $_POST['setting'] ) ? $_POST['setting'] : ''; |
|
177 | - $value = isset( $_POST['value'] ) ? $_POST['value'] : ''; |
|
176 | + $setting = isset($_POST['setting']) ? $_POST['setting'] : ''; |
|
177 | + $value = isset($_POST['value']) ? $_POST['value'] : ''; |
|
178 | 178 | |
179 | - if ( empty( $setting ) && empty( $value ) ) { |
|
179 | + if (empty($setting) && empty($value)) { |
|
180 | 180 | wp_send_json( -1 ); |
181 | 181 | wp_die(); |
182 | 182 | } |
183 | 183 | |
184 | - update_option( 'auto_load_next_post_' . $setting, $value ); |
|
184 | + update_option('auto_load_next_post_'.$setting, $value); |
|
185 | 185 | |
186 | - wp_send_json( 1 ); |
|
186 | + wp_send_json(1); |
|
187 | 187 | wp_die(); |
188 | 188 | } // END set_setting() |
189 | 189 |
@@ -12,7 +12,7 @@ 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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @see alnp_meta_version() |
23 | 23 | */ |
24 | -add_action( 'wp_head', 'alnp_meta_version' ); |
|
24 | +add_action('wp_head', 'alnp_meta_version'); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Repeater Template |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @see auto_load_next_post_comments() |
32 | 32 | * @see auto_load_next_post_navigation() |
33 | 33 | */ |
34 | -add_action( 'template_redirect', 'alnp_template_redirect' ); |
|
35 | -add_action( 'alnp_load_content', 'alnp_load_fallback_content', 1, 10 ); |
|
36 | -add_action( 'alnp_load_after_content', 'auto_load_next_post_comments', 1, 5 ); |
|
37 | -add_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 ); |
|
34 | +add_action('template_redirect', 'alnp_template_redirect'); |
|
35 | +add_action('alnp_load_content', 'alnp_load_fallback_content', 1, 10); |
|
36 | +add_action('alnp_load_after_content', 'auto_load_next_post_comments', 1, 5); |
|
37 | +add_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10); |
@@ -13,11 +13,11 @@ 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 | -if ( ! function_exists( 'alnp_get_post_type' ) ) { |
|
20 | +if ( ! function_exists('alnp_get_post_type')) { |
|
21 | 21 | /** |
22 | 22 | * Returns the post type. |
23 | 23 | * |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $post_type = get_post_type(); |
29 | 29 | |
30 | 30 | // If the post type is a post then return single instead. |
31 | - if ( $post_type == 'post' ) { |
|
31 | + if ($post_type == 'post') { |
|
32 | 32 | return 'single'; |
33 | 33 | } |
34 | 34 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if ( ! function_exists( 'alnp_get_post_types' ) ) { |
|
39 | +if ( ! function_exists('alnp_get_post_types')) { |
|
40 | 40 | /** |
41 | 41 | * This returns a list of public registered post types. |
42 | 42 | * |
@@ -49,35 +49,35 @@ discard block |
||
49 | 49 | ); |
50 | 50 | |
51 | 51 | // If Auto Load Next Post Pro is installed then return all public post types. |
52 | - if ( is_alnp_pro_version_installed() ) { |
|
53 | - $post_types = get_post_types( array( 'public' => true ), 'names' ); |
|
52 | + if (is_alnp_pro_version_installed()) { |
|
53 | + $post_types = get_post_types(array('public' => true), 'names'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Un-supported post types are unset. |
57 | - $post_types = alnp_unset_unsupported_post_types( $post_types ); |
|
57 | + $post_types = alnp_unset_unsupported_post_types($post_types); |
|
58 | 58 | |
59 | 59 | return $post_types; |
60 | 60 | } // END alnp_get_post_types() |
61 | 61 | } |
62 | 62 | |
63 | -if ( ! function_exists( 'alnp_unset_unsupported_post_types' ) ) { |
|
63 | +if ( ! function_exists('alnp_unset_unsupported_post_types')) { |
|
64 | 64 | /** |
65 | 65 | * Unsets un-supported post types. |
66 | 66 | * |
67 | 67 | * @since 1.6.0 |
68 | 68 | * @return array $post_types |
69 | 69 | */ |
70 | - function alnp_unset_unsupported_post_types( $post_types ) { |
|
71 | - unset( $post_types['elementor_library'] ); |
|
72 | - unset( $post_types['tdb_templates'] ); |
|
70 | + function alnp_unset_unsupported_post_types($post_types) { |
|
71 | + unset($post_types['elementor_library']); |
|
72 | + unset($post_types['tdb_templates']); |
|
73 | 73 | |
74 | - $post_types = apply_filters( 'alnp_unset_unsupported_post_types', $post_types ); |
|
74 | + $post_types = apply_filters('alnp_unset_unsupported_post_types', $post_types); |
|
75 | 75 | |
76 | 76 | return $post_types; |
77 | 77 | } // END alnp_unset_unsupported_post_types() |
78 | 78 | } |
79 | 79 | |
80 | -if ( ! function_exists( 'alnp_get_random_page_permalink' ) ) { |
|
80 | +if ( ! function_exists('alnp_get_random_page_permalink')) { |
|
81 | 81 | /** |
82 | 82 | * Returns the permalink of a random page |
83 | 83 | * |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param string $post_type - Default is post. |
86 | 86 | * @return int|boolean |
87 | 87 | */ |
88 | - function alnp_get_random_page_permalink( $post_type = 'post' ) { |
|
88 | + function alnp_get_random_page_permalink($post_type = 'post') { |
|
89 | 89 | $args = array( |
90 | 90 | 'post_type' => $post_type, |
91 | 91 | 'post_status' => 'publish', |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | 'posts_per_page' => 1 |
94 | 94 | ); |
95 | 95 | |
96 | - $query = new WP_Query( $args ); |
|
96 | + $query = new WP_Query($args); |
|
97 | 97 | |
98 | - if ( $query->have_posts() ) { |
|
99 | - while ( $query->have_posts() ) : $query->the_post(); |
|
98 | + if ($query->have_posts()) { |
|
99 | + while ($query->have_posts()) : $query->the_post(); |
|
100 | 100 | $id = get_the_ID(); |
101 | 101 | |
102 | - return get_permalink( $id ); |
|
102 | + return get_permalink($id); |
|
103 | 103 | endwhile; |
104 | 104 | } else { |
105 | 105 | return false; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } // END alnp_get_random_page_permalink() |
108 | 108 | } |
109 | 109 | |
110 | -if ( ! function_exists( 'alnp_load_js_in_footer' ) ) { |
|
110 | +if ( ! function_exists('alnp_load_js_in_footer')) { |
|
111 | 111 | /** |
112 | 112 | * This helps the plugin decide to load the JavaScript in the footer or not. |
113 | 113 | * |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | * @return boolean |
116 | 116 | */ |
117 | 117 | function alnp_load_js_in_footer() { |
118 | - $load_in_footer = get_option( 'auto_load_next_post_load_js_in_footer', false ); |
|
118 | + $load_in_footer = get_option('auto_load_next_post_load_js_in_footer', false); |
|
119 | 119 | |
120 | - if ( isset( $load_in_footer ) && $load_in_footer == 'yes' ) { |
|
120 | + if (isset($load_in_footer) && $load_in_footer == 'yes') { |
|
121 | 121 | return true; |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } // END alnp_load_js_in_footer() |
126 | 126 | } |
127 | 127 | |
128 | -if ( ! function_exists( 'alnp_disable_on_mobile' ) ) { |
|
128 | +if ( ! function_exists('alnp_disable_on_mobile')) { |
|
129 | 129 | /** |
130 | 130 | * This helps the plugin decide to disable Auto Load Next Post |
131 | 131 | * from running on mobile devices. |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | * @return boolean |
135 | 135 | */ |
136 | 136 | function alnp_disable_on_mobile() { |
137 | - $disable_mobile = get_option( 'auto_load_next_post_disable_on_mobile', false ); |
|
137 | + $disable_mobile = get_option('auto_load_next_post_disable_on_mobile', false); |
|
138 | 138 | |
139 | - if ( isset( $disable_mobile ) && $disable_mobile == 'yes' ) { |
|
139 | + if (isset($disable_mobile) && $disable_mobile == 'yes') { |
|
140 | 140 | return true; |
141 | 141 | } |
142 | 142 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } // END alnp_disable_on_mobile() |
145 | 145 | } |
146 | 146 | |
147 | -if ( ! function_exists( 'alnp_get_admin_screens' ) ) { |
|
147 | +if ( ! function_exists('alnp_get_admin_screens')) { |
|
148 | 148 | /** |
149 | 149 | * These are the only screens Auto Load Next Post will focus |
150 | 150 | * on displaying notices or equeue scripts/styles. |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | } // END alnp_get_admin_screens() |
164 | 164 | } |
165 | 165 | |
166 | -if ( ! function_exists( 'alnp_meta_version' ) ) { |
|
166 | +if ( ! function_exists('alnp_meta_version')) { |
|
167 | 167 | /** |
168 | 168 | * Adds the plugin version to the header. |
169 | 169 | * |
170 | 170 | * @since 1.6.0 |
171 | 171 | */ |
172 | 172 | function alnp_meta_version() { |
173 | - echo '<meta name="generator" content="Auto Load Next Post ' . esc_attr( AUTO_LOAD_NEXT_POST_VERSION ) . '" />' . "\n"; |
|
173 | + echo '<meta name="generator" content="Auto Load Next Post '.esc_attr(AUTO_LOAD_NEXT_POST_VERSION).'" />'."\n"; |
|
174 | 174 | } // END alnp_meta_version() |
175 | 175 | } |
176 | 176 | \ No newline at end of file |
@@ -11,24 +11,24 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | ?> |
18 | 18 | <div class="notice notice-warning auto-load-next-post-notice"> |
19 | 19 | <div class="auto-load-next-post-notice-inner"> |
20 | 20 | <div class="auto-load-next-post-notice-icon"> |
21 | - <img src="<?php echo AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/images/icon-256x256.png'; ?>" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
21 | + <img src="<?php echo AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/images/icon-256x256.png'; ?>" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
22 | 22 | </div> |
23 | 23 | |
24 | 24 | <div class="auto-load-next-post-notice-content"> |
25 | - <h3><?php esc_html_e( 'Update Coming!', 'auto-load-next-post' ); ?></h3> |
|
26 | - <p><?php printf( __( 'Version %1$s1.6.0%2$s of %3$s is coming with new features and improvements. Before it is released I require your help to test with the themes you like to use and provide feedback. I do recommend you do so on a staging site. You will be helping me move the project forward. Thank you!', 'auto-load-next-post' ), '<strong>', '</strong>', esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
25 | + <h3><?php esc_html_e('Update Coming!', 'auto-load-next-post'); ?></h3> |
|
26 | + <p><?php printf(__('Version %1$s1.6.0%2$s of %3$s is coming with new features and improvements. Before it is released I require your help to test with the themes you like to use and provide feedback. I do recommend you do so on a staging site. You will be helping me move the project forward. Thank you!', 'auto-load-next-post'), '<strong>', '</strong>', esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class="auto-load-next-post-send-feedback"> |
30 | - <?php printf( '<a href="%1$s" class="button button-primary auto-load-next-post-feedback-button" target="_blank">%2$s</a>', esc_url( 'https://autoloadnextpost.com/2019/09/09/auto-load-next-post-v1-6-0-beta-1/' ), esc_html__( 'Learn More', 'auto-load-next-post' ) ); ?> |
|
31 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_upgrade_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'Not interested / Already doing so?', 'auto-load-next-post' ); ?></a> |
|
30 | + <?php printf('<a href="%1$s" class="button button-primary auto-load-next-post-feedback-button" target="_blank">%2$s</a>', esc_url('https://autoloadnextpost.com/2019/09/09/auto-load-next-post-v1-6-0-beta-1/'), esc_html__('Learn More', 'auto-load-next-post')); ?> |
|
31 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_upgrade_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('Not interested / Already doing so?', 'auto-load-next-post'); ?></a> |
|
32 | 32 | </div> |
33 | 33 | </div> |
34 | 34 | </div> |
@@ -11,7 +11,7 @@ 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 | |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | <div class="notice notice-success auto-load-next-post-notice is-dismissible"> |
21 | 21 | <div class="auto-load-next-post-notice-inner"> |
22 | 22 | <div class="auto-load-next-post-notice-icon"> |
23 | - <img src="<?php echo AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/images/icon-256x256.png'; ?>" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
23 | + <img src="<?php echo AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/images/icon-256x256.png'; ?>" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <div class="auto-load-next-post-notice-content"> |
27 | - <h3><?php echo sprintf( esc_html__( 'Thank you for installing %1$s!', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></h3> |
|
28 | - <p><?php echo sprintf( __( 'We detected your theme %1$s%3$s%2$s already supports %4$s. Everything is already setup for you and is ready to increase your pageviews.', 'auto-load-next-post' ), '<strong>', '</strong>', $active_theme->name, esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
27 | + <h3><?php echo sprintf(esc_html__('Thank you for installing %1$s!', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></h3> |
|
28 | + <p><?php echo sprintf(__('We detected your theme %1$s%3$s%2$s already supports %4$s. Everything is already setup for you and is ready to increase your pageviews.', 'auto-load-next-post'), '<strong>', '</strong>', $active_theme->name, esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
29 | 29 | </div> |
30 | 30 | </div> |
31 | 31 | </div> |
@@ -11,28 +11,28 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | 18 | $current_user = wp_get_current_user(); |
19 | 19 | |
20 | -$time = auto_load_next_post_seconds_to_words( time() - $install_date ); |
|
20 | +$time = auto_load_next_post_seconds_to_words(time() - $install_date); |
|
21 | 21 | ?> |
22 | 22 | <div class="notice notice-info auto-load-next-post-notice"> |
23 | 23 | <div class="auto-load-next-post-notice-inner"> |
24 | 24 | <div class="auto-load-next-post-notice-icon"> |
25 | - <img src="<?php echo AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/images/icon-256x256.png'; ?>" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
25 | + <img src="<?php echo AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/images/icon-256x256.png'; ?>" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
26 | 26 | </div> |
27 | 27 | |
28 | 28 | <div class="auto-load-next-post-notice-content"> |
29 | - <h3><?php printf( esc_html__( 'Hi %s, are you enjoying Auto Load Next Post?', 'auto-load-next-post' ), $current_user->display_name ); ?></h3> |
|
30 | - <p><?php printf( esc_html__( 'You have been using %1$s for %2$s now! Mind leaving a review and let me know know what you think of the plugin? I\'d really appreciate it!', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), esc_html( $time ) ); ?></p> |
|
29 | + <h3><?php printf(esc_html__('Hi %s, are you enjoying Auto Load Next Post?', 'auto-load-next-post'), $current_user->display_name); ?></h3> |
|
30 | + <p><?php printf(esc_html__('You have been using %1$s for %2$s now! Mind leaving a review and let me know know what you think of the plugin? I\'d really appreciate it!', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), esc_html($time)); ?></p> |
|
31 | 31 | </div> |
32 | 32 | |
33 | 33 | <div class="auto-load-next-post-review-now"> |
34 | - <?php printf( '<a href="%1$s" class="button button-primary auto-load-next-post-review-button" target="_blank">%2$s</a>', esc_url( AUTO_LOAD_NEXT_POST_REVIEW_URL . '?rate=5#new-post' ), esc_html__( 'Leave a Review', 'auto-load-next-post' ) ); ?> |
|
35 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_review_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'No thank you / I already have', 'auto-load-next-post' ); ?></a> |
|
34 | + <?php printf('<a href="%1$s" class="button button-primary auto-load-next-post-review-button" target="_blank">%2$s</a>', esc_url(AUTO_LOAD_NEXT_POST_REVIEW_URL.'?rate=5#new-post'), esc_html__('Leave a Review', 'auto-load-next-post')); ?> |
|
35 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_review_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('No thank you / I already have', 'auto-load-next-post'); ?></a> |
|
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | </div> |