Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bradp committed Oct 2, 2024
1 parent ebd5e39 commit d137095
Show file tree
Hide file tree
Showing 31 changed files with 172 additions and 281 deletions.
13 changes: 4 additions & 9 deletions bluehost-wordpress-plugin.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php
/**
* Bluehost WordPress Plugin.
* Bluehost WordPress Plugin
*
* @package WPPluginBluehost
*
* @author Newfold Digital
* @copyright Copyright 2024 by Newfold Digital - All rights reserved.
* @license GPL-2.0-or-later
Expand Down Expand Up @@ -37,22 +36,18 @@
define( 'BLUEHOST_PLUGIN_FILE', __FILE__ );
define( 'BLUEHOST_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'BLUEHOST_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'BLUEHOST_BUILD_DIR', BLUEHOST_PLUGIN_DIR . 'build/' . BLUEHOST_PLUGIN_VERSION );
define( 'BLUEHOST_BUILD_URL', BLUEHOST_PLUGIN_URL . 'build/' . BLUEHOST_PLUGIN_VERSION );
if ( ! defined( 'NFD_HIIVE_URL' ) ) {
define( 'NFD_HIIVE_URL', 'https://hiive.cloud/api' );
}

// Load alternate experience and short-circuit plugin functionality.
if ( defined( 'BURST_SAFETY_MODE' ) && BURST_SAFETY_MODE ) {

// Load alternate experience
require __DIR__ . '/inc/alt-experience/init.php';

// Short-circuit all plugin functionality
return;
}

define( 'BLUEHOST_BUILD_DIR', BLUEHOST_PLUGIN_DIR . 'build/' . BLUEHOST_PLUGIN_VERSION );
define( 'BLUEHOST_BUILD_URL', BLUEHOST_PLUGIN_URL . 'build/' . BLUEHOST_PLUGIN_VERSION );

global $pagenow;
if ( 'plugins.php' === $pagenow ) {

Expand Down
40 changes: 15 additions & 25 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
<?php
/**
* Plugin bootstrap file.
* Plugin bootstrap file
*
* @package WPPluginBluehost
*/

namespace Bluehost;

use NewfoldLabs\WP\Context\Context;
use WP_Forge\WPUpdateHandler\PluginUpdater;
use WP_Forge\UpgradeHandler\UpgradeHandler;
use NewfoldLabs\WP\ModuleLoader\Container;
use NewfoldLabs\WP\ModuleLoader\Plugin;
<<<<<<< HEAD
use WP_Forge\UpgradeHandler\UpgradeHandler;
use WP_Forge\WPUpdateHandler\PluginUpdater;
||||||| 72e3d866bcfe
use NewfoldLabs\WP\Context\Context;
use function NewfoldLabs\WP\ModuleLoader\container as setContainer;
use function NewfoldLabs\WP\Context\setContext;
=======
use NewfoldLabs\WP\Context\Context;
use NewfoldLabs\WP\Module\Features\Features;
use function NewfoldLabs\WP\ModuleLoader\container as setContainer;
use function NewfoldLabs\WP\Context\setContext;
>>>>>>> main
use function NewfoldLabs\WP\Context\getContext;
use function NewfoldLabs\WP\Context\setContext;
use function NewfoldLabs\WP\ModuleLoader\container as setContainer;

// Composer autoloader
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
Expand Down Expand Up @@ -95,8 +85,8 @@ function () {
);

// Properly get branding links depending on market
$wordpress_hosting_page = ( 'Bluehost_India' === get_option( 'mm_brand' ) ) ? 'https://www.bluehost.in?utm_source=coming-soon-template&amp;utm_medium=bluehost_plugin' : 'https://bluehost.com?utm_source=coming-soon-template&amp;utm_medium=bluehost_plugin';
$my_panel = ( 'Bluehost_India' === get_option( 'mm_brand' ) ) ? 'https://my.bluehost.in/web-hosting/cplogin' : 'https://my.bluehost.com/web-hosting/cplogin';
$wordpress_hosting_page = ( get_option( 'mm_brand' ) === 'Bluehost_India' ) ? 'https://www.bluehost.in?utm_source=coming-soon-template&amp;utm_medium=bluehost_plugin' : 'https://bluehost.com?utm_source=coming-soon-template&amp;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';
$website_guide_link = 'https://www.bluehost.com/blog/how-to-create-a-website-guide/';
$migrate_link = 'https://www.bluehost.com/blog/how-to-migrate-a-wordpress-website-to-a-new-server/';
$hosting_link = 'https://www.bluehost.com/hosting/shared';
Expand All @@ -108,16 +98,16 @@ function () {
'admin_app_url' => admin_url( 'admin.php?page=bluehost#/home' ),
'template_h1' => __( 'Coming Soon!', 'wp-plugin-bluehost' ),
'template_h2' => __( 'A New WordPress Site', 'wp-plugin-bluehost' ),
'template_coming_soon_links'
=> '<a href="' . esc_url( $website_guide_link ) . '" target="_blank" rel="noopener noreferrer nofollow">'
. __( 'How to Build a Website: A Practical Guide to WordPress on Bluehost', 'wp-plugin-bluehost' )
. '</a><br/>'
. '<a href="' . esc_url( $migrate_link ) . '" target="_blank" rel="noopener noreferrer nofollow">'
. __( 'How to Migrate a Website to Bluehost?', 'wp-plugin-bluehost' )
. '</a><br/>'
. '<a href="' . esc_url( $hosting_link ) . '" target="_blank" rel="noopener noreferrer nofollow">'
. __( 'Why choose Bluehost for your WordPress site?', 'wp-plugin-bluehost' )
. '</a><br/>',
'template_coming_soon_links' =>
'<a href="' . esc_url( $website_guide_link ) . '" target="_blank" rel="noopener noreferrer nofollow">' .
__( 'How to Build a Website: A Practical Guide to WordPress on Bluehost', 'wp-plugin-bluehost' ) .
'</a><br/>' .
'<a href="' . esc_url( $migrate_link ) . '" target="_blank" rel="noopener noreferrer nofollow">' .
__( 'How to Migrate a Website to Bluehost?', 'wp-plugin-bluehost' ) .
'</a><br/>' .
'<a href="' . esc_url( $hosting_link ) . '" target="_blank" rel="noopener noreferrer nofollow">' .
__( 'Why choose Bluehost for your WordPress site?', 'wp-plugin-bluehost' ) .
'</a><br/>',
'template_footer_t' => sprintf(
/* translators: %1$s is replaced with opening link tag taking you to bluehost.com/wordpress, %2$s is replaced with closing link tag, %3$s is replaced with opening link tag taking you to login page, %4$s is replaced with closing link tag, %5$s is replaced with opening link tag taking you to my.bluehost.com, %6$s is replaced with closing link tag */
esc_html__( 'A %1$sBluehost%2$s powered website. Is this your website? Log in to %3$sWordPress%4$s or %5$sBluehost%6$s.', 'wp-plugin-bluehost' ) . '&nbsp;',
Expand Down
114 changes: 27 additions & 87 deletions inc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use function NewfoldLabs\WP\Module\Features\isEnabled;

/**
* \Bluehost\Admin.
* \Bluehost\Admin
*/
final class Admin {

Expand All @@ -37,20 +37,14 @@ public function __construct() {
\add_filter( 'newfold_runtime', [ __CLASS__, 'add_to_runtime' ] );

if ( isset( $_GET['page'] ) && strpos( filter_input( INPUT_GET, 'page', FILTER_UNSAFE_RAW ), 'bluehost' ) >= 0 ) { // phpcs:ignore
<<<<<<< HEAD
\add_action( 'admin_footer_text', [ __CLASS__, 'add_brand_to_admin_footer' ] );
||||||| 72e3d866bcfe
\add_action( 'admin_footer_text', array( __CLASS__, 'add_brand_to_admin_footer' ) );
=======
\add_action( 'admin_footer_text', array( __CLASS__, 'add_brand_to_admin_footer' ) );
/* Disable admin notices on App pages */
\add_action( 'admin_init', array( __CLASS__, 'disable_admin_notices' ) );
>>>>>>> main
\add_action( 'admin_init', [ __CLASS__, 'disable_admin_notices' ] );
}
}

/**
* Add to runtime.
* Add to runtime
*
* @param Array $sdk - The runtime array
*
Expand All @@ -72,84 +66,34 @@ public static function add_to_runtime( $sdk ) {
public static function subpages() {
global $bluehost_module_container;

<<<<<<< HEAD
$home = [
||||||| 72e3d866bcfe
$home = array(
=======
$home = array(
>>>>>>> main
$home = [
'bluehost#/home' => __( 'Home', 'wp-plugin-bluehost' ),
<<<<<<< HEAD
];
$store = [
||||||| 72e3d866bcfe
);
$store = array(
=======
);
$pagesAndPosts = array(
$pagesAndPosts = [
'bluehost#/pages-and-posts' => __( 'Pages & Posts', 'wp-plugin-bluehost' ),
);
$store = array(
>>>>>>> main
];
$store = [
'bluehost#/store' => __( 'Store', 'wp-plugin-bluehost' ),
<<<<<<< HEAD
];
$marketplace = [
||||||| 72e3d866bcfe
);
$marketplace = array(
=======
);
$marketplace = array(
>>>>>>> main
$marketplace = [
'bluehost#/marketplace' => __( 'Marketplace', 'wp-plugin-bluehost' ),
<<<<<<< HEAD
];
$performance = [
'bluehost#/performance' => __( 'Performance', 'wp-plugin-bluehost' ),
];
$settings = [
||||||| 72e3d866bcfe
);
$performance = array(
'bluehost#/performance' => __( 'Performance', 'wp-plugin-bluehost' ),
);
$settings = array(
=======
);
// add performance if enabled
$performance = isEnabled( 'performance' )
? array(
? [
'bluehost#/performance' => __( 'Performance', 'wp-plugin-bluehost' ),
)
: array();
$settings = array(
>>>>>>> main
]
: [];
$settings = [
'bluehost#/settings' => __( 'Settings', 'wp-plugin-bluehost' ),
<<<<<<< HEAD
];
$staging = [
'bluehost#/staging' => __( 'Staging', 'wp-plugin-bluehost' ),
];
$help = [
||||||| 72e3d866bcfe
);
$staging = array(
'bluehost#/staging' => __( 'Staging', 'wp-plugin-bluehost' ),
);
$help = array(
=======
);
// add staging if enabled
$staging = isEnabled( 'staging' )
? array(
? [
'bluehost#/staging' => __( 'Staging', 'wp-plugin-bluehost' ),
)
: array();
$help = array(
>>>>>>> main
]
: [];
$help = [
'bluehost#/help' => __( 'Help', 'wp-plugin-bluehost' ),
];

Expand All @@ -167,7 +111,7 @@ public static function subpages() {

/**
* Add inline script to admin screens
* - hide extra link in subnav.
* - hide extra link in subnav
*/
public static function admin_nav_style() {
echo '<style>';
Expand All @@ -180,6 +124,8 @@ public static function admin_nav_style() {

/**
* Add WordPress Page to Appearance submenu.
*
* @return void
*/
public static function page() {
$bluehost_icon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+CiAgICA8cGF0aCBmaWxsPSIjYTdhYWFkIiBkPSJNNCA0aDguOTMzdjguOTIzSDRWNFptMTEuNTMgMGg4Ljk0djguOTIzaC04Ljk0VjRabTExLjUzMSAwSDM2djguOTIzaC04LjkzOVY0Wk00IDE1LjUzOGg4LjkzM3Y4LjkyNEg0di04LjkyNFptMTEuNTMgMGg4Ljk0djguOTI0aC04Ljk0di04LjkyNFptMTEuNTMxIDBIMzZ2OC45MjRoLTguOTM5di04LjkyNFpNNCAyNy4wNzdoOC45MzNWMzZINHYtOC45MjNabTExLjUzIDBoOC45NFYzNmgtOC45NHYtOC45MjNabTExLjUzMSAwSDM2VjM2aC04LjkzOXYtOC45MjNaIi8+Cjwvc3ZnPg==';
Expand Down Expand Up @@ -211,6 +157,8 @@ public static function page() {

/**
* Render DOM element for React to load onto.
*
* @return void
*/
public static function render() {
global $wp_version;
Expand Down Expand Up @@ -239,6 +187,8 @@ public static function render() {
* Load Page Scripts & Styles.
*
* @param String $hook - The hook name
*
* @return void
*/
public static function assets( $hook ) {

Expand All @@ -256,13 +206,7 @@ public static function assets( $hook ) {
\wp_register_script(
'bluehost-script',
BLUEHOST_BUILD_URL . '/index.js',
<<<<<<< HEAD
array_merge( $asset['dependencies'], [ 'nfd-runtime' ] ),
||||||| 72e3d866bcfe
array_merge( $asset['dependencies'], array( 'nfd-runtime' ) ),
=======
array_merge( $asset['dependencies'], array( 'newfold-features', 'nfd-runtime' ) ),
>>>>>>> main
array_merge( $asset['dependencies'], [ 'newfold-features', 'nfd-runtime' ] ),
$asset['version'],
true
);
Expand Down Expand Up @@ -301,7 +245,9 @@ public static function assets( $hook ) {
}

/**
* Load text domain for plugin.
* Load text domain for plugin
*
* @return void
*/
public static function load_text_domain() {

Expand Down Expand Up @@ -336,11 +282,6 @@ public static function actions( $actions ) {
}

/**
<<<<<<< HEAD
* Filter WordPress Admin Footer Text "Thank you for creating with...".
||||||| 72e3d866bcfe
* Filter WordPress Admin Footer Text "Thank you for creating with..."
=======
* Disable admin notices on App pages
*
* @return void
Expand All @@ -352,7 +293,6 @@ public static function disable_admin_notices() {

/**
* Filter WordPress Admin Footer Text "Thank you for creating with..."
>>>>>>> main
*
* @param string $footer_text footer text
*
Expand Down
2 changes: 1 addition & 1 deletion inc/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
final class Data {

/**
* Data loaded onto window.NewfoldRuntime.
* Data loaded onto window.NewfoldRuntime
*
* @return array
*/
Expand Down
2 changes: 1 addition & 1 deletion inc/LoginRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Bluehost;

/**
* Class LoginRedirect.
* Class LoginRedirect
*
* @package Bluehost
*/
Expand Down
6 changes: 3 additions & 3 deletions inc/RestApi/CachingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use function NewfoldLabs\WP\ModuleLoader\container;

/**
* Class CachingController.
* Class CachingController
*/
class CachingController extends \WP_REST_Controller {

Expand All @@ -25,7 +25,7 @@ public function __construct() {
}

/**
* Registers the settings route.
* Registers the settings route
*/
public function register_routes() {

Expand All @@ -41,7 +41,7 @@ public function register_routes() {
}

/**
* Clears the entire cache.
* Clears the entire cache
*/
public function purge_all() {

Expand Down
6 changes: 3 additions & 3 deletions inc/RestApi/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use function NewfoldLabs\WP\ModuleLoader\container;

/**
* Class SettingsController.
* Class SettingsController
*/
class SettingsController extends \WP_REST_Controller {

Expand All @@ -17,7 +17,7 @@ class SettingsController extends \WP_REST_Controller {
protected $namespace = 'bluehost/v1';

/**
* Registers the settings route.
* Registers the settings route
*/
public function register_routes() {

Expand Down Expand Up @@ -145,7 +145,7 @@ public function update_item( $request ) {
}

/**
* Retrieve the existing saved array of settings.
* Retrieve the existing saved array of settings
*
* @return array $settings List of the settings and their values
*/
Expand Down
Loading

0 comments on commit d137095

Please sign in to comment.