-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7cb3b2f
commit 4887900
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace NewfoldLabs\WP\Module\Onboarding\Data\Services; | ||
|
||
use NewfoldLabs\WP\Module\AI\SiteGen\SiteGen; | ||
use NewfoldLabs\WP\Module\Onboarding\Data\Data; | ||
|
||
/** | ||
* Class SiteGenService | ||
* | ||
* Class for handling SiteGen interactions. | ||
*/ | ||
class SiteGenService { | ||
|
||
/** | ||
* Determines whether the given identifier is valid. | ||
* | ||
* @param string $key The identifier to be evaluated. | ||
* @return boolean | ||
*/ | ||
public static function is_identifier( $key ) { | ||
$identifiers = array( | ||
'siteclassification' => true, | ||
'targetaudience' => true, | ||
'contenttones' => true, | ||
'contentstructure' => true, | ||
'colorpalette' => true, | ||
'sitemap' => true, | ||
'pluginrecommendation' => true, | ||
'fontpair' => true, | ||
'keywords' => true, | ||
); | ||
|
||
return isset( $identifiers[ $key ] ); | ||
} | ||
|
||
/** | ||
* Checks if the site is eligible for SiteGen Capabilities. | ||
* | ||
* @return boolean | ||
*/ | ||
public static function is_enabled() { | ||
if ( ! ( class_exists( 'NewfoldLabs\WP\Module\AI\SiteGen\SiteGen' ) ) ) { | ||
return false; | ||
} | ||
return isset( Data::current_brand()['config']['enabled_flows']['sitegen'] ) | ||
&& true === Data::current_brand()['config']['enabled_flows']['sitegen']; | ||
} | ||
|
||
|
||
/** | ||
* Sends the data required for SiteGen Generation | ||
* | ||
* @param string|Object $site_info The prompt that configures the Site gen object. | ||
* @param string $identifier The identifier for Generating Site Meta. | ||
* @param boolean $skip_cache To override the cache and fetch the data. | ||
* @return array | ||
*/ | ||
public static function instantiate_site_meta( $site_info, $identifier, $skip_cache ) { | ||
|
||
// SiteGen::generate_sitegen_meta( $site_info, $identifier, $skip_cache ); | ||
return array(); | ||
} | ||
|
||
} |