Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoladj77 committed Oct 1, 2024
1 parent bf2c1da commit b961f04
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 47 deletions.
31 changes: 18 additions & 13 deletions includes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@
* class Utils
**/
class Utils {
/**
* @static
* @access public
*
* @return \Elementor\Plugin
*/

private static $elementor_installed = null;

private static $elementor_active = null;

public static function elementor(): \Elementor\Plugin {
return \Elementor\Plugin::$instance;
}

/**
* @static
* @access public
*
* @return bool
*/
public static function is_elementor_active(): bool {
return defined( 'ELEMENTOR_VERSION' );
if ( null === self::$elementor_active ) {
self::$elementor_active = defined( 'ELEMENTOR_VERSION' );
}

return self::$elementor_active;
}

public static function is_elementor_installed() {
if ( null === self::$elementor_installed ) {
self::$elementor_installed = file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' );
}

return self::$elementor_installed;
}
}
26 changes: 0 additions & 26 deletions modules/admin/classes/elementor/elementor-helper.php

This file was deleted.

6 changes: 3 additions & 3 deletions modules/admin/classes/rest/onboarding-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace HelloPlus\Modules\Admin\Classes\Rest;

use HelloPlus\Modules\Admin\Classes\Elementor\Elementor_Helper;
use HelloPlus\Includes\Utils;
use WP_REST_Server;

class Onboarding_Settings {
Expand Down Expand Up @@ -35,8 +35,8 @@ public function get_onboarding_settings() {
[
'settings' => [
'nonce' => $nonce,
'elementorInstalled' => Elementor_Helper::is_elementor_installed(),
'elementorActive' => Elementor_Helper::is_elementor_active(),
'elementorInstalled' => Utils::is_elementor_installed(),
'elementorActive' => Utils::is_elementor_active(),
],
]
);
Expand Down
6 changes: 3 additions & 3 deletions modules/admin/classes/rest/promotions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace HelloPlus\Modules\Admin\Classes\Rest;

use HelloPlus\Modules\Admin\Classes\Elementor\Elementor_Helper;
use HelloPlus\Includes\Utils;
use WP_REST_Server;

if ( ! defined( 'ABSPATH' ) ) {
Expand Down Expand Up @@ -33,7 +33,7 @@ function () {
}

public function get_promotions() {
if ( ! Elementor_Helper::is_elementor_installed() ) {
if ( ! Utils::is_elementor_installed() ) {
$action_links_data[] = [
'type' => 'install-elementor',
'url' => wp_nonce_url(
Expand All @@ -54,7 +54,7 @@ public function get_promotions() {
];
}

if ( ! Elementor_Helper::is_elementor_active() ) {
if ( ! Utils::is_elementor_active() ) {
$action_links_data[] = [
'type' => 'activate-elementor',
'image' => HELLO_PLUS_URL . '/assets/images/elementor.svg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use HelloPlus\Modules\Admin\Classes\Rest\Promotions;


class Rest_Controller {
class Api_Controller {

protected $endpoints = [];

Expand Down
2 changes: 1 addition & 1 deletion modules/admin/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function get_name(): string {
protected function get_component_ids(): array {
return [
'Plugin_Notice',
'Rest_Controller',
'Api_Controller',
'Admin_Menu_Controller',
'Admin_Top_Bar',
'Scripts_Controller',
Expand Down

0 comments on commit b961f04

Please sign in to comment.