@@ -11,23 +11,23 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | ?> |
| 18 | 18 | <div class="notice notice-warning auto-load-next-post-notice is-dismissible"> |
| 19 | 19 | <div class="auto-load-next-post-notice-inner"> |
| 20 | 20 | <div class="auto-load-next-post-notice-icon"> |
| 21 | - <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__( 'Auto Load Next Post WordPress Plugin', 'auto-load-next-post' ); ?>" /> |
|
| 21 | + <img src="https://ps.w.org/auto-load-next-post/assets/icon-256x256.png" alt="<?php echo esc_attr__('Auto Load Next Post WordPress Plugin', 'auto-load-next-post'); ?>" /> |
|
| 22 | 22 | </div> |
| 23 | 23 | |
| 24 | 24 | <div class="auto-load-next-post-notice-content"> |
| 25 | - <h3><?php esc_html_e( 'Upgrade Warning!', 'auto-load-next-post' ); ?></h3> |
|
| 26 | - <p><?php printf( __( 'Version %1$s1.6.0%2$s of %3$s is coming soon with new features and improvements. Before updating, please test the beta/pre-release on a staging site when it becomes available. Look forward to your feedback!', 'auto-load-next-post' ), '<strong>', '</strong>', esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ); ?></p> |
|
| 25 | + <h3><?php esc_html_e('Upgrade Warning!', 'auto-load-next-post'); ?></h3> |
|
| 26 | + <p><?php printf(__('Version %1$s1.6.0%2$s of %3$s is coming soon with new features and improvements. Before updating, please test the beta/pre-release on a staging site when it becomes available. Look forward to your feedback!', 'auto-load-next-post'), '<strong>', '</strong>', esc_html__('Auto Load Next Post', 'auto-load-next-post')); ?></p> |
|
| 27 | 27 | </div> |
| 28 | 28 | |
| 29 | 29 | <div class="auto-load-next-post-send-feedback"> |
| 30 | - <?php printf( '<a href="%1$s" class="button button-primary auto-load-next-post-feedback-button" target="_blank">%2$s</a>', esc_url( 'https://autoloadnextpost.com/2019/05/24/whats-coming-in-v1-6-0/' ), esc_html__( 'Learn More', 'auto-load-next-post' ) ); ?> |
|
| 30 | + <?php printf('<a href="%1$s" class="button button-primary auto-load-next-post-feedback-button" target="_blank">%2$s</a>', esc_url('https://autoloadnextpost.com/2019/05/24/whats-coming-in-v1-6-0/'), esc_html__('Learn More', 'auto-load-next-post')); ?> |
|
| 31 | 31 | </div> |
| 32 | 32 | </div> |
| 33 | 33 | </div> |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'Auto_Load_Next_Post_Admin_Notices' ) ) { |
|
| 18 | +if ( ! class_exists('Auto_Load_Next_Post_Admin_Notices')) { |
|
| 19 | 19 | |
| 20 | 20 | class Auto_Load_Next_Post_Admin_Notices { |
| 21 | 21 | |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | * @version 1.5.11 |
| 38 | 38 | */ |
| 39 | 39 | public function __construct() { |
| 40 | - self::$install_date = get_site_option( 'auto_load_next_post_install_date', time() ); |
|
| 40 | + self::$install_date = get_site_option('auto_load_next_post_install_date', time()); |
|
| 41 | 41 | |
| 42 | 42 | // Check WordPress enviroment. |
| 43 | - add_action( 'admin_init', array( $this, 'check_wp' ), 12 ); |
|
| 43 | + add_action('admin_init', array($this, 'check_wp'), 12); |
|
| 44 | 44 | |
| 45 | 45 | // Don't bug the user if they don't want to see any notices. |
| 46 | - add_action( 'admin_init', array( $this, 'dont_bug_me' ), 15 ); |
|
| 46 | + add_action('admin_init', array($this, 'dont_bug_me'), 15); |
|
| 47 | 47 | |
| 48 | 48 | // Display other admin notices when required. All are dismissable. |
| 49 | - add_action( 'admin_print_styles', array( $this, 'add_notices' ), 0 ); |
|
| 49 | + add_action('admin_print_styles', array($this, 'add_notices'), 0); |
|
| 50 | 50 | } // END __construct() |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | global $wp_version; |
| 63 | 63 | |
| 64 | 64 | // If the current user can not install plugins then return nothing! |
| 65 | - if ( ! current_user_can( 'install_plugins' ) ) { |
|
| 65 | + if ( ! current_user_can('install_plugins')) { |
|
| 66 | 66 | return false; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if ( ! version_compare( $wp_version, AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE, '>=' ) ) { |
|
| 70 | - add_action( 'admin_notices', array( $this, 'requirement_wp_notice' ) ); |
|
| 69 | + if ( ! version_compare($wp_version, AUTO_LOAD_NEXT_POST_WP_VERSION_REQUIRE, '>=')) { |
|
| 70 | + add_action('admin_notices', array($this, 'requirement_wp_notice')); |
|
| 71 | 71 | return false; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -87,25 +87,25 @@ discard block |
||
| 87 | 87 | $user_hidden_notice = false; |
| 88 | 88 | |
| 89 | 89 | // If the user is allowed to install plugins and requested to hide the review notice then hide it for that user. |
| 90 | - if ( ! empty( $_GET['hide_auto_load_next_post_review_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 91 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true ); |
|
| 90 | + if ( ! empty($_GET['hide_auto_load_next_post_review_notice']) && current_user_can('install_plugins')) { |
|
| 91 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true); |
|
| 92 | 92 | $user_hidden_notice = true; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // If the user is allowed to install plugins and requested to hide the welcome notice then hide it for that user. |
| 96 | - if ( ! empty( $_GET['hide_auto_load_next_post_welcome_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 97 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_welcome_notice', '1', true ); |
|
| 96 | + if ( ! empty($_GET['hide_auto_load_next_post_welcome_notice']) && current_user_can('install_plugins')) { |
|
| 97 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_welcome_notice', '1', true); |
|
| 98 | 98 | $user_hidden_notice = true; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( ! empty( $_GET['hide_auto_load_next_post_beta_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 102 | - set_transient( 'alnp_beta_notice_hidden', 'hidden', WEEK_IN_SECONDS ); |
|
| 101 | + if ( ! empty($_GET['hide_auto_load_next_post_beta_notice']) && current_user_can('install_plugins')) { |
|
| 102 | + set_transient('alnp_beta_notice_hidden', 'hidden', WEEK_IN_SECONDS); |
|
| 103 | 103 | $user_hidden_notice = true; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ( $user_hidden_notice ) { |
|
| 106 | + if ($user_hidden_notice) { |
|
| 107 | 107 | // Redirect to the plugins page. |
| 108 | - wp_safe_redirect( admin_url( 'plugins.php' ) ); |
|
| 108 | + wp_safe_redirect(admin_url('plugins.php')); |
|
| 109 | 109 | exit; |
| 110 | 110 | } |
| 111 | 111 | } // END dont_bug_me() |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | global $current_user; |
| 125 | 125 | |
| 126 | 126 | // If the current user can not install plugins then return nothing! |
| 127 | - if ( ! current_user_can( 'install_plugins' ) ) { |
|
| 127 | + if ( ! current_user_can('install_plugins')) { |
|
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -132,64 +132,64 @@ discard block |
||
| 132 | 132 | $screen_id = $screen ? $screen->id : ''; |
| 133 | 133 | |
| 134 | 134 | // Notices should only show on the main dashboard and on the plugins screen. |
| 135 | - if ( ! in_array( $screen_id, alnp_get_admin_screens() ) ) { |
|
| 135 | + if ( ! in_array($screen_id, alnp_get_admin_screens())) { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Is admin welcome notice hidden? |
| 140 | - $hide_welcome_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_welcome_notice', true ); |
|
| 140 | + $hide_welcome_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_welcome_notice', true); |
|
| 141 | 141 | |
| 142 | 142 | // Check if we need to display the welcome notice. |
| 143 | - if ( empty( $hide_welcome_notice ) ) { |
|
| 143 | + if (empty($hide_welcome_notice)) { |
|
| 144 | 144 | // If the user has just installed the plugin for the first time then welcome the user. |
| 145 | - if ( ( intval( time() - self::$install_date ) / WEEK_IN_SECONDS ) % 52 <= 2 ) { |
|
| 146 | - add_action( 'admin_notices', array( $this, 'welcome_notice' ) ); |
|
| 145 | + if ((intval(time() - self::$install_date) / WEEK_IN_SECONDS) % 52 <= 2) { |
|
| 146 | + add_action('admin_notices', array($this, 'welcome_notice')); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Is admin review notice hidden? |
| 151 | - $hide_review_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', true ); |
|
| 151 | + $hide_review_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', true); |
|
| 152 | 152 | |
| 153 | 153 | // Check if we need to display the review plugin notice. |
| 154 | - if ( empty( $hide_review_notice ) ) { |
|
| 154 | + if (empty($hide_review_notice)) { |
|
| 155 | 155 | // If it has been a week or more since activating the plugin then display the review notice. |
| 156 | - if ( ( intval( time() - self::$install_date ) ) > WEEK_IN_SECONDS ) { |
|
| 157 | - add_action( 'admin_notices', array( $this, 'plugin_review_notice' ) ); |
|
| 156 | + if ((intval(time() - self::$install_date)) > WEEK_IN_SECONDS) { |
|
| 157 | + add_action('admin_notices', array($this, 'plugin_review_notice')); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // Is this version of Auto Load Next Post a beta release? |
| 162 | - if ( is_alnp_beta() && empty( get_transient( 'alnp_beta_notice_hidden' ) ) ) { |
|
| 163 | - add_action( 'admin_notices', array( $this, 'beta_notice' ) ); |
|
| 162 | + if (is_alnp_beta() && empty(get_transient('alnp_beta_notice_hidden'))) { |
|
| 163 | + add_action('admin_notices', array($this, 'beta_notice')); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $template = get_option( 'template' ); |
|
| 166 | + $template = get_option('template'); |
|
| 167 | 167 | |
| 168 | 168 | // Checks if the theme supports Auto Load Next Post and not provided via a plugin. |
| 169 | - if ( is_alnp_supported() ) { |
|
| 170 | - $plugin_supported = alnp_get_theme_support( 'plugin_support' ); |
|
| 169 | + if (is_alnp_supported()) { |
|
| 170 | + $plugin_supported = alnp_get_theme_support('plugin_support'); |
|
| 171 | 171 | |
| 172 | 172 | // Return if theme is supported via plugin. |
| 173 | - if ( ! empty( $plugin_supported ) && $plugin_supported == 'yes' ) { |
|
| 174 | - update_option( 'auto_load_next_post_theme_supported', $template ); |
|
| 173 | + if ( ! empty($plugin_supported) && $plugin_supported == 'yes') { |
|
| 174 | + update_option('auto_load_next_post_theme_supported', $template); |
|
| 175 | 175 | return false; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // If supported theme does not match active theme then show notice. |
| 179 | - if ( get_option( 'auto_load_next_post_theme_supported' ) !== $template ) { |
|
| 180 | - add_action( 'admin_notices', array( $this, 'theme_ready_notice' ) ); |
|
| 181 | - update_option( 'auto_load_next_post_theme_supported', $template ); |
|
| 179 | + if (get_option('auto_load_next_post_theme_supported') !== $template) { |
|
| 180 | + add_action('admin_notices', array($this, 'theme_ready_notice')); |
|
| 181 | + update_option('auto_load_next_post_theme_supported', $template); |
|
| 182 | 182 | } |
| 183 | 183 | } else { |
| 184 | 184 | // If theme not supported then delete option. |
| 185 | - delete_option( 'auto_load_next_post_theme_supported' ); |
|
| 185 | + delete_option('auto_load_next_post_theme_supported'); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | // Upgrade warning notice that will disappear once the new release is installed. |
| 189 | 189 | $upgrade_version = '1.6.0'; |
| 190 | 190 | |
| 191 | - if ( version_compare( AUTO_LOAD_NEXT_POST_VERSION, $upgrade_version, '<' ) ) { |
|
| 192 | - add_action( 'admin_notices', array( $this, 'upgrade_warning' ) ); |
|
| 191 | + if (version_compare(AUTO_LOAD_NEXT_POST_VERSION, $upgrade_version, '<')) { |
|
| 192 | + add_action('admin_notices', array($this, 'upgrade_warning')); |
|
| 193 | 193 | } |
| 194 | 194 | } // END add_notices() |
| 195 | 195 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @version 1.5.13 |
| 203 | 203 | */ |
| 204 | 204 | public function upgrade_warning() { |
| 205 | - include_once( dirname( __FILE__ ) . '/views/html-notice-upgrade-warning.php' ); |
|
| 205 | + include_once(dirname(__FILE__).'/views/html-notice-upgrade-warning.php'); |
|
| 206 | 206 | } // END upgrade_warning() |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @since 1.4.3 |
| 213 | 213 | */ |
| 214 | 214 | public function requirement_wp_notice() { |
| 215 | - include( dirname( __FILE__ ) . '/views/html-notice-requirement-wp.php' ); |
|
| 215 | + include(dirname(__FILE__).'/views/html-notice-requirement-wp.php'); |
|
| 216 | 216 | } // END requirement_wp_notice() |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @since 1.5.0 |
| 223 | 223 | */ |
| 224 | 224 | public function theme_ready_notice() { |
| 225 | - include( dirname( __FILE__ ) . '/views/html-notice-theme-ready.php' ); |
|
| 225 | + include(dirname(__FILE__).'/views/html-notice-theme-ready.php'); |
|
| 226 | 226 | } // END theme_ready_notice() |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @since 1.5.0 |
| 233 | 233 | */ |
| 234 | 234 | public function welcome_notice() { |
| 235 | - include( dirname( __FILE__ ) . '/views/html-notice-welcome.php' ); |
|
| 235 | + include(dirname(__FILE__).'/views/html-notice-welcome.php'); |
|
| 236 | 236 | } // END welcome_notice() |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @since 1.5.0 |
| 243 | 243 | */ |
| 244 | 244 | public function beta_notice() { |
| 245 | - include( dirname( __FILE__ ) . '/views/html-notice-trying-beta.php' ); |
|
| 245 | + include(dirname(__FILE__).'/views/html-notice-trying-beta.php'); |
|
| 246 | 246 | } // END beta_notice() |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | public function plugin_review_notice() { |
| 256 | 256 | $install_date = self::$install_date; |
| 257 | 257 | |
| 258 | - include( dirname( __FILE__ ) . '/views/html-notice-please-review.php' ); |
|
| 258 | + include(dirname(__FILE__).'/views/html-notice-please-review.php'); |
|
| 259 | 259 | } // END plugin_review_notice() |
| 260 | 260 | |
| 261 | 261 | } // END class. |