-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.php
73 lines (66 loc) · 1.73 KB
/
Config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace NewfoldLabs\WP\Module\Onboarding\Data;
use NewfoldLabs\WP\Module\Data\SiteCapabilities;
/**
* WordPress and Onboarding configuration data.
*/
final class Config {
/**
* The values need to be a string, this can later be converted to raw values.
*
* @var array
*/
protected static $wp_config_initialization_constants = array(
'AUTOSAVE_INTERVAL' => '300',
'WP_POST_REVISIONS' => '20',
'EMPTY_TRASH_DAYS' => '7',
'WP_AUTO_UPDATE_CORE' => 'true',
'WP_CRON_LOCK_TIMEOUT' => '120',
);
/**
* Get the initial values for wp-config constants.
*
* @return array
*/
public static function get_wp_config_initialization_constants() {
return self::$wp_config_initialization_constants;
}
/**
* Get a specific site capability.
*
* @param string $capability Name/slug of the capability.
* @return boolean
*/
public static function get_site_capability( $capability ) {
// Only fetch capabilities in the admin when a user is logged in
if ( ! is_admin() || ! is_user_logged_in() ) {
return false;
}
$site_capabilities = new SiteCapabilities();
return $site_capabilities->get( $capability );
}
/**
* Gets the current customer capability if he has access to AI Sitegen.
*
* @return boolean
*/
public static function has_ai_sitegen() {
return self::get_site_capability( 'hasAISiteGen' );
}
/**
* Gets the current site's capability if it can import via instaWp.
*
* @return boolean
*/
public static function can_migrate_site() {
return self::get_site_capability( 'canMigrateSite' );
}
/**
* Gets the current site's capability if it has solution.
*
* @return boolean
*/
public static function has_solution() {
return self::get_site_capability( 'hasSolution' );
}
}