@@ -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_Autoloader' ) ) { |
|
19 | +if ( ! class_exists('Auto_Load_Next_Post_Autoloader')) { |
|
20 | 20 | |
21 | 21 | class Auto_Load_Next_Post_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 |
@@ -164,8 +164,12 @@ discard block |
||
164 | 164 | public function alnp_remove_widgets_panel( $components ) { |
165 | 165 | if ( $this->alnp_is_customizer() ) { |
166 | 166 | foreach( $components as $key => $component ) { |
167 | - if ( $component == 'widgets' ) unset( $components[ 'widgets' ] ); |
|
168 | - if ( $component == 'nav_menus' ) unset( $components[ 'nav_menus' ] ); |
|
167 | + if ( $component == 'widgets' ) { |
|
168 | + unset( $components[ 'widgets' ] ); |
|
169 | + } |
|
170 | + if ( $component == 'nav_menus' ) { |
|
171 | + unset( $components[ 'nav_menus' ] ); |
|
172 | + } |
|
169 | 173 | } |
170 | 174 | } |
171 | 175 | |
@@ -463,8 +467,7 @@ discard block |
||
463 | 467 | return false; |
464 | 468 | } elseif ( is_home() ) { |
465 | 469 | return true; |
466 | - } |
|
467 | - elseif ( is_singular( apply_filters( 'alnp_customizer_posts_ready', array( 'post' ) ) ) ) { |
|
470 | + } elseif ( is_singular( apply_filters( 'alnp_customizer_posts_ready', array( 'post' ) ) ) ) { |
|
468 | 471 | return true; |
469 | 472 | } |
470 | 473 | |
@@ -495,8 +498,7 @@ discard block |
||
495 | 498 | |
496 | 499 | return get_permalink( $id ); |
497 | 500 | endwhile; |
498 | - } |
|
499 | - else { |
|
501 | + } else { |
|
500 | 502 | return false; |
501 | 503 | } |
502 | 504 | } // END alnp_get_random_page_permalink() |
@@ -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( 'Auto_Load_Next_Post_Customizer' ) ) { |
|
17 | +if ( ! class_exists('Auto_Load_Next_Post_Customizer')) { |
|
18 | 18 | |
19 | 19 | class Auto_Load_Next_Post_Customizer { |
20 | 20 | |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @access public |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'customize_register', array( $this, 'alnp_init_customizer' ), 50 ); |
|
29 | - add_filter( 'customize_loaded_components', array( $this, 'alnp_remove_widgets_panel' ) ); |
|
28 | + add_action('customize_register', array($this, 'alnp_init_customizer'), 50); |
|
29 | + add_filter('customize_loaded_components', array($this, 'alnp_remove_widgets_panel')); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -36,21 +36,21 @@ discard block |
||
36 | 36 | * @since 1.5.0 |
37 | 37 | * @param WP_Customize_Manager $wp_customize The Customizer object. |
38 | 38 | */ |
39 | - public function alnp_init_customizer( $wp_customize ) { |
|
39 | + public function alnp_init_customizer($wp_customize) { |
|
40 | 40 | /** |
41 | 41 | * Dont add settings to the customizer if the user does |
42 | 42 | * not have permission to make changes to the theme. |
43 | 43 | */ |
44 | - if ( ! current_user_can( 'edit_theme_options' ) ) { |
|
44 | + if ( ! current_user_can('edit_theme_options')) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | |
48 | 48 | // Load custom controllers. |
49 | - require_once( dirname( __FILE__ ) . '/class-alnp-arbitrary-controller.php' ); |
|
49 | + require_once(dirname(__FILE__).'/class-alnp-arbitrary-controller.php'); |
|
50 | 50 | //require_once( dirname( __FILE__ ) . '/class-alnp-display-video-controller.php' ); |
51 | 51 | |
52 | 52 | // Auto Load Next Post Panel. |
53 | - $panel = array( 'panel' => 'alnp' ); |
|
53 | + $panel = array('panel' => 'alnp'); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Add the main panel and sections. |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | */ |
60 | 60 | $wp_customize->add_panel( |
61 | 61 | 'alnp', array( |
62 | - 'title' => esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), |
|
62 | + 'title' => esc_html__('Auto Load Next Post', 'auto-load-next-post'), |
|
63 | 63 | 'capability' => 'edit_theme_options', |
64 | - 'description' => esc_html__( 'Auto Load Next Post increases your pageviews by engaging the site viewers to keep reading your content rather than increasing your bounce rate.', 'auto-load-next-post' ), |
|
64 | + 'description' => esc_html__('Auto Load Next Post increases your pageviews by engaging the site viewers to keep reading your content rather than increasing your bounce rate.', 'auto-load-next-post'), |
|
65 | 65 | 'priority' => 160, |
66 | - 'active_callback' => array( $this, 'is_page_alnp_ready' ) |
|
66 | + 'active_callback' => array($this, 'is_page_alnp_ready') |
|
67 | 67 | ) |
68 | 68 | ); |
69 | 69 | |
@@ -71,24 +71,24 @@ discard block |
||
71 | 71 | $sections = $this->alnp_get_customizer_sections(); |
72 | 72 | |
73 | 73 | // Add each section. |
74 | - foreach ( $sections as $section => $args ) { |
|
74 | + foreach ($sections as $section => $args) { |
|
75 | 75 | /** |
76 | 76 | * If we are not only viewing Auto Load Next Post customizer sections |
77 | 77 | * then move them under our own panel. |
78 | 78 | */ |
79 | - if ( ! $this->alnp_is_customizer() ) { |
|
80 | - $args = array_merge( $args, $panel ); |
|
79 | + if ( ! $this->alnp_is_customizer()) { |
|
80 | + $args = array_merge($args, $panel); |
|
81 | 81 | } |
82 | 82 | |
83 | - $wp_customize->add_section( $section, $args ); |
|
83 | + $wp_customize->add_section($section, $args); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Get plugin settings. |
87 | 87 | $settings = $this->alnp_get_customizer_settings(); |
88 | 88 | |
89 | 89 | // Add each setting. |
90 | - foreach ( $settings as $setting => $args ) { |
|
91 | - $wp_customize->add_setting( $setting, $args ); |
|
90 | + foreach ($settings as $setting => $args) { |
|
91 | + $wp_customize->add_setting($setting, $args); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | * @since 1.5.0 |
98 | 98 | * @param WP_Customize_Manager $wp_customize The Customizer object. |
99 | 99 | */ |
100 | - do_action( 'alnp_customizer_register', $wp_customize ); |
|
100 | + do_action('alnp_customizer_register', $wp_customize); |
|
101 | 101 | |
102 | 102 | $controls = $this->alnp_get_customizer_controls(); |
103 | 103 | |
104 | - foreach ( $controls as $control => $args ) { |
|
105 | - $wp_customize->add_control( new $args['class']( $wp_customize, $control, $args ) ); |
|
104 | + foreach ($controls as $control => $args) { |
|
105 | + $wp_customize->add_control(new $args['class']($wp_customize, $control, $args)); |
|
106 | 106 | } |
107 | 107 | |
108 | - if ( $this->alnp_is_customizer() ) { |
|
109 | - $this->alnp_remove_default_customizer_panels( $wp_customize ); // Remove controls from the customizer. |
|
108 | + if ($this->alnp_is_customizer()) { |
|
109 | + $this->alnp_remove_default_customizer_panels($wp_customize); // Remove controls from the customizer. |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Video Help - Coming Soon |
@@ -128,30 +128,30 @@ discard block |
||
128 | 128 | * to tell users about the pro version, what comes with it |
129 | 129 | * and link to product page. |
130 | 130 | */ |
131 | - if ( ! is_alnp_pro_version_installed() ) { |
|
132 | - include_once( dirname( __FILE__ ) . '/class-alnp-pro-preview-controller.php' ); |
|
131 | + if ( ! is_alnp_pro_version_installed()) { |
|
132 | + include_once(dirname(__FILE__).'/class-alnp-pro-preview-controller.php'); |
|
133 | 133 | |
134 | 134 | $preview_args = array( |
135 | - 'title' => esc_html__( 'More?', 'auto-load-next-post' ), |
|
135 | + 'title' => esc_html__('More?', 'auto-load-next-post'), |
|
136 | 136 | 'priority' => 999, |
137 | 137 | ); |
138 | 138 | |
139 | - if ( ! $this->alnp_is_customizer() ) { |
|
140 | - $preview_args = array_merge( $preview_args, $panel ); |
|
139 | + if ( ! $this->alnp_is_customizer()) { |
|
140 | + $preview_args = array_merge($preview_args, $panel); |
|
141 | 141 | } |
142 | 142 | |
143 | - $wp_customize->add_section( 'alnp_pro_preview', $preview_args ); |
|
143 | + $wp_customize->add_section('alnp_pro_preview', $preview_args); |
|
144 | 144 | |
145 | - $wp_customize->add_setting( 'alnp_pro_preview', array( |
|
145 | + $wp_customize->add_setting('alnp_pro_preview', array( |
|
146 | 146 | 'default' => null, |
147 | - ) ); |
|
147 | + )); |
|
148 | 148 | |
149 | - $wp_customize->add_control( new Auto_Load_Next_Post_Pro_Preview_Controller( $wp_customize, 'alnp_pro_preview', array( |
|
150 | - 'label' => __( 'Looking for more options?', 'auto-load-next-post' ), |
|
149 | + $wp_customize->add_control(new Auto_Load_Next_Post_Pro_Preview_Controller($wp_customize, 'alnp_pro_preview', array( |
|
150 | + 'label' => __('Looking for more options?', 'auto-load-next-post'), |
|
151 | 151 | 'section' => 'alnp_pro_preview', |
152 | 152 | 'settings' => 'alnp_pro_preview', |
153 | 153 | 'priority' => 1, |
154 | - ) ) ); |
|
154 | + ))); |
|
155 | 155 | } |
156 | 156 | } // END alnp_init_customizer() |
157 | 157 | |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | * @param array $components Core Customizer components list. |
163 | 163 | * @return array (Maybe) modified components list. |
164 | 164 | */ |
165 | - public function alnp_remove_widgets_panel( $components ) { |
|
166 | - if ( $this->alnp_is_customizer() ) { |
|
167 | - foreach( $components as $key => $component ) { |
|
168 | - if ( $component == 'widgets' ) unset( $components[ 'widgets' ] ); |
|
169 | - if ( $component == 'nav_menus' ) unset( $components[ 'nav_menus' ] ); |
|
165 | + public function alnp_remove_widgets_panel($components) { |
|
166 | + if ($this->alnp_is_customizer()) { |
|
167 | + foreach ($components as $key => $component) { |
|
168 | + if ($component == 'widgets') unset($components['widgets']); |
|
169 | + if ($component == 'nav_menus') unset($components['nav_menus']); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param object $wp_customize |
182 | 182 | * @return boolean |
183 | 183 | */ |
184 | - public function alnp_remove_default_customizer_panels( $wp_customize ) { |
|
184 | + public function alnp_remove_default_customizer_panels($wp_customize) { |
|
185 | 185 | global $wp_customize; |
186 | 186 | |
187 | 187 | $wp_customize->remove_section("themes"); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return boolean |
205 | 205 | */ |
206 | 206 | public function alnp_is_customizer() { |
207 | - return isset( $_GET['alnp-customizer'] ) && $_GET['alnp-customizer'] === 'yes'; |
|
207 | + return isset($_GET['alnp-customizer']) && $_GET['alnp-customizer'] === 'yes'; |
|
208 | 208 | } // END alnp_is_customizer() |
209 | 209 | |
210 | 210 | /** |
@@ -219,23 +219,23 @@ discard block |
||
219 | 219 | * |
220 | 220 | * @param array $sections Customizer sections to add. |
221 | 221 | */ |
222 | - return apply_filters( 'auto_load_next_post_get_customizer_sections', array( |
|
222 | + return apply_filters('auto_load_next_post_get_customizer_sections', array( |
|
223 | 223 | 'auto_load_next_post_theme_selectors' => array( |
224 | 224 | 'capability' => 'edit_theme_options', |
225 | - 'title' => esc_html__( 'Theme Selectors', 'auto-load-next-post' ), |
|
226 | - 'description' => sprintf( __( 'Set the theme selectors below according to the theme. %1$sHow to find my theme selectors?%2$s', 'auto-load-next-post' ), '<a href="' . esc_url( 'https://autoloadnextpost.com/documentation/find-theme-selectors/?utm_source=wpcustomizer&utm_campaign=plugin-settings-theme-selectors' ) . '" target="_blank">', '</a>' ), |
|
225 | + 'title' => esc_html__('Theme Selectors', 'auto-load-next-post'), |
|
226 | + 'description' => sprintf(__('Set the theme selectors below according to the theme. %1$sHow to find my theme selectors?%2$s', 'auto-load-next-post'), '<a href="'.esc_url('https://autoloadnextpost.com/documentation/find-theme-selectors/?utm_source=wpcustomizer&utm_campaign=plugin-settings-theme-selectors').'" target="_blank">', '</a>'), |
|
227 | 227 | ), |
228 | 228 | 'auto_load_next_post_misc' => array( |
229 | 229 | 'capability' => 'edit_theme_options', |
230 | - 'title' => esc_html__( 'Misc Settings', 'auto-load-next-post' ), |
|
231 | - 'description' => sprintf( __( 'Here you can set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
230 | + 'title' => esc_html__('Misc Settings', 'auto-load-next-post'), |
|
231 | + 'description' => sprintf(__('Here you can set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
232 | 232 | ), |
233 | 233 | 'auto_load_next_post_events' => array( |
234 | 234 | 'capability' => 'edit_theme_options', |
235 | - 'title' => esc_html__( 'Events', 'auto-load-next-post' ), |
|
236 | - 'description' => sprintf( __( 'Below you can enter external JavaScript events to be triggered alongside %1$s native events. Separate each event like so: %2$s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<code>event1, event2,</code>' ), |
|
235 | + 'title' => esc_html__('Events', 'auto-load-next-post'), |
|
236 | + 'description' => sprintf(__('Below you can enter external JavaScript events to be triggered alongside %1$s native events. Separate each event like so: %2$s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<code>event1, event2,</code>'), |
|
237 | 237 | ), |
238 | - ) ); |
|
238 | + )); |
|
239 | 239 | } // END alnp_get_customizer_sections() |
240 | 240 | |
241 | 241 | /** |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $settings Customizer settings to add. |
254 | 254 | */ |
255 | - return apply_filters( 'auto_load_next_post_get_customizer_settings', array( |
|
255 | + return apply_filters('auto_load_next_post_get_customizer_settings', array( |
|
256 | 256 | 'auto_load_next_post_content_container' => array( |
257 | 257 | 'capability' => 'edit_theme_options', |
258 | 258 | 'default' => $settings['alnp_content_container'], |
259 | 259 | 'sanitize_callback' => 'wp_filter_post_kses', |
260 | - 'validate_callback' => array( $this, 'alnp_validate_content_container_selector' ), |
|
260 | + 'validate_callback' => array($this, 'alnp_validate_content_container_selector'), |
|
261 | 261 | 'transport' => 'postMessage', |
262 | 262 | 'type' => 'option', |
263 | 263 | ), |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | 'capability' => 'edit_theme_options', |
266 | 266 | 'default' => $settings['alnp_title_selector'], |
267 | 267 | 'sanitize_callback' => 'wp_filter_post_kses', |
268 | - 'validate_callback' => array( $this, 'alnp_validate_post_title_selector' ), |
|
268 | + 'validate_callback' => array($this, 'alnp_validate_post_title_selector'), |
|
269 | 269 | 'transport' => 'postMessage', |
270 | 270 | 'type' => 'option', |
271 | 271 | ), |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | 'capability' => 'edit_theme_options', |
274 | 274 | 'default' => $settings['alnp_navigation_container'], |
275 | 275 | 'sanitize_callback' => 'wp_filter_post_kses', |
276 | - 'validate_callback' => array( $this, 'alnp_validate_post_navigation_selector' ), |
|
276 | + 'validate_callback' => array($this, 'alnp_validate_post_navigation_selector'), |
|
277 | 277 | 'transport' => 'postMessage', |
278 | 278 | 'type' => 'option', |
279 | 279 | ), |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | 'transport' => 'postMessage', |
322 | 322 | 'type' => 'option', |
323 | 323 | ), |
324 | - ) ); |
|
324 | + )); |
|
325 | 325 | } // END alnp_get_customizer_settings() |
326 | 326 | |
327 | 327 | /** |
@@ -339,80 +339,80 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @param array $controls Customizer controls to add. |
341 | 341 | */ |
342 | - return apply_filters( 'auto_load_next_post_get_customizer_controls', array( |
|
342 | + return apply_filters('auto_load_next_post_get_customizer_controls', array( |
|
343 | 343 | 'alnp_content_container' => array( |
344 | 344 | 'class' => 'WP_Customize_Control', |
345 | - 'label' => esc_html__( 'Content Container', 'auto-load-next-post' ), |
|
346 | - 'description' => sprintf( __( 'The primary container where the post content is loaded in. Default: %s', 'auto-load-next-post' ), '<code>main.site-main</code>' ), |
|
345 | + 'label' => esc_html__('Content Container', 'auto-load-next-post'), |
|
346 | + 'description' => sprintf(__('The primary container where the post content is loaded in. Default: %s', 'auto-load-next-post'), '<code>main.site-main</code>'), |
|
347 | 347 | 'section' => 'auto_load_next_post_theme_selectors', |
348 | 348 | 'settings' => 'auto_load_next_post_content_container', |
349 | 349 | 'type' => 'text', |
350 | 350 | ), |
351 | 351 | 'alnp_title_selector' => array( |
352 | 352 | 'class' => 'WP_Customize_Control', |
353 | - 'label' => esc_html__( 'Post Title Selector', 'auto-load-next-post' ), |
|
354 | - 'description' => sprintf( __( 'Used to identify which article the user is reading and track should Google Analytics or other analytics be enabled. Default: %s', 'auto-load-next-post' ), '<code>h1.entry-title</code>' ), |
|
353 | + 'label' => esc_html__('Post Title Selector', 'auto-load-next-post'), |
|
354 | + 'description' => sprintf(__('Used to identify which article the user is reading and track should Google Analytics or other analytics be enabled. Default: %s', 'auto-load-next-post'), '<code>h1.entry-title</code>'), |
|
355 | 355 | 'section' => 'auto_load_next_post_theme_selectors', |
356 | 356 | 'settings' => 'auto_load_next_post_title_selector', |
357 | 357 | 'type' => 'text', |
358 | 358 | ), |
359 | 359 | 'alnp_navigation_container' => array( |
360 | 360 | 'class' => 'WP_Customize_Control', |
361 | - 'label' => esc_html__( 'Post Navigation Container', 'auto-load-next-post' ), |
|
362 | - 'description' => sprintf( __( 'Used to identify which post to load next if any. Default: %s', 'auto-load-next-post' ), '<code>nav.post-navigation</code>' ), |
|
361 | + 'label' => esc_html__('Post Navigation Container', 'auto-load-next-post'), |
|
362 | + 'description' => sprintf(__('Used to identify which post to load next if any. Default: %s', 'auto-load-next-post'), '<code>nav.post-navigation</code>'), |
|
363 | 363 | 'section' => 'auto_load_next_post_theme_selectors', |
364 | 364 | 'settings' => 'auto_load_next_post_navigation_container', |
365 | 365 | 'type' => 'text', |
366 | 366 | ), |
367 | 367 | 'alnp_comments_container' => array( |
368 | 368 | 'class' => 'WP_Customize_Control', |
369 | - 'label' => esc_html__( 'Comments Container', 'auto-load-next-post' ), |
|
370 | - 'description' => sprintf( __( 'Used to remove comments if enabled under <strong>%1$sMisc%2$s</strong> settings. Default: %3$s', 'auto-load-next-post' ), '<a href="javascript:wp.customize.section( \'auto_load_next_post_misc\' ).focus();">', '</a>', '<code>div#comments</code>' ), |
|
369 | + 'label' => esc_html__('Comments Container', 'auto-load-next-post'), |
|
370 | + 'description' => sprintf(__('Used to remove comments if enabled under <strong>%1$sMisc%2$s</strong> settings. Default: %3$s', 'auto-load-next-post'), '<a href="javascript:wp.customize.section( \'auto_load_next_post_misc\' ).focus();">', '</a>', '<code>div#comments</code>'), |
|
371 | 371 | 'section' => 'auto_load_next_post_theme_selectors', |
372 | 372 | 'settings' => 'auto_load_next_post_comments_container', |
373 | 373 | 'type' => 'text', |
374 | 374 | ), |
375 | 375 | 'alnp_remove_comments' => array( |
376 | 376 | 'class' => 'WP_Customize_Control', |
377 | - 'label' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
|
378 | - 'description' => esc_html__( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ), |
|
377 | + 'label' => esc_html__('Remove Comments', 'auto-load-next-post'), |
|
378 | + 'description' => esc_html__('Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post'), |
|
379 | 379 | 'section' => 'auto_load_next_post_misc', |
380 | 380 | 'settings' => 'auto_load_next_post_remove_comments', |
381 | 381 | 'type' => 'checkbox', |
382 | 382 | ), |
383 | 383 | 'alnp_google_analytics' => array( |
384 | 384 | 'class' => 'WP_Customize_Control', |
385 | - 'label' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
|
386 | - 'description' => esc_html__( 'Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post' ), |
|
385 | + 'label' => esc_html__('Update Google Analytics', 'auto-load-next-post'), |
|
386 | + 'description' => esc_html__('Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post'), |
|
387 | 387 | 'section' => 'auto_load_next_post_misc', |
388 | 388 | 'settings' => 'auto_load_next_post_google_analytics', |
389 | 389 | 'type' => 'checkbox', |
390 | 390 | ), |
391 | 391 | 'alnp_js_footer' => array( |
392 | 392 | 'class' => 'WP_Customize_Control', |
393 | - 'label' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
|
394 | - 'description' => esc_html__( 'Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site.', 'auto-load-next-post' ), |
|
393 | + 'label' => esc_html__('JavaScript in Footer?', 'auto-load-next-post'), |
|
394 | + 'description' => esc_html__('Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site.', 'auto-load-next-post'), |
|
395 | 395 | 'section' => 'auto_load_next_post_misc', |
396 | 396 | 'settings' => 'auto_load_next_post_google_analytics', |
397 | 397 | 'type' => 'checkbox', |
398 | 398 | ), |
399 | 399 | 'alnp_on_load_event' => array( |
400 | 400 | 'class' => 'WP_Customize_Control', |
401 | - 'label' => esc_html__( 'Post loaded', 'auto-load-next-post' ), |
|
402 | - 'description' => esc_html__( 'Events listed here will be triggered after a new post has loaded.', 'auto-load-next-post' ), |
|
401 | + 'label' => esc_html__('Post loaded', 'auto-load-next-post'), |
|
402 | + 'description' => esc_html__('Events listed here will be triggered after a new post has loaded.', 'auto-load-next-post'), |
|
403 | 403 | 'section' => 'auto_load_next_post_events', |
404 | 404 | 'settings' => 'auto_load_next_post_on_load_event', |
405 | 405 | 'type' => 'textarea', |
406 | 406 | ), |
407 | 407 | 'alnp_on_entering_event' => array( |
408 | 408 | 'class' => 'WP_Customize_Control', |
409 | - 'label' => esc_html__( 'Entering a Post', 'auto-load-next-post' ), |
|
410 | - 'description' => esc_html__( 'Events listed here will be triggered when entering a post.', 'auto-load-next-post' ), |
|
409 | + 'label' => esc_html__('Entering a Post', 'auto-load-next-post'), |
|
410 | + 'description' => esc_html__('Events listed here will be triggered when entering a post.', 'auto-load-next-post'), |
|
411 | 411 | 'section' => 'auto_load_next_post_events', |
412 | 412 | 'settings' => 'auto_load_next_post_on_entering_event', |
413 | 413 | 'type' => 'textarea', |
414 | 414 | ), |
415 | - ) ); |
|
415 | + )); |
|
416 | 416 | } // END alnp_get_customizer_controls() |
417 | 417 | |
418 | 418 | /** |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | * @param string $value Value, normally pre-sanitized. |
424 | 424 | * @return WP_Error $validity |
425 | 425 | */ |
426 | - public function alnp_validate_content_container_selector( $validity, $value ) { |
|
427 | - if ( empty( $value ) ) { |
|
428 | - $validity->add( 'required', esc_html__( 'The content container selector is empty. Will not know where to load posts without it.', 'auto-load-next-post' ) ); |
|
426 | + public function alnp_validate_content_container_selector($validity, $value) { |
|
427 | + if (empty($value)) { |
|
428 | + $validity->add('required', esc_html__('The content container selector is empty. Will not know where to load posts without it.', 'auto-load-next-post')); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | return $validity; |
@@ -439,9 +439,9 @@ discard block |
||
439 | 439 | * @param string $value Value, normally pre-sanitized. |
440 | 440 | * @return WP_Error $validity |
441 | 441 | */ |
442 | - public function alnp_validate_post_title_selector( $validity, $value ) { |
|
443 | - if ( empty( $value ) ) { |
|
444 | - $validity->add( 'required', esc_html__( 'The post title selector is empty. Will not be able to identify which article the user is reading.', 'auto-load-next-post' ) ); |
|
442 | + public function alnp_validate_post_title_selector($validity, $value) { |
|
443 | + if (empty($value)) { |
|
444 | + $validity->add('required', esc_html__('The post title selector is empty. Will not be able to identify which article the user is reading.', 'auto-load-next-post')); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | return $validity; |
@@ -455,9 +455,9 @@ discard block |
||
455 | 455 | * @param string $value Value, normally pre-sanitized. |
456 | 456 | * @return WP_Error $validity |
457 | 457 | */ |
458 | - public function alnp_validate_post_navigation_selector( $validity, $value ) { |
|
459 | - if ( empty( $value ) ) { |
|
460 | - $validity->add( 'required', esc_html__( 'The post navigation container selector is empty. Required so ALNP can look up the next post to load.', 'auto-load-next-post' ) ); |
|
458 | + public function alnp_validate_post_navigation_selector($validity, $value) { |
|
459 | + if (empty($value)) { |
|
460 | + $validity->add('required', esc_html__('The post navigation container selector is empty. Required so ALNP can look up the next post to load.', 'auto-load-next-post')); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | return $validity; |
@@ -471,16 +471,16 @@ discard block |
||
471 | 471 | */ |
472 | 472 | public function alnp_get_settings() { |
473 | 473 | $args = array( |
474 | - 'alnp_content_container' => get_option( 'auto_load_next_post_content_container' ), |
|
475 | - 'alnp_title_selector' => get_option( 'auto_load_next_post_title_selector' ), |
|
476 | - 'alnp_navigation_container' => get_option( 'auto_load_next_post_navigation_container' ), |
|
477 | - 'alnp_previous_post_selector' => get_option( 'auto_load_next_post_previous_post_selector' ), |
|
478 | - 'alnp_comments_container' => get_option( 'auto_load_next_post_comments_container' ), |
|
479 | - 'alnp_remove_comments' => get_option( 'auto_load_next_post_remove_comments' ), |
|
480 | - 'alnp_google_analytics' => get_option( 'auto_load_next_post_google_analytics' ), |
|
481 | - 'alnp_js_footer' => get_option( 'auto_load_next_post_js_footer' ), |
|
482 | - 'alnp_on_load_event' => get_option( 'auto_load_next_post_on_load_event' ), |
|
483 | - 'alnp_on_entering_event' => get_option( 'auto_load_next_post_on_entering_event' ), |
|
474 | + 'alnp_content_container' => get_option('auto_load_next_post_content_container'), |
|
475 | + 'alnp_title_selector' => get_option('auto_load_next_post_title_selector'), |
|
476 | + 'alnp_navigation_container' => get_option('auto_load_next_post_navigation_container'), |
|
477 | + 'alnp_previous_post_selector' => get_option('auto_load_next_post_previous_post_selector'), |
|
478 | + 'alnp_comments_container' => get_option('auto_load_next_post_comments_container'), |
|
479 | + 'alnp_remove_comments' => get_option('auto_load_next_post_remove_comments'), |
|
480 | + 'alnp_google_analytics' => get_option('auto_load_next_post_google_analytics'), |
|
481 | + 'alnp_js_footer' => get_option('auto_load_next_post_js_footer'), |
|
482 | + 'alnp_on_load_event' => get_option('auto_load_next_post_on_load_event'), |
|
483 | + 'alnp_on_entering_event' => get_option('auto_load_next_post_on_entering_event'), |
|
484 | 484 | ); |
485 | 485 | |
486 | 486 | return $args; |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | * @return boolean |
495 | 495 | */ |
496 | 496 | public function is_page_alnp_ready() { |
497 | - if ( is_front_page() && is_home() ) { |
|
497 | + if (is_front_page() && is_home()) { |
|
498 | 498 | return false; |
499 | - } elseif ( is_front_page() ) { |
|
499 | + } elseif (is_front_page()) { |
|
500 | 500 | return false; |
501 | - } elseif ( is_home() ) { |
|
501 | + } elseif (is_home()) { |
|
502 | 502 | return true; |
503 | 503 | } |
504 | - elseif ( is_singular( apply_filters( 'alnp_customizer_posts_ready', array( 'post' ) ) ) ) { |
|
504 | + elseif (is_singular(apply_filters('alnp_customizer_posts_ready', array('post')))) { |
|
505 | 505 | return true; |
506 | 506 | } |
507 | 507 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @param string $post_type - Default is post. |
517 | 517 | * @return int|boolean |
518 | 518 | */ |
519 | - public static function alnp_get_random_page_permalink( $post_type = 'post' ) { |
|
519 | + public static function alnp_get_random_page_permalink($post_type = 'post') { |
|
520 | 520 | $args = array( |
521 | 521 | 'post_type' => $post_type, |
522 | 522 | 'post_status' => 'publish', |
@@ -524,13 +524,13 @@ discard block |
||
524 | 524 | 'posts_per_page' => 1 |
525 | 525 | ); |
526 | 526 | |
527 | - $query = new WP_Query( $args ); |
|
527 | + $query = new WP_Query($args); |
|
528 | 528 | |
529 | - if ( $query->have_posts() ) { |
|
530 | - while ( $query->have_posts() ) : $query->the_post(); |
|
529 | + if ($query->have_posts()) { |
|
530 | + while ($query->have_posts()) : $query->the_post(); |
|
531 | 531 | $id = get_the_ID(); |
532 | 532 | |
533 | - return get_permalink( $id ); |
|
533 | + return get_permalink($id); |
|
534 | 534 | endwhile; |
535 | 535 | } |
536 | 536 | else { |
@@ -10,7 +10,7 @@ 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 | |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | <div class="notice notice-success auto-load-next-post-notice is-dismissible"> |
20 | 20 | <div class="auto-load-next-post-notice-inner"> |
21 | 21 | <div class="auto-load-next-post-notice-icon"> |
22 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
22 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
23 | 23 | </div> |
24 | 24 | |
25 | 25 | <div class="auto-load-next-post-notice-content"> |
26 | - <h3><?php echo esc_html__( 'Congratulations!', 'auto-load-next-post' ); ?></h3> |
|
27 | - <p><?php echo sprintf( __( 'Your current theme <strong>%1$s</strong> is supported. %2$s is ready to increase your pageviews. There is nothing else to setup so your good to go.', 'auto-load-next-post' ), $active_theme->name, esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
26 | + <h3><?php echo esc_html__('Congratulations!', 'auto-load-next-post'); ?></h3> |
|
27 | + <p><?php echo sprintf(__('Your current theme <strong>%1$s</strong> is supported. %2$s is ready to increase your pageviews. There is nothing else to setup so your good to go.', 'auto-load-next-post'), $active_theme->name, esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
28 | 28 | </div> |
29 | 29 | </div> |
30 | 30 | </div> |
@@ -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-info 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="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
21 | + <img src="https://ps.w.org/auto-load-next-post/assets/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 echo esc_html__( 'Thanks for trying out this beta!', 'auto-load-next-post' ); ?></h3> |
|
26 | - <p><?php printf( esc_html__( 'If you have any questions about the beta or if you have any feedback at all, let me know. Any little bit you\'re willing to share helps. You can %1$sjoin the Slack channel%2$s to provide feedback, discuss features to be added and integrations to support. Or you can just give feedback the old fashion way pressing the big button on the side.', 'auto-load-next-post' ), '<a href="' . esc_url( 'https://launchpass.com/autoloadnextpost' ) . '" target="_blank">', '</a>' ); ?></p> |
|
25 | + <h3><?php echo esc_html__('Thanks for trying out this beta!', 'auto-load-next-post'); ?></h3> |
|
26 | + <p><?php printf(esc_html__('If you have any questions about the beta or if you have any feedback at all, let me know. Any little bit you\'re willing to share helps. You can %1$sjoin the Slack channel%2$s to provide feedback, discuss features to be added and integrations to support. Or you can just give feedback the old fashion way pressing the big button on the side.', 'auto-load-next-post'), '<a href="'.esc_url('https://launchpass.com/autoloadnextpost').'" target="_blank">', '</a>'); ?></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/contact/' ), esc_html__( 'Give Feedback', 'auto-load-next-post' ) ); ?> |
|
31 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_beta_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'Ask me again in 7 days', '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/contact/'), esc_html__('Give Feedback', 'auto-load-next-post')); ?> |
|
31 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_beta_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('Ask me again in 7 days', 'auto-load-next-post'); ?></a> |
|
32 | 32 | </div> |
33 | 33 | </div> |
34 | 34 | </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="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
25 | + <img src="https://ps.w.org/auto-load-next-post/assets/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 echo esc_html__( 'Are you enjoying Auto Load Next Post?', 'auto-load-next-post' ); ?></h3> |
|
30 | - <p><?php printf( esc_html__( 'You have been using %1$s for %2$s now! Mind leaving a quick 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 echo esc_html__('Are you enjoying Auto Load Next Post?', 'auto-load-next-post'); ?></h3> |
|
30 | + <p><?php printf(esc_html__('You have been using %1$s for %2$s now! Mind leaving a quick 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( 'https://wordpress.org/support/plugin/auto-load-next-post/reviews?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('https://wordpress.org/support/plugin/auto-load-next-post/reviews?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> |
@@ -10,31 +10,31 @@ 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 | 17 | <div class="notice notice-success auto-load-next-post-notice"> |
18 | 18 | <div class="auto-load-next-post-notice-inner"> |
19 | 19 | <div class="auto-load-next-post-notice-icon"> |
20 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
20 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
21 | 21 | </div> |
22 | 22 | |
23 | 23 | <div class="auto-load-next-post-notice-content"> |
24 | - <h3><?php echo esc_html__( 'Welcome!', 'auto-load-next-post' ); ?></h3> |
|
24 | + <h3><?php echo esc_html__('Welcome!', 'auto-load-next-post'); ?></h3> |
|
25 | 25 | <p> |
26 | - <?php echo sprintf( __( 'Thank you for activating %1$s! If you\'re a first time user, welcome! You\'re well on your way to increasing your pageviews.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?> |
|
26 | + <?php echo sprintf(__('Thank you for activating %1$s! If you\'re a first time user, welcome! You\'re well on your way to increasing your pageviews.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?> |
|
27 | 27 | <?php |
28 | 28 | // If the theme has not added support then encourage the user to see the documentation. |
29 | - if ( !is_alnp_supported() ) { |
|
29 | + if ( ! is_alnp_supported()) { |
|
30 | 30 | $query = array( |
31 | 31 | 'autofocus[panel]' => 'alnp', |
32 | 32 | 'autofocus[section]' => 'auto_load_next_post_theme_selectors', |
33 | 33 | 'url' => ALNP_Customizer::alnp_get_random_page_permalink(), |
34 | - 'return' => admin_url( 'options-general.php?page=auto-load-next-post-settings' ), |
|
34 | + 'return' => admin_url('options-general.php?page=auto-load-next-post-settings'), |
|
35 | 35 | ); |
36 | - $customizer_link = add_query_arg( $query, admin_url( 'customize.php' ) ); |
|
37 | - echo sprintf( __( 'I encourage you to check out the plugin documentation and getting started with %1$ssetting up your theme selectors%2$s.', 'auto-load-next-post' ), '<a href="' . esc_url( $customizer_link ) . '">', '</a>' ); |
|
36 | + $customizer_link = add_query_arg($query, admin_url('customize.php')); |
|
37 | + echo sprintf(__('I encourage you to check out the plugin documentation and getting started with %1$ssetting up your theme selectors%2$s.', 'auto-load-next-post'), '<a href="'.esc_url($customizer_link).'">', '</a>'); |
|
38 | 38 | } |
39 | 39 | ?> |
40 | 40 | </p> |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | <div class="auto-load-next-post-documentation"> |
44 | 44 | <?php |
45 | 45 | // If the theme has not added support then display button to documentation. |
46 | - if ( !is_alnp_supported() ) { |
|
47 | - printf( '<a href="%1$s" class="button button-primary auto-load-next-post-documentation-button" target="_blank">%2$s</a>', esc_url( 'https://autoloadnextpost.com/documentation/?utm_source=plugin&utm_medium=link&utm_campaign=welcome-notice' ), esc_html__( 'Documentation', 'auto-load-next-post' ) ); |
|
46 | + if ( ! is_alnp_supported()) { |
|
47 | + printf('<a href="%1$s" class="button button-primary auto-load-next-post-documentation-button" target="_blank">%2$s</a>', esc_url('https://autoloadnextpost.com/documentation/?utm_source=plugin&utm_medium=link&utm_campaign=welcome-notice'), esc_html__('Documentation', 'auto-load-next-post')); |
|
48 | 48 | } |
49 | 49 | ?> |
50 | - <a href="<?php echo esc_url( add_query_arg( 'hide_auto_load_next_post_welcome_notice', 'true' ) ); ?>" class="no-thanks"><?php echo esc_html__( 'Dismiss Notice', 'auto-load-next-post' ); ?></a> |
|
50 | + <a href="<?php echo esc_url(add_query_arg('hide_auto_load_next_post_welcome_notice', 'true')); ?>" class="no-thanks"><?php echo esc_html__('Dismiss Notice', 'auto-load-next-post'); ?></a> |
|
51 | 51 | </div> |
52 | 52 | </div> |
53 | 53 | </div> |
@@ -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,16 +37,16 @@ discard block |
||
37 | 37 | * @version 1.5.0 |
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 | 42 | // Check WordPress enviroment. |
43 | - add_action( 'admin_init', array( $this, 'check_wp' ), 12 ); |
|
43 | + add_action('admin_init', array($this, 'check_wp'), 12); |
|
44 | 44 | |
45 | 45 | // Don't bug the user if they don't want to see any notices. |
46 | - add_action( 'admin_init', array( $this, 'dont_bug_me' ), 15 ); |
|
46 | + add_action('admin_init', array($this, 'dont_bug_me'), 15); |
|
47 | 47 | |
48 | 48 | // Display other admin notices when required. All are dismissable. |
49 | - add_action( 'admin_notices', array( $this, 'add_notices' ), 0 ); |
|
49 | + add_action('admin_notices', array($this, 'add_notices'), 0); |
|
50 | 50 | } // END __construct() |
51 | 51 | |
52 | 52 | /** |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | public function check_wp() { |
61 | 61 | global $wp_version; |
62 | 62 | |
63 | - if ( ! version_compare( $wp_version, AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE, '>=' ) ) { |
|
64 | - add_action( 'admin_notices', array( $this, 'requirement_wp_notice' ) ); |
|
63 | + if ( ! version_compare($wp_version, AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE, '>=')) { |
|
64 | + add_action('admin_notices', array($this, 'requirement_wp_notice')); |
|
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | |
@@ -81,25 +81,25 @@ discard block |
||
81 | 81 | $user_hidden_notice = false; |
82 | 82 | |
83 | 83 | // If the user is allowed to install plugins and requested to hide the review notice then hide it for that user. |
84 | - if ( ! empty( $_GET['hide_auto_load_next_post_review_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
85 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true ); |
|
84 | + if ( ! empty($_GET['hide_auto_load_next_post_review_notice']) && current_user_can('install_plugins')) { |
|
85 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true); |
|
86 | 86 | $user_hidden_notice = true; |
87 | 87 | } |
88 | 88 | |
89 | 89 | // If the user is allowed to install plugins and requested to hide the welcome notice then hide it for that user. |
90 | - if ( ! empty( $_GET['hide_auto_load_next_post_welcome_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
91 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_welcome_notice', '1', true ); |
|
90 | + if ( ! empty($_GET['hide_auto_load_next_post_welcome_notice']) && current_user_can('install_plugins')) { |
|
91 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_welcome_notice', '1', true); |
|
92 | 92 | $user_hidden_notice = true; |
93 | 93 | } |
94 | 94 | |
95 | - if ( ! empty( $_GET['hide_auto_load_next_post_beta_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
96 | - set_transient( 'alnp_beta_notice_hidden', 'hidden', WEEK_IN_SECONDS ); |
|
95 | + if ( ! empty($_GET['hide_auto_load_next_post_beta_notice']) && current_user_can('install_plugins')) { |
|
96 | + set_transient('alnp_beta_notice_hidden', 'hidden', WEEK_IN_SECONDS); |
|
97 | 97 | $user_hidden_notice = true; |
98 | 98 | } |
99 | 99 | |
100 | - if ( $user_hidden_notice ) { |
|
100 | + if ($user_hidden_notice) { |
|
101 | 101 | // Redirect to the plugins page. |
102 | - wp_safe_redirect( admin_url( 'plugins.php' ) ); exit; |
|
102 | + wp_safe_redirect(admin_url('plugins.php')); exit; |
|
103 | 103 | } |
104 | 104 | } // END dont_bug_me() |
105 | 105 | |
@@ -118,43 +118,43 @@ discard block |
||
118 | 118 | $template = get_option('template'); |
119 | 119 | |
120 | 120 | // Checks if the theme supports Auto Load Next Post. |
121 | - if ( is_alnp_supported() ) { |
|
121 | + if (is_alnp_supported()) { |
|
122 | 122 | // If supported theme does not match active theme then show notice. |
123 | - if ( get_option( 'auto_load_next_post_theme_supported' ) !== $template ) { |
|
124 | - add_action( 'admin_notices', array( $this, 'theme_ready_notice' ) ); |
|
125 | - update_option( 'auto_load_next_post_theme_supported', $template ); |
|
123 | + if (get_option('auto_load_next_post_theme_supported') !== $template) { |
|
124 | + add_action('admin_notices', array($this, 'theme_ready_notice')); |
|
125 | + update_option('auto_load_next_post_theme_supported', $template); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | else { |
129 | 129 | // If theme not supported then delete option. |
130 | - delete_option( 'auto_load_next_post_theme_supported' ); |
|
130 | + delete_option('auto_load_next_post_theme_supported'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // Is admin review notice hidden? |
134 | - $hide_review_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', true ); |
|
134 | + $hide_review_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', true); |
|
135 | 135 | |
136 | 136 | // Check if we need to display the review plugin notice. |
137 | - if ( current_user_can( 'install_plugins' ) && empty( $hide_review_notice ) ) { |
|
137 | + if (current_user_can('install_plugins') && empty($hide_review_notice)) { |
|
138 | 138 | // If it has been a week or more since activating the plugin then display the review notice. |
139 | - if ( ( intval( time() - self::$install_date ) ) > WEEK_IN_SECONDS ) { |
|
140 | - add_action( 'admin_notices', array( $this, 'plugin_review_notice' ) ); |
|
139 | + if ((intval(time() - self::$install_date)) > WEEK_IN_SECONDS) { |
|
140 | + add_action('admin_notices', array($this, 'plugin_review_notice')); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | 144 | // Is admin welcome notice hidden? |
145 | - $hide_welcome_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_welcome_notice', true ); |
|
145 | + $hide_welcome_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_welcome_notice', true); |
|
146 | 146 | |
147 | 147 | // Check if we need to display the welcome notice. |
148 | - if ( current_user_can( 'install_plugins' ) && empty( $hide_welcome_notice ) ) { |
|
148 | + if (current_user_can('install_plugins') && empty($hide_welcome_notice)) { |
|
149 | 149 | // If the user has just installed the plugin for the first time then welcome the user. |
150 | - if ( ( intval( time() - strtotime( self::$install_date ) ) / WEEK_IN_SECONDS ) % 52 <= 2 ) { |
|
151 | - add_action( 'admin_notices', array( $this, 'welcome_notice' ) ); |
|
150 | + if ((intval(time() - strtotime(self::$install_date)) / WEEK_IN_SECONDS) % 52 <= 2) { |
|
151 | + add_action('admin_notices', array($this, 'welcome_notice')); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | 155 | // Is this version of Auto Load Next Post a beta release? |
156 | - if ( is_alnp_beta() && empty( get_transient( 'alnp_beta_notice_hidden' ) ) ) { |
|
157 | - add_action( 'admin_notices', array( $this, 'beta_notice' ) ); |
|
156 | + if (is_alnp_beta() && empty(get_transient('alnp_beta_notice_hidden'))) { |
|
157 | + add_action('admin_notices', array($this, 'beta_notice')); |
|
158 | 158 | } |
159 | 159 | } // END add_notices() |
160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @since 1.4.3 |
166 | 166 | */ |
167 | 167 | public function requirement_wp_notice() { |
168 | - include( dirname( __FILE__ ) . '/views/html-notice-requirement-wp.php' ); |
|
168 | + include(dirname(__FILE__).'/views/html-notice-requirement-wp.php'); |
|
169 | 169 | } // END requirement_wp_notice() |
170 | 170 | |
171 | 171 | /** |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @since 1.5.0 |
176 | 176 | */ |
177 | 177 | public function theme_ready_notice() { |
178 | - include( dirname( __FILE__ ) . '/views/html-notice-theme-ready.php' ); |
|
178 | + include(dirname(__FILE__).'/views/html-notice-theme-ready.php'); |
|
179 | 179 | } // END theme_ready_notice() |
180 | 180 | |
181 | 181 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @since 1.5.0 |
186 | 186 | */ |
187 | 187 | public function welcome_notice() { |
188 | - include( dirname( __FILE__ ) . '/views/html-notice-welcome.php' ); |
|
188 | + include(dirname(__FILE__).'/views/html-notice-welcome.php'); |
|
189 | 189 | } // END welcome_notice() |
190 | 190 | |
191 | 191 | /** |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @since 1.5.0 |
196 | 196 | */ |
197 | 197 | public function beta_notice() { |
198 | - include( dirname( __FILE__ ) . '/views/html-notice-trying-beta.php' ); |
|
198 | + include(dirname(__FILE__).'/views/html-notice-trying-beta.php'); |
|
199 | 199 | } // END beta_notice() |
200 | 200 | |
201 | 201 | /** |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | public function plugin_review_notice() { |
209 | 209 | $install_date = self::$install_date; |
210 | 210 | |
211 | - include( dirname( __FILE__ ) . '/views/html-notice-please-review.php' ); |
|
211 | + include(dirname(__FILE__).'/views/html-notice-please-review.php'); |
|
212 | 212 | } // END plugin_review_notice() |
213 | 213 | |
214 | 214 | } // END class. |
@@ -124,8 +124,7 @@ |
||
124 | 124 | add_action( 'admin_notices', array( $this, 'theme_ready_notice' ) ); |
125 | 125 | update_option( 'auto_load_next_post_theme_supported', $template ); |
126 | 126 | } |
127 | - } |
|
128 | - else { |
|
127 | + } else { |
|
129 | 128 | // If theme not supported then delete option. |
130 | 129 | delete_option( 'auto_load_next_post_theme_supported' ); |
131 | 130 | } |
@@ -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 ( ! class_exists( 'Auto_Load_Next_Post_Admin_Help' ) ) { |
|
21 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Help')) { |
|
22 | 22 | |
23 | 23 | class Auto_Load_Next_Post_Admin_Help { |
24 | 24 | |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @since 1.0.0 |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_action( 'current_screen', array( $this, 'add_help_tabs' ), 50 ); |
|
32 | + add_action('current_screen', array($this, 'add_help_tabs'), 50); |
|
33 | 33 | } // END __construct() |
34 | 34 | |
35 | 35 | /** |
@@ -42,62 +42,62 @@ discard block |
||
42 | 42 | public function add_help_tabs() { |
43 | 43 | $screen = get_current_screen(); |
44 | 44 | |
45 | - if ( $screen->id != 'settings_page_auto-load-next-post-settings') { |
|
45 | + if ($screen->id != 'settings_page_auto-load-next-post-settings') { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | - $screen->add_help_tab( array( |
|
49 | + $screen->add_help_tab(array( |
|
50 | 50 | 'id' => 'auto_load_next_post_theme_selectors_tab', |
51 | - 'title' => __( 'Theme Selectors', 'auto-load-next-post' ), |
|
51 | + 'title' => __('Theme Selectors', 'auto-load-next-post'), |
|
52 | 52 | 'content' => |
53 | - '<h2>' . __( 'Theme Selectors', 'auto-load-next-post' ) . '</h2>' . |
|
54 | - '<p>' . sprintf( __( 'Theme Selectors allows %s look for where to load content in, the post being read, the next post to load and whether to show or hide comments per post.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . '</p>' . |
|
55 | - '<p>' . sprintf( __( 'When the plugin was activated, default theme selectors are set that match the majority of most WordPress themes. If the active theme supports %1$s then it will set its own theme selectors. If the theme has not declared support for %1$s and posts are not loading, dont worry. It is most likely that at least one of these selectors need to be changed. You may find it to be the <em>Content Container</em>. See more information on %2$show to find your theme selectors%3$s.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a href="https://autoloadnextpost.com/documentation/find-theme-selectors/">', '</a>' ) . '</p>' . |
|
56 | - '<p>' . sprintf( esc_html__( 'These are the default theme selectors when %s is installed.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . '</p>' . |
|
57 | - '<h5>' . esc_html__( 'Default Theme Selectors', 'auto-load-next-post' ) . '</h5>' . |
|
58 | - '<ul>' . |
|
59 | - '<li><strong>' . esc_html__( 'Content Container', 'auto-load-next-post' ) . '</strong>' . '<br>main.site-main</li>' . |
|
60 | - '<li><strong>' . esc_html__( 'Post Title', 'auto-load-next-post' ) . '</strong>' . '<br>h1.entry-title</li>' . |
|
61 | - '<li><strong>' . esc_html__( 'Post Navigation', 'auto-load-next-post' ) . '</strong>' . '<br>nav.post-navigation</li>' . |
|
62 | - '<li><strong>' . esc_html__( 'Comments Container', 'auto-load-next-post' ) . '</strong>' . '<br>div#comments</li>' . |
|
53 | + '<h2>'.__('Theme Selectors', 'auto-load-next-post').'</h2>'. |
|
54 | + '<p>'.sprintf(__('Theme Selectors allows %s look for where to load content in, the post being read, the next post to load and whether to show or hide comments per post.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).'</p>'. |
|
55 | + '<p>'.sprintf(__('When the plugin was activated, default theme selectors are set that match the majority of most WordPress themes. If the active theme supports %1$s then it will set its own theme selectors. If the theme has not declared support for %1$s and posts are not loading, dont worry. It is most likely that at least one of these selectors need to be changed. You may find it to be the <em>Content Container</em>. See more information on %2$show to find your theme selectors%3$s.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a href="https://autoloadnextpost.com/documentation/find-theme-selectors/">', '</a>').'</p>'. |
|
56 | + '<p>'.sprintf(esc_html__('These are the default theme selectors when %s is installed.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).'</p>'. |
|
57 | + '<h5>'.esc_html__('Default Theme Selectors', 'auto-load-next-post').'</h5>'. |
|
58 | + '<ul>'. |
|
59 | + '<li><strong>'.esc_html__('Content Container', 'auto-load-next-post').'</strong>'.'<br>main.site-main</li>'. |
|
60 | + '<li><strong>'.esc_html__('Post Title', 'auto-load-next-post').'</strong>'.'<br>h1.entry-title</li>'. |
|
61 | + '<li><strong>'.esc_html__('Post Navigation', 'auto-load-next-post').'</strong>'.'<br>nav.post-navigation</li>'. |
|
62 | + '<li><strong>'.esc_html__('Comments Container', 'auto-load-next-post').'</strong>'.'<br>div#comments</li>'. |
|
63 | 63 | '</ul>' |
64 | - ) ); |
|
64 | + )); |
|
65 | 65 | |
66 | - $screen->add_help_tab( array( |
|
66 | + $screen->add_help_tab(array( |
|
67 | 67 | 'id' => 'auto_load_next_post_support_tab', |
68 | - 'title' => esc_html__( 'Help & Support', 'auto-load-next-post' ), |
|
68 | + 'title' => esc_html__('Help & Support', 'auto-load-next-post'), |
|
69 | 69 | 'content' => |
70 | - '<h2>' . esc_html__( 'Help & Support', 'auto-load-next-post' ) . '</h2>' . |
|
71 | - '<p>' . sprintf( __( 'Should you need help understanding, using, or extending %1$s, please %2$sread the documentation%3$s. You will find snippets, tutorials and much more.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a href="https://autoloadnextpost.com/documentation/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" target="_blank">', '</a>' ) . '</p>' . |
|
72 | - '<p>' . sprintf( __( 'For further assistance with %1$s you can use the %2$scommunity forum%3$s.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a href="https://wordpress.org/support/plugin/auto-load-next-post" target="_blank">', '</a>' ) . '</p> ' . |
|
73 | - '<p>' . sprintf( __( '%1$s is in need of translations. Is the plugin not translated in your language or do you spot errors with the current translations? Helping out is easy! Head over to the project on WordPress.org and click %2$sTranslate %1$s%3$s.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a href="https://translate.wordpress.org/projects/wp-plugins/auto-load-next-post" target="_blank">', '</a>' ) . '</p>' . |
|
74 | - '<p><a href="https://autoloadnextpost.com/documentation/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" class="button button-primary" target="_blank">' . esc_html__( 'Documentation', 'auto-load-next-post' ) . '</a> <a href="https://wordpress.org/support/plugin/auto-load-next-post" class="button button-secondary" target="_blank">' . esc_html__( 'Community Forum', 'auto-load-next-post' ) . '</a> <a href="https://autoloadnextpost.com/f-a-q/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" class="button button-secondary" target="_blank">' . esc_html__( 'Frequently Asked Questions', 'auto-load-next-post' ) . '</a> <a href="https://translate.wordpress.org/projects/wp-plugins/auto-load-next-post" class="button button-secondary" target="_blank">' . sprintf( esc_html__( 'Translate %s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . '</a></p>' |
|
75 | - ) ); |
|
70 | + '<h2>'.esc_html__('Help & Support', 'auto-load-next-post').'</h2>'. |
|
71 | + '<p>'.sprintf(__('Should you need help understanding, using, or extending %1$s, please %2$sread the documentation%3$s. You will find snippets, tutorials and much more.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a href="https://autoloadnextpost.com/documentation/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" target="_blank">', '</a>').'</p>'. |
|
72 | + '<p>'.sprintf(__('For further assistance with %1$s you can use the %2$scommunity forum%3$s.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a href="https://wordpress.org/support/plugin/auto-load-next-post" target="_blank">', '</a>').'</p> '. |
|
73 | + '<p>'.sprintf(__('%1$s is in need of translations. Is the plugin not translated in your language or do you spot errors with the current translations? Helping out is easy! Head over to the project on WordPress.org and click %2$sTranslate %1$s%3$s.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a href="https://translate.wordpress.org/projects/wp-plugins/auto-load-next-post" target="_blank">', '</a>').'</p>'. |
|
74 | + '<p><a href="https://autoloadnextpost.com/documentation/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" class="button button-primary" target="_blank">'.esc_html__('Documentation', 'auto-load-next-post').'</a> <a href="https://wordpress.org/support/plugin/auto-load-next-post" class="button button-secondary" target="_blank">'.esc_html__('Community Forum', 'auto-load-next-post').'</a> <a href="https://autoloadnextpost.com/f-a-q/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" class="button button-secondary" target="_blank">'.esc_html__('Frequently Asked Questions', 'auto-load-next-post').'</a> <a href="https://translate.wordpress.org/projects/wp-plugins/auto-load-next-post" class="button button-secondary" target="_blank">'.sprintf(esc_html__('Translate %s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).'</a></p>' |
|
75 | + )); |
|
76 | 76 | |
77 | - $screen->add_help_tab( array( |
|
77 | + $screen->add_help_tab(array( |
|
78 | 78 | 'id' => 'auto_load_next_post_bugs_tab', |
79 | - 'title' => esc_html__( 'Found a bug?', 'auto-load-next-post' ), |
|
79 | + 'title' => esc_html__('Found a bug?', 'auto-load-next-post'), |
|
80 | 80 | 'content' => |
81 | - '<h2>' . esc_html__( 'Found a bug?', 'auto-load-next-post' ) . '</h2>' . |
|
82 | - '<p>' . sprintf( __( 'If you find a bug within %1$s, please %2$sreport the issue%4$s by creating a ticket on the GitHub repository where I can deal with it more appropriately. Please ensure that you have read the %3$sguidelines to contributing%4$s prior to submitting your report. To help me solve the issue, please be as descriptive as possible.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/issues?state=open" target="_blank">', '<a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/blob/master/CONTRIBUTING.md" target="_blank">', '</a>' ) . '</p>' . |
|
83 | - '<p><a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/issues?state=open" class="button button-primary" target="_blank">' . esc_html__( 'Report an Issue', 'auto-load-next-post' ) . '</a></p>' |
|
84 | - ) ); |
|
81 | + '<h2>'.esc_html__('Found a bug?', 'auto-load-next-post').'</h2>'. |
|
82 | + '<p>'.sprintf(__('If you find a bug within %1$s, please %2$sreport the issue%4$s by creating a ticket on the GitHub repository where I can deal with it more appropriately. Please ensure that you have read the %3$sguidelines to contributing%4$s prior to submitting your report. To help me solve the issue, please be as descriptive as possible.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/issues?state=open" target="_blank">', '<a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/blob/master/CONTRIBUTING.md" target="_blank">', '</a>').'</p>'. |
|
83 | + '<p><a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/issues?state=open" class="button button-primary" target="_blank">'.esc_html__('Report an Issue', 'auto-load-next-post').'</a></p>' |
|
84 | + )); |
|
85 | 85 | |
86 | 86 | $screen->add_help_tab(array( |
87 | 87 | 'id' => 'auto_load_next_post_feedback_tab', |
88 | - 'title' => esc_html__( 'Feedback', 'auto-load-next-post' ), |
|
88 | + 'title' => esc_html__('Feedback', 'auto-load-next-post'), |
|
89 | 89 | 'content' => |
90 | - '<h2>' . esc_html__( 'Feedback', 'auto-load-next-post' ) . '</h2>' . |
|
91 | - '<p>' . esc_html__( 'Your feedback is very important to me. Please consider leaving a review on WordPress.org or complete a simple survey.', 'auto-load-next-post' ) . '</p>' . |
|
92 | - '<p>' . sprintf( __( 'If %1$s has worked out for you well and you like it, please consider %2$smaking a donation%3$s.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), '<a href="https://www.buymeacoffee.com/sebastien" target="_blank">', '</a>' ) . '</p>'. |
|
93 | - '<p><a href="https://wordpress.org/support/view/plugin-reviews/auto-load-next-post?filter=5#postform" class="button button-primary" target="_blank">' . esc_html__( 'Submit a Review', 'auto-load-next-post' ) . '</a> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdzxlvnXRBIw8gqI7Z2O-HzYtncpGjDkLjlaeZLVsfrR61FNA/viewform?usp=sf_link" class="button button-secondary" target="_blank">' . esc_html__( 'Complete a Simple Survey', 'auto-load-next-post' ) . '</a> <a href="https://www.buymeacoffee.com/sebastien" class="button button-secondary" target="_blank">' . esc_html__( 'Make a Donation', 'auto-load-next-post' ) . '</a></p>' |
|
94 | - ) ); |
|
90 | + '<h2>'.esc_html__('Feedback', 'auto-load-next-post').'</h2>'. |
|
91 | + '<p>'.esc_html__('Your feedback is very important to me. Please consider leaving a review on WordPress.org or complete a simple survey.', 'auto-load-next-post').'</p>'. |
|
92 | + '<p>'.sprintf(__('If %1$s has worked out for you well and you like it, please consider %2$smaking a donation%3$s.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), '<a href="https://www.buymeacoffee.com/sebastien" target="_blank">', '</a>').'</p>'. |
|
93 | + '<p><a href="https://wordpress.org/support/view/plugin-reviews/auto-load-next-post?filter=5#postform" class="button button-primary" target="_blank">'.esc_html__('Submit a Review', 'auto-load-next-post').'</a> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdzxlvnXRBIw8gqI7Z2O-HzYtncpGjDkLjlaeZLVsfrR61FNA/viewform?usp=sf_link" class="button button-secondary" target="_blank">'.esc_html__('Complete a Simple Survey', 'auto-load-next-post').'</a> <a href="https://www.buymeacoffee.com/sebastien" class="button button-secondary" target="_blank">'.esc_html__('Make a Donation', 'auto-load-next-post').'</a></p>' |
|
94 | + )); |
|
95 | 95 | |
96 | 96 | $screen->set_help_sidebar( |
97 | - '<p><strong>' . esc_html__( 'For more information:', 'auto-load-next-post' ) . '</strong></p>' . |
|
98 | - '<p><a href="https://autoloadnextpost.com/about/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" target="_blank">' . sprintf( esc_html__( 'About %s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . '</a></p>' . |
|
99 | - '<p><a href="https://wordpress.org/plugins/auto-load-next-post/" target="_blank">' . esc_html__( 'WordPress.org Project', 'auto-load-next-post' ) . '</a></p>' . |
|
100 | - '<p><a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/" target="_blank">' . esc_html__( 'GitHub Project', 'auto-load-next-post' ) . '</a></p>' |
|
97 | + '<p><strong>'.esc_html__('For more information:', 'auto-load-next-post').'</strong></p>'. |
|
98 | + '<p><a href="https://autoloadnextpost.com/about/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" target="_blank">'.sprintf(esc_html__('About %s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).'</a></p>'. |
|
99 | + '<p><a href="https://wordpress.org/plugins/auto-load-next-post/" target="_blank">'.esc_html__('WordPress.org Project', 'auto-load-next-post').'</a></p>'. |
|
100 | + '<p><a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/" target="_blank">'.esc_html__('GitHub Project', 'auto-load-next-post').'</a></p>' |
|
101 | 101 | ); |
102 | 102 | |
103 | 103 | } // END add_help_tabs() |
@@ -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 | |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * @return string|array * |
27 | 27 | */ |
28 | 28 | function auto_load_next_post_clean($var) { |
29 | - if ( is_array( $var ) ) { |
|
30 | - return array_map( 'auto_load_next_post_clean', $var ); |
|
29 | + if (is_array($var)) { |
|
30 | + return array_map('auto_load_next_post_clean', $var); |
|
31 | 31 | } else { |
32 | - return is_scalar( $var ) ? sanitize_text_field( $var ) : $var; |
|
32 | + return is_scalar($var) ? sanitize_text_field($var) : $var; |
|
33 | 33 | } |
34 | 34 | } // END auto_load_next_post_clean() |
35 | 35 | |
@@ -40,58 +40,58 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param string $seconds Seconds in time. |
42 | 42 | */ |
43 | -function auto_load_next_post_seconds_to_words( $seconds ) { |
|
43 | +function auto_load_next_post_seconds_to_words($seconds) { |
|
44 | 44 | // Get the years. |
45 | - $years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100; |
|
46 | - if ( $years > 1 ) { |
|
45 | + $years = (intval($seconds) / YEAR_IN_SECONDS) % 100; |
|
46 | + if ($years > 1) { |
|
47 | 47 | /* translators: Number of years */ |
48 | - return sprintf( __( '%s years', 'auto-load-next-post' ), $years ); |
|
49 | - } elseif ( $years > 0 ) { |
|
50 | - return __( 'a year', 'auto-load-next-post' ); |
|
48 | + return sprintf(__('%s years', 'auto-load-next-post'), $years); |
|
49 | + } elseif ($years > 0) { |
|
50 | + return __('a year', 'auto-load-next-post'); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Get the weeks. |
54 | - $weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52; |
|
55 | - if ( $weeks > 1 ) { |
|
54 | + $weeks = (intval($seconds) / WEEK_IN_SECONDS) % 52; |
|
55 | + if ($weeks > 1) { |
|
56 | 56 | /* translators: Number of weeks */ |
57 | - return sprintf( __( '%s weeks', 'auto-load-next-post' ), $weeks ); |
|
58 | - } elseif ( $weeks > 0 ) { |
|
59 | - return __( 'a week', 'auto-load-next-post' ); |
|
57 | + return sprintf(__('%s weeks', 'auto-load-next-post'), $weeks); |
|
58 | + } elseif ($weeks > 0) { |
|
59 | + return __('a week', 'auto-load-next-post'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Get the days. |
63 | - $days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7; |
|
64 | - if ( $days > 1 ) { |
|
63 | + $days = (intval($seconds) / DAY_IN_SECONDS) % 7; |
|
64 | + if ($days > 1) { |
|
65 | 65 | /* translators: Number of days */ |
66 | - return sprintf( __( '%s days', 'auto-load-next-post' ), $days ); |
|
67 | - } elseif ( $days > 0 ) { |
|
68 | - return __( 'a day', 'auto-load-next-post' ); |
|
66 | + return sprintf(__('%s days', 'auto-load-next-post'), $days); |
|
67 | + } elseif ($days > 0) { |
|
68 | + return __('a day', 'auto-load-next-post'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Get the hours. |
72 | - $hours = ( intval( $seconds ) / HOUR_IN_SECONDS ) % 24; |
|
73 | - if ( $hours > 1 ) { |
|
72 | + $hours = (intval($seconds) / HOUR_IN_SECONDS) % 24; |
|
73 | + if ($hours > 1) { |
|
74 | 74 | /* translators: Number of hours */ |
75 | - return sprintf( __( '%s hours', 'auto-load-next-post' ), $hours ); |
|
76 | - } elseif ( $hours > 0 ) { |
|
77 | - return __( 'an hour', 'auto-load-next-post' ); |
|
75 | + return sprintf(__('%s hours', 'auto-load-next-post'), $hours); |
|
76 | + } elseif ($hours > 0) { |
|
77 | + return __('an hour', 'auto-load-next-post'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Get the minutes. |
81 | - $minutes = ( intval( $seconds ) / MINUTE_IN_SECONDS ) % 60; |
|
82 | - if ( $minutes > 1 ) { |
|
81 | + $minutes = (intval($seconds) / MINUTE_IN_SECONDS) % 60; |
|
82 | + if ($minutes > 1) { |
|
83 | 83 | /* translators: Number of minutes */ |
84 | - return sprintf( __( '%s minutes', 'auto-load-next-post' ), $minutes ); |
|
85 | - } elseif ( $minutes > 0 ) { |
|
86 | - return __( 'a minute', 'auto-load-next-post' ); |
|
84 | + return sprintf(__('%s minutes', 'auto-load-next-post'), $minutes); |
|
85 | + } elseif ($minutes > 0) { |
|
86 | + return __('a minute', 'auto-load-next-post'); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // Get the seconds. |
90 | - $seconds = intval( $seconds ) % 60; |
|
91 | - if ( $seconds > 1 ) { |
|
90 | + $seconds = intval($seconds) % 60; |
|
91 | + if ($seconds > 1) { |
|
92 | 92 | /* translators: Number of seconds */ |
93 | - return sprintf( __( '%s seconds', 'auto-load-next-post' ), $seconds ); |
|
94 | - } elseif ( $seconds > 0 ) { |
|
95 | - return __( 'a second', 'auto-load-next-post' ); |
|
93 | + return sprintf(__('%s seconds', 'auto-load-next-post'), $seconds); |
|
94 | + } elseif ($seconds > 0) { |
|
95 | + return __('a second', 'auto-load-next-post'); |
|
96 | 96 | } |
97 | 97 | } |