Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…oarding into enhance/PRESS2-535-consolidate-animations
  • Loading branch information
arunshenoy99 committed Feb 1, 2023
2 parents 92dbf2e + 8d85d3c commit 1244d34
Show file tree
Hide file tree
Showing 19 changed files with 20,762 additions and 340 deletions.
207 changes: 134 additions & 73 deletions includes/Data/Brands.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,100 +6,161 @@
*/
final class Brands {

/**
* Brand specific data - Bluehost, Bluhost India, Webcom
*
* @return array
*/
public static function get_brands() {

return array(
'bluehost' => array(
'brand' => 'bluehost',
'name' => 'Bluehost',
'url' => 'https://bluehost.com',
'knowledgeBaseUrl' => 'https://www.bluehost.com/help/results/wordpress',
'helpUrl' => 'https://www.bluehost.com/help',
'blogUrl' => 'https://www.bluehost.com/blog/',
'facebookUrl' => 'https://www.facebook.com/bluehost',
'twitterName' => '@bluehost',
'twitterUrl' => 'https://twitter.com/bluehost',
'youtubeUrl' => 'https://www.youtube.com/user/bluehost',
'linkedinUrl' => 'https://www.linkedin.com/company/bluehost-com',
'accountUrl' => 'https://my.bluehost.com',
'domainsUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/domains',
'emailUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/email-office',
'hireExpertsInfo' => array(
'defaultLink' => 'admin.php?',
'fragment' => '#/marketplace/services/blue-sky',
'queryParameters' => array(
'page' => 'bluehost',
'utm_source' => 'onboarding',
'utm_medium' => 'wp_admin',
'utm_campaign' => 'wp-setup'
'brand' => 'bluehost',
'name' => 'Bluehost',
'url' => 'https://bluehost.com',
'knowledgeBaseUrl' => 'https://www.bluehost.com/help/results/wordpress',
'helpUrl' => 'https://www.bluehost.com/help',
'blogUrl' => 'https://www.bluehost.com/blog/',
'facebookUrl' => 'https://www.facebook.com/bluehost',
'twitterName' => '@bluehost',
'twitterUrl' => 'https://twitter.com/bluehost',
'youtubeUrl' => 'https://www.youtube.com/user/bluehost',
'linkedinUrl' => 'https://www.linkedin.com/company/bluehost-com',
'accountUrl' => 'https://my.bluehost.com',
'domainsUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/domains',
'emailUrl' => 'https://my.bluehost.com/hosting/app?lil=1#/email-office',
'phoneNumbers' => array(
'sales' => '844-303-1730',
'support' => '888-401-4678',
'intl' => '+1-801-765-9400',
),
'hireExpertsInfo' => array(
'defaultLink' => 'admin.php?',
'fragment' => '#/marketplace/services/blue-sky',
'queryParameters' => array(
'page' => 'bluehost',
'utm_source' => 'onboarding',
'utm_medium' => 'wp_admin',
'utm_campaign' => 'wp-setup',
),
),
'expertsInfo' => array(
'defaultLink' => 'https://my.bluehost.com/cgi/app/#/marketplace/product/i/bluesky',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
'expertsInfo' => array(
'defaultLink' => 'https://my.bluehost.com/cgi/app/#/marketplace/product/i/bluesky',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
),
),
'fullServiceCreativeTeamInfo' => array(
'defaultLink' => 'https://www.bluehost.com/solutions/full-service',
'fragment' => '#full-service',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
'defaultLink' => 'https://www.bluehost.com/solutions/full-service',
'fragment' => '#full-service',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
),
),
'techSupportInfo' => array(
'defaultLink' => 'https://helpchat.bluehost.com/',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
'techSupportInfo' => array(
'defaultLink' => 'https://helpchat.bluehost.com/',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
),
),
),
'bluehost-india' => array(
'brand' => 'bluehost-india',
'name' => 'Bluehost',
'url' => 'https://bluehost.in',
'knowledgeBaseUrl' => 'https://www.bluehost.in/hosting/help/results/wordpress',
'helpUrl' => 'https://www.bluehost.in/hosting/help',
'blogUrl' => 'https://www.bluehost.in/tutorials',
'facebookUrl' => 'https://www.facebook.com/BlueHostIndia',
'twitterName' => '@BluehostIndia',
'twitterUrl' => 'https://twitter.com/bluehostindia',
'youtubeUrl' => null,
'linkedinUrl' => null,
'accountUrl' => 'https://my.bluehost.in',
'domainsUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/domains',
'emailUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/email-office',
'hireExpertsInfo' => array(
'defaultLink' => 'https://www.bluehost.in/solutions/full-service',
'utmParameters' => array(
'utm_source' => 'blog',
'utm_medium' => 'socialmedia',
'utm_campaign' => 'blogpost'
)
'brand' => 'bluehost-india',
'name' => 'Bluehost',
'url' => 'https://bluehost.in',
'knowledgeBaseUrl' => 'https://www.bluehost.in/hosting/help/results/wordpress',
'helpUrl' => 'https://www.bluehost.in/hosting/help',
'blogUrl' => 'https://www.bluehost.in/tutorials',
'facebookUrl' => 'https://www.facebook.com/BlueHostIndia',
'twitterName' => '@BluehostIndia',
'twitterUrl' => 'https://twitter.com/bluehostindia',
'youtubeUrl' => null,
'linkedinUrl' => null,
'accountUrl' => 'https://my.bluehost.in',
'domainsUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/domains',
'emailUrl' => 'https://my.bluehost.in/hosting/app?lil=1#/email-office',
'hireExpertsInfo' => array(
'defaultLink' => 'https://www.bluehost.in/solutions/full-service',
'utmParameters' => array(
'utm_source' => 'blog',
'utm_medium' => 'socialmedia',
'utm_campaign' => 'blogpost',
),
),
'expertsInfo' => array(
'defaultLink' => 'https://my.bluehost.in/cgi/app/#/marketplace/product/i/bluesky',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
),
),
'fullServiceCreativeTeamInfo' => array(
'defaultLink' => 'https://www.bluehost.in/solutions/full-service',
'fragment' => '#full-service',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
),
),
'techSupportInfo' => array(
'defaultLink' => 'https://helpchat.bluehost.in/',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
),
),
),
'webcom' => array(
'brand' => 'webcom',
'name' => 'Web.com',
'url' => 'https://web.com',
'knowledgeBaseUrl' => 'https://www.web.com/knowledge',
'helpUrl' => 'https://www.web.com/knowledge',
'blogUrl' => 'https://www.web.com/blog',
'facebookUrl' => 'https://www.facebook.com/Web.com/',
'twitterName' => '@webdotcom',
'twitterUrl' => 'http://twitter.com/webdotcom',
'youtubeUrl' => 'https://www.youtube.com/c/webdotcom',
'linkedinUrl' => 'https://www.linkedin.com/company/website-pros/',
'accountUrl' => 'https://www.web.com/my-account',
'domainsUrl' => 'https://www.web.com/domains',
'emailUrl' => 'https://www.web.com/email-service',
'phoneNumbers' => array(
'sales' => '866-923-8821',
'support' => '866-923-8821',
'intl' => '+1-904-680-6617',
),
'hireExpertsInfo' => array(
'defaultLink' => 'https://www.web.com/websites/pro-website-services',
'utmParameters' => array(
'utm_source' => '',
'utm_medium' => '',
'utm_campaign' => '',
),
),
'expertsInfo' => array(
'defaultLink' => 'https://my.bluehost.in/cgi/app/#/marketplace/product/i/bluesky',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
'expertsInfo' => array(
'defaultLink' => 'https://www.web.com/websites/pro-website-services',
'queryParams' => array(
'utm_source' => '',
'utm_medium' => '',
),
),
'fullServiceCreativeTeamInfo' => array(
'defaultLink' => 'https://www.bluehost.in/solutions/full-service',
'fragment' => '#full-service',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
'defaultLink' => 'https://www.web.com/websites/pro-website-services',
'fragment' => '',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
),
),
'techSupportInfo' => array(
'defaultLink' => 'https://helpchat.bluehost.in/',
'queryParams' => array(
'utm_source' => 'wp-onboarding',
'utm_medium' => 'brand-plugin',
'techSupportInfo' => array(
'defaultLink' => '',
'queryParams' => array(
'utm_source' => '',
'utm_medium' => '',
),
),
),
Expand Down
1 change: 1 addition & 0 deletions includes/Data/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ final class Options {
'page_on_front' => 'page_on_front',
'theme_settings' => 'theme_settings',
'flow_preset' => 'flow_preset',
'wpseo_social' => 'wpseo_social',
);

/**
Expand Down
47 changes: 41 additions & 6 deletions includes/Data/Patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@

use NewfoldLabs\WP\Module\Onboarding\Data\Options;

/**
* Class Patterns
*/
final class Patterns {

/**
* Retrieve Patterns for Theme Step.
*
* @return array
*/
protected static function get_theme_step_patterns() {
return array(
'yith-wonder' => array(
Expand Down Expand Up @@ -96,12 +104,19 @@ protected static function get_theme_step_patterns() {
'shown' => true,
),
),
'site-features' => SiteFeatures::get_site_features()[Data::current_flow()]
'site-features' => SiteFeatures::get_site_features()[ Data::current_flow() ],
),
);
}

public static function cleanup_wp_grammar( $content ) {
/**
* Sanitize the content by cleaning wp_grammar.
*
* @param string $content Data to clean
*
* @return string
*/
private static function cleanup_wp_grammar( $content ) {

// Remove template-part if that exists
$content = preg_replace( '/^<!-- wp:template-part .* \/-->$/m', '', $content );
Expand All @@ -115,6 +130,13 @@ public static function cleanup_wp_grammar( $content ) {
return $content;
}

/**
* Retrieve pattern from slug.
*
* @param array $pattern_slug Pattern Slug Data
*
* @return array|boolean
*/
public static function get_pattern_from_slug( $pattern_slug ) {

$block_patterns_registry = \WP_Block_Patterns_Registry::get_instance();
Expand All @@ -130,6 +152,14 @@ public static function get_pattern_from_slug( $pattern_slug ) {
return false;
}

/**
* Retrieve Theme Step Patterns from chosen Theme in Previous Step
*
* @param string $step Step from which Theme Step Pattern is required
* @param boolean $squash Flag set to retrieve the block pattern
*
* @return array|string
*/
public static function get_theme_step_patterns_from_step( $step, $squash = false ) {
$active_theme = ( \wp_get_theme() )->get( 'TextDomain' );

Expand All @@ -142,7 +172,7 @@ public static function get_theme_step_patterns_from_step( $step, $squash = false
$block_patterns = array();
$block_patterns_squashed = '';
foreach ( array_keys( $pattern_slugs ) as $pattern_slug ) {
if ( $pattern_slugs[ $pattern_slug ]['active'] === true ) {
if ( true === $pattern_slugs[ $pattern_slug ]['active'] ) {
$pattern_name = $active_theme . '/' . $pattern_slug;
if ( $block_patterns_registry->is_registered( $pattern_name ) ) {
$pattern = $block_patterns_registry->get_registered( $pattern_name );
Expand All @@ -166,6 +196,11 @@ public static function get_theme_step_patterns_from_step( $step, $squash = false
return $squash ? $block_patterns_squashed : $block_patterns;
}

/**
* Retrieve Pattern Count.
*
* @return array
*/
public static function get_count_of_patterns() {
$active_theme = ( \wp_get_theme() )->get( 'TextDomain' );
$theme_step_patterns = self::get_theme_step_patterns();
Expand All @@ -176,10 +211,10 @@ public static function get_count_of_patterns() {
$theme_step_count = 0;
$combine_styles = 1;
foreach ( $patterns as $pattern => $pattern_data ) {
if ( isset( $pattern_data['shown'] ) && $pattern_data['shown'] === true ) {
$theme_step_count += 1;
if ( isset( $pattern_data['shown'] ) && true === $pattern_data['shown'] ) {
++$theme_step_count;
}
if ( isset( $pattern_data['combine'] ) && $pattern_data['combine'] === true ) {
if ( isset( $pattern_data['combine'] ) && true === $pattern_data['combine'] ) {
$combine_styles = count( \WP_Theme_JSON_Resolver::get_style_variations() ) + 1;
}
}
Expand Down
29 changes: 22 additions & 7 deletions includes/Data/SiteFeatures.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
<?php

namespace NewfoldLabs\WP\Module\Onboarding\Data;
use \__;
use NewfoldLabs\WP\Module\Onboarding\Data\Options;

/**
* Class SiteFeatures
*/
final class SiteFeatures {

public static function get_site_features()
{

/**
* Retrieve Site Features.
*
* @return array
*/
public static function get_site_features() {
return array(
'wp-setup' => array(),
'wp-setup' => array(),
'ecommerce' => array(
'jetpack' => array(
'slug' => 'jetpack',
Expand Down Expand Up @@ -105,7 +110,12 @@ public static function get_site_features()
);
}

public static function mark_initial_plugins() {
/**
* Based on the flow type initial site features are marked.
*
* @return array
*/
private static function mark_initial_plugins() {
$flow = Data::current_flow();
$installed_plugins = Plugins::get_init();

Expand All @@ -121,6 +131,11 @@ public static function mark_initial_plugins() {
return $site_features_marked;
}

/**
* Retrieve marked site features
*
* @return array
*/
public static function get() {
return self::mark_initial_plugins();
}
Expand Down
Loading

0 comments on commit 1244d34

Please sign in to comment.