Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/remove is jarvis host info file check #775

Merged
merged 4 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,50 +24,6 @@
return;
}

/**
* Check if platform is Jarvis
*
* @return bool
*/
function bluehost_is_jarvis() {
$is_jarvis = false;
$host = array(
'dirs' => explode( '/', ABSPATH ),
'user' => get_current_user(),
'homedir' => null,
'info_file' => null,
);

// Build host's home directory
foreach ( $host['dirs'] as $dir ) {
if ( ! empty( $dir ) ) {
$host['homedir'] = $host['homedir'] . '/' . $dir;

if ( $dir === $host['user'] ) {
break;
}
}
}

// Check for Jarvis .host-info file
if ( file_exists( $host['homedir'] . '/.host-info' ) ) {
$host['info_file'] = file_get_contents( $host['homedir'] . '/.host-info' );
}

// Check for Jarvis platform
if (
null !== $host['info_file']
&& (
false !== stripos( $host['info_file'], 'platform = jarvis' )
|| false !== stripos( $host['info_file'], 'platform=jarvis' )
)
) {
$is_jarvis = true;
}

return $is_jarvis;
}

/*
* Initialize coming soon module via container
*/
Expand Down Expand Up @@ -100,15 +56,6 @@ function () {
'bluehost'
);

$bluehost_module_container->set(
'isJarvis',
$bluehost_module_container->computed(
function () {
return bluehost_is_jarvis();
}
)
);

// properly get branding links depending on market
$wordpress_hosting_page = ( get_option( 'mm_brand' ) === 'Bluehost_India' ) ? 'https://www.bluehost.in?utm_source=coming-soon-template&utm_medium=bluehost_plugin' : 'https://bluehost.com?utm_source=coming-soon-template&utm_medium=bluehost_plugin';
$my_panel = ( get_option( 'mm_brand' ) === 'Bluehost_India' ) ? 'https://my.bluehost.in/web-hosting/cplogin' : 'https://my.bluehost.com/web-hosting/cplogin';
Expand Down
1 change: 0 additions & 1 deletion inc/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public static function runtime() {
global $bluehost_module_container;

$runtime = array(
'isJarvis' => $bluehost_module_container->get('isJarvis'),
'plugin' => array(
'url' => BLUEHOST_BUILD_URL,
'version' => BLUEHOST_PLUGIN_VERSION,
Expand Down
2 changes: 1 addition & 1 deletion src/app/data/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NewfoldRuntime } from "@newfold-labs/wp-module-runtime";
import { getPlatformBaseUrl } from "../util/helpers";

const getSupportPhoneNumber = () => {
const brand = NewfoldRuntime.sdk.plugin.brand;
const brand = NewfoldRuntime.plugin.brand;

if ( brand === 'Bluehost_India' ) {
return '1800-419-4426';
Expand Down
2 changes: 1 addition & 1 deletion src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const AppBody = ( props ) => {
id="wppbh-app-rendered"
className={ classnames(
'wpadmin-brand-bluehost',
`wppbh-wp-${ NewfoldRuntime.sdk.wpversion }`,
`wppbh-wp-${ NewfoldRuntime.wpVersion }`,
`wppbh-page-${ kebabCase( location.pathname ) }`,
props.className,
'nfd-w-full nfd-p-4 min-[783px]:nfd-p-0'
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/home/accountCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Card, Title } from "@newfold/ui-component-library";
import { addUtmParams, getPlatformPathUrl, getPlatformBaseUrl } from "../../util/helpers";
import classNames from "classnames";

const isJarvis = NewfoldRuntime.sdk.isJarvis;
const isJarvis = NewfoldRuntime.capabilities.isJarvis;

const base = [
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/util/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ export const addUtmParams = (url, params = {}) => {
* @return {string}
*/
export const getPlatformBaseUrl = ( path = '' ) => {
const brand = NewfoldRuntime.sdk.plugin.brand;
const isJarvis = NewfoldRuntime.sdk.isJarvis;
const brand = NewfoldRuntime.plugin.brand;
const isJarvis = NewfoldRuntime.capabilities.isJarvis;

const baseUrl = () => {
if (brand === 'Bluehost_India') {
Expand Down Expand Up @@ -198,7 +198,7 @@ export const getPlatformBaseUrl = ( path = '' ) => {
* // returns https://www.bluehost.com/my-account/home if Jarvis or https://my.bluehost.com/hosting/app#home if legacy
*/
export const getPlatformPathUrl = ( jarvisPath = '', legacyPath = '' ) => {
const isJarvis = NewfoldRuntime.sdk.isJarvis;
const isJarvis = NewfoldRuntime.capabilities.isJarvis;

if (isJarvis) {
return getPlatformBaseUrl('/my-account/') + jarvisPath;
Expand Down
Loading