| @@ -1,0 +1,412 @@ | ||
| 1 | +<?php | |
| 2 | +/* | |
| 3 | + * License: GPLv3 | |
| 4 | + * License URI: https://www.gnu.org/licenses/gpl.txt | |
| 5 | + * Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/) | |
| 6 | + */ | |
| 7 | + | |
| 8 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 9 | + | |
| 10 | + die( 'These aren\'t the droids you\'re looking for.' ); | |
| 11 | +} | |
| 12 | + | |
| 13 | +if ( ! defined( 'WPSSO_PLUGINDIR' ) ) { | |
| 14 | + | |
| 15 | + die( 'Do. Or do not. There is no try.' ); | |
| 16 | +} | |
| 17 | + | |
| 18 | +if ( ! class_exists( 'WpssoConflict' ) ) { | |
| 19 | + | |
| 20 | + class WpssoConflict { | |
| 21 | + | |
| 22 | + private $p; // Wpsso class object. | |
| 23 | + private $seo = null; // WpssoConflictSeo class object. | |
| 24 | + | |
| 25 | + /* | |
| 26 | + * Instantiated by Wpsso->set_objects() when is_admin() is true. | |
| 27 | + */ | |
| 28 | + public function __construct( &$plugin ) { | |
| 29 | + | |
| 30 | + $this->p =& $plugin; | |
| 31 | + | |
| 32 | + if ( $this->p->debug->enabled ) { | |
| 33 | + | |
| 34 | + $this->p->debug->mark(); | |
| 35 | + } | |
| 36 | + | |
| 37 | + $doing_ajax = SucomUtilWP::doing_ajax(); | |
| 38 | + | |
| 39 | + if ( ! $doing_ajax ) { | |
| 40 | + | |
| 41 | + if ( ! SucomUtilWP::doing_block_editor() ) { | |
| 42 | + | |
| 43 | + add_action( 'admin_head', array( $this, 'conflict_checks' ), -1000 ); | |
| 44 | + } | |
| 45 | + } | |
| 46 | + } | |
| 47 | + | |
| 48 | + public function conflict_checks() { | |
| 49 | + | |
| 50 | + $this->conflict_check_addon(); | |
| 51 | + $this->conflict_check_db(); | |
| 52 | + $this->conflict_check_php(); | |
| 53 | + $this->conflict_check_vc(); | |
| 54 | + $this->conflict_check_wp(); | |
| 55 | + | |
| 56 | + require_once WPSSO_PLUGINDIR . 'lib/conflict-seo.php'; | |
| 57 | + | |
| 58 | + $this->seo = new WpssoConflictSeo( $this->p ); | |
| 59 | + | |
| 60 | + $this->seo->conflict_checks(); | |
| 61 | + } | |
| 62 | + | |
| 63 | + private function conflict_check_addon() { | |
| 64 | + | |
| 65 | + if ( ! empty( $this->p->avail[ 'p_ext' ][ 'ipm' ] ) ) { | |
| 66 | + | |
| 67 | + $pkg_info = $this->p->util->get_pkg_info(); // Uses a local cache. | |
| 68 | + $plugins_url = is_multisite() ? network_admin_url( 'plugins.php', null ) : get_admin_url( $blog_id = null, 'plugins.php' ); | |
| 69 | + $plugins_url = add_query_arg( array( 's' => 'wpsso-inherit-parent-meta' ), $plugins_url ); | |
| 70 | + $addon_name = __( 'WPSSO Inherit Parent Metadata', 'plugin name', 'wpsso' ); | |
| 71 | + | |
| 72 | + $notice_msg = sprintf( __( 'The %1$s add-on is deprecated.', 'wpsso' ), $addon_name ) . ' '; | |
| 73 | + | |
| 74 | + $notice_msg .= sprintf( __( 'All features of the %1$s add-on were integrated into the %2$s plugin.', 'wpsso' ), | |
| 75 | + $addon_name, $pkg_info[ 'wpsso' ][ 'name' ] ) . ' '; | |
| 76 | + | |
| 77 | + $notice_msg .= sprintf( __( '<a href="%1$s">Please deactivate and delete the %2$s add-on</a>.', 'wpsso' ), | |
| 78 | + $plugins_url, $addon_name ) . ' '; | |
| 79 | + | |
| 80 | + $notice_key = 'deactivate-wpsso-inherit-parent-meta'; | |
| 81 | + | |
| 82 | + $this->p->notice->err( $notice_msg, null, $notice_key ); | |
| 83 | + } | |
| 84 | + | |
| 85 | + if ( ! empty( $this->p->avail[ 'p_ext' ][ 'json' ] ) ) { | |
| 86 | + | |
| 87 | + $pkg_info = $this->p->util->get_pkg_info(); // Uses a local cache. | |
| 88 | + $plugins_url = is_multisite() ? network_admin_url( 'plugins.php', null ) : get_admin_url( $blog_id = null, 'plugins.php' ); | |
| 89 | + $plugins_url = add_query_arg( array( 's' => 'wpsso-schema-json-ld' ), $plugins_url ); | |
| 90 | + $addon_name = __( 'WPSSO Schema JSON-LD Markup', 'plugin name', 'wpsso' ); | |
| 91 | + | |
| 92 | + if ( ! empty( $pkg_info[ 'wpssojson' ][ 'pp' ] ) && empty( $pkg_info[ 'wpsso' ][ 'pp' ] ) ) { | |
| 93 | + | |
| 94 | + $notice_msg = sprintf( __( 'The %1$s add-on is deprecated since October 2021.', 'wpsso' ), $addon_name ) . ' '; | |
| 95 | + | |
| 96 | + $notice_msg .= sprintf( __( 'All features of the %1$s add-on were integrated into the %2$s and %3$s plugins at that time.', 'wpsso' ), | |
| 97 | + $addon_name, $pkg_info[ 'wpsso' ][ 'name_std' ], $pkg_info[ 'wpsso' ][ 'name_pro' ] ) . ' '; | |
| 98 | + | |
| 99 | + $notice_msg .= sprintf( __( 'The add-on may continue to function as intended, but is no longer actively maintained or tested for compatibility with the %1$s plugin.', 'wpsso' ), $pkg_info[ 'wpsso' ][ 'name' ] ) . ' '; | |
| 100 | + | |
| 101 | + $notice_msg .= sprintf( __( '<a href="%1$s">We suggest deactivating the %2$s add-on at your earliest convenience</a>.', 'wpsso' ), | |
| 102 | + $plugins_url, $addon_name ) . ' '; | |
| 103 | + | |
| 104 | + $notice_key = 'deactivate-wpsso-schema-json-ld-pro'; | |
| 105 | + | |
| 106 | + $this->p->notice->warn( $notice_msg, null, $notice_key, 3 * MONTH_IN_SECONDS ); | |
| 107 | + | |
| 108 | + } else { | |
| 109 | + | |
| 110 | + $notice_msg = sprintf( __( 'The %1$s add-on is deprecated.', 'wpsso' ), $addon_name ) . ' '; | |
| 111 | + | |
| 112 | + $notice_msg .= sprintf( __( 'All features of the %1$s add-on were integrated into the %2$s plugin.', 'wpsso' ), | |
| 113 | + $addon_name, $pkg_info[ 'wpsso' ][ 'name' ] ) . ' '; | |
| 114 | + | |
| 115 | + $notice_msg .= sprintf( __( '<a href="%1$s">Please deactivate and delete the %2$s add-on</a>.', 'wpsso' ), | |
| 116 | + $plugins_url, $addon_name ) . ' '; | |
| 117 | + | |
| 118 | + $notice_key = 'deactivate-wpsso-schema-json-ld'; | |
| 119 | + | |
| 120 | + $this->p->notice->err( $notice_msg, null, $notice_key ); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + | |
| 124 | + if ( ! empty( $this->p->avail[ 'p_ext' ][ 'org' ] ) ) { | |
| 125 | + | |
| 126 | + $pkg_info = $this->p->util->get_pkg_info(); // Uses a local cache. | |
| 127 | + $plugins_url = is_multisite() ? network_admin_url( 'plugins.php', null ) : get_admin_url( $blog_id = null, 'plugins.php' ); | |
| 128 | + $plugins_url = add_query_arg( array( 's' => 'wpsso+organization+markup' ), $plugins_url ); | |
| 129 | + $addon_name = __( 'WPSSO Organization Markup', 'plugin name', 'wpsso' ); | |
| 130 | + $repl_name = $pkg_info[ 'wpssoopm' ][ 'name' ]; | |
| 131 | + $repl_link = empty( $this->p->avail[ 'p_ext' ][ 'opm' ] ) ? $this->p->util->get_admin_url( 'addons#wpssoopm', $repl_name ) : $repl_name; | |
| 132 | + | |
| 133 | + $notice_msg = sprintf( __( 'The %1$s add-on is deprecated and replaced by the %2$s add-on.', 'wpsso' ), | |
| 134 | + $addon_name, $repl_link ) . ' '; | |
| 135 | + | |
| 136 | + if ( empty( $this->p->avail[ 'p_ext' ][ 'opm' ] ) ) { | |
| 137 | + | |
| 138 | + $notice_msg .= sprintf( __( 'After installing and activating %1$s, <a href="%2$s">please deactivate and delete the %3$s add-on</a>.', | |
| 139 | + 'wpsso' ), $repl_link, $plugins_url, $addon_name ) . ' '; | |
| 140 | + | |
| 141 | + } else { | |
| 142 | + | |
| 143 | + $notice_msg .= sprintf( __( '<a href="%1$s">Please deactivate and delete the %2$s add-on</a>.', 'wpsso' ), | |
| 144 | + $plugins_url, $addon_name ) . ' '; | |
| 145 | + } | |
| 146 | + | |
| 147 | + $notice_key = 'deactivate-wpsso-organization'; | |
| 148 | + | |
| 149 | + $this->p->notice->err( $notice_msg, null, $notice_key ); | |
| 150 | + } | |
| 151 | + | |
| 152 | + if ( ! empty( $this->p->avail[ 'p_ext' ][ 'plm' ] ) ) { | |
| 153 | + | |
| 154 | + $pkg_info = $this->p->util->get_pkg_info(); // Uses a local cache. | |
| 155 | + $plugins_url = is_multisite() ? network_admin_url( 'plugins.php', null ) : get_admin_url( $blog_id = null, 'plugins.php' ); | |
| 156 | + $plugins_url = add_query_arg( array( 's' => 'wpsso-plm' ), $plugins_url ); | |
| 157 | + $addon_name = __( 'WPSSO Place and Local SEO Markup', 'plugin name', 'wpsso' ); | |
| 158 | + $repl_name = $pkg_info[ 'wpssoopm' ][ 'name' ]; | |
| 159 | + $repl_link = empty( $this->p->avail[ 'p_ext' ][ 'opm' ] ) ? $this->p->util->get_admin_url( 'addons#wpssoopm', $repl_name ) : $repl_name; | |
| 160 | + | |
| 161 | + $notice_msg = sprintf( __( 'The %1$s add-on is deprecated and replaced by the %2$s add-on.', 'wpsso' ), | |
| 162 | + $addon_name, $repl_link ) . ' '; | |
| 163 | + | |
| 164 | + if ( empty( $this->p->avail[ 'p_ext' ][ 'opm' ] ) ) { | |
| 165 | + | |
| 166 | + $notice_msg .= sprintf( __( 'After installing and activating %1$s, <a href="%2$s">please deactivate and delete the %3$s add-on</a>.', | |
| 167 | + 'wpsso' ), $repl_link, $plugins_url, $addon_name ) . ' '; | |
| 168 | + | |
| 169 | + } else { | |
| 170 | + | |
| 171 | + $notice_msg .= sprintf( __( '<a href="%1$s">Please deactivate and delete the %2$s add-on</a>.', 'wpsso' ), | |
| 172 | + $plugins_url, $addon_name ) . ' '; | |
| 173 | + } | |
| 174 | + | |
| 175 | + $notice_key = 'deactivate-wpsso-plm'; | |
| 176 | + | |
| 177 | + $this->p->notice->err( $notice_msg, null, $notice_key ); | |
| 178 | + } | |
| 179 | + } | |
| 180 | + | |
| 181 | + private function conflict_check_db() { | |
| 182 | + | |
| 183 | + global $wpdb; | |
| 184 | + | |
| 185 | + /* | |
| 186 | + * See https://dev.mysql.com/doc/refman/8.0/en/program-variables.html. | |
| 187 | + * | |
| 188 | + * See https://dev.mysql.com/doc/refman/8.0/en/packet-too-large.html. | |
| 189 | + */ | |
| 190 | + $result = $wpdb->get_results( 'SELECT @@global.max_allowed_packet', ARRAY_A ); | |
| 191 | + | |
| 192 | + if ( isset( $result[ 0 ][ '@@global.max_allowed_packet' ] ) ) { // Just in case. | |
| 193 | + | |
| 194 | + $max_allowed = $result[ 0 ][ '@@global.max_allowed_packet' ]; | |
| 195 | + | |
| 196 | + if ( $this->p->debug->enabled ) { | |
| 197 | + | |
| 198 | + $this->p->debug->log( 'db max_allowed_packet value is "' . $max_allowed . '"' ); | |
| 199 | + } | |
| 200 | + | |
| 201 | + $min_bytes = 1 * 1024 * 1024; // 1MB in bytes. | |
| 202 | + $def_bytes = 16 * 1024 * 1024; // 16MB in bytes. | |
| 203 | + | |
| 204 | + if ( $max_allowed < $min_bytes ) { | |
| 205 | + | |
| 206 | + $notice_msg = sprintf( __( 'Your database is configured for a "%1$s" size of %2$d bytes, which is less than the recommended minimum value of %3$d bytes (a common default value is %4$d bytes).', 'wpsso' ), 'max_allowed_packet', $max_allowed, $min_bytes, $def_bytes ) . ' '; | |
| 207 | + | |
| 208 | + $notice_msg .= sprintf( __( 'Please contact your hosting provider and have the "%1$s" database option adjusted to a larger and safer value.', 'wpsso' ), 'max_allowed_packet' ) . ' '; | |
| 209 | + | |
| 210 | + $notice_msg .= sprintf( __( 'See the %1$s sections %2$s and %3$s for more information on this database option.', 'wpsso' ), 'MySQL 8.0 Reference Manual', '<a href="https://dev.mysql.com/doc/refman/8.0/en/program-variables.html">Using Options to Set Program Variables</a>', '<a href="https://dev.mysql.com/doc/refman/8.0/en/packet-too-large.html">Packet Too Large</a>', 'max_allowed_packet' ) . ' '; | |
| 211 | + | |
| 212 | + $notice_key = 'db-max-allowed-packet-too-small'; | |
| 213 | + | |
| 214 | + $this->p->notice->err( $notice_msg, null, $notice_key ); | |
| 215 | + } | |
| 216 | + } | |
| 217 | + } | |
| 218 | + | |
| 219 | + private function conflict_check_php() { | |
| 220 | + | |
| 221 | + /* | |
| 222 | + * Load WP class libraries to avoid triggering a bug in EWWW when applying the 'wp_image_editors' filter. | |
| 223 | + */ | |
| 224 | + require_once ABSPATH . WPINC . '/class-wp-image-editor.php'; | |
| 225 | + require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php'; | |
| 226 | + require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php'; | |
| 227 | + | |
| 228 | + $implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); | |
| 229 | + | |
| 230 | + $php_extensions = $this->p->cf[ 'php' ][ 'extensions' ]; | |
| 231 | + | |
| 232 | + $error_pre = sprintf( __( '%s error:', 'wpsso' ), __METHOD__ ); | |
| 233 | + | |
| 234 | + foreach ( $php_extensions as $php_ext => $php_info ) { | |
| 235 | + | |
| 236 | + /* | |
| 237 | + * Skip image extensions for WordPress image editors that are not used. | |
| 238 | + */ | |
| 239 | + if ( ! empty( $php_info[ 'wp_image_editor' ][ 'class' ] ) ) { | |
| 240 | + | |
| 241 | + if ( ! in_array( $php_info[ 'wp_image_editor' ][ 'class' ], $implementations ) ) { | |
| 242 | + | |
| 243 | + continue; | |
| 244 | + } | |
| 245 | + } | |
| 246 | + | |
| 247 | + $notice_msg = ''; // Clear any previous error message. | |
| 248 | + $notice_key = ''; // Clear any previous error message key. | |
| 249 | + | |
| 250 | + /* | |
| 251 | + * Check for the extension first, then maybe check for its functions. | |
| 252 | + */ | |
| 253 | + if ( ! extension_loaded( $php_ext ) ) { | |
| 254 | + | |
| 255 | + if ( $this->p->debug->enabled ) { | |
| 256 | + | |
| 257 | + $this->p->debug->log( 'php ' . $php_ext . ' extension module is not loaded' ); | |
| 258 | + } | |
| 259 | + | |
| 260 | + /* | |
| 261 | + * If this is a WordPress image editing extension, add information about the WordPress | |
| 262 | + * image editing class. | |
| 263 | + */ | |
| 264 | + if ( ! empty( $php_info[ 'wp_image_editor' ][ 'class' ] ) ) { | |
| 265 | + | |
| 266 | + /* | |
| 267 | + * If we have a WordPress reference URL for this image editing class, link the | |
| 268 | + * image editor class name. | |
| 269 | + */ | |
| 270 | + if ( ! empty( $php_info[ 'wp_image_editor' ][ 'url' ] ) ) { | |
| 271 | + | |
| 272 | + $editor_class = '<a href="' . $php_info[ 'wp_image_editor' ][ 'url' ] . '">' . | |
| 273 | + $php_info[ 'wp_image_editor' ][ 'class' ] . '</a>'; | |
| 274 | + | |
| 275 | + } else $editor_class = $php_info[ 'wp_image_editor' ][ 'class' ]; | |
| 276 | + | |
| 277 | + $notice_msg .= sprintf( __( 'WordPress is configured to use the %1$s image editing class but the <a href="%2$s">PHP %3$s extension module</a> is not loaded:', 'wpsso' ), $editor_class, $php_info[ 'url' ], $php_info[ 'label' ] ) . ' '; | |
| 278 | + | |
| 279 | + } else $notice_msg .= sprintf( __( 'The <a href="%1$s">PHP %2$s extension module</a> is not loaded:', 'wpsso' ), | |
| 280 | + $php_info[ 'url' ], $php_info[ 'label' ] ) . ' '; | |
| 281 | + | |
| 282 | + /* | |
| 283 | + * Add additional / mode specific information about this check for the hosting provider. | |
| 284 | + */ | |
| 285 | + $notice_msg .= sprintf( __( 'The <a href="%1$s">PHP %2$s function</a> for "%3$s" returned false.', 'wpsso' ), | |
| 286 | + __( 'https://secure.php.net/manual/en/function.extension-loaded.php', 'wpsso' ), | |
| 287 | + '<code>extension_loaded()</code>', $php_ext ) . ' '; | |
| 288 | + | |
| 289 | + /* | |
| 290 | + * If we are checking for the ImageMagick PHP extension, make sure the user knows the | |
| 291 | + * difference between the OS package and the PHP extension. | |
| 292 | + */ | |
| 293 | + if ( $php_ext === 'imagick' ) { | |
| 294 | + | |
| 295 | + $notice_msg .= sprintf( __( 'Note that the ImageMagick application and the PHP "%1$s" extension are two different products - this error is for the PHP "%1$s" extension, not the ImageMagick application.', 'wpsso' ), $php_ext ) . ' '; | |
| 296 | + } | |
| 297 | + | |
| 298 | + $notice_msg .= sprintf( __( 'Please contact your hosting provider to have the missing PHP "%1$s" extension installed and enabled.', 'wpsso' ), $php_ext ); | |
| 299 | + | |
| 300 | + $notice_key .= 'php-extension-' . $php_ext . '-not-loaded'; | |
| 301 | + | |
| 302 | + /* | |
| 303 | + * If the PHP extension is loaded, then maybe check to make sure the extension is complete. ;-) | |
| 304 | + */ | |
| 305 | + } elseif ( ! empty( $php_info[ 'classes' ] ) && is_array( $php_info[ 'classes' ] ) ) { | |
| 306 | + | |
| 307 | + foreach ( $php_info[ 'classes' ] as $class_name ) { | |
| 308 | + | |
| 309 | + if ( ! class_exists( $class_name ) ) { | |
| 310 | + | |
| 311 | + if ( $this->p->debug->enabled ) { | |
| 312 | + | |
| 313 | + $this->p->debug->log( 'php ' . $class_name . ' class is missing' ); | |
| 314 | + } | |
| 315 | + | |
| 316 | + $notice_msg .= sprintf( __( 'The <a href="%1$s">PHP %2$s extension module</a> is loaded but the %3$s class is missing.', 'wpsso' ), $php_info[ 'url' ], $php_info[ 'label' ], '<code>' . $class_name . '</code>' ) . ' '; | |
| 317 | + | |
| 318 | + $notice_msg .= __( 'Please contact your hosting provider to have the missing PHP class installed.', 'wpsso' ); | |
| 319 | + | |
| 320 | + $notice_key .= 'php-class-' . $class_name . '-missing'; | |
| 321 | + } | |
| 322 | + } | |
| 323 | + | |
| 324 | + } elseif ( ! empty( $php_info[ 'functions' ] ) && is_array( $php_info[ 'functions' ] ) ) { | |
| 325 | + | |
| 326 | + foreach ( $php_info[ 'functions' ] as $function_name ) { | |
| 327 | + | |
| 328 | + if ( ! function_exists( $function_name ) ) { | |
| 329 | + | |
| 330 | + if ( $this->p->debug->enabled ) { | |
| 331 | + | |
| 332 | + $this->p->debug->log( 'php ' . $function_name . '() function is missing' ); | |
| 333 | + } | |
| 334 | + | |
| 335 | + $notice_msg .= sprintf( __( 'The <a href="%1$s">PHP %2$s extension module</a> is loaded but the %3$s function is missing.', 'wpsso' ), $php_info[ 'url' ], $php_info[ 'label' ], '<code>' . $function_name . '()</code>' ) . ' '; | |
| 336 | + | |
| 337 | + $notice_msg .= __( 'Please contact your hosting provider to have the missing PHP function installed.', 'wpsso' ); | |
| 338 | + | |
| 339 | + $notice_key .= 'php-function-' . $function_name . '-missing'; | |
| 340 | + } | |
| 341 | + } | |
| 342 | + } | |
| 343 | + | |
| 344 | + if ( ! empty( $notice_msg ) ) { | |
| 345 | + | |
| 346 | + $this->p->notice->err( $notice_msg, null, $notice_key ); | |
| 347 | + | |
| 348 | + SucomUtil::safe_error_log( $error_pre . ' ' . $notice_msg, $strip_html = true ); | |
| 349 | + } | |
| 350 | + } | |
| 351 | + } | |
| 352 | + | |
| 353 | + private function conflict_check_vc() { | |
| 354 | + | |
| 355 | + if ( defined( 'WPB_VC_VERSION' ) ) { | |
| 356 | + | |
| 357 | + /* | |
| 358 | + * Although no specific entry was added in the WPBakery changelog, it has been reported that this | |
| 359 | + * bug is now fixed in the current WPBakery version (6.1.0). | |
| 360 | + * | |
| 361 | + * https://kb.wpbakery.com/docs/preface/release-notes/ | |
| 362 | + */ | |
| 363 | + $min_version = '6.1.0'; | |
| 364 | + | |
| 365 | + if ( version_compare( WPB_VC_VERSION, $min_version, '<' ) ) { | |
| 366 | + | |
| 367 | + if ( $this->p->debug->enabled ) { | |
| 368 | + | |
| 369 | + $this->p->debug->log( 'visual composer version with event bug detected' ); | |
| 370 | + } | |
| 371 | + | |
| 372 | + $blog_post_url = 'https://surniaulula.com/2018/apps/wordpress/plugins/wpbakery/wpbakery-visual-composer-bug-in-change-handler/'; | |
| 373 | + | |
| 374 | + $notice_msg = __( 'An issue with WPBakery Visual Composer has been detected.', 'wpsso' ) . ' '; | |
| 375 | + | |
| 376 | + $notice_msg .= sprintf( __( 'WPBakery Visual Composer version %s and older are known to have a bug in their jQuery event handling code.', 'wpsso' ), $min_version ) . ' '; | |
| 377 | + | |
| 378 | + $notice_msg .= __( 'To avoid jQuery crashing on show / hide jQuery events, please update your version of WPBakery Visual Composer immediately.', 'wpsso' ); | |
| 379 | + | |
| 380 | + $notice_key = 'wpb-vc-version-event-bug-' . $min_version; | |
| 381 | + | |
| 382 | + $this->p->notice->err( $notice_msg, null, $notice_key ); | |
| 383 | + } | |
| 384 | + } | |
| 385 | + } | |
| 386 | + | |
| 387 | + private function conflict_check_wp() { | |
| 388 | + | |
| 389 | + $is_public = get_option( 'blog_public' ); | |
| 390 | + $is_prod_env = 'production' === wp_get_environment_type() ? true : false; // Since WP v5.5. | |
| 391 | + | |
| 392 | + if ( ! $is_public && $is_prod_env ) { | |
| 393 | + | |
| 394 | + if ( $this->p->debug->enabled ) { | |
| 395 | + | |
| 396 | + $this->p->debug->log( 'wp blog_public option is disabled' ); | |
| 397 | + } | |
| 398 | + | |
| 399 | + $settings_url = get_admin_url( $blog_id = null, 'options-reading.php' ); | |
| 400 | + | |
| 401 | + $notice_msg = sprintf( __( 'The WordPress <a href="%s">Search Engine Visibility</a> option is set to discourage search engines from indexing this site.', 'wpsso' ), $settings_url ) . ' '; | |
| 402 | + | |
| 403 | + $notice_msg .= __( 'This is not compatible with the purpose of optimizing your content for social and search engines - please uncheck the option to allow search engines and social sites to access your site.', 'wpsso' ); | |
| 404 | + | |
| 405 | + $notice_key = 'wp-search-engine-visibility-disabled'; | |
| 406 | + $dismiss_time = MONTH_IN_SECONDS; | |
| 407 | + | |
| 408 | + $this->p->notice->warn( $notice_msg, null, $notice_key, $dismiss_time ); | |
| 409 | + } | |
| 410 | + } | |
| 411 | + } | |
| 412 | +} | |