Skip to content

Commit

Permalink
Merge pull request #121 from newfold-labs/add/populate-capabilities-flag
Browse files Browse the repository at this point in the history
Add a populate capabilities flag for brand data
  • Loading branch information
wpscholar authored Oct 28, 2024
2 parents 09a23d2 + 1bb6be3 commit 99d9047
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 31 deletions.
26 changes: 9 additions & 17 deletions includes/Brands.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public static function get_default_brand() {
}

/**
* Brand specific data - Bluehost, Bluehost India, Webcom
* Retrieve brand-specific data for various brands such as Bluehost, Bluehost India, Web.com, etc.
*
* @return array
* @return array Associative array containing configuration details for each brand, including links,
* contact information, and enabled features.
*/
public static function get_brands() {

// Checks if customer has acess to AI Sitegen.
public static function get_brands(): array {
// Checks if customer has access to AI Sitegen.
$has_ai_sitegen = Config::has_ai_sitegen();
$can_migrate_site = Config::can_migrate_site();

Expand Down Expand Up @@ -99,9 +99,7 @@ public static function get_brands() {
),
),
'migrationInfo' => array(
'defaultLink' => Config::is_jarvis() ?
'https://www.bluehost.com/my-account/hosting/details/sites/add/transfer'
: 'https://my.bluehost.com/cgi/services/migration',
'defaultLink' => 'https://www.bluehost.com/my-account/hosting/details/sites/add/transfer',
),
'config' => array(
'enabled_flows' => array(
Expand Down Expand Up @@ -401,15 +399,9 @@ public static function get_brands() {
'twitterUrl' => 'https://twitter.com/hostgator',
'youtubeUrl' => 'https://www.youtube.com/user/hostgator',
'linkedinUrl' => 'https://www.linkedin.com/company/hostgator-com/',
'accountUrl' => Config::is_jarvis() ?
'https://www.hostgator.com/my-account/login'
: 'https://portal.hostgator.com/',
'domainsUrl' => Config::is_jarvis() ?
'https://www.hostgator.com/my-account/domain-center/domain-list'
: 'https://portal.hostgator.com/domain/manage',
'emailUrl' => Config::is_jarvis() ?
'https://www.hostgator.com/my-account/hosting/details/email'
: 'https://portal.hostgator.com/email',
'accountUrl' => 'https://www.hostgator.com/my-account/login',
'domainsUrl' => 'https://www.hostgator.com/my-account/domain-center/domain-list',
'emailUrl' => 'https://www.hostgator.com/my-account/hosting/details/email',
'pluginDashboardPage' => \admin_url( 'admin.php?page=hostgator' ),
'phoneNumbers' => array(
'support' => '866-964-2867',
Expand Down
13 changes: 4 additions & 9 deletions includes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,14 @@ public static function get_wp_config_initialization_constants() {
* @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 );
}

/**
* Checks if the site is on Jarvis hosting.
*
* @return boolean
*/
public static function is_jarvis() {
return self::get_site_capability( 'isJarvis' );
}

/**
* Gets the current customer capability if he has access to AI Sitegen.
*
Expand Down
5 changes: 3 additions & 2 deletions includes/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ public static function runtime() {
}

/**
* Establish brand to apply to Onboarding experience.
* Establish the brand to apply to the Onboarding experience.
*
* @return array
* @return array The configuration array of the current brand. If the specified brand is not found,
* returns the default brand configuration.
*/
public static function current_brand() {
$brands = Brands::get_brands();
Expand Down
8 changes: 5 additions & 3 deletions includes/Flows/Flows.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ final class Flows {
),

'continueWithoutAi' => false,
'sitegenThemeMode' => '',
'sitegenThemeMode' => '',
);

/**
Expand Down Expand Up @@ -220,8 +220,10 @@ public static function get_default_flow() {
/**
* Retrieve all the known onboarding flows.
*
* @return array A value of true for each key indicates that the flow has been approved
* and a value of null indicates the flow has not been approved (or) has been temporarily disabled.
* @return array Associative array of onboarding flows. A value of true for each key indicates that the
* flow has been approved. A value of null indicates the flow has not been approved or has
* been temporarily disabled. If no enabled flows are found, default flows are provided with
* a value of false.
*/
public static function get_flows() {
$current_brand = Data::current_brand();
Expand Down

0 comments on commit 99d9047

Please sign in to comment.