@@ -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( 'ALNP_Admin_Notices' ) ) { |
|
| 18 | +if ( ! class_exists('ALNP_Admin_Notices')) { |
|
| 19 | 19 | |
| 20 | 20 | class ALNP_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 | |
@@ -88,32 +88,32 @@ discard block |
||
| 88 | 88 | $user_hidden_notice = false; |
| 89 | 89 | |
| 90 | 90 | // If the user is allowed to install plugins and requested to hide the review notice then hide it for that user. |
| 91 | - if ( ! empty( $_GET['hide_auto_load_next_post_review_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 92 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true ); |
|
| 91 | + if ( ! empty($_GET['hide_auto_load_next_post_review_notice']) && current_user_can('install_plugins')) { |
|
| 92 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', '1', true); |
|
| 93 | 93 | $user_hidden_notice = true; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | // If the user is allowed to install plugins and requested to hide the upgrade notice then hide it for that user. |
| 97 | - if ( ! empty( $_GET['hide_auto_load_next_post_upgrade_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 98 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_upgrade_notice', '1', true ); |
|
| 97 | + if ( ! empty($_GET['hide_auto_load_next_post_upgrade_notice']) && current_user_can('install_plugins')) { |
|
| 98 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_upgrade_notice', '1', true); |
|
| 99 | 99 | $user_hidden_notice = true; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // If the user is allowed to install plugins and requested to hide the setup notice then hide it for that user. |
| 103 | - if ( ! empty( $_GET['hide_auto_load_next_post_setup_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 104 | - add_user_meta( $current_user->ID, 'auto_load_next_post_hide_setup_notice', '1', true ); |
|
| 103 | + if ( ! empty($_GET['hide_auto_load_next_post_setup_notice']) && current_user_can('install_plugins')) { |
|
| 104 | + add_user_meta($current_user->ID, 'auto_load_next_post_hide_setup_notice', '1', true); |
|
| 105 | 105 | $user_hidden_notice = true; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // If the user is allowed to install plugins and requested to hide the beta notice then hide it for that user. |
| 109 | - if ( ! empty( $_GET['hide_auto_load_next_post_beta_notice'] ) && current_user_can( 'install_plugins' ) ) { |
|
| 110 | - set_transient( 'alnp_beta_notice_hidden', 'hidden', WEEK_IN_SECONDS ); |
|
| 109 | + if ( ! empty($_GET['hide_auto_load_next_post_beta_notice']) && current_user_can('install_plugins')) { |
|
| 110 | + set_transient('alnp_beta_notice_hidden', 'hidden', WEEK_IN_SECONDS); |
|
| 111 | 111 | $user_hidden_notice = true; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ( $user_hidden_notice ) { |
|
| 114 | + if ($user_hidden_notice) { |
|
| 115 | 115 | // Redirect to the plugins page. |
| 116 | - wp_safe_redirect( admin_url( 'plugins.php' ) ); |
|
| 116 | + wp_safe_redirect(admin_url('plugins.php')); |
|
| 117 | 117 | exit; |
| 118 | 118 | } |
| 119 | 119 | } // END dont_bug_me() |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | global $current_user; |
| 133 | 133 | |
| 134 | 134 | // If the current user can not install plugins then return nothing! |
| 135 | - if ( ! current_user_can( 'install_plugins' ) ) { |
|
| 135 | + if ( ! current_user_can('install_plugins')) { |
|
| 136 | 136 | return false; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -140,64 +140,64 @@ discard block |
||
| 140 | 140 | $screen_id = $screen ? $screen->id : ''; |
| 141 | 141 | |
| 142 | 142 | // Notices should only show on the main dashboard and on the plugins screen. |
| 143 | - if ( ! in_array( $screen_id, alnp_get_admin_screens() ) ) { |
|
| 143 | + if ( ! in_array($screen_id, alnp_get_admin_screens())) { |
|
| 144 | 144 | return false; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Is admin review notice hidden? |
| 148 | - $hide_review_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_review_notice', true ); |
|
| 148 | + $hide_review_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_review_notice', true); |
|
| 149 | 149 | |
| 150 | 150 | // Check if we need to display the review plugin notice. |
| 151 | - if ( empty( $hide_review_notice ) ) { |
|
| 151 | + if (empty($hide_review_notice)) { |
|
| 152 | 152 | // If it has been a week or more since activating the plugin then display the review notice. |
| 153 | - if ( ( intval( time() - self::$install_date ) ) > WEEK_IN_SECONDS ) { |
|
| 154 | - add_action( 'admin_notices', array( $this, 'plugin_review_notice' ) ); |
|
| 153 | + if ((intval(time() - self::$install_date)) > WEEK_IN_SECONDS) { |
|
| 154 | + add_action('admin_notices', array($this, 'plugin_review_notice')); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Is admin setup wizard notice hidden? |
| 159 | - $hide_setup_wizard_notice = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_setup_notice', true ); |
|
| 159 | + $hide_setup_wizard_notice = get_user_meta($current_user->ID, 'auto_load_next_post_hide_setup_notice', true); |
|
| 160 | 160 | |
| 161 | 161 | // Check if we need to show setup wizard notice. |
| 162 | - if ( empty( $hide_setup_wizard_notice ) && ! is_alnp_supported() ) { |
|
| 162 | + if (empty($hide_setup_wizard_notice) && ! is_alnp_supported()) { |
|
| 163 | 163 | // Notify users of the Setup Wizard. |
| 164 | - add_action( 'admin_notices', array( $this, 'setup_wizard_notice' ) ); |
|
| 164 | + add_action('admin_notices', array($this, 'setup_wizard_notice')); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // Is this version of Auto Load Next Post a beta/pre-release? |
| 168 | - if ( is_alnp_beta() && empty( get_transient( 'alnp_beta_notice_hidden' ) ) ) { |
|
| 169 | - add_action( 'admin_notices', array( $this, 'beta_notice' ) ); |
|
| 168 | + if (is_alnp_beta() && empty(get_transient('alnp_beta_notice_hidden'))) { |
|
| 169 | + add_action('admin_notices', array($this, 'beta_notice')); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $template = get_option( 'template' ); |
|
| 172 | + $template = get_option('template'); |
|
| 173 | 173 | |
| 174 | 174 | // Checks if the theme supports Auto Load Next Post and not provided via a plugin. |
| 175 | - if ( is_alnp_supported() ) { |
|
| 176 | - $plugin_supported = alnp_get_theme_support( 'plugin_support' ); |
|
| 175 | + if (is_alnp_supported()) { |
|
| 176 | + $plugin_supported = alnp_get_theme_support('plugin_support'); |
|
| 177 | 177 | |
| 178 | 178 | // Return if theme is supported via plugin. |
| 179 | - if ( ! empty( $plugin_supported ) && $plugin_supported == 'yes' ) { |
|
| 180 | - update_option( 'auto_load_next_post_theme_supported', $template ); |
|
| 179 | + if ( ! empty($plugin_supported) && $plugin_supported == 'yes') { |
|
| 180 | + update_option('auto_load_next_post_theme_supported', $template); |
|
| 181 | 181 | return false; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // If supported theme does not match active theme then show notice. |
| 185 | - if ( get_option( 'auto_load_next_post_theme_supported' ) !== $template ) { |
|
| 186 | - add_action( 'admin_notices', array( $this, 'theme_ready_notice' ) ); |
|
| 187 | - update_option( 'auto_load_next_post_theme_supported', $template ); |
|
| 185 | + if (get_option('auto_load_next_post_theme_supported') !== $template) { |
|
| 186 | + add_action('admin_notices', array($this, 'theme_ready_notice')); |
|
| 187 | + update_option('auto_load_next_post_theme_supported', $template); |
|
| 188 | 188 | } |
| 189 | 189 | } else { |
| 190 | 190 | // If theme not supported then delete option. |
| 191 | - delete_option( 'auto_load_next_post_theme_supported' ); |
|
| 191 | + delete_option('auto_load_next_post_theme_supported'); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // Upgrade warning notice that will disappear once the new release is installed. |
| 195 | 195 | $upgrade_version = '1.6.0'; |
| 196 | 196 | |
| 197 | - $user_hidden_upgrade = get_user_meta( $current_user->ID, 'auto_load_next_post_hide_upgrade_notice', '1' ); |
|
| 197 | + $user_hidden_upgrade = get_user_meta($current_user->ID, 'auto_load_next_post_hide_upgrade_notice', '1'); |
|
| 198 | 198 | |
| 199 | - if ( ! is_alnp_beta() && version_compare( AUTO_LOAD_NEXT_POST_VERSION, $upgrade_version, '<' ) && empty( $user_hidden_upgrade ) ) { |
|
| 200 | - add_action( 'admin_notices', array( $this, 'upgrade_warning' ) ); |
|
| 199 | + if ( ! is_alnp_beta() && version_compare(AUTO_LOAD_NEXT_POST_VERSION, $upgrade_version, '<') && empty($user_hidden_upgrade)) { |
|
| 200 | + add_action('admin_notices', array($this, 'upgrade_warning')); |
|
| 201 | 201 | } |
| 202 | 202 | } // END add_notices() |
| 203 | 203 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @version 1.5.13 |
| 211 | 211 | */ |
| 212 | 212 | public function upgrade_warning() { |
| 213 | - include_once( dirname( __FILE__ ) . '/views/html-notice-upgrade-warning.php' ); |
|
| 213 | + include_once(dirname(__FILE__).'/views/html-notice-upgrade-warning.php'); |
|
| 214 | 214 | } // END upgrade_warning() |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @since 1.4.3 |
| 221 | 221 | */ |
| 222 | 222 | public function requirement_wp_notice() { |
| 223 | - include( dirname( __FILE__ ) . '/views/html-notice-requirement-wp.php' ); |
|
| 223 | + include(dirname(__FILE__).'/views/html-notice-requirement-wp.php'); |
|
| 224 | 224 | } // END requirement_wp_notice() |
| 225 | 225 | |
| 226 | 226 | /** |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @since 1.5.0 |
| 231 | 231 | */ |
| 232 | 232 | public function theme_ready_notice() { |
| 233 | - include( dirname( __FILE__ ) . '/views/html-notice-theme-ready.php' ); |
|
| 233 | + include(dirname(__FILE__).'/views/html-notice-theme-ready.php'); |
|
| 234 | 234 | } // END theme_ready_notice() |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @since 1.6.0 |
| 241 | 241 | */ |
| 242 | 242 | public function setup_wizard_notice() { |
| 243 | - include( dirname( __FILE__ ) . '/views/html-notice-setup-wizard.php' ); |
|
| 243 | + include(dirname(__FILE__).'/views/html-notice-setup-wizard.php'); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * @since 1.5.0 |
| 251 | 251 | */ |
| 252 | 252 | public function beta_notice() { |
| 253 | - include( dirname( __FILE__ ) . '/views/html-notice-trying-beta.php' ); |
|
| 253 | + include(dirname(__FILE__).'/views/html-notice-trying-beta.php'); |
|
| 254 | 254 | } // END beta_notice() |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | public function plugin_review_notice() { |
| 264 | 264 | $install_date = self::$install_date; |
| 265 | 265 | |
| 266 | - include( dirname( __FILE__ ) . '/views/html-notice-please-review.php' ); |
|
| 266 | + include(dirname(__FILE__).'/views/html-notice-please-review.php'); |
|
| 267 | 267 | } // END plugin_review_notice() |
| 268 | 268 | |
| 269 | 269 | } // END class. |
@@ -12,11 +12,11 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if ( ! class_exists( 'ALNP_Privacy' ) ) { |
|
| 19 | +if ( ! class_exists('ALNP_Privacy')) { |
|
| 20 | 20 | |
| 21 | 21 | class ALNP_Privacy { |
| 22 | 22 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @access public |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'admin_init', array( $this, 'add_privacy_policy_guide_content' ) ); |
|
| 29 | + add_action('admin_init', array($this, 'add_privacy_policy_guide_content')); |
|
| 30 | 30 | } // END __construct() |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | * @static |
| 37 | 37 | */ |
| 38 | 38 | public static function add_privacy_policy_guide_content() { |
| 39 | - if ( function_exists( 'wp_add_privacy_policy_content' ) ) { |
|
| 40 | - wp_add_privacy_policy_content( esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ), self::get_privacy_policy_guide_message() ); |
|
| 39 | + if (function_exists('wp_add_privacy_policy_content')) { |
|
| 40 | + wp_add_privacy_policy_content(esc_html__('Auto Load Next Post', 'auto-load-next-post'), self::get_privacy_policy_guide_message()); |
|
| 41 | 41 | } |
| 42 | 42 | } // END add_privacy_policy_guide_content() |
| 43 | 43 | |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | protected static function get_privacy_policy_guide_message() { |
| 52 | 52 | $content = ' |
| 53 | 53 | <div class="wp-suggested-text">' . |
| 54 | - '<p class="privacy-policy-tutorial">' . |
|
| 55 | - 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' ) ) . |
|
| 56 | - '</p>' . |
|
| 54 | + '<p class="privacy-policy-tutorial">'. |
|
| 55 | + 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')). |
|
| 56 | + '</p>'. |
|
| 57 | 57 | '</div>'; |
| 58 | 58 | |
| 59 | 59 | return $content; |