@@ -8,60 +8,60 @@ |
||
8 | 8 | * @version 1.5.8 |
9 | 9 | */ |
10 | 10 | |
11 | -if ( have_posts() ) : |
|
11 | +if (have_posts()) : |
|
12 | 12 | |
13 | 13 | // Load content before the loop. |
14 | - do_action( 'alnp_load_before_loop' ); |
|
14 | + do_action('alnp_load_before_loop'); |
|
15 | 15 | |
16 | 16 | // Check that there are posts to load. |
17 | - while ( have_posts() ) : the_post(); |
|
17 | + while (have_posts()) : the_post(); |
|
18 | 18 | |
19 | 19 | $post_format = get_post_format(); // Post Format e.g. video |
20 | 20 | |
21 | 21 | $post_type = alnp_get_post_type(); // Post Type e.g. single |
22 | 22 | |
23 | 23 | // Load content before the post content. |
24 | - do_action( 'alnp_load_before_content' ); |
|
24 | + do_action('alnp_load_before_content'); |
|
25 | 25 | |
26 | 26 | // Load content before the post content for a specific post format. |
27 | - do_action( 'alnp_load_before_content_post_format_' . $post_format ); |
|
27 | + do_action('alnp_load_before_content_post_format_'.$post_format); |
|
28 | 28 | |
29 | 29 | // Load content before the post content for a specific post type. |
30 | - do_action( 'alnp_load_before_content_post_type_' . $post_type ); |
|
30 | + do_action('alnp_load_before_content_post_type_'.$post_type); |
|
31 | 31 | |
32 | - if ( false === $post_format ) { |
|
32 | + if (false === $post_format) { |
|
33 | 33 | /* |
34 | 34 | * Include the Post-Type-specific template for the content. |
35 | 35 | * layout-___.php (where ___ is the Post Type name). |
36 | 36 | */ |
37 | - if ( locate_template( alnp_template_location() . 'layout-' . $post_type . '.php') != '' ) { |
|
38 | - get_template_part( alnp_template_location() . 'layout', $post_type ); |
|
37 | + if (locate_template(alnp_template_location().'layout-'.$post_type.'.php') != '') { |
|
38 | + get_template_part(alnp_template_location().'layout', $post_type); |
|
39 | 39 | } else { |
40 | 40 | // If no specific post type found then fallback to standard layout.php file. |
41 | - get_template_part( alnp_template_location() . 'layout' ); |
|
41 | + get_template_part(alnp_template_location().'layout'); |
|
42 | 42 | } |
43 | 43 | } else { |
44 | - get_template_part( alnp_template_location() . 'layout', $post_format ); |
|
44 | + get_template_part(alnp_template_location().'layout', $post_format); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Load content after the post content for a specific post type. |
48 | - do_action( 'alnp_load_after_content_post_type_' . $post_type ); |
|
48 | + do_action('alnp_load_after_content_post_type_'.$post_type); |
|
49 | 49 | |
50 | 50 | // Load content after the post content for a specific post format. |
51 | - do_action( 'alnp_load_after_content_post_format_' . $post_format ); |
|
51 | + do_action('alnp_load_after_content_post_format_'.$post_format); |
|
52 | 52 | |
53 | 53 | // Load content after the post content. |
54 | - do_action( 'alnp_load_after_content' ); |
|
54 | + do_action('alnp_load_after_content'); |
|
55 | 55 | |
56 | 56 | // End the loop. |
57 | 57 | endwhile; |
58 | 58 | |
59 | 59 | // Load content after the loop. |
60 | - do_action( 'alnp_load_after_loop' ); |
|
60 | + do_action('alnp_load_after_loop'); |
|
61 | 61 | |
62 | 62 | else : |
63 | 63 | |
64 | 64 | // Load content if there are no more posts. |
65 | - do_action( 'alnp_no_more_posts' ); |
|
65 | + do_action('alnp_no_more_posts'); |
|
66 | 66 | |
67 | 67 | endif; // END if have_posts() |
@@ -31,9 +31,11 @@ |
||
31 | 31 | // Load content after the loop. |
32 | 32 | do_action( 'alnp_load_after_loop' ); |
33 | 33 | |
34 | -else : |
|
34 | +else { |
|
35 | + : |
|
35 | 36 | |
36 | 37 | // Load content if there are no more posts. |
37 | 38 | do_action( 'alnp_no_more_posts' ); |
39 | +} |
|
38 | 40 | |
39 | 41 | endif; // END if have_posts() |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | <div class="notice notice-success auto-load-next-post-notice is-dismissible"> |
21 | 21 | <div class="auto-load-next-post-notice-inner"> |
22 | 22 | <div class="auto-load-next-post-notice-icon"> |
23 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
23 | + <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'); ?>" /> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <div class="auto-load-next-post-notice-content"> |
27 | - <h3><?php echo sprintf( esc_html__( 'Thank you for installing %1$s!', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></h3> |
|
28 | - <p><?php echo sprintf( __( 'We detected your theme <strong>%1$s</strong> already supports %2$s. Everything is already setup for you and is ready to increase your pageviews.', 'auto-load-next-post' ), $active_theme->name, esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
27 | + <h3><?php echo sprintf(esc_html__('Thank you for installing %1$s!', 'auto-load-next-post'), esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></h3> |
|
28 | + <p><?php echo sprintf(__('We detected your theme <strong>%1$s</strong> already supports %2$s. Everything is already setup for you and is ready to increase your pageviews.', 'auto-load-next-post'), $active_theme->name, esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
29 | 29 | </div> |
30 | 30 | </div> |
31 | 31 | </div> |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function init() { |
31 | 31 | // Add theme support and preset the theme selectors. |
32 | - add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) ); |
|
32 | + add_action('after_setup_theme', array(__CLASS__, 'add_theme_support')); |
|
33 | 33 | |
34 | 34 | // Filters the location of the repeater template. |
35 | - add_filter( 'alnp_template_redirect', array( __CLASS__, 'template_redirect' ) ); |
|
35 | + add_filter('alnp_template_redirect', array(__CLASS__, 'template_redirect')); |
|
36 | 36 | |
37 | 37 | // Filters the repeater template location. |
38 | - add_filter( 'alnp_template_location', array( __CLASS__, 'alnp_oceanwp_template_location' ) ); |
|
38 | + add_filter('alnp_template_location', array(__CLASS__, 'alnp_oceanwp_template_location')); |
|
39 | 39 | |
40 | 40 | // Remove Auto Load Next Post compatible post navigation. |
41 | - remove_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 ); |
|
41 | + remove_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10); |
|
42 | 42 | } // END init() |
43 | 43 | |
44 | 44 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return string |
49 | 49 | */ |
50 | 50 | public static function template_redirect() { |
51 | - return AUTO_LOAD_NEXT_POST_FILE_PATH . '/template/theme-support/oceanwp/content-alnp.php'; |
|
51 | + return AUTO_LOAD_NEXT_POST_FILE_PATH.'/template/theme-support/oceanwp/content-alnp.php'; |
|
52 | 52 | } // END template_redirect() |
53 | 53 | |
54 | 54 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * @static |
70 | 70 | */ |
71 | 71 | public static function add_theme_support() { |
72 | - add_theme_support( 'auto-load-next-post', array( |
|
72 | + add_theme_support('auto-load-next-post', array( |
|
73 | 73 | 'content_container' => 'div.site-content', |
74 | 74 | 'title_selector' => '.entry-title', |
75 | 75 | 'navigation_container' => 'nav.post-navigation', |
76 | 76 | 'comments_container' => 'section#comments', |
77 | 77 | 'load_js_in_footer' => 'no', |
78 | 78 | 'lock_js_in_footer' => 'no', |
79 | - ) ); |
|
79 | + )); |
|
80 | 80 | } // END add_theme_support() |
81 | 81 | |
82 | 82 | } // END class |
@@ -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 |
@@ -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 |
@@ -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_Install' ) ) { |
|
18 | +if ( ! class_exists('Auto_Load_Next_Post_Install')) { |
|
19 | 19 | |
20 | 20 | class Auto_Load_Next_Post_Install { |
21 | 21 | |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __construct() { |
39 | 39 | // Resets Auto Load Next Post settings when requested. |
40 | - add_action( 'init', array( __CLASS__, 'reset_alnp' ), 0 ); |
|
40 | + add_action('init', array(__CLASS__, 'reset_alnp'), 0); |
|
41 | 41 | |
42 | 42 | // Checks version of Auto Load Next Post and install/update if needed. |
43 | - add_action( 'init', array( __CLASS__, 'check_version' ), 5 ); |
|
43 | + add_action('init', array(__CLASS__, 'check_version'), 5); |
|
44 | 44 | |
45 | 45 | // Adds rewrite endpoint. |
46 | - add_action( 'init', array( __CLASS__, 'add_rewrite_endpoint' ), 10 ); |
|
46 | + add_action('init', array(__CLASS__, 'add_rewrite_endpoint'), 10); |
|
47 | 47 | |
48 | 48 | // Get plugin version. |
49 | - self::$current_version = get_option( 'auto_load_next_post_version' ); |
|
49 | + self::$current_version = get_option('auto_load_next_post_version'); |
|
50 | 50 | } // END __construct() |
51 | 51 | |
52 | 52 | /** |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @version 1.5.11 |
61 | 61 | */ |
62 | 62 | public static function check_version() { |
63 | - if ( ! defined( 'IFRAME_REQUEST' ) && version_compare( self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<' ) && current_user_can( 'install_plugins' ) ) { |
|
63 | + if ( ! defined('IFRAME_REQUEST') && version_compare(self::$current_version, AUTO_LOAD_NEXT_POST_VERSION, '<') && current_user_can('install_plugins')) { |
|
64 | 64 | self::install(); |
65 | - do_action( 'auto_load_next_post_updated' ); |
|
65 | + do_action('auto_load_next_post_updated'); |
|
66 | 66 | } |
67 | 67 | } // END check_version() |
68 | 68 | |
@@ -75,19 +75,19 @@ discard block |
||
75 | 75 | * @version 1.5.0 |
76 | 76 | */ |
77 | 77 | public static function install() { |
78 | - if ( ! is_blog_installed() ) { |
|
78 | + if ( ! is_blog_installed()) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | 82 | // Check if we are not already running this routine. |
83 | - if ( 'yes' === get_transient( 'alnp_installing' ) ) { |
|
83 | + if ('yes' === get_transient('alnp_installing')) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
87 | 87 | // If we made it till here nothing is running yet, lets set the transient now for five minutes. |
88 | - set_transient( 'alnp_installing', 'yes', MINUTE_IN_SECONDS * 5 ); |
|
89 | - if ( ! defined( 'AUTO_LOAD_NEXT_POST_INSTALLING' ) ) { |
|
90 | - define( 'AUTO_LOAD_NEXT_POST_INSTALLING', true ); |
|
88 | + set_transient('alnp_installing', 'yes', MINUTE_IN_SECONDS * 5); |
|
89 | + if ( ! defined('AUTO_LOAD_NEXT_POST_INSTALLING')) { |
|
90 | + define('AUTO_LOAD_NEXT_POST_INSTALLING', true); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | // Add default options. |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | // Refresh rewrite rules. |
109 | 109 | self::flush_rewrite_rules(); |
110 | 110 | |
111 | - delete_transient( 'alnp_installing' ); |
|
111 | + delete_transient('alnp_installing'); |
|
112 | 112 | |
113 | - do_action( 'alnp_installed' ); |
|
113 | + do_action('alnp_installed'); |
|
114 | 114 | } // END install() |
115 | 115 | |
116 | 116 | /** |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @since 1.5.0 |
123 | 123 | */ |
124 | 124 | private static function set_theme_selectors() { |
125 | - if ( is_alnp_supported() ) { |
|
126 | - $content_container = alnp_get_theme_support( 'content_container' ); |
|
127 | - $title_selector = alnp_get_theme_support( 'title_selector' ); |
|
128 | - $navigation_container = alnp_get_theme_support( 'navigation_container' ); |
|
129 | - $comments_container = alnp_get_theme_support( 'comments_container' ); |
|
130 | - |
|
131 | - if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container ); |
|
132 | - if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
133 | - if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
134 | - if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
125 | + if (is_alnp_supported()) { |
|
126 | + $content_container = alnp_get_theme_support('content_container'); |
|
127 | + $title_selector = alnp_get_theme_support('title_selector'); |
|
128 | + $navigation_container = alnp_get_theme_support('navigation_container'); |
|
129 | + $comments_container = alnp_get_theme_support('comments_container'); |
|
130 | + |
|
131 | + if ( ! empty($content_container)) update_option('auto_load_next_post_content_container', $content_container); |
|
132 | + if ( ! empty($title_selector)) update_option('auto_load_next_post_title_selector', $title_selector); |
|
133 | + if ( ! empty($navigation_container)) update_option('auto_load_next_post_navigation_container', $navigation_container); |
|
134 | + if ( ! empty($comments_container)) update_option('auto_load_next_post_comments_container', $comments_container); |
|
135 | 135 | } |
136 | 136 | } // END set_theme_selectors() |
137 | 137 | |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * @version 1.5.3 |
147 | 147 | */ |
148 | 148 | private static function set_js_in_footer() { |
149 | - if ( is_alnp_supported() ) { |
|
150 | - $load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' ); |
|
151 | - $lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' ); |
|
149 | + if (is_alnp_supported()) { |
|
150 | + $load_js_in_footer = alnp_get_theme_support('load_js_in_footer'); |
|
151 | + $lock_js_in_footer = alnp_get_theme_support('lock_js_in_footer'); |
|
152 | 152 | |
153 | - if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer ); |
|
154 | - if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer ); |
|
153 | + if ( ! empty($load_js_in_footer) && $load_js_in_footer == 'yes') update_option('auto_load_next_post_load_js_in_footer', $load_js_in_footer); |
|
154 | + if ( ! empty($lock_js_in_footer) && $lock_js_in_footer == 'yes') update_option('auto_load_next_post_lock_js_in_footer', $lock_js_in_footer); |
|
155 | 155 | } |
156 | 156 | } // END set_js_in_footer() |
157 | 157 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @static |
163 | 163 | */ |
164 | 164 | private static function update_version() { |
165 | - update_option( 'auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION ); |
|
165 | + update_option('auto_load_next_post_version', AUTO_LOAD_NEXT_POST_VERSION); |
|
166 | 166 | } // END update_version() |
167 | 167 | |
168 | 168 | /** |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | * @version 1.5.0 |
175 | 175 | */ |
176 | 176 | public static function set_install_date() { |
177 | - $install_date = get_site_option( 'auto_load_next_post_install_date' ); |
|
177 | + $install_date = get_site_option('auto_load_next_post_install_date'); |
|
178 | 178 | |
179 | 179 | // If ALNP was installed before but the install date was not converted to time then convert it. |
180 | - if ( ! empty( $install_date ) && !intval( $install_date ) ) { |
|
181 | - update_site_option( 'auto_load_next_post_install_date', strtotime( $install_date ) ); |
|
180 | + if ( ! empty($install_date) && ! intval($install_date)) { |
|
181 | + update_site_option('auto_load_next_post_install_date', strtotime($install_date)); |
|
182 | 182 | } else { |
183 | - add_site_option( 'auto_load_next_post_install_date', time() ); |
|
183 | + add_site_option('auto_load_next_post_install_date', time()); |
|
184 | 184 | } |
185 | 185 | } // END set_install_date() |
186 | 186 | |
@@ -196,15 +196,15 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public static function create_options() { |
198 | 198 | // Include settings so that we can run through defaults |
199 | - include_once( dirname( __FILE__ ) . '/admin/class-alnp-admin-settings.php' ); |
|
199 | + include_once(dirname(__FILE__).'/admin/class-alnp-admin-settings.php'); |
|
200 | 200 | |
201 | 201 | $settings = Auto_Load_Next_Post_Admin_Settings::get_settings_pages(); |
202 | 202 | |
203 | - foreach ( $settings as $section ) { |
|
204 | - foreach ( $section->get_settings() as $value ) { |
|
205 | - if ( isset( $value['default'] ) && isset( $value['id'] ) ) { |
|
206 | - $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true; |
|
207 | - add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) ); |
|
203 | + foreach ($settings as $section) { |
|
204 | + foreach ($section->get_settings() as $value) { |
|
205 | + if (isset($value['default']) && isset($value['id'])) { |
|
206 | + $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true; |
|
207 | + add_option($value['id'], $value['default'], '', ($autoload ? 'yes' : 'no')); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @version 1.5.0 |
220 | 220 | */ |
221 | 221 | public static function add_rewrite_endpoint() { |
222 | - add_rewrite_endpoint( 'alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT ); |
|
222 | + add_rewrite_endpoint('alnp', EP_PERMALINK | EP_PAGES | EP_ATTACHMENT); |
|
223 | 223 | } // END add_rewrite_endpoint() |
224 | 224 | |
225 | 225 | /** |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | * @global object $wpdb |
243 | 243 | */ |
244 | 244 | public static function reset_alnp() { |
245 | - if ( current_user_can( 'install_plugins' ) && isset( $_GET['reset-alnp'] ) && $_GET['reset-alnp'] == 'yes' ) { |
|
245 | + if (current_user_can('install_plugins') && isset($_GET['reset-alnp']) && $_GET['reset-alnp'] == 'yes') { |
|
246 | 246 | global $wpdb; |
247 | 247 | |
248 | 248 | // Make sure it is only a single site we are resetting. |
249 | - if ( ! is_multisite() ) { |
|
249 | + if ( ! is_multisite()) { |
|
250 | 250 | // Delete options |
251 | 251 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'auto_load_next_post_%'"); |
252 | 252 | |
@@ -254,26 +254,26 @@ discard block |
||
254 | 254 | $wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key LIKE 'auto_load_next_post_%'"); |
255 | 255 | |
256 | 256 | // Delete Uninstall Data - Just to double check it has been removed. |
257 | - delete_option( 'auto_load_next_post_uninstall_data' ); |
|
257 | + delete_option('auto_load_next_post_uninstall_data'); |
|
258 | 258 | |
259 | 259 | // Delete Install Date |
260 | - delete_option( 'auto_load_next_post_install_date' ); |
|
260 | + delete_option('auto_load_next_post_install_date'); |
|
261 | 261 | } |
262 | 262 | else { |
263 | 263 | // Delete Uninstall Data |
264 | - delete_site_option( 'auto_load_next_post_uninstall_data' ); |
|
264 | + delete_site_option('auto_load_next_post_uninstall_data'); |
|
265 | 265 | |
266 | 266 | // Delete Install Date |
267 | - delete_site_option( 'auto_load_next_post_install_date' ); |
|
267 | + delete_site_option('auto_load_next_post_install_date'); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | // Re-install Auto Load Next Post |
271 | 271 | self::install(); |
272 | 272 | |
273 | - wp_safe_redirect( add_query_arg( array( |
|
273 | + wp_safe_redirect(add_query_arg(array( |
|
274 | 274 | 'page' => 'auto-load-next-post-settings', |
275 | 275 | 'reset' => 'done' |
276 | - ), admin_url( 'options-general.php' ) ) ); |
|
276 | + ), admin_url('options-general.php'))); |
|
277 | 277 | exit; |
278 | 278 | } |
279 | 279 | } // END reset_alnp() |
@@ -128,10 +128,18 @@ discard block |
||
128 | 128 | $navigation_container = alnp_get_theme_support( 'navigation_container' ); |
129 | 129 | $comments_container = alnp_get_theme_support( 'comments_container' ); |
130 | 130 | |
131 | - if ( ! empty( $content_container ) ) update_option( 'auto_load_next_post_content_container', $content_container ); |
|
132 | - if ( ! empty( $title_selector ) ) update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
133 | - if ( ! empty( $navigation_container ) ) update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
134 | - if ( ! empty( $comments_container ) ) update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
131 | + if ( ! empty( $content_container ) ) { |
|
132 | + update_option( 'auto_load_next_post_content_container', $content_container ); |
|
133 | + } |
|
134 | + if ( ! empty( $title_selector ) ) { |
|
135 | + update_option( 'auto_load_next_post_title_selector', $title_selector ); |
|
136 | + } |
|
137 | + if ( ! empty( $navigation_container ) ) { |
|
138 | + update_option( 'auto_load_next_post_navigation_container', $navigation_container ); |
|
139 | + } |
|
140 | + if ( ! empty( $comments_container ) ) { |
|
141 | + update_option( 'auto_load_next_post_comments_container', $comments_container ); |
|
142 | + } |
|
135 | 143 | } |
136 | 144 | } // END set_theme_selectors() |
137 | 145 | |
@@ -150,8 +158,12 @@ discard block |
||
150 | 158 | $load_js_in_footer = alnp_get_theme_support( 'load_js_in_footer' ); |
151 | 159 | $lock_js_in_footer = alnp_get_theme_support( 'lock_js_in_footer' ); |
152 | 160 | |
153 | - if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer ); |
|
154 | - if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer ); |
|
161 | + if ( ! empty( $load_js_in_footer ) && $load_js_in_footer == 'yes' ) { |
|
162 | + update_option( 'auto_load_next_post_load_js_in_footer', $load_js_in_footer ); |
|
163 | + } |
|
164 | + if ( ! empty( $lock_js_in_footer ) && $lock_js_in_footer == 'yes' ) { |
|
165 | + update_option( 'auto_load_next_post_lock_js_in_footer', $lock_js_in_footer ); |
|
166 | + } |
|
155 | 167 | } |
156 | 168 | } // END set_js_in_footer() |
157 | 169 | |
@@ -258,8 +270,7 @@ discard block |
||
258 | 270 | |
259 | 271 | // Delete Install Date |
260 | 272 | delete_option( 'auto_load_next_post_install_date' ); |
261 | - } |
|
262 | - else { |
|
273 | + } else { |
|
263 | 274 | // Delete Uninstall Data |
264 | 275 | delete_site_option( 'auto_load_next_post_uninstall_data' ); |
265 | 276 |