@@ -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); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @param string $post_type |
220 | 220 | * @param string $post_format |
221 | 221 | * @return string $template |
222 | - */ |
|
222 | + */ |
|
223 | 223 | function alnp_get_template( $post_type = 'post', $post_format = '' ) { |
224 | 224 | if ( ! empty( $post_format ) ) { |
225 | 225 | $template = get_option( 'auto_load_next_post_template_post_' . strtolower( $post_format ) ); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param string $post_type |
246 | 246 | * @param string $post_format |
247 | 247 | * @return array |
248 | - */ |
|
248 | + */ |
|
249 | 249 | function alnp_find_template( $location = '', $post_type, $post_format ) { |
250 | 250 | // Templates to look for based on the post that is loaded. |
251 | 251 | $templates = alnp_get_templates( $post_type, $post_format ); |
@@ -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 ( ! function_exists( 'alnp_template_redirect' ) ) { |
|
19 | +if ( ! function_exists('alnp_template_redirect')) { |
|
20 | 20 | /** |
21 | 21 | * When the 'alnp' endpoint is used on a singular post it forces |
22 | 22 | * the template redirect to retrieve only the post content. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | global $wp_query; |
30 | 30 | |
31 | 31 | // If this is not a request for alnp or a singular object then bail. |
32 | - if ( ! isset( $wp_query->query_vars['alnp'] ) || ! is_singular() ) { |
|
32 | + if ( ! isset($wp_query->query_vars['alnp']) || ! is_singular()) { |
|
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
@@ -38,28 +38,28 @@ discard block |
||
38 | 38 | * If theme does not have a template file for Auto Load Next Post, |
39 | 39 | * the plugin will load a default template. |
40 | 40 | */ |
41 | - $child_path = get_stylesheet_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
42 | - $template_path = get_template_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
41 | + $child_path = get_stylesheet_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
42 | + $template_path = get_template_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
43 | 43 | $default_path = AUTO_LOAD_NEXT_POST_FILE_PATH; |
44 | 44 | $template_redirect = ''; |
45 | 45 | |
46 | - if ( file_exists( $child_path . 'content-alnp.php' ) ) { |
|
47 | - $template_redirect = $child_path . 'content-alnp.php'; |
|
48 | - } else if ( file_exists( $template_path . 'content-alnp.php' ) ) { |
|
49 | - $template_redirect = $template_path . 'content-alnp.php'; |
|
50 | - } else if ( file_exists( $default_path . '/templates/content-alnp.php' ) ) { |
|
51 | - $template_redirect = $default_path . '/templates/content-alnp.php'; |
|
46 | + if (file_exists($child_path.'content-alnp.php')) { |
|
47 | + $template_redirect = $child_path.'content-alnp.php'; |
|
48 | + } else if (file_exists($template_path.'content-alnp.php')) { |
|
49 | + $template_redirect = $template_path.'content-alnp.php'; |
|
50 | + } else if (file_exists($default_path.'/templates/content-alnp.php')) { |
|
51 | + $template_redirect = $default_path.'/templates/content-alnp.php'; |
|
52 | 52 | } |
53 | 53 | |
54 | - $template_redirect = apply_filters( 'alnp_template_redirect', $template_redirect ); |
|
54 | + $template_redirect = apply_filters('alnp_template_redirect', $template_redirect); |
|
55 | 55 | |
56 | - include( $template_redirect ); |
|
56 | + include($template_redirect); |
|
57 | 57 | |
58 | 58 | exit; |
59 | 59 | } // END alnp_template_redirect() |
60 | 60 | } |
61 | 61 | |
62 | -if ( ! function_exists( 'auto_load_next_post_comments' ) ) { |
|
62 | +if ( ! function_exists('auto_load_next_post_comments')) { |
|
63 | 63 | /** |
64 | 64 | * Adds the comments template after the post content. |
65 | 65 | * |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | */ |
69 | 69 | function auto_load_next_post_comments() { |
70 | 70 | // If comments are open or we have at least one comment, load up the comment template. |
71 | - if ( comments_open() || get_comments_number() ) : |
|
71 | + if (comments_open() || get_comments_number()) : |
|
72 | 72 | comments_template(); |
73 | 73 | endif; |
74 | 74 | } // END auto_load_next_post_comments() |
75 | 75 | } |
76 | 76 | |
77 | -if ( ! function_exists( 'auto_load_next_post_navigation' ) ) { |
|
77 | +if ( ! function_exists('auto_load_next_post_navigation')) { |
|
78 | 78 | /** |
79 | 79 | * Adds the post navigation for the previous link only after the post content. |
80 | 80 | * |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | function auto_load_next_post_navigation() { |
85 | 85 | ?> |
86 | 86 | <nav class="navigation post-navigation" role="navigation"> |
87 | - <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'auto-load-next-post' ) . '</span> %title' ); ?></span> |
|
87 | + <span class="nav-previous"><?php previous_post_link('%link', '<span class="meta-nav">'._x('←', 'Previous post link', 'auto-load-next-post').'</span> %title'); ?></span> |
|
88 | 88 | </nav> |
89 | 89 | <?php |
90 | 90 | } // END auto_load_next_post_navigation() |
91 | 91 | } |
92 | 92 | |
93 | -if ( ! function_exists( 'alnp_get_locations' ) ) { |
|
93 | +if ( ! function_exists('alnp_get_locations')) { |
|
94 | 94 | /** |
95 | 95 | * Get list of locations as to where the content for the theme is located. |
96 | 96 | * The list is in the order to look for the templates that store the content. |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } // END alnp_get_locations() |
116 | 116 | } |
117 | 117 | |
118 | -if ( ! function_exists( 'alnp_get_templates' ) ) { |
|
118 | +if ( ! function_exists('alnp_get_templates')) { |
|
119 | 119 | /** |
120 | 120 | * Get list of templates to look for. |
121 | 121 | * |
@@ -124,28 +124,28 @@ discard block |
||
124 | 124 | * @param string $post_format |
125 | 125 | * @return array |
126 | 126 | */ |
127 | - function alnp_get_templates( $post_type = 'post', $post_format = '' ) { |
|
127 | + function alnp_get_templates($post_type = 'post', $post_format = '') { |
|
128 | 128 | $get_standard = array( |
129 | 129 | 'content-single.php', |
130 | 130 | 'content-post.php', |
131 | - 'content-' . $post_type . '.php', |
|
131 | + 'content-'.$post_type.'.php', |
|
132 | 132 | 'content.php' |
133 | 133 | ); |
134 | 134 | |
135 | - if ( ! empty( $post_format ) ) { |
|
135 | + if ( ! empty($post_format)) { |
|
136 | 136 | $get_formats = array( |
137 | - 'format-' . $post_format . '.php', |
|
138 | - 'content' . $post_format . '.php' |
|
137 | + 'format-'.$post_format.'.php', |
|
138 | + 'content'.$post_format.'.php' |
|
139 | 139 | ); |
140 | 140 | |
141 | - return array_merge( $get_standard, $get_formats ); |
|
141 | + return array_merge($get_standard, $get_formats); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $get_standard; |
145 | 145 | } // END alnp_get_templates() |
146 | 146 | } |
147 | 147 | |
148 | -if ( ! function_exists( 'alnp_scan_directories' ) ) { |
|
148 | +if ( ! function_exists('alnp_scan_directories')) { |
|
149 | 149 | /** |
150 | 150 | * Scans for the theme template directory depending on the post type requested and saves it. |
151 | 151 | * |
@@ -153,31 +153,31 @@ discard block |
||
153 | 153 | * @param string $post_type |
154 | 154 | * @param string $post_format |
155 | 155 | */ |
156 | - function alnp_scan_directories( $post_type = 'post', $post_format = '' ) { |
|
156 | + function alnp_scan_directories($post_type = 'post', $post_format = '') { |
|
157 | 157 | // Possible locations where the content files are found. |
158 | 158 | $locations = alnp_get_locations(); |
159 | 159 | |
160 | 160 | // Templates to look for based on the post that is loaded. |
161 | - $templates = alnp_get_templates( $post_type, $post_format ); |
|
161 | + $templates = alnp_get_templates($post_type, $post_format); |
|
162 | 162 | |
163 | 163 | $content_found = false; |
164 | 164 | |
165 | 165 | // Scanning all possible locations. |
166 | - foreach( $locations as $location ) { |
|
166 | + foreach ($locations as $location) { |
|
167 | 167 | // Scanning all possible templates within the locations. |
168 | - foreach( $templates as $template ) { |
|
168 | + foreach ($templates as $template) { |
|
169 | 169 | // Remove forwardslash if location is the parent theme folder. |
170 | - if ( empty( $location ) ) { |
|
170 | + if (empty($location)) { |
|
171 | 171 | $location = str_replace('/', '', $location); |
172 | 172 | } |
173 | 173 | |
174 | 174 | // If a template has been found then save it. |
175 | - if ( locate_template( $location . $template ) != '' && $content_found !== true ) { |
|
175 | + if (locate_template($location.$template) != '' && $content_found !== true) { |
|
176 | 176 | // Save template found. |
177 | - if ( ! empty( $post_format ) ) { |
|
178 | - update_option( 'auto_load_next_post_directory_post_' . $post_format, $location ); |
|
177 | + if ( ! empty($post_format)) { |
|
178 | + update_option('auto_load_next_post_directory_post_'.$post_format, $location); |
|
179 | 179 | } else { |
180 | - update_option( 'auto_load_next_post_directory_' . $post_type, $location ); |
|
180 | + update_option('auto_load_next_post_directory_'.$post_type, $location); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | $content_found = true; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } // END alnp_scan_directories() |
188 | 188 | } |
189 | 189 | |
190 | -if ( ! function_exists( 'alnp_get_template_directory' ) ) { |
|
190 | +if ( ! function_exists('alnp_get_template_directory')) { |
|
191 | 191 | /** |
192 | 192 | * Returns the template directory saved. |
193 | 193 | * |
@@ -196,14 +196,14 @@ discard block |
||
196 | 196 | * @param string $post_format |
197 | 197 | * @return string $template |
198 | 198 | */ |
199 | - function alnp_get_template_directory( $post_type = 'post', $post_format = '' ) { |
|
200 | - if ( ! empty( $post_format ) ) { |
|
201 | - $template = get_option( 'auto_load_next_post_directory_post_' . $post_format ); |
|
199 | + function alnp_get_template_directory($post_type = 'post', $post_format = '') { |
|
200 | + if ( ! empty($post_format)) { |
|
201 | + $template = get_option('auto_load_next_post_directory_post_'.$post_format); |
|
202 | 202 | } else { |
203 | - $template = get_option( 'auto_load_next_post_directory_' . $post_type ); |
|
203 | + $template = get_option('auto_load_next_post_directory_'.$post_type); |
|
204 | 204 | } |
205 | 205 | |
206 | - if ( !$template ) { |
|
206 | + if ( ! $template) { |
|
207 | 207 | return ''; |
208 | 208 | } |
209 | 209 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } // END alnp_get_template_directory() |
212 | 212 | } |
213 | 213 | |
214 | -if ( ! function_exists( 'alnp_get_template' ) ) { |
|
214 | +if ( ! function_exists('alnp_get_template')) { |
|
215 | 215 | /** |
216 | 216 | * Returns the template file saved. |
217 | 217 | * |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | * @param string $post_format |
221 | 221 | * @return string $template |
222 | 222 | */ |
223 | - function alnp_get_template( $post_type = 'post', $post_format = '' ) { |
|
224 | - if ( ! empty( $post_format ) ) { |
|
225 | - $template = get_option( 'auto_load_next_post_template_post_' . strtolower( $post_format ) ); |
|
223 | + function alnp_get_template($post_type = 'post', $post_format = '') { |
|
224 | + if ( ! empty($post_format)) { |
|
225 | + $template = get_option('auto_load_next_post_template_post_'.strtolower($post_format)); |
|
226 | 226 | } else { |
227 | - $template = get_option( 'auto_load_next_post_template_' . strtolower( $post_type ) ); |
|
227 | + $template = get_option('auto_load_next_post_template_'.strtolower($post_type)); |
|
228 | 228 | } |
229 | 229 | |
230 | - if ( !$template ) { |
|
230 | + if ( ! $template) { |
|
231 | 231 | return ''; |
232 | 232 | } |
233 | 233 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | } // END alnp_get_template() |
236 | 236 | } |
237 | 237 | |
238 | -if ( ! function_exists( 'alnp_find_template' ) ) { |
|
238 | +if ( ! function_exists('alnp_find_template')) { |
|
239 | 239 | /** |
240 | 240 | * Scans through the active theme to look for the content to load. |
241 | 241 | * If the content is not found then the fallback will be used. |
@@ -246,27 +246,27 @@ discard block |
||
246 | 246 | * @param string $post_format |
247 | 247 | * @return array |
248 | 248 | */ |
249 | - function alnp_find_template( $location = '', $post_type, $post_format ) { |
|
249 | + function alnp_find_template($location = '', $post_type, $post_format) { |
|
250 | 250 | // Templates to look for based on the post that is loaded. |
251 | - $templates = alnp_get_templates( $post_type, $post_format ); |
|
251 | + $templates = alnp_get_templates($post_type, $post_format); |
|
252 | 252 | |
253 | 253 | $found = false; |
254 | 254 | |
255 | 255 | // Scanning all possible templates within the set location. |
256 | - foreach( $templates as $template ) { |
|
256 | + foreach ($templates as $template) { |
|
257 | 257 | // Remove forwardslash if location is the parent theme folder. |
258 | - if ( empty( $location ) ) { |
|
258 | + if (empty($location)) { |
|
259 | 259 | $location = str_replace('/', '', $location); |
260 | 260 | } |
261 | 261 | |
262 | 262 | // If a template has been found then return it. |
263 | - if ( locate_template( $location . $template ) != '' && $found != true ) { |
|
264 | - $file = $location . $template; |
|
263 | + if (locate_template($location.$template) != '' && $found != true) { |
|
264 | + $file = $location.$template; |
|
265 | 265 | |
266 | - if ( ! empty( $post_format ) ) { |
|
267 | - update_option( 'auto_load_next_post_template_post_' . strtolower( $post_format ), $file ); |
|
266 | + if ( ! empty($post_format)) { |
|
267 | + update_option('auto_load_next_post_template_post_'.strtolower($post_format), $file); |
|
268 | 268 | } else { |
269 | - update_option( 'auto_load_next_post_template_' . strtolower( $post_type ), $file ); |
|
269 | + update_option('auto_load_next_post_template_'.strtolower($post_type), $file); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | $found = true; |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } // END alnp_find_template() |
281 | 281 | } |
282 | 282 | |
283 | -if ( ! function_exists( 'alnp_load_content' ) ) { |
|
283 | +if ( ! function_exists('alnp_load_content')) { |
|
284 | 284 | /** |
285 | 285 | * Loads theme template set either by theme support or setup wizard. |
286 | 286 | * If the content is not found then a fallback template will be used. |
@@ -289,59 +289,59 @@ discard block |
||
289 | 289 | * @param string $post_type |
290 | 290 | * @param string $post_format |
291 | 291 | */ |
292 | - function alnp_load_content( $post_type, $post_format ) { |
|
292 | + function alnp_load_content($post_type, $post_format) { |
|
293 | 293 | // Returns template location for supported themes. |
294 | 294 | $template_location = alnp_template_location(); |
295 | 295 | |
296 | 296 | $content_found = false; |
297 | 297 | |
298 | 298 | // Check and return directory and template if already found. |
299 | - if ( empty( $template_location ) ) { |
|
300 | - $directory = alnp_get_template_directory( $post_type, $post_format ); |
|
299 | + if (empty($template_location)) { |
|
300 | + $directory = alnp_get_template_directory($post_type, $post_format); |
|
301 | 301 | } else { |
302 | 302 | $directory = $template_location; |
303 | 303 | } |
304 | 304 | |
305 | - $template = alnp_get_template( $post_type, $post_format ); |
|
305 | + $template = alnp_get_template($post_type, $post_format); |
|
306 | 306 | |
307 | - if ( ! empty( $directory ) && ! empty( $template ) ) { |
|
308 | - $template = $directory . $template; |
|
307 | + if ( ! empty($directory) && ! empty($template)) { |
|
308 | + $template = $directory.$template; |
|
309 | 309 | $content_found = true; |
310 | 310 | } else { |
311 | 311 | // Possible locations where the content files are found. |
312 | 312 | $locations = alnp_get_locations(); |
313 | 313 | |
314 | 314 | // Scanning all possible locations. |
315 | - foreach( $locations as $location ) { |
|
316 | - $template = alnp_find_template( $directory, $post_type, $post_format ); |
|
315 | + foreach ($locations as $location) { |
|
316 | + $template = alnp_find_template($directory, $post_type, $post_format); |
|
317 | 317 | $content_found = $template['found']; |
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | 321 | // Can be overridden. |
322 | - $content_found = apply_filters( 'alnp_content_found', $content_found ); |
|
322 | + $content_found = apply_filters('alnp_content_found', $content_found); |
|
323 | 323 | |
324 | 324 | // Check if the user has forced the use of the fallback template. |
325 | - $use_fallback = get_option( 'auto_load_next_post_use_fallback' ); |
|
325 | + $use_fallback = get_option('auto_load_next_post_use_fallback'); |
|
326 | 326 | |
327 | 327 | // If content is found then load the template part. |
328 | - if ( $content_found && empty( $use_fallback ) ) { |
|
329 | - locate_template( $template, true, false ); |
|
328 | + if ($content_found && empty($use_fallback)) { |
|
329 | + locate_template($template, true, false); |
|
330 | 330 | } |
331 | 331 | else { |
332 | - do_action( 'alnp_load_content', $post_type ); |
|
332 | + do_action('alnp_load_content', $post_type); |
|
333 | 333 | } |
334 | 334 | } // END alnp_load_content() |
335 | 335 | } |
336 | 336 | |
337 | -if ( ! function_exists( 'alnp_load_fallback_content' ) ) { |
|
337 | +if ( ! function_exists('alnp_load_fallback_content')) { |
|
338 | 338 | /** |
339 | 339 | * Load fallback template should no content file be found. |
340 | 340 | * |
341 | 341 | * @since 1.6.0 |
342 | 342 | * @param string $post_type |
343 | 343 | */ |
344 | - function alnp_load_fallback_content( $post_type ) { |
|
345 | - get_template_part( AUTO_LOAD_NEXT_POST_FILE_PATH . '/templates/content/content', $post_type ); |
|
344 | + function alnp_load_fallback_content($post_type) { |
|
345 | + get_template_part(AUTO_LOAD_NEXT_POST_FILE_PATH.'/templates/content/content', $post_type); |
|
346 | 346 | } // END alnp_load_fallback_content() |
347 | 347 | } |
@@ -327,8 +327,7 @@ |
||
327 | 327 | // If content is found then load the template part. |
328 | 328 | if ( $content_found && empty( $use_fallback ) ) { |
329 | 329 | locate_template( $template, true, false ); |
330 | - } |
|
331 | - else { |
|
330 | + } else { |
|
332 | 331 | do_action( 'alnp_load_content', $post_type ); |
333 | 332 | } |
334 | 333 | } // END alnp_load_content() |
@@ -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> |