PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.4
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.4
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / inc / class-wpseo-installation.php

class-wpseo-installation.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.4, at inc/class-wpseo-installation.php

47 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Internals
6 * @since 3.6
7 */
8
9 /**
10 * This class checks if the wpseo option doesn't exists. In the case it doesn't it will set a property that is
11 * accessible via a method to check if the installation is fresh.
12 */
13 class WPSEO_Installation {
14
15 /**
16 * Checks if Yoast SEO is installed for the first time.
17 */
18 public function __construct() {
19 $is_first_install = $this->is_first_install();
20
21 if ( $is_first_install && WPSEO_Utils::is_api_available() ) {
22 add_action( 'wpseo_activate', [ $this, 'set_first_install_options' ] );
23 }
24 }
25
26 /**
27 * When the option doesn't exist, it should be a new install.
28 *
29 * @return bool
30 */
31 private function is_first_install() {
32 return ( get_option( 'wpseo' ) === false );
33 }
34
35 /**
36 * Sets the options on first install for showing the installation notice and disabling of the settings pages.
37 */
38 public function set_first_install_options() {
39 $options = get_option( 'wpseo' );
40
41 $options['show_onboarding_notice'] = true;
42 $options['first_activated_on'] = time();
43
44 update_option( 'wpseo', $options );
45 }
46 }
47