notices.php
222 lines
| 1 | <?php |
| 2 | // Exit if accessed directly. |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | // phpcs:disable Generic.Arrays.DisallowLongArraySyntax.Found |
| 8 | if ( ! function_exists( 'aioseo_php_notice' ) ) { |
| 9 | /** |
| 10 | * Displays a notice to users about unsupported PHP versions. |
| 11 | * |
| 12 | * @since 4.0.0 |
| 13 | */ |
| 14 | function aioseo_php_notice() { |
| 15 | if ( ! current_user_can( 'administrator' ) ) { |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | $medium = false !== strpos( AIOSEO_PHP_VERSION_DIR, 'pro' ) ? 'proplugin' : 'liteplugin'; |
| 20 | ?> |
| 21 | <div class="notice notice-error"> |
| 22 | <p> |
| 23 | <?php |
| 24 | echo wp_kses( |
| 25 | sprintf( |
| 26 | // Translators: 1 - Opening HTML bold tag, 2 - Closing HTML bold tag, 3 - Opening HTML link tag, 4 - Closing HTML link tag. |
| 27 | __( 'Your site is running an %1$sinsecure version%2$s of PHP that is no longer supported. Please contact your web hosting provider to update your PHP version or switch to a %3$srecommended WordPress hosting company%4$s.', 'all-in-one-seo-pack' ), // phpcs:ignore Generic.Files.LineLength.MaxExceeded |
| 28 | '<strong>', |
| 29 | '</strong>', |
| 30 | '<a href="https://www.wpbeginner.com/wordpress-hosting/" target="_blank" rel="noopener noreferrer">', |
| 31 | '</a>' |
| 32 | ), |
| 33 | array( |
| 34 | 'a' => array( |
| 35 | 'href' => array(), |
| 36 | 'target' => array(), |
| 37 | 'rel' => array(), |
| 38 | ), |
| 39 | 'strong' => array(), |
| 40 | ) |
| 41 | ); |
| 42 | ?> |
| 43 | <br><br> |
| 44 | <?php |
| 45 | echo wp_kses( |
| 46 | sprintf( |
| 47 | // Translators: 1 - Opening HTML bold tag, 2 - Closing HTML bold tag, 3 - The short plugin name ("AIOSEO"), 4 - Opening HTML link tag, 5 - Closing HTML link tag. |
| 48 | __( '%1$sNote:%2$s %3$s plugin is disabled on your site until you fix the issue. %4$sRead more for additional information.%5$s', 'all-in-one-seo-pack' ), |
| 49 | '<strong>', |
| 50 | '</strong>', |
| 51 | 'AIOSEO', |
| 52 | '<a href="https://aioseo.com/docs/supported-php-version/?utm_source=WordPress&utm_medium=' . $medium . '&utm_campaign=outdated-php-notice" target="_blank" rel="noopener noreferrer">', // phpcs:ignore Generic.Files.LineLength.MaxExceeded |
| 53 | '</a>' |
| 54 | ), |
| 55 | array( |
| 56 | 'a' => array( |
| 57 | 'href' => array(), |
| 58 | 'target' => array(), |
| 59 | 'rel' => array(), |
| 60 | ), |
| 61 | 'strong' => array(), |
| 62 | ) |
| 63 | ); |
| 64 | ?> |
| 65 | </p> |
| 66 | </div> |
| 67 | |
| 68 | <?php |
| 69 | // In case this is on plugin activation. |
| 70 | if ( isset( $_GET['activate'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended |
| 71 | unset( $_GET['activate'] ); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | if ( ! function_exists( 'aioseo_php_notice_deprecated' ) ) { |
| 77 | /** |
| 78 | * Displays a notice to users about deprecated PHP versions. |
| 79 | * |
| 80 | * @since 4.0.0 |
| 81 | */ |
| 82 | function aioseo_php_notice_deprecated() { |
| 83 | if ( ! current_user_can( 'administrator' ) ) { |
| 84 | return; |
| 85 | } |
| 86 | |
| 87 | $medium = false !== strpos( AIOSEO_PHP_VERSION_DIR, 'pro' ) ? 'proplugin' : 'liteplugin'; |
| 88 | ?> |
| 89 | <div class="notice notice-error"> |
| 90 | <p> |
| 91 | <?php |
| 92 | echo wp_kses( |
| 93 | sprintf( |
| 94 | // Translators: 1 - Opening HTML bold tag, 2 - Closing HTML bold tag, 3 - Opening HTML link tag, 4 - Closing HTML link tag. |
| 95 | __( 'Your site is running an %1$soutdated version%2$s of PHP that is no longer supported and may cause issues with %3$s. Please contact your web hosting provider to update your PHP version or switch to a %4$srecommended WordPress hosting company%5$s.', 'all-in-one-seo-pack' ), // phpcs:ignore Generic.Files.LineLength.MaxExceeded |
| 96 | '<strong>', |
| 97 | '</strong>', |
| 98 | '<strong>AIOSEO</strong>', |
| 99 | '<a href="https://www.wpbeginner.com/wordpress-hosting/" target="_blank" rel="noopener noreferrer">', |
| 100 | '</a>' |
| 101 | ), |
| 102 | array( |
| 103 | 'a' => array( |
| 104 | 'href' => array(), |
| 105 | 'target' => array(), |
| 106 | 'rel' => array(), |
| 107 | ), |
| 108 | 'strong' => array(), |
| 109 | ) |
| 110 | ); |
| 111 | ?> |
| 112 | <br><br> |
| 113 | <?php |
| 114 | echo wp_kses( |
| 115 | sprintf( |
| 116 | // phpcs:ignore Generic.Files.LineLength.MaxExceeded |
| 117 | // Translators: 1 - Opening HTML bold tag, 2 - Closing HTML bold tag, 3 - The PHP version, 4 - The current year, 5 - The short plugin name ("AIOSEO"), 6 - Opening HTML link tag, 7 - Closing HTML link tag. |
| 118 | __( '%1$sNote:%2$s Support for PHP %3$s will be discontinued in %4$s. After this, if no further action is taken, %5$s will be disabled. %6$sRead more for additional information.%7$s', 'all-in-one-seo-pack' ), // phpcs:ignore Generic.Files.LineLength.MaxExceeded |
| 119 | '<strong>', |
| 120 | '</strong>', |
| 121 | PHP_VERSION, |
| 122 | gmdate( 'Y' ), |
| 123 | 'AIOSEO', |
| 124 | '<a href="https://aioseo.com/docs/supported-php-version/?utm_source=WordPress&utm_medium=' . $medium . '&utm_campaign=outdated-php-notice" target="_blank" rel="noopener noreferrer">', // phpcs:ignore Generic.Files.LineLength.MaxExceeded |
| 125 | '</a>' |
| 126 | ), |
| 127 | array( |
| 128 | 'a' => array( |
| 129 | 'href' => array(), |
| 130 | 'target' => array(), |
| 131 | 'rel' => array(), |
| 132 | ), |
| 133 | 'strong' => array(), |
| 134 | ) |
| 135 | ); |
| 136 | ?> |
| 137 | </p> |
| 138 | </div> |
| 139 | |
| 140 | <?php |
| 141 | // In case this is on plugin activation. |
| 142 | if ( isset( $_GET['activate'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended |
| 143 | unset( $_GET['activate'] ); |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | if ( ! function_exists( 'aioseo_wordpress_notice' ) ) { |
| 149 | /** |
| 150 | * Displays a notice to users about unsupported WordPress versions. |
| 151 | * |
| 152 | * @since 4.1.2 |
| 153 | */ |
| 154 | function aioseo_wordpress_notice() { |
| 155 | if ( ! current_user_can( 'administrator' ) ) { |
| 156 | return; |
| 157 | } |
| 158 | |
| 159 | ?> |
| 160 | <div class="notice notice-error"> |
| 161 | <p> |
| 162 | <?php |
| 163 | echo wp_kses( |
| 164 | sprintf( |
| 165 | // Translators: 1 - Opening HTML bold tag, 2 - Closing HTML bold tag, 3 - The plugin name ("All in One SEO"). |
| 166 | __( 'Your site is running an %1$sinsecure version%2$s of WordPress that is no longer supported. Please update your site to the latest version of WordPress in order to continue using %3$s.', 'all-in-one-seo-pack' ), // phpcs:ignore Generic.Files.LineLength.MaxExceeded |
| 167 | '<strong>', |
| 168 | '</strong>', |
| 169 | 'All in One SEO' |
| 170 | ), |
| 171 | array( |
| 172 | 'strong' => array(), |
| 173 | ) |
| 174 | ); |
| 175 | ?> |
| 176 | </p> |
| 177 | </div> |
| 178 | |
| 179 | <?php |
| 180 | // In case this is on plugin activation. |
| 181 | if ( isset( $_GET['activate'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended |
| 182 | unset( $_GET['activate'] ); |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | if ( ! function_exists( 'aioseo_lite_notice' ) ) { |
| 188 | /** |
| 189 | * Display the notice after deactivation when Pro is still active |
| 190 | * and user wanted to activate the Lite version of the plugin. |
| 191 | * |
| 192 | * @since 4.0.0 |
| 193 | */ |
| 194 | function aioseo_lite_notice() { |
| 195 | |
| 196 | global $aioseoLiteJustActivated, $aioseoLiteJustDeactivated; |
| 197 | |
| 198 | if ( |
| 199 | empty( $aioseoLiteJustActivated ) || |
| 200 | empty( $aioseoLiteJustDeactivated ) |
| 201 | ) { |
| 202 | return; |
| 203 | } |
| 204 | |
| 205 | // Currently tried to activate Lite with Pro still active, so display the message. |
| 206 | printf( |
| 207 | '<div class="notice notice-warning"> |
| 208 | <p>%1$s</p> |
| 209 | <p>%2$s</p> |
| 210 | </div>', |
| 211 | esc_html__( 'Heads up!', 'all-in-one-seo-pack' ), |
| 212 | // Translators: 1 - "AIOSEO Pro", 2 - "AIOSEO Lite". |
| 213 | sprintf( esc_html__( 'Your site already has %1$s activated. If you want to switch to %2$s, please first go to Plugins > Installed Plugins and deactivate %1$s. Then, you can activate %2$s.', 'all-in-one-seo-pack' ), 'AIOSEO Pro', 'AIOSEO Lite' ) // phpcs:ignore Generic.Files.LineLength.MaxExceeded |
| 214 | ); |
| 215 | |
| 216 | if ( isset( $_GET['activate'] ) ) { // phpcs:ignore HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended |
| 217 | unset( $_GET['activate'] ); |
| 218 | } |
| 219 | |
| 220 | unset( $aioseoLiteJustActivated, $aioseoLiteJustDeactivated ); |
| 221 | } |
| 222 | } |