diff --git a/includes/Compatibility/Safe_Mode.php b/includes/Compatibility/Safe_Mode.php index e005be888..4b5d17432 100644 --- a/includes/Compatibility/Safe_Mode.php +++ b/includes/Compatibility/Safe_Mode.php @@ -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' ) ); - } /** diff --git a/includes/Compatibility/Scan.php b/includes/Compatibility/Scan.php index 1633866d0..fd37aee73 100644 --- a/includes/Compatibility/Scan.php +++ b/includes/Compatibility/Scan.php @@ -109,7 +109,5 @@ protected function evaluate() { if ( 'scan-initiated' === $this->result ) { $this->result = 'compatible'; } - } - } diff --git a/includes/Compatibility/Status.php b/includes/Compatibility/Status.php index e43a453f5..3fb074f0c 100644 --- a/includes/Compatibility/Status.php +++ b/includes/Compatibility/Status.php @@ -60,5 +60,4 @@ public static function set( $status ) { public static function reset() { \delete_option( Options::get_option_name( 'compatibility_results' ) ); } - } diff --git a/includes/ModuleController.php b/includes/ModuleController.php index 310b72fb5..f63f765d8 100644 --- a/includes/ModuleController.php +++ b/includes/ModuleController.php @@ -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 ); - } } - } /** @@ -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; } diff --git a/includes/Mustache/Mustache.php b/includes/Mustache/Mustache.php index 4c8dc9f00..5e5614d0e 100644 --- a/includes/Mustache/Mustache.php +++ b/includes/Mustache/Mustache.php @@ -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' ), ) ); } @@ -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 ); } } diff --git a/includes/RestApi/RestApiFilter.php b/includes/RestApi/RestApiFilter.php index 7bfc7eb13..16465fb60 100644 --- a/includes/RestApi/RestApiFilter.php +++ b/includes/RestApi/RestApiFilter.php @@ -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() diff --git a/includes/RestApi/SettingsController.php b/includes/RestApi/SettingsController.php index 88741ef99..8725d0bc8 100644 --- a/includes/RestApi/SettingsController.php +++ b/includes/RestApi/SettingsController.php @@ -280,7 +280,6 @@ public function get_current_settings() { } $social_data['other_social_urls'] = $filtered_social_urls; return $social_data; - } /** @@ -355,5 +354,4 @@ private function validate_twitter_id( $twitter_id, $strip_at_sign = true ) { return false; } - } diff --git a/includes/RestApi/SitePagesController.php b/includes/RestApi/SitePagesController.php index d839bf89b..e86e6286b 100644 --- a/includes/RestApi/SitePagesController.php +++ b/includes/RestApi/SitePagesController.php @@ -11,8 +11,6 @@ * Class SitePagesController */ class SitePagesController { - - /** * The namespace of this controller's route. * @@ -118,7 +116,6 @@ private function set_homepage( $homepage_pattern_slug ) { } return true; - } /** diff --git a/includes/RestApi/Themes/ApprovedThemesController.php b/includes/RestApi/Themes/ApprovedThemesController.php index d536f4f01..513e081f1 100644 --- a/includes/RestApi/Themes/ApprovedThemesController.php +++ b/includes/RestApi/Themes/ApprovedThemesController.php @@ -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'] ); diff --git a/includes/RestApi/Themes/ThemeColorsController.php b/includes/RestApi/Themes/ThemeColorsController.php index 2bb470dfb..c7b251259 100644 --- a/includes/RestApi/Themes/ThemeColorsController.php +++ b/includes/RestApi/Themes/ThemeColorsController.php @@ -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, @@ -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; } } diff --git a/includes/RestApi/Themes/ThemeFontsController.php b/includes/RestApi/Themes/ThemeFontsController.php index 354f9faf5..f482b1bf1 100644 --- a/includes/RestApi/Themes/ThemeFontsController.php +++ b/includes/RestApi/Themes/ThemeFontsController.php @@ -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, @@ -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( @@ -66,6 +66,6 @@ public function get_theme_fonts() { ); } - return $theme_font_palettes; + return $theme_font_palettes; } } diff --git a/includes/RestApi/Themes/ThemeVariationsController.php b/includes/RestApi/Themes/ThemeVariationsController.php index 1f75098ba..bd8cf8260 100644 --- a/includes/RestApi/Themes/ThemeVariationsController.php +++ b/includes/RestApi/Themes/ThemeVariationsController.php @@ -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, + ), + ); } /** @@ -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, + ), + ); } /** @@ -188,5 +188,4 @@ public function set_theme_variation( \WP_REST_Request $request ) { 'Settings parameter is found to be missing' ); } - } diff --git a/includes/Services/I18nService.php b/includes/Services/I18nService.php index c60f3a96b..d45c324f6 100644 --- a/includes/Services/I18nService.php +++ b/includes/Services/I18nService.php @@ -39,6 +39,5 @@ public static function load_js_translations( $domain, $script_slug, $languages_d $domain, $languages_dir ); - } } diff --git a/includes/Services/PluginService.php b/includes/Services/PluginService.php index 58f750539..bc29b7dbe 100644 --- a/includes/Services/PluginService.php +++ b/includes/Services/PluginService.php @@ -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; @@ -14,6 +13,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. */ @@ -120,7 +121,7 @@ public static function activate_init_plugins() { /** * Sets up a Transient to activate plugins and filter_active_plugins * - * @return boolean + * @return void */ public static function configure_activation_transient() { global $pagenow; @@ -128,6 +129,7 @@ public static function configure_activation_transient() { switch ( $pagenow ) { case 'index.php': // If the page is nfd-onboarding + // phpcs:ignore if ( isset( $_GET['page'] ) && WP_Admin::$slug === \sanitize_text_field( $_GET['page'] ) ) { if ( '1' !== get_transient( Options::get_option_name( 'filter_active_plugins' ) ) ) { set_transient( Options::get_option_name( 'filter_active_plugins' ), '1', 20 * MINUTE_IN_SECONDS ); @@ -145,13 +147,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; } ); - } } diff --git a/includes/WP_Admin.php b/includes/WP_Admin.php index 1f6c94c1e..4ce435f43 100644 --- a/includes/WP_Admin.php +++ b/includes/WP_Admin.php @@ -159,5 +159,4 @@ public static function initialize() { self::register_assets(); } - } // END /NewfoldLabs/WP/Module/Onboarding/Admin() diff --git a/includes/WP_Config.php b/includes/WP_Config.php index c12aa39d6..cbbf892ba 100644 --- a/includes/WP_Config.php +++ b/includes/WP_Config.php @@ -6,53 +6,52 @@ */ class WP_Config { - /** - * WordPress Configuration - * - * @var \WPConfigTransformer - */ - protected $wp_config; + /** + * WordPress Configuration + * + * @var \WPConfigTransformer + */ + protected $wp_config; - /** - * WP_Config constructor. - */ + /** + * WP_Config constructor. + */ public function __construct() { - $this->wp_config = new \WPConfigTransformer( ABSPATH . 'wp-config.php' ); + $this->wp_config = new \WPConfigTransformer( ABSPATH . 'wp-config.php' ); } - /** - * Adds a new constant to WordPress Configuration. - * - * @param mixed $name Name of the constant - * @param mixed $value Value of the constant - * - * @return boolean - */ + /** + * Adds a new constant to WordPress Configuration. + * + * @param mixed $name Name of the constant + * @param mixed $value Value of the constant + * + * @return boolean + */ public function add_constant( $name, $value ) { - return $this->wp_config->add( 'constant', $name, $value, array( 'raw' => true ) ); + return $this->wp_config->add( 'constant', $name, $value, array( 'raw' => true ) ); } - /** - * Updates an existing constant in WordPress Configuration. - * - * @param mixed $name Name of the constant - * @param mixed $value Value of the constant - * - * @return boolean - */ + /** + * Updates an existing constant in WordPress Configuration. + * + * @param mixed $name Name of the constant + * @param mixed $value Value of the constant + * + * @return boolean + */ public function update_constant( $name, $value ) { - return $this->wp_config->update( 'constant', $name, $value, array( 'raw' => true ) ); + return $this->wp_config->update( 'constant', $name, $value, array( 'raw' => true ) ); } - /** - * Checks if the constant already exists in the WordPress Configuration. - * - * @param mixed $name Name of the constant. - * - * @return boolean - */ + /** + * Checks if the constant already exists in the WordPress Configuration. + * + * @param mixed $name Name of the constant. + * + * @return boolean + */ public function constant_exists( $name ) { - return $this->wp_config->exists( 'constant', $name ); + return $this->wp_config->exists( 'constant', $name ); } - }