@@ -11,13 +11,13 @@ 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 | 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 | <style type="text/css"> |
23 | 23 | .notice.auto-load-next-post-notice { |
@@ -103,17 +103,17 @@ discard block |
||
103 | 103 | <div class="notice notice-info auto-load-next-post-notice"> |
104 | 104 | <div class="auto-load-next-post-notice-inner"> |
105 | 105 | <div class="auto-load-next-post-notice-icon"> |
106 | - <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' ); ?>" /> |
|
106 | + <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'); ?>" /> |
|
107 | 107 | </div> |
108 | 108 | |
109 | 109 | <div class="auto-load-next-post-notice-content"> |
110 | - <h3><?php echo esc_html__( 'Are you enjoying Auto Load Next Post?', 'auto-load-next-post' ); ?></h3> |
|
111 | - <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> |
|
110 | + <h3><?php echo esc_html__('Are you enjoying Auto Load Next Post?', 'auto-load-next-post'); ?></h3> |
|
111 | + <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> |
|
112 | 112 | </div> |
113 | 113 | |
114 | 114 | <div class="auto-load-next-post-review-now"> |
115 | - <?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' ) ); ?> |
|
116 | - <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> |
|
115 | + <?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')); ?> |
|
116 | + <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> |
|
117 | 117 | </div> |
118 | 118 | </div> |
119 | 119 | </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_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() |
@@ -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'), |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | 'alnp_remove_comments' => get_option('auto_load_next_post_remove_comments'), |
244 | 244 | 'alnp_google_analytics' => get_option('auto_load_next_post_google_analytics'), |
245 | 245 | 'alnp_is_customizer' => is_customize_preview() |
246 | - ) ); |
|
246 | + )); |
|
247 | 247 | } // END if is_singular() && get_post_type() |
248 | 248 | } // END alnp_scripts() |
249 | 249 | |
@@ -260,18 +260,18 @@ discard block |
||
260 | 260 | * @param string $version Optional, can match the version of the plugin or version of the source file. |
261 | 261 | * @global string $wp_version |
262 | 262 | */ |
263 | - public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '' ) { |
|
263 | + public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '') { |
|
264 | 264 | global $wp_version; |
265 | 265 | |
266 | - $url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file. |
|
266 | + $url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file. |
|
267 | 267 | |
268 | - if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) { |
|
269 | - if ( $is_script ) { |
|
270 | - wp_register_script( $name, $url, $support, $version ); |
|
271 | - wp_enqueue_script( $name ); |
|
268 | + if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) { |
|
269 | + if ($is_script) { |
|
270 | + wp_register_script($name, $url, $support, $version); |
|
271 | + wp_enqueue_script($name); |
|
272 | 272 | } else { |
273 | - wp_register_style( $name, $url ); |
|
274 | - wp_enqueue_style( $name ); |
|
273 | + wp_register_style($name, $url); |
|
274 | + wp_enqueue_style($name); |
|
275 | 275 | } // end if |
276 | 276 | } // end if |
277 | 277 | |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | } // END run_auto_load_next_post() |
290 | 290 | |
291 | 291 | // Fetch the Php version checker. |
292 | -if ( ! class_exists( 'WP_Update_Php' ) ) { |
|
293 | - require_once( dirname( __FILE__ ) . '/wp-update-php/wp-update-php.php' ); |
|
292 | +if ( ! class_exists('WP_Update_Php')) { |
|
293 | + require_once(dirname(__FILE__).'/wp-update-php/wp-update-php.php'); |
|
294 | 294 | } |
295 | 295 | $updatePhp = new WP_Update_Php( |
296 | 296 | array( |
@@ -304,6 +304,6 @@ discard block |
||
304 | 304 | ); |
305 | 305 | |
306 | 306 | // If the miniumum version of PHP required is available then run the plugin. |
307 | -if ( $updatePhp->does_it_meet_required_php_version() ) { |
|
307 | +if ($updatePhp->does_it_meet_required_php_version()) { |
|
308 | 308 | add_action('plugins_loaded', 'run_auto_load_next_post', 20); |
309 | 309 | } |
@@ -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 |