From 8ee0fa3bf07f75f323527f32a491da11f8c25317 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Wed, 27 Nov 2024 11:21:53 +0530 Subject: [PATCH 1/3] Remove WP 6.7 related changes --- obfx_modules/companion-legacy/init.php | 6 +++--- obfx_modules/custom-fonts/init.php | 2 +- themeisle-companion.php | 7 +------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/obfx_modules/companion-legacy/init.php b/obfx_modules/companion-legacy/init.php index 343cc056..76c1e612 100644 --- a/obfx_modules/companion-legacy/init.php +++ b/obfx_modules/companion-legacy/init.php @@ -300,8 +300,8 @@ public function hooks() { } if ( $this->is_hestia() ) { - $this->hestia_require(); - $this->hestia_fix_duplicate_widgets(); + $this->loader->add_action( 'after_setup_theme', $this, 'hestia_require' ); + $this->loader->add_action( 'after_setup_theme', $this, 'hestia_fix_duplicate_widgets' ); $this->loader->add_action( 'wp_enqueue_scripts', $this, 'hestia_enqueue_clients_style' ); $this->loader->add_filter( 'hestia_clients_bar_default_content', $this, 'hestia_load_clients_default_content' ); $this->loader->add_filter( 'hestia_top_bar_alignment_default', $this, 'hestia_top_bar_default_alignment' ); @@ -310,7 +310,7 @@ public function hooks() { } if ( $this->is_hestia_pro() ) { - $this->hestia_fix_duplicate_widgets(); + $this->loader->add_action( 'after_setup_theme', $this, 'hestia_fix_duplicate_widgets' ); $this->loader->add_filter( 'hestia_clients_bar_default_content', $this, 'hestia_load_clients_default_content' ); $this->loader->add_filter( 'hestia_top_bar_alignment_default', $this, 'hestia_top_bar_default_alignment' ); } diff --git a/obfx_modules/custom-fonts/init.php b/obfx_modules/custom-fonts/init.php index c1c01dc2..83510e5a 100644 --- a/obfx_modules/custom-fonts/init.php +++ b/obfx_modules/custom-fonts/init.php @@ -63,7 +63,7 @@ public function hooks() { $this->loader->add_action( 'admin_enqueue_scripts', $this, 'enqueue_media_scripts' ); $admin_instance = new Custom_Fonts_Admin(); - $admin_instance->create_taxonomy(); + $this->loader->add_action( 'init', $admin_instance, 'create_taxonomy' ); $this->loader->add_action( 'admin_menu', $admin_instance, 'add_to_menu' ); $this->loader->add_action( 'admin_head', $admin_instance, 'edit_custom_font_form' ); $this->loader->add_filter( 'manage_edit-obfx_custom_fonts_columns', $admin_instance, 'manage_columns' ); diff --git a/themeisle-companion.php b/themeisle-companion.php index 7282cac9..69cea0be 100644 --- a/themeisle-companion.php +++ b/themeisle-companion.php @@ -111,9 +111,4 @@ function() { */ spl_autoload_register( array( 'Autoloader', 'loader' ) ); -/** - * The start of the app. - * - * @since 1.0.0 - */ -add_action( 'init', 'run_orbit_fox' ); +run_orbit_fox(); From a0f2f9d1208d6dd266bc53b3206c2e1789eca1dc Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Wed, 27 Nov 2024 13:00:04 +0530 Subject: [PATCH 2/3] Fix textdomain loading issue with WP 6.7 --- .../abstract/class-orbit-fox-module-abstract.php | 9 +++++++++ obfx_modules/beaver-widgets/init.php | 11 ++++++++++- obfx_modules/companion-legacy/init.php | 8 +++++++- obfx_modules/custom-fonts/init.php | 13 +++++++++++-- obfx_modules/elementor-widgets/init.php | 12 ++++++++++-- obfx_modules/google-analytics/init.php | 6 ++---- obfx_modules/header-footer-scripts/init.php | 12 ++++++++++-- obfx_modules/menu-icons/init.php | 13 +++++++++++-- obfx_modules/mystock-import/init.php | 11 ++++++++++- obfx_modules/policy-notice/init.php | 7 ++----- obfx_modules/social-sharing/init.php | 6 ++---- obfx_modules/template-directory/init.php | 13 +++++++++++-- 12 files changed, 95 insertions(+), 26 deletions(-) diff --git a/core/app/abstract/class-orbit-fox-module-abstract.php b/core/app/abstract/class-orbit-fox-module-abstract.php index 6ddd0b5b..7598fbb4 100644 --- a/core/app/abstract/class-orbit-fox-module-abstract.php +++ b/core/app/abstract/class-orbit-fox-module-abstract.php @@ -167,6 +167,7 @@ public function __construct() { */ public function register_loader( Orbit_Fox_Loader $loader ) { $this->loader = $loader; + $this->loader->add_action( 'init', $this, 'set_module_strings' ); $this->loader->add_action( $this->get_slug() . '_activate', $this, 'activate' ); $this->loader->add_action( $this->get_slug() . '_deactivate', $this, 'deactivate' ); } @@ -824,4 +825,12 @@ protected function check_new_user( $option_name = 'obfx_new_user' ) { update_option( $option_name, 'no' ); return false; } + + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { + } } diff --git a/obfx_modules/beaver-widgets/init.php b/obfx_modules/beaver-widgets/init.php index c9c5d1d8..bbdfcb87 100644 --- a/obfx_modules/beaver-widgets/init.php +++ b/obfx_modules/beaver-widgets/init.php @@ -24,9 +24,18 @@ class Beaver_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract { */ public function __construct() { parent::__construct(); + + $this->active_default = true; + } + + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { $this->name = __( 'Page builder widgets', 'themeisle-companion' ); $this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' ); - $this->active_default = true; } /** diff --git a/obfx_modules/companion-legacy/init.php b/obfx_modules/companion-legacy/init.php index 76c1e612..2ba4eabf 100644 --- a/obfx_modules/companion-legacy/init.php +++ b/obfx_modules/companion-legacy/init.php @@ -29,7 +29,14 @@ public function __construct() { parent::__construct(); $this->active_default = true; + } + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { $this->inc_dir = $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR; if ( ! defined( 'THEMEISLE_COMPANION_PATH' ) ) { define( 'THEMEISLE_COMPANION_PATH', $this->inc_dir ); @@ -47,7 +54,6 @@ public function __construct() { require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'functions.php'; } - if ( $this->is_hestia() ) { require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'functions.php'; require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php'; diff --git a/obfx_modules/custom-fonts/init.php b/obfx_modules/custom-fonts/init.php index 83510e5a..9389aaeb 100644 --- a/obfx_modules/custom-fonts/init.php +++ b/obfx_modules/custom-fonts/init.php @@ -27,12 +27,21 @@ class Custom_Fonts_OBFX_Module extends Orbit_Fox_Module_Abstract { */ public function __construct() { parent::__construct(); - $this->name = __( 'Custom fonts', 'themeisle-companion' ); - $this->description = __( 'Upload custom fonts and use them anywhere on your site.', 'themeisle-companion' ); + $this->active_default = false; $this->refresh_after_enabled = true; } + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { + $this->name = __( 'Custom fonts', 'themeisle-companion' ); + $this->description = __( 'Upload custom fonts and use them anywhere on your site.', 'themeisle-companion' ); + } + /** * Determine if module should be loaded. * diff --git a/obfx_modules/elementor-widgets/init.php b/obfx_modules/elementor-widgets/init.php index 3fb5bac2..d6afd792 100644 --- a/obfx_modules/elementor-widgets/init.php +++ b/obfx_modules/elementor-widgets/init.php @@ -29,6 +29,16 @@ class Elementor_Widgets_OBFX_Module extends Orbit_Fox_Module_Abstract { */ public function __construct() { parent::__construct(); + + $this->active_default = true; + } + + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { $this->name = __( 'Page builder widgets', 'themeisle-companion' ); $this->description = __( 'Adds widgets to the most popular builders: Elementor or Beaver. More to come!', 'themeisle-companion' ); @@ -60,8 +70,6 @@ public function __construct() { '; } - - $this->active_default = true; } /** diff --git a/obfx_modules/google-analytics/init.php b/obfx_modules/google-analytics/init.php index 37525f39..2344c84a 100644 --- a/obfx_modules/google-analytics/init.php +++ b/obfx_modules/google-analytics/init.php @@ -21,13 +21,11 @@ class Google_Analytics_OBFX_Module extends Orbit_Fox_Module_Abstract { private $api_url = 'https://analytics.orbitfox.com/api/pirate-bridge/v1'; /** - * Test_OBFX_Module constructor. + * Setup module strings * - * @since 4.0.3 * @access public */ - public function __construct() { - parent::__construct(); + public function set_module_strings() { $this->name = __( 'Analytics Integration', 'themeisle-companion' ); $this->description = __( 'A module to integrate Google Analytics into your site easily.', 'themeisle-companion' ); } diff --git a/obfx_modules/header-footer-scripts/init.php b/obfx_modules/header-footer-scripts/init.php index a4bf9af7..773a1cea 100644 --- a/obfx_modules/header-footer-scripts/init.php +++ b/obfx_modules/header-footer-scripts/init.php @@ -27,10 +27,18 @@ class Header_Footer_Scripts_OBFX_Module extends Orbit_Fox_Module_Abstract { */ public function __construct() { parent::__construct(); - $this->name = __( 'Header Footer Scripts', 'themeisle-companion' ); - $this->description = __( 'An easy way to add scripts, such as tracking and analytics scripts, to the header and footer of your website, as well as in the body of your posts and pages.', 'themeisle-companion' ); $this->active_default = true; + } + + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { + $this->name = __( 'Header Footer Scripts', 'themeisle-companion' ); + $this->description = __( 'An easy way to add scripts, such as tracking and analytics scripts, to the header and footer of your website, as well as in the body of your posts and pages.', 'themeisle-companion' ); $this->meta_controls = array( 'obfx-header-scripts' => array( 'type' => 'textarea', diff --git a/obfx_modules/menu-icons/init.php b/obfx_modules/menu-icons/init.php index 5bc94c5a..31248bea 100644 --- a/obfx_modules/menu-icons/init.php +++ b/obfx_modules/menu-icons/init.php @@ -30,13 +30,22 @@ class Menu_Icons_OBFX_Module extends Orbit_Fox_Module_Abstract { */ public function __construct() { parent::__construct(); - $this->name = __( 'Menu Icons', 'themeisle-companion' ); - $this->description = __( 'Module to define menu icons for navigation.', 'themeisle-companion' ); + $this->active_default = true; add_action( 'admin_init', array( $this, 'check_conflict' ), 99 ); } + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { + $this->name = __( 'Menu Icons', 'themeisle-companion' ); + $this->description = __( 'Module to define menu icons for navigation.', 'themeisle-companion' ); + } + /** * Determine if module should be loaded. diff --git a/obfx_modules/mystock-import/init.php b/obfx_modules/mystock-import/init.php index 25cf7dcd..12035adf 100644 --- a/obfx_modules/mystock-import/init.php +++ b/obfx_modules/mystock-import/init.php @@ -53,9 +53,18 @@ class Mystock_Import_OBFX_Module extends Orbit_Fox_Module_Abstract { */ public function __construct() { parent::__construct(); + + $this->active_default = true; + } + + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { $this->name = __( 'Mystock Import', 'themeisle-companion' ); $this->description = __( 'Module to import images directly from', 'themeisle-companion' ) . sprintf( ' mystock.photos', 'https://mystock.photos' ); - $this->active_default = true; } diff --git a/obfx_modules/policy-notice/init.php b/obfx_modules/policy-notice/init.php index 16f06c09..ddcc3fe5 100644 --- a/obfx_modules/policy-notice/init.php +++ b/obfx_modules/policy-notice/init.php @@ -17,14 +17,11 @@ class Policy_Notice_OBFX_Module extends Orbit_Fox_Module_Abstract { /** - * Test_OBFX_Module constructor. + * Setup module strings * - * @since 1.0.0 * @access public */ - public function __construct() { - parent::__construct(); - + public function set_module_strings() { $this->name = __( 'Policy Notice', 'themeisle-companion' ); $this->description = __( 'A simple notice bar which will help you inform users about your website policy.', 'themeisle-companion' ); } diff --git a/obfx_modules/social-sharing/init.php b/obfx_modules/social-sharing/init.php index 0f8cdc84..dddd38f2 100644 --- a/obfx_modules/social-sharing/init.php +++ b/obfx_modules/social-sharing/init.php @@ -20,13 +20,11 @@ class Social_Sharing_OBFX_Module extends Orbit_Fox_Module_Abstract { private $social_share_links = array(); /** - * Social_Sharing_OBFX_Module constructor. + * Setup module strings * - * @since 1.0.0 * @access public */ - public function __construct() { - parent::__construct(); + public function set_module_strings() { $this->name = __( 'Social Sharing Module', 'themeisle-companion' ); /* * translators: %s Document anchor link. diff --git a/obfx_modules/template-directory/init.php b/obfx_modules/template-directory/init.php index 8a295af6..f4606eb4 100644 --- a/obfx_modules/template-directory/init.php +++ b/obfx_modules/template-directory/init.php @@ -27,12 +27,21 @@ class Template_Directory_OBFX_Module extends Orbit_Fox_Module_Abstract { */ public function __construct() { parent::__construct(); - $this->name = __( 'Template Directory Module', 'themeisle-companion' ); - $this->description = __( 'The awesome template directory is aiming to provide a wide range of templates that you can import straight into your website.', 'themeisle-companion' ); + $this->active_default = false; $this->refresh_after_enabled = true; } + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { + $this->name = __( 'Template Directory Module', 'themeisle-companion' ); + $this->description = __( 'The awesome template directory is aiming to provide a wide range of templates that you can import straight into your website.', 'themeisle-companion' ); + } + /** * Determine if module should be loaded. * From 3c43c93275bcf673452faa6e0f7fe27171762723 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 3 Dec 2024 16:49:54 +0530 Subject: [PATCH 3/3] Move required file to __construct --- obfx_modules/companion-legacy/init.php | 34 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/obfx_modules/companion-legacy/init.php b/obfx_modules/companion-legacy/init.php index 2ba4eabf..273ae769 100644 --- a/obfx_modules/companion-legacy/init.php +++ b/obfx_modules/companion-legacy/init.php @@ -28,15 +28,6 @@ class Companion_Legacy_OBFX_Module extends Orbit_Fox_Module_Abstract { public function __construct() { parent::__construct(); - $this->active_default = true; - } - - /** - * Setup module strings - * - * @access public - */ - public function set_module_strings() { $this->inc_dir = $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR; if ( ! defined( 'THEMEISLE_COMPANION_PATH' ) ) { define( 'THEMEISLE_COMPANION_PATH', $this->inc_dir ); @@ -44,9 +35,7 @@ public function set_module_strings() { if ( ! defined( 'THEMEISLE_COMPANION_URL' ) ) { define( 'THEMEISLE_COMPANION_URL', plugin_dir_url( $this->inc_dir ) ); } - $theme_name = ''; if ( $this->is_zerif() ) { - $theme_name = 'Zerif'; require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-focus.php'; require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-testimonial.php'; require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-clients.php'; @@ -57,12 +46,33 @@ public function set_module_strings() { if ( $this->is_hestia() ) { require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'functions.php'; require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php'; - $theme_name = 'Hestia'; } if ( $this->is_hestia_pro() ) { require_once $this->inc_dir . 'hestia' . DIRECTORY_SEPARATOR . 'common-functions.php'; + + } + $this->active_default = true; + } + + /** + * Setup module strings + * + * @access public + */ + public function set_module_strings() { + $theme_name = ''; + if ( $this->is_zerif() ) { + $theme_name = 'Zerif'; + } + + if ( $this->is_hestia() ) { + $theme_name = 'Hestia'; + + } + + if ( $this->is_hestia_pro() ) { $theme_name = 'Hestia Pro'; }