Skip to content

Commit

Permalink
Merge pull request #879 from Codeinwp/bugfix/878
Browse files Browse the repository at this point in the history
Fixed compatibility issues with WordPress 6.7 and Elementor widgets
  • Loading branch information
vytisbulkevicius authored Dec 3, 2024
2 parents 92fe566 + 3c43c93 commit e98d052
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 41 deletions.
9 changes: 9 additions & 0 deletions core/app/abstract/class-orbit-fox-module-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
Expand Down Expand Up @@ -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() {
}
}
11 changes: 10 additions & 1 deletion obfx_modules/beaver-widgets/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
34 changes: 25 additions & 9 deletions obfx_modules/companion-legacy/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,51 @@ class Companion_Legacy_OBFX_Module extends Orbit_Fox_Module_Abstract {
public function __construct() {
parent::__construct();

$this->active_default = true;

$this->inc_dir = $this->get_dir() . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR;
if ( ! defined( 'THEMEISLE_COMPANION_PATH' ) ) {
define( 'THEMEISLE_COMPANION_PATH', $this->inc_dir );
}
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';
require_once $this->inc_dir . 'zerif-lite' . DIRECTORY_SEPARATOR . 'widgets' . DIRECTORY_SEPARATOR . 'widget-team.php';
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';
$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';

}
Expand Down Expand Up @@ -300,8 +316,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' );
Expand All @@ -310,7 +326,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' );
}
Expand Down
15 changes: 12 additions & 3 deletions obfx_modules/custom-fonts/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -63,7 +72,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' );
Expand Down
12 changes: 10 additions & 2 deletions obfx_modules/elementor-widgets/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );

Expand Down Expand Up @@ -60,8 +70,6 @@ public function __construct() {
</a>
</div>';
}

$this->active_default = true;
}

/**
Expand Down
6 changes: 2 additions & 4 deletions obfx_modules/google-analytics/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
Expand Down
12 changes: 10 additions & 2 deletions obfx_modules/header-footer-scripts/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 11 additions & 2 deletions obfx_modules/menu-icons/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 10 additions & 1 deletion obfx_modules/mystock-import/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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( ' <a href="%s" target="_blank">mystock.photos</a>', 'https://mystock.photos' );
$this->active_default = true;
}


Expand Down
7 changes: 2 additions & 5 deletions obfx_modules/policy-notice/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
Expand Down
6 changes: 2 additions & 4 deletions obfx_modules/social-sharing/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 11 additions & 2 deletions obfx_modules/template-directory/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
7 changes: 1 addition & 6 deletions themeisle-companion.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit e98d052

Please sign in to comment.