@@ -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_Help' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Help')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Admin_Help { |
21 | 21 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @since 1.0.0 |
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | - add_action( 'current_screen', array( $this, 'add_help_tabs' ), 50 ); |
|
29 | + add_action('current_screen', array($this, 'add_help_tabs'), 50); |
|
30 | 30 | } // END __construct() |
31 | 31 | |
32 | 32 | /** |
@@ -38,62 +38,62 @@ discard block |
||
38 | 38 | public function add_help_tabs() { |
39 | 39 | $screen = get_current_screen(); |
40 | 40 | |
41 | - if ( $screen->id != 'settings_page_auto-load-next-post-settings') { |
|
41 | + if ($screen->id != 'settings_page_auto-load-next-post-settings') { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - $screen->add_help_tab( array( |
|
45 | + $screen->add_help_tab(array( |
|
46 | 46 | 'id' => 'auto_load_next_post_docs_tab', |
47 | - 'title' => __( 'General Settings', 'auto-load-next-post' ), |
|
47 | + 'title' => __('General Settings', 'auto-load-next-post'), |
|
48 | 48 | 'content' => |
49 | - '<h2>' . __( 'General Settings', 'auto-load-next-post' ) . '</h2>' . |
|
50 | - '<p>' . sprintf( __( '%s requires theme selectors to match the active theme in order to detect the elements and let the magic happen.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . '</p>' . |
|
51 | - '<p>' . __( 'When the plugin was activated, the theme selectors are set to WordPress theme standard. If you are experiencing any problems, it is most likely that at least one of these selectors need to be changed however it could also be related with the theme template structure.', 'auto-load-next-post' ) . '</p>' . |
|
52 | - '<p>' . __( 'These are the default theme selectors when Auto Load Next Post is installed.', 'auto-load-next-post' ) . '</p>' . |
|
53 | - '<h5>' . __( 'Default Theme Selectors', 'auto-load-next-post' ) . '</h5>' . |
|
54 | - '<ul>' . |
|
55 | - '<li><strong>' . __( 'Content Container', 'auto-load-next-post' ) . '</strong>' . '<br>main.site-main</li>' . |
|
56 | - '<li><strong>' . __( 'Post Title', 'auto-load-next-post' ) . '</strong>' . '<br>h1.entry-title</li>' . |
|
57 | - '<li><strong>' . __( 'Post Navigation', 'auto-load-next-post' ) . '</strong>' . '<br>nav.post-navigation</li>' . |
|
58 | - '<li><strong>' . __( 'Comments Container', 'auto-load-next-post' ) . '</strong>' . '<br>div#comments</li>' . |
|
49 | + '<h2>'.__('General Settings', 'auto-load-next-post').'</h2>'. |
|
50 | + '<p>'.sprintf(__('%s requires theme selectors to match the active theme in order to detect the elements and let the magic happen.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).'</p>'. |
|
51 | + '<p>'.__('When the plugin was activated, the theme selectors are set to WordPress theme standard. If you are experiencing any problems, it is most likely that at least one of these selectors need to be changed however it could also be related with the theme template structure.', 'auto-load-next-post').'</p>'. |
|
52 | + '<p>'.__('These are the default theme selectors when Auto Load Next Post is installed.', 'auto-load-next-post').'</p>'. |
|
53 | + '<h5>'.__('Default Theme Selectors', 'auto-load-next-post').'</h5>'. |
|
54 | + '<ul>'. |
|
55 | + '<li><strong>'.__('Content Container', 'auto-load-next-post').'</strong>'.'<br>main.site-main</li>'. |
|
56 | + '<li><strong>'.__('Post Title', 'auto-load-next-post').'</strong>'.'<br>h1.entry-title</li>'. |
|
57 | + '<li><strong>'.__('Post Navigation', 'auto-load-next-post').'</strong>'.'<br>nav.post-navigation</li>'. |
|
58 | + '<li><strong>'.__('Comments Container', 'auto-load-next-post').'</strong>'.'<br>div#comments</li>'. |
|
59 | 59 | '</ul>' |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | - $screen->add_help_tab( array( |
|
62 | + $screen->add_help_tab(array( |
|
63 | 63 | 'id' => 'auto_load_next_post_support_tab', |
64 | - 'title' => __( 'Help & Support', 'auto-load-next-post' ), |
|
64 | + 'title' => __('Help & Support', 'auto-load-next-post'), |
|
65 | 65 | 'content' => |
66 | - '<h2>' . __( 'Help & Support', 'auto-load-next-post' ) . '</h2>' . |
|
67 | - '<p>' . sprintf( __( 'Should you need help understanding, using, or extending Auto Load Next Post, please <a href="https://autoloadnextpost.com/documentation/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" target="_blank">read the documentation</a>. You will find snippets, tutorials and much more.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . '</p>' . |
|
68 | - '<p>' . sprintf( __( 'For further assistance with %s you can use the <a href="%s" target="_blank">community forum</a>.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), 'https://wordpress.org/support/plugin/auto-load-next-post' ) . '</p> ' . |
|
69 | - '<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 <a href="https://translate.wordpress.org/projects/wp-plugins/auto-load-next-post" target="_blank">Translate %1$s</a>.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . '</p>' . |
|
70 | - '<p><a href="https://autoloadnextpost.com/documentation/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" class="button button-primary" target="_blank">' . __( 'Documentation', 'auto-load-next-post' ) . '</a> <a href="https://wordpress.org/support/plugin/auto-load-next-post" class="button button-secondary" target="_blank">' . __( '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" target="_blank">' . __( 'Frequently Asked Questions', 'auto-load-next-post' ) . '</a></p>' |
|
71 | - ) ); |
|
66 | + '<h2>'.__('Help & Support', 'auto-load-next-post').'</h2>'. |
|
67 | + '<p>'.sprintf(__('Should you need help understanding, using, or extending Auto Load Next Post, please <a href="https://autoloadnextpost.com/documentation/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" target="_blank">read the documentation</a>. You will find snippets, tutorials and much more.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).'</p>'. |
|
68 | + '<p>'.sprintf(__('For further assistance with %s you can use the <a href="%s" target="_blank">community forum</a>.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), 'https://wordpress.org/support/plugin/auto-load-next-post').'</p> '. |
|
69 | + '<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 <a href="https://translate.wordpress.org/projects/wp-plugins/auto-load-next-post" target="_blank">Translate %1$s</a>.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).'</p>'. |
|
70 | + '<p><a href="https://autoloadnextpost.com/documentation/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" class="button button-primary" target="_blank">'.__('Documentation', 'auto-load-next-post').'</a> <a href="https://wordpress.org/support/plugin/auto-load-next-post" class="button button-secondary" target="_blank">'.__('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" target="_blank">'.__('Frequently Asked Questions', 'auto-load-next-post').'</a></p>' |
|
71 | + )); |
|
72 | 72 | |
73 | - $screen->add_help_tab( array( |
|
73 | + $screen->add_help_tab(array( |
|
74 | 74 | 'id' => 'auto_load_next_post_bugs_tab', |
75 | - 'title' => __( 'Found a bug?', 'auto-load-next-post' ), |
|
75 | + 'title' => __('Found a bug?', 'auto-load-next-post'), |
|
76 | 76 | 'content' => |
77 | - '<h2>' . __( 'Found a bug?', 'auto-load-next-post' ) . '</h2>' . |
|
78 | - '<p>' . sprintf( __( 'If you find a bug within %s, please <a href="%s" target="_blank">report the issue</a> by creating a ticket on the GitHub repository where I can deal with it more appropriately. Please ensure that you have read the <a href="%s" target="_blank">guidelines to contributing</a> 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' ), 'https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/issues?state=open', 'https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/blob/master/CONTRIBUTING.md') . '</p>' . |
|
79 | - '<p><a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/issues?state=open" class="button button-primary" target="_blank">' . __( 'Report an Issue', 'auto-load-next-post' ) . '</a></p>' |
|
80 | - ) ); |
|
77 | + '<h2>'.__('Found a bug?', 'auto-load-next-post').'</h2>'. |
|
78 | + '<p>'.sprintf(__('If you find a bug within %s, please <a href="%s" target="_blank">report the issue</a> by creating a ticket on the GitHub repository where I can deal with it more appropriately. Please ensure that you have read the <a href="%s" target="_blank">guidelines to contributing</a> 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'), 'https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/issues?state=open', 'https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/blob/master/CONTRIBUTING.md').'</p>'. |
|
79 | + '<p><a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/issues?state=open" class="button button-primary" target="_blank">'.__('Report an Issue', 'auto-load-next-post').'</a></p>' |
|
80 | + )); |
|
81 | 81 | |
82 | 82 | $screen->add_help_tab(array( |
83 | 83 | 'id' => 'auto_load_next_post_feedback_tab', |
84 | - 'title' => __( 'Feedback', 'auto-load-next-post' ), |
|
84 | + 'title' => __('Feedback', 'auto-load-next-post'), |
|
85 | 85 | 'content' => |
86 | - '<h2>' . __( 'Feedback', 'auto-load-next-post' ) . '</h2>' . |
|
87 | - '<p>' . __( '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>' . |
|
88 | - '<p>' . sprintf( __( 'If %1$s has worked out for you well and you like it, please consider <a href="%2$s" target="_blank">making a donation</a>.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), 'https://autoloadnextpost.com/donate/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab').'</p>'. |
|
89 | - '<p><a href="https://wordpress.org/support/view/plugin-reviews/auto-load-next-post?filter=5#postform" class="button button-primary" target="_blank">' . __( '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">' . __( 'Complete a Simple Survey', 'auto-load-next-post' ) . '</a> <a href="https://autoloadnextpost.com/donate/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" class="button button-secondary" target="_blank">' . __( 'Make a Donation', 'auto-load-next-post' ) . '</a></p>' |
|
90 | - ) ); |
|
86 | + '<h2>'.__('Feedback', 'auto-load-next-post').'</h2>'. |
|
87 | + '<p>'.__('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>'. |
|
88 | + '<p>'.sprintf(__('If %1$s has worked out for you well and you like it, please consider <a href="%2$s" target="_blank">making a donation</a>.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post'), 'https://autoloadnextpost.com/donate/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab').'</p>'. |
|
89 | + '<p><a href="https://wordpress.org/support/view/plugin-reviews/auto-load-next-post?filter=5#postform" class="button button-primary" target="_blank">'.__('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">'.__('Complete a Simple Survey', 'auto-load-next-post').'</a> <a href="https://autoloadnextpost.com/donate/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" class="button button-secondary" target="_blank">'.__('Make a Donation', 'auto-load-next-post').'</a></p>' |
|
90 | + )); |
|
91 | 91 | |
92 | 92 | $screen->set_help_sidebar( |
93 | - '<p><strong>' . __( 'For more information:', 'auto-load-next-post' ) . '</strong></p>' . |
|
94 | - '<p><a href="https://autoloadnextpost.com/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" target="_blank">' . sprintf( __( 'About %s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . '</a></p>' . |
|
95 | - '<p><a href="https://wordpress.org/plugins/auto-load-next-post" target="_blank">' . __( 'WordPress.org Project', 'auto-load-next-post' ) . '</a></p>' . |
|
96 | - '<p><a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/" target="_blank">' . __( 'Github Project', 'auto-load-next-post' ) . '</a></p>' |
|
93 | + '<p><strong>'.__('For more information:', 'auto-load-next-post').'</strong></p>'. |
|
94 | + '<p><a href="https://autoloadnextpost.com/?utm_source=wpadmin&utm_campaign=plugin-settings-help-tab" target="_blank">'.sprintf(__('About %s', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).'</a></p>'. |
|
95 | + '<p><a href="https://wordpress.org/plugins/auto-load-next-post" target="_blank">'.__('WordPress.org Project', 'auto-load-next-post').'</a></p>'. |
|
96 | + '<p><a href="https://github.com/AutoLoadNextPost/Auto-Load-Next-Post/" target="_blank">'.__('Github Project', 'auto-load-next-post').'</a></p>' |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | } // END add_help_tabs() |
@@ -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_Install' ) ) { |
|
19 | +if ( ! class_exists('Auto_Load_Next_Post_Install')) { |
|
20 | 20 | |
21 | 21 | class Auto_Load_Next_Post_Install { |
22 | 22 | |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | * @access public |
38 | 38 | */ |
39 | 39 | public function __construct() { |
40 | - add_action( 'init', array( __CLASS__, 'add_rewrite_endpoint' ), 0 ); |
|
41 | - add_action( 'init', array( __CLASS__, 'check_version' ), 5 ); |
|
40 | + add_action('init', array(__CLASS__, 'add_rewrite_endpoint'), 0); |
|
41 | + add_action('init', array(__CLASS__, 'check_version'), 5); |
|
42 | 42 | |
43 | 43 | // Get plugin version. |
44 | - self::$current_version = get_option( 'auto_load_next_post_version', null ); |
|
44 | + self::$current_version = get_option('auto_load_next_post_version', null); |
|
45 | 45 | } // END __construct() |
46 | 46 | |
47 | 47 | /** |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @since 1.4.10 |
55 | 55 | */ |
56 | 56 | public static function check_version() { |
57 | - if ( ! defined( 'IFRAME_REQUEST' ) && version_compare( self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<' ) ) { |
|
57 | + if ( ! defined('IFRAME_REQUEST') && version_compare(self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<')) { |
|
58 | 58 | self::install(); |
59 | - do_action( 'auto_load_next_post_updated' ); |
|
59 | + do_action('auto_load_next_post_updated'); |
|
60 | 60 | } |
61 | 61 | } // END check_version() |
62 | 62 | |
@@ -69,19 +69,19 @@ discard block |
||
69 | 69 | * @version 1.4.10 |
70 | 70 | */ |
71 | 71 | public static function install() { |
72 | - if ( ! is_blog_installed() ) { |
|
72 | + if ( ! is_blog_installed()) { |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // Check if we are not already running this routine. |
77 | - if ( 'yes' === get_transient( 'alnp_installing' ) ) { |
|
77 | + if ('yes' === get_transient('alnp_installing')) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | 81 | // If we made it till here nothing is running yet, lets set the transient now for five minutes. |
82 | - set_transient( 'alnp_installing', 'yes', MINUTE_IN_SECONDS * 5 ); |
|
83 | - if ( ! defined( 'AUTO_LOAD_NEXT_POST_INSTALLING' ) ) { |
|
84 | - define( 'AUTO_LOAD_NEXT_POST_INSTALLING', true ); |
|
82 | + set_transient('alnp_installing', 'yes', MINUTE_IN_SECONDS * 5); |
|
83 | + if ( ! defined('AUTO_LOAD_NEXT_POST_INSTALLING')) { |
|
84 | + define('AUTO_LOAD_NEXT_POST_INSTALLING', true); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | // Add default options. |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | // Set activation date. |
94 | 94 | self::set_install_date(); |
95 | 95 | |
96 | - delete_transient( 'alnp_installing' ); |
|
96 | + delete_transient('alnp_installing'); |
|
97 | 97 | |
98 | - do_action( 'alnp_installed' ); |
|
98 | + do_action('alnp_installed'); |
|
99 | 99 | } // END install() |
100 | 100 | |
101 | 101 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @static |
106 | 106 | */ |
107 | 107 | private static function update_version() { |
108 | - update_option( 'auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION ); |
|
108 | + update_option('auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION); |
|
109 | 109 | } // END update_version() |
110 | 110 | |
111 | 111 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @version 1.4.10 |
118 | 118 | */ |
119 | 119 | public static function set_install_date() { |
120 | - add_site_option( 'auto_load_next_post_install_date', time() ); |
|
120 | + add_site_option('auto_load_next_post_install_date', time()); |
|
121 | 121 | } // END set_install_date() |
122 | 122 | |
123 | 123 | /** |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public static function create_options() { |
133 | 133 | // Include settings so that we can run through defaults |
134 | - include_once( dirname( __FILE__ ) . '/admin/class-auto-load-next-post-admin-settings.php' ); |
|
134 | + include_once(dirname(__FILE__).'/admin/class-auto-load-next-post-admin-settings.php'); |
|
135 | 135 | |
136 | 136 | $settings = Auto_Load_Next_Post_Admin_Settings::get_settings_pages(); |
137 | 137 | |
138 | - foreach ( $settings as $section ) { |
|
139 | - foreach ( $section->get_settings() as $value ) { |
|
140 | - if ( isset( $value['default'] ) && isset( $value['id'] ) ) { |
|
141 | - $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true; |
|
142 | - add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) ); |
|
138 | + foreach ($settings as $section) { |
|
139 | + foreach ($section->get_settings() as $value) { |
|
140 | + if (isset($value['default']) && isset($value['id'])) { |
|
141 | + $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true; |
|
142 | + add_option($value['id'], $value['default'], '', ($autoload ? 'yes' : 'no')); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @since 1.0.0 |
153 | 153 | */ |
154 | 154 | public static function add_rewrite_endpoint() { |
155 | - add_rewrite_endpoint( 'partial', EP_PERMALINK ); |
|
155 | + add_rewrite_endpoint('partial', EP_PERMALINK); |
|
156 | 156 | |
157 | 157 | // Refresh permalinks |
158 | 158 | flush_rewrite_rules(); |
@@ -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 | |
@@ -33,58 +33,58 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param string $seconds Seconds in time. |
35 | 35 | */ |
36 | -function auto_load_next_post_seconds_to_words( $seconds ) { |
|
36 | +function auto_load_next_post_seconds_to_words($seconds) { |
|
37 | 37 | // Get the years. |
38 | - $years = ( intval( $seconds ) / YEAR_IN_SECONDS ) % 100; |
|
39 | - if ( $years > 1 ) { |
|
38 | + $years = (intval($seconds) / YEAR_IN_SECONDS) % 100; |
|
39 | + if ($years > 1) { |
|
40 | 40 | /* translators: Number of years */ |
41 | - return sprintf( __( '%s years', 'auto-load-next-post' ), $years ); |
|
42 | - } elseif ( $years > 0 ) { |
|
43 | - return __( 'a year', 'auto-load-next-post' ); |
|
41 | + return sprintf(__('%s years', 'auto-load-next-post'), $years); |
|
42 | + } elseif ($years > 0) { |
|
43 | + return __('a year', 'auto-load-next-post'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // Get the weeks. |
47 | - $weeks = ( intval( $seconds ) / WEEK_IN_SECONDS ) % 52; |
|
48 | - if ( $weeks > 1 ) { |
|
47 | + $weeks = (intval($seconds) / WEEK_IN_SECONDS) % 52; |
|
48 | + if ($weeks > 1) { |
|
49 | 49 | /* translators: Number of weeks */ |
50 | - return sprintf( __( '%s weeks', 'auto-load-next-post' ), $weeks ); |
|
51 | - } elseif ( $weeks > 0 ) { |
|
52 | - return __( 'a week', 'auto-load-next-post' ); |
|
50 | + return sprintf(__('%s weeks', 'auto-load-next-post'), $weeks); |
|
51 | + } elseif ($weeks > 0) { |
|
52 | + return __('a week', 'auto-load-next-post'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // Get the days. |
56 | - $days = ( intval( $seconds ) / DAY_IN_SECONDS ) % 7; |
|
57 | - if ( $days > 1 ) { |
|
56 | + $days = (intval($seconds) / DAY_IN_SECONDS) % 7; |
|
57 | + if ($days > 1) { |
|
58 | 58 | /* translators: Number of days */ |
59 | - return sprintf( __( '%s days', 'auto-load-next-post' ), $days ); |
|
60 | - } elseif ( $days > 0 ) { |
|
61 | - return __( 'a day', 'auto-load-next-post' ); |
|
59 | + return sprintf(__('%s days', 'auto-load-next-post'), $days); |
|
60 | + } elseif ($days > 0) { |
|
61 | + return __('a day', 'auto-load-next-post'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Get the hours. |
65 | - $hours = ( intval( $seconds ) / HOUR_IN_SECONDS ) % 24; |
|
66 | - if ( $hours > 1 ) { |
|
65 | + $hours = (intval($seconds) / HOUR_IN_SECONDS) % 24; |
|
66 | + if ($hours > 1) { |
|
67 | 67 | /* translators: Number of hours */ |
68 | - return sprintf( __( '%s hours', 'auto-load-next-post' ), $hours ); |
|
69 | - } elseif ( $hours > 0 ) { |
|
70 | - return __( 'an hour', 'auto-load-next-post' ); |
|
68 | + return sprintf(__('%s hours', 'auto-load-next-post'), $hours); |
|
69 | + } elseif ($hours > 0) { |
|
70 | + return __('an hour', 'auto-load-next-post'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Get the minutes. |
74 | - $minutes = ( intval( $seconds ) / MINUTE_IN_SECONDS ) % 60; |
|
75 | - if ( $minutes > 1 ) { |
|
74 | + $minutes = (intval($seconds) / MINUTE_IN_SECONDS) % 60; |
|
75 | + if ($minutes > 1) { |
|
76 | 76 | /* translators: Number of minutes */ |
77 | - return sprintf( __( '%s minutes', 'auto-load-next-post' ), $minutes ); |
|
78 | - } elseif ( $minutes > 0 ) { |
|
79 | - return __( 'a minute', 'auto-load-next-post' ); |
|
77 | + return sprintf(__('%s minutes', 'auto-load-next-post'), $minutes); |
|
78 | + } elseif ($minutes > 0) { |
|
79 | + return __('a minute', 'auto-load-next-post'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // Get the seconds. |
83 | - $seconds = intval( $seconds ) % 60; |
|
84 | - if ( $seconds > 1 ) { |
|
83 | + $seconds = intval($seconds) % 60; |
|
84 | + if ($seconds > 1) { |
|
85 | 85 | /* translators: Number of seconds */ |
86 | - return sprintf( __( '%s seconds', 'auto-load-next-post' ), $seconds ); |
|
87 | - } elseif ( $seconds > 0 ) { |
|
88 | - return __( 'a second', 'auto-load-next-post' ); |
|
86 | + return sprintf(__('%s seconds', 'auto-load-next-post'), $seconds); |
|
87 | + } elseif ($seconds > 0) { |
|
88 | + return __('a second', 'auto-load-next-post'); |
|
89 | 89 | } |
90 | 90 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
20 | 20 | // Include core functions |
21 | -include( dirname( __FILE__ ) . '/auto-load-next-post-conditional-functions.php'); |
|
22 | -include( dirname( __FILE__ ) . '/auto-load-next-post-formatting-functions.php'); |
|
21 | +include(dirname(__FILE__).'/auto-load-next-post-conditional-functions.php'); |
|
22 | +include(dirname(__FILE__).'/auto-load-next-post-formatting-functions.php'); |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * When the 'partial' endpoint is used on a post, retrieve only the post content. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | global $wp_query; |
33 | 33 | |
34 | 34 | // If this is not a request for partial or a singular object then bail |
35 | - if ( ! isset( $wp_query->query_vars['partial'] ) || ! is_singular() ) { |
|
35 | + if ( ! isset($wp_query->query_vars['partial']) || ! is_singular()) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | * If theme does not have a template file for Auto Load Next Post, |
42 | 42 | * the plugin will load a default template. |
43 | 43 | */ |
44 | - $child_path = get_stylesheet_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
45 | - $template_path = get_template_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
44 | + $child_path = get_stylesheet_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
45 | + $template_path = get_template_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
46 | 46 | $default_path = AUTO_LOAD_NEXT_POST_FILE_PATH; |
47 | 47 | |
48 | - if ( file_exists( $child_path . 'content-partial.php' ) ) { |
|
49 | - include( $child_path . 'content-partial.php' ); |
|
48 | + if (file_exists($child_path.'content-partial.php')) { |
|
49 | + include($child_path.'content-partial.php'); |
|
50 | 50 | } |
51 | - else if( file_exists( $template_path . 'content-partial.php') ) { |
|
52 | - include( $template_path . 'content-partial.php' ); |
|
51 | + else if (file_exists($template_path.'content-partial.php')) { |
|
52 | + include($template_path.'content-partial.php'); |
|
53 | 53 | } |
54 | - else if( file_exists( $default_path . '/template/content-partial.php' ) ) { |
|
55 | - include( $default_path . '/template/content-partial.php' ); |
|
54 | + else if (file_exists($default_path.'/template/content-partial.php')) { |
|
55 | + include($default_path.'/template/content-partial.php'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | exit; |
59 | 59 | } |
60 | -add_action( 'template_redirect', 'auto_load_next_post_template_redirect' ); |
|
60 | +add_action('template_redirect', 'auto_load_next_post_template_redirect'); |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Adds the comments template after the post content. |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function auto_load_next_post_comments() { |
69 | 69 | // If comments are open or we have at least one comment, load up the comment template. |
70 | - if ( comments_open() || get_comments_number() ) : |
|
70 | + if (comments_open() || get_comments_number()) : |
|
71 | 71 | comments_template(); |
72 | 72 | endif; |
73 | 73 | } |
74 | -add_action( 'alnp_load_after_content', 'auto_load_next_post_comments', 1, 5 ); |
|
74 | +add_action('alnp_load_after_content', 'auto_load_next_post_comments', 1, 5); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Adds the post navigation for the previous link only after the post content. |
@@ -86,4 +86,4 @@ discard block |
||
86 | 86 | </nav> |
87 | 87 | <?php |
88 | 88 | } |
89 | -add_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 ); |
|
89 | +add_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10); |
@@ -16,71 +16,71 @@ |
||
16 | 16 | * @version 1.4.12 |
17 | 17 | */ |
18 | 18 | |
19 | -$template_location = apply_filters( 'alnp_template_location', '' ); // e.g. "template-parts/post/" |
|
19 | +$template_location = apply_filters('alnp_template_location', ''); // e.g. "template-parts/post/" |
|
20 | 20 | |
21 | -if ( have_posts() ) : |
|
21 | +if (have_posts()) : |
|
22 | 22 | |
23 | 23 | // Load content before the loop. |
24 | - do_action( 'alnp_load_before_loop' ); |
|
24 | + do_action('alnp_load_before_loop'); |
|
25 | 25 | |
26 | 26 | // Check that there are posts to load. |
27 | - while ( have_posts() ) : the_post(); |
|
27 | + while (have_posts()) : the_post(); |
|
28 | 28 | |
29 | 29 | $post_format = get_post_format(); // Post Format e.g. video |
30 | 30 | |
31 | 31 | $post_type = alnp_get_post_type(); // Post Type e.g. single |
32 | 32 | |
33 | 33 | // Load content before the post content. |
34 | - do_action( 'alnp_load_before_content' ); |
|
34 | + do_action('alnp_load_before_content'); |
|
35 | 35 | |
36 | 36 | // Load content before the post content for a specific post format. |
37 | - do_action( 'alnp_load_before_content_post_format_' . $post_format ); |
|
37 | + do_action('alnp_load_before_content_post_format_'.$post_format); |
|
38 | 38 | |
39 | 39 | // Load content before the post content for a specific post type. |
40 | - do_action( 'alnp_load_before_content_post_type_' . $post_type ); |
|
40 | + do_action('alnp_load_before_content_post_type_'.$post_type); |
|
41 | 41 | |
42 | - if ( false === $post_format ) { |
|
42 | + if (false === $post_format) { |
|
43 | 43 | /* |
44 | 44 | * Include the Post-Type-specific template for the content. |
45 | 45 | * content-___.php (where ___ is the Post Type name). |
46 | 46 | */ |
47 | - if ( locate_template( $template_location . 'content-' . $post_type . '.php') != '' ) { |
|
48 | - get_template_part( $template_location . 'content', $post_type ); |
|
47 | + if (locate_template($template_location.'content-'.$post_type.'.php') != '') { |
|
48 | + get_template_part($template_location.'content', $post_type); |
|
49 | 49 | } else { |
50 | 50 | // If no specific post type found then fallback to standard content.php file. |
51 | - get_template_part( $template_location . 'content' ); |
|
51 | + get_template_part($template_location.'content'); |
|
52 | 52 | } |
53 | 53 | } else { |
54 | 54 | /* |
55 | 55 | * Include the Post-Format-specific template for the content. |
56 | 56 | * called format-___.php (where ___ is the Post Format name). |
57 | 57 | */ |
58 | - if ( locate_template( $template_location . 'format-' . $post_format . '.php' ) != '' ) { |
|
59 | - get_template_part( $template_location . 'format', $post_format ); |
|
58 | + if (locate_template($template_location.'format-'.$post_format.'.php') != '') { |
|
59 | + get_template_part($template_location.'format', $post_format); |
|
60 | 60 | } else { |
61 | 61 | // If no format-{post-format}.php file found then fallback to content-{post-format}.php |
62 | - get_template_part( $template_location . 'content', $post_format ); |
|
62 | + get_template_part($template_location.'content', $post_format); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | 66 | // Load content after the post content for a specific post type. |
67 | - do_action( 'alnp_load_after_content_post_type_' . $post_type ); |
|
67 | + do_action('alnp_load_after_content_post_type_'.$post_type); |
|
68 | 68 | |
69 | 69 | // Load content after the post content for a specific post format. |
70 | - do_action( 'alnp_load_after_content_post_format_' . $post_format ); |
|
70 | + do_action('alnp_load_after_content_post_format_'.$post_format); |
|
71 | 71 | |
72 | 72 | // Load content after the post content. |
73 | - do_action( 'alnp_load_after_content' ); |
|
73 | + do_action('alnp_load_after_content'); |
|
74 | 74 | |
75 | 75 | // End the loop. |
76 | 76 | endwhile; |
77 | 77 | |
78 | 78 | // Load content after the loop. |
79 | - do_action( 'alnp_load_after_loop' ); |
|
79 | + do_action('alnp_load_after_loop'); |
|
80 | 80 | |
81 | 81 | else : |
82 | 82 | |
83 | 83 | // Load content if there are no more posts. |
84 | - do_action( 'alnp_no_more_posts' ); |
|
84 | + do_action('alnp_no_more_posts'); |
|
85 | 85 | |
86 | 86 | endif; // END if have_posts() |
@@ -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( 'auto_load_next_post_is_ajax' ) ) { |
|
20 | +if ( ! function_exists('auto_load_next_post_is_ajax')) { |
|
21 | 21 | /** |
22 | 22 | * Returns true when the page is loaded via ajax. |
23 | 23 | * |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | * @return bool |
27 | 27 | */ |
28 | 28 | function auto_load_next_post_is_ajax() { |
29 | - if ( defined( 'DOING_AJAX' ) ) { |
|
29 | + if (defined('DOING_AJAX')) { |
|
30 | 30 | return true; |
31 | 31 | } |
32 | 32 | |
33 | - return( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false; |
|
33 | + return(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') ? true : false; |
|
34 | 34 | } // END auto_load_next_post_is_ajax |
35 | 35 | } |
36 | 36 | |
37 | -if ( ! function_exists( 'supports_alnp' ) ) { |
|
37 | +if ( ! function_exists('supports_alnp')) { |
|
38 | 38 | /** |
39 | 39 | * Returns true or false if Auto Load Next Post supports the theme. |
40 | 40 | * |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | 'storefront' |
54 | 54 | ); |
55 | 55 | |
56 | - $supported_themes = array_merge( $core_themes, $other_themes ); |
|
56 | + $supported_themes = array_merge($core_themes, $other_themes); |
|
57 | 57 | |
58 | - if ( in_array( get_option('template'), $supported_themes ) ) { |
|
58 | + if (in_array(get_option('template'), $supported_themes)) { |
|
59 | 59 | return true; |
60 | - } else if ( current_theme_supports( 'auto-load-next-post' ) ) { |
|
60 | + } else if (current_theme_supports('auto-load-next-post')) { |
|
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } // END supports_alnp() |
66 | 66 | } |
67 | 67 | |
68 | -if ( ! function_exists( 'alnp_template_location' ) ) { |
|
68 | +if ( ! function_exists('alnp_template_location')) { |
|
69 | 69 | /** |
70 | 70 | * Filters the template location for get_template_part(). |
71 | 71 | * |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | function alnp_template_location() { |
78 | 78 | $current_theme = get_option('template'); |
79 | 79 | |
80 | - switch( $current_theme ) { |
|
80 | + switch ($current_theme) { |
|
81 | 81 | case 'twentyseventeen': |
82 | 82 | $path = 'template-parts/post/'; |
83 | 83 | break; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | add_filter('alnp_template_location', 'alnp_template_location'); |
98 | 98 | } |
99 | 99 | |
100 | -if ( ! function_exists( 'is_alnp_pro_version_installed' ) ) { |
|
100 | +if ( ! function_exists('is_alnp_pro_version_installed')) { |
|
101 | 101 | /** |
102 | 102 | * Detects if Auto Load Next Post Pro is installed. |
103 | 103 | * |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | * @return boolen |
107 | 107 | */ |
108 | 108 | function is_alnp_pro_version_installed() { |
109 | - $active_plugins = (array) get_option( 'active_plugins', array() ); |
|
109 | + $active_plugins = (array) get_option('active_plugins', array()); |
|
110 | 110 | |
111 | - if ( is_multisite() ) { |
|
112 | - $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); |
|
111 | + if (is_multisite()) { |
|
112 | + $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); |
|
113 | 113 | } |
114 | 114 | |
115 | - 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 ); |
|
115 | + 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); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | -if ( ! function_exists( 'alnp_get_post_type' ) ) { |
|
119 | +if ( ! function_exists('alnp_get_post_type')) { |
|
120 | 120 | /** |
121 | 121 | * Returns the post type. |
122 | 122 | * |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $post_type = get_post_type(); |
129 | 129 | |
130 | 130 | // If the post type is a post then return single instead. |
131 | - if ( $post_type == 'post' ) { |
|
131 | + if ($post_type == 'post') { |
|
132 | 132 | return 'single'; |
133 | 133 | } |
134 | 134 |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Auto_Load_Next_Post_Settings_Events_Tab' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Events_Tab')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Settings_Events_Tab extends Auto_Load_Next_Post_Settings_Page { |
21 | 21 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | 30 | $this->id = 'events'; |
31 | - $this->label = __( 'Events', 'auto-load-next-post' ); |
|
31 | + $this->label = __('Events', 'auto-load-next-post'); |
|
32 | 32 | |
33 | 33 | parent::__construct(); |
34 | 34 | } // END __construct() |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | 'auto_load_next_post_general_settings', array( |
46 | 46 | |
47 | 47 | array( |
48 | - 'title' => __( 'Events', 'auto-load-next-post' ), |
|
48 | + 'title' => __('Events', 'auto-load-next-post'), |
|
49 | 49 | 'type' => 'title', |
50 | - 'desc' => sprintf( __( 'User defined events, below you can choose external JavaScript events to be triggered alongside Auto Load Next Post native events', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
50 | + 'desc' => sprintf(__('User defined events, below you can choose external JavaScript events to be triggered alongside Auto Load Next Post native events', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
51 | 51 | 'id' => 'events_options' |
52 | 52 | ), |
53 | 53 | |
54 | 54 | array( |
55 | - 'title' => __( 'Post loaded', 'auto-load-next-post' ), |
|
56 | - 'desc' => __( 'After the new post has loaded, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post' ), |
|
55 | + 'title' => __('Post loaded', 'auto-load-next-post'), |
|
56 | + 'desc' => __('After the new post has loaded, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post'), |
|
57 | 57 | //'desc_tip' => true, |
58 | 58 | 'id' => 'auto_load_next_post_on_load_event', |
59 | 59 | 'placeholder' => 'event1,event2, ...', |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | ), |
64 | 64 | |
65 | 65 | array( |
66 | - 'title' => __( 'Entering a post', 'auto-load-next-post' ), |
|
67 | - 'desc' => __( 'Entering a post, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post' ), |
|
66 | + 'title' => __('Entering a post', 'auto-load-next-post'), |
|
67 | + 'desc' => __('Entering a post, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post'), |
|
68 | 68 | //'desc_tip' => true, |
69 | 69 | 'id' => 'auto_load_next_post_on_entering_event', |
70 | 70 | 'placeholder' => 'event1,event2, ...', |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function output() { |
90 | 90 | $settings = $this->get_settings(); |
91 | 91 | |
92 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
92 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
93 | 93 | } // END output() |
94 | 94 | |
95 | 95 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | $settings = $this->get_settings(); |
106 | 106 | |
107 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings, $current_tab ); |
|
107 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings, $current_tab); |
|
108 | 108 | } // END save() |
109 | 109 | |
110 | 110 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return array |
118 | 118 | */ |
119 | 119 | public function get_post_types() { |
120 | - $post_types = get_post_types( array( 'public' => true ), 'names' ); |
|
120 | + $post_types = get_post_types(array('public' => true), 'names'); |
|
121 | 121 | |
122 | 122 | return $post_types; |
123 | 123 | } // END get_post_types() |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists('Auto_Load_Next_Post_Admin_Settings' ) ) { |
|
19 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Settings')) { |
|
20 | 20 | |
21 | 21 | class Auto_Load_Next_Post_Admin_Settings { |
22 | 22 | |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @return $settings |
58 | 58 | */ |
59 | 59 | public static function get_settings_pages() { |
60 | - if ( empty( self::$settings ) ) { |
|
60 | + if (empty(self::$settings)) { |
|
61 | 61 | $settings = array(); |
62 | 62 | |
63 | - include_once( dirname( __FILE__ ) . '/settings/class-alnp-settings-page.php' ); |
|
63 | + include_once(dirname(__FILE__).'/settings/class-alnp-settings-page.php'); |
|
64 | 64 | |
65 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-general.php'); |
|
66 | - $settings[] = include( dirname( __FILE__ ) . '/settings/class-alnp-settings-events.php'); |
|
65 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-general.php'); |
|
66 | + $settings[] = include(dirname(__FILE__).'/settings/class-alnp-settings-events.php'); |
|
67 | 67 | |
68 | - self::$settings = apply_filters( 'auto_load_next_post_get_settings_pages', $settings ); |
|
68 | + self::$settings = apply_filters('auto_load_next_post_get_settings_pages', $settings); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return self::$settings; |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | public static function save() { |
84 | 84 | global $current_tab; |
85 | 85 | |
86 | - check_admin_referer( 'auto-load-next-post-settings' ); |
|
86 | + check_admin_referer('auto-load-next-post-settings'); |
|
87 | 87 | |
88 | 88 | // Trigger actions |
89 | - do_action( 'auto_load_next_post_settings_save_' . $current_tab ); |
|
90 | - do_action( 'auto_load_next_post_update_options_' . $current_tab ); |
|
91 | - do_action( 'auto_load_next_post_update_options' ); |
|
89 | + do_action('auto_load_next_post_settings_save_'.$current_tab); |
|
90 | + do_action('auto_load_next_post_update_options_'.$current_tab); |
|
91 | + do_action('auto_load_next_post_update_options'); |
|
92 | 92 | |
93 | - self::add_message( __( 'Your settings have been saved.', 'auto-load-next-post' ) ); |
|
93 | + self::add_message(__('Your settings have been saved.', 'auto-load-next-post')); |
|
94 | 94 | |
95 | - do_action( 'auto_load_next_post_settings_saved' ); |
|
95 | + do_action('auto_load_next_post_settings_saved'); |
|
96 | 96 | } // END save() |
97 | 97 | |
98 | 98 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @since 1.0.0 |
104 | 104 | * @param string $text Message |
105 | 105 | */ |
106 | - public static function add_message( $text ) { |
|
106 | + public static function add_message($text) { |
|
107 | 107 | self::$messages[] = $text; |
108 | 108 | } // END add_message() |
109 | 109 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @since 1.0.0 |
116 | 116 | * @param string $text Error |
117 | 117 | */ |
118 | - public static function add_error( $text ) { |
|
118 | + public static function add_error($text) { |
|
119 | 119 | self::$errors[] = $text; |
120 | 120 | } // END add_error() |
121 | 121 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | public static function show_messages() { |
131 | - if ( count( self::$errors ) > 0 ) { |
|
132 | - foreach ( self::$errors as $error ) { |
|
133 | - echo '<div id="message" class="error inline"><p><strong>' . esc_html( $error ) . '</strong></p></div>'; |
|
131 | + if (count(self::$errors) > 0) { |
|
132 | + foreach (self::$errors as $error) { |
|
133 | + echo '<div id="message" class="error inline"><p><strong>'.esc_html($error).'</strong></p></div>'; |
|
134 | 134 | } |
135 | - } elseif ( count( self::$messages ) > 0 ) { |
|
136 | - foreach ( self::$messages as $message ) { |
|
137 | - echo '<div id="message" class="updated inline"><p><strong>' . esc_html( $message ) . '</strong></p></div>'; |
|
135 | + } elseif (count(self::$messages) > 0) { |
|
136 | + foreach (self::$messages as $message) { |
|
137 | + echo '<div id="message" class="updated inline"><p><strong>'.esc_html($message).'</strong></p></div>'; |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } // END show_messages() |
@@ -156,18 +156,18 @@ discard block |
||
156 | 156 | public static function output() { |
157 | 157 | global $current_section, $current_tab; |
158 | 158 | |
159 | - do_action( 'auto_load_next_post_settings_start' ); |
|
159 | + do_action('auto_load_next_post_settings_start'); |
|
160 | 160 | |
161 | - wp_enqueue_script( 'auto_load_next_post_settings', AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/admin/settings' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true ); |
|
161 | + wp_enqueue_script('auto_load_next_post_settings', AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/js/admin/settings'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true); |
|
162 | 162 | |
163 | - wp_localize_script( 'auto_load_next_post_settings', 'auto_load_next_post_settings_params', array( |
|
164 | - 'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post' ), |
|
165 | - ) ); |
|
163 | + wp_localize_script('auto_load_next_post_settings', 'auto_load_next_post_settings_params', array( |
|
164 | + 'i18n_nav_warning' => __('The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post'), |
|
165 | + )); |
|
166 | 166 | |
167 | 167 | // Get tabs for the settings page |
168 | - $tabs = apply_filters( 'auto_load_next_post_settings_tabs_array', array() ); |
|
168 | + $tabs = apply_filters('auto_load_next_post_settings_tabs_array', array()); |
|
169 | 169 | |
170 | - include( dirname( __FILE__ ) . '/views/html-admin-settings.php' ); |
|
170 | + include(dirname(__FILE__).'/views/html-admin-settings.php'); |
|
171 | 171 | } // END output() |
172 | 172 | |
173 | 173 | /** |
@@ -179,20 +179,20 @@ discard block |
||
179 | 179 | * @param mixed $option_name |
180 | 180 | * @return string |
181 | 181 | */ |
182 | - public static function get_option( $option_name, $default = '' ) { |
|
182 | + public static function get_option($option_name, $default = '') { |
|
183 | 183 | // Array value |
184 | - if ( strstr( $option_name, '[' ) ) { |
|
185 | - parse_str( $option_name, $option_array ); |
|
184 | + if (strstr($option_name, '[')) { |
|
185 | + parse_str($option_name, $option_array); |
|
186 | 186 | |
187 | 187 | // Option name is first key |
188 | - $option_name = current( array_keys( $option_array ) ); |
|
188 | + $option_name = current(array_keys($option_array)); |
|
189 | 189 | |
190 | 190 | // Get value |
191 | - $option_values = get_option( $option_name, '' ); |
|
191 | + $option_values = get_option($option_name, ''); |
|
192 | 192 | |
193 | - $key = key( $option_array[$option_name] ); |
|
193 | + $key = key($option_array[$option_name]); |
|
194 | 194 | |
195 | - if ( isset( $option_values[$key] ) ) { |
|
195 | + if (isset($option_values[$key])) { |
|
196 | 196 | $option_value = $option_values[$key]; |
197 | 197 | } else { |
198 | 198 | $option_value = null; |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | $option_value = get_option($option_name, null); |
203 | 203 | } |
204 | 204 | |
205 | - if ( is_array( $option_value ) ) { |
|
206 | - $option_value = array_map( 'stripslashes', $option_value ); |
|
207 | - } elseif ( ! is_null( $option_value ) ) { |
|
208 | - $option_value = stripslashes( $option_value ); |
|
205 | + if (is_array($option_value)) { |
|
206 | + $option_value = array_map('stripslashes', $option_value); |
|
207 | + } elseif ( ! is_null($option_value)) { |
|
208 | + $option_value = stripslashes($option_value); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | return $option_value === null ? $default : $option_value; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | if ($tip && in_array($value['type'], array('checkbox'))) { |
284 | 284 | $tip = '<p class="description">'.$tip.'</p>'; |
285 | 285 | } else if ($tip) { |
286 | - $tip = '<img class="help_tip" data-tip="'.esc_attr($tip).'" src="' . AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/images/help.png" height="16" width="16" />'; |
|
286 | + $tip = '<img class="help_tip" data-tip="'.esc_attr($tip).'" src="'.AUTO_LOAD_NEXT_POST_URL_PATH.'/assets/images/help.png" height="16" width="16" />'; |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Switch based on type |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | * @param array $options Opens array to output |
532 | 532 | * @return bool |
533 | 533 | */ |
534 | - public static function save_fields( $options, $current_tab ) { |
|
535 | - if ( empty( $_POST ) ) { |
|
534 | + public static function save_fields($options, $current_tab) { |
|
535 | + if (empty($_POST)) { |
|
536 | 536 | return false; |
537 | 537 | } |
538 | 538 | |
@@ -540,21 +540,21 @@ discard block |
||
540 | 540 | $update_options = array(); |
541 | 541 | |
542 | 542 | // Loop options and get values to save |
543 | - foreach ( $options as $value ) { |
|
543 | + foreach ($options as $value) { |
|
544 | 544 | |
545 | - if ( ! isset( $value['id'] ) ) { |
|
545 | + if ( ! isset($value['id'])) { |
|
546 | 546 | continue; |
547 | 547 | } |
548 | 548 | |
549 | - $type = isset( $value['type'] ) ? sanitize_title( $value['type'] ) : ''; |
|
549 | + $type = isset($value['type']) ? sanitize_title($value['type']) : ''; |
|
550 | 550 | |
551 | 551 | // Get the option name |
552 | 552 | $option_value = null; |
553 | 553 | |
554 | - switch ( $type ) { |
|
554 | + switch ($type) { |
|
555 | 555 | // Standard types |
556 | 556 | case "checkbox" : |
557 | - if ( isset( $_POST[$value['id']] ) ) { |
|
557 | + if (isset($_POST[$value['id']])) { |
|
558 | 558 | $option_value = 'yes'; |
559 | 559 | } else { |
560 | 560 | $option_value = 'no'; |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | break; |
564 | 564 | |
565 | 565 | case "textarea" : |
566 | - if ( isset( $_POST[$value['id']] ) ) { |
|
567 | - $option_value = wp_kses_post( trim( stripslashes( $_POST[$value['id']] ) ) ); |
|
566 | + if (isset($_POST[$value['id']])) { |
|
567 | + $option_value = wp_kses_post(trim(stripslashes($_POST[$value['id']]))); |
|
568 | 568 | } else { |
569 | 569 | $option_value = ''; |
570 | 570 | } |
@@ -576,8 +576,8 @@ discard block |
||
576 | 576 | case "select" : |
577 | 577 | case "single_select_page" : |
578 | 578 | case "radio" : |
579 | - if ( isset( $_POST[$value['id']] ) ) { |
|
580 | - $option_value = auto_load_next_post_clean( stripslashes( $_POST[$value['id']] ) ); |
|
579 | + if (isset($_POST[$value['id']])) { |
|
580 | + $option_value = auto_load_next_post_clean(stripslashes($_POST[$value['id']])); |
|
581 | 581 | } else { |
582 | 582 | $option_value = ''; |
583 | 583 | } |
@@ -587,8 +587,8 @@ discard block |
||
587 | 587 | // Special types |
588 | 588 | case "multiselect" : |
589 | 589 | // Get array |
590 | - if ( isset( $_POST[$value['id']] ) ) { |
|
591 | - $selected_values = array_map( 'auto_load_next_post_clean', array_map( 'stripslashes', (array) $_POST[$value['id']] ) ); |
|
590 | + if (isset($_POST[$value['id']])) { |
|
591 | + $selected_values = array_map('auto_load_next_post_clean', array_map('stripslashes', (array) $_POST[$value['id']])); |
|
592 | 592 | } else { |
593 | 593 | $selected_values = array(); |
594 | 594 | } |
@@ -598,19 +598,19 @@ discard block |
||
598 | 598 | |
599 | 599 | // Custom handling |
600 | 600 | default : |
601 | - do_action( 'auto_load_next_post_update_option_' . $type, $value ); |
|
601 | + do_action('auto_load_next_post_update_option_'.$type, $value); |
|
602 | 602 | |
603 | 603 | break; |
604 | 604 | } // END switch() |
605 | 605 | |
606 | - if ( ! is_null( $option_value ) ) { |
|
606 | + if ( ! is_null($option_value)) { |
|
607 | 607 | |
608 | 608 | // Check if option is an array |
609 | - if ( strstr( $value['id'], '[') ) { |
|
610 | - parse_str( $value['id'], $option_array ); |
|
609 | + if (strstr($value['id'], '[')) { |
|
610 | + parse_str($value['id'], $option_array); |
|
611 | 611 | |
612 | 612 | // Option name is first key |
613 | - $option_name = current( array_keys( $option_array ) ); |
|
613 | + $option_name = current(array_keys($option_array)); |
|
614 | 614 | |
615 | 615 | // Get old option value |
616 | 616 | if ( ! isset($update_options[$option_name])) { |
@@ -633,16 +633,16 @@ discard block |
||
633 | 633 | } |
634 | 634 | |
635 | 635 | // Custom handling |
636 | - do_action( 'auto_load_next_post_update_option', $value ); |
|
636 | + do_action('auto_load_next_post_update_option', $value); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | // Now save the options |
640 | - foreach ( $update_options as $name => $value ) { |
|
641 | - update_option( $name, $value ); |
|
640 | + foreach ($update_options as $name => $value) { |
|
641 | + update_option($name, $value); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | // Save all options as an array. Ready for export. |
645 | - update_option( 'auto_load_next_post_options_' . $current_tab, $update_options ); |
|
645 | + update_option('auto_load_next_post_options_'.$current_tab, $update_options); |
|
646 | 646 | |
647 | 647 | return true; |
648 | 648 | } // END save_fields() |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @version 1.4.10 |
29 | 29 | */ |
30 | -if ( ! class_exists('Auto_Load_Next_Post') ) { |
|
30 | +if ( ! class_exists('Auto_Load_Next_Post')) { |
|
31 | 31 | |
32 | 32 | class Auto_Load_Next_Post { |
33 | 33 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return Auto_Load_Next_Post Single instance. |
53 | 53 | */ |
54 | 54 | public static function instance() { |
55 | - if ( is_null( self::$_instance ) ) { |
|
55 | + if (is_null(self::$_instance)) { |
|
56 | 56 | self::$_instance = new self(); |
57 | 57 | self::$_instance->setup_constants(); |
58 | 58 | self::$_instance->includes(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function __clone() { |
71 | 71 | // Cloning instances of the class is forbidden |
72 | - _doing_it_wrong( __FUNCTION__, __( 'Cloning this object is forbidden.', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_VERSION ); |
|
72 | + _doing_it_wrong(__FUNCTION__, __('Cloning this object is forbidden.', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_VERSION); |
|
73 | 73 | } // END __clone() |
74 | 74 | |
75 | 75 | /** |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | public function __wakeup() { |
83 | - _doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'auto-load-next-post' ), AUTO_LOAD_NEXT_POST_VERSION ); |
|
83 | + _doing_it_wrong(__FUNCTION__, __('Unserializing instances of this class is forbidden.', 'auto-load-next-post'), AUTO_LOAD_NEXT_POST_VERSION); |
|
84 | 84 | } // END __wakeup() |
85 | 85 | |
86 | 86 | /** |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function __construct() { |
94 | 94 | // Auto-load classes on demand |
95 | - if ( function_exists("__autoload") ) { |
|
95 | + if (function_exists("__autoload")) { |
|
96 | 96 | spl_autoload_register("__autoload"); |
97 | 97 | } |
98 | 98 | |
99 | - spl_autoload_register( array( $this, 'autoload' ) ); |
|
99 | + spl_autoload_register(array($this, 'autoload')); |
|
100 | 100 | |
101 | 101 | // Load translation files. |
102 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
102 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
103 | 103 | |
104 | 104 | // Load Auto Load Next Post scripts on the frontend. |
105 | - add_action( 'wp_enqueue_scripts', array( $this, 'alnp_scripts' ) ); |
|
105 | + add_action('wp_enqueue_scripts', array($this, 'alnp_scripts')); |
|
106 | 106 | } // END __construct() |
107 | 107 | |
108 | 108 | /** |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | * @param mixed $class |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - public function autoload( $class ) { |
|
116 | + public function autoload($class) { |
|
117 | 117 | $path = null; |
118 | - $file = strtolower( 'class-' . str_replace( '_', '-', $class ) ) . '.php'; |
|
118 | + $file = strtolower('class-'.str_replace('_', '-', $class)).'.php'; |
|
119 | 119 | |
120 | - if ( strpos( $class, 'auto_load_next_post_admin' ) === 0 ) { |
|
121 | - $path = AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/admin/'; |
|
122 | - } else if ( strpos( $class, 'auto_load_next_post_' ) === 0 ) { |
|
123 | - $path = AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/'; |
|
120 | + if (strpos($class, 'auto_load_next_post_admin') === 0) { |
|
121 | + $path = AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/admin/'; |
|
122 | + } else if (strpos($class, 'auto_load_next_post_') === 0) { |
|
123 | + $path = AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/'; |
|
124 | 124 | } |
125 | 125 | |
126 | - if ( $path !== null && is_readable( $path . $file ) ) { |
|
127 | - include_once( $path . $file ); |
|
126 | + if ($path !== null && is_readable($path.$file)) { |
|
127 | + include_once($path.$file); |
|
128 | 128 | return true; |
129 | 129 | } |
130 | 130 | } // END autoload() |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | * @access private |
163 | 163 | * @since 1.4.3 |
164 | 164 | */ |
165 | - private function define( $name, $value ) { |
|
166 | - if ( ! defined( $name ) ) { |
|
167 | - define( $name, $value ); |
|
165 | + private function define($name, $value) { |
|
166 | + if ( ! defined($name)) { |
|
167 | + define($name, $value); |
|
168 | 168 | } |
169 | 169 | } // END define() |
170 | 170 | |
@@ -181,20 +181,20 @@ discard block |
||
181 | 181 | * @return void |
182 | 182 | */ |
183 | 183 | public function includes() { |
184 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
184 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
185 | 185 | |
186 | 186 | // Include admin class to handle all back-end functions. |
187 | - if ( is_admin() ) { |
|
188 | - include_once( dirname( __FILE__ ) . '/includes/admin/class-auto-load-next-post-admin.php'); // Admin section. |
|
187 | + if (is_admin()) { |
|
188 | + include_once(dirname(__FILE__).'/includes/admin/class-auto-load-next-post-admin.php'); // Admin section. |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | // Install. |
192 | - require_once( dirname( __FILE__ ) . '/includes/class-auto-load-next-post-install.php' ); |
|
192 | + require_once(dirname(__FILE__).'/includes/class-auto-load-next-post-install.php'); |
|
193 | 193 | |
194 | 194 | /** |
195 | 195 | * Auto Load Next Post is fully loaded. |
196 | 196 | */ |
197 | - do_action( 'auto_load_next_post_loaded' ); |
|
197 | + do_action('auto_load_next_post_loaded'); |
|
198 | 198 | } // END includes() |
199 | 199 | |
200 | 200 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return void |
210 | 210 | */ |
211 | 211 | public function load_plugin_textdomain() { |
212 | - load_plugin_textdomain( 'auto-load-next-post', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
212 | + load_plugin_textdomain('auto-load-next-post', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
213 | 213 | } // END load_plugin_textdomain() |
214 | 214 | |
215 | 215 | /** |
@@ -223,18 +223,18 @@ discard block |
||
223 | 223 | /** |
224 | 224 | * Load the Javascript if found as a singluar post. |
225 | 225 | */ |
226 | - if ( is_singular() && get_post_type() == 'post' ) { |
|
227 | - $this->load_file( 'auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
226 | + if (is_singular() && get_post_type() == 'post') { |
|
227 | + $this->load_file('auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
228 | 228 | |
229 | 229 | // Only load History.js when not in the customizer. |
230 | - if ( ! is_customize_preview() ) { |
|
231 | - $this->load_file( 'auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
230 | + if ( ! is_customize_preview()) { |
|
231 | + $this->load_file('auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION); |
|
232 | 232 | } |
233 | 233 | |
234 | - $this->load_file( 'auto-load-next-post-script', '/assets/js/frontend/auto-load-next-post' . AUTO_LOAD_NEXT_POST_DEBUG_MODE.AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array('auto-load-next-post-scrollspy'), AUTO_LOAD_NEXT_POST_VERSION ); |
|
234 | + $this->load_file('auto-load-next-post-script', '/assets/js/frontend/auto-load-next-post'.AUTO_LOAD_NEXT_POST_DEBUG_MODE.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('auto-load-next-post-scrollspy'), AUTO_LOAD_NEXT_POST_VERSION); |
|
235 | 235 | |
236 | 236 | // Variables for JS scripts |
237 | - wp_localize_script( 'auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
237 | + wp_localize_script('auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
238 | 238 | 'alnp_version' => AUTO_LOAD_NEXT_POST_VERSION, |
239 | 239 | 'alnp_content_container' => get_option('auto_load_next_post_content_container'), |
240 | 240 | 'alnp_title_selector' => get_option('auto_load_next_post_title_selector'), |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | 'alnp_event_on_load' => get_option('auto_load_next_post_on_load_event'), |
246 | 246 | 'alnp_event_on_entering' => get_option('auto_load_next_post_on_entering_event'), |
247 | 247 | 'alnp_is_customizer' => is_customize_preview() |
248 | - ) ); |
|
248 | + )); |
|
249 | 249 | } // END if is_singular() && get_post_type() |
250 | 250 | } // END alnp_scripts() |
251 | 251 | |
@@ -262,18 +262,18 @@ discard block |
||
262 | 262 | * @param string $version Optional, can match the version of the plugin or version of the source file. |
263 | 263 | * @global string $wp_version |
264 | 264 | */ |
265 | - public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '' ) { |
|
265 | + public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '') { |
|
266 | 266 | global $wp_version; |
267 | 267 | |
268 | - $url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file. |
|
268 | + $url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file. |
|
269 | 269 | |
270 | - if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) { |
|
271 | - if ( $is_script ) { |
|
272 | - wp_register_script( $name, $url, $support, $version ); |
|
273 | - wp_enqueue_script( $name ); |
|
270 | + if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) { |
|
271 | + if ($is_script) { |
|
272 | + wp_register_script($name, $url, $support, $version); |
|
273 | + wp_enqueue_script($name); |
|
274 | 274 | } else { |
275 | - wp_register_style( $name, $url ); |
|
276 | - wp_enqueue_style( $name ); |
|
275 | + wp_register_style($name, $url); |
|
276 | + wp_enqueue_style($name); |
|
277 | 277 | } // end if |
278 | 278 | } // end if |
279 | 279 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | } // END run_auto_load_next_post() |
292 | 292 | |
293 | 293 | // Fetch the Php version checker. |
294 | -if ( ! class_exists( 'WP_Update_Php' ) ) { |
|
295 | - require_once( dirname( __FILE__ ) . '/wp-update-php/wp-update-php.php' ); |
|
294 | +if ( ! class_exists('WP_Update_Php')) { |
|
295 | + require_once(dirname(__FILE__).'/wp-update-php/wp-update-php.php'); |
|
296 | 296 | } |
297 | 297 | $updatePhp = new WP_Update_Php( |
298 | 298 | array( |
@@ -306,6 +306,6 @@ discard block |
||
306 | 306 | ); |
307 | 307 | |
308 | 308 | // If the miniumum version of PHP required is available then run the plugin. |
309 | -if ( $updatePhp->does_it_meet_required_php_version() ) { |
|
309 | +if ($updatePhp->does_it_meet_required_php_version()) { |
|
310 | 310 | add_action('plugins_loaded', 'run_auto_load_next_post', 20); |
311 | 311 | } |