exceptions
5 years ago
options
2 years ago
sitemaps
2 years ago
class-addon-manager.php
3 years ago
class-my-yoast-api-request.php
5 years ago
class-post-type.php
2 years ago
class-rewrite.php
3 years ago
class-upgrade-history.php
5 years ago
class-upgrade.php
3 years ago
class-wpseo-admin-bar-menu.php
2 years ago
class-wpseo-content-images.php
4 years ago
class-wpseo-custom-fields.php
3 years ago
class-wpseo-custom-taxonomies.php
6 years ago
class-wpseo-image-utils.php
3 years ago
class-wpseo-installation.php
5 years ago
class-wpseo-meta.php
2 years ago
class-wpseo-primary-term.php
6 years ago
class-wpseo-rank.php
3 years ago
class-wpseo-replace-vars.php
3 years ago
class-wpseo-replacement-variable.php
5 years ago
class-wpseo-shortlinker.php
3 years ago
class-wpseo-statistics.php
5 years ago
class-wpseo-utils.php
3 years ago
date-helper.php
5 years ago
index.php
10 years ago
interface-wpseo-wordpress-ajax-integration.php
7 years ago
interface-wpseo-wordpress-integration.php
7 years ago
language-utils.php
3 years ago
wpseo-functions-deprecated.php
3 years ago
wpseo-functions.php
3 years ago
wpseo-non-ajax-functions.php
5 years ago
class-wpseo-installation.php
47 lines
| 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 |