mirror of
https://github.com/proelements/proelements.git
synced 2026-04-05 20:13:47 +00:00
v3.35.0
This commit is contained in:
@@ -10,23 +10,23 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
class Custom_Fonts_Menu_Item implements Admin_Menu_Item {
|
||||
public function get_capability() {
|
||||
public function get_capability(): string {
|
||||
return Fonts_Manager::CAPABILITY;
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
public function get_label(): string {
|
||||
return esc_html__( 'Custom Fonts', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_parent_slug() {
|
||||
public function get_parent_slug(): string {
|
||||
return Settings::PAGE_ID;
|
||||
}
|
||||
|
||||
public function get_position() {
|
||||
public function get_position(): ?int {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function is_visible() {
|
||||
public function is_visible(): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
class Custom_Fonts_Promotion_Menu_Item extends Base_Promotion_Item {
|
||||
public function get_name() {
|
||||
public function get_name(): string {
|
||||
return 'custom-fonts-promotion';
|
||||
}
|
||||
|
||||
public function get_position() {
|
||||
public function get_position(): ?int {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_cta_url() {
|
||||
public function get_cta_url(): string {
|
||||
$connect_url = Plugin::instance()->license_admin->get_connect_url( [
|
||||
'utm_source' => 'wp-custom-fonts',
|
||||
'utm_medium' => 'wp-dash',
|
||||
@@ -32,25 +32,25 @@ class Custom_Fonts_Promotion_Menu_Item extends Base_Promotion_Item {
|
||||
: $connect_url;
|
||||
}
|
||||
|
||||
public function get_cta_text() {
|
||||
public function get_cta_text(): string {
|
||||
return API::is_license_expired()
|
||||
? esc_html__( 'Renew now', 'elementor-pro' )
|
||||
: esc_html__( 'Connect & Activate', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
public function get_label(): string {
|
||||
return esc_html__( 'Custom Fonts', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
public function get_page_title(): string {
|
||||
return esc_html__( 'Custom Fonts', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_promotion_title() {
|
||||
public function get_promotion_title(): string {
|
||||
return esc_html__( 'Add Your Custom Fonts', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_promotion_description() {
|
||||
public function get_promotion_description(): string {
|
||||
return esc_html__(
|
||||
'Custom Fonts allows you to add your self-hosted fonts and use them on your projects to create a unique brand language.',
|
||||
'elementor-pro'
|
||||
|
||||
@@ -10,23 +10,23 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
class Custom_Icons_Menu_Item implements Admin_Menu_Item {
|
||||
public function get_capability() {
|
||||
public function get_capability(): string {
|
||||
return Icons_Manager::CAPABILITY;
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
public function get_label(): string {
|
||||
return esc_html__( 'Custom Icons', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_parent_slug() {
|
||||
public function get_parent_slug(): string {
|
||||
return Settings::PAGE_ID;
|
||||
}
|
||||
|
||||
public function get_position() {
|
||||
public function get_position(): ?int {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function is_visible() {
|
||||
public function is_visible(): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
class Custom_Icons_Promotion_Menu_Item extends Base_Promotion_Item {
|
||||
public function get_name() {
|
||||
public function get_name(): string {
|
||||
return 'custom-icons-promotion';
|
||||
}
|
||||
|
||||
public function get_cta_url() {
|
||||
public function get_cta_url(): string {
|
||||
$connect_url = Plugin::instance()->license_admin->get_connect_url( [
|
||||
'utm_source' => 'wp-custom-icons',
|
||||
'utm_medium' => 'wp-dash',
|
||||
@@ -28,29 +28,29 @@ class Custom_Icons_Promotion_Menu_Item extends Base_Promotion_Item {
|
||||
: $connect_url;
|
||||
}
|
||||
|
||||
public function get_position() {
|
||||
public function get_position(): ?int {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get_cta_text() {
|
||||
public function get_cta_text(): string {
|
||||
return API::is_license_expired()
|
||||
? esc_html__( 'Renew now', 'elementor-pro' )
|
||||
: esc_html__( 'Connect & Activate', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_label() {
|
||||
public function get_label(): string {
|
||||
return esc_html__( 'Custom Icons', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_page_title() {
|
||||
public function get_page_title(): string {
|
||||
return esc_html__( 'Custom Icons', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_promotion_title() {
|
||||
public function get_promotion_title(): string {
|
||||
return esc_html__( 'Add Your Custom Icons', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_promotion_description() {
|
||||
public function get_promotion_description(): string {
|
||||
return esc_html__(
|
||||
'Don\'t rely solely on the FontAwesome icons everyone else is using! Differentiate your website and your style with custom icons you can upload from your favorite icons source.',
|
||||
'elementor-pro'
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\AssetsManager\AssetTypes\EditorOneMenuItems;
|
||||
|
||||
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Interface;
|
||||
use Elementor\Modules\EditorOne\Classes\Menu_Config;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\AdminMenuItems\Custom_Fonts_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\Fonts_Manager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Editor_One_Fonts_Menu_Item extends Custom_Fonts_Menu_Item implements Menu_Item_Interface {
|
||||
|
||||
public function get_position(): int {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public function get_slug(): string {
|
||||
return Fonts_Manager::MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_parent_slug(): string {
|
||||
return Menu_Config::ELEMENTOR_MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_label(): string {
|
||||
return esc_html__( 'Fonts', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_group_id(): string {
|
||||
return Menu_Config::CUSTOM_ELEMENTS_GROUP_ID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\AssetsManager\AssetTypes\EditorOneMenuItems;
|
||||
|
||||
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Interface;
|
||||
use Elementor\Modules\EditorOne\Classes\Menu_Config;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\AdminMenuItems\Custom_Fonts_Promotion_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\Fonts_Manager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Editor_One_Fonts_Promotion extends Custom_Fonts_Promotion_Menu_Item implements Menu_Item_Interface {
|
||||
|
||||
public function get_position(): int {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public function get_slug(): string {
|
||||
return Fonts_Manager::PROMOTION_MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_parent_slug(): string {
|
||||
return Menu_Config::ELEMENTOR_MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_label(): string {
|
||||
return esc_html__( 'Fonts', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_group_id(): string {
|
||||
return Menu_Config::CUSTOM_ELEMENTS_GROUP_ID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\AssetsManager\AssetTypes\EditorOneMenuItems;
|
||||
|
||||
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Interface;
|
||||
use Elementor\Modules\EditorOne\Classes\Menu_Config;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\AdminMenuItems\Custom_Icons_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\Icons_Manager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Editor_One_Icons_Menu_Item extends Custom_Icons_Menu_Item implements Menu_Item_Interface {
|
||||
|
||||
public function get_position(): int {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public function get_slug(): string {
|
||||
return Icons_Manager::MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_parent_slug(): string {
|
||||
return Menu_Config::ELEMENTOR_MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_label(): string {
|
||||
return esc_html__( 'Icons', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_group_id(): string {
|
||||
return Menu_Config::CUSTOM_ELEMENTS_GROUP_ID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace ElementorPro\Modules\AssetsManager\AssetTypes\EditorOneMenuItems;
|
||||
|
||||
use Elementor\Core\Admin\EditorOneMenu\Interfaces\Menu_Item_Interface;
|
||||
use Elementor\Modules\EditorOne\Classes\Menu_Config;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\AdminMenuItems\Custom_Icons_Promotion_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\Icons_Manager;
|
||||
|
||||
class Editor_One_Icons_Promotion extends Custom_Icons_Promotion_Menu_Item implements Menu_Item_Interface {
|
||||
|
||||
public function get_position(): int {
|
||||
return 20;
|
||||
}
|
||||
|
||||
public function get_slug(): string {
|
||||
return Icons_Manager::PROMOTION_MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_parent_slug(): string {
|
||||
return Menu_Config::ELEMENTOR_MENU_SLUG;
|
||||
}
|
||||
|
||||
public function get_label(): string {
|
||||
return esc_html__( 'Icons', 'elementor-pro' );
|
||||
}
|
||||
|
||||
public function get_group_id(): string {
|
||||
return Menu_Config::CUSTOM_ELEMENTS_GROUP_ID;
|
||||
}
|
||||
}
|
||||
@@ -2,21 +2,27 @@
|
||||
namespace ElementorPro\Modules\AssetsManager\AssetTypes;
|
||||
|
||||
use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
|
||||
use Elementor\Utils;
|
||||
use ElementorPro\Core\Utils as Pro_Utils;
|
||||
use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
|
||||
use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
|
||||
use Elementor\Plugin;
|
||||
use Elementor\Settings;
|
||||
use Elementor\Utils;
|
||||
use ElementorPro\Base\Editor_One_Trait;
|
||||
use ElementorPro\Core\Behaviors\Feature_Lock;
|
||||
use ElementorPro\Core\Utils as Pro_Utils;
|
||||
use ElementorPro\License\API;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\AdminMenuItems\Custom_Fonts_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\AdminMenuItems\Custom_Fonts_Promotion_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\EditorOneMenuItems\Editor_One_Fonts_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\EditorOneMenuItems\Editor_One_Fonts_Promotion;
|
||||
use ElementorPro\Modules\AssetsManager\Classes;
|
||||
use Elementor\Settings;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Fonts_Manager {
|
||||
use Editor_One_Trait;
|
||||
|
||||
const CAPABILITY = 'manage_options';
|
||||
|
||||
@@ -612,9 +618,6 @@ class Fonts_Manager {
|
||||
return $parent_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Font Manager action and filter hooks
|
||||
*/
|
||||
protected function actions() {
|
||||
add_action( 'init', [ $this, 'register_post_type_and_tax' ] );
|
||||
|
||||
@@ -622,6 +625,10 @@ class Fonts_Manager {
|
||||
add_action( 'init', [ $this, 'redirect_admin_old_page_to_new' ] );
|
||||
|
||||
add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu_manager ) {
|
||||
if ( $this->is_editor_one_active() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->register_admin_menu( $admin_menu_manager );
|
||||
} );
|
||||
|
||||
@@ -643,6 +650,14 @@ class Fonts_Manager {
|
||||
}, 50 );
|
||||
|
||||
add_action( 'admin_head', [ $this, 'clean_admin_listing_page' ] );
|
||||
|
||||
add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
|
||||
if ( $this->can_use_custom_fonts() ) {
|
||||
$menu_data_provider->register_menu( new Editor_One_Fonts_Menu_Item() );
|
||||
} else {
|
||||
$menu_data_provider->register_menu( new Editor_One_Fonts_Promotion() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// TODO: Maybe just ignore all of those when the user can't use custom fonts?
|
||||
@@ -667,6 +682,12 @@ class Fonts_Manager {
|
||||
// Ajax.
|
||||
add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] );
|
||||
|
||||
add_filter( 'elementor/editor-one/admin-edit-post-types', function ( array $post_types ) {
|
||||
$post_types[] = self::CPT;
|
||||
|
||||
return $post_types;
|
||||
} );
|
||||
|
||||
/**
|
||||
* Elementor fonts manager loaded.
|
||||
*
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
namespace ElementorPro\Modules\AssetsManager\AssetTypes;
|
||||
|
||||
use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
|
||||
use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
|
||||
use Elementor\Plugin;
|
||||
use ElementorPro\Base\Editor_One_Trait;
|
||||
use ElementorPro\Core\Behaviors\Feature_Lock;
|
||||
use ElementorPro\License\API;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\AdminMenuItems\Custom_Icons_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\AdminMenuItems\Custom_Icons_Promotion_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\EditorOneMenuItems\Editor_One_Icons_Menu_Item;
|
||||
use ElementorPro\Modules\AssetsManager\AssetTypes\EditorOneMenuItems\Editor_One_Icons_Promotion;
|
||||
use ElementorPro\Modules\AssetsManager\Classes;
|
||||
use Elementor\Settings;
|
||||
|
||||
@@ -14,6 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
class Icons_Manager {
|
||||
use Editor_One_Trait;
|
||||
|
||||
const CAPABILITY = 'manage_options';
|
||||
|
||||
@@ -193,9 +199,6 @@ class Icons_Manager {
|
||||
return $categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Font Manager action and filter hooks
|
||||
*/
|
||||
protected function actions() {
|
||||
add_action( 'init', [ $this, 'register_post_type' ] );
|
||||
|
||||
@@ -203,6 +206,10 @@ class Icons_Manager {
|
||||
add_action( 'init', [ $this, 'redirect_admin_old_page_to_new' ] );
|
||||
|
||||
add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu_manager ) {
|
||||
if ( $this->is_editor_one_active() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->register_admin_menu( $admin_menu_manager );
|
||||
} );
|
||||
|
||||
@@ -224,6 +231,14 @@ class Icons_Manager {
|
||||
}, 50 );
|
||||
|
||||
add_action( 'admin_head', [ $this, 'clean_admin_listing_page' ] );
|
||||
|
||||
add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
|
||||
if ( $this->can_use_custom_icons() ) {
|
||||
$menu_data_provider->register_menu( new Editor_One_Icons_Menu_Item() );
|
||||
} else {
|
||||
$menu_data_provider->register_menu( new Editor_One_Icons_Promotion() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
// TODO: Maybe just ignore all of those when the user can't use custom icons?
|
||||
@@ -232,6 +247,12 @@ class Icons_Manager {
|
||||
|
||||
add_filter( 'elementor/finder/categories', [ $this, 'add_finder_item' ] );
|
||||
|
||||
add_filter( 'elementor/editor-one/admin-edit-post-types', function ( array $post_types ) {
|
||||
$post_types[] = self::CPT;
|
||||
|
||||
return $post_types;
|
||||
} );
|
||||
|
||||
/**
|
||||
* Elementor icons manager loaded.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user