Skip to content

Commit

Permalink
Start the code 🌟
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod committed Nov 22, 2023
1 parent 7cb3b2f commit 4887900
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions includes/Services/SiteGenService.php
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();
}

}

0 comments on commit 4887900

Please sign in to comment.