mirror of
https://github.com/elementor/hello-theme.git
synced 2026-07-27 14:01:37 +08:00
Some checks failed
PHPUnit / File Diff (push) Failing after 0s
Build / Build theme (push) Failing after 1s
Lint / PHPCS (push) Failing after 0s
Lint / ESLint (push) Failing after 1m18s
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 7.4 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.0 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.1 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.2 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.8 - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress 6.9 - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress latest - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - WordPress nightly - PHP version 8.3 (push) Has been skipped
PHPUnit / PHPUnit - Test Results (push) Successful in 2s
* update: remove items from menu * Cleanup: remove dead code from theme builder/site planner submenu removal Removes the enqueue script, webpack entry, and unused Utils helpers that only existed to support the Theme Builder and AI Site Planner submenu items removed from the Hello admin sidebar. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
95 lines
2.5 KiB
PHP
95 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace HelloTheme\Includes;
|
|
|
|
use Elementor\App\App;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly.
|
|
}
|
|
|
|
/**
|
|
* class Utils
|
|
**/
|
|
class Utils {
|
|
|
|
public static function elementor(): \Elementor\Plugin {
|
|
return \Elementor\Plugin::$instance;
|
|
}
|
|
|
|
public static function has_pro(): bool {
|
|
return defined( 'ELEMENTOR_PRO_VERSION' );
|
|
}
|
|
|
|
public static function is_elementor_active(): bool {
|
|
static $elementor_active = null;
|
|
if ( null === $elementor_active ) {
|
|
$elementor_active = defined( 'ELEMENTOR_VERSION' );
|
|
}
|
|
|
|
return $elementor_active;
|
|
}
|
|
|
|
public static function is_elementor_installed(): bool {
|
|
static $elementor_installed = null;
|
|
if ( null === $elementor_installed ) {
|
|
$elementor_installed = file_exists( WP_PLUGIN_DIR . '/elementor/elementor.php' );
|
|
}
|
|
|
|
return $elementor_installed;
|
|
}
|
|
|
|
public static function get_theme_builder_url(): string {
|
|
if ( ! class_exists( 'Elementor\App\App' ) ) {
|
|
return 'https://go.elementor.com/hello-theme-builder';
|
|
}
|
|
|
|
if ( self::has_pro() ) {
|
|
return admin_url( 'admin.php?page=' . App::PAGE_ID . '&ver=' . ELEMENTOR_VERSION ) . '#site-editor';
|
|
}
|
|
|
|
if ( self::is_elementor_active() ) {
|
|
return admin_url( 'admin.php?page=' . App::PAGE_ID . '&ver=' . ELEMENTOR_VERSION ) . '#site-editor/promotion';
|
|
}
|
|
|
|
return 'https://go.elementor.com/hello-theme-builder';
|
|
}
|
|
|
|
public static function get_elementor_activation_link(): string {
|
|
$plugin = 'elementor/elementor.php';
|
|
|
|
$url = 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all';
|
|
|
|
return add_query_arg( '_wpnonce', wp_create_nonce( 'activate-plugin_' . $plugin ), $url );
|
|
}
|
|
|
|
public static function get_plugin_install_url( $plugin_slug ): string {
|
|
$action = 'install-plugin';
|
|
|
|
$url = add_query_arg(
|
|
[
|
|
'action' => $action,
|
|
'plugin' => $plugin_slug,
|
|
'referrer' => 'hello-elementor',
|
|
],
|
|
admin_url( 'update.php' )
|
|
);
|
|
|
|
return add_query_arg( '_wpnonce', wp_create_nonce( $action . '_' . $plugin_slug ), $url );
|
|
}
|
|
|
|
public static function get_action_link_type() {
|
|
$installed_plugins = get_plugins();
|
|
|
|
if ( ! isset( $installed_plugins['elementor/elementor.php'] ) ) {
|
|
$action_link_type = 'install-elementor';
|
|
} elseif ( ! defined( 'ELEMENTOR_VERSION' ) ) {
|
|
$action_link_type = 'activate-elementor';
|
|
} elseif ( ! hello_header_footer_experiment_active() ) {
|
|
$action_link_type = 'activate-header-footer-experiment';
|
|
} else {
|
|
$action_link_type = 'style-header-footer';
|
|
}
|
|
return $action_link_type;
|
|
}
|
|
}
|