@@ -9,18 +9,18 @@ discard block |
||
9 | 9 | * @package Auto Load Next Post |
10 | 10 | * @license GPL-2.0+ |
11 | 11 | */ |
12 | -if ( ! defined( 'ABSPATH' ) || ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
12 | +if ( ! defined('ABSPATH') || ! defined('WP_UNINSTALL_PLUGIN')) { |
|
13 | 13 | exit(); // Exit if accessed directly. |
14 | 14 | } |
15 | 15 | |
16 | 16 | global $wpdb; |
17 | 17 | |
18 | -$uninstall = get_option( 'auto_load_next_post_uninstall_data' ); |
|
18 | +$uninstall = get_option('auto_load_next_post_uninstall_data'); |
|
19 | 19 | |
20 | -if ( ! empty( $uninstall ) ) { |
|
20 | +if ( ! empty($uninstall)) { |
|
21 | 21 | |
22 | 22 | // Make sure it is only a single site we are uninstalling from. |
23 | - if ( ! is_multisite() ) { |
|
23 | + if ( ! is_multisite()) { |
|
24 | 24 | // Delete options |
25 | 25 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'auto_load_next_post_%'"); |
26 | 26 | |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | $wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'auto_load_next_post_%'"); |
29 | 29 | |
30 | 30 | // Delete Uninstall Data - Just to double check it has been removed. |
31 | - delete_option( 'auto_load_next_post_uninstall_data' ); |
|
31 | + delete_option('auto_load_next_post_uninstall_data'); |
|
32 | 32 | |
33 | 33 | // Delete Install Date |
34 | - delete_option( 'auto_load_next_post_install_date' ); |
|
34 | + delete_option('auto_load_next_post_install_date'); |
|
35 | 35 | } |
36 | 36 | else { |
37 | 37 | // Delete Uninstall Data |
38 | - delete_site_option( 'auto_load_next_post_uninstall_data' ); |
|
38 | + delete_site_option('auto_load_next_post_uninstall_data'); |
|
39 | 39 | |
40 | 40 | // Delete Install Date |
41 | - delete_site_option( 'auto_load_next_post_install_date' ); |
|
41 | + delete_site_option('auto_load_next_post_install_date'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -32,8 +32,7 @@ |
||
32 | 32 | |
33 | 33 | // Delete Install Date |
34 | 34 | delete_option( 'auto_load_next_post_install_date' ); |
35 | - } |
|
36 | - else { |
|
35 | + } else { |
|
37 | 36 | // Delete Uninstall Data |
38 | 37 | delete_site_option( 'auto_load_next_post_uninstall_data' ); |
39 | 38 |
@@ -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_Theme_Selectors_Tab' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Theme_Selectors_Tab')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Settings_Theme_Selectors_Tab extends Auto_Load_Next_Post_Settings_Page { |
21 | 21 | |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | 30 | $this->id = 'theme-selectors'; |
31 | - $this->label = esc_html__( 'Theme Selectors', 'auto-load-next-post' ); |
|
31 | + $this->label = esc_html__('Theme Selectors', 'auto-load-next-post'); |
|
32 | 32 | |
33 | 33 | parent::__construct(); |
34 | 34 | |
35 | - add_action( 'auto_load_next_post_sections_theme-selectors', array( __CLASS__, 'is_theme_supported' ), 10 ); |
|
36 | - add_action( 'auto_load_next_post_sections_theme-selectors', array( __CLASS__, 'no_theme_selectors_set' ), 10 ); |
|
35 | + add_action('auto_load_next_post_sections_theme-selectors', array(__CLASS__, 'is_theme_supported'), 10); |
|
36 | + add_action('auto_load_next_post_sections_theme-selectors', array(__CLASS__, 'no_theme_selectors_set'), 10); |
|
37 | 37 | } // END __construct() |
38 | 38 | |
39 | 39 | /** |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | * @since 1.5.10 |
45 | 45 | */ |
46 | 46 | public static function is_theme_supported() { |
47 | - if ( is_alnp_supported() ) { |
|
48 | - $plugin_supported = alnp_get_theme_support( 'plugin_support' ); |
|
47 | + if (is_alnp_supported()) { |
|
48 | + $plugin_supported = alnp_get_theme_support('plugin_support'); |
|
49 | 49 | |
50 | 50 | // Is the theme supported by theme or plugin? |
51 | - if ( ! empty( $plugin_supported ) && $plugin_supported == 'yes' ) { |
|
52 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-plugin-supported.php' ); |
|
51 | + if ( ! empty($plugin_supported) && $plugin_supported == 'yes') { |
|
52 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-plugin-supported.php'); |
|
53 | 53 | } else { |
54 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-is-supported.php' ); |
|
54 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-is-supported.php'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } // END is_theme_supported() |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | public static function no_theme_selectors_set() { |
67 | 67 | $set_selectors = array(); |
68 | 68 | |
69 | - $content_container = get_option( 'auto_load_next_post_content_container' ); |
|
70 | - $title_selector = get_option( 'auto_load_next_post_title_selector' ); |
|
71 | - $navigation_container = get_option( 'auto_load_next_post_navigation_container' ); |
|
69 | + $content_container = get_option('auto_load_next_post_content_container'); |
|
70 | + $title_selector = get_option('auto_load_next_post_title_selector'); |
|
71 | + $navigation_container = get_option('auto_load_next_post_navigation_container'); |
|
72 | 72 | |
73 | - if ( ! empty( $content_container ) ) { |
|
73 | + if ( ! empty($content_container)) { |
|
74 | 74 | $set_selectors[] = $content_container; |
75 | 75 | } |
76 | 76 | |
77 | - if ( ! empty( $title_selector ) ) { |
|
77 | + if ( ! empty($title_selector)) { |
|
78 | 78 | $set_selectors[] = $title_selector; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! empty( $navigation_container ) ) { |
|
81 | + if ( ! empty($navigation_container)) { |
|
82 | 82 | $set_selectors[] = $navigation_container; |
83 | 83 | } |
84 | 84 | |
85 | - if ( empty( $set_selectors ) || is_array( $set_selectors ) && count( $set_selectors ) < 3 ) { |
|
86 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-no-theme-selectors.php' ); |
|
85 | + if (empty($set_selectors) || is_array($set_selectors) && count($set_selectors) < 3) { |
|
86 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-no-theme-selectors.php'); |
|
87 | 87 | } |
88 | 88 | } // END no_theme_selectors_set() |
89 | 89 | |
@@ -102,26 +102,26 @@ discard block |
||
102 | 102 | 'auto_load_next_post_theme_selectors_settings', array( |
103 | 103 | |
104 | 104 | array( |
105 | - 'title' => esc_html__( 'Theme Selectors', 'auto-load-next-post' ), |
|
105 | + 'title' => esc_html__('Theme Selectors', 'auto-load-next-post'), |
|
106 | 106 | 'type' => 'title', |
107 | - 'desc' => sprintf( esc_html__( 'Here you set the theme selectors below according to your active theme. All are required for %s to work.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
107 | + 'desc' => sprintf(esc_html__('Here you set the theme selectors below according to your active theme. All are required for %s to work.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
108 | 108 | 'id' => 'theme_selectors_options' |
109 | 109 | ), |
110 | 110 | |
111 | 111 | array( |
112 | - 'title' => esc_html__( 'Content Container', 'auto-load-next-post' ), |
|
113 | - 'desc' => sprintf( __( 'The primary container where the post content is loaded in. Default: %s', 'auto-load-next-post' ), '<code>main.site-main</code>' ), |
|
112 | + 'title' => esc_html__('Content Container', 'auto-load-next-post'), |
|
113 | + 'desc' => sprintf(__('The primary container where the post content is loaded in. Default: %s', 'auto-load-next-post'), '<code>main.site-main</code>'), |
|
114 | 114 | 'id' => 'auto_load_next_post_content_container', |
115 | 115 | 'default' => 'main.site-main', |
116 | - 'placeholder' => esc_html__( 'Required', 'auto-load-next-post' ), |
|
116 | + 'placeholder' => esc_html__('Required', 'auto-load-next-post'), |
|
117 | 117 | 'type' => 'text', |
118 | 118 | 'css' => 'min-width:300px;', |
119 | 119 | 'autoload' => false |
120 | 120 | ), |
121 | 121 | |
122 | 122 | array( |
123 | - 'title' => esc_html__( 'Post Title', 'auto-load-next-post' ), |
|
124 | - 'desc' => sprintf( __( 'Used to identify which article the user is reading and track should Google Analytics or other analytics be enabled. Default: %s', 'auto-load-next-post' ), '<code>h1.entry-title</code>' ), |
|
123 | + 'title' => esc_html__('Post Title', 'auto-load-next-post'), |
|
124 | + 'desc' => sprintf(__('Used to identify which article the user is reading and track should Google Analytics or other analytics be enabled. Default: %s', 'auto-load-next-post'), '<code>h1.entry-title</code>'), |
|
125 | 125 | 'id' => 'auto_load_next_post_title_selector', |
126 | 126 | 'default' => 'h1.entry-title', |
127 | 127 | 'type' => 'text', |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | ), |
131 | 131 | |
132 | 132 | array( |
133 | - 'title' => esc_html__( 'Post Navigation', 'auto-load-next-post' ), |
|
134 | - 'desc' => sprintf( __( 'Used to identify which post to load next if any. Default: %s', 'auto-load-next-post' ), '<code>nav.post-navigation</code>' ), |
|
133 | + 'title' => esc_html__('Post Navigation', 'auto-load-next-post'), |
|
134 | + 'desc' => sprintf(__('Used to identify which post to load next if any. Default: %s', 'auto-load-next-post'), '<code>nav.post-navigation</code>'), |
|
135 | 135 | 'id' => 'auto_load_next_post_navigation_container', |
136 | 136 | 'default' => 'nav.post-navigation', |
137 | 137 | 'type' => 'text', |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | ), |
141 | 141 | |
142 | 142 | array( |
143 | - 'title' => esc_html__( 'Comments Container', 'auto-load-next-post' ), |
|
144 | - 'desc' => sprintf( __( 'Used to remove comments if enabled under %1$sMisc%2$s settings. Default: %3$s', 'auto-load-next-post' ), '<strong><a href="' . get_admin_url( $blog_id, 'options-general.php?page=auto-load-next-post-settings&tab=misc' ) . '">', '</a></strong>', '<code>div#comments</code>' ), |
|
143 | + 'title' => esc_html__('Comments Container', 'auto-load-next-post'), |
|
144 | + 'desc' => sprintf(__('Used to remove comments if enabled under %1$sMisc%2$s settings. Default: %3$s', 'auto-load-next-post'), '<strong><a href="'.get_admin_url($blog_id, 'options-general.php?page=auto-load-next-post-settings&tab=misc').'">', '</a></strong>', '<code>div#comments</code>'), |
|
145 | 145 | 'id' => 'auto_load_next_post_comments_container', |
146 | 146 | 'default' => 'div#comments', |
147 | 147 | 'type' => 'text', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function output() { |
166 | 166 | $settings = $this->get_settings(); |
167 | 167 | |
168 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
168 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
169 | 169 | } // END output() |
170 | 170 | |
171 | 171 | /** |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function save() { |
179 | 179 | $settings = $this->get_settings(); |
180 | 180 | |
181 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings ); |
|
181 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings); |
|
182 | 182 | } // END save() |
183 | 183 | |
184 | 184 | } // END class |
@@ -10,12 +10,12 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | $active_theme = wp_get_theme(); |
18 | 18 | ?> |
19 | 19 | <div class="notice notice-info"> |
20 | - <p><?php echo sprintf( __( '%s theme is supported via a plugin. Do <strong>NOT</strong> change the theme selectors.', 'auto-load-next-post' ), $active_theme->name ); ?></p> |
|
20 | + <p><?php echo sprintf(__('%s theme is supported via a plugin. Do <strong>NOT</strong> change the theme selectors.', 'auto-load-next-post'), $active_theme->name); ?></p> |
|
21 | 21 | </div> |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
|
2 | +defined('ABSPATH') || die('Cheatin’ uh?'); |
|
3 | 3 | |
4 | -require AUTO_LOAD_NEXT_POST_3RD_PARTY . 'plugins/wp-rocket.php'; |
|
5 | 4 | \ No newline at end of file |
5 | +require AUTO_LOAD_NEXT_POST_3RD_PARTY.'plugins/wp-rocket.php'; |
|
6 | 6 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
|
2 | +defined('ABSPATH') || die('Cheatin’ uh?'); |
|
3 | 3 | |
4 | -if ( defined( 'WP_ROCKET_VERSION' ) ) : |
|
4 | +if (defined('WP_ROCKET_VERSION')) : |
|
5 | 5 | /** |
6 | 6 | * Excludes Auto Load Next Post scripts from JS minification. |
7 | 7 | * |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | * @param Array $excluded_js An array of JS handles enqueued in WordPress. |
10 | 10 | * @return Array the updated array of handles. |
11 | 11 | */ |
12 | - function rocket_exclude_js_alnp( $excluded_js ) { |
|
13 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.js' ) ); |
|
14 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.min.js' ) ); |
|
15 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.dev.js' ) ); |
|
16 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/libs/jquery.history.js' ) ); |
|
17 | - $excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/libs/scrollspy.min.js' ) ); |
|
12 | + function rocket_exclude_js_alnp($excluded_js) { |
|
13 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/frontend/auto-load-next-post.js')); |
|
14 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/frontend/auto-load-next-post.min.js')); |
|
15 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/frontend/auto-load-next-post.dev.js')); |
|
16 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/libs/jquery.history.js')); |
|
17 | + $excluded_js[] = str_replace(home_url(), '', plugins_url('/auto-load-next-post/assets/js/libs/scrollspy.min.js')); |
|
18 | 18 | |
19 | 19 | return $excluded_js; |
20 | 20 | } |
21 | - add_filter( 'rocket_exclude_js', 'rocket_exclude_js_disqus' ); |
|
21 | + add_filter('rocket_exclude_js', 'rocket_exclude_js_disqus'); |
|
22 | 22 | endif; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public static function init() { |
32 | 32 | // Add theme support and preset the theme selectors. |
33 | - add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) ); |
|
33 | + add_action('after_setup_theme', array(__CLASS__, 'add_theme_support')); |
|
34 | 34 | |
35 | 35 | // Display the post thumbnail before the content. |
36 | - add_action( 'alnp_load_before_content', array( __CLASS__, 'the_post_thumbnail' ), 10 ); |
|
36 | + add_action('alnp_load_before_content', array(__CLASS__, 'the_post_thumbnail'), 10); |
|
37 | 37 | |
38 | 38 | // Filters the repeater template location. |
39 | - add_filter( 'alnp_template_location', array( __CLASS__, 'alnp_poseidon_template_location' ) ); |
|
39 | + add_filter('alnp_template_location', array(__CLASS__, 'alnp_poseidon_template_location')); |
|
40 | 40 | } // END init() |
41 | 41 | |
42 | 42 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | // Get theme options from database. |
53 | 53 | $theme_options = poseidon_theme_options(); |
54 | 54 | |
55 | - if ( is_single() && has_post_thumbnail() && 'header' == $theme_options['post_layout_single'] ) { |
|
55 | + if (is_single() && has_post_thumbnail() && 'header' == $theme_options['post_layout_single']) { |
|
56 | 56 | the_post_thumbnail(); |
57 | 57 | } |
58 | 58 | } // END the_post_thumbnail() |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | * @static |
76 | 76 | */ |
77 | 77 | public static function add_theme_support() { |
78 | - add_theme_support( 'auto-load-next-post', array( |
|
78 | + add_theme_support('auto-load-next-post', array( |
|
79 | 79 | 'content_container' => 'main.site-main', |
80 | 80 | 'title_selector' => 'h1.entry-title', |
81 | 81 | 'navigation_container' => 'nav.post-navigation', |
82 | 82 | 'comments_container' => 'div#comments', |
83 | 83 | 'load_js_in_footer' => 'no', |
84 | 84 | 'lock_js_in_footer' => 'no', |
85 | - ) ); |
|
85 | + )); |
|
86 | 86 | } // END add_theme_support() |
87 | 87 | |
88 | 88 | } // END class |
@@ -279,7 +279,7 @@ |
||
279 | 279 | * @param string $name The ID to register with WordPress. |
280 | 280 | * @param string $file_path The path to the actual file. |
281 | 281 | * @param bool $is_script Optional, argument for if the incoming file_path is a JavaScript source file. |
282 | - * @param array $support Optional, for requiring other javascripts for the source file you are calling. |
|
282 | + * @param string[] $support Optional, for requiring other javascripts for the source file you are calling. |
|
283 | 283 | * @param string $version Optional, can match the version of the plugin or version of the source file. |
284 | 284 | * @param bool $footer Optional, can set the JavaScript to load in the footer instead. |
285 | 285 | */ |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * The main instance of the plugin. |
27 | 27 | */ |
28 | -if ( ! class_exists( 'Auto_Load_Next_Post' ) ) { |
|
28 | +if ( ! class_exists('Auto_Load_Next_Post')) { |
|
29 | 29 | |
30 | 30 | class Auto_Load_Next_Post { |
31 | 31 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return Auto_Load_Next_Post Single instance. |
60 | 60 | */ |
61 | 61 | public static function instance() { |
62 | - if ( is_null( self::$_instance ) ) { |
|
62 | + if (is_null(self::$_instance)) { |
|
63 | 63 | self::$_instance = new self(); |
64 | 64 | } |
65 | 65 | return self::$_instance; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function __clone() { |
76 | 76 | // Cloning instances of the class is forbidden |
77 | - _doing_it_wrong( __FUNCTION__, __( 'Cloning this object is forbidden.', 'auto-load-next-post' ), self::$version ); |
|
77 | + _doing_it_wrong(__FUNCTION__, __('Cloning this object is forbidden.', 'auto-load-next-post'), self::$version); |
|
78 | 78 | } // END __clone() |
79 | 79 | |
80 | 80 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | public function __wakeup() { |
88 | - _doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'auto-load-next-post' ), self::$version ); |
|
88 | + _doing_it_wrong(__FUNCTION__, __('Unserializing instances of this class is forbidden.', 'auto-load-next-post'), self::$version); |
|
89 | 89 | } // END __wakeup() |
90 | 90 | |
91 | 91 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Auto Load Next Post is fully loaded. |
106 | 106 | */ |
107 | - do_action( 'auto_load_next_post_loaded' ); |
|
107 | + do_action('auto_load_next_post_loaded'); |
|
108 | 108 | } // END __construct() |
109 | 109 | |
110 | 110 | /** |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function init_hooks() { |
117 | 117 | // Load translation files. |
118 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
118 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
119 | 119 | |
120 | 120 | // Load Auto Load Next Post scripts on the frontend. |
121 | - add_action( 'wp_enqueue_scripts', array( $this, 'alnp_enqueue_scripts' ) ); |
|
121 | + add_action('wp_enqueue_scripts', array($this, 'alnp_enqueue_scripts')); |
|
122 | 122 | } // END init_hooks() |
123 | 123 | |
124 | 124 | /** |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | $this->define('AUTO_LOAD_NEXT_POST_FILE', __FILE__); |
134 | 134 | $this->define('AUTO_LOAD_NEXT_POST_SLUG', 'auto-load-next-post'); |
135 | 135 | |
136 | - $this->define('AUTO_LOAD_NEXT_POST_URL_PATH', untrailingslashit( plugins_url( '/', __FILE__ ) ) ); |
|
137 | - $this->define('AUTO_LOAD_NEXT_POST_FILE_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
|
136 | + $this->define('AUTO_LOAD_NEXT_POST_URL_PATH', untrailingslashit(plugins_url('/', __FILE__))); |
|
137 | + $this->define('AUTO_LOAD_NEXT_POST_FILE_PATH', untrailingslashit(plugin_dir_path(__FILE__))); |
|
138 | 138 | $this->define('AUTO_LOAD_NEXT_POST_TEMPLATE_PATH', 'auto-load-next-post/'); |
139 | - $this->define('AUTO_LOAD_NEXT_POST_3RD_PARTY', AUTO_LOAD_NEXT_POST_FILE_PATH . '/includes/3rd-party/'); |
|
139 | + $this->define('AUTO_LOAD_NEXT_POST_3RD_PARTY', AUTO_LOAD_NEXT_POST_FILE_PATH.'/includes/3rd-party/'); |
|
140 | 140 | |
141 | 141 | $this->define('AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE', '4.4'); |
142 | 142 | |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * @access private |
160 | 160 | * @since 1.4.3 |
161 | 161 | */ |
162 | - private function define( $name, $value ) { |
|
163 | - if ( ! defined( $name ) ) { |
|
164 | - define( $name, $value ); |
|
162 | + private function define($name, $value) { |
|
163 | + if ( ! defined($name)) { |
|
164 | + define($name, $value); |
|
165 | 165 | } |
166 | 166 | } // END define() |
167 | 167 | |
@@ -174,29 +174,29 @@ discard block |
||
174 | 174 | * @return void |
175 | 175 | */ |
176 | 176 | public function includes() { |
177 | - include_once( dirname( __FILE__ ) . '/includes/class-alnp-autoloader.php' ); // Autoloader. |
|
178 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-conditional-functions.php' ); // Conditional functions. |
|
179 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-formatting-functions.php' ); // Formatting functions. |
|
180 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-themes-supported.php' ); // Handles all supported themes out of the box. |
|
181 | - include_once( dirname( __FILE__ ) . '/includes/auto-load-next-post-core-functions.php' ); // Contains core functions for the front/back end. |
|
177 | + include_once(dirname(__FILE__).'/includes/class-alnp-autoloader.php'); // Autoloader. |
|
178 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-conditional-functions.php'); // Conditional functions. |
|
179 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-formatting-functions.php'); // Formatting functions. |
|
180 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-themes-supported.php'); // Handles all supported themes out of the box. |
|
181 | + include_once(dirname(__FILE__).'/includes/auto-load-next-post-core-functions.php'); // Contains core functions for the front/back end. |
|
182 | 182 | |
183 | 183 | // Include theme support. |
184 | 184 | alnp_include_theme_support(); |
185 | 185 | |
186 | 186 | // 3rd Party support. |
187 | - include_once( dirname( __FILE__ ) . '/includes/3rd-party/3rd-party.php' ); |
|
187 | + include_once(dirname(__FILE__).'/includes/3rd-party/3rd-party.php'); |
|
188 | 188 | |
189 | 189 | // Customizer. |
190 | - include_once( dirname( __FILE__ ) . '/includes/customizer/class-alnp-customizer.php' ); |
|
191 | - include_once( dirname( __FILE__ ) . '/includes/customizer/class-alnp-customizer-scripts.php' ); |
|
190 | + include_once(dirname(__FILE__).'/includes/customizer/class-alnp-customizer.php'); |
|
191 | + include_once(dirname(__FILE__).'/includes/customizer/class-alnp-customizer-scripts.php'); |
|
192 | 192 | |
193 | 193 | // Include admin class to handle all back-end functions. |
194 | - if ( is_admin() ) { |
|
195 | - include_once( dirname( __FILE__ ) . '/includes/admin/class-alnp-admin.php' ); // Admin section. |
|
194 | + if (is_admin()) { |
|
195 | + include_once(dirname(__FILE__).'/includes/admin/class-alnp-admin.php'); // Admin section. |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // Install. |
199 | - require_once( dirname( __FILE__ ) . '/includes/class-alnp-install.php' ); |
|
199 | + require_once(dirname(__FILE__).'/includes/class-alnp-install.php'); |
|
200 | 200 | } // END includes() |
201 | 201 | |
202 | 202 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return void |
212 | 212 | */ |
213 | 213 | public function load_plugin_textdomain() { |
214 | - load_plugin_textdomain( 'auto-load-next-post', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
214 | + load_plugin_textdomain('auto-load-next-post', false, dirname(plugin_basename(__FILE__)).'/languages/'); |
|
215 | 215 | } // END load_plugin_textdomain() |
216 | 216 | |
217 | 217 | /** |
@@ -223,33 +223,33 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function alnp_enqueue_scripts() { |
225 | 225 | // Load the Javascript if found as a singluar post and the user is not a bot. |
226 | - if ( !alnp_is_bot() && is_singular() && get_post_type() == 'post' ) { |
|
226 | + if ( ! alnp_is_bot() && is_singular() && get_post_type() == 'post') { |
|
227 | 227 | // This checks to see if the JavaScript should load in the footer or not. |
228 | 228 | $load_in_footer = alnp_load_js_in_footer(); |
229 | 229 | |
230 | - $this->load_file( 'auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy.min.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer ); |
|
230 | + $this->load_file('auto-load-next-post-scrollspy', '/assets/js/libs/scrollspy.min.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer); |
|
231 | 231 | |
232 | 232 | // Only load History.js when not in the customizer. |
233 | - if ( ! is_customize_preview() ) { |
|
234 | - $this->load_file( 'auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer ); |
|
233 | + if ( ! is_customize_preview()) { |
|
234 | + $this->load_file('auto-load-next-post-history', '/assets/js/libs/jquery.history.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, $load_in_footer); |
|
235 | 235 | } |
236 | 236 | |
237 | - $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, $load_in_footer ); |
|
237 | + $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, $load_in_footer); |
|
238 | 238 | |
239 | 239 | // Variables for the JavaScript |
240 | - wp_localize_script( 'auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
240 | + wp_localize_script('auto-load-next-post-script', 'auto_load_next_post_params', array( |
|
241 | 241 | 'alnp_version' => AUTO_LOAD_NEXT_POST_VERSION, |
242 | - 'alnp_content_container' => get_option( 'auto_load_next_post_content_container' ), |
|
243 | - 'alnp_title_selector' => get_option( 'auto_load_next_post_title_selector' ), |
|
244 | - 'alnp_navigation_container' => get_option( 'auto_load_next_post_navigation_container' ), |
|
245 | - 'alnp_comments_container' => get_option( 'auto_load_next_post_comments_container' ), |
|
246 | - 'alnp_remove_comments' => get_option( 'auto_load_next_post_remove_comments' ), |
|
247 | - 'alnp_google_analytics' => get_option( 'auto_load_next_post_google_analytics' ), |
|
248 | - 'alnp_event_on_load' => get_option( 'auto_load_next_post_on_load_event' ), |
|
249 | - 'alnp_event_on_entering' => get_option( 'auto_load_next_post_on_entering_event' ), |
|
242 | + 'alnp_content_container' => get_option('auto_load_next_post_content_container'), |
|
243 | + 'alnp_title_selector' => get_option('auto_load_next_post_title_selector'), |
|
244 | + 'alnp_navigation_container' => get_option('auto_load_next_post_navigation_container'), |
|
245 | + 'alnp_comments_container' => get_option('auto_load_next_post_comments_container'), |
|
246 | + 'alnp_remove_comments' => get_option('auto_load_next_post_remove_comments'), |
|
247 | + 'alnp_google_analytics' => get_option('auto_load_next_post_google_analytics'), |
|
248 | + 'alnp_event_on_load' => get_option('auto_load_next_post_on_load_event'), |
|
249 | + 'alnp_event_on_entering' => get_option('auto_load_next_post_on_entering_event'), |
|
250 | 250 | 'alnp_is_customizer' => $this->is_alnp_using_customizer(), |
251 | 251 | 'alnp_load_in_footer' => $load_in_footer |
252 | - ) ); |
|
252 | + )); |
|
253 | 253 | } // END if is_singular() && get_post_type() |
254 | 254 | } // END alnp_enqueue_scripts() |
255 | 255 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return string|false |
263 | 263 | */ |
264 | 264 | public static function is_alnp_using_customizer() { |
265 | - if ( is_customize_preview() ) { |
|
265 | + if (is_customize_preview()) { |
|
266 | 266 | return "yes"; |
267 | 267 | } |
268 | 268 | |
@@ -283,19 +283,19 @@ discard block |
||
283 | 283 | * @param string $version Optional, can match the version of the plugin or version of the source file. |
284 | 284 | * @param bool $footer Optional, can set the JavaScript to load in the footer instead. |
285 | 285 | */ |
286 | - public static function load_file( $name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false ) { |
|
287 | - $url = AUTO_LOAD_NEXT_POST_URL_PATH . $file_path; // URL to the file. |
|
288 | - |
|
289 | - if ( file_exists( AUTO_LOAD_NEXT_POST_FILE_PATH . $file_path ) ) { |
|
290 | - if ( $is_script ) { |
|
291 | - if ( !wp_script_is( $name, 'registered' ) ) { |
|
292 | - wp_register_script( $name, $url, $support, $version, $footer ); |
|
293 | - wp_enqueue_script( $name ); |
|
286 | + public static function load_file($name, $file_path, $is_script = false, $support = array(), $version = '', $footer = false) { |
|
287 | + $url = AUTO_LOAD_NEXT_POST_URL_PATH.$file_path; // URL to the file. |
|
288 | + |
|
289 | + if (file_exists(AUTO_LOAD_NEXT_POST_FILE_PATH.$file_path)) { |
|
290 | + if ($is_script) { |
|
291 | + if ( ! wp_script_is($name, 'registered')) { |
|
292 | + wp_register_script($name, $url, $support, $version, $footer); |
|
293 | + wp_enqueue_script($name); |
|
294 | 294 | } |
295 | 295 | } else { |
296 | - if ( !wp_style_is( $name, 'registered' ) ) { |
|
297 | - wp_register_style( $name, $url ); |
|
298 | - wp_enqueue_style( $name ); |
|
296 | + if ( ! wp_style_is($name, 'registered')) { |
|
297 | + wp_register_style($name, $url); |
|
298 | + wp_enqueue_style($name); |
|
299 | 299 | } |
300 | 300 | } // end if |
301 | 301 | } // end if |
@@ -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' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Admin')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Admin { |
21 | 21 | |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | self::includes(); |
32 | 32 | |
33 | 33 | // Register scripts and styles for settings page. |
34 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_styles' ), 10 ); |
|
35 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ), 10 ); |
|
34 | + add_action('admin_enqueue_scripts', array($this, 'admin_styles'), 10); |
|
35 | + add_action('admin_enqueue_scripts', array($this, 'admin_scripts'), 10); |
|
36 | 36 | |
37 | 37 | // Add a message in the WP Privacy Policy Guide page. |
38 | - add_action( 'admin_init', array( $this, 'add_privacy_policy_guide_content' ) ); |
|
38 | + add_action('admin_init', array($this, 'add_privacy_policy_guide_content')); |
|
39 | 39 | |
40 | 40 | // Add settings page. |
41 | - add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); |
|
41 | + add_action('admin_menu', array($this, 'admin_menu'), 9); |
|
42 | 42 | |
43 | 43 | // Filters plugin row and admin footer. |
44 | - add_filter( 'plugin_action_links_' . plugin_basename( AUTO_LOAD_NEXT_POST_FILE ), array( $this, 'plugin_action_links' ) ); |
|
45 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta'), 10, 3 ); |
|
46 | - add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 15, 1 ); |
|
47 | - add_filter( 'update_footer', array( $this, 'update_footer'), 15 ); |
|
44 | + add_filter('plugin_action_links_'.plugin_basename(AUTO_LOAD_NEXT_POST_FILE), array($this, 'plugin_action_links')); |
|
45 | + add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 3); |
|
46 | + add_filter('admin_footer_text', array($this, 'admin_footer_text'), 15, 1); |
|
47 | + add_filter('update_footer', array($this, 'update_footer'), 15); |
|
48 | 48 | } // END __construct() |
49 | 49 | |
50 | 50 | /** |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | * @version 1.5.11 |
56 | 56 | */ |
57 | 57 | public function includes() { |
58 | - include( dirname( __FILE__ ) . '/class-alnp-admin-notices.php' ); // Plugin Notices |
|
58 | + include(dirname(__FILE__).'/class-alnp-admin-notices.php'); // Plugin Notices |
|
59 | 59 | |
60 | 60 | // Classes we only need if the ajax is not-ajax |
61 | - if ( apply_filters( 'auto_load_next_post_enable_admin_help_tab', true ) ) { |
|
62 | - include( dirname( __FILE__ ) . '/class-alnp-admin-help.php' ); // Plugin Help Tab |
|
61 | + if (apply_filters('auto_load_next_post_enable_admin_help_tab', true)) { |
|
62 | + include(dirname(__FILE__).'/class-alnp-admin-help.php'); // Plugin Help Tab |
|
63 | 63 | } |
64 | 64 | } // END includes() |
65 | 65 | |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | $screen = get_current_screen(); |
74 | 74 | $screen_id = $screen ? $screen->id : ''; |
75 | 75 | |
76 | - Auto_Load_Next_Post::load_file( AUTO_LOAD_NEXT_POST_SLUG . '_admin', '/assets/css/admin/auto-load-next-post' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.css' ); |
|
76 | + Auto_Load_Next_Post::load_file(AUTO_LOAD_NEXT_POST_SLUG.'_admin', '/assets/css/admin/auto-load-next-post'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.css'); |
|
77 | 77 | |
78 | - if ( $screen_id == 'settings_page_auto-load-next-post-settings' ) { |
|
78 | + if ($screen_id == 'settings_page_auto-load-next-post-settings') { |
|
79 | 79 | // Select2 - Make sure that we remove other registered Select2 to prevent styling issues. |
80 | - if ( wp_script_is( 'select2', 'registered' ) ) { |
|
81 | - wp_dequeue_style( 'select2' ); |
|
82 | - wp_deregister_style( 'select2' ); |
|
80 | + if (wp_script_is('select2', 'registered')) { |
|
81 | + wp_dequeue_style('select2'); |
|
82 | + wp_deregister_style('select2'); |
|
83 | 83 | } |
84 | 84 | |
85 | - Auto_Load_Next_Post::load_file( 'select2', '/assets/css/libs/select2' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.css' ); |
|
85 | + Auto_Load_Next_Post::load_file('select2', '/assets/css/libs/select2'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.css'); |
|
86 | 86 | } |
87 | 87 | } // END admin_styles() |
88 | 88 | |
@@ -97,24 +97,24 @@ discard block |
||
97 | 97 | $screen = get_current_screen(); |
98 | 98 | $screen_id = $screen ? $screen->id : ''; |
99 | 99 | |
100 | - if ( $screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
100 | + if ($screen->id == 'settings_page_auto-load-next-post-settings') { |
|
101 | 101 | // Select2 - Make sure that we remove other registered Select2 to prevent plugin conflict issues. |
102 | - if ( wp_script_is( 'select2', 'registered' ) ) { |
|
103 | - wp_dequeue_script( 'select2' ); |
|
104 | - wp_deregister_script( 'select2' ); |
|
102 | + if (wp_script_is('select2', 'registered')) { |
|
103 | + wp_dequeue_script('select2'); |
|
104 | + wp_deregister_script('select2'); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // Load Select2 |
108 | - Auto_Load_Next_Post::load_file( 'select2', '/assets/js/libs/select2' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array( 'jquery' ), '4.0.5', true ); |
|
108 | + Auto_Load_Next_Post::load_file('select2', '/assets/js/libs/select2'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), '4.0.5', true); |
|
109 | 109 | |
110 | 110 | // Load plugin settings. |
111 | - Auto_Load_Next_Post::load_file( AUTO_LOAD_NEXT_POST_SLUG . '_admin', '/assets/js/admin/settings' . AUTO_LOAD_NEXT_POST_SCRIPT_MODE . '.js', true, array( 'jquery' ), AUTO_LOAD_NEXT_POST_VERSION, true ); |
|
111 | + Auto_Load_Next_Post::load_file(AUTO_LOAD_NEXT_POST_SLUG.'_admin', '/assets/js/admin/settings'.AUTO_LOAD_NEXT_POST_SCRIPT_MODE.'.js', true, array('jquery'), AUTO_LOAD_NEXT_POST_VERSION, true); |
|
112 | 112 | |
113 | 113 | // Variables for Admin JavaScripts |
114 | - wp_localize_script( AUTO_LOAD_NEXT_POST_SLUG . '_admin', 'alnp_settings_params', array( |
|
114 | + wp_localize_script(AUTO_LOAD_NEXT_POST_SLUG.'_admin', 'alnp_settings_params', array( |
|
115 | 115 | 'is_rtl' => is_rtl() ? 'rtl' : 'ltr', |
116 | - 'i18n_nav_warning' => esc_html__( 'The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post' ), |
|
117 | - ) ); |
|
116 | + 'i18n_nav_warning' => esc_html__('The changes you made will be lost if you navigate away from this page.', 'auto-load-next-post'), |
|
117 | + )); |
|
118 | 118 | } |
119 | 119 | } // END admin_scripts() |
120 | 120 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @static |
127 | 127 | */ |
128 | 128 | public static function add_privacy_policy_guide_content() { |
129 | - if ( function_exists( 'wp_add_privacy_policy_content' ) ) { |
|
130 | - wp_add_privacy_policy_content( esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), self::get_privacy_policy_guide_message() ); |
|
129 | + if (function_exists('wp_add_privacy_policy_content')) { |
|
130 | + wp_add_privacy_policy_content(esc_html__('Auto Load Next Post', 'auto-load-next-post'), self::get_privacy_policy_guide_message()); |
|
131 | 131 | } |
132 | 132 | } // END add_privacy_policy_guide_content() |
133 | 133 | |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | protected static function get_privacy_policy_guide_message() { |
143 | 143 | $content = ' |
144 | 144 | <div contenteditable="false">' . |
145 | - '<p class="wp-policy-help">' . |
|
146 | - sprintf( __( '%s does not collect, store or share any personal data.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . |
|
147 | - '</p>' . |
|
145 | + '<p class="wp-policy-help">'. |
|
146 | + sprintf(__('%s does not collect, store or share any personal data.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')). |
|
147 | + '</p>'. |
|
148 | 148 | '</div>'; |
149 | 149 | |
150 | 150 | return $content; |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function admin_menu() { |
161 | 161 | $settings_page = add_options_page( |
162 | - sprintf( __( '%s Settings', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
163 | - esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), |
|
162 | + sprintf(__('%s Settings', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
163 | + esc_html__('Auto Load Next Post', 'auto-load-next-post'), |
|
164 | 164 | 'manage_options', |
165 | 165 | 'auto-load-next-post-settings', |
166 | - array( $this, 'settings_page' ) |
|
166 | + array($this, 'settings_page') |
|
167 | 167 | ); |
168 | 168 | |
169 | - add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) ); |
|
169 | + add_action('load-'.$settings_page, array($this, 'settings_page_init')); |
|
170 | 170 | } // END admin_menu() |
171 | 171 | |
172 | 172 | /** |
@@ -181,29 +181,29 @@ discard block |
||
181 | 181 | global $current_tab, $current_section; |
182 | 182 | |
183 | 183 | // Include settings pages. |
184 | - include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' ); |
|
184 | + include_once(dirname(__FILE__).'/class-alnp-admin-settings.php'); |
|
185 | 185 | |
186 | 186 | Auto_Load_Next_Post_Admin_Settings::get_settings_pages(); |
187 | 187 | |
188 | 188 | // Get current tab/section. |
189 | - $current_tab = empty( $_GET['tab'] ) ? 'theme-selectors' : sanitize_title( wp_unslash( $_GET['tab'] ) ); |
|
190 | - $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) ); |
|
189 | + $current_tab = empty($_GET['tab']) ? 'theme-selectors' : sanitize_title(wp_unslash($_GET['tab'])); |
|
190 | + $current_section = empty($_REQUEST['section']) ? '' : sanitize_title(wp_unslash($_REQUEST['section'])); |
|
191 | 191 | |
192 | 192 | // Save settings if data has been posted. |
193 | - if ( apply_filters( '' !== $current_section ? "auto_load_next_post_save_settings_{$current_tab}_{$current_section}" : "auto_load_next_post_save_settings_{$current_tab}", ! empty( $_POST ) ) ) { |
|
193 | + if (apply_filters('' !== $current_section ? "auto_load_next_post_save_settings_{$current_tab}_{$current_section}" : "auto_load_next_post_save_settings_{$current_tab}", ! empty($_POST))) { |
|
194 | 194 | Auto_Load_Next_Post_Admin_Settings::save(); |
195 | 195 | } |
196 | 196 | |
197 | 197 | // Add any posted messages. |
198 | - if ( ! empty( $_GET['auto_load_next_post_error'] ) ) { |
|
199 | - Auto_Load_Next_Post_Admin_Settings::add_error( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_error'] ) ) ); |
|
198 | + if ( ! empty($_GET['auto_load_next_post_error'])) { |
|
199 | + Auto_Load_Next_Post_Admin_Settings::add_error(wp_kses_post(wp_unslash($_GET['auto_load_next_post_error']))); |
|
200 | 200 | } |
201 | 201 | |
202 | - if ( ! empty( $_GET['auto_load_next_post_message'] ) ) { |
|
203 | - Auto_Load_Next_Post_Admin_Settings::add_message( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_message'] ) ) ); |
|
202 | + if ( ! empty($_GET['auto_load_next_post_message'])) { |
|
203 | + Auto_Load_Next_Post_Admin_Settings::add_message(wp_kses_post(wp_unslash($_GET['auto_load_next_post_message']))); |
|
204 | 204 | } |
205 | 205 | |
206 | - do_action( 'auto_load_next_post_settings_page_init' ); |
|
206 | + do_action('auto_load_next_post_settings_page_init'); |
|
207 | 207 | } // END settings_page_init() |
208 | 208 | |
209 | 209 | /** |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @since 1.0.0 |
214 | 214 | */ |
215 | 215 | public function settings_page() { |
216 | - include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' ); |
|
216 | + include_once(dirname(__FILE__).'/class-alnp-admin-settings.php'); |
|
217 | 217 | |
218 | 218 | Auto_Load_Next_Post_Admin_Settings::output(); |
219 | 219 | } // END settings_page() |
@@ -227,18 +227,18 @@ discard block |
||
227 | 227 | * @param array $links |
228 | 228 | * @return array $links |
229 | 229 | */ |
230 | - public function plugin_action_links( $links ) { |
|
230 | + public function plugin_action_links($links) { |
|
231 | 231 | $plugin_action_links = array(); |
232 | 232 | |
233 | - if ( current_user_can( 'manage_options' ) ) { |
|
233 | + if (current_user_can('manage_options')) { |
|
234 | 234 | // Checks if Auto Load Next Post Pro has been installed. |
235 | - if ( ! is_alnp_pro_version_installed() ) { |
|
236 | - $plugin_action_links['go-pro'] = '<a href="' . esc_url( AUTO_LOAD_NEXT_POST_STORE_URL . 'pro/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page' ) . '" aria-label="' . esc_attr__( 'Sign up for Auto Load Next Post Pro', 'auto-load-next-post' ) . '" target="_blank" style="color:green; font-weight:bold;">' . __( 'Sign up for Pro', 'auto-load-next-post' ) . '</a>'; |
|
235 | + if ( ! is_alnp_pro_version_installed()) { |
|
236 | + $plugin_action_links['go-pro'] = '<a href="'.esc_url(AUTO_LOAD_NEXT_POST_STORE_URL.'pro/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page').'" aria-label="'.esc_attr__('Sign up for Auto Load Next Post Pro', 'auto-load-next-post').'" target="_blank" style="color:green; font-weight:bold;">'.__('Sign up for Pro', 'auto-load-next-post').'</a>'; |
|
237 | 237 | } |
238 | 238 | |
239 | - $plugin_action_links['settings'] = '<a href="' . admin_url( 'options-general.php?page=auto-load-next-post-settings' ) . '" aria-label="' . esc_attr__( 'View Auto Load Next Post settings', 'auto-load-next-post' ) . '">' . __( 'Settings', 'auto-load-next-post' ) . '</a>'; |
|
239 | + $plugin_action_links['settings'] = '<a href="'.admin_url('options-general.php?page=auto-load-next-post-settings').'" aria-label="'.esc_attr__('View Auto Load Next Post settings', 'auto-load-next-post').'">'.__('Settings', 'auto-load-next-post').'</a>'; |
|
240 | 240 | |
241 | - return array_merge( $plugin_action_links, $links ); |
|
241 | + return array_merge($plugin_action_links, $links); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | return $links; |
@@ -255,18 +255,18 @@ discard block |
||
255 | 255 | * @param array $data Plugin Information |
256 | 256 | * @return array $links |
257 | 257 | */ |
258 | - public function plugin_row_meta( $links, $file, $data ) { |
|
259 | - if ( $file == plugin_basename( AUTO_LOAD_NEXT_POST_FILE ) ) { |
|
260 | - $links[ 1 ] = sprintf( __( 'Developed By %s', 'auto-load-next-post' ), '<a href="' . $data[ 'AuthorURI' ] . '" aria-label="' . esc_attr__( 'View the developers site', 'auto-load-next-post' ) . '">' . $data[ 'Author' ] . '</a>' ); |
|
258 | + public function plugin_row_meta($links, $file, $data) { |
|
259 | + if ($file == plugin_basename(AUTO_LOAD_NEXT_POST_FILE)) { |
|
260 | + $links[1] = sprintf(__('Developed By %s', 'auto-load-next-post'), '<a href="'.$data['AuthorURI'].'" aria-label="'.esc_attr__('View the developers site', 'auto-load-next-post').'">'.$data['Author'].'</a>'); |
|
261 | 261 | |
262 | 262 | $row_meta = array( |
263 | - 'docs' => '<a href="' . esc_url( AUTO_LOAD_NEXT_POST_STORE_URL . 'documentation/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page' ) . '" aria-label="' . esc_attr__( 'View Auto Load Next Post documentation', 'auto-load-next-post' ) . '" target="_blank">' . esc_attr__( 'Documentation', 'auto-load-next-post' ) . '</a>', |
|
264 | - 'community' => '<a href="' . esc_url( 'https://wordpress.org/support/plugin/auto-load-next-post' ) . '" aria-label="' . esc_attr__( 'Get support from the community', 'auto-load-next-post' ). '" target="_blank">' . esc_attr__( 'Community Support', 'auto-load-next-post' ) . '</a>', |
|
265 | - 'theme-support' => '<a href="' . esc_url( AUTO_LOAD_NEXT_POST_STORE_URL . 'product/theme-support/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page' ) . '" attr-label="' . esc_attr__( 'Get theme support', 'auto-load-next-post' ) . '" target="_blank">' . esc_attr__( 'Theme Support', 'auto-load-next-post' ) . '</a>', |
|
266 | - 'review' => '<a href="' . esc_url( AUTO_LOAD_NEXT_POST_REVIEW_URL ) . '" aria-label="' . esc_attr( __( 'Review Auto Load Next Post on WordPress.org', 'auto-load-next-post' ) ) . '" target="_blank">' . __( 'Leave a Review', 'auto-load-next-post' ) . '</a>', |
|
263 | + 'docs' => '<a href="'.esc_url(AUTO_LOAD_NEXT_POST_STORE_URL.'documentation/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page').'" aria-label="'.esc_attr__('View Auto Load Next Post documentation', 'auto-load-next-post').'" target="_blank">'.esc_attr__('Documentation', 'auto-load-next-post').'</a>', |
|
264 | + 'community' => '<a href="'.esc_url('https://wordpress.org/support/plugin/auto-load-next-post').'" aria-label="'.esc_attr__('Get support from the community', 'auto-load-next-post').'" target="_blank">'.esc_attr__('Community Support', 'auto-load-next-post').'</a>', |
|
265 | + 'theme-support' => '<a href="'.esc_url(AUTO_LOAD_NEXT_POST_STORE_URL.'product/theme-support/?utm_source=plugin&utm_medium=link&utm_campaign=plugins-page').'" attr-label="'.esc_attr__('Get theme support', 'auto-load-next-post').'" target="_blank">'.esc_attr__('Theme Support', 'auto-load-next-post').'</a>', |
|
266 | + 'review' => '<a href="'.esc_url(AUTO_LOAD_NEXT_POST_REVIEW_URL).'" aria-label="'.esc_attr(__('Review Auto Load Next Post on WordPress.org', 'auto-load-next-post')).'" target="_blank">'.__('Leave a Review', 'auto-load-next-post').'</a>', |
|
267 | 267 | ); |
268 | 268 | |
269 | - $links = array_merge( $links, $row_meta ); |
|
269 | + $links = array_merge($links, $row_meta); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | return $links; |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | * @param string $text text to be rendered in the footer. |
283 | 283 | * @return string $text |
284 | 284 | */ |
285 | - public function admin_footer_text( $text ) { |
|
285 | + public function admin_footer_text($text) { |
|
286 | 286 | $current_screen = get_current_screen(); |
287 | 287 | |
288 | - if ( isset( $current_screen->id ) && $current_screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
288 | + if (isset($current_screen->id) && $current_screen->id == 'settings_page_auto-load-next-post-settings') { |
|
289 | 289 | // Rating and Review |
290 | 290 | $text = sprintf( |
291 | 291 | /* translators: 1: Auto Load Next Post 2:: five stars */ |
292 | - __( 'If you like %1$s, please leave a %2$s rating. A huge thank you in advance!', 'auto-load-next-post' ), |
|
293 | - sprintf( '<strong>%1$s</strong>', esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
294 | - '<a href="' . AUTO_LOAD_NEXT_POST_REVIEW_URL . '?rate=5#new-post" target="_blank" aria-label="' . esc_attr__( 'five star', 'auto-load-next-post' ) . '" data-rated="' . esc_attr__( 'Thanks :)', 'auto-load-next-post' ) . '">★★★★★</a>' |
|
292 | + __('If you like %1$s, please leave a %2$s rating. A huge thank you in advance!', 'auto-load-next-post'), |
|
293 | + sprintf('<strong>%1$s</strong>', esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
294 | + '<a href="'.AUTO_LOAD_NEXT_POST_REVIEW_URL.'?rate=5#new-post" target="_blank" aria-label="'.esc_attr__('five star', 'auto-load-next-post').'" data-rated="'.esc_attr__('Thanks :)', 'auto-load-next-post').'">★★★★★</a>' |
|
295 | 295 | ); |
296 | 296 | } |
297 | 297 | |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | * @param string $text |
309 | 309 | * @return string $text |
310 | 310 | */ |
311 | - public function update_footer( $text ) { |
|
311 | + public function update_footer($text) { |
|
312 | 312 | $screen = get_current_screen(); |
313 | 313 | |
314 | - if ( $screen->id == 'settings_page_auto-load-next-post-settings' ) { |
|
315 | - return sprintf( __( '%s Version', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ) . ' ' . esc_attr( AUTO_LOAD_NEXT_POST_VERSION ); |
|
314 | + if ($screen->id == 'settings_page_auto-load-next-post-settings') { |
|
315 | + return sprintf(__('%s Version', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')).' '.esc_attr(AUTO_LOAD_NEXT_POST_VERSION); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | return $text; |
@@ -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_Misc_Tab' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Settings_Misc_Tab')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Settings_Misc_Tab extends Auto_Load_Next_Post_Settings_Page { |
21 | 21 | |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | 30 | $this->id = 'misc'; |
31 | - $this->label = esc_html__( 'Misc', 'auto-load-next-post' ); |
|
31 | + $this->label = esc_html__('Misc', 'auto-load-next-post'); |
|
32 | 32 | |
33 | 33 | parent::__construct(); |
34 | 34 | |
35 | - add_filter( 'auto_load_next_post_misc_settings', array( __CLASS__, 'lock_js_in_footer' ), 0, 1 ); |
|
36 | - add_action( 'auto_load_next_post_sections_misc', array( __CLASS__, 'no_comment_selector_set' ), 10 ); |
|
35 | + add_filter('auto_load_next_post_misc_settings', array(__CLASS__, 'lock_js_in_footer'), 0, 1); |
|
36 | + add_action('auto_load_next_post_sections_misc', array(__CLASS__, 'no_comment_selector_set'), 10); |
|
37 | 37 | } // END __construct() |
38 | 38 | |
39 | 39 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | * @since 1.5.0 |
45 | 45 | */ |
46 | 46 | public static function no_comment_selector_set() { |
47 | - $comments_container = get_option( 'auto_load_next_post_comments_container' ); |
|
48 | - $remove_comments = get_option( 'auto_load_next_post_remove_comments' ); |
|
47 | + $comments_container = get_option('auto_load_next_post_comments_container'); |
|
48 | + $remove_comments = get_option('auto_load_next_post_remove_comments'); |
|
49 | 49 | |
50 | - if ( empty( $comments_container ) && ! empty( $remove_comments ) ) { |
|
51 | - include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-no-comment-selector.php' ); |
|
50 | + if (empty($comments_container) && ! empty($remove_comments)) { |
|
51 | + include(dirname(AUTO_LOAD_NEXT_POST_FILE).'/includes/admin/views/html-notice-no-comment-selector.php'); |
|
52 | 52 | } |
53 | 53 | } // END no_comment_selector_set() |
54 | 54 | |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | * @param array $settings |
65 | 65 | * @return array $settings |
66 | 66 | */ |
67 | - public static function lock_js_in_footer( $settings ) { |
|
68 | - $js_locked_in_footer = get_option( 'auto_load_next_post_lock_js_in_footer' ); |
|
67 | + public static function lock_js_in_footer($settings) { |
|
68 | + $js_locked_in_footer = get_option('auto_load_next_post_lock_js_in_footer'); |
|
69 | 69 | |
70 | - if ( ! empty( $js_locked_in_footer ) && $js_locked_in_footer == 'yes' ) { |
|
70 | + if ( ! empty($js_locked_in_footer) && $js_locked_in_footer == 'yes') { |
|
71 | 71 | // Setting key to look for. |
72 | 72 | $key = 'load_js_in_footer'; |
73 | 73 | |
74 | 74 | // Find the setting. |
75 | - $find_setting = array_search( $key, $settings ); |
|
75 | + $find_setting = array_search($key, $settings); |
|
76 | 76 | |
77 | 77 | // Does the setting exist? |
78 | - if ( is_bool( $find_setting ) === true ) { |
|
79 | - unset( $settings[$key] ); |
|
78 | + if (is_bool($find_setting) === true) { |
|
79 | + unset($settings[$key]); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -98,46 +98,46 @@ discard block |
||
98 | 98 | 'title' => array( |
99 | 99 | 'title' => $this->label, |
100 | 100 | 'type' => 'title', |
101 | - 'desc' => sprintf( esc_html__( 'Here you set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
|
101 | + 'desc' => sprintf(esc_html__('Here you set if you want to track pageviews, remove comments and load %s javascript in the footer.', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')), |
|
102 | 102 | 'id' => 'misc_options' |
103 | 103 | ), |
104 | 104 | |
105 | 105 | 'remove_comments' => array( |
106 | - 'title' => esc_html__( 'Remove Comments', 'auto-load-next-post' ), |
|
107 | - 'desc' => esc_html__( 'Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post' ), |
|
106 | + 'title' => esc_html__('Remove Comments', 'auto-load-next-post'), |
|
107 | + 'desc' => esc_html__('Enable to remove comments when each post loads including the initial post.', 'auto-load-next-post'), |
|
108 | 108 | 'id' => 'auto_load_next_post_remove_comments', |
109 | 109 | 'default' => 'yes', |
110 | 110 | 'type' => 'checkbox' |
111 | 111 | ), |
112 | 112 | |
113 | 113 | 'google_analytics' => array( |
114 | - 'title' => esc_html__( 'Update Google Analytics', 'auto-load-next-post' ), |
|
115 | - 'desc' => esc_html__( 'Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post' ), |
|
114 | + 'title' => esc_html__('Update Google Analytics', 'auto-load-next-post'), |
|
115 | + 'desc' => esc_html__('Enable to track each post the visitor is reading. This will count as a pageview. You must already have Google Analytics setup.', 'auto-load-next-post'), |
|
116 | 116 | 'id' => 'auto_load_next_post_google_analytics', |
117 | 117 | 'default' => 'no', |
118 | 118 | 'type' => 'checkbox' |
119 | 119 | ), |
120 | 120 | |
121 | 121 | 'load_js_in_footer' => array( |
122 | - 'title' => esc_html__( 'JavaScript in Footer?', 'auto-load-next-post' ), |
|
123 | - 'desc' => esc_html__( 'Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site or if the current theme requires it.', 'auto-load-next-post' ), |
|
122 | + 'title' => esc_html__('JavaScript in Footer?', 'auto-load-next-post'), |
|
123 | + 'desc' => esc_html__('Enable to load Auto Load Next Post in the footer instead of the header. Can be useful to optimize your site or if the current theme requires it.', 'auto-load-next-post'), |
|
124 | 124 | 'id' => 'auto_load_next_post_load_js_in_footer', |
125 | 125 | 'default' => 'no', |
126 | 126 | 'type' => 'checkbox' |
127 | 127 | ), |
128 | 128 | |
129 | 129 | 'reset_data' => array( |
130 | - 'title' => esc_html__( 'Reset all data?', 'auto-load-next-post' ), |
|
131 | - 'desc' => esc_html__( 'Press the reset button to clear all settings for this plugin and re-initialize.', 'auto-load-next-post' ), |
|
130 | + 'title' => esc_html__('Reset all data?', 'auto-load-next-post'), |
|
131 | + 'desc' => esc_html__('Press the reset button to clear all settings for this plugin and re-initialize.', 'auto-load-next-post'), |
|
132 | 132 | 'id' => 'auto_load_next_post_reset_data', |
133 | - 'value' => esc_html__( 'Reset', 'auto-load-next-post' ), |
|
134 | - 'url' => add_query_arg( array( 'page' => 'auto-load-next-post-settings', 'tab' => esc_attr( $this->id ), 'reset-alnp' => 'yes' ), admin_url( 'options-general.php' ) ), |
|
133 | + 'value' => esc_html__('Reset', 'auto-load-next-post'), |
|
134 | + 'url' => add_query_arg(array('page' => 'auto-load-next-post-settings', 'tab' => esc_attr($this->id), 'reset-alnp' => 'yes'), admin_url('options-general.php')), |
|
135 | 135 | 'type' => 'button' |
136 | 136 | ), |
137 | 137 | |
138 | 138 | 'uninstall' => array( |
139 | - 'title' => esc_html__( 'Remove all data on uninstall?', 'auto-load-next-post' ), |
|
140 | - 'desc' => esc_html__( 'If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post' ), |
|
139 | + 'title' => esc_html__('Remove all data on uninstall?', 'auto-load-next-post'), |
|
140 | + 'desc' => esc_html__('If enabled, all settings for this plugin will all be deleted when uninstalling via Plugins > Delete.', 'auto-load-next-post'), |
|
141 | 141 | 'id' => 'auto_load_next_post_uninstall_data', |
142 | 142 | 'default' => 'no', |
143 | 143 | 'type' => 'checkbox' |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public function output() { |
161 | 161 | $settings = $this->get_settings(); |
162 | 162 | |
163 | - Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
|
163 | + Auto_Load_Next_Post_Admin_Settings::output_fields($settings); |
|
164 | 164 | } // END output() |
165 | 165 | |
166 | 166 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function save() { |
173 | 173 | $settings = $this->get_settings(); |
174 | 174 | |
175 | - Auto_Load_Next_Post_Admin_Settings::save_fields( $settings ); |
|
175 | + Auto_Load_Next_Post_Admin_Settings::save_fields($settings); |
|
176 | 176 | } // END save() |
177 | 177 | |
178 | 178 | } // END class |