Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…oarding into enhance/ai-onboarding
  • Loading branch information
arunshenoy99 committed Jan 9, 2024
2 parents 7aeb3bc + 29cf245 commit f11a232
Show file tree
Hide file tree
Showing 18 changed files with 504 additions and 585 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"require": {
"mustache/mustache": "^2.14",
"wp-cli/wp-config-transformer": "^1.3",
"newfold-labs/wp-module-onboarding-data": "^0.0.9",
"newfold-labs/wp-module-onboarding-data": "^0.0.10",
"newfold-labs/wp-module-patterns": "^0.1.9",
"newfold-labs/wp-module-install-checker": "^1.0"
},
Expand Down
831 changes: 385 additions & 446 deletions composer.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion includes/Compatibility/Safe_Mode.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function __construct( Scan $scan ) {

// Cleanup and Redirect to Onboarding once core has updated successfully via manual DB upgrade. See wp-admin/upgrade.php
\add_action( 'load-about.php', array( self::class, 'handle_redirect' ) );

}

/**
Expand Down
2 changes: 0 additions & 2 deletions includes/Compatibility/Scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,5 @@ protected function evaluate() {
if ( 'scan-initiated' === $this->result ) {
$this->result = 'compatible';
}

}

}
1 change: 0 additions & 1 deletion includes/Compatibility/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@ public static function set( $status ) {
public static function reset() {
\delete_option( Options::get_option_name( 'compatibility_results' ) );
}

}
10 changes: 2 additions & 8 deletions includes/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,10 @@ public static function module_switcher() {
// Deactivate the Module
deactivate( $module_name );
}
} else {

// Check if the Module Does Exist
if ( ModuleRegistry::get( $module_name ) ) {

} elseif ( ModuleRegistry::get( $module_name ) ) {
// Activate the Module
activate( $module_name );
}
}

}

/**
Expand Down Expand Up @@ -109,7 +103,7 @@ public static function verify_onboarding_criteria( $brand_name ) {
* @return boolean
*/
public static function is_brand_eligible( $brand_name ) {
if ( false !== strpos( $brand_name, 'hostgator' ) && 'hostgator-br' !== $brand_name && 'hostgator-us' !== $brand_name ) {
if ( false !== strpos( $brand_name, 'hostgator' ) && 'hostgator-br' !== $brand_name && 'hostgator-us' !== $brand_name ) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions includes/Mustache/Mustache.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Mustache {
public function __construct() {
$this->mustache_engine = new \Mustache_Engine(
array(
'loader' => new \Mustache_Loader_FilesystemLoader( dirname( __FILE__ ) . '/Templates' ),
'loader' => new \Mustache_Loader_FilesystemLoader( __DIR__ . '/Templates' ),
)
);
}
Expand All @@ -32,6 +32,6 @@ public function __construct() {
* @return string
*/
public function render_template( $template_name, $data ) {
return $this->mustache_engine->loadTemplate( $template_name )->render( $data );
return $this->mustache_engine->loadTemplate( $template_name )->render( $data );
}
}
1 change: 0 additions & 1 deletion includes/RestApi/RestApiFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,5 +298,4 @@ public static function register_wc_settings_options() {
register_setting( 'general', Options::get_option_name( $wc_settings_option, false ), $value );
}
}

} // END /NewfoldLabs/WP/Module/Onboarding/RestApiFilter()
2 changes: 0 additions & 2 deletions includes/RestApi/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ public function get_current_settings() {
}
$social_data['other_social_urls'] = $filtered_social_urls;
return $social_data;

}

/**
Expand Down Expand Up @@ -355,5 +354,4 @@ private function validate_twitter_id( $twitter_id, $strip_at_sign = true ) {

return false;
}

}
3 changes: 0 additions & 3 deletions includes/RestApi/SitePagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* Class SitePagesController
*/
class SitePagesController {


/**
* The namespace of this controller's route.
*
Expand Down Expand Up @@ -118,7 +116,6 @@ private function set_homepage( $homepage_pattern_slug ) {
}

return true;

}

/**
Expand Down
6 changes: 3 additions & 3 deletions includes/RestApi/Themes/ApprovedThemesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public function get_installed_themes() {
$response = \rest_do_request( $request );

if ( 200 === $response->status ) {
$current_brand = $current_brand = Data::current_brand();
$current_brand_name = $current_brand['name'] ? $current_brand['name'] : 'Newfold Digital';
$themes_data = json_decode( \wp_json_encode( $response->data ), true );
$current_brand = Data::current_brand();
$current_brand_name = $current_brand['name'] ? $current_brand['name'] : 'Newfold Digital';
$themes_data = json_decode( \wp_json_encode( $response->data ), true );
foreach ( $themes_data as $theme_data ) {
$theme = new Theme( $theme_data['stylesheet'] );
$theme->set_theme_image( $theme_data['screenshot'] );
Expand Down
56 changes: 28 additions & 28 deletions includes/RestApi/Themes/ThemeColorsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@
class ThemeColorsController extends \WP_REST_Controller {


/**
* The namespace of this controller's route.
*
* @var string
*/
protected $namespace = 'newfold-onboarding/v1';
/**
* The namespace of this controller's route.
*
* @var string
*/
protected $namespace = 'newfold-onboarding/v1';

/**
* The base of this controller's route.
*
* @var string
*/
protected $rest_base = '/themes';
/**
* The base of this controller's route.
*
* @var string
*/
protected $rest_base = '/themes';


/**
* The extended base of this controller's route.
*
* @var string
*/
protected $rest_extended_base = '/colors';
/**
* The extended base of this controller's route.
*
* @var string
*/
protected $rest_extended_base = '/colors';



/**
* Registers routes for ThemeColorsController
*/
/**
* Registers routes for ThemeColorsController
*/
public function register_routes() {
\register_rest_route(
$this->namespace,
Expand All @@ -52,13 +52,13 @@ public function register_routes() {
);
}

/**
* Retrieves the active theme color variations.
*
* @return array|\WP_Error
*/
/**
* Retrieves the active theme color variations.
*
* @return array|\WP_Error
*/
public function get_theme_colors() {
$theme_color_palettes = Colors::get_colors_from_theme();
return $theme_color_palettes;
$theme_color_palettes = Colors::get_colors_from_theme();
return $theme_color_palettes;
}
}
56 changes: 28 additions & 28 deletions includes/RestApi/Themes/ThemeFontsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@
class ThemeFontsController extends \WP_REST_Controller {


/**
* The namespace of this controller's route.
*
* @var string
*/
protected $namespace = 'newfold-onboarding/v1';
/**
* The namespace of this controller's route.
*
* @var string
*/
protected $namespace = 'newfold-onboarding/v1';

/**
* The base of this controller's route.
*
* @var string
*/
protected $rest_base = '/themes';
/**
* The base of this controller's route.
*
* @var string
*/
protected $rest_base = '/themes';


/**
* The extended base of this controller's route.
*
* @var string
*/
protected $rest_extended_base = '/fonts';
/**
* The extended base of this controller's route.
*
* @var string
*/
protected $rest_extended_base = '/fonts';

/**
* Registers routes for ThemeColorsController
*/
/**
* Registers routes for ThemeColorsController
*/
public function register_routes() {
\register_rest_route(
$this->namespace,
Expand All @@ -50,13 +50,13 @@ public function register_routes() {
);
}

/**
* Retrieves the active theme font variations.
*
* @return array|\WP_Error
*/
/**
* Retrieves the active theme font variations.
*
* @return array|\WP_Error
*/
public function get_theme_fonts() {
$theme_font_palettes = Fonts::get_fonts_from_theme();
$theme_font_palettes = Fonts::get_fonts_from_theme();

if ( ! $theme_font_palettes ) {
return new \WP_Error(
Expand All @@ -66,6 +66,6 @@ public function get_theme_fonts() {
);
}

return $theme_font_palettes;
return $theme_font_palettes;
}
}
33 changes: 16 additions & 17 deletions includes/RestApi/Themes/ThemeVariationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public function register_routes() {
* @return array
*/
public function get_pattern_args() {
return array(
'variations' => array(
'type' => 'boolean',
'default' => false,
),
);
return array(
'variations' => array(
'type' => 'boolean',
'default' => false,
),
);
}

/**
Expand All @@ -77,16 +77,16 @@ public function get_pattern_args() {
* @return array
*/
public function set_pattern_args() {
return array(
'title' => array(
'type' => 'string',
'required' => true,
),
'settings' => array(
'type' => 'object',
'required' => true,
),
);
return array(
'title' => array(
'type' => 'string',
'required' => true,
),
'settings' => array(
'type' => 'object',
'required' => true,
),
);
}

/**
Expand Down Expand Up @@ -188,5 +188,4 @@ public function set_theme_variation( \WP_REST_Request $request ) {
'Settings parameter is found to be missing'
);
}

}
1 change: 0 additions & 1 deletion includes/Services/I18nService.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ public static function load_js_translations( $domain, $script_slug, $languages_d
$domain,
$languages_dir
);

}
}
6 changes: 3 additions & 3 deletions includes/Services/PluginService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use NewfoldLabs\WP\Module\Onboarding\WP_Admin;
use NewfoldLabs\WP\Module\Onboarding\Data\Options;
use function NewfoldLabs\WP\ModuleLoader\container;
use NewfoldLabs\WP\Module\Installer\Services\PluginInstaller;
use NewfoldLabs\WP\Module\Installer\TaskManagers\PluginActivationTaskManager;
use NewfoldLabs\WP\Module\Installer\TaskManagers\PluginInstallTaskManager;
Expand All @@ -16,6 +15,8 @@
use NewfoldLabs\WP\Module\Onboarding\Data\Plugins;
use NewfoldLabs\WP\Module\Onboarding\Data\SiteFeatures;

use function NewfoldLabs\WP\ModuleLoader\container;

/**
* Class for providing plugin related services.
*/
Expand Down Expand Up @@ -161,13 +162,12 @@ public static function configure_activation_transient() {
// Add hook to activate plugins after transient is deleted
add_filter(
'option_active_plugins',
function( $plugins ) {
function ( $plugins ) {
if ( '1' === get_transient( Options::get_option_name( 'filter_active_plugins' ) ) ) {
return array( container()->plugin()->basename );
}
return $plugins;
}
);

}
}
1 change: 0 additions & 1 deletion includes/WP_Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,4 @@ public static function mark_sitegen_generated_themes() {
\wp_enqueue_script( 'sitegen-theme-marker' );
\wp_enqueue_style( 'sitegen-theme-marker' );
}

} // END /NewfoldLabs/WP/Module/Onboarding/Admin()
Loading

0 comments on commit f11a232

Please sign in to comment.