diff --git a/bluehost-wordpress-plugin.php b/bluehost-wordpress-plugin.php
index c9b2eb74a..587976c03 100644
--- a/bluehost-wordpress-plugin.php
+++ b/bluehost-wordpress-plugin.php
@@ -1,9 +1,8 @@
>>>>>> 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' ) ) {
@@ -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&utm_medium=bluehost_plugin' : 'https://bluehost.com?utm_source=coming-soon-template&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&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';
$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';
@@ -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'
- => ''
- . __( 'How to Build a Website: A Practical Guide to WordPress on Bluehost', 'wp-plugin-bluehost' )
- . '
'
- . ''
- . __( 'How to Migrate a Website to Bluehost?', 'wp-plugin-bluehost' )
- . '
'
- . ''
- . __( 'Why choose Bluehost for your WordPress site?', 'wp-plugin-bluehost' )
- . '
',
+ 'template_coming_soon_links' =>
+ '' .
+ __( 'How to Build a Website: A Practical Guide to WordPress on Bluehost', 'wp-plugin-bluehost' ) .
+ '
' .
+ '' .
+ __( 'How to Migrate a Website to Bluehost?', 'wp-plugin-bluehost' ) .
+ '
' .
+ '' .
+ __( 'Why choose Bluehost for your WordPress site?', 'wp-plugin-bluehost' ) .
+ '
',
'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' ) . ' ',
diff --git a/inc/Admin.php b/inc/Admin.php
index c2722b490..f18f3bf1b 100644
--- a/inc/Admin.php
+++ b/inc/Admin.php
@@ -11,7 +11,7 @@
use function NewfoldLabs\WP\Module\Features\isEnabled;
/**
- * \Bluehost\Admin.
+ * \Bluehost\Admin
*/
final class Admin {
@@ -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
*
@@ -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' ),
];
@@ -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 '';
- echo file_get_contents( __DIR__ . '/index.html' );
+ $version = BLUEHOST_PLUGIN_VERSION;
+ $asset_file = BLUEHOST_BUILD_DIR . '/index.asset.php';
+ if ( is_readable( $asset_file ) ) {
+ $asset = include_once $asset_file;
+ $version = $asset['version'];
+ }
+
+ wp_enqueue_style(
+ 'bluehost-style',
+ BLUEHOST_BUILD_URL . '/index.css',
+ [ 'wp-components' ],
+ $version
+ );
+
+ echo file_get_contents( __DIR__ . '/index.html' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
},
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+CiAgICA8cGF0aCBmaWxsPSIjYTdhYWFkIiBkPSJNNCA0aDguOTMzdjguOTIzSDRWNFptMTEuNTMgMGg4Ljk0djguOTIzaC04Ljk0VjRabTExLjUzMSAwSDM2djguOTIzaC04LjkzOVY0Wk00IDE1LjUzOGg4LjkzM3Y4LjkyNEg0di04LjkyNFptMTEuNTMgMGg4Ljk0djguOTI0aC04Ljk0di04LjkyNFptMTEuNTMxIDBIMzZ2OC45MjRoLTguOTM5di04LjkyNFpNNCAyNy4wNzdoOC45MzNWMzZINHYtOC45MjNabTExLjUzIDBoOC45NFYzNmgtOC45NHYtOC45MjNabTExLjUzMSAwSDM2VjM2aC04LjkzOXYtOC45MjNaIi8+Cjwvc3ZnPg==',
1
diff --git a/inc/base.php b/inc/base.php
index 7e9779354..42a0ca070 100644
--- a/inc/base.php
+++ b/inc/base.php
@@ -1,6 +1,6 @@
conflicts, 'slug' );
@@ -226,7 +225,7 @@ public function deactivate() {
}
/**
- * Display error messages in the admin.
+ * Display error messages in the admin
*/
public function admin_notices() {
$conflict_errors = array_column( $this->conflicts, 'error' );
diff --git a/inc/plugin-php-compat-check.php b/inc/plugin-php-compat-check.php
index cc7c7e8a9..cf84a76c9 100644
--- a/inc/plugin-php-compat-check.php
+++ b/inc/plugin-php-compat-check.php
@@ -8,63 +8,63 @@
namespace Bluehost;
/**
- * Class Plugin_PHP_Compat_Check.
+ * Class Plugin_PHP_Compat_Check
*
* This class is responsible for performing basic checks to see if the minimum requirements for the plugin have been met.
*/
class Plugin_PHP_Compat_Check {
/**
- * Callbacks for additional checks.
+ * Callbacks for additional checks
*
* @var array
*/
public $callbacks = [];
/**
- * Collection of errors.
+ * Collection of errors
*
* @var \WP_Error
*/
public $errors;
/**
- * A reference to the main plugin file.
+ * A reference to the main plugin file
*
* @var string
*/
public $file;
/**
- * Minimum PHP version required for this plugin.
+ * Minimum PHP version required for this plugin
*
* @var string
*/
public $min_php_version;
/**
- * Minimum WordPress version required for this plugin.
+ * Minimum WordPress version required for this plugin
*
* @var string
*/
public $min_wp_version;
/**
- * Plugin name.
+ * Plugin name
*
* @var string
*/
public $name = '';
/**
- * Required PHP extensions.
+ * Required PHP extensions
*
* @var array
*/
public $req_php_extensions = [];
/**
- * Setup our class properties.
+ * Setup our class properties
*
* @param string $file Plugin file
*/
@@ -75,7 +75,7 @@ public function __construct( $file ) {
}
/**
- * Get the plugin name from the plugin file headers.
+ * Get the plugin name from the plugin file headers
*
* @return string
*/
@@ -115,7 +115,7 @@ public function check_plugin_requirements() {
}
/**
- * Check if the minimum required PHP version is available.
+ * Check if the minimum required PHP version is available
*/
public function check_has_min_php_version() {
if ( version_compare( PHP_VERSION, $this->min_php_version, '<' ) ) {
@@ -143,7 +143,7 @@ public function check_has_required_php_extensions() {
}
/**
- * Check if the minimum required WordPress version is available.
+ * Check if the minimum required WordPress version is available
*/
public function check_has_min_wp_version() {
global $wp_version;
@@ -162,7 +162,7 @@ public function check_has_min_wp_version() {
}
/**
- * Check if any errors were encountered during our plugin checks.
+ * Check if any errors were encountered during our plugin checks
*
* @return bool
*/
@@ -171,7 +171,7 @@ public function has_errors() {
}
/**
- * Deactivate the plugin.
+ * Deactivate the plugin
*/
public function deactivate() {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
@@ -181,7 +181,7 @@ public function deactivate() {
}
/**
- * Display error messages in the admin.
+ * Display error messages in the admin
*/
public function admin_notices() {
echo '
{ error && error.message ? error.message : '' } { error && error.data - ? __( ' Error code: ', 'wp-plugin-bluehost' ) + + ? __( 'Error code:', 'wp-plugin-bluehost' ) + + ' ' + error.data.status : '' }
diff --git a/src/app/pages/home/myProductsSection.js b/src/app/pages/home/myProductsSection.js index 39be23d3e..c379d7970 100644 --- a/src/app/pages/home/myProductsSection.js +++ b/src/app/pages/home/myProductsSection.js @@ -1,3 +1,4 @@ +/* eslint-disable @wordpress/i18n-no-flanking-whitespace */ import apiFetch from '@wordpress/api-fetch'; import { useState, useEffect } from '@wordpress/element'; import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime'; diff --git a/src/app/pages/settings/commentSettings.js b/src/app/pages/settings/commentSettings.js index 947542532..d28253e95 100644 --- a/src/app/pages/settings/commentSettings.js +++ b/src/app/pages/settings/commentSettings.js @@ -1,3 +1,4 @@ +/* global sprintf */ import { useState } from '@wordpress/element'; import { useUpdateEffect } from 'react-use'; import { @@ -9,7 +10,6 @@ import { import AppStore from '../../data/store'; import { bluehostSettingsApiFetch } from '../../util/helpers'; import { useNotification } from 'App/components/notifications'; - const OldPostsComments = ( { setError, notify } ) => { const { store, setStore } = useContext( AppStore ); const [ disableCommentsOldPosts, setDisableCommentsOldPosts ] = useState( @@ -78,37 +78,32 @@ const CloseCommentsDays = ( { setError, notify } ) => { ); const closeCommentsDaysNoticeTitle = () => { - return __( 'Comments setting saved ', 'wp-plugin-bluehost' ); + return __( 'Comments setting saved', 'wp-plugin-bluehost' ); }; const closeCommentsDaysNoticeText = () => { - //`Comments on posts are disabled after ${closeCommentsDays} days.` - return ( - __( - 'Comments on posts are disabled after ', - 'wp-plugin-bluehost' - ) + - closeCommentsDays + + return sprintf( + //translators: %s: number of days. `Comments on posts are disabled after ${closeCommentsDays} days.` _n( - ' day.', - ' days.', + 'Comments on posts are disabled after %s day.', + 'Comments on posts are disabled after %s days.', parseInt( closeCommentsDays ), 'wp-plugin-bluehost' - ) + ), + closeCommentsDays ); }; const closeCommentsDaysLabelText = () => { - //`Close comments after ${closeCommentsDays} days.` - return ( - __( 'Close comments after ', 'wp-plugin-bluehost' ) + - closeCommentsDays + + return sprintf( + //translators: %s: number of days. `Close comments after ${closeCommentsDays} days.` _n( - ' day.', - ' days.', + 'Close comments after %s day.', + 'Close comments after %s days.', parseInt( closeCommentsDays ), 'wp-plugin-bluehost' - ) + ), + closeCommentsDays ); }; @@ -178,16 +173,15 @@ const CommentsPerPage = ( { setError, notify } ) => { }; const commentsPerPageNoticeText = () => { - //`Posts will display ${commentsPerPage} comments at a time.` - return ( - __( 'Posts will display ', 'wp-plugin-bluehost' ) + - commentsPerPage + + return sprintf( + //translators: %s: number of comments. `Posts will display ${commentsPerPage} comments at a time.` _n( - ' comment at a time.', - ' comments at a time.', + 'Posts will display %s comment at a time.', + 'Posts will display %s comments at a time.', parseInt( commentsPerPage ), 'wp-plugin-bluehost' - ) + ), + commentsPerPage ); }; diff --git a/src/app/pages/settings/contentSettings.js b/src/app/pages/settings/contentSettings.js index 570824c1b..c4239ab08 100644 --- a/src/app/pages/settings/contentSettings.js +++ b/src/app/pages/settings/contentSettings.js @@ -1,3 +1,4 @@ +/* global sprintf */ import { useState } from '@wordpress/element'; import { useUpdateEffect } from 'react-use'; import { Alert, Container, SelectField } from '@newfold/ui-component-library'; @@ -13,22 +14,19 @@ const EmptyTrash = ( { setError, notify } ) => { let numTrashWeeks = Math.floor( emptyTrashDays / 7 ); const emptyTrashNoticeTitle = () => { - return __( 'Trash setting saved ', 'wp-plugin-bluehost' ); + return __( 'Trash setting saved', 'wp-plugin-bluehost' ); }; const emptyTrashNoticeText = () => { - return ( - __( - 'The trash will automatically empty every ', - 'wp-plugin-bluehost' - ) + - numTrashWeeks + + return sprintf( + //translators: %s: number of weeks. `The trash will automatically empty every ${numTrashWeeks} weeks.` _n( - ' week.', - ' weeks.', + 'The trash will automatically empty every %s week.', + 'The trash will automatically empty every %s weeks.', parseInt( numTrashWeeks ), 'wp-plugin-bluehost' - ) + ), + numTrashWeeks ); }; @@ -66,22 +64,10 @@ const EmptyTrash = ( { setError, notify } ) => {