first commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
$user = wp_get_current_user();
|
||||
|
||||
$ajax = Plugin::$instance->common->get_component( 'ajax' );
|
||||
|
||||
$beta_tester_email = $user->user_email;
|
||||
|
||||
/**
|
||||
* Print beta tester dialog.
|
||||
*
|
||||
* Display a dialog box to suggest the user to opt-in to the beta testers newsletter.
|
||||
*
|
||||
* Fired by `admin_footer` filter.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @access public
|
||||
*/
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-beta-tester">
|
||||
<form id="elementor-beta-tester-form" method="post">
|
||||
<?php // PHPCS - This is a nonce, doesn't need to be escaped. ?>
|
||||
<input type="hidden" name="_nonce" value="<?php echo $ajax->create_nonce(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
|
||||
<input type="hidden" name="action" value="elementor_beta_tester_signup" />
|
||||
<div id="elementor-beta-tester-form__caption"><?php echo esc_html__( 'Get Beta Updates', 'elementor' ); ?></div>
|
||||
<div id="elementor-beta-tester-form__description"><?php echo esc_html__( 'As a beta tester, you’ll receive an update that includes a testing version of Elementor and its content directly to your Email', 'elementor' ); ?></div>
|
||||
<div id="elementor-beta-tester-form__input-wrapper">
|
||||
<input id="elementor-beta-tester-form__email" name="beta_tester_email" type="email" placeholder="<?php echo esc_attr__( 'Your Email', 'elementor' ); ?>" required value="<?php echo esc_attr( $beta_tester_email ); ?>" />
|
||||
<button id="elementor-beta-tester-form__submit" class="elementor-button">
|
||||
<span class="elementor-state-icon">
|
||||
<i class="eicon-loading eicon-animation-spin" aria-hidden="true"></i>
|
||||
</span>
|
||||
<?php echo esc_html__( 'Sign Up', 'elementor' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
<div id="elementor-beta-tester-form__terms">
|
||||
<?php
|
||||
echo sprintf(
|
||||
/* translators: 1. "Terms of service" link, 2. "Privacy policy" link */
|
||||
esc_html__( 'By clicking Sign Up, you agree to Elementor\'s %1$s and %2$s', 'elementor' ),
|
||||
sprintf(
|
||||
'<a href="%1$s" target="_blank">%2$s</a>',
|
||||
esc_url( Beta_Testers::NEWSLETTER_TERMS_URL ),
|
||||
esc_html__( 'Terms of Service', 'elementor' )
|
||||
),
|
||||
sprintf(
|
||||
'<a href="%1$s" target="_blank">%2$s</a>',
|
||||
esc_url( Beta_Testers::NEWSLETTER_PRIVACY_URL ),
|
||||
esc_html__( 'Privacy Policy', 'elementor' )
|
||||
)
|
||||
)
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
</script>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Base\Document;
|
||||
use Elementor\TemplateLibrary\Forms\New_Template_Form;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
$new_template_control_form = new New_Template_Form( [ 'id' => 'form' ] );
|
||||
$document_types = Plugin::$instance->documents->get_document_types();
|
||||
|
||||
$types = [];
|
||||
$lock_configs = [];
|
||||
|
||||
$selected = get_query_var( 'elementor_library_type' );
|
||||
|
||||
foreach ( $document_types as $document_type ) {
|
||||
if ( $document_type::get_property( 'show_in_library' ) ) {
|
||||
/**
|
||||
* @var Document $instance
|
||||
*/
|
||||
$instance = new $document_type();
|
||||
$lock_behavior = $document_type::get_lock_behavior_v2();
|
||||
|
||||
$types[ $instance->get_name() ] = $document_type::get_title();
|
||||
$lock_configs[ $instance->get_name() ] = empty( $lock_behavior )
|
||||
? (object) []
|
||||
: $lock_behavior->get_config();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new template library dialog types.
|
||||
*
|
||||
* Filters the dialog types when printing new template dialog.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param array $types Types data.
|
||||
* @param Document $document_types Document types.
|
||||
*/
|
||||
$types = apply_filters( 'elementor/template-library/create_new_dialog_types', $types, $document_types );
|
||||
ksort( $types );
|
||||
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-new-template">
|
||||
<div id="elementor-new-template__description">
|
||||
<div id="elementor-new-template__description__title"><?php
|
||||
printf(
|
||||
/* translators: %1$s Span open tag, %2$s: Span close tag. */
|
||||
esc_html__( 'Templates Help You %1$sWork Efficiently%2$s', 'elementor' ),
|
||||
'<span>',
|
||||
'</span>'
|
||||
);
|
||||
?></div>
|
||||
<div id="elementor-new-template__description__content"><?php echo esc_html__( 'Use templates to create the different pieces of your site, and reuse them with one click whenever needed.', 'elementor' ); ?></div>
|
||||
</div>
|
||||
<form id="elementor-new-template__form" action="<?php esc_url( admin_url( '/edit.php' ) ); ?>">
|
||||
<input type="hidden" name="post_type" value="elementor_library">
|
||||
<input type="hidden" name="action" value="elementor_new_post">
|
||||
<?php // PHPCS - a nonce doesn't have to be escaped. ?>
|
||||
<input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'elementor_action_new_post' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
|
||||
<div id="elementor-new-template__form__title"><?php echo esc_html__( 'Choose Template Type', 'elementor' ); ?></div>
|
||||
<div id="elementor-new-template__form__template-type__wrapper" class="elementor-form-field">
|
||||
<label for="elementor-new-template__form__template-type" class="elementor-form-field__label"><?php echo esc_html__( 'Select the type of template you want to work on', 'elementor' ); ?></label>
|
||||
<div class="elementor-form-field__select__wrapper">
|
||||
<?php // Badge will be filled from js. ?>
|
||||
<span id="elementor-new-template__form__template-type-badge" class="e-hidden">
|
||||
<i id="elementor-new-template__form__template-type-badge__icon"></i>
|
||||
<span id="elementor-new-template__form__template-type-badge__text"></span>
|
||||
</span>
|
||||
|
||||
<select id="elementor-new-template__form__template-type" class="elementor-form-field__select" name="template_type" required>
|
||||
<option value=""><?php echo esc_html__( 'Select', 'elementor' ); ?>...</option>
|
||||
<?php
|
||||
foreach ( $types as $value => $type_title ) {
|
||||
printf(
|
||||
'<option value="%1$s" data-lock=\'%2$s\' %3$s>%4$s</option>',
|
||||
esc_attr( $value ),
|
||||
wp_json_encode( $lock_configs[ $value ] ?? (object) [] ),
|
||||
selected( $selected, $value, false ),
|
||||
esc_html( $type_title )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Template library dialog fields.
|
||||
*
|
||||
* Fires after Elementor template library dialog fields are displayed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
do_action( 'elementor/template-library/create_new_dialog_fields', $new_template_control_form );
|
||||
|
||||
$additional_controls = $new_template_control_form->get_controls();
|
||||
if ( $additional_controls ) {
|
||||
wp_add_inline_script( 'elementor-admin', 'const elementor_new_template_form_controls = ' . wp_json_encode( $additional_controls ) . ';' );
|
||||
$new_template_control_form->render();
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="elementor-new-template__form__post-title__wrapper" class="elementor-form-field">
|
||||
<label for="elementor-new-template__form__post-title" class="elementor-form-field__label">
|
||||
<?php echo esc_html__( 'Name your template', 'elementor' ); ?>
|
||||
</label>
|
||||
<div class="elementor-form-field__text__wrapper">
|
||||
<input type="text" placeholder="<?php echo esc_attr__( 'Enter template name (optional)', 'elementor' ); ?>" id="elementor-new-template__form__post-title" class="elementor-form-field__text" name="post_data[post_title]">
|
||||
</div>
|
||||
</div>
|
||||
<button id="elementor-new-template__form__submit" class="elementor-button e-primary"><?php echo esc_html__( 'Create Template', 'elementor' ); ?></button>
|
||||
<a id="elementor-new-template__form__lock_button" class="elementor-button e-accent e-hidden" target="_blank"><?php // Will be filled from js. ?></a>
|
||||
</form>
|
||||
</script>
|
||||
301
wp-content/plugins/elementor/includes/api.php
Normal file
301
wp-content/plugins/elementor/includes/api.php
Normal file
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Common\Modules\Connect\Apps\Library;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor API.
|
||||
*
|
||||
* Elementor API handler class is responsible for communicating with Elementor
|
||||
* remote servers retrieving templates data and to send uninstall feedback.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Api {
|
||||
|
||||
/**
|
||||
* Elementor library option key.
|
||||
*/
|
||||
const LIBRARY_OPTION_KEY = 'elementor_remote_info_library';
|
||||
|
||||
/**
|
||||
* Elementor feed option key.
|
||||
*/
|
||||
const FEED_OPTION_KEY = 'elementor_remote_info_feed_data';
|
||||
|
||||
const TRANSIENT_KEY_PREFIX = 'elementor_remote_info_api_data_';
|
||||
|
||||
|
||||
/**
|
||||
* API info URL.
|
||||
*
|
||||
* Holds the URL of the info API.
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @var string API info URL.
|
||||
*/
|
||||
public static $api_info_url = 'https://my.elementor.com/api/v1/info/';
|
||||
|
||||
/**
|
||||
* API feedback URL.
|
||||
*
|
||||
* Holds the URL of the feedback API.
|
||||
*
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var string API feedback URL.
|
||||
*/
|
||||
private static $api_feedback_url = 'https://my.elementor.com/api/v1/feedback/';
|
||||
|
||||
/**
|
||||
* Get info data.
|
||||
*
|
||||
* This function notifies the user of upgrade notices, new templates and contributors.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @param bool $force_update Optional. Whether to force the data retrieval or
|
||||
* not. Default is false.
|
||||
*
|
||||
* @return array|false Info data, or false.
|
||||
*/
|
||||
private static function get_info_data( $force_update = false ) {
|
||||
$cache_key = self::TRANSIENT_KEY_PREFIX . ELEMENTOR_VERSION;
|
||||
|
||||
$info_data = get_transient( $cache_key );
|
||||
|
||||
if ( $force_update || false === $info_data ) {
|
||||
$timeout = ( $force_update ) ? 25 : 8;
|
||||
|
||||
$response = wp_remote_get( self::$api_info_url, [
|
||||
'timeout' => $timeout,
|
||||
'body' => [
|
||||
// Which API version is used.
|
||||
'api_version' => ELEMENTOR_VERSION,
|
||||
// Which language to return.
|
||||
'site_lang' => get_bloginfo( 'language' ),
|
||||
],
|
||||
] );
|
||||
|
||||
if ( is_wp_error( $response ) || 200 !== (int) wp_remote_retrieve_response_code( $response ) ) {
|
||||
set_transient( $cache_key, [], 2 * HOUR_IN_SECONDS );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$info_data = json_decode( wp_remote_retrieve_body( $response ), true );
|
||||
|
||||
if ( empty( $info_data ) || ! is_array( $info_data ) ) {
|
||||
set_transient( $cache_key, [], 2 * HOUR_IN_SECONDS );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isset( $info_data['library'] ) ) {
|
||||
update_option( self::LIBRARY_OPTION_KEY, $info_data['library'], 'no' );
|
||||
|
||||
unset( $info_data['library'] );
|
||||
}
|
||||
|
||||
if ( isset( $info_data['feed'] ) ) {
|
||||
update_option( self::FEED_OPTION_KEY, $info_data['feed'], 'no' );
|
||||
|
||||
unset( $info_data['feed'] );
|
||||
}
|
||||
|
||||
set_transient( $cache_key, $info_data, 12 * HOUR_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $info_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get upgrade notice.
|
||||
*
|
||||
* Retrieve the upgrade notice if one exists, or false otherwise.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array|false Upgrade notice, or false none exist.
|
||||
*/
|
||||
public static function get_upgrade_notice() {
|
||||
$data = self::get_info_data();
|
||||
|
||||
if ( empty( $data['upgrade_notice'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $data['upgrade_notice'];
|
||||
}
|
||||
|
||||
public static function get_admin_notice() {
|
||||
$data = self::get_info_data();
|
||||
if ( empty( $data['admin_notice'] ) ) {
|
||||
return false;
|
||||
}
|
||||
return $data['admin_notice'];
|
||||
}
|
||||
|
||||
public static function get_canary_deployment_info( $force = false ) {
|
||||
$data = self::get_info_data( $force );
|
||||
|
||||
if ( empty( $data['canary_deployment'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $data['canary_deployment'];
|
||||
}
|
||||
|
||||
public static function get_promotion_widgets() {
|
||||
$data = self::get_info_data();
|
||||
|
||||
if ( ! isset( $data['pro_widgets'] ) ) {
|
||||
$data['pro_widgets'] = [];
|
||||
}
|
||||
|
||||
return $data['pro_widgets'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get templates data.
|
||||
*
|
||||
* Retrieve the templates data from a remote server.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param bool $force_update Optional. Whether to force the data update or
|
||||
* not. Default is false.
|
||||
*
|
||||
* @return array The templates data.
|
||||
*/
|
||||
public static function get_library_data( $force_update = false ) {
|
||||
self::get_info_data( $force_update );
|
||||
|
||||
$library_data = get_option( self::LIBRARY_OPTION_KEY );
|
||||
|
||||
if ( empty( $library_data ) ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $library_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get feed data.
|
||||
*
|
||||
* Retrieve the feed info data from remote elementor server.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param bool $force_update Optional. Whether to force the data update or
|
||||
* not. Default is false.
|
||||
*
|
||||
* @return array Feed data.
|
||||
*/
|
||||
public static function get_feed_data( $force_update = false ) {
|
||||
self::get_info_data( $force_update );
|
||||
|
||||
$feed = get_option( self::FEED_OPTION_KEY );
|
||||
|
||||
if ( empty( $feed ) ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return $feed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get template content.
|
||||
*
|
||||
* Retrieve the templates content received from a remote server.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param int $template_id The template ID.
|
||||
*
|
||||
* @return object|\WP_Error The template content.
|
||||
*/
|
||||
public static function get_template_content( $template_id ) {
|
||||
/** @var Library $library */
|
||||
$library = Plugin::$instance->common->get_component( 'connect' )->get_app( 'library' );
|
||||
|
||||
return $library->get_template_content( $template_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Feedback.
|
||||
*
|
||||
* Fires a request to Elementor server with the feedback data.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param string $feedback_key Feedback key.
|
||||
* @param string $feedback_text Feedback text.
|
||||
*
|
||||
* @return array The response of the request.
|
||||
*/
|
||||
public static function send_feedback( $feedback_key, $feedback_text ) {
|
||||
return wp_remote_post( self::$api_feedback_url, [
|
||||
'timeout' => 30,
|
||||
'body' => [
|
||||
'api_version' => ELEMENTOR_VERSION,
|
||||
'site_lang' => get_bloginfo( 'language' ),
|
||||
'feedback_key' => $feedback_key,
|
||||
'feedback' => $feedback_text,
|
||||
],
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax reset API data.
|
||||
*
|
||||
* Reset Elementor library API data using an ajax call.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function ajax_reset_api_data() {
|
||||
check_ajax_referer( 'elementor_reset_library', '_nonce' );
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_send_json_error( 'Permission denied' );
|
||||
}
|
||||
|
||||
self::get_info_data( true );
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Init.
|
||||
*
|
||||
* Initialize Elementor API.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function init() {
|
||||
add_action( 'wp_ajax_elementor_reset_library', [ __CLASS__, 'ajax_reset_api_data' ] );
|
||||
}
|
||||
}
|
||||
340
wp-content/plugins/elementor/includes/autoloader.php
Normal file
340
wp-content/plugins/elementor/includes/autoloader.php
Normal file
@@ -0,0 +1,340 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor autoloader.
|
||||
*
|
||||
* Elementor autoloader handler class is responsible for loading the different
|
||||
* classes needed to run the plugin.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
class Autoloader {
|
||||
|
||||
/**
|
||||
* Classes map.
|
||||
*
|
||||
* Maps Elementor classes to file names.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var array Classes used by elementor.
|
||||
*/
|
||||
private static $classes_map;
|
||||
|
||||
/**
|
||||
* Classes aliases.
|
||||
*
|
||||
* Maps Elementor classes to aliases.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var array Classes aliases.
|
||||
*/
|
||||
private static $classes_aliases;
|
||||
|
||||
/**
|
||||
* Default path for autoloader.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $default_path;
|
||||
|
||||
/**
|
||||
* Default namespace for autoloader.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $default_namespace;
|
||||
|
||||
/**
|
||||
* Run autoloader.
|
||||
*
|
||||
* Register a function as `__autoload()` implementation.
|
||||
*
|
||||
* @param string $default_path
|
||||
* @param string $default_namespace
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function run( $default_path = '', $default_namespace = '' ) {
|
||||
if ( '' === $default_path ) {
|
||||
$default_path = ELEMENTOR_PATH;
|
||||
}
|
||||
|
||||
if ( '' === $default_namespace ) {
|
||||
$default_namespace = __NAMESPACE__;
|
||||
}
|
||||
|
||||
self::$default_path = $default_path;
|
||||
self::$default_namespace = $default_namespace;
|
||||
|
||||
spl_autoload_register( [ __CLASS__, 'autoload' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get classes aliases.
|
||||
*
|
||||
* Retrieve the classes aliases names.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Classes aliases.
|
||||
*/
|
||||
public static function get_classes_aliases() {
|
||||
if ( ! self::$classes_aliases ) {
|
||||
self::init_classes_aliases();
|
||||
}
|
||||
|
||||
return self::$classes_aliases;
|
||||
}
|
||||
|
||||
public static function get_classes_map() {
|
||||
if ( ! self::$classes_map ) {
|
||||
self::init_classes_map();
|
||||
}
|
||||
|
||||
return self::$classes_map;
|
||||
}
|
||||
|
||||
private static function init_classes_map() {
|
||||
self::$classes_map = [
|
||||
'Api' => 'includes/api.php',
|
||||
'Base_Control' => 'includes/controls/base.php',
|
||||
'Base_Data_Control' => 'includes/controls/base-data.php',
|
||||
'Base_UI_Control' => 'includes/controls/base-ui.php',
|
||||
'Beta_Testers' => 'includes/beta-testers.php',
|
||||
'Compatibility' => 'includes/compatibility.php',
|
||||
'Conditions' => 'includes/conditions.php',
|
||||
'Controls_Manager' => 'includes/managers/controls.php',
|
||||
'Controls_Stack' => 'includes/base/controls-stack.php',
|
||||
'Sub_Controls_Stack' => 'includes/base/sub-controls-stack.php',
|
||||
'DB' => 'includes/db.php',
|
||||
'Elements_Manager' => 'includes/managers/elements.php',
|
||||
'Embed' => 'includes/embed.php',
|
||||
'Fonts' => 'includes/fonts.php',
|
||||
'Frontend' => 'includes/frontend.php',
|
||||
'Group_Control_Base' => 'includes/controls/groups/base.php',
|
||||
'Group_Control_Interface' => 'includes/interfaces/group-control.php',
|
||||
'Has_Validation' => 'includes/interfaces/has-validation.php',
|
||||
'Heartbeat' => 'includes/heartbeat.php',
|
||||
'Images_Manager' => 'includes/managers/image.php',
|
||||
'Maintenance' => 'includes/maintenance.php',
|
||||
'Maintenance_Mode' => 'includes/maintenance-mode.php',
|
||||
'Preview' => 'includes/preview.php',
|
||||
'Rollback' => 'includes/rollback.php',
|
||||
'Settings' => 'includes/settings/settings.php',
|
||||
'Settings_Controls' => 'includes/settings/controls.php',
|
||||
'Settings_Validations' => 'includes/settings/validations.php',
|
||||
'Settings_Page' => 'includes/settings/settings-page.php',
|
||||
'Shapes' => 'includes/shapes.php',
|
||||
'Skins_Manager' => 'includes/managers/skins.php',
|
||||
'Icons_Manager' => 'includes/managers/icons.php',
|
||||
'Stylesheet' => 'includes/stylesheet.php',
|
||||
'System_Info\Main' => 'includes/settings/system-info/main.php',
|
||||
'TemplateLibrary\Classes\Import_Images' => 'includes/template-library/classes/class-import-images.php',
|
||||
'TemplateLibrary\Forms\New_Template_Form' => 'includes/template-library/forms/new-template-form.php',
|
||||
'TemplateLibrary\Manager' => 'includes/template-library/manager.php',
|
||||
'TemplateLibrary\Source_Base' => 'includes/template-library/sources/base.php',
|
||||
'TemplateLibrary\Source_Local' => 'includes/template-library/sources/local.php',
|
||||
'TemplateLibrary\Source_Remote' => 'includes/template-library/sources/remote.php',
|
||||
'Tools' => 'includes/settings/tools.php',
|
||||
'Tracker' => 'includes/tracker.php',
|
||||
'User' => 'includes/user.php',
|
||||
'Utils' => 'includes/utils.php',
|
||||
'Widget_WordPress' => 'includes/widgets/wordpress.php',
|
||||
'Widgets_Manager' => 'includes/managers/widgets.php',
|
||||
'WordPress_Widgets_Manager' => 'includes/managers/wordpress-widgets.php',
|
||||
];
|
||||
|
||||
$controls_names = Controls_Manager::get_controls_names();
|
||||
|
||||
$controls_names = array_merge( $controls_names, [
|
||||
'base_multiple',
|
||||
'base_units',
|
||||
] );
|
||||
|
||||
foreach ( $controls_names as $control_name ) {
|
||||
$class_name = 'Control_' . self::normalize_class_name( $control_name, '_' );
|
||||
|
||||
self::$classes_map[ $class_name ] = 'includes/controls/' . str_replace( '_', '-', $control_name ) . '.php';
|
||||
}
|
||||
|
||||
$controls_groups_names = Controls_Manager::get_groups_names();
|
||||
|
||||
foreach ( $controls_groups_names as $group_name ) {
|
||||
$class_name = 'Group_Control_' . self::normalize_class_name( $group_name, '_' );
|
||||
|
||||
self::$classes_map[ $class_name ] = 'includes/controls/groups/' . $group_name . '.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize Class Name
|
||||
*
|
||||
* Used to convert control names to class names.
|
||||
*
|
||||
* @param $string
|
||||
* @param string $delimiter
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private static function normalize_class_name( $string, $delimiter = ' ' ) {
|
||||
return ucwords( str_replace( '-', '_', $string ), $delimiter );
|
||||
}
|
||||
|
||||
/**
|
||||
* Init classes aliases.
|
||||
*
|
||||
* When Elementor classes renamed or moved to different folders, developers
|
||||
* can still use the old names by setting an aliase.
|
||||
*
|
||||
* While in deprecation period both classes will work. When the deprecation
|
||||
* period ends, the alies should be removed from the list of aliases.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* self::$classes_aliases = [
|
||||
* 'Namespace\OldClassName' => [
|
||||
* 'replacement' => 'Namespace\NewClassName',
|
||||
* 'version' => '3.0.0',
|
||||
* ],
|
||||
* 'Namespace\OldModule\ClassName' => [
|
||||
* 'replacement' => 'Namespace\NewModule\ClassName',
|
||||
* 'version' => '3.5.0',
|
||||
* ],
|
||||
* ];
|
||||
*
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function init_classes_aliases() {
|
||||
self::$classes_aliases = [
|
||||
'System_Info\Main' => [
|
||||
'replacement' => 'Modules\System_Info\Module',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
'System_Info\Classes\Abstracts\Base_Reporter' => [
|
||||
'replacement' => 'Modules\System_Info\Reporters\Base',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
'System_Info\Classes\Server_Reporter' => [
|
||||
'replacement' => 'Modules\System_Info\Reporters\Server',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
'System_Info\Classes\MU_Plugins_Reporter' => [
|
||||
'replacement' => 'Modules\System_Info\Reporters\MU_Plugins',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
'System_Info\Classes\Network_Plugins_Reporter' => [
|
||||
'replacement' => 'Modules\System_Info\Reporters\Network_Plugins',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
'System_Info\Classes\Plugins_Reporter' => [
|
||||
'replacement' => 'Modules\System_Info\Reporters\Plugins',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
'System_Info\Classes\Theme_Reporter' => [
|
||||
'replacement' => 'Modules\System_Info\Reporters\Theme',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
'System_Info\Classes\User_Reporter' => [
|
||||
'replacement' => 'Modules\System_Info\Reporters\User',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
'System_Info\Helpers\Model_Helper' => [
|
||||
'replacement' => 'Modules\System_Info\Helpers\Model_Helper',
|
||||
'version' => '2.9.0',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load class.
|
||||
*
|
||||
* For a given class name, require the class file.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @param string $relative_class_name Class name.
|
||||
*/
|
||||
private static function load_class( $relative_class_name ) {
|
||||
$classes_map = self::get_classes_map();
|
||||
|
||||
if ( isset( $classes_map[ $relative_class_name ] ) ) {
|
||||
$filename = self::$default_path . '/' . $classes_map[ $relative_class_name ];
|
||||
} else {
|
||||
$filename = strtolower(
|
||||
preg_replace(
|
||||
[ '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
|
||||
[ '$1-$2', '-', DIRECTORY_SEPARATOR ],
|
||||
$relative_class_name
|
||||
)
|
||||
);
|
||||
|
||||
$filename = self::$default_path . $filename . '.php';
|
||||
}
|
||||
|
||||
if ( is_readable( $filename ) ) {
|
||||
require $filename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Autoload.
|
||||
*
|
||||
* For a given class, check if it exist and load it.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @param string $class Class name.
|
||||
*/
|
||||
private static function autoload( $class ) {
|
||||
if ( 0 !== strpos( $class, self::$default_namespace . '\\' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$relative_class_name = preg_replace( '/^' . self::$default_namespace . '\\\/', '', $class );
|
||||
|
||||
$classes_aliases = self::get_classes_aliases();
|
||||
|
||||
$has_class_alias = isset( $classes_aliases[ $relative_class_name ] );
|
||||
|
||||
// Backward Compatibility: Save old class name for set an alias after the new class is loaded
|
||||
if ( $has_class_alias ) {
|
||||
$alias_data = $classes_aliases[ $relative_class_name ];
|
||||
|
||||
$relative_class_name = $alias_data['replacement'];
|
||||
}
|
||||
|
||||
$final_class_name = self::$default_namespace . '\\' . $relative_class_name;
|
||||
|
||||
if ( ! class_exists( $final_class_name ) ) {
|
||||
self::load_class( $relative_class_name );
|
||||
}
|
||||
|
||||
if ( $has_class_alias ) {
|
||||
class_alias( $final_class_name, $class );
|
||||
|
||||
Utils::handle_deprecation( $class, $alias_data['version'], $final_class_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
2537
wp-content/plugins/elementor/includes/base/controls-stack.php
Normal file
2537
wp-content/plugins/elementor/includes/base/controls-stack.php
Normal file
File diff suppressed because it is too large
Load Diff
1554
wp-content/plugins/elementor/includes/base/element-base.php
Normal file
1554
wp-content/plugins/elementor/includes/base/element-base.php
Normal file
File diff suppressed because it is too large
Load Diff
271
wp-content/plugins/elementor/includes/base/skin-base.php
Normal file
271
wp-content/plugins/elementor/includes/base/skin-base.php
Normal file
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor skin base.
|
||||
*
|
||||
* An abstract class to register new skins for Elementor widgets. Skins allows
|
||||
* you to add new templates, set custom controls and more.
|
||||
*
|
||||
* To register new skins for your widget use the `add_skin()` method inside the
|
||||
* widget's `register_skins()` method.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Skin_Base extends Sub_Controls_Stack {
|
||||
|
||||
/**
|
||||
* Parent widget.
|
||||
*
|
||||
* Holds the parent widget of the skin. Default value is null, no parent widget.
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @var Widget_Base|null
|
||||
*/
|
||||
protected $parent = null;
|
||||
|
||||
/**
|
||||
* Skin base constructor.
|
||||
*
|
||||
* Initializing the skin base class by setting parent widget and registering
|
||||
* controls actions.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @param Widget_Base $parent
|
||||
*/
|
||||
public function __construct( Widget_Base $parent ) {
|
||||
parent::__construct( $parent );
|
||||
|
||||
$this->_register_controls_actions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render skin.
|
||||
*
|
||||
* Generates the final HTML on the frontend.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @abstract
|
||||
*/
|
||||
abstract public function render();
|
||||
|
||||
/**
|
||||
* Render element in static mode.
|
||||
*
|
||||
* If not inherent will call the base render.
|
||||
*/
|
||||
public function render_static() {
|
||||
$this->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the render logic.
|
||||
*/
|
||||
public function render_by_mode() {
|
||||
if ( Plugin::$instance->frontend->is_static_render_mode() ) {
|
||||
$this->render_static();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register skin controls actions.
|
||||
*
|
||||
* Run on init and used to register new skins to be injected to the widget.
|
||||
* This method is used to register new actions that specify the location of
|
||||
* the skin in the widget.
|
||||
*
|
||||
* Example usage:
|
||||
* `add_action( 'elementor/element/{widget_id}/{section_id}/before_section_end', [ $this, 'register_controls' ] );`
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*/
|
||||
protected function _register_controls_actions() {}
|
||||
|
||||
/**
|
||||
* Get skin control ID.
|
||||
*
|
||||
* Retrieve the skin control ID. Note that skin controls have special prefix
|
||||
* to distinguish them from regular controls, and from controls in other
|
||||
* skins.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @param string $control_base_id Control base ID.
|
||||
*
|
||||
* @return string Control ID.
|
||||
*/
|
||||
protected function get_control_id( $control_base_id ) {
|
||||
$skin_id = str_replace( '-', '_', $this->get_id() );
|
||||
return $skin_id . '_' . $control_base_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get skin settings.
|
||||
*
|
||||
* Retrieve all the skin settings or, when requested, a specific setting.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @TODO: rename to get_setting() and create backward compatibility.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $control_base_id Control base ID.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_instance_value( $control_base_id ) {
|
||||
$control_id = $this->get_control_id( $control_base_id );
|
||||
return $this->parent->get_settings( $control_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Start skin controls section.
|
||||
*
|
||||
* Used to add a new section of controls to the skin.
|
||||
*
|
||||
* @since 1.3.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Section ID.
|
||||
* @param array $args Section arguments.
|
||||
*/
|
||||
public function start_controls_section( $id, $args = [] ) {
|
||||
$args['condition']['_skin'] = $this->get_id();
|
||||
parent::start_controls_section( $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new skin control.
|
||||
*
|
||||
* Register a single control to the allow the user to set/update skin data.
|
||||
*
|
||||
* @param string $id Control ID.
|
||||
* @param array $args Control arguments.
|
||||
* @param array $options
|
||||
*
|
||||
* @return bool True if skin added, False otherwise.
|
||||
|
||||
* @since 3.0.0 New `$options` parameter added.
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function add_control( $id, $args = [], $options = [] ) {
|
||||
$args['condition']['_skin'] = $this->get_id();
|
||||
return parent::add_control( $id, $args, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update skin control.
|
||||
*
|
||||
* Change the value of an existing skin control.
|
||||
*
|
||||
* @since 1.3.0
|
||||
* @since 1.8.1 New `$options` parameter added.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Control ID.
|
||||
* @param array $args Control arguments. Only the new fields you want to update.
|
||||
* @param array $options Optional. Some additional options.
|
||||
*/
|
||||
public function update_control( $id, $args, array $options = [] ) {
|
||||
$args['condition']['_skin'] = $this->get_id();
|
||||
parent::update_control( $id, $args, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new responsive skin control.
|
||||
*
|
||||
* Register a set of controls to allow editing based on user screen size.
|
||||
*
|
||||
* @param string $id Responsive control ID.
|
||||
* @param array $args Responsive control arguments.
|
||||
* @param array $options
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
public function add_responsive_control( $id, $args, $options = [] ) {
|
||||
$args['condition']['_skin'] = $this->get_id();
|
||||
parent::add_responsive_control( $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Start skin controls tab.
|
||||
*
|
||||
* Used to add a new tab inside a group of tabs.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Control ID.
|
||||
* @param array $args Control arguments.
|
||||
*/
|
||||
public function start_controls_tab( $id, $args ) {
|
||||
$args['condition']['_skin'] = $this->get_id();
|
||||
parent::start_controls_tab( $id, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Start skin controls tabs.
|
||||
*
|
||||
* Used to add a new set of tabs inside a section.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Control ID.
|
||||
*/
|
||||
public function start_controls_tabs( $id ) {
|
||||
$args['condition']['_skin'] = $this->get_id();
|
||||
parent::start_controls_tabs( $id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new group control.
|
||||
*
|
||||
* Register a set of related controls grouped together as a single unified
|
||||
* control.
|
||||
*
|
||||
* @param string $group_name Group control name.
|
||||
* @param array $args Group control arguments. Default is an empty array.
|
||||
* @param array $options
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
*/
|
||||
final public function add_group_control( $group_name, $args = [], $options = [] ) {
|
||||
$args['condition']['_skin'] = $this->get_id();
|
||||
parent::add_group_control( $group_name, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parent widget.
|
||||
*
|
||||
* Used to define the parent widget of the skin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param Widget_Base $parent Parent widget.
|
||||
*/
|
||||
public function set_parent( $parent ) {
|
||||
$this->parent = $parent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor sub controls stack.
|
||||
*
|
||||
* An abstract class that can be used to divide a large ControlsStack into small parts.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Sub_Controls_Stack {
|
||||
/**
|
||||
* @var Controls_Stack
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* Get self ID.
|
||||
*
|
||||
* Retrieve the self ID.
|
||||
*
|
||||
* @access public
|
||||
* @abstract
|
||||
*/
|
||||
abstract public function get_id();
|
||||
|
||||
/**
|
||||
* Get self title.
|
||||
*
|
||||
* Retrieve the self title.
|
||||
*
|
||||
* @access public
|
||||
* @abstract
|
||||
*/
|
||||
abstract public function get_title();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Initializing the base class by setting parent stack.
|
||||
*
|
||||
* @access public
|
||||
* @param Controls_Stack $parent
|
||||
*/
|
||||
public function __construct( $parent ) {
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get control ID.
|
||||
*
|
||||
* Retrieve the control ID. Note that the sub controls stack may have a special prefix
|
||||
* to distinguish them from regular controls, and from controls in other
|
||||
* sub stack.
|
||||
*
|
||||
* By default do nothing, and return the original id.
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @param string $control_base_id Control base ID.
|
||||
*
|
||||
* @return string Control ID.
|
||||
*/
|
||||
protected function get_control_id( $control_base_id ) {
|
||||
return $control_base_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new control.
|
||||
*
|
||||
* Register a single control to allow the user to set/update data.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Control ID.
|
||||
* @param array $args Control arguments.
|
||||
* @param array $options
|
||||
*
|
||||
* @return bool True if added, False otherwise.
|
||||
*/
|
||||
public function add_control( $id, $args, $options = [] ) {
|
||||
return $this->parent->add_control( $this->get_control_id( $id ), $args, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update control.
|
||||
*
|
||||
* Change the value of an existing control.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Control ID.
|
||||
* @param array $args Control arguments. Only the new fields you want to update.
|
||||
* @param array $options Optional. Some additional options.
|
||||
*/
|
||||
public function update_control( $id, $args, array $options = [] ) {
|
||||
$this->parent->update_control( $this->get_control_id( $id ), $args, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove control.
|
||||
*
|
||||
* Unregister an existing control.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Control ID.
|
||||
*/
|
||||
public function remove_control( $id ) {
|
||||
$this->parent->remove_control( $this->get_control_id( $id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new group control.
|
||||
*
|
||||
* Register a set of related controls grouped together as a single unified
|
||||
* control.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $group_name Group control name.
|
||||
* @param array $args Group control arguments. Default is an empty array.
|
||||
* @param array $options
|
||||
*
|
||||
*/
|
||||
public function add_group_control( $group_name, $args, $options = [] ) {
|
||||
$args['name'] = $this->get_control_id( $args['name'] );
|
||||
$this->parent->add_group_control( $group_name, $args, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new responsive control.
|
||||
*
|
||||
* Register a set of controls to allow editing based on user screen size.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Responsive control ID.
|
||||
* @param array $args Responsive control arguments.
|
||||
* @param array $options
|
||||
*/
|
||||
public function add_responsive_control( $id, $args, $options = [] ) {
|
||||
$this->parent->add_responsive_control( $this->get_control_id( $id ), $args, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update responsive control.
|
||||
*
|
||||
* Change the value of an existing responsive control.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Responsive control ID.
|
||||
* @param array $args Responsive control arguments.
|
||||
*/
|
||||
public function update_responsive_control( $id, $args ) {
|
||||
$this->parent->update_responsive_control( $this->get_control_id( $id ), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove responsive control.
|
||||
*
|
||||
* Unregister an existing responsive control.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Responsive control ID.
|
||||
*/
|
||||
public function remove_responsive_control( $id ) {
|
||||
$this->parent->remove_responsive_control( $this->get_control_id( $id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Start controls section.
|
||||
*
|
||||
* Used to add a new section of controls to the stack.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Section ID.
|
||||
* @param array $args Section arguments.
|
||||
*/
|
||||
|
||||
public function start_controls_section( $id, $args = [] ) {
|
||||
$this->parent->start_controls_section( $this->get_control_id( $id ), $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* End controls section.
|
||||
*
|
||||
* Used to close an existing open controls section.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function end_controls_section() {
|
||||
$this->parent->end_controls_section();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start controls tabs.
|
||||
*
|
||||
* Used to add a new set of tabs inside a section.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Control ID.
|
||||
*/
|
||||
public function start_controls_tabs( $id ) {
|
||||
$this->parent->start_controls_tabs( $this->get_control_id( $id ) );
|
||||
}
|
||||
|
||||
public function start_controls_tab( $id, $args ) {
|
||||
$this->parent->start_controls_tab( $this->get_control_id( $id ), $args );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* End controls tabs.
|
||||
*
|
||||
* Used to close an existing open controls tabs.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function end_controls_tab() {
|
||||
$this->parent->end_controls_tab();
|
||||
}
|
||||
|
||||
/**
|
||||
* End controls tabs.
|
||||
*
|
||||
* Used to close an existing open controls tabs.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function end_controls_tabs() {
|
||||
$this->parent->end_controls_tabs();
|
||||
}
|
||||
}
|
||||
1255
wp-content/plugins/elementor/includes/base/widget-base.php
Normal file
1255
wp-content/plugins/elementor/includes/base/widget-base.php
Normal file
File diff suppressed because it is too large
Load Diff
124
wp-content/plugins/elementor/includes/beta-testers.php
Normal file
124
wp-content/plugins/elementor/includes/beta-testers.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor beta testers.
|
||||
*
|
||||
* Elementor beta testers handler class is responsible for the Beta Testers
|
||||
* feature that allows developers to test Elementor beta versions.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class Beta_Testers {
|
||||
|
||||
const NEWSLETTER_TERMS_URL = 'https://go.elementor.com/beta-testers-newsletter-terms';
|
||||
|
||||
const NEWSLETTER_PRIVACY_URL = 'https://go.elementor.com/beta-testers-newsletter-privacy';
|
||||
|
||||
const BETA_TESTER_SIGNUP = 'beta_tester_signup';
|
||||
|
||||
/**
|
||||
* Transient key.
|
||||
*
|
||||
* Holds the Elementor beta testers transient key.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var string Transient key.
|
||||
*/
|
||||
private $transient_key;
|
||||
|
||||
/**
|
||||
* Get beta version.
|
||||
*
|
||||
* Retrieve Elementor beta version from wp.org plugin repository.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access private
|
||||
*
|
||||
* @return string|false Beta version or false.
|
||||
*/
|
||||
private function get_beta_version() {
|
||||
$beta_version = get_site_transient( $this->transient_key );
|
||||
|
||||
if ( false === $beta_version ) {
|
||||
$beta_version = 'false';
|
||||
|
||||
$response = wp_remote_get( 'https://plugins.svn.wordpress.org/elementor/trunk/readme.txt' );
|
||||
|
||||
if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) {
|
||||
preg_match( '/Beta tag: (.*)/i', $response['body'], $matches );
|
||||
if ( isset( $matches[1] ) ) {
|
||||
$beta_version = $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
set_site_transient( $this->transient_key, $beta_version, 6 * HOUR_IN_SECONDS );
|
||||
}
|
||||
|
||||
return $beta_version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check version.
|
||||
*
|
||||
* Checks whether a beta version exist, and retrieve the version data.
|
||||
*
|
||||
* Fired by `pre_set_site_transient_update_plugins` filter, before WordPress
|
||||
* runs the plugin update checker.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $transient Plugin version data.
|
||||
*
|
||||
* @return array Plugin version data.
|
||||
*/
|
||||
public function check_version( $transient ) {
|
||||
if ( empty( $transient->checked ) ) {
|
||||
return $transient;
|
||||
}
|
||||
|
||||
delete_site_transient( $this->transient_key );
|
||||
|
||||
$plugin_slug = basename( ELEMENTOR__FILE__, '.php' );
|
||||
|
||||
$beta_version = $this->get_beta_version();
|
||||
if ( 'false' !== $beta_version && version_compare( $beta_version, ELEMENTOR_VERSION, '>' ) ) {
|
||||
$response = new \stdClass();
|
||||
$response->plugin = $plugin_slug;
|
||||
$response->slug = $plugin_slug;
|
||||
$response->new_version = $beta_version;
|
||||
$response->url = 'https://elementor.com/';
|
||||
$response->package = sprintf( 'https://downloads.wordpress.org/plugin/elementor.%s.zip', $beta_version );
|
||||
|
||||
$transient->response[ ELEMENTOR_PLUGIN_BASE ] = $response;
|
||||
}
|
||||
|
||||
return $transient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Beta testers constructor.
|
||||
*
|
||||
* Initializing Elementor beta testers.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( 'yes' !== get_option( 'elementor_beta', 'no' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->transient_key = md5( 'elementor_beta_testers_response_key' );
|
||||
|
||||
add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_version' ] );
|
||||
}
|
||||
}
|
||||
375
wp-content/plugins/elementor/includes/compatibility.php
Normal file
375
wp-content/plugins/elementor/includes/compatibility.php
Normal file
@@ -0,0 +1,375 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Base\Document;
|
||||
use Elementor\Core\DocumentTypes\PageBase;
|
||||
use Elementor\TemplateLibrary\Source_Local;
|
||||
use Elementor\Utils;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor compatibility.
|
||||
*
|
||||
* Elementor compatibility handler class is responsible for compatibility with
|
||||
* external plugins. The class resolves different issues with non-compatible
|
||||
* plugins.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Compatibility {
|
||||
|
||||
/**
|
||||
* Register actions.
|
||||
*
|
||||
* Run Elementor compatibility with external plugins using custom filters and
|
||||
* actions.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function register_actions() {
|
||||
add_action( 'init', [ __CLASS__, 'init' ] );
|
||||
|
||||
self::polylang_compatibility();
|
||||
self::yoast_duplicate_post();
|
||||
|
||||
if ( is_admin() || defined( 'WP_LOAD_IMPORTERS' ) ) {
|
||||
add_filter( 'wp_import_post_meta', [ __CLASS__, 'on_wp_import_post_meta' ] );
|
||||
add_filter( 'wxr_importer.pre_process.post_meta', [ __CLASS__, 'on_wxr_importer_pre_process_post_meta' ] );
|
||||
}
|
||||
|
||||
add_action( 'elementor/maintenance_mode/mode_changed', [ __CLASS__, 'clear_3rd_party_cache' ] );
|
||||
}
|
||||
|
||||
public static function clear_3rd_party_cache() {
|
||||
// W3 Total Cache.
|
||||
if ( function_exists( 'w3tc_flush_all' ) ) {
|
||||
w3tc_flush_all();
|
||||
}
|
||||
|
||||
// WP Fastest Cache.
|
||||
if ( ! empty( $GLOBALS['wp_fastest_cache'] ) && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ) {
|
||||
$GLOBALS['wp_fastest_cache']->deleteCache();
|
||||
}
|
||||
|
||||
// WP Super Cache
|
||||
if ( function_exists( 'wp_cache_clean_cache' ) ) {
|
||||
global $file_prefix;
|
||||
wp_cache_clean_cache( $file_prefix, true );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new button to gutenberg.
|
||||
*
|
||||
* Insert new "Elementor" button to the gutenberg editor to create new post
|
||||
* using Elementor page builder.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function add_new_button_to_gutenberg() {
|
||||
global $typenow;
|
||||
if ( ! User::is_current_user_can_edit_post_type( $typenow ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Introduced in WP 5.0
|
||||
if ( function_exists( 'use_block_editor_for_post' ) && ! use_block_editor_for_post( $typenow ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Deprecated/removed in Gutenberg plugin v5.3.0
|
||||
if ( function_exists( 'gutenberg_can_edit_post_type' ) && ! gutenberg_can_edit_post_type( $typenow ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener( 'DOMContentLoaded', function() {
|
||||
var dropdown = document.querySelector( '#split-page-title-action .dropdown' );
|
||||
|
||||
if ( ! dropdown ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = '<?php echo esc_url( Plugin::$instance->documents->get_create_new_post_url( $typenow ) ); ?>';
|
||||
|
||||
dropdown.insertAdjacentHTML( 'afterbegin', '<a href="' + url + '">Elementor</a>' );
|
||||
} );
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Init.
|
||||
*
|
||||
* Initialize Elementor compatibility with external plugins.
|
||||
*
|
||||
* Fired by `init` action.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function init() {
|
||||
// Hotfix for NextGEN Gallery plugin.
|
||||
if ( defined( 'NGG_PLUGIN_VERSION' ) ) {
|
||||
add_filter( 'elementor/document/urls/edit', function( $edit_link ) {
|
||||
return add_query_arg( 'display_gallery_iframe', '', $edit_link );
|
||||
} );
|
||||
}
|
||||
|
||||
// Exclude our Library from Yoast SEO plugin.
|
||||
add_filter( 'wpseo_sitemaps_supported_post_types', [ __CLASS__, 'filter_library_post_type' ] );
|
||||
add_filter( 'wpseo_accessible_post_types', [ __CLASS__, 'filter_library_post_type' ] );
|
||||
add_filter( 'wpseo_sitemap_exclude_post_type', function( $retval, $post_type ) {
|
||||
if ( Source_Local::CPT === $post_type ) {
|
||||
$retval = true;
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}, 10, 2 );
|
||||
|
||||
// Disable optimize files in Editor from Autoptimize plugin.
|
||||
add_filter( 'autoptimize_filter_noptimize', function( $retval ) {
|
||||
if ( Plugin::$instance->editor->is_edit_mode() ) {
|
||||
$retval = true;
|
||||
}
|
||||
|
||||
return $retval;
|
||||
} );
|
||||
|
||||
// Add the description (content) tab for a new product, so it can be edited with Elementor.
|
||||
add_filter( 'woocommerce_product_tabs', function( $tabs ) {
|
||||
if ( ! isset( $tabs['description'] ) && Plugin::$instance->preview->is_preview_mode() ) {
|
||||
$post = get_post();
|
||||
if ( empty( $post->post_content ) ) {
|
||||
$tabs['description'] = [
|
||||
'title' => esc_html__( 'Description', 'elementor' ),
|
||||
'priority' => 10,
|
||||
'callback' => 'woocommerce_product_description_tab',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
} );
|
||||
|
||||
// Fix WC session not defined in editor.
|
||||
if ( class_exists( 'woocommerce' ) ) {
|
||||
add_action( 'elementor/editor/before_enqueue_scripts', function() {
|
||||
remove_action( 'woocommerce_shortcode_before_product_cat_loop', 'wc_print_notices' );
|
||||
remove_action( 'woocommerce_before_shop_loop', 'wc_print_notices' );
|
||||
remove_action( 'woocommerce_before_single_product', 'wc_print_notices' );
|
||||
} );
|
||||
|
||||
add_filter( 'elementor/maintenance_mode/is_login_page', function( $value ) {
|
||||
|
||||
// Support Woocommerce Account Page.
|
||||
if ( is_account_page() && ! is_user_logged_in() ) {
|
||||
$value = true;
|
||||
}
|
||||
return $value;
|
||||
} );
|
||||
}
|
||||
|
||||
// Fix Jetpack Contact Form in Editor Mode.
|
||||
if ( class_exists( 'Grunion_Editor_View' ) ) {
|
||||
add_action( 'elementor/editor/before_enqueue_scripts', function() {
|
||||
remove_action( 'media_buttons', 'grunion_media_button', 999 );
|
||||
remove_action( 'admin_enqueue_scripts', 'grunion_enable_spam_recheck' );
|
||||
|
||||
remove_action( 'admin_notices', [ 'Grunion_Editor_View', 'handle_editor_view_js' ] );
|
||||
remove_action( 'admin_head', [ 'Grunion_Editor_View', 'admin_head' ] );
|
||||
} );
|
||||
}
|
||||
|
||||
// Fix Popup Maker in Editor Mode.
|
||||
if ( class_exists( 'PUM_Admin_Shortcode_UI' ) ) {
|
||||
add_action( 'elementor/editor/before_enqueue_scripts', function() {
|
||||
$pum_admin_instance = \PUM_Admin_Shortcode_UI::instance();
|
||||
|
||||
remove_action( 'print_media_templates', [ $pum_admin_instance, 'print_media_templates' ] );
|
||||
remove_action( 'admin_print_footer_scripts', [ $pum_admin_instance, 'admin_print_footer_scripts' ], 100 );
|
||||
remove_action( 'wp_ajax_pum_do_shortcode', [ $pum_admin_instance, 'wp_ajax_pum_do_shortcode' ] );
|
||||
|
||||
remove_action( 'admin_enqueue_scripts', [ $pum_admin_instance, 'admin_enqueue_scripts' ] );
|
||||
|
||||
remove_filter( 'pum_admin_var', [ $pum_admin_instance, 'pum_admin_var' ] );
|
||||
} );
|
||||
}
|
||||
|
||||
// Fix Preview URL for https://github.com/wpmudev/domain-mapping plugin
|
||||
if ( class_exists( 'domain_map' ) ) {
|
||||
add_filter( 'elementor/document/urls/preview', function( $preview_url ) {
|
||||
if ( wp_parse_url( $preview_url, PHP_URL_HOST ) !== Utils::get_super_global_value( $_SERVER, 'HTTP_HOST' ) ) {
|
||||
$preview_url = \domain_map::utils()->unswap_url( $preview_url );
|
||||
$preview_url = add_query_arg( [
|
||||
'dm' => \Domainmap_Module_Mapping::BYPASS,
|
||||
], $preview_url );
|
||||
}
|
||||
|
||||
return $preview_url;
|
||||
} );
|
||||
}
|
||||
|
||||
// Gutenberg
|
||||
if ( function_exists( 'gutenberg_init' ) ) {
|
||||
add_action( 'admin_print_scripts-edit.php', [ __CLASS__, 'add_new_button_to_gutenberg' ], 11 );
|
||||
}
|
||||
}
|
||||
|
||||
public static function filter_library_post_type( $post_types ) {
|
||||
unset( $post_types[ Source_Local::CPT ] );
|
||||
|
||||
return $post_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Polylang compatibility.
|
||||
*
|
||||
* Fix Polylang compatibility with Elementor.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
* @static
|
||||
*/
|
||||
private static function polylang_compatibility() {
|
||||
// Copy elementor data while polylang creates a translation copy
|
||||
add_filter( 'pll_copy_post_metas', [ __CLASS__, 'save_polylang_meta' ], 10, 4 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save polylang meta.
|
||||
*
|
||||
* Copy elementor data while polylang creates a translation copy.
|
||||
*
|
||||
* Fired by `pll_copy_post_metas` filter.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param array $keys List of custom fields names.
|
||||
* @param bool $sync True if it is synchronization, false if it is a copy.
|
||||
* @param int $from ID of the post from which we copy information.
|
||||
* @param int $to ID of the post to which we paste information.
|
||||
*
|
||||
* @return array List of custom fields names.
|
||||
*/
|
||||
public static function save_polylang_meta( $keys, $sync, $from, $to ) {
|
||||
// Copy only for a new post.
|
||||
if ( ! $sync ) {
|
||||
Plugin::$instance->db->copy_elementor_meta( $from, $to );
|
||||
}
|
||||
|
||||
return $keys;
|
||||
}
|
||||
|
||||
private static function yoast_duplicate_post() {
|
||||
add_filter( 'duplicate_post_excludelist_filter', function( $meta_excludelist ) {
|
||||
$exclude_list = [
|
||||
Document::TYPE_META_KEY,
|
||||
'_elementor_page_assets',
|
||||
'_elementor_controls_usage',
|
||||
'_elementor_css',
|
||||
'_elementor_screenshot',
|
||||
];
|
||||
|
||||
return array_merge( $meta_excludelist, $exclude_list );
|
||||
} );
|
||||
|
||||
add_action( 'duplicate_post_post_copy', function( $new_post_id, $post ) {
|
||||
$original_template_type = get_post_meta( $post->ID, Document::TYPE_META_KEY, true );
|
||||
if ( ! empty( $original_template_type ) ) {
|
||||
update_post_meta( $new_post_id, Document::TYPE_META_KEY, $original_template_type );
|
||||
}
|
||||
}, 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Process post meta before WP importer.
|
||||
*
|
||||
* Normalize Elementor post meta on import, We need the `wp_slash` in order
|
||||
* to avoid the unslashing during the `add_post_meta`.
|
||||
*
|
||||
* Fired by `wp_import_post_meta` filter.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param array $post_meta Post meta.
|
||||
*
|
||||
* @return array Updated post meta.
|
||||
*/
|
||||
public static function on_wp_import_post_meta( $post_meta ) {
|
||||
$is_wp_importer_before_0_7 = self::is_wp_importer_before_0_7();
|
||||
|
||||
if ( $is_wp_importer_before_0_7 ) {
|
||||
foreach ( $post_meta as &$meta ) {
|
||||
if ( '_elementor_data' === $meta['key'] ) {
|
||||
$meta['value'] = wp_slash( $meta['value'] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $post_meta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is WP Importer Before 0.7
|
||||
*
|
||||
* Checks if WP Importer is installed, and whether its version is older than 0.7.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_wp_importer_before_0_7() {
|
||||
$wp_importer = get_plugins( '/wordpress-importer' );
|
||||
|
||||
if ( ! empty( $wp_importer ) ) {
|
||||
$wp_importer_version = $wp_importer['wordpress-importer.php']['Version'];
|
||||
|
||||
if ( version_compare( $wp_importer_version, '0.7', '<' ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process post meta before WXR importer.
|
||||
*
|
||||
* Normalize Elementor post meta on import with the new WP_importer, We need
|
||||
* the `wp_slash` in order to avoid the unslashing during the `add_post_meta`.
|
||||
*
|
||||
* Fired by `wxr_importer.pre_process.post_meta` filter.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param array $post_meta Post meta.
|
||||
*
|
||||
* @return array Updated post meta.
|
||||
*/
|
||||
public static function on_wxr_importer_pre_process_post_meta( $post_meta ) {
|
||||
$is_wp_importer_before_0_7 = self::is_wp_importer_before_0_7();
|
||||
|
||||
if ( $is_wp_importer_before_0_7 ) {
|
||||
if ( '_elementor_data' === $post_meta['key'] ) {
|
||||
$post_meta['value'] = wp_slash( $post_meta['value'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $post_meta;
|
||||
}
|
||||
}
|
||||
113
wp-content/plugins/elementor/includes/conditions.php
Normal file
113
wp-content/plugins/elementor/includes/conditions.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor conditions.
|
||||
*
|
||||
* Elementor conditions handler class introduce the compare conditions and the
|
||||
* check conditions methods.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Conditions {
|
||||
|
||||
/**
|
||||
* Compare conditions.
|
||||
*
|
||||
* Whether the two values comply the comparison operator.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param mixed $left_value First value to compare.
|
||||
* @param mixed $right_value Second value to compare.
|
||||
* @param string $operator Comparison operator.
|
||||
*
|
||||
* @return bool Whether the two values complies the comparison operator.
|
||||
*/
|
||||
public static function compare( $left_value, $right_value, $operator ) {
|
||||
switch ( $operator ) {
|
||||
case '==':
|
||||
return $left_value == $right_value;
|
||||
case '!=':
|
||||
return $left_value != $right_value;
|
||||
case '!==':
|
||||
return $left_value !== $right_value;
|
||||
case 'in':
|
||||
return in_array( $left_value, $right_value, true );
|
||||
case '!in':
|
||||
return ! in_array( $left_value, $right_value, true );
|
||||
case 'contains':
|
||||
return in_array( $right_value, $left_value, true );
|
||||
case '!contains':
|
||||
return ! in_array( $right_value, $left_value, true );
|
||||
case '<':
|
||||
return $left_value < $right_value;
|
||||
case '<=':
|
||||
return $left_value <= $right_value;
|
||||
case '>':
|
||||
return $left_value > $right_value;
|
||||
case '>=':
|
||||
return $left_value >= $right_value;
|
||||
default:
|
||||
return $left_value === $right_value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check conditions.
|
||||
*
|
||||
* Whether the comparison conditions comply.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param array $conditions The conditions to check.
|
||||
* @param array $comparison The comparison parameter.
|
||||
*
|
||||
* @return bool Whether the comparison conditions comply.
|
||||
*/
|
||||
public static function check( array $conditions, array $comparison ) {
|
||||
$is_or_condition = isset( $conditions['relation'] ) && 'or' === $conditions['relation'];
|
||||
|
||||
$condition_succeed = ! $is_or_condition;
|
||||
|
||||
foreach ( $conditions['terms'] as $term ) {
|
||||
if ( ! empty( $term['terms'] ) ) {
|
||||
$comparison_result = self::check( $term, $comparison );
|
||||
} else {
|
||||
preg_match( '/(\w+)(?:\[(\w+)])?/', $term['name'], $parsed_name );
|
||||
|
||||
$value = $comparison[ $parsed_name[1] ];
|
||||
|
||||
if ( ! empty( $parsed_name[2] ) ) {
|
||||
$value = $value[ $parsed_name[2] ];
|
||||
}
|
||||
|
||||
$operator = null;
|
||||
|
||||
if ( ! empty( $term['operator'] ) ) {
|
||||
$operator = $term['operator'];
|
||||
}
|
||||
|
||||
$comparison_result = self::compare( $value, $term['value'], $operator );
|
||||
}
|
||||
|
||||
if ( $is_or_condition ) {
|
||||
if ( $comparison_result ) {
|
||||
return true;
|
||||
}
|
||||
} elseif ( ! $comparison_result ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $condition_succeed;
|
||||
}
|
||||
}
|
||||
79
wp-content/plugins/elementor/includes/controls/alert.php
Normal file
79
wp-content/plugins/elementor/includes/controls/alert.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor alert control.
|
||||
*
|
||||
* A base control for creating alerts in the Editor panels.
|
||||
*
|
||||
* @since 3.19.0
|
||||
*/
|
||||
class Control_Alert extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get alert control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `alert`.
|
||||
*
|
||||
* @since 3.19.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'alert';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render alert control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 3.19.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<#
|
||||
const validAlertTypes = [ 'info', 'success', 'warning', 'danger' ];
|
||||
if ( ! validAlertTypes.includes( data.alert_type ) ) {
|
||||
data.alert_type = 'info';
|
||||
}
|
||||
data.content = elementor.compileTemplate( data.content, { view } );
|
||||
#>
|
||||
<div class="elementor-control-alert elementor-panel-alert elementor-panel-alert-{{ data.alert_type }}">
|
||||
<# if ( data.heading ) { #>
|
||||
<div class="elementor-control-alert-heading">{{{ data.heading }}}</div>
|
||||
<# } #>
|
||||
<# if ( data.content ) { #>
|
||||
<div class="elementor-control-alert-content ">{{{ data.content }}}</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get alert control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the alert control. Used to return the
|
||||
* default settings while initializing the alert control.
|
||||
*
|
||||
* @since 3.19.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'alert_type' => '', // info, success, warning, danger.
|
||||
'heading' => '',
|
||||
'content' => '',
|
||||
];
|
||||
}
|
||||
}
|
||||
179
wp-content/plugins/elementor/includes/controls/animation.php
Normal file
179
wp-content/plugins/elementor/includes/controls/animation.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor animation control.
|
||||
*
|
||||
* A base control for creating entrance animation control. Displays a select box
|
||||
* with the available entrance animation effects @see Control_Animation::get_animations() .
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Animation extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get control type.
|
||||
*
|
||||
* Retrieve the animation control type.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'animation';
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve default control settings.
|
||||
*
|
||||
* Get the default settings of the control. Used to return the default
|
||||
* settings while initializing the control.
|
||||
*
|
||||
* @since 2.5.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
$default_settings['label_block'] = true;
|
||||
$default_settings['render_type'] = 'none';
|
||||
|
||||
return $default_settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get animations list.
|
||||
*
|
||||
* Retrieve the list of all the available animations.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Control type.
|
||||
*/
|
||||
public static function get_animations() {
|
||||
$animations = [
|
||||
'Fading' => [
|
||||
'fadeIn' => 'Fade In',
|
||||
'fadeInDown' => 'Fade In Down',
|
||||
'fadeInLeft' => 'Fade In Left',
|
||||
'fadeInRight' => 'Fade In Right',
|
||||
'fadeInUp' => 'Fade In Up',
|
||||
],
|
||||
'Zooming' => [
|
||||
'zoomIn' => 'Zoom In',
|
||||
'zoomInDown' => 'Zoom In Down',
|
||||
'zoomInLeft' => 'Zoom In Left',
|
||||
'zoomInRight' => 'Zoom In Right',
|
||||
'zoomInUp' => 'Zoom In Up',
|
||||
],
|
||||
'Bouncing' => [
|
||||
'bounceIn' => 'Bounce In',
|
||||
'bounceInDown' => 'Bounce In Down',
|
||||
'bounceInLeft' => 'Bounce In Left',
|
||||
'bounceInRight' => 'Bounce In Right',
|
||||
'bounceInUp' => 'Bounce In Up',
|
||||
],
|
||||
'Sliding' => [
|
||||
'slideInDown' => 'Slide In Down',
|
||||
'slideInLeft' => 'Slide In Left',
|
||||
'slideInRight' => 'Slide In Right',
|
||||
'slideInUp' => 'Slide In Up',
|
||||
],
|
||||
'Rotating' => [
|
||||
'rotateIn' => 'Rotate In',
|
||||
'rotateInDownLeft' => 'Rotate In Down Left',
|
||||
'rotateInDownRight' => 'Rotate In Down Right',
|
||||
'rotateInUpLeft' => 'Rotate In Up Left',
|
||||
'rotateInUpRight' => 'Rotate In Up Right',
|
||||
],
|
||||
'Attention Seekers' => [
|
||||
'bounce' => 'Bounce',
|
||||
'flash' => 'Flash',
|
||||
'pulse' => 'Pulse',
|
||||
'rubberBand' => 'Rubber Band',
|
||||
'shake' => 'Shake',
|
||||
'headShake' => 'Head Shake',
|
||||
'swing' => 'Swing',
|
||||
'tada' => 'Tada',
|
||||
'wobble' => 'Wobble',
|
||||
'jello' => 'Jello',
|
||||
],
|
||||
'Light Speed' => [
|
||||
'lightSpeedIn' => 'Light Speed In',
|
||||
],
|
||||
'Specials' => [
|
||||
'rollIn' => 'Roll In',
|
||||
],
|
||||
];
|
||||
|
||||
$additional_animations = [];
|
||||
|
||||
/**
|
||||
* Entrance animations.
|
||||
*
|
||||
* Filters the animations list displayed in the animations control.
|
||||
*
|
||||
* This hook can be used to register animations in addition to the
|
||||
* basic Elementor animations.
|
||||
*
|
||||
* @since 2.4.0
|
||||
*
|
||||
* @param array $additional_animations Additional animations array.
|
||||
*/
|
||||
$additional_animations = apply_filters( 'elementor/controls/animations/additional_animations', $additional_animations );
|
||||
|
||||
return array_merge( $animations, $additional_animations );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render animations control template.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
|
||||
<option value=""><?php echo esc_html__( 'Default', 'elementor' ); ?></option>
|
||||
<option value="none"><?php echo esc_html__( 'None', 'elementor' ); ?></option>
|
||||
<?php foreach ( static::get_animations() as $animations_group_name => $animations_group ) : ?>
|
||||
<optgroup label="<?php echo esc_attr( $animations_group_name ); ?>">
|
||||
<?php foreach ( $animations_group as $animation_name => $animation_title ) : ?>
|
||||
<option value="<?php echo esc_attr( $animation_name ); ?>"><?php echo esc_html( $animation_title ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
public static function get_assets( $setting ) {
|
||||
if ( ! $setting || 'none' === $setting ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'styles' => [ 'e-animations' ],
|
||||
];
|
||||
}
|
||||
}
|
||||
148
wp-content/plugins/elementor/includes/controls/base-data.php
Normal file
148
wp-content/plugins/elementor/includes/controls/base-data.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor base data control.
|
||||
*
|
||||
* An abstract class for creating new data controls in the panel.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Base_Data_Control extends Base_Control {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$default_value = $this->get_default_value();
|
||||
|
||||
if ( '' !== $default_value ) {
|
||||
$this->set_settings( 'default_value', $default_value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data control default value.
|
||||
*
|
||||
* Retrieve the default value of the data control. Used to return the default
|
||||
* values while initializing the data control.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data control value.
|
||||
*
|
||||
* Retrieve the value of the data control from a specific Controls_Stack settings.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $control Control
|
||||
* @param array $settings Element settings
|
||||
*
|
||||
* @return mixed Control values.
|
||||
*/
|
||||
public function get_value( $control, $settings ) {
|
||||
if ( ! isset( $control['default'] ) ) {
|
||||
$control['default'] = $this->get_default_value();
|
||||
}
|
||||
|
||||
if ( isset( $settings[ $control['name'] ] ) ) {
|
||||
$value = $settings[ $control['name'] ];
|
||||
} else {
|
||||
$value = $control['default'];
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse dynamic tags.
|
||||
*
|
||||
* Iterates through all the controls and renders all the dynamic tags.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $dynamic_value The dynamic tag text.
|
||||
* @param array $dynamic_settings The dynamic tag settings.
|
||||
*
|
||||
* @return string|string[]|mixed A string or an array of strings with the
|
||||
* return value from each tag callback function.
|
||||
*/
|
||||
public function parse_tags( $dynamic_value, $dynamic_settings ) {
|
||||
$current_dynamic_settings = $this->get_settings( 'dynamic' );
|
||||
|
||||
if ( is_array( $current_dynamic_settings ) ) {
|
||||
$dynamic_settings = array_merge( $current_dynamic_settings, $dynamic_settings );
|
||||
}
|
||||
|
||||
return Plugin::$instance->dynamic_tags->parse_tags_text( $dynamic_value, $dynamic_settings, [ Plugin::$instance->dynamic_tags, 'get_tag_data_content' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data control style value.
|
||||
*
|
||||
* Retrieve the style of the control. Used when adding CSS rules to the control
|
||||
* while extracting CSS from the `selectors` data argument.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 2.3.3 New `$control_data` parameter added.
|
||||
* @access public
|
||||
*
|
||||
* @param string $css_property CSS property.
|
||||
* @param string $control_value Control value.
|
||||
* @param array $control_data Control Data.
|
||||
*
|
||||
* @return string Control style value.
|
||||
*/
|
||||
public function get_style_value( $css_property, $control_value, array $control_data ) {
|
||||
if ( 'DEFAULT' === $css_property ) {
|
||||
return $control_data['default'];
|
||||
}
|
||||
|
||||
return $control_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data control unique ID.
|
||||
*
|
||||
* Retrieve the unique ID of the control. Used to set a uniq CSS ID for the
|
||||
* element.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access protected
|
||||
*
|
||||
* @param string $input_type Input type. Default is 'default'.
|
||||
*
|
||||
* @return string Unique ID.
|
||||
*/
|
||||
protected function get_control_uid( $input_type = 'default' ) {
|
||||
return 'elementor-control-' . $input_type . '-{{{ data._cid }}}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Safe Print data control unique ID.
|
||||
*
|
||||
* Retrieve the unique ID of the control. Used to set a unique CSS ID for the
|
||||
* element.
|
||||
*
|
||||
* @access protected
|
||||
*
|
||||
* @param string $input_type Input type. Default is 'default'.
|
||||
*/
|
||||
protected function print_control_uid( $input_type = 'default' ) {
|
||||
echo esc_attr( $this->get_control_uid( $input_type ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
abstract class Base_Icon_Font {
|
||||
|
||||
/**
|
||||
* Get Icon type.
|
||||
*
|
||||
* Retrieve the icon type.
|
||||
*
|
||||
* @access public
|
||||
* @abstract
|
||||
*/
|
||||
abstract public function get_type();
|
||||
|
||||
/**
|
||||
* Enqueue Icon scripts and styles.
|
||||
*
|
||||
* Used to register and enqueue custom scripts and styles used by the Icon.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
abstract public function enqueue();
|
||||
|
||||
/**
|
||||
* get_css_prefix
|
||||
* @return string
|
||||
*/
|
||||
abstract public function get_css_prefix();
|
||||
|
||||
abstract public function get_icons();
|
||||
|
||||
public function __construct() {}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor control base multiple.
|
||||
*
|
||||
* An abstract class for creating new controls in the panel that return
|
||||
* more than a single value. Each value of the multi-value control will
|
||||
* be returned as an item in a `key => value` array.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Control_Base_Multiple extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get multiple control default value.
|
||||
*
|
||||
* Retrieve the default value of the multiple control. Used to return the default
|
||||
* values while initializing the multiple control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get multiple control value.
|
||||
*
|
||||
* Retrieve the value of the multiple control from a specific Controls_Stack settings.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $control Control
|
||||
* @param array $settings Settings
|
||||
*
|
||||
* @return mixed Control values.
|
||||
*/
|
||||
public function get_value( $control, $settings ) {
|
||||
$value = parent::get_value( $control, $settings );
|
||||
|
||||
if ( empty( $control['default'] ) ) {
|
||||
$control['default'] = [];
|
||||
}
|
||||
|
||||
if ( ! is_array( $value ) ) {
|
||||
$value = [];
|
||||
}
|
||||
|
||||
$control['default'] = array_merge(
|
||||
$this->get_default_value(),
|
||||
$control['default']
|
||||
);
|
||||
|
||||
return array_merge(
|
||||
$control['default'],
|
||||
$value
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get multiple control style value.
|
||||
*
|
||||
* Retrieve the style of the control. Used when adding CSS rules to the control
|
||||
* while extracting CSS from the `selectors` data argument.
|
||||
*
|
||||
* @since 1.0.5
|
||||
* @since 2.3.3 New `$control_data` parameter added.
|
||||
* @access public
|
||||
*
|
||||
* @param string $css_property CSS property.
|
||||
* @param array $control_value Control value.
|
||||
* @param array $control_data Control Data.
|
||||
*
|
||||
* @return array Control style value.
|
||||
*/
|
||||
public function get_style_value( $css_property, $control_value, array $control_data ) {
|
||||
return $control_value[ strtolower( $css_property ) ];
|
||||
}
|
||||
}
|
||||
31
wp-content/plugins/elementor/includes/controls/base-ui.php
Normal file
31
wp-content/plugins/elementor/includes/controls/base-ui.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor base UI control.
|
||||
*
|
||||
* An abstract class for creating new UI controls in the panel.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Base_UI_Control extends Base_Control {
|
||||
|
||||
/**
|
||||
* Get features.
|
||||
*
|
||||
* Retrieve the list of all the available features.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Features array.
|
||||
*/
|
||||
public static function get_features() {
|
||||
return [ 'ui' ];
|
||||
}
|
||||
}
|
||||
159
wp-content/plugins/elementor/includes/controls/base-units.php
Normal file
159
wp-content/plugins/elementor/includes/controls/base-units.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor control base units.
|
||||
*
|
||||
* An abstract class for creating new unit controls in the panel.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Control_Base_Units extends Control_Base_Multiple {
|
||||
|
||||
/**
|
||||
* Get units control default value.
|
||||
*
|
||||
* Retrieve the default value of the units control. Used to return the default
|
||||
* values while initializing the units control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [
|
||||
'unit' => 'px',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get units control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the units control. Used to return the default
|
||||
* settings while initializing the units control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'size_units' => [ 'px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
'em' => [
|
||||
'min' => 0.1,
|
||||
'max' => 10,
|
||||
'step' => 0.1,
|
||||
],
|
||||
'rem' => [
|
||||
'min' => 0.1,
|
||||
'max' => 10,
|
||||
'step' => 0.1,
|
||||
],
|
||||
'%' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
'deg' => [
|
||||
'min' => 0,
|
||||
'max' => 360,
|
||||
'step' => 1,
|
||||
],
|
||||
'grad' => [
|
||||
'min' => 0,
|
||||
'max' => 400,
|
||||
'step' => 1,
|
||||
],
|
||||
'rad' => [
|
||||
'min' => 0,
|
||||
'max' => 6.2832,
|
||||
'step' => 0.0001,
|
||||
],
|
||||
'turn' => [
|
||||
'min' => 0,
|
||||
'max' => 1,
|
||||
'step' => 0.01,
|
||||
],
|
||||
'vh' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
'vw' => [
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
],
|
||||
's' => [
|
||||
'min' => 0,
|
||||
'max' => 3,
|
||||
'step' => 0.1,
|
||||
],
|
||||
'ms' => [
|
||||
'min' => 0,
|
||||
'max' => 3000,
|
||||
'step' => 100,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Print units control settings.
|
||||
*
|
||||
* Used to generate the units control template in the editor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*/
|
||||
protected function print_units_template() {
|
||||
?>
|
||||
<# if ( data.size_units && data.size_units.length > 1 ) { #>
|
||||
<div class="e-units-wrapper">
|
||||
<div class="e-units-switcher">
|
||||
<span></span>
|
||||
<i class="eicon-edit" aria-hidden="true"></i>
|
||||
<i class="eicon-angle-right" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Switch units', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="e-units-choices">
|
||||
<# _.each( data.size_units, function( unit ) { #>
|
||||
<input id="elementor-choose-{{ data._cid + data.name + unit }}" type="radio" name="elementor-choose-{{ data.name + data._cid }}" data-setting="unit" value="{{ unit }}">
|
||||
<label class="elementor-units-choices-label" for="elementor-choose-{{ data._cid + data.name + unit }}" data-choose="{{{ unit }}}">
|
||||
<# if ( 'custom' === unit ) { #>
|
||||
<i class="eicon-edit" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Custom unit', 'elementor' ); ?></span>
|
||||
<# } else { #>
|
||||
<span>{{{ unit }}}</span>
|
||||
<# } #>
|
||||
</label>
|
||||
<# } ); #>
|
||||
</div>
|
||||
</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function get_style_value( $css_property, $control_value, array $control_data ) {
|
||||
$return_value = parent::get_style_value( $css_property, $control_value, $control_data );
|
||||
|
||||
if ( 'UNIT' === $css_property && 'custom' === $return_value ) {
|
||||
$return_value = '__EMPTY__';
|
||||
}
|
||||
|
||||
return $return_value;
|
||||
}
|
||||
}
|
||||
156
wp-content/plugins/elementor/includes/controls/base.php
Normal file
156
wp-content/plugins/elementor/includes/controls/base.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Base\Base_Object;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor base control.
|
||||
*
|
||||
* An abstract class for creating new controls in the panel.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Base_Control extends Base_Object {
|
||||
|
||||
/**
|
||||
* Base settings.
|
||||
*
|
||||
* Holds all the base settings of the control.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_base_settings = [
|
||||
'label' => '',
|
||||
'description' => '',
|
||||
'show_label' => true,
|
||||
'label_block' => false,
|
||||
'separator' => 'default',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get features.
|
||||
*
|
||||
* Retrieve the list of all the available features. Currently Elementor uses only
|
||||
* the `UI` feature.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Features array.
|
||||
*/
|
||||
public static function get_features() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get control type.
|
||||
*
|
||||
* Retrieve the control type.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
* @abstract
|
||||
*/
|
||||
abstract public function get_type();
|
||||
|
||||
/**
|
||||
* Control base constructor.
|
||||
*
|
||||
* Initializing the control base class.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->set_settings( array_merge( $this->_base_settings, $this->get_default_settings() ) );
|
||||
|
||||
$this->set_settings( 'features', static::get_features() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue control scripts and styles.
|
||||
*
|
||||
* Used to register and enqueue custom scripts and styles used by the control.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {}
|
||||
|
||||
/**
|
||||
* Control content template.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* Note that the content template is wrapped by Base_Control::print_template().
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
* @abstract
|
||||
*/
|
||||
abstract public function content_template();
|
||||
|
||||
/**
|
||||
* Print control template.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*/
|
||||
final public function print_template() {
|
||||
?>
|
||||
<script type="text/html" id="tmpl-elementor-control-<?php echo esc_attr( $this->get_type() ); ?>-content">
|
||||
<div class="elementor-control-content">
|
||||
<?php
|
||||
$this->content_template();
|
||||
?>
|
||||
</div>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default control settings.
|
||||
*
|
||||
* Retrieve the default settings of the control. Used to return the default
|
||||
* settings while initializing the control.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function get_assets( $setting ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Update value of control that needs to be updated after import.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $control_args
|
||||
* @param array $config
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function on_import_update_settings( $value, array $control_args, array $config ) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
128
wp-content/plugins/elementor/includes/controls/box-shadow.php
Normal file
128
wp-content/plugins/elementor/includes/controls/box-shadow.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor box shadow control.
|
||||
*
|
||||
* A base control for creating box shadows control. Displays input fields for
|
||||
* horizontal shadow, vertical shadow, shadow blur, shadow spread and shadow
|
||||
* color.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Box_Shadow extends Control_Base_Multiple {
|
||||
|
||||
/**
|
||||
* Get box shadow control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `box_shadow`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'box_shadow';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get box shadow control default value.
|
||||
*
|
||||
* Retrieve the default value of the box shadow control. Used to return the
|
||||
* default values while initializing the box shadow control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [
|
||||
'horizontal' => 0,
|
||||
'vertical' => 0,
|
||||
'blur' => 10,
|
||||
'spread' => 0,
|
||||
'color' => 'rgba(0,0,0,0.5)',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get box shadow control sliders.
|
||||
*
|
||||
* Retrieve the sliders of the box shadow control. Sliders are used while
|
||||
* rendering the control output in the editor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control sliders.
|
||||
*/
|
||||
public function get_sliders() {
|
||||
return [
|
||||
'horizontal' => [
|
||||
'label' => esc_html__( 'Horizontal', 'elementor' ),
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
'vertical' => [
|
||||
'label' => esc_html__( 'Vertical', 'elementor' ),
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
'blur' => [
|
||||
'label' => esc_html__( 'Blur', 'elementor' ),
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
'spread' => [
|
||||
'label' => esc_html__( 'Spread', 'elementor' ),
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render box shadow control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-shadow-box">
|
||||
<div class="elementor-control-field elementor-color-picker-wrapper">
|
||||
<label class="elementor-control-title"><?php echo esc_html__( 'Color', 'elementor' ); ?></label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-unit-1">
|
||||
<div class="elementor-color-picker-placeholder"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
foreach ( $this->get_sliders() as $slider_name => $slider ) :
|
||||
?>
|
||||
<div class="elementor-shadow-slider elementor-control-type-slider">
|
||||
<label for="<?php $this->print_control_uid( $slider_name ); ?>" class="elementor-control-title"><?php
|
||||
// PHPCS - the value of $slider['label'] is already escaped.
|
||||
echo $slider['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?></label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<div class="elementor-slider" data-input="<?php echo esc_attr( $slider_name ); ?>"></div>
|
||||
<div class="elementor-slider-input elementor-control-unit-2">
|
||||
<input id="<?php $this->print_control_uid( $slider_name ); ?>" type="number" min="<?php echo esc_attr( $slider['min'] ); ?>" max="<?php echo esc_attr( $slider['max'] ); ?>" data-setting="<?php echo esc_attr( $slider_name ); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
75
wp-content/plugins/elementor/includes/controls/button.php
Normal file
75
wp-content/plugins/elementor/includes/controls/button.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor button control.
|
||||
*
|
||||
* A base control for creating a button control. Displays a button that can
|
||||
* trigger an event.
|
||||
*
|
||||
* @since 1.9.0
|
||||
*/
|
||||
class Control_Button extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get button control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `button`.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'button';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get button control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the button control. Used to
|
||||
* return the default settings while initializing the button
|
||||
* control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'text' => '',
|
||||
'event' => '',
|
||||
'button_type' => 'default',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render button control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<button type="button" class="elementor-button elementor-button-{{{ data.button_type }}}" data-event="{{{ data.event }}}">{{{ data.text }}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
83
wp-content/plugins/elementor/includes/controls/choose.php
Normal file
83
wp-content/plugins/elementor/includes/controls/choose.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor choose control.
|
||||
*
|
||||
* A base control for creating choose control. Displays radio buttons styled as
|
||||
* groups of buttons with icons for each option.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Choose extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get choose control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `choose`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'choose';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render choose control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
$control_uid_input_type = '{{value}}';
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<div class="elementor-choices">
|
||||
<# _.each( data.options, function( options, value ) { #>
|
||||
<input id="<?php $this->print_control_uid( $control_uid_input_type ); ?>" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ value }}">
|
||||
<label class="elementor-choices-label elementor-control-unit-1 tooltip-target" for="<?php $this->print_control_uid( $control_uid_input_type ); ?>" data-tooltip="{{ options.title }}" title="{{ options.title }}">
|
||||
<i class="{{ options.icon }}" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only">{{{ options.title }}}</span>
|
||||
</label>
|
||||
<# } ); #>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get choose control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the choose control. Used to return the
|
||||
* default settings while initializing the choose control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'options' => [],
|
||||
'toggle' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
83
wp-content/plugins/elementor/includes/controls/code.php
Normal file
83
wp-content/plugins/elementor/includes/controls/code.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor code control.
|
||||
*
|
||||
* A base control for creating code control. Displays a code editor textarea.
|
||||
* Based on Ace editor (@see https://ace.c9.io/).
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Code extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get code control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `code`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'code';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get code control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the code control. Used to return the default
|
||||
* settings while initializing the code control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'language' => 'html', // html/css
|
||||
'rows' => 10,
|
||||
'ai' => [
|
||||
'active' => true,
|
||||
'type' => 'code',
|
||||
],
|
||||
'dynamic' => [
|
||||
'categories' => [ TagsModule::TEXT_CATEGORY ],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render code control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
|
||||
<textarea id="<?php $this->print_control_uid(); ?>" rows="{{ data.rows }}" class="e-input-style elementor-code-editor" data-setting="{{ data.name }}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
86
wp-content/plugins/elementor/includes/controls/color.php
Normal file
86
wp-content/plugins/elementor/includes/controls/color.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor color control.
|
||||
*
|
||||
* A base control for creating color control. Displays a color picker field with
|
||||
* an alpha slider. Includes a customizable color palette that can be preset by
|
||||
* the user. Accepts a `scheme` argument that allows you to set a value from the
|
||||
* active color scheme as the default value returned by the control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Color extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get color control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `color`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'color';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render color control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label class="elementor-control-title">{{{ data.label || '' }}}</label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper elementor-control-unit-5">
|
||||
<div class="elementor-color-picker-placeholder"></div>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get color control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the color control. Used to return the default
|
||||
* settings while initializing the color control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'alpha' => true,
|
||||
'scheme' => '',
|
||||
'dynamic' => [
|
||||
'categories' => [
|
||||
TagsModule::COLOR_CATEGORY,
|
||||
],
|
||||
'active' => true,
|
||||
],
|
||||
'global' => [
|
||||
'active' => true,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
80
wp-content/plugins/elementor/includes/controls/date-time.php
Normal file
80
wp-content/plugins/elementor/includes/controls/date-time.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor date/time control.
|
||||
*
|
||||
* A base control for creating date time control. Displays a date/time picker
|
||||
* based on the Flatpickr library @see https://chmln.github.io/flatpickr/ .
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Date_Time extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get date time control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `date_time`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'date_time';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get date time control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the date time control. Used to return the
|
||||
* default settings while initializing the date time control.
|
||||
*
|
||||
* @since 1.8.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'picker_options' => [],
|
||||
'dynamic' => [
|
||||
'categories' => [
|
||||
TagsModule::DATETIME_CATEGORY,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render date time control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
|
||||
<input id="<?php $this->print_control_uid(); ?>" placeholder="{{ view.getControlPlaceholder() }}" class="elementor-date-time-picker flatpickr elementor-control-tag-area" type="text" data-setting="{{ data.name }}">
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor Deprecated Notice control.
|
||||
*
|
||||
* A base control specific for creating Deprecation Notices control.
|
||||
* Displays a warning notice in the panel.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
class Control_Deprecated_Notice extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get deprecated-notice control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `deprecated_notice`.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'deprecated_notice';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render deprecated notice control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<# if ( data.label ) { #>
|
||||
<span class="elementor-control-title">{{{ data.label }}}</span>
|
||||
<#
|
||||
}
|
||||
let notice = wp.i18n.sprintf( wp.i18n.__( 'The <strong>%1$s</strong> widget has been deprecated since %2$s %3$s.', 'elementor' ), data.widget, data.plugin, data.since );
|
||||
if ( data.replacement ) {
|
||||
notice += '<br>' + wp.i18n.sprintf( wp.i18n.__( 'It has been replaced by <strong>%1$s</strong>.', 'elementor' ), data.replacement );
|
||||
}
|
||||
if ( data.last ) {
|
||||
notice += '<br>' + wp.i18n.sprintf( wp.i18n.__( 'Note that %1$s will be completely removed once %2$s %3$s is released.', 'elementor' ), data.widget, data.plugin, data.last );
|
||||
}
|
||||
#>
|
||||
<div class="elementor-control-deprecated-notice elementor-panel-alert elementor-panel-alert-warning">{{{ notice }}}</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get deprecated-notice control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the deprecated notice control. Used to return the
|
||||
* default settings while initializing the deprecated notice control.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'widget' => '', // Widgets name
|
||||
'since' => '', // Plugin version widget was deprecated
|
||||
'last' => '', // Plugin version in which the widget will be removed
|
||||
'plugin' => '', // Plugin's title
|
||||
'replacement' => '', // Widget replacement
|
||||
];
|
||||
}
|
||||
}
|
||||
160
wp-content/plugins/elementor/includes/controls/dimensions.php
Normal file
160
wp-content/plugins/elementor/includes/controls/dimensions.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor dimension control.
|
||||
*
|
||||
* A base control for creating dimension control. Displays input fields for top,
|
||||
* right, bottom, left and the option to link them together.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Dimensions extends Control_Base_Units {
|
||||
|
||||
/**
|
||||
* Get dimensions control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `dimensions`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'dimensions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dimensions control default values.
|
||||
*
|
||||
* Retrieve the default value of the dimensions control. Used to return the
|
||||
* default values while initializing the dimensions control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return array_merge(
|
||||
parent::get_default_value(), [
|
||||
'top' => '',
|
||||
'right' => '',
|
||||
'bottom' => '',
|
||||
'left' => '',
|
||||
'isLinked' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function get_singular_name() {
|
||||
return 'dimension';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dimensions control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the dimensions control. Used to return the
|
||||
* default settings while initializing the dimensions control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return array_merge(
|
||||
parent::get_default_settings(), [
|
||||
'label_block' => true,
|
||||
'allowed_dimensions' => 'all',
|
||||
'placeholder' => '',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
protected function get_dimensions() {
|
||||
return [
|
||||
'top' => __( 'Top', 'elementor' ),
|
||||
'right' => __( 'Right', 'elementor' ),
|
||||
'bottom' => __( 'Bottom', 'elementor' ),
|
||||
'left' => __( 'Left', 'elementor' ),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render dimensions control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
$class_name = $this->get_singular_name();
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<?php $this->print_units_template(); ?>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<ul class="elementor-control-<?php echo esc_attr( $class_name ); ?>s">
|
||||
<?php
|
||||
foreach ( $this->get_dimensions() as $dimension_key => $dimension_title ) :
|
||||
?>
|
||||
<li class="elementor-control-<?php echo esc_attr( $class_name ); ?>">
|
||||
<input id="<?php $this->print_control_uid( $dimension_key ); ?>" type="text" data-setting="<?php
|
||||
// PHPCS - the variable $dimension_key is a plain text.
|
||||
echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?>" placeholder="<#
|
||||
placeholder = view.getControlPlaceholder();
|
||||
if ( _.isObject( placeholder ) && ! _.isUndefined( placeholder.<?php
|
||||
// PHPCS - the variable $dimension_key is a plain text.
|
||||
echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?> ) ) {
|
||||
print( placeholder.<?php
|
||||
// PHPCS - the variable $dimension_key is a plain text.
|
||||
echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?> );
|
||||
} else {
|
||||
print( placeholder );
|
||||
} #>"
|
||||
<# if ( -1 === _.indexOf( allowed_dimensions, '<?php
|
||||
// PHPCS - the variable $dimension_key is a plain text.
|
||||
echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?>' ) ) { #>
|
||||
disabled
|
||||
<# } #>
|
||||
/>
|
||||
<label for="<?php $this->print_control_uid( $dimension_key ); ?>" class="elementor-control-<?php echo esc_attr( $class_name ); ?>-label"><?php
|
||||
// PHPCS - the variable $dimension_title holds an escaped translated value.
|
||||
echo $dimension_title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?></label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<li>
|
||||
<button class="elementor-link-<?php echo esc_attr( $class_name ); ?>s tooltip-target" data-tooltip="<?php echo esc_attr__( 'Link values together', 'elementor' ); ?>">
|
||||
<span class="elementor-linked">
|
||||
<i class="eicon-link" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Link values together', 'elementor' ); ?></span>
|
||||
</span>
|
||||
<span class="elementor-unlinked">
|
||||
<i class="eicon-chain-broken" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Unlinked values', 'elementor' ); ?></span>
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
43
wp-content/plugins/elementor/includes/controls/divider.php
Normal file
43
wp-content/plugins/elementor/includes/controls/divider.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor divider control.
|
||||
*
|
||||
* A base control for creating divider control. Displays horizontal line in
|
||||
* the panel.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
class Control_Divider extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get divider control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `divider`.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'divider';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render divider control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor exit animation control.
|
||||
*
|
||||
* A control for creating exit animation. Displays a select box
|
||||
* with the available exit animation effects @see Control_Exit_Animation::get_animations() .
|
||||
*
|
||||
* @since 2.5.0
|
||||
*/
|
||||
class Control_Exit_Animation extends Control_Animation {
|
||||
|
||||
/**
|
||||
* Get control type.
|
||||
*
|
||||
* Retrieve the animation control type.
|
||||
*
|
||||
* @since 2.5.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'exit_animation';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get animations list.
|
||||
*
|
||||
* Retrieve the list of all the available animations.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Control type.
|
||||
*/
|
||||
public static function get_animations() {
|
||||
$animations = [
|
||||
'Fading' => [
|
||||
'fadeIn' => 'Fade Out',
|
||||
'fadeInDown' => 'Fade Out Up',
|
||||
'fadeInLeft' => 'Fade Out Left',
|
||||
'fadeInRight' => 'Fade Out Right',
|
||||
'fadeInUp' => 'Fade Out Down',
|
||||
],
|
||||
'Zooming' => [
|
||||
'zoomIn' => 'Zoom Out',
|
||||
'zoomInDown' => 'Zoom Out Up',
|
||||
'zoomInLeft' => 'Zoom Out Left',
|
||||
'zoomInRight' => 'Zoom Out Right',
|
||||
'zoomInUp' => 'Zoom Out Down',
|
||||
],
|
||||
'Sliding' => [
|
||||
'slideInDown' => 'Slide Out Up',
|
||||
'slideInLeft' => 'Slide Out Left',
|
||||
'slideInRight' => 'Slide Out Right',
|
||||
'slideInUp' => 'Slide Out Down',
|
||||
],
|
||||
'Rotating' => [
|
||||
'rotateIn' => 'Rotate Out',
|
||||
'rotateInDownLeft' => 'Rotate Out Up Left',
|
||||
'rotateInDownRight' => 'Rotate Out Up Right',
|
||||
'rotateInUpRight' => 'Rotate Out Down Left',
|
||||
'rotateInUpLeft' => 'Rotate Out Down Right',
|
||||
],
|
||||
'Light Speed' => [
|
||||
'lightSpeedIn' => 'Light Speed Out',
|
||||
],
|
||||
'Specials' => [
|
||||
'rollIn' => 'Roll Out',
|
||||
],
|
||||
];
|
||||
|
||||
$additional_animations = [];
|
||||
|
||||
/**
|
||||
* Exit animations.
|
||||
*
|
||||
* Filters the animations list displayed in the exit animations control.
|
||||
*
|
||||
* This hook can be used to register new animations in addition to the
|
||||
* basic Elementor exit animations.
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param array $additional_animations Additional animations array.
|
||||
*/
|
||||
$additional_animations = apply_filters( 'elementor/controls/exit-animations/additional_animations', $additional_animations );
|
||||
|
||||
return array_merge( $animations, $additional_animations );
|
||||
}
|
||||
|
||||
public static function get_assets( $setting ) {
|
||||
if ( ! $setting || 'none' === $setting ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'styles' => [ 'e-animations' ],
|
||||
];
|
||||
}
|
||||
}
|
||||
85
wp-content/plugins/elementor/includes/controls/font.php
Normal file
85
wp-content/plugins/elementor/includes/controls/font.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor font control.
|
||||
*
|
||||
* A base control for creating font control. Displays font select box. The
|
||||
* control allows you to set a list of fonts.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Font extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get font control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `font`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'font';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the font control. Used to return the default
|
||||
* settings while initializing the font control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'groups' => Fonts::get_font_groups(),
|
||||
'options' => Fonts::get_fonts(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render font control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-unit-5">
|
||||
<select id="<?php $this->print_control_uid(); ?>" class="elementor-control-font-family" data-setting="{{ data.name }}">
|
||||
<option value=""><?php echo esc_html__( 'Default', 'elementor' ); ?></option>
|
||||
<# _.each( data.groups, function( group_label, group_name ) {
|
||||
var groupFonts = getFontsByGroups( group_name );
|
||||
if ( ! _.isEmpty( groupFonts ) ) { #>
|
||||
<optgroup label="{{ group_label }}">
|
||||
<# _.each( groupFonts, function( fontType, fontName ) { #>
|
||||
<option value="{{ fontName }}">{{{ fontName }}}</option>
|
||||
<# } ); #>
|
||||
</optgroup>
|
||||
<# }
|
||||
}); #>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
172
wp-content/plugins/elementor/includes/controls/gallery.php
Normal file
172
wp-content/plugins/elementor/includes/controls/gallery.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Utils\Hints;
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor gallery control.
|
||||
*
|
||||
* A base control for creating gallery chooser control. Based on the WordPress
|
||||
* media library galleries. Used to select images from the WordPress media library.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Gallery extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get gallery control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `gallery`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'gallery';
|
||||
}
|
||||
|
||||
/**
|
||||
* Import gallery images.
|
||||
*
|
||||
* Used to import gallery control files from external sites while importing
|
||||
* Elementor template JSON file, and replacing the old data.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $settings Control settings
|
||||
*
|
||||
* @return array Control settings.
|
||||
*/
|
||||
public function on_import( $settings ) {
|
||||
foreach ( $settings as &$attachment ) {
|
||||
if ( empty( $attachment['url'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$attachment = Plugin::$instance->templates_manager->get_import_images_instance()->import( $attachment );
|
||||
}
|
||||
|
||||
// Filter out attachments that don't exist
|
||||
$settings = array_filter( $settings );
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render gallery control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<div class="elementor-control-title">{{{ data.label }}}</div>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<div class="elementor-control-media__content elementor-control-tag-area">
|
||||
<div class="elementor-control-gallery-status elementor-control-dynamic-switcher-wrapper">
|
||||
<span class="elementor-control-gallery-status-title"></span>
|
||||
<button class="elementor-control-gallery-clear elementor-control-unit-1 tooltip-target" data-tooltip="<?php echo esc_attr__( 'Clear gallery', 'elementor' ); ?>">
|
||||
<i class="eicon-trash-o" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Clear gallery', 'elementor' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="elementor-control-gallery-content">
|
||||
<div class="elementor-control-gallery-thumbnails" tabindex="0"></div>
|
||||
<div class="elementor-control-gallery-edit">
|
||||
<span><i class="eicon-pencil" aria-hidden="true"></i></span>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Edit gallery', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<button class="elementor-button elementor-control-gallery-add tooltip-target" data-tooltip="<?php echo esc_attr__( 'Add Images', 'elementor' ); ?>">
|
||||
<i class="eicon-plus-circle" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Add Images', 'elementor' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php /* ?>
|
||||
<div class="elementor-control-media__warnings" role="alert" style="display: none;">
|
||||
<?php
|
||||
Hints::get_notice_template( [
|
||||
'type' => 'warning',
|
||||
'content' => esc_html__( 'This image doesn’t contain ALT text - which is necessary for accessibility and SEO.', 'elementor' ),
|
||||
'icon' => true,
|
||||
] );
|
||||
?>
|
||||
</div>
|
||||
<?php */ ?>
|
||||
|
||||
<?php if ( Hints::should_display_hint( 'image-optimization' ) ) : ?>
|
||||
<div class="elementor-control-media__promotions" role="alert" style="display: none;">
|
||||
<?php
|
||||
Hints::get_notice_template( [
|
||||
'display' => ! Hints::is_dismissed( 'image-optimization' ),
|
||||
'type' => 'info',
|
||||
'content' => __( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ),
|
||||
'icon' => true,
|
||||
'dismissible' => 'image_optimizer_hint',
|
||||
'button_text' => Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate Plugin', 'elementor' ) : __( 'Install Plugin', 'elementor' ),
|
||||
'button_event' => 'image_optimizer_hint',
|
||||
'button_data' => [
|
||||
'action_url' => Hints::get_plugin_action_url( 'image-optimization' ),
|
||||
],
|
||||
] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gallery control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the gallery control. Used to return the
|
||||
* default settings while initializing the gallery control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'dynamic' => [
|
||||
'categories' => [ TagsModule::GALLERY_CATEGORY ],
|
||||
'returnType' => 'object',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gallery control default values.
|
||||
*
|
||||
* Retrieve the default value of the gallery control. Used to return the default
|
||||
* values while initializing the gallery control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
78
wp-content/plugins/elementor/includes/controls/gaps.php
Normal file
78
wp-content/plugins/elementor/includes/controls/gaps.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor gap control.
|
||||
*
|
||||
* A base control for creating a gap control. Displays input fields for two values,
|
||||
* row/column, height/width and the option to link them together.
|
||||
*
|
||||
* @since 3.13.0
|
||||
*/
|
||||
|
||||
class Control_Gaps extends Control_Dimensions {
|
||||
/**
|
||||
* Get gap control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `gap`.
|
||||
*
|
||||
* @since 3.13.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'gaps';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gap control default values.
|
||||
*
|
||||
* Retrieve the default value of the gap control. Used to return the default
|
||||
* values while initializing the gap control.
|
||||
*
|
||||
* @since 3.13.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [
|
||||
'column' => '',
|
||||
'row' => '',
|
||||
'isLinked' => true,
|
||||
'unit' => 'px',
|
||||
];
|
||||
}
|
||||
|
||||
public function get_singular_name() {
|
||||
return 'gap';
|
||||
}
|
||||
|
||||
protected function get_dimensions() {
|
||||
return [
|
||||
'column' => esc_html__( 'Column', 'elementor' ),
|
||||
'row' => esc_html__( 'Row', 'elementor' ),
|
||||
];
|
||||
}
|
||||
|
||||
public function get_value( $control, $settings ) {
|
||||
$value = parent::get_value( $control, $settings );
|
||||
|
||||
// BC for any old Slider control values.
|
||||
if ( $this->should_update_gaps_values( $value ) ) {
|
||||
$value['column'] = strval( $value['size'] );
|
||||
$value['row'] = strval( $value['size'] );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function should_update_gaps_values( $value ) {
|
||||
return isset( $value['size'] ) && '' !== $value['size'] && '' === $value['column'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,855 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor background control.
|
||||
*
|
||||
* A base control for creating background control. Displays input fields to define
|
||||
* the background color, background image, background gradient or background video.
|
||||
*
|
||||
* @since 1.2.2
|
||||
*/
|
||||
class Group_Control_Background extends Group_Control_Base {
|
||||
|
||||
/**
|
||||
* Fields.
|
||||
*
|
||||
* Holds all the background control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
* @static
|
||||
*
|
||||
* @var array Background control fields.
|
||||
*/
|
||||
protected static $fields;
|
||||
|
||||
/**
|
||||
* Background Types.
|
||||
*
|
||||
* Holds all the available background types.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $background_types;
|
||||
|
||||
/**
|
||||
* Get background control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `background`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'background';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get background control types.
|
||||
*
|
||||
* Retrieve available background types.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Available background types.
|
||||
*/
|
||||
public static function get_background_types() {
|
||||
if ( null === self::$background_types ) {
|
||||
self::$background_types = self::get_default_background_types();
|
||||
}
|
||||
|
||||
return self::$background_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Default background types.
|
||||
*
|
||||
* Retrieve background control initial types.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @return array Default background types.
|
||||
*/
|
||||
private static function get_default_background_types() {
|
||||
return [
|
||||
'classic' => [
|
||||
'title' => esc_html__( 'Classic', 'elementor' ),
|
||||
'icon' => 'eicon-paint-brush',
|
||||
],
|
||||
'gradient' => [
|
||||
'title' => esc_html__( 'Gradient', 'elementor' ),
|
||||
'icon' => 'eicon-barcode',
|
||||
],
|
||||
'video' => [
|
||||
'title' => esc_html__( 'Video', 'elementor' ),
|
||||
'icon' => 'eicon-video-camera',
|
||||
],
|
||||
'slideshow' => [
|
||||
'title' => esc_html__( 'Slideshow', 'elementor' ),
|
||||
'icon' => 'eicon-slideshow',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize background control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access public
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
public function init_fields() {
|
||||
$active_breakpoints = Plugin::$instance->breakpoints->get_active_breakpoints();
|
||||
|
||||
$location_device_args = [];
|
||||
$location_device_defaults = [
|
||||
'default' => [
|
||||
'unit' => '%',
|
||||
],
|
||||
];
|
||||
|
||||
$angel_device_args = [];
|
||||
$angel_device_defaults = [
|
||||
'default' => [
|
||||
'unit' => 'deg',
|
||||
],
|
||||
];
|
||||
|
||||
$position_device_args = [];
|
||||
$position_device_defaults = [
|
||||
'default' => 'center center',
|
||||
];
|
||||
|
||||
foreach ( $active_breakpoints as $breakpoint_name => $breakpoint ) {
|
||||
$location_device_args[ $breakpoint_name ] = $location_device_defaults;
|
||||
$angel_device_args[ $breakpoint_name ] = $angel_device_defaults;
|
||||
$position_device_args[ $breakpoint_name ] = $position_device_defaults;
|
||||
}
|
||||
|
||||
$fields = [];
|
||||
|
||||
$fields['background'] = [
|
||||
'label' => esc_html__( 'Background Type', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'render_type' => 'ui',
|
||||
];
|
||||
|
||||
$fields['gradient_notice'] = [
|
||||
'type' => Controls_Manager::ALERT,
|
||||
'alert_type' => 'warning',
|
||||
'content' => esc_html__( 'Set locations and angle for each breakpoint to ensure the gradient adapts to different screen sizes.', 'elementor' ),
|
||||
'render_type' => 'ui',
|
||||
'condition' => [
|
||||
'background' => [ 'gradient' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['color'] = [
|
||||
'label' => esc_html__( 'Color', 'elementor' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'title' => esc_html__( 'Background Color', 'elementor' ),
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-color: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic', 'gradient', 'video' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['color_stop'] = [
|
||||
'label' => esc_html_x( 'Location', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ '%', 'custom' ],
|
||||
'default' => [
|
||||
'unit' => '%',
|
||||
'size' => 0,
|
||||
],
|
||||
'device_args' => $location_device_args,
|
||||
'responsive' => true,
|
||||
'render_type' => 'ui',
|
||||
'condition' => [
|
||||
'background' => [ 'gradient' ],
|
||||
],
|
||||
'of_type' => 'gradient',
|
||||
];
|
||||
|
||||
$fields['color_b'] = [
|
||||
'label' => esc_html__( 'Second Color', 'elementor' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#f2295b',
|
||||
'render_type' => 'ui',
|
||||
'control_type' => 'content',
|
||||
'condition' => [
|
||||
'background' => [ 'gradient' ],
|
||||
],
|
||||
'of_type' => 'gradient',
|
||||
];
|
||||
|
||||
$fields['color_b_stop'] = [
|
||||
'label' => esc_html_x( 'Location', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ '%', 'custom' ],
|
||||
'default' => [
|
||||
'unit' => '%',
|
||||
'size' => 100,
|
||||
],
|
||||
'device_args' => $location_device_args,
|
||||
'responsive' => true,
|
||||
'render_type' => 'ui',
|
||||
'condition' => [
|
||||
'background' => [ 'gradient' ],
|
||||
],
|
||||
'of_type' => 'gradient',
|
||||
];
|
||||
|
||||
$fields['gradient_type'] = [
|
||||
'label' => esc_html_x( 'Type', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'linear' => esc_html__( 'Linear', 'elementor' ),
|
||||
'radial' => esc_html__( 'Radial', 'elementor' ),
|
||||
],
|
||||
'default' => 'linear',
|
||||
'render_type' => 'ui',
|
||||
'condition' => [
|
||||
'background' => [ 'gradient' ],
|
||||
],
|
||||
'of_type' => 'gradient',
|
||||
];
|
||||
|
||||
$fields['gradient_angle'] = [
|
||||
'label' => esc_html__( 'Angle', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ],
|
||||
'default' => [
|
||||
'unit' => 'deg',
|
||||
'size' => 180,
|
||||
],
|
||||
'device_args' => $angel_device_args,
|
||||
'responsive' => true,
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-color: transparent; background-image: linear-gradient({{SIZE}}{{UNIT}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'gradient' ],
|
||||
'gradient_type' => 'linear',
|
||||
],
|
||||
'of_type' => 'gradient',
|
||||
];
|
||||
|
||||
$fields['gradient_position'] = [
|
||||
'label' => esc_html__( 'Position', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'center center' => esc_html__( 'Center Center', 'elementor' ),
|
||||
'center left' => esc_html__( 'Center Left', 'elementor' ),
|
||||
'center right' => esc_html__( 'Center Right', 'elementor' ),
|
||||
'top center' => esc_html__( 'Top Center', 'elementor' ),
|
||||
'top left' => esc_html__( 'Top Left', 'elementor' ),
|
||||
'top right' => esc_html__( 'Top Right', 'elementor' ),
|
||||
'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
|
||||
'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
|
||||
'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
|
||||
],
|
||||
'default' => 'center center',
|
||||
'device_args' => $position_device_args,
|
||||
'responsive' => true,
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-color: transparent; background-image: radial-gradient(at {{VALUE}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'gradient' ],
|
||||
'gradient_type' => 'radial',
|
||||
],
|
||||
'of_type' => 'gradient',
|
||||
];
|
||||
|
||||
$fields['image'] = [
|
||||
'label' => esc_html__( 'Image', 'elementor' ),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'ai' => [
|
||||
'category' => 'background',
|
||||
],
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'responsive' => true,
|
||||
'title' => esc_html__( 'Background Image', 'elementor' ),
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-image: url("{{URL}}");',
|
||||
],
|
||||
'has_sizes' => true,
|
||||
'render_type' => 'template',
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['position'] = [
|
||||
'label' => esc_html__( 'Position', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'separator' => 'before',
|
||||
'responsive' => true,
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'center center' => esc_html__( 'Center Center', 'elementor' ),
|
||||
'center left' => esc_html__( 'Center Left', 'elementor' ),
|
||||
'center right' => esc_html__( 'Center Right', 'elementor' ),
|
||||
'top center' => esc_html__( 'Top Center', 'elementor' ),
|
||||
'top left' => esc_html__( 'Top Left', 'elementor' ),
|
||||
'top right' => esc_html__( 'Top Right', 'elementor' ),
|
||||
'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
|
||||
'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
|
||||
'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
|
||||
'initial' => esc_html__( 'Custom', 'elementor' ),
|
||||
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-position: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['xpos'] = [
|
||||
'label' => esc_html__( 'X Position', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'responsive' => true,
|
||||
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
|
||||
'default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'tablet_default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'mobile_default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => -800,
|
||||
'max' => 800,
|
||||
],
|
||||
'em' => [
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
'%' => [
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
'vw' => [
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos.SIZE}}{{ypos.UNIT}}',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'position' => [ 'initial' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
'required' => true,
|
||||
];
|
||||
|
||||
$fields['ypos'] = [
|
||||
'label' => esc_html__( 'Y Position', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'responsive' => true,
|
||||
'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ],
|
||||
'default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'tablet_default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'mobile_default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => -800,
|
||||
'max' => 800,
|
||||
],
|
||||
'em' => [
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
'%' => [
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
'vh' => [
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-position: {{xpos.SIZE}}{{xpos.UNIT}} {{SIZE}}{{UNIT}}',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'position' => [ 'initial' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
'required' => true,
|
||||
];
|
||||
|
||||
$fields['attachment'] = [
|
||||
'label' => esc_html_x( 'Attachment', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'scroll' => esc_html_x( 'Scroll', 'Background Control', 'elementor' ),
|
||||
'fixed' => esc_html_x( 'Fixed', 'Background Control', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'(desktop+){{SELECTOR}}' => 'background-attachment: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['attachment_alert'] = [
|
||||
'type' => Controls_Manager::RAW_HTML,
|
||||
'content_classes' => 'elementor-control-field-description',
|
||||
'raw' => esc_html__( 'Note: Attachment Fixed works only on desktop.', 'elementor' ),
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
'attachment' => 'fixed',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['repeat'] = [
|
||||
'label' => esc_html_x( 'Repeat', 'Background Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'responsive' => true,
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'no-repeat' => esc_html__( 'No-repeat', 'elementor' ),
|
||||
'repeat' => esc_html__( 'Repeat', 'elementor' ),
|
||||
'repeat-x' => esc_html__( 'Repeat-x', 'elementor' ),
|
||||
'repeat-y' => esc_html__( 'Repeat-y', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-repeat: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['size'] = [
|
||||
'label' => esc_html__( 'Display Size', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'responsive' => true,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'auto' => esc_html__( 'Auto', 'elementor' ),
|
||||
'cover' => esc_html__( 'Cover', 'elementor' ),
|
||||
'contain' => esc_html__( 'Contain', 'elementor' ),
|
||||
'initial' => esc_html__( 'Custom', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-size: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['bg_width'] = [
|
||||
'label' => esc_html__( 'Width', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'responsive' => true,
|
||||
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'max' => 1000,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'size' => 100,
|
||||
'unit' => '%',
|
||||
],
|
||||
'required' => true,
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto',
|
||||
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'classic' ],
|
||||
'size' => [ 'initial' ],
|
||||
'image[url]!' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['video_link'] = [
|
||||
'label' => esc_html__( 'Video Link', 'elementor' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'placeholder' => 'https://www.youtube.com/watch?v=XHOmBV4js_E',
|
||||
'description' => esc_html__( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'elementor' ),
|
||||
'label_block' => true,
|
||||
'default' => '',
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
'categories' => [
|
||||
TagsModule::POST_META_CATEGORY,
|
||||
TagsModule::URL_CATEGORY,
|
||||
],
|
||||
],
|
||||
'ai' => [
|
||||
'active' => false,
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['video_start'] = [
|
||||
'label' => esc_html__( 'Start Time', 'elementor' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'description' => esc_html__( 'Specify a start time (in seconds)', 'elementor' ),
|
||||
'placeholder' => 10,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['video_end'] = [
|
||||
'label' => esc_html__( 'End Time', 'elementor' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'description' => esc_html__( 'Specify an end time (in seconds)', 'elementor' ),
|
||||
'placeholder' => 70,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['play_once'] = [
|
||||
'label' => esc_html__( 'Play Once', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['play_on_mobile'] = [
|
||||
'label' => esc_html__( 'Play On Mobile', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
// This control was added to handle a bug with the Youtube Embed API. The bug: If there is a video with Privacy
|
||||
// Mode on, and at the same time the page contains another video WITHOUT privacy mode on, one of the videos
|
||||
// will not run properly. This added control allows users to align all their videos to one host (either
|
||||
// youtube.com or youtube-nocookie.com, depending on whether the user wants privacy mode on or not).
|
||||
$fields['privacy_mode'] = [
|
||||
'label' => esc_html__( 'Privacy Mode', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'of_type' => 'video',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['video_fallback'] = [
|
||||
'label' => esc_html__( 'Background Fallback', 'elementor' ),
|
||||
'description' => esc_html__( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ),
|
||||
'type' => Controls_Manager::MEDIA,
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'video' ],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'background: url("{{URL}}") 50% 50%; background-size: cover;',
|
||||
],
|
||||
'of_type' => 'video',
|
||||
];
|
||||
|
||||
$fields['slideshow_gallery'] = [
|
||||
'label' => esc_html__( 'Images', 'elementor' ),
|
||||
'type' => Controls_Manager::GALLERY,
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'show_label' => false,
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_loop'] = [
|
||||
'label' => esc_html__( 'Infinite Loop', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'default' => 'yes',
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_slide_duration'] = [
|
||||
'label' => esc_html__( 'Duration', 'elementor' ) . ' (ms)',
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 5000,
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_slide_transition'] = [
|
||||
'label' => esc_html__( 'Transition', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'fade',
|
||||
'options' => [
|
||||
'fade' => 'Fade',
|
||||
'slide_right' => 'Slide Right',
|
||||
'slide_left' => 'Slide Left',
|
||||
'slide_up' => 'Slide Up',
|
||||
'slide_down' => 'Slide Down',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_transition_duration'] = [
|
||||
'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)',
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'default' => 500,
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_background_size'] = [
|
||||
'label' => esc_html__( 'Background Size', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'responsive' => true,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'auto' => esc_html__( 'Auto', 'elementor' ),
|
||||
'cover' => esc_html__( 'Cover', 'elementor' ),
|
||||
'contain' => esc_html__( 'Contain', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['slideshow_background_position'] = [
|
||||
'label' => esc_html__( 'Background Position', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'responsive' => true,
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'center center' => esc_html__( 'Center Center', 'elementor' ),
|
||||
'center left' => esc_html__( 'Center Left', 'elementor' ),
|
||||
'center right' => esc_html__( 'Center Right', 'elementor' ),
|
||||
'top center' => esc_html__( 'Top Center', 'elementor' ),
|
||||
'top left' => esc_html__( 'Top Left', 'elementor' ),
|
||||
'top right' => esc_html__( 'Top Right', 'elementor' ),
|
||||
'bottom center' => esc_html__( 'Bottom Center', 'elementor' ),
|
||||
'bottom left' => esc_html__( 'Bottom Left', 'elementor' ),
|
||||
'bottom right' => esc_html__( 'Bottom Right', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['slideshow_lazyload'] = [
|
||||
'label' => esc_html__( 'Lazyload', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_ken_burns'] = [
|
||||
'label' => esc_html__( 'Ken Burns Effect', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'separator' => 'before',
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
],
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
$fields['slideshow_ken_burns_zoom_direction'] = [
|
||||
'label' => esc_html__( 'Direction', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => 'in',
|
||||
'options' => [
|
||||
'in' => esc_html__( 'In', 'elementor' ),
|
||||
'out' => esc_html__( 'Out', 'elementor' ),
|
||||
],
|
||||
'condition' => [
|
||||
'background' => [ 'slideshow' ],
|
||||
'slideshow_ken_burns!' => '',
|
||||
],
|
||||
'of_type' => 'slideshow',
|
||||
'frontend_available' => true,
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get child default args.
|
||||
*
|
||||
* Retrieve the default arguments for all the child controls for a specific group
|
||||
* control.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default arguments for all the child controls.
|
||||
*/
|
||||
protected function get_child_default_args() {
|
||||
return [
|
||||
'types' => [ 'classic', 'gradient' ],
|
||||
'selector' => '{{WRAPPER}}:not(.elementor-motion-effects-element-type-background), {{WRAPPER}} > .elementor-motion-effects-container > .elementor-motion-effects-layer',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter fields.
|
||||
*
|
||||
* Filter which controls to display, using `include`, `exclude`, `condition`
|
||||
* and `of_type` arguments.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function filter_fields() {
|
||||
$fields = parent::filter_fields();
|
||||
|
||||
$args = $this->get_args();
|
||||
|
||||
foreach ( $fields as &$field ) {
|
||||
if ( isset( $field['of_type'] ) && ! in_array( $field['of_type'], $args['types'] ) ) {
|
||||
unset( $field );
|
||||
}
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare fields.
|
||||
*
|
||||
* Process background control fields before adding them to `add_control()`.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @param array $fields Background control fields.
|
||||
*
|
||||
* @return array Processed fields.
|
||||
*/
|
||||
protected function prepare_fields( $fields ) {
|
||||
$args = $this->get_args();
|
||||
|
||||
$background_types = self::get_background_types();
|
||||
|
||||
$choose_types = [];
|
||||
|
||||
foreach ( $args['types'] as $type ) {
|
||||
if ( isset( $background_types[ $type ] ) ) {
|
||||
$choose_types[ $type ] = $background_types[ $type ];
|
||||
}
|
||||
}
|
||||
|
||||
$fields['background']['options'] = $choose_types;
|
||||
|
||||
return parent::prepare_fields( $fields );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the background control. Used to return the
|
||||
* default options while initializing the background control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default background control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
592
wp-content/plugins/elementor/includes/controls/groups/base.php
Normal file
592
wp-content/plugins/elementor/includes/controls/groups/base.php
Normal file
@@ -0,0 +1,592 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor group control base.
|
||||
*
|
||||
* An abstract class for creating new group controls in the panel.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @abstract
|
||||
*/
|
||||
abstract class Group_Control_Base implements Group_Control_Interface {
|
||||
|
||||
/**
|
||||
* Arguments.
|
||||
*
|
||||
* Holds all the group control arguments.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @var array Group control arguments.
|
||||
*/
|
||||
private $args = [];
|
||||
|
||||
/**
|
||||
* Options.
|
||||
*
|
||||
* Holds all the group control options.
|
||||
*
|
||||
* Currently supports only the popover options.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @var array Group control options.
|
||||
*/
|
||||
private $options;
|
||||
|
||||
/**
|
||||
* Get options.
|
||||
*
|
||||
* Retrieve group control options. If options are not set, it will initialize default options.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $option Optional. Single option.
|
||||
*
|
||||
* @return mixed Group control options. If option parameter was not specified, it will
|
||||
* return an array of all the options. If single option specified, it will
|
||||
* return the option value or `null` if option does not exists.
|
||||
*/
|
||||
final public function get_options( $option = null ) {
|
||||
if ( null === $this->options ) {
|
||||
$this->init_options();
|
||||
}
|
||||
|
||||
if ( $option ) {
|
||||
if ( isset( $this->options[ $option ] ) ) {
|
||||
return $this->options[ $option ];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new controls to stack.
|
||||
*
|
||||
* Register multiple controls to allow the user to set/update data.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param Controls_Stack $element The element stack.
|
||||
* @param array $user_args The control arguments defined by the user.
|
||||
* @param array $options Optional. The element options. Default is
|
||||
* an empty array.
|
||||
*/
|
||||
final public function add_controls( Controls_Stack $element, array $user_args, array $options = [] ) {
|
||||
$this->init_args( $user_args );
|
||||
|
||||
// Filter which controls to display
|
||||
$filtered_fields = $this->filter_fields();
|
||||
$filtered_fields = $this->prepare_fields( $filtered_fields );
|
||||
|
||||
// For php < 7
|
||||
reset( $filtered_fields );
|
||||
|
||||
if ( isset( $this->args['separator'] ) ) {
|
||||
$filtered_fields[ key( $filtered_fields ) ]['separator'] = $this->args['separator'];
|
||||
}
|
||||
|
||||
$has_injection = false;
|
||||
|
||||
if ( ! empty( $options['position'] ) ) {
|
||||
$has_injection = true;
|
||||
|
||||
$element->start_injection( $options['position'] );
|
||||
|
||||
unset( $options['position'] );
|
||||
}
|
||||
|
||||
if ( $this->get_options( 'popover' ) ) {
|
||||
$this->start_popover( $element );
|
||||
}
|
||||
|
||||
foreach ( $filtered_fields as $field_id => $field_args ) {
|
||||
// Add the global group args to the control
|
||||
$field_args = $this->add_group_args_to_field( $field_id, $field_args );
|
||||
|
||||
// Register the control
|
||||
$id = $this->get_controls_prefix() . $field_id;
|
||||
|
||||
if ( ! empty( $field_args['responsive'] ) ) {
|
||||
unset( $field_args['responsive'] );
|
||||
|
||||
$element->add_responsive_control( $id, $field_args, $options );
|
||||
} else {
|
||||
$element->add_control( $id, $field_args, $options );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $this->get_options( 'popover' ) ) {
|
||||
$element->end_popover();
|
||||
}
|
||||
|
||||
if ( $has_injection ) {
|
||||
$element->end_injection();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get arguments.
|
||||
*
|
||||
* Retrieve group control arguments.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Group control arguments.
|
||||
*/
|
||||
final public function get_args() {
|
||||
return $this->args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fields.
|
||||
*
|
||||
* Retrieve group control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access public
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
final public function get_fields() {
|
||||
if ( null === static::$fields ) {
|
||||
static::$fields = $this->init_fields();
|
||||
}
|
||||
|
||||
return static::$fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get controls prefix.
|
||||
*
|
||||
* Retrieve the prefix of the group control, which is `{{ControlName}}_`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control prefix.
|
||||
*/
|
||||
public function get_controls_prefix() {
|
||||
return $this->args['name'] . '_';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group control classes.
|
||||
*
|
||||
* Retrieve the classes of the group control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Group control classes.
|
||||
*/
|
||||
public function get_base_group_classes() {
|
||||
return 'elementor-group-control-' . static::get_type() . ' elementor-group-control';
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize group control fields.
|
||||
*
|
||||
* @abstract
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*/
|
||||
abstract protected function init_fields();
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the group control. Used to return the
|
||||
* default options while initializing the group control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default group control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get child default arguments.
|
||||
*
|
||||
* Retrieve the default arguments for all the child controls for a specific group
|
||||
* control.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default arguments for all the child controls.
|
||||
*/
|
||||
protected function get_child_default_args() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter fields.
|
||||
*
|
||||
* Filter which controls to display, using `include`, `exclude` and the
|
||||
* `condition` arguments.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function filter_fields() {
|
||||
$args = $this->get_args();
|
||||
|
||||
$fields = $this->get_fields();
|
||||
|
||||
if ( ! empty( $args['include'] ) ) {
|
||||
$fields = array_intersect_key( $fields, array_flip( $args['include'] ) );
|
||||
}
|
||||
|
||||
if ( ! empty( $args['exclude'] ) ) {
|
||||
$fields = array_diff_key( $fields, array_flip( $args['exclude'] ) );
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add group arguments to field.
|
||||
*
|
||||
* Register field arguments to group control.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @param string $control_id Group control id.
|
||||
* @param array $field_args Group control field arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function add_group_args_to_field( $control_id, $field_args ) {
|
||||
$args = $this->get_args();
|
||||
|
||||
if ( ! empty( $args['tab'] ) ) {
|
||||
$field_args['tab'] = $args['tab'];
|
||||
}
|
||||
|
||||
if ( ! empty( $args['section'] ) ) {
|
||||
$field_args['section'] = $args['section'];
|
||||
}
|
||||
|
||||
$field_args['classes'] = $this->get_base_group_classes() . ' elementor-group-control-' . $control_id;
|
||||
|
||||
foreach ( [ 'condition', 'conditions' ] as $condition_type ) {
|
||||
if ( ! empty( $args[ $condition_type ] ) ) {
|
||||
if ( empty( $field_args[ $condition_type ] ) ) {
|
||||
$field_args[ $condition_type ] = [];
|
||||
}
|
||||
|
||||
$field_args[ $condition_type ] += $args[ $condition_type ];
|
||||
}
|
||||
}
|
||||
|
||||
return $field_args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare fields.
|
||||
*
|
||||
* Process group control fields before adding them to `add_control()`.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @param array $fields Group control fields.
|
||||
*
|
||||
* @return array Processed fields.
|
||||
*/
|
||||
protected function prepare_fields( $fields ) {
|
||||
$popover_options = $this->get_options( 'popover' );
|
||||
|
||||
$popover_name = ! $popover_options ? null : $popover_options['starter_name'];
|
||||
|
||||
foreach ( $fields as $field_key => &$field ) {
|
||||
if ( $popover_name ) {
|
||||
$field['condition'][ $popover_name . '!' ] = '';
|
||||
}
|
||||
|
||||
if ( isset( $this->args['fields_options']['__all'] ) ) {
|
||||
$field = array_merge( $field, $this->args['fields_options']['__all'] );
|
||||
}
|
||||
|
||||
if ( isset( $this->args['fields_options'][ $field_key ] ) ) {
|
||||
$field = array_merge( $field, $this->args['fields_options'][ $field_key ] );
|
||||
}
|
||||
|
||||
if ( ! empty( $field['condition'] ) ) {
|
||||
$field = $this->add_condition_prefix( $field );
|
||||
}
|
||||
|
||||
if ( ! empty( $field['conditions'] ) ) {
|
||||
$field['conditions'] = $this->add_conditions_prefix( $field['conditions'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $field['selectors'] ) ) {
|
||||
$field['selectors'] = $this->handle_selectors( $field['selectors'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $field['device_args'] ) ) {
|
||||
foreach ( $field['device_args'] as $device => $device_arg ) {
|
||||
if ( ! empty( $field['device_args'][ $device ]['condition'] ) ) {
|
||||
$field['device_args'][ $device ] = $this->add_condition_prefix( $field['device_args'][ $device ] );
|
||||
}
|
||||
|
||||
if ( ! empty( $field['device_args'][ $device ]['conditions'] ) ) {
|
||||
$field['device_args'][ $device ]['conditions'] = $this->add_conditions_prefix( $field['device_args'][ $device ]['conditions'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $device_arg['selectors'] ) ) {
|
||||
$field['device_args'][ $device ]['selectors'] = $this->handle_selectors( $device_arg['selectors'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init options.
|
||||
*
|
||||
* Initializing group control options.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access private
|
||||
*/
|
||||
private function init_options() {
|
||||
$default_options = [
|
||||
'popover' => [
|
||||
'starter_name' => 'popover_toggle',
|
||||
'starter_value' => 'custom',
|
||||
'starter_title' => '',
|
||||
],
|
||||
];
|
||||
|
||||
$this->options = array_replace_recursive( $default_options, $this->get_default_options() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Init arguments.
|
||||
*
|
||||
* Initializing group control base class.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @param array $args Group control settings value.
|
||||
*/
|
||||
protected function init_args( $args ) {
|
||||
$this->args = array_merge( $this->get_default_args(), $this->get_child_default_args(), $args );
|
||||
|
||||
if ( isset( $this->args['scheme'] ) ) {
|
||||
$this->args['global']['default'] = Plugin::$instance->kits_manager->convert_scheme_to_global( $this->args['scheme'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default arguments.
|
||||
*
|
||||
* Retrieve the default arguments of the group control. Used to return the
|
||||
* default arguments while initializing the group control.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access private
|
||||
*
|
||||
* @return array Control default arguments.
|
||||
*/
|
||||
private function get_default_args() {
|
||||
return [
|
||||
'default' => '',
|
||||
'selector' => '{{WRAPPER}}',
|
||||
'fields_options' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add condition prefix.
|
||||
*
|
||||
* Used to add the group prefix to controls with conditions, to
|
||||
* distinguish them from other controls with the same name.
|
||||
*
|
||||
* This way Elementor can apply condition logic to a specific control in a
|
||||
* group control.
|
||||
*
|
||||
* @since 1.2.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $field Group control field.
|
||||
*
|
||||
* @return array Group control field.
|
||||
*/
|
||||
private function add_condition_prefix( $field ) {
|
||||
$controls_prefix = $this->get_controls_prefix();
|
||||
|
||||
$prefixed_condition_keys = array_map(
|
||||
function( $key ) use ( $controls_prefix ) {
|
||||
return $controls_prefix . $key;
|
||||
},
|
||||
array_keys( $field['condition'] )
|
||||
);
|
||||
|
||||
$field['condition'] = array_combine(
|
||||
$prefixed_condition_keys,
|
||||
$field['condition']
|
||||
);
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
private function add_conditions_prefix( $conditions ) {
|
||||
$controls_prefix = $this->get_controls_prefix();
|
||||
|
||||
foreach ( $conditions['terms'] as & $condition ) {
|
||||
if ( isset( $condition['terms'] ) ) {
|
||||
$condition = $this->add_conditions_prefix( $condition );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$condition['name'] = $controls_prefix . $condition['name'];
|
||||
}
|
||||
|
||||
return $conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle selectors.
|
||||
*
|
||||
* Used to process the CSS selector of group control fields. When using
|
||||
* group control, Elementor needs to apply the selector to different fields.
|
||||
* This method handles the process.
|
||||
*
|
||||
* In addition, it handles selector values from other fields and process the
|
||||
* css.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access private
|
||||
*
|
||||
* @param array $selectors An array of selectors to process.
|
||||
*
|
||||
* @return array Processed selectors.
|
||||
*/
|
||||
private function handle_selectors( $selectors ) {
|
||||
$args = $this->get_args();
|
||||
|
||||
$selectors = array_combine(
|
||||
array_map(
|
||||
function( $key ) use ( $args ) {
|
||||
return str_replace( '{{SELECTOR}}', $args['selector'], $key );
|
||||
}, array_keys( $selectors )
|
||||
),
|
||||
$selectors
|
||||
);
|
||||
|
||||
if ( ! $selectors ) {
|
||||
return $selectors;
|
||||
}
|
||||
|
||||
$controls_prefix = $this->get_controls_prefix();
|
||||
|
||||
foreach ( $selectors as &$selector ) {
|
||||
$selector = preg_replace_callback( '/{{\K(.*?)(?=}})/', function( $matches ) use ( $controls_prefix ) {
|
||||
$is_external_reference = false;
|
||||
|
||||
return preg_replace_callback( '/[^ ]+?(?=\.)\./', function( $sub_matches ) use ( $controls_prefix, &$is_external_reference ) {
|
||||
$placeholder = $sub_matches[0];
|
||||
|
||||
if ( 'external.' === $placeholder ) {
|
||||
$is_external_reference = true;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( $is_external_reference ) {
|
||||
$is_external_reference = false;
|
||||
|
||||
return $placeholder;
|
||||
}
|
||||
|
||||
return $controls_prefix . $placeholder;
|
||||
}, $matches[1] );
|
||||
}, $selector );
|
||||
}
|
||||
|
||||
return $selectors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start popover.
|
||||
*
|
||||
* Starts a group controls popover.
|
||||
*
|
||||
* @since 1.9.1
|
||||
* @access private
|
||||
* @param Controls_Stack $element Element.
|
||||
*/
|
||||
private function start_popover( Controls_Stack $element ) {
|
||||
$popover_options = $this->get_options( 'popover' );
|
||||
|
||||
$settings = $this->get_args();
|
||||
|
||||
if ( isset( $settings['global'] ) ) {
|
||||
if ( ! isset( $popover_options['settings']['global'] ) ) {
|
||||
$popover_options['settings']['global'] = [];
|
||||
}
|
||||
|
||||
$popover_options['settings']['global'] = array_replace_recursive( $popover_options['settings']['global'], $settings['global'] );
|
||||
}
|
||||
|
||||
if ( isset( $settings['label'] ) ) {
|
||||
$label = $settings['label'];
|
||||
} else {
|
||||
$label = $popover_options['starter_title'];
|
||||
}
|
||||
|
||||
$control_params = [
|
||||
'type' => Controls_Manager::POPOVER_TOGGLE,
|
||||
'label' => $label,
|
||||
'return_value' => $popover_options['starter_value'],
|
||||
];
|
||||
|
||||
if ( ! empty( $popover_options['settings'] ) ) {
|
||||
$control_params = array_replace_recursive( $control_params, $popover_options['settings'] );
|
||||
}
|
||||
|
||||
foreach ( [ 'condition', 'conditions' ] as $key ) {
|
||||
if ( ! empty( $settings[ $key ] ) ) {
|
||||
$control_params[ $key ] = $settings[ $key ];
|
||||
}
|
||||
}
|
||||
|
||||
$starter_name = $popover_options['starter_name'];
|
||||
|
||||
if ( isset( $this->args['fields_options'][ $starter_name ] ) ) {
|
||||
$control_params = array_merge( $control_params, $this->args['fields_options'][ $starter_name ] );
|
||||
}
|
||||
|
||||
$control_params['groupPrefix'] = $this->get_controls_prefix();
|
||||
|
||||
$element->add_control( $this->get_controls_prefix() . $starter_name, $control_params );
|
||||
|
||||
$element->start_popover();
|
||||
}
|
||||
}
|
||||
120
wp-content/plugins/elementor/includes/controls/groups/border.php
Normal file
120
wp-content/plugins/elementor/includes/controls/groups/border.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor border control.
|
||||
*
|
||||
* A base control for creating border control. Displays input fields to define
|
||||
* border type, border width and border color.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Group_Control_Border extends Group_Control_Base {
|
||||
|
||||
/**
|
||||
* Fields.
|
||||
*
|
||||
* Holds all the border control fields.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @static
|
||||
*
|
||||
* @var array Border control fields.
|
||||
*/
|
||||
protected static $fields;
|
||||
|
||||
/**
|
||||
* Get border control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `border`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'border';
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize border control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function init_fields() {
|
||||
$fields = [];
|
||||
|
||||
$fields['border'] = [
|
||||
'label' => esc_html__( 'Border Type', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'none' => esc_html__( 'None', 'elementor' ),
|
||||
'solid' => esc_html__( 'Solid', 'elementor' ),
|
||||
'double' => esc_html__( 'Double', 'elementor' ),
|
||||
'dotted' => esc_html__( 'Dotted', 'elementor' ),
|
||||
'dashed' => esc_html__( 'Dashed', 'elementor' ),
|
||||
'groove' => esc_html__( 'Groove', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'border-style: {{VALUE}};',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['width'] = [
|
||||
'label' => esc_html__( 'Border Width', 'elementor' ),
|
||||
'type' => Controls_Manager::DIMENSIONS,
|
||||
'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'border!' => [ '', 'none' ],
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['color'] = [
|
||||
'label' => esc_html__( 'Border Color', 'elementor' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'border-color: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'border!' => [ '', 'none' ],
|
||||
],
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the border control. Used to return the
|
||||
* default options while initializing the border control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default border control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor box shadow control.
|
||||
*
|
||||
* A base control for creating box shadow control. Displays input fields to define
|
||||
* the box shadow including the horizontal shadow, vertical shadow, shadow blur,
|
||||
* shadow spread, shadow color and the position.
|
||||
*
|
||||
* @since 1.2.2
|
||||
*/
|
||||
class Group_Control_Box_Shadow extends Group_Control_Base {
|
||||
|
||||
/**
|
||||
* Fields.
|
||||
*
|
||||
* Holds all the box shadow control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
* @static
|
||||
*
|
||||
* @var array Box shadow control fields.
|
||||
*/
|
||||
protected static $fields;
|
||||
|
||||
/**
|
||||
* Get box shadow control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `box-shadow`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'box-shadow';
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize box shadow control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function init_fields() {
|
||||
$controls = [];
|
||||
|
||||
$controls['box_shadow'] = [
|
||||
'label' => esc_html__( 'Box Shadow', 'elementor' ),
|
||||
'type' => Controls_Manager::BOX_SHADOW,
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'box-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{SPREAD}}px {{COLOR}} {{box_shadow_position.VALUE}};',
|
||||
],
|
||||
];
|
||||
|
||||
$controls['box_shadow_position'] = [
|
||||
'label' => esc_html__( 'Position', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
' ' => esc_html_x( 'Outline', 'Box Shadow Control', 'elementor' ),
|
||||
'inset' => esc_html_x( 'Inset', 'Box Shadow Control', 'elementor' ),
|
||||
],
|
||||
'default' => ' ',
|
||||
'render_type' => 'ui',
|
||||
];
|
||||
|
||||
return $controls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the box shadow control. Used to return the
|
||||
* default options while initializing the box shadow control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default box shadow control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => [
|
||||
'starter_title' => esc_html__( 'Box Shadow', 'elementor' ),
|
||||
'starter_name' => 'box_shadow_type',
|
||||
'starter_value' => 'yes',
|
||||
'settings' => [
|
||||
'render_type' => 'ui',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor CSS Filter control.
|
||||
*
|
||||
* A base control for applying css filters. Displays sliders to define the
|
||||
* values of different CSS filters including blur, brightens, contrast,
|
||||
* saturation and hue.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
class Group_Control_Css_Filter extends Group_Control_Base {
|
||||
|
||||
/**
|
||||
* Prepare fields.
|
||||
*
|
||||
* Process css_filter control fields before adding them to `add_control()`.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @access protected
|
||||
*
|
||||
* @param array $fields CSS filter control fields.
|
||||
*
|
||||
* @return array Processed fields.
|
||||
*/
|
||||
protected static $fields;
|
||||
|
||||
/**
|
||||
* Get CSS filter control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `css-filter`.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'css-filter';
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize CSS filter control fields.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function init_fields() {
|
||||
$controls = [];
|
||||
|
||||
$controls['blur'] = [
|
||||
'label' => esc_html_x( 'Blur', 'Filter Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'required' => 'true',
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 10,
|
||||
'step' => 0.1,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'filter: brightness( {{brightness.SIZE}}% ) contrast( {{contrast.SIZE}}% ) saturate( {{saturate.SIZE}}% ) blur( {{blur.SIZE}}px ) hue-rotate( {{hue.SIZE}}deg )',
|
||||
],
|
||||
];
|
||||
|
||||
$controls['brightness'] = [
|
||||
'label' => esc_html_x( 'Brightness', 'Filter Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'render_type' => 'ui',
|
||||
'required' => 'true',
|
||||
'default' => [
|
||||
'size' => 100,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 200,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$controls['contrast'] = [
|
||||
'label' => esc_html_x( 'Contrast', 'Filter Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'render_type' => 'ui',
|
||||
'required' => 'true',
|
||||
'default' => [
|
||||
'size' => 100,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 200,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$controls['saturate'] = [
|
||||
'label' => esc_html_x( 'Saturation', 'Filter Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'render_type' => 'ui',
|
||||
'required' => 'true',
|
||||
'default' => [
|
||||
'size' => 100,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 200,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$controls['hue'] = [
|
||||
'label' => esc_html_x( 'Hue', 'Filter Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'render_type' => 'ui',
|
||||
'required' => 'true',
|
||||
'default' => [
|
||||
'size' => 0,
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 360,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $controls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the CSS filter control. Used to return the
|
||||
* default options while initializing the CSS filter control.
|
||||
*
|
||||
* @since 2.1.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default CSS filter control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => [
|
||||
'starter_name' => 'css_filter',
|
||||
'starter_title' => esc_html__( 'CSS Filters', 'elementor' ),
|
||||
'settings' => [
|
||||
'render_type' => 'ui',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Group_Control_Flex_Container extends Group_Control_Base {
|
||||
|
||||
protected static $fields;
|
||||
|
||||
public static function get_type() {
|
||||
return 'flex-container';
|
||||
}
|
||||
|
||||
protected function init_fields() {
|
||||
$start = is_rtl() ? 'right' : 'left';
|
||||
$end = is_rtl() ? 'left' : 'right';
|
||||
|
||||
$fields = [];
|
||||
|
||||
$fields['items'] = [
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'label' => esc_html__( 'Items', 'elementor' ),
|
||||
'separator' => 'before',
|
||||
];
|
||||
|
||||
$fields['direction'] = [
|
||||
'label' => esc_html__( 'Direction', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'row' => [
|
||||
'title' => esc_html__( 'Row - horizontal', 'elementor' ),
|
||||
'icon' => 'eicon-arrow-' . $end,
|
||||
],
|
||||
'column' => [
|
||||
'title' => esc_html__( 'Column - vertical', 'elementor' ),
|
||||
'icon' => 'eicon-arrow-down',
|
||||
],
|
||||
'row-reverse' => [
|
||||
'title' => esc_html__( 'Row - reversed', 'elementor' ),
|
||||
'icon' => 'eicon-arrow-' . $start,
|
||||
],
|
||||
'column-reverse' => [
|
||||
'title' => esc_html__( 'Column - reversed', 'elementor' ),
|
||||
'icon' => 'eicon-arrow-up',
|
||||
],
|
||||
],
|
||||
'default' => '',
|
||||
// The `--container-widget-width` CSS variable is used for handling widgets that get an undefined width in column mode.
|
||||
// The `--container-widget-flex-grow` CSS variable is used to give certain widgets a default `flex-grow: 1` value for the `flex row` combination.
|
||||
'selectors_dictionary' => [
|
||||
'row' => '--flex-direction: row; --container-widget-width: initial; --container-widget-height: 100%; --container-widget-flex-grow: 1; --container-widget-align-self: stretch; --flex-wrap-mobile: wrap;',
|
||||
'column' => '--flex-direction: column; --container-widget-width: 100%; --container-widget-height: initial; --container-widget-flex-grow: 0; --container-widget-align-self: initial; --flex-wrap-mobile: wrap;',
|
||||
'row-reverse' => '--flex-direction: row-reverse; --container-widget-width: initial; --container-widget-height: 100%; --container-widget-flex-grow: 1; --container-widget-align-self: stretch; --flex-wrap-mobile: wrap-reverse;',
|
||||
'column-reverse' => '--flex-direction: column-reverse; --container-widget-width: 100%; --container-widget-height: initial; --container-widget-flex-grow: 0; --container-widget-align-self: initial; --flex-wrap-mobile: wrap;',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '{{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
// Only use the flex direction prefix class inside the editor.
|
||||
$flex_direction_prefix_class = Plugin::$instance->editor->is_edit_mode() ? [ 'prefix_class' => 'e-con--' ] : [];
|
||||
|
||||
$fields['_is_row'] = array_merge( $flex_direction_prefix_class, [
|
||||
'type' => Controls_Manager::HIDDEN,
|
||||
'default' => 'row',
|
||||
'condition' => [
|
||||
'direction' => [
|
||||
'row',
|
||||
'row-reverse',
|
||||
],
|
||||
],
|
||||
] );
|
||||
|
||||
$fields['_is_column'] = array_merge( $flex_direction_prefix_class, [
|
||||
'type' => Controls_Manager::HIDDEN,
|
||||
'default' => 'column',
|
||||
'condition' => [
|
||||
'direction' => [
|
||||
'',
|
||||
'column',
|
||||
'column-reverse',
|
||||
],
|
||||
],
|
||||
] );
|
||||
|
||||
$fields['justify_content'] = [
|
||||
'label' => esc_html__( 'Justify Content', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => true,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'flex-start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-justify-start-h',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-justify-center-h',
|
||||
],
|
||||
'flex-end' => [
|
||||
'title' => esc_html__( 'End', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-justify-end-h',
|
||||
],
|
||||
'space-between' => [
|
||||
'title' => esc_html__( 'Space Between', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-justify-space-between-h',
|
||||
],
|
||||
'space-around' => [
|
||||
'title' => esc_html__( 'Space Around', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-justify-space-around-h',
|
||||
],
|
||||
'space-evenly' => [
|
||||
'title' => esc_html__( 'Space Evenly', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-justify-space-evenly-h',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--justify-content: {{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['align_items'] = [
|
||||
'label' => esc_html__( 'Align Items', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'flex-start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-align-start-v',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-align-center-v',
|
||||
],
|
||||
'flex-end' => [
|
||||
'title' => esc_html__( 'End', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-align-end-v',
|
||||
],
|
||||
'stretch' => [
|
||||
'title' => esc_html__( 'Stretch', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-align-stretch-v',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--align-items: {{VALUE}}; --container-widget-width: calc( ( 1 - var( --container-widget-flex-grow ) ) * 100% );',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['gap'] = [
|
||||
'label' => esc_html__( 'Gaps', 'elementor' ),
|
||||
'type' => Controls_Manager::GAPS,
|
||||
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
],
|
||||
'separator' => 'before',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--gap: {{ROW}}{{UNIT}} {{COLUMN}}{{UNIT}}',
|
||||
],
|
||||
'responsive' => true,
|
||||
'conversion_map' => [
|
||||
'old_key' => 'size',
|
||||
'new_key' => 'column',
|
||||
],
|
||||
'upgrade_conversion_map' => [
|
||||
'old_key' => 'size',
|
||||
'new_keys' => [ 'column', 'row' ],
|
||||
],
|
||||
'validators' => [
|
||||
'Number' => [
|
||||
'min' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['wrap'] = [
|
||||
'label' => esc_html__( 'Wrap', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'nowrap' => [
|
||||
'title' => esc_html__( 'No Wrap', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-nowrap',
|
||||
],
|
||||
'wrap' => [
|
||||
'title' => esc_html__( 'Wrap', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-wrap',
|
||||
],
|
||||
],
|
||||
'description' => esc_html__( 'Items within the container can stay in a single line (No wrap), or break into multiple lines (Wrap).', 'elementor' ),
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--flex-wrap: {{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['align_content'] = [
|
||||
'label' => esc_html__( 'Align Content', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'center' => esc_html__( 'Center', 'elementor' ),
|
||||
'flex-start' => esc_html__( 'Start', 'elementor' ),
|
||||
'flex-end' => esc_html__( 'End', 'elementor' ),
|
||||
'space-between' => esc_html__( 'Space Between', 'elementor' ),
|
||||
'space-around' => esc_html__( 'Space Around', 'elementor' ),
|
||||
'space-evenly' => esc_html__( 'Space Evenly', 'elementor' ),
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--align-content: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'wrap' => 'wrap',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Group_Control_Flex_Item extends Group_Control_Base {
|
||||
|
||||
protected static $fields;
|
||||
|
||||
public static function get_type() {
|
||||
return 'flex-item';
|
||||
}
|
||||
|
||||
protected function init_fields() {
|
||||
$fields = [];
|
||||
|
||||
$fields['basis_type'] = [
|
||||
'label' => esc_html__( 'Flex Basis', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'custom' => esc_html__( 'Custom', 'elementor' ),
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['basis'] = [
|
||||
'label' => esc_html__( 'Custom Width', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'px' => [
|
||||
'max' => 1000,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'unit' => '%',
|
||||
],
|
||||
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--flex-basis: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
'condition' => [
|
||||
'basis_type' => 'custom',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['align_self'] = [
|
||||
'label' => esc_html__( 'Align Self', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'flex-start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-align-start-v',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-align-center-v',
|
||||
],
|
||||
'flex-end' => [
|
||||
'title' => esc_html__( 'End', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-align-end-v',
|
||||
],
|
||||
'stretch' => [
|
||||
'title' => esc_html__( 'Stretch', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-align-stretch-v',
|
||||
],
|
||||
],
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--align-self: {{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
'description' => esc_html__( 'This control will affect contained elements only.', 'elementor' ),
|
||||
];
|
||||
|
||||
$fields['order'] = [
|
||||
'label' => esc_html__( 'Order', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-order-start',
|
||||
],
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor' ),
|
||||
'icon' => 'eicon-flex eicon-order-end',
|
||||
],
|
||||
'custom' => [
|
||||
'title' => esc_html__( 'Custom', 'elementor' ),
|
||||
'icon' => 'eicon-ellipsis-v',
|
||||
],
|
||||
],
|
||||
'selectors_dictionary' => [
|
||||
// Hacks to set the order to start / end.
|
||||
// For example, if the user has 10 widgets, but wants to set the 5th one to be first,
|
||||
// this hack should do the trick while taking in account elements with `order: 0` or less.
|
||||
'start' => '-99999 /* order start hack */',
|
||||
'end' => '99999 /* order end hack */',
|
||||
'custom' => '',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--order: {{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
'description' => esc_html__( 'This control will affect contained elements only.', 'elementor' ),
|
||||
];
|
||||
|
||||
$fields['order_custom'] = [
|
||||
'label' => esc_html__( 'Custom Order', 'elementor' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--order: {{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
'condition' => [
|
||||
'order' => 'custom',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['size'] = [
|
||||
'label' => esc_html__( 'Size', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'none' => [
|
||||
'title' => esc_html__( 'None', 'elementor' ),
|
||||
'icon' => 'eicon-ban',
|
||||
],
|
||||
'grow' => [
|
||||
'title' => esc_html__( 'Grow', 'elementor' ),
|
||||
'icon' => 'eicon-grow',
|
||||
],
|
||||
'shrink' => [
|
||||
'title' => esc_html__( 'Shrink', 'elementor' ),
|
||||
'icon' => 'eicon-shrink',
|
||||
],
|
||||
'custom' => [
|
||||
'title' => esc_html__( 'Custom', 'elementor' ),
|
||||
'icon' => 'eicon-ellipsis-v',
|
||||
],
|
||||
],
|
||||
'selectors_dictionary' => [
|
||||
'grow' => '--flex-grow: 1; --flex-shrink: 0;',
|
||||
'shrink' => '--flex-grow: 0; --flex-shrink: 1;',
|
||||
'custom' => '',
|
||||
'none' => '--flex-grow: 0; --flex-shrink: 0;',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '{{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['grow'] = [
|
||||
'label' => esc_html__( 'Flex Grow', 'elementor' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--flex-grow: {{VALUE}};',
|
||||
],
|
||||
'default' => 1,
|
||||
'placeholder' => 1,
|
||||
'responsive' => true,
|
||||
'condition' => [
|
||||
'size' => 'custom',
|
||||
],
|
||||
];
|
||||
|
||||
$fields['shrink'] = [
|
||||
'label' => esc_html__( 'Flex Shrink', 'elementor' ),
|
||||
'type' => Controls_Manager::NUMBER,
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--flex-shrink: {{VALUE}};',
|
||||
],
|
||||
'default' => 1,
|
||||
'placeholder' => 1,
|
||||
'responsive' => true,
|
||||
'condition' => [
|
||||
'size' => 'custom',
|
||||
],
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,320 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Plugin;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
class Group_Control_Grid_Container extends Group_Control_Base {
|
||||
|
||||
protected static $fields;
|
||||
|
||||
public static function get_type() {
|
||||
return 'grid-container';
|
||||
}
|
||||
|
||||
protected function init_fields() {
|
||||
$icon_start = is_rtl() ? 'end' : 'start';
|
||||
$icon_end = is_rtl() ? 'start' : 'end';
|
||||
|
||||
$fields = [];
|
||||
|
||||
$fields['items_grid'] = [
|
||||
'type' => Controls_Manager::HEADING,
|
||||
'label' => esc_html__( 'Items', 'elementor' ),
|
||||
'separator' => 'before',
|
||||
];
|
||||
|
||||
$fields['outline'] = [
|
||||
'label' => esc_html__( 'Grid Outline', 'elementor' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'label_on' => esc_html__( 'Show', 'elementor' ),
|
||||
'label_off' => esc_html__( 'Hide', 'elementor' ),
|
||||
'default' => 'yes',
|
||||
'editor_available' => true,
|
||||
];
|
||||
|
||||
$responsive_unit_defaults = $this->get_responsive_unit_defaults();
|
||||
|
||||
$fields['columns_grid'] = [
|
||||
'label' => esc_html__( 'Columns', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'fr' => [
|
||||
'min' => 1,
|
||||
'max' => 12,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'size_units' => [ 'fr', 'custom' ],
|
||||
'unit_selectors_dictionary' => [
|
||||
'custom' => '--e-con-grid-template-columns: {{SIZE}}',
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'fr',
|
||||
'size' => 3,
|
||||
],
|
||||
'mobile_default' => [
|
||||
'unit' => 'fr',
|
||||
'size' => 1,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--e-con-grid-template-columns: repeat({{SIZE}}, 1fr)',
|
||||
],
|
||||
'responsive' => true,
|
||||
'editor_available' => true,
|
||||
] + $responsive_unit_defaults;
|
||||
|
||||
$fields['rows_grid'] = [
|
||||
'label' => esc_html__( 'Rows', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'range' => [
|
||||
'fr' => [
|
||||
'min' => 1,
|
||||
'max' => 12,
|
||||
'step' => 1,
|
||||
],
|
||||
],
|
||||
'size_units' => [ 'fr', 'custom' ],
|
||||
'unit_selectors_dictionary' => [
|
||||
'custom' => '--e-con-grid-template-rows: {{SIZE}}',
|
||||
],
|
||||
'default' => [
|
||||
'unit' => 'fr',
|
||||
'size' => 2,
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--e-con-grid-template-rows: repeat({{SIZE}}, 1fr)',
|
||||
],
|
||||
'responsive' => true,
|
||||
'editor_available' => true,
|
||||
] + $responsive_unit_defaults;
|
||||
|
||||
$fields['gaps'] = [
|
||||
'label' => esc_html__( 'Gaps', 'elementor' ),
|
||||
'type' => Controls_Manager::GAPS,
|
||||
'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
|
||||
'default' => [
|
||||
'unit' => 'px',
|
||||
],
|
||||
'separator' => 'before',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--gap: {{ROW}}{{UNIT}} {{COLUMN}}{{UNIT}}',
|
||||
],
|
||||
'responsive' => true,
|
||||
'validators' => [
|
||||
'Number' => [
|
||||
'min' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$fields['auto_flow'] = [
|
||||
'label' => esc_html__( 'Auto Flow', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'options' => [
|
||||
'row' => esc_html__( 'Row', 'elementor' ),
|
||||
'column' => esc_html__( 'Column', 'elementor' ),
|
||||
],
|
||||
'default' => 'row',
|
||||
'separator' => 'before',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--grid-auto-flow: {{VALUE}}',
|
||||
],
|
||||
'responsive' => true,
|
||||
'editor_available' => true,
|
||||
] + $this->get_responsive_autoflow_defaults();
|
||||
|
||||
$fields['justify_items'] = [
|
||||
'label' => esc_html__( 'Justify Items', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor' ),
|
||||
'icon' => 'eicon-align-' . $icon_start . '-h',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor' ),
|
||||
'icon' => 'eicon-align-center-h',
|
||||
],
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor' ),
|
||||
'icon' => 'eicon-align-' . $icon_end . '-h',
|
||||
],
|
||||
'stretch' => [
|
||||
'title' => esc_html__( 'Stretch', 'elementor' ),
|
||||
'icon' => 'eicon-align-stretch-h',
|
||||
],
|
||||
],
|
||||
'default' => '',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--justify-items: {{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['align_items'] = [
|
||||
'label' => esc_html__( 'Align Items', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor' ),
|
||||
'icon' => 'eicon-align-start-v',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor' ),
|
||||
'icon' => 'eicon-align-center-v',
|
||||
],
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor' ),
|
||||
'icon' => 'eicon-align-end-v',
|
||||
],
|
||||
'stretch' => [
|
||||
'title' => esc_html__( 'Stretch', 'elementor' ),
|
||||
'icon' => 'eicon-align-stretch-v',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--align-items: {{VALUE}};',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['justify_content'] = [
|
||||
'label' => esc_html__( 'Justify Content', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => true,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor' ),
|
||||
'icon' => 'eicon-justify-start-h',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Middle', 'elementor' ),
|
||||
'icon' => 'eicon-justify-center-h',
|
||||
],
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor' ),
|
||||
'icon' => 'eicon-justify-end-h',
|
||||
],
|
||||
'space-between' => [
|
||||
'title' => esc_html__( 'Space Between', 'elementor' ),
|
||||
'icon' => 'eicon-justify-space-between-h',
|
||||
],
|
||||
'space-around' => [
|
||||
'title' => esc_html__( 'Space Around', 'elementor' ),
|
||||
'icon' => 'eicon-justify-space-around-h',
|
||||
],
|
||||
'space-evenly' => [
|
||||
'title' => esc_html__( 'Space Evenly', 'elementor' ),
|
||||
'icon' => 'eicon-justify-space-evenly-h',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--grid-justify-content: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'columns_grid[unit]' => 'custom',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
$fields['align_content'] = [
|
||||
'label' => esc_html__( 'Align Content', 'elementor' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'label_block' => true,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor' ),
|
||||
'icon' => 'eicon-justify-start-v',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Middle', 'elementor' ),
|
||||
'icon' => 'eicon-justify-center-v',
|
||||
],
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor' ),
|
||||
'icon' => 'eicon-justify-end-v',
|
||||
],
|
||||
'space-between' => [
|
||||
'title' => esc_html__( 'Space Between', 'elementor' ),
|
||||
'icon' => 'eicon-justify-space-between-v',
|
||||
],
|
||||
'space-around' => [
|
||||
'title' => esc_html__( 'Space Around', 'elementor' ),
|
||||
'icon' => 'eicon-justify-space-around-v',
|
||||
],
|
||||
'space-evenly' => [
|
||||
'title' => esc_html__( 'Space Evenly', 'elementor' ),
|
||||
'icon' => 'eicon-justify-space-evenly-v',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '--grid-align-content: {{VALUE}};',
|
||||
],
|
||||
'condition' => [
|
||||
'rows_grid[unit]' => 'custom',
|
||||
],
|
||||
'responsive' => true,
|
||||
];
|
||||
|
||||
// Only use the auto flow prefix class inside the editor.
|
||||
$auto_flow_prefix_class = Plugin::$instance->editor->is_edit_mode() ? [ 'prefix_class' => 'e-con--' ] : [];
|
||||
|
||||
$fields['_is_row'] = array_merge( $auto_flow_prefix_class, [
|
||||
'type' => Controls_Manager::HIDDEN,
|
||||
'default' => 'row',
|
||||
'condition' => [
|
||||
'auto_flow' => [
|
||||
'row',
|
||||
],
|
||||
],
|
||||
] );
|
||||
|
||||
$fields['_is_column'] = array_merge( $auto_flow_prefix_class, [
|
||||
'type' => Controls_Manager::HIDDEN,
|
||||
'default' => 'column',
|
||||
'condition' => [
|
||||
'auto_flow' => [
|
||||
'column',
|
||||
],
|
||||
],
|
||||
] );
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
protected function get_responsive_unit_defaults() {
|
||||
$responsive_unit_defaults = [];
|
||||
$active_breakpoints = Plugin::$instance->breakpoints->get_active_breakpoints();
|
||||
|
||||
foreach ( $active_breakpoints as $breakpoint_name => $breakpoint ) {
|
||||
$responsive_unit_defaults[ $breakpoint_name . '_default' ] = [
|
||||
'unit' => 'fr',
|
||||
];
|
||||
}
|
||||
|
||||
return $responsive_unit_defaults;
|
||||
}
|
||||
|
||||
protected function get_responsive_autoflow_defaults() {
|
||||
$responsive_autoflow_defaults = [];
|
||||
$active_breakpoints = Plugin::$instance->breakpoints->get_active_breakpoints();
|
||||
|
||||
foreach ( $active_breakpoints as $breakpoint_name => $breakpoint ) {
|
||||
$responsive_autoflow_defaults[ $breakpoint_name . '_default' ] = 'row';
|
||||
}
|
||||
|
||||
return $responsive_autoflow_defaults;
|
||||
}
|
||||
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,405 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor image size control.
|
||||
*
|
||||
* A base control for creating image size control. Displays input fields to define
|
||||
* one of the default image sizes (thumbnail, medium, medium_large, large) or custom
|
||||
* image dimensions.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Group_Control_Image_Size extends Group_Control_Base {
|
||||
|
||||
/**
|
||||
* Fields.
|
||||
*
|
||||
* Holds all the image size control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
* @static
|
||||
*
|
||||
* @var array Image size control fields.
|
||||
*/
|
||||
protected static $fields;
|
||||
|
||||
/**
|
||||
* Get image size control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `image-size`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'image-size';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attachment image HTML.
|
||||
*
|
||||
* Retrieve the attachment image HTML code.
|
||||
*
|
||||
* Note that some widgets use the same key for the media control that allows
|
||||
* the image selection and for the image size control that allows the user
|
||||
* to select the image size, in this case the third parameter should be null
|
||||
* or the same as the second parameter. But when the widget uses different
|
||||
* keys for the media control and the image size control, when calling this
|
||||
* method you should pass the keys.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param array $settings Control settings.
|
||||
* @param string $image_size_key Optional. Settings key for image size.
|
||||
* Default is `image`.
|
||||
* @param string $image_key Optional. Settings key for image. Default
|
||||
* is null. If not defined uses image size key
|
||||
* as the image key.
|
||||
*
|
||||
* @return string Image HTML.
|
||||
*/
|
||||
public static function get_attachment_image_html( $settings, $image_size_key = 'image', $image_key = null ) {
|
||||
if ( ! $image_key ) {
|
||||
$image_key = $image_size_key;
|
||||
}
|
||||
|
||||
$image = $settings[ $image_key ];
|
||||
|
||||
// Old version of image settings.
|
||||
if ( ! isset( $settings[ $image_size_key . '_size' ] ) ) {
|
||||
$settings[ $image_size_key . '_size' ] = '';
|
||||
}
|
||||
|
||||
$size = $settings[ $image_size_key . '_size' ];
|
||||
|
||||
$image_class = ! empty( $settings['hover_animation'] ) ? 'elementor-animation-' . $settings['hover_animation'] : '';
|
||||
|
||||
$html = '';
|
||||
|
||||
// If is the new version - with image size.
|
||||
$image_sizes = get_intermediate_image_sizes();
|
||||
|
||||
$image_sizes[] = 'full';
|
||||
|
||||
if ( ! empty( $image['id'] ) && ! wp_attachment_is_image( $image['id'] ) ) {
|
||||
$image['id'] = '';
|
||||
}
|
||||
|
||||
$is_static_render_mode = Plugin::$instance->frontend->is_static_render_mode();
|
||||
|
||||
// On static mode don't use WP responsive images.
|
||||
if ( ! empty( $image['id'] ) && in_array( $size, $image_sizes ) && ! $is_static_render_mode ) {
|
||||
$image_class .= " attachment-$size size-$size wp-image-{$image['id']}";
|
||||
$image_attr = [
|
||||
'class' => trim( $image_class ),
|
||||
];
|
||||
|
||||
$html .= wp_get_attachment_image( $image['id'], $size, false, $image_attr );
|
||||
} else {
|
||||
$image_src = self::get_attachment_image_src( $image['id'], $image_size_key, $settings );
|
||||
|
||||
if ( ! $image_src && isset( $image['url'] ) ) {
|
||||
$image_src = $image['url'];
|
||||
}
|
||||
|
||||
if ( ! empty( $image_src ) ) {
|
||||
$image_class_html = ! empty( $image_class ) ? ' class="' . esc_attr( $image_class ) . '"' : '';
|
||||
|
||||
$html .= sprintf(
|
||||
'<img src="%1$s" title="%2$s" alt="%3$s"%4$s loading="lazy" />',
|
||||
esc_url( $image_src ),
|
||||
esc_attr( Control_Media::get_image_title( $image ) ),
|
||||
esc_attr( Control_Media::get_image_alt( $image ) ),
|
||||
$image_class_html
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Attachment Image HTML
|
||||
*
|
||||
* Filters the Attachment Image HTML
|
||||
*
|
||||
* @since 2.4.0
|
||||
* @param string $html the attachment image HTML string
|
||||
* @param array $settings Control settings.
|
||||
* @param string $image_size_key Optional. Settings key for image size.
|
||||
* Default is `image`.
|
||||
* @param string $image_key Optional. Settings key for image. Default
|
||||
* is null. If not defined uses image size key
|
||||
* as the image key.
|
||||
*/
|
||||
return apply_filters( 'elementor/image_size/get_attachment_image_html', $html, $settings, $image_size_key, $image_key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Safe print attachment image HTML.
|
||||
*
|
||||
* @uses get_attachment_image_html.
|
||||
*
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param array $settings Control settings.
|
||||
* @param string $image_size_key Optional. Settings key for image size.
|
||||
* Default is `image`.
|
||||
* @param string $image_key Optional. Settings key for image. Default
|
||||
* is null. If not defined uses image size key
|
||||
* as the image key.
|
||||
*/
|
||||
public static function print_attachment_image_html( array $settings, $image_size_key = 'image', $image_key = null ) {
|
||||
Utils::print_wp_kses_extended( self::get_attachment_image_html( $settings, $image_size_key, $image_key ), [ 'image' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all image sizes.
|
||||
*
|
||||
* Retrieve available image sizes with data like `width`, `height` and `crop`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array An array of available image sizes.
|
||||
*/
|
||||
public static function get_all_image_sizes() {
|
||||
global $_wp_additional_image_sizes;
|
||||
|
||||
$default_image_sizes = [ 'thumbnail', 'medium', 'medium_large', 'large' ];
|
||||
|
||||
$image_sizes = [];
|
||||
|
||||
foreach ( $default_image_sizes as $size ) {
|
||||
$image_sizes[ $size ] = [
|
||||
'width' => (int) get_option( $size . '_size_w' ),
|
||||
'height' => (int) get_option( $size . '_size_h' ),
|
||||
'crop' => (bool) get_option( $size . '_crop' ),
|
||||
];
|
||||
}
|
||||
|
||||
if ( $_wp_additional_image_sizes ) {
|
||||
$image_sizes = array_merge( $image_sizes, $_wp_additional_image_sizes );
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-admin/includes/media.php */
|
||||
return apply_filters( 'image_size_names_choose', $image_sizes );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attachment image src.
|
||||
*
|
||||
* Retrieve the attachment image source URL.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param string $attachment_id The attachment ID.
|
||||
* @param string $image_size_key Settings key for image size.
|
||||
* @param array $settings Control settings.
|
||||
*
|
||||
* @return string Attachment image source URL.
|
||||
*/
|
||||
public static function get_attachment_image_src( $attachment_id, $image_size_key, array $settings ) {
|
||||
if ( empty( $attachment_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$size = $settings[ $image_size_key . '_size' ];
|
||||
|
||||
if ( 'custom' !== $size ) {
|
||||
$attachment_size = $size;
|
||||
} else {
|
||||
// Use BFI_Thumb script
|
||||
// TODO: Please rewrite this code.
|
||||
require_once ELEMENTOR_PATH . 'includes/libraries/bfi-thumb/bfi-thumb.php';
|
||||
|
||||
$custom_dimension = $settings[ $image_size_key . '_custom_dimension' ];
|
||||
|
||||
$attachment_size = [
|
||||
// Defaults sizes
|
||||
0 => null, // Width.
|
||||
1 => null, // Height.
|
||||
|
||||
'bfi_thumb' => true,
|
||||
'crop' => true,
|
||||
];
|
||||
|
||||
$has_custom_size = false;
|
||||
if ( ! empty( $custom_dimension['width'] ) ) {
|
||||
$has_custom_size = true;
|
||||
$attachment_size[0] = $custom_dimension['width'];
|
||||
}
|
||||
|
||||
if ( ! empty( $custom_dimension['height'] ) ) {
|
||||
$has_custom_size = true;
|
||||
$attachment_size[1] = $custom_dimension['height'];
|
||||
}
|
||||
|
||||
if ( ! $has_custom_size ) {
|
||||
$attachment_size = 'full';
|
||||
}
|
||||
}
|
||||
|
||||
$image_src = wp_get_attachment_image_src( $attachment_id, $attachment_size );
|
||||
|
||||
if ( empty( $image_src[0] ) && 'thumbnail' !== $attachment_size ) {
|
||||
$image_src = wp_get_attachment_image_src( $attachment_id );
|
||||
}
|
||||
|
||||
return ! empty( $image_src[0] ) ? $image_src[0] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get child default arguments.
|
||||
*
|
||||
* Retrieve the default arguments for all the child controls for a specific group
|
||||
* control.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default arguments for all the child controls.
|
||||
*/
|
||||
protected function get_child_default_args() {
|
||||
return [
|
||||
'include' => [],
|
||||
'exclude' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize image size control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function init_fields() {
|
||||
$fields = [];
|
||||
|
||||
$fields['size'] = [
|
||||
'label' => esc_html__( 'Image Resolution', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
];
|
||||
|
||||
$fields['custom_dimension'] = [
|
||||
'label' => esc_html__( 'Image Dimension', 'elementor' ),
|
||||
'type' => Controls_Manager::IMAGE_DIMENSIONS,
|
||||
'description' => esc_html__( 'You can crop the original image size to any custom size. You can also set a single value for height or width in order to keep the original size ratio.', 'elementor' ),
|
||||
'condition' => [
|
||||
'size' => 'custom',
|
||||
],
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare fields.
|
||||
*
|
||||
* Process image size control fields before adding them to `add_control()`.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @param array $fields Image size control fields.
|
||||
*
|
||||
* @return array Processed fields.
|
||||
*/
|
||||
protected function prepare_fields( $fields ) {
|
||||
$image_sizes = $this->get_image_sizes();
|
||||
|
||||
$args = $this->get_args();
|
||||
|
||||
if ( ! empty( $args['default'] ) && isset( $image_sizes[ $args['default'] ] ) ) {
|
||||
$default_value = $args['default'];
|
||||
} else {
|
||||
// Get the first item for default value.
|
||||
$default_value = array_keys( $image_sizes );
|
||||
$default_value = array_shift( $default_value );
|
||||
}
|
||||
|
||||
$fields['size']['options'] = $image_sizes;
|
||||
|
||||
$fields['size']['default'] = $default_value;
|
||||
|
||||
if ( ! isset( $image_sizes['custom'] ) ) {
|
||||
unset( $fields['custom_dimension'] );
|
||||
}
|
||||
|
||||
return parent::prepare_fields( $fields );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image sizes.
|
||||
*
|
||||
* Retrieve available image sizes after filtering `include` and `exclude` arguments.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
*
|
||||
* @return array Filtered image sizes.
|
||||
*/
|
||||
private function get_image_sizes() {
|
||||
$wp_image_sizes = self::get_all_image_sizes();
|
||||
|
||||
$args = $this->get_args();
|
||||
|
||||
if ( $args['include'] ) {
|
||||
$wp_image_sizes = array_intersect_key( $wp_image_sizes, array_flip( $args['include'] ) );
|
||||
} elseif ( $args['exclude'] ) {
|
||||
$wp_image_sizes = array_diff_key( $wp_image_sizes, array_flip( $args['exclude'] ) );
|
||||
}
|
||||
|
||||
$image_sizes = [];
|
||||
|
||||
foreach ( $wp_image_sizes as $size_key => $size_attributes ) {
|
||||
$control_title = ucwords( str_replace( '_', ' ', $size_key ) );
|
||||
if ( is_array( $size_attributes ) ) {
|
||||
$control_title .= sprintf( ' - %d x %d', $size_attributes['width'], $size_attributes['height'] );
|
||||
}
|
||||
|
||||
$image_sizes[ $size_key ] = $control_title;
|
||||
}
|
||||
|
||||
$image_sizes['full'] = esc_html__( 'Full', 'elementor' );
|
||||
|
||||
if ( ! empty( $args['include']['custom'] ) || ! in_array( 'custom', $args['exclude'] ) ) {
|
||||
$image_sizes['custom'] = esc_html__( 'Custom', 'elementor' );
|
||||
}
|
||||
|
||||
return $image_sizes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the image size control. Used to return the
|
||||
* default options while initializing the image size control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default image size control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor text shadow control.
|
||||
*
|
||||
* A base control for creating text shadow control. Displays input fields to define
|
||||
* the text shadow including the horizontal shadow, vertical shadow, shadow blur and
|
||||
* shadow color.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
class Group_Control_Text_Shadow extends Group_Control_Base {
|
||||
|
||||
/**
|
||||
* Fields.
|
||||
*
|
||||
* Holds all the text shadow control fields.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access protected
|
||||
* @static
|
||||
*
|
||||
* @var array Text shadow control fields.
|
||||
*/
|
||||
protected static $fields;
|
||||
|
||||
/**
|
||||
* Get text shadow control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `text-shadow`.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'text-shadow';
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize text shadow control fields.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function init_fields() {
|
||||
$controls = [];
|
||||
|
||||
$controls['text_shadow'] = [
|
||||
'label' => esc_html__( 'Text Shadow', 'elementor' ),
|
||||
'type' => Controls_Manager::TEXT_SHADOW,
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => 'text-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{COLOR}};',
|
||||
],
|
||||
];
|
||||
|
||||
return $controls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the text shadow control. Used to return the
|
||||
* default options while initializing the text shadow control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default text shadow control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => [
|
||||
'starter_title' => esc_html__( 'Text Shadow', 'elementor' ),
|
||||
'starter_name' => 'text_shadow_type',
|
||||
'starter_value' => 'yes',
|
||||
'settings' => [
|
||||
'render_type' => 'ui',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor text stroke control.
|
||||
*
|
||||
* A group control for creating a stroke effect on text. Displays input fields to define
|
||||
* the text stroke and color stroke.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*/
|
||||
class Group_Control_Text_Stroke extends Group_Control_Base {
|
||||
|
||||
/**
|
||||
* Fields.
|
||||
*
|
||||
* Holds all the text stroke control fields.
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @access protected
|
||||
* @static
|
||||
*
|
||||
* @var array Text Stroke control fields.
|
||||
*/
|
||||
protected static $fields;
|
||||
|
||||
/**
|
||||
* Get text stroke control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `text-stroke`.
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'text-stroke';
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize text stroke control fields.
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function init_fields() {
|
||||
$controls = [];
|
||||
|
||||
$controls['text_stroke'] = [
|
||||
'label' => esc_html__( 'Text Stroke', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px', 'em', 'rem', 'custom' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 0,
|
||||
'max' => 10,
|
||||
],
|
||||
'em' => [
|
||||
'min' => 0,
|
||||
'max' => 1,
|
||||
],
|
||||
'rem' => [
|
||||
'min' => 0,
|
||||
'max' => 1,
|
||||
],
|
||||
],
|
||||
'responsive' => true,
|
||||
'selector' => '{{WRAPPER}}',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '-webkit-text-stroke-width: {{SIZE}}{{UNIT}}; stroke-width: {{SIZE}}{{UNIT}};',
|
||||
],
|
||||
];
|
||||
|
||||
$controls['stroke_color'] = [
|
||||
'label' => esc_html__( 'Stroke Color', 'elementor' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#000',
|
||||
'selector' => '{{WRAPPER}}',
|
||||
'selectors' => [
|
||||
'{{SELECTOR}}' => '-webkit-text-stroke-color: {{VALUE}}; stroke: {{VALUE}};',
|
||||
],
|
||||
];
|
||||
|
||||
return $controls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the text stroke control. Used to return the
|
||||
* default options while initializing the text stroke control.
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default text stroke control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => [
|
||||
'starter_title' => esc_html__( 'Text Stroke', 'elementor' ),
|
||||
'starter_name' => 'text_stroke_type',
|
||||
'starter_value' => 'yes',
|
||||
'settings' => [
|
||||
'render_type' => 'ui',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Settings\Page\Manager as PageManager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor typography control.
|
||||
*
|
||||
* A base control for creating typography control. Displays input fields to define
|
||||
* the content typography including font size, font family, font weight, text
|
||||
* transform, font style, line height and letter spacing.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Group_Control_Typography extends Group_Control_Base {
|
||||
|
||||
/**
|
||||
* Fields.
|
||||
*
|
||||
* Holds all the typography control fields.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
* @static
|
||||
*
|
||||
* @var array Typography control fields.
|
||||
*/
|
||||
protected static $fields;
|
||||
|
||||
/**
|
||||
* Scheme fields keys.
|
||||
*
|
||||
* Holds all the typography control scheme fields keys.
|
||||
* Default is an array containing `font_family` and `font_weight`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var array Typography control scheme fields keys.
|
||||
*/
|
||||
private static $_scheme_fields_keys = [ 'font_family', 'font_weight' ];
|
||||
|
||||
/**
|
||||
* Get scheme fields keys.
|
||||
*
|
||||
* Retrieve all the available typography control scheme fields keys.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Scheme fields keys.
|
||||
*/
|
||||
public static function get_scheme_fields_keys() {
|
||||
return self::$_scheme_fields_keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get typography control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `typography`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'typography';
|
||||
}
|
||||
|
||||
/**
|
||||
* Init fields.
|
||||
*
|
||||
* Initialize typography control fields.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control fields.
|
||||
*/
|
||||
protected function init_fields() {
|
||||
$fields = [];
|
||||
|
||||
$kit = Plugin::$instance->kits_manager->get_active_kit_for_frontend();
|
||||
|
||||
/**
|
||||
* Retrieve the settings directly from DB, because of an open issue when a controls group is being initialized
|
||||
* from within another group
|
||||
*/
|
||||
$kit_settings = $kit->get_meta( PageManager::META_KEY );
|
||||
|
||||
$default_fonts = isset( $kit_settings['default_generic_fonts'] ) ? $kit_settings['default_generic_fonts'] : 'Sans-serif';
|
||||
|
||||
if ( $default_fonts ) {
|
||||
$default_fonts = ', ' . $default_fonts;
|
||||
}
|
||||
|
||||
$fields['font_family'] = [
|
||||
'label' => esc_html_x( 'Family', 'Typography Control', 'elementor' ),
|
||||
'type' => Controls_Manager::FONT,
|
||||
'default' => '',
|
||||
'selector_value' => 'font-family: "{{VALUE}}"' . $default_fonts . ';',
|
||||
];
|
||||
|
||||
$fields['font_size'] = [
|
||||
'label' => esc_html_x( 'Size', 'Typography Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 1,
|
||||
'max' => 200,
|
||||
],
|
||||
'em' => [
|
||||
'max' => 20,
|
||||
],
|
||||
'rem' => [
|
||||
'max' => 20,
|
||||
],
|
||||
'vw' => [
|
||||
'min' => 0.1,
|
||||
'max' => 10,
|
||||
'step' => 0.1,
|
||||
],
|
||||
],
|
||||
'responsive' => true,
|
||||
'selector_value' => 'font-size: {{SIZE}}{{UNIT}}',
|
||||
];
|
||||
|
||||
$fields['font_weight'] = [
|
||||
'label' => esc_html_x( 'Weight', 'Typography Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'100' => '100 ' . esc_html_x( '(Thin)', 'Typography Control', 'elementor' ),
|
||||
'200' => '200 ' . esc_html_x( '(Extra Light)', 'Typography Control', 'elementor' ),
|
||||
'300' => '300 ' . esc_html_x( '(Light)', 'Typography Control', 'elementor' ),
|
||||
'400' => '400 ' . esc_html_x( '(Normal)', 'Typography Control', 'elementor' ),
|
||||
'500' => '500 ' . esc_html_x( '(Medium)', 'Typography Control', 'elementor' ),
|
||||
'600' => '600 ' . esc_html_x( '(Semi Bold)', 'Typography Control', 'elementor' ),
|
||||
'700' => '700 ' . esc_html_x( '(Bold)', 'Typography Control', 'elementor' ),
|
||||
'800' => '800 ' . esc_html_x( '(Extra Bold)', 'Typography Control', 'elementor' ),
|
||||
'900' => '900 ' . esc_html_x( '(Black)', 'Typography Control', 'elementor' ),
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'normal' => esc_html__( 'Normal', 'elementor' ),
|
||||
'bold' => esc_html__( 'Bold', 'elementor' ),
|
||||
],
|
||||
];
|
||||
|
||||
$fields['text_transform'] = [
|
||||
'label' => esc_html_x( 'Transform', 'Typography Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'uppercase' => esc_html_x( 'Uppercase', 'Typography Control', 'elementor' ),
|
||||
'lowercase' => esc_html_x( 'Lowercase', 'Typography Control', 'elementor' ),
|
||||
'capitalize' => esc_html_x( 'Capitalize', 'Typography Control', 'elementor' ),
|
||||
'none' => esc_html__( 'Normal', 'elementor' ),
|
||||
],
|
||||
];
|
||||
|
||||
$fields['font_style'] = [
|
||||
'label' => esc_html_x( 'Style', 'Typography Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'normal' => esc_html__( 'Normal', 'elementor' ),
|
||||
'italic' => esc_html_x( 'Italic', 'Typography Control', 'elementor' ),
|
||||
'oblique' => esc_html_x( 'Oblique', 'Typography Control', 'elementor' ),
|
||||
],
|
||||
];
|
||||
|
||||
$fields['text_decoration'] = [
|
||||
'label' => esc_html_x( 'Decoration', 'Typography Control', 'elementor' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Default', 'elementor' ),
|
||||
'underline' => esc_html_x( 'Underline', 'Typography Control', 'elementor' ),
|
||||
'overline' => esc_html_x( 'Overline', 'Typography Control', 'elementor' ),
|
||||
'line-through' => esc_html_x( 'Line Through', 'Typography Control', 'elementor' ),
|
||||
'none' => esc_html__( 'None', 'elementor' ),
|
||||
],
|
||||
];
|
||||
|
||||
$fields['line_height'] = [
|
||||
'label' => esc_html__( 'Line Height', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'desktop_default' => [
|
||||
'unit' => 'em',
|
||||
],
|
||||
'tablet_default' => [
|
||||
'unit' => 'em',
|
||||
],
|
||||
'mobile_default' => [
|
||||
'unit' => 'em',
|
||||
],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 1,
|
||||
],
|
||||
],
|
||||
'responsive' => true,
|
||||
'size_units' => [ 'px', 'em', 'rem', 'custom' ],
|
||||
'selector_value' => 'line-height: {{SIZE}}{{UNIT}}',
|
||||
];
|
||||
|
||||
$fields['letter_spacing'] = [
|
||||
'label' => esc_html__( 'Letter Spacing', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px', 'em', 'rem', 'custom' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => -5,
|
||||
'max' => 10,
|
||||
'step' => 0.1,
|
||||
],
|
||||
'em' => [
|
||||
'min' => 0,
|
||||
'max' => 1,
|
||||
'step' => 0.01,
|
||||
],
|
||||
'rem' => [
|
||||
'min' => 0,
|
||||
'max' => 1,
|
||||
'step' => 0.01,
|
||||
],
|
||||
],
|
||||
'responsive' => true,
|
||||
'selector_value' => 'letter-spacing: {{SIZE}}{{UNIT}}',
|
||||
];
|
||||
|
||||
$fields['word_spacing'] = [
|
||||
'label' => esc_html__( 'Word Spacing', 'elementor' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px', 'em', 'rem', 'custom' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'max' => 50,
|
||||
],
|
||||
'em' => [
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
],
|
||||
'rem' => [
|
||||
'min' => 0,
|
||||
'max' => 5,
|
||||
],
|
||||
],
|
||||
'desktop_default' => [
|
||||
'unit' => 'em',
|
||||
],
|
||||
'tablet_default' => [
|
||||
'unit' => 'em',
|
||||
],
|
||||
'mobile_default' => [
|
||||
'unit' => 'em',
|
||||
],
|
||||
'responsive' => true,
|
||||
'selector_value' => 'word-spacing: {{SIZE}}{{UNIT}}',
|
||||
];
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare fields.
|
||||
*
|
||||
* Process typography control fields before adding them to `add_control()`.
|
||||
*
|
||||
* @since 1.2.3
|
||||
* @access protected
|
||||
*
|
||||
* @param array $fields Typography control fields.
|
||||
*
|
||||
* @return array Processed fields.
|
||||
*/
|
||||
protected function prepare_fields( $fields ) {
|
||||
array_walk(
|
||||
$fields, function( &$field, $field_name ) {
|
||||
|
||||
if ( in_array( $field_name, [ 'typography', 'popover_toggle' ] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$selector_value = ! empty( $field['selector_value'] ) ? $field['selector_value'] : str_replace( '_', '-', $field_name ) . ': {{VALUE}};';
|
||||
|
||||
$field['selectors'] = [
|
||||
'{{SELECTOR}}' => $selector_value,
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
return parent::prepare_fields( $fields );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add group arguments to field.
|
||||
*
|
||||
* Register field arguments to typography control.
|
||||
*
|
||||
* @since 1.2.2
|
||||
* @access protected
|
||||
*
|
||||
* @param string $control_id Typography control id.
|
||||
* @param array $field_args Typography control field arguments.
|
||||
*
|
||||
* @return array Field arguments.
|
||||
*/
|
||||
protected function add_group_args_to_field( $control_id, $field_args ) {
|
||||
$field_args = parent::add_group_args_to_field( $control_id, $field_args );
|
||||
|
||||
$field_args['groupPrefix'] = $this->get_controls_prefix();
|
||||
$field_args['groupType'] = 'typography';
|
||||
|
||||
$args = $this->get_args();
|
||||
|
||||
if ( in_array( $control_id, self::get_scheme_fields_keys() ) && ! empty( $args['scheme'] ) ) {
|
||||
$field_args['scheme'] = [
|
||||
'type' => self::get_type(),
|
||||
'value' => $args['scheme'],
|
||||
'key' => $control_id,
|
||||
];
|
||||
}
|
||||
|
||||
return $field_args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default options.
|
||||
*
|
||||
* Retrieve the default options of the typography control. Used to return the
|
||||
* default options while initializing the typography control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Default typography control options.
|
||||
*/
|
||||
protected function get_default_options() {
|
||||
return [
|
||||
'popover' => [
|
||||
'starter_name' => 'typography',
|
||||
'starter_title' => esc_html__( 'Typography', 'elementor' ),
|
||||
'settings' => [
|
||||
'render_type' => 'ui',
|
||||
'groupType' => 'typography',
|
||||
'global' => [
|
||||
'active' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
66
wp-content/plugins/elementor/includes/controls/heading.php
Normal file
66
wp-content/plugins/elementor/includes/controls/heading.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor heading control.
|
||||
*
|
||||
* A base control for creating heading control. Displays a text heading between
|
||||
* controls in the panel.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Heading extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get heading control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `heading`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'heading';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get heading control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the heading control. Used to return the
|
||||
* default settings while initializing the heading control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render heading control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<h3 class="elementor-control-title">{{{ data.label }}}</h3>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
47
wp-content/plugins/elementor/includes/controls/hidden.php
Normal file
47
wp-content/plugins/elementor/includes/controls/hidden.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor hidden control.
|
||||
*
|
||||
* A base control for creating hidden control. Used to save additional data in
|
||||
* the database without a visual presentation in the panel.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Hidden extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get hidden control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `hidden`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'hidden';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render hidden control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<input type="hidden" data-setting="{{{ data.name }}}" />
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor hover animation control.
|
||||
*
|
||||
* A base control for creating hover animation control. Displays a select box
|
||||
* with the available hover animation effects @see Control_Hover_Animation::get_animations()
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Hover_Animation extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Animations.
|
||||
*
|
||||
* Holds all the available hover animation effects of the control.
|
||||
*
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $_animations;
|
||||
|
||||
/**
|
||||
* Get hover animation control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `hover_animation`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'hover_animation';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get animations.
|
||||
*
|
||||
* Retrieve the available hover animation effects.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Available hover animation.
|
||||
*/
|
||||
public static function get_animations() {
|
||||
if ( is_null( self::$_animations ) ) {
|
||||
self::$_animations = [
|
||||
'grow' => 'Grow',
|
||||
'shrink' => 'Shrink',
|
||||
'pulse' => 'Pulse',
|
||||
'pulse-grow' => 'Pulse Grow',
|
||||
'pulse-shrink' => 'Pulse Shrink',
|
||||
'push' => 'Push',
|
||||
'pop' => 'Pop',
|
||||
'bounce-in' => 'Bounce In',
|
||||
'bounce-out' => 'Bounce Out',
|
||||
'rotate' => 'Rotate',
|
||||
'grow-rotate' => 'Grow Rotate',
|
||||
'float' => 'Float',
|
||||
'sink' => 'Sink',
|
||||
'bob' => 'Bob',
|
||||
'hang' => 'Hang',
|
||||
'skew' => 'Skew',
|
||||
'skew-forward' => 'Skew Forward',
|
||||
'skew-backward' => 'Skew Backward',
|
||||
'wobble-vertical' => 'Wobble Vertical',
|
||||
'wobble-horizontal' => 'Wobble Horizontal',
|
||||
'wobble-to-bottom-right' => 'Wobble To Bottom Right',
|
||||
'wobble-to-top-right' => 'Wobble To Top Right',
|
||||
'wobble-top' => 'Wobble Top',
|
||||
'wobble-bottom' => 'Wobble Bottom',
|
||||
'wobble-skew' => 'Wobble Skew',
|
||||
'buzz' => 'Buzz',
|
||||
'buzz-out' => 'Buzz Out',
|
||||
];
|
||||
|
||||
$additional_animations = [];
|
||||
|
||||
/**
|
||||
* Hover animations.
|
||||
*
|
||||
* Filters the animations list displayed in the hover animations control.
|
||||
*
|
||||
* This hook can be used to register new animations in addition to the
|
||||
* basic Elementor hover animations.
|
||||
*
|
||||
* @since 2.4.0
|
||||
*
|
||||
* @param array $additional_animations Additional animations array.
|
||||
*/
|
||||
$additional_animations = apply_filters( 'elementor/controls/hover_animations/additional_animations', $additional_animations );
|
||||
|
||||
self::$_animations = array_merge( self::$_animations, $additional_animations );
|
||||
}
|
||||
|
||||
return self::$_animations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render hover animation control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
|
||||
<option value=""><?php echo esc_html__( 'None', 'elementor' ); ?></option>
|
||||
<?php foreach ( static::get_animations() as $animation_name => $animation_title ) : ?>
|
||||
<option value="<?php Utils::print_unescaped_internal_string( $animation_name ); ?>"><?php Utils::print_unescaped_internal_string( $animation_title ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hover animation control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the hover animation control. Used to return
|
||||
* the default settings while initializing the hover animation control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public static function get_assets( $setting ) {
|
||||
if ( ! $setting || 'none' === $setting ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
'styles' => [ 'e-animations' ],
|
||||
];
|
||||
}
|
||||
}
|
||||
889
wp-content/plugins/elementor/includes/controls/icon.php
Normal file
889
wp-content/plugins/elementor/includes/controls/icon.php
Normal file
@@ -0,0 +1,889 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor icon control.
|
||||
*
|
||||
* A base control for creating an icon control. Displays a font icon select box
|
||||
* field. The control accepts `include` or `exclude` arguments to set a partial
|
||||
* list of icons.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @deprecated 2.6.0 Use `Control_Icons` class instead.
|
||||
*/
|
||||
class Control_Icon extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get icon control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `icon`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @deprecated 2.6.0 Use `Control_Icons` class instead.
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'icon';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icons.
|
||||
*
|
||||
* Retrieve all the available icons.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @deprecated 2.6.0 Use `Control_Icons` class instead.
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return array Available icons.
|
||||
*/
|
||||
public static function get_icons() {
|
||||
return [
|
||||
'fa fa-500px' => '500px',
|
||||
'fa fa-address-book' => 'address-book',
|
||||
'fa fa-address-book-o' => 'address-book-o',
|
||||
'fa fa-address-card' => 'address-card',
|
||||
'fa fa-address-card-o' => 'address-card-o',
|
||||
'fa fa-adjust' => 'adjust',
|
||||
'fa fa-adn' => 'adn',
|
||||
'fa fa-align-center' => 'align-center',
|
||||
'fa fa-align-justify' => 'align-justify',
|
||||
'fa fa-align-left' => 'align-left',
|
||||
'fa fa-align-right' => 'align-right',
|
||||
'fa fa-amazon' => 'amazon',
|
||||
'fa fa-ambulance' => 'ambulance',
|
||||
'fa fa-american-sign-language-interpreting' => 'american-sign-language-interpreting',
|
||||
'fa fa-anchor' => 'anchor',
|
||||
'fa fa-android' => 'android',
|
||||
'fa fa-angellist' => 'angellist',
|
||||
'fa fa-angle-double-down' => 'angle-double-down',
|
||||
'fa fa-angle-double-left' => 'angle-double-left',
|
||||
'fa fa-angle-double-right' => 'angle-double-right',
|
||||
'fa fa-angle-double-up' => 'angle-double-up',
|
||||
'fa fa-angle-down' => 'angle-down',
|
||||
'fa fa-angle-left' => 'angle-left',
|
||||
'fa fa-angle-right' => 'angle-right',
|
||||
'fa fa-angle-up' => 'angle-up',
|
||||
'fa fa-apple' => 'apple',
|
||||
'fa fa-archive' => 'archive',
|
||||
'fa fa-area-chart' => 'area-chart',
|
||||
'fa fa-arrow-circle-down' => 'arrow-circle-down',
|
||||
'fa fa-arrow-circle-left' => 'arrow-circle-left',
|
||||
'fa fa-arrow-circle-o-down' => 'arrow-circle-o-down',
|
||||
'fa fa-arrow-circle-o-left' => 'arrow-circle-o-left',
|
||||
'fa fa-arrow-circle-o-right' => 'arrow-circle-o-right',
|
||||
'fa fa-arrow-circle-o-up' => 'arrow-circle-o-up',
|
||||
'fa fa-arrow-circle-right' => 'arrow-circle-right',
|
||||
'fa fa-arrow-circle-up' => 'arrow-circle-up',
|
||||
'fa fa-arrow-down' => 'arrow-down',
|
||||
'fa fa-arrow-left' => 'arrow-left',
|
||||
'fa fa-arrow-right' => 'arrow-right',
|
||||
'fa fa-arrow-up' => 'arrow-up',
|
||||
'fa fa-arrows' => 'arrows',
|
||||
'fa fa-arrows-alt' => 'arrows-alt',
|
||||
'fa fa-arrows-h' => 'arrows-h',
|
||||
'fa fa-arrows-v' => 'arrows-v',
|
||||
'fa fa-asl-interpreting' => 'asl-interpreting',
|
||||
'fa fa-assistive-listening-systems' => 'assistive-listening-systems',
|
||||
'fa fa-asterisk' => 'asterisk',
|
||||
'fa fa-at' => 'at',
|
||||
'fa fa-audio-description' => 'audio-description',
|
||||
'fa fa-automobile' => 'automobile',
|
||||
'fa fa-backward' => 'backward',
|
||||
'fa fa-balance-scale' => 'balance-scale',
|
||||
'fa fa-ban' => 'ban',
|
||||
'fa fa-bandcamp' => 'bandcamp',
|
||||
'fa fa-bank' => 'bank',
|
||||
'fa fa-bar-chart' => 'bar-chart',
|
||||
'fa fa-bar-chart-o' => 'bar-chart-o',
|
||||
'fa fa-barcode' => 'barcode',
|
||||
'fa fa-bars' => 'bars',
|
||||
'fa fa-bath' => 'bath',
|
||||
'fa fa-bathtub' => 'bathtub',
|
||||
'fa fa-battery' => 'battery',
|
||||
'fa fa-battery-0' => 'battery-0',
|
||||
'fa fa-battery-1' => 'battery-1',
|
||||
'fa fa-battery-2' => 'battery-2',
|
||||
'fa fa-battery-3' => 'battery-3',
|
||||
'fa fa-battery-4' => 'battery-4',
|
||||
'fa fa-battery-empty' => 'battery-empty',
|
||||
'fa fa-battery-full' => 'battery-full',
|
||||
'fa fa-battery-half' => 'battery-half',
|
||||
'fa fa-battery-quarter' => 'battery-quarter',
|
||||
'fa fa-battery-three-quarters' => 'battery-three-quarters',
|
||||
'fa fa-bed' => 'bed',
|
||||
'fa fa-beer' => 'beer',
|
||||
'fa fa-behance' => 'behance',
|
||||
'fa fa-behance-square' => 'behance-square',
|
||||
'fa fa-bell' => 'bell',
|
||||
'fa fa-bell-o' => 'bell-o',
|
||||
'fa fa-bell-slash' => 'bell-slash',
|
||||
'fa fa-bell-slash-o' => 'bell-slash-o',
|
||||
'fa fa-bicycle' => 'bicycle',
|
||||
'fa fa-binoculars' => 'binoculars',
|
||||
'fa fa-birthday-cake' => 'birthday-cake',
|
||||
'fa fa-bitbucket' => 'bitbucket',
|
||||
'fa fa-bitbucket-square' => 'bitbucket-square',
|
||||
'fa fa-bitcoin' => 'bitcoin',
|
||||
'fa fa-black-tie' => 'black-tie',
|
||||
'fa fa-blind' => 'blind',
|
||||
'fa fa-bluetooth' => 'bluetooth',
|
||||
'fa fa-bluetooth-b' => 'bluetooth-b',
|
||||
'fa fa-bold' => 'bold',
|
||||
'fa fa-bolt' => 'bolt',
|
||||
'fa fa-bomb' => 'bomb',
|
||||
'fa fa-book' => 'book',
|
||||
'fa fa-bookmark' => 'bookmark',
|
||||
'fa fa-bookmark-o' => 'bookmark-o',
|
||||
'fa fa-braille' => 'braille',
|
||||
'fa fa-briefcase' => 'briefcase',
|
||||
'fa fa-btc' => 'btc',
|
||||
'fa fa-bug' => 'bug',
|
||||
'fa fa-building' => 'building',
|
||||
'fa fa-building-o' => 'building-o',
|
||||
'fa fa-bullhorn' => 'bullhorn',
|
||||
'fa fa-bullseye' => 'bullseye',
|
||||
'fa fa-bus' => 'bus',
|
||||
'fa fa-buysellads' => 'buysellads',
|
||||
'fa fa-cab' => 'cab',
|
||||
'fa fa-calculator' => 'calculator',
|
||||
'fa fa-calendar' => 'calendar',
|
||||
'fa fa-calendar-check-o' => 'calendar-check-o',
|
||||
'fa fa-calendar-minus-o' => 'calendar-minus-o',
|
||||
'fa fa-calendar-o' => 'calendar-o',
|
||||
'fa fa-calendar-plus-o' => 'calendar-plus-o',
|
||||
'fa fa-calendar-times-o' => 'calendar-times-o',
|
||||
'fa fa-camera' => 'camera',
|
||||
'fa fa-camera-retro' => 'camera-retro',
|
||||
'fa fa-car' => 'car',
|
||||
'fa fa-caret-down' => 'caret-down',
|
||||
'fa fa-caret-left' => 'caret-left',
|
||||
'fa fa-caret-right' => 'caret-right',
|
||||
'fa fa-caret-square-o-down' => 'caret-square-o-down',
|
||||
'fa fa-caret-square-o-left' => 'caret-square-o-left',
|
||||
'fa fa-caret-square-o-right' => 'caret-square-o-right',
|
||||
'fa fa-caret-square-o-up' => 'caret-square-o-up',
|
||||
'fa fa-caret-up' => 'caret-up',
|
||||
'fa fa-cart-arrow-down' => 'cart-arrow-down',
|
||||
'fa fa-cart-plus' => 'cart-plus',
|
||||
'fa fa-cc' => 'cc',
|
||||
'fa fa-cc-amex' => 'cc-amex',
|
||||
'fa fa-cc-diners-club' => 'cc-diners-club',
|
||||
'fa fa-cc-discover' => 'cc-discover',
|
||||
'fa fa-cc-jcb' => 'cc-jcb',
|
||||
'fa fa-cc-mastercard' => 'cc-mastercard',
|
||||
'fa fa-cc-paypal' => 'cc-paypal',
|
||||
'fa fa-cc-stripe' => 'cc-stripe',
|
||||
'fa fa-cc-visa' => 'cc-visa',
|
||||
'fa fa-certificate' => 'certificate',
|
||||
'fa fa-chain' => 'chain',
|
||||
'fa fa-chain-broken' => 'chain-broken',
|
||||
'fa fa-check' => 'check',
|
||||
'fa fa-check-circle' => 'check-circle',
|
||||
'fa fa-check-circle-o' => 'check-circle-o',
|
||||
'fa fa-check-square' => 'check-square',
|
||||
'fa fa-check-square-o' => 'check-square-o',
|
||||
'fa fa-chevron-circle-down' => 'chevron-circle-down',
|
||||
'fa fa-chevron-circle-left' => 'chevron-circle-left',
|
||||
'fa fa-chevron-circle-right' => 'chevron-circle-right',
|
||||
'fa fa-chevron-circle-up' => 'chevron-circle-up',
|
||||
'fa fa-chevron-down' => 'chevron-down',
|
||||
'fa fa-chevron-left' => 'chevron-left',
|
||||
'fa fa-chevron-right' => 'chevron-right',
|
||||
'fa fa-chevron-up' => 'chevron-up',
|
||||
'fa fa-child' => 'child',
|
||||
'fa fa-chrome' => 'chrome',
|
||||
'fa fa-circle' => 'circle',
|
||||
'fa fa-circle-o' => 'circle-o',
|
||||
'fa fa-circle-o-notch' => 'circle-o-notch',
|
||||
'fa fa-circle-thin' => 'circle-thin',
|
||||
'fa fa-clipboard' => 'clipboard',
|
||||
'fa fa-clock-o' => 'clock-o',
|
||||
'fa fa-clone' => 'clone',
|
||||
'fa fa-close' => 'close',
|
||||
'fa fa-cloud' => 'cloud',
|
||||
'fa fa-cloud-download' => 'cloud-download',
|
||||
'fa fa-cloud-upload' => 'cloud-upload',
|
||||
'fa fa-cny' => 'cny',
|
||||
'fa fa-code' => 'code',
|
||||
'fa fa-code-fork' => 'code-fork',
|
||||
'fa fa-codepen' => 'codepen',
|
||||
'fa fa-codiepie' => 'codiepie',
|
||||
'fa fa-coffee' => 'coffee',
|
||||
'fa fa-cog' => 'cog',
|
||||
'fa fa-cogs' => 'cogs',
|
||||
'fa fa-columns' => 'columns',
|
||||
'fa fa-comment' => 'comment',
|
||||
'fa fa-comment-o' => 'comment-o',
|
||||
'fa fa-commenting' => 'commenting',
|
||||
'fa fa-commenting-o' => 'commenting-o',
|
||||
'fa fa-comments' => 'comments',
|
||||
'fa fa-comments-o' => 'comments-o',
|
||||
'fa fa-compass' => 'compass',
|
||||
'fa fa-compress' => 'compress',
|
||||
'fa fa-connectdevelop' => 'connectdevelop',
|
||||
'fa fa-contao' => 'contao',
|
||||
'fa fa-copy' => 'copy',
|
||||
'fa fa-copyright' => 'copyright',
|
||||
'fa fa-creative-commons' => 'creative-commons',
|
||||
'fa fa-credit-card' => 'credit-card',
|
||||
'fa fa-credit-card-alt' => 'credit-card-alt',
|
||||
'fa fa-crop' => 'crop',
|
||||
'fa fa-crosshairs' => 'crosshairs',
|
||||
'fa fa-css3' => 'css3',
|
||||
'fa fa-cube' => 'cube',
|
||||
'fa fa-cubes' => 'cubes',
|
||||
'fa fa-cut' => 'cut',
|
||||
'fa fa-cutlery' => 'cutlery',
|
||||
'fa fa-dashboard' => 'dashboard',
|
||||
'fa fa-dashcube' => 'dashcube',
|
||||
'fa fa-database' => 'database',
|
||||
'fa fa-deaf' => 'deaf',
|
||||
'fa fa-deafness' => 'deafness',
|
||||
'fa fa-dedent' => 'dedent',
|
||||
'fa fa-delicious' => 'delicious',
|
||||
'fa fa-desktop' => 'desktop',
|
||||
'fa fa-deviantart' => 'deviantart',
|
||||
'fa fa-diamond' => 'diamond',
|
||||
'fa fa-digg' => 'digg',
|
||||
'fa fa-dollar' => 'dollar',
|
||||
'fa fa-dot-circle-o' => 'dot-circle-o',
|
||||
'fa fa-download' => 'download',
|
||||
'fa fa-dribbble' => 'dribbble',
|
||||
'fa fa-drivers-license' => 'drivers-license',
|
||||
'fa fa-drivers-license-o' => 'drivers-license-o',
|
||||
'fa fa-dropbox' => 'dropbox',
|
||||
'fa fa-drupal' => 'drupal',
|
||||
'fa fa-edge' => 'edge',
|
||||
'fa fa-edit' => 'edit',
|
||||
'fa fa-eercast' => 'eercast',
|
||||
'fa fa-eject' => 'eject',
|
||||
'fa fa-ellipsis-h' => 'ellipsis-h',
|
||||
'fa fa-ellipsis-v' => 'ellipsis-v',
|
||||
'fa fa-empire' => 'empire',
|
||||
'fa fa-envelope' => 'envelope',
|
||||
'fa fa-envelope-o' => 'envelope-o',
|
||||
'fa fa-envelope-open' => 'envelope-open',
|
||||
'fa fa-envelope-open-o' => 'envelope-open-o',
|
||||
'fa fa-envelope-square' => 'envelope-square',
|
||||
'fa fa-envira' => 'envira',
|
||||
'fa fa-eraser' => 'eraser',
|
||||
'fa fa-etsy' => 'etsy',
|
||||
'fa fa-eur' => 'eur',
|
||||
'fa fa-euro' => 'euro',
|
||||
'fa fa-exchange' => 'exchange',
|
||||
'fa fa-exclamation' => 'exclamation',
|
||||
'fa fa-exclamation-circle' => 'exclamation-circle',
|
||||
'fa fa-exclamation-triangle' => 'exclamation-triangle',
|
||||
'fa fa-expand' => 'expand',
|
||||
'fa fa-expeditedssl' => 'expeditedssl',
|
||||
'fa fa-external-link' => 'external-link',
|
||||
'fa fa-external-link-square' => 'external-link-square',
|
||||
'fa fa-eye' => 'eye',
|
||||
'fa fa-eye-slash' => 'eye-slash',
|
||||
'fa fa-eyedropper' => 'eyedropper',
|
||||
'fa fa-fa' => 'fa',
|
||||
'fa fa-facebook' => 'facebook',
|
||||
'fa fa-facebook-f' => 'facebook-f',
|
||||
'fa fa-facebook-official' => 'facebook-official',
|
||||
'fa fa-facebook-square' => 'facebook-square',
|
||||
'fa fa-fast-backward' => 'fast-backward',
|
||||
'fa fa-fast-forward' => 'fast-forward',
|
||||
'fa fa-fax' => 'fax',
|
||||
'fa fa-feed' => 'feed',
|
||||
'fa fa-female' => 'female',
|
||||
'fa fa-fighter-jet' => 'fighter-jet',
|
||||
'fa fa-file' => 'file',
|
||||
'fa fa-file-archive-o' => 'file-archive-o',
|
||||
'fa fa-file-audio-o' => 'file-audio-o',
|
||||
'fa fa-file-code-o' => 'file-code-o',
|
||||
'fa fa-file-excel-o' => 'file-excel-o',
|
||||
'fa fa-file-image-o' => 'file-image-o',
|
||||
'fa fa-file-movie-o' => 'file-movie-o',
|
||||
'fa fa-file-o' => 'file-o',
|
||||
'fa fa-file-pdf-o' => 'file-pdf-o',
|
||||
'fa fa-file-photo-o' => 'file-photo-o',
|
||||
'fa fa-file-picture-o' => 'file-picture-o',
|
||||
'fa fa-file-powerpoint-o' => 'file-powerpoint-o',
|
||||
'fa fa-file-sound-o' => 'file-sound-o',
|
||||
'fa fa-file-text' => 'file-text',
|
||||
'fa fa-file-text-o' => 'file-text-o',
|
||||
'fa fa-file-video-o' => 'file-video-o',
|
||||
'fa fa-file-word-o' => 'file-word-o',
|
||||
'fa fa-file-zip-o' => 'file-zip-o',
|
||||
'fa fa-files-o' => 'files-o',
|
||||
'fa fa-film' => 'film',
|
||||
'fa fa-filter' => 'filter',
|
||||
'fa fa-fire' => 'fire',
|
||||
'fa fa-fire-extinguisher' => 'fire-extinguisher',
|
||||
'fa fa-firefox' => 'firefox',
|
||||
'fa fa-first-order' => 'first-order',
|
||||
'fa fa-flag' => 'flag',
|
||||
'fa fa-flag-checkered' => 'flag-checkered',
|
||||
'fa fa-flag-o' => 'flag-o',
|
||||
'fa fa-flash' => 'flash',
|
||||
'fa fa-flask' => 'flask',
|
||||
'fa fa-flickr' => 'flickr',
|
||||
'fa fa-floppy-o' => 'floppy-o',
|
||||
'fa fa-folder' => 'folder',
|
||||
'fa fa-folder-o' => 'folder-o',
|
||||
'fa fa-folder-open' => 'folder-open',
|
||||
'fa fa-folder-open-o' => 'folder-open-o',
|
||||
'fa fa-font' => 'font',
|
||||
'fa fa-font-awesome' => 'font-awesome',
|
||||
'fa fa-fonticons' => 'fonticons',
|
||||
'fa fa-fort-awesome' => 'fort-awesome',
|
||||
'fa fa-forumbee' => 'forumbee',
|
||||
'fa fa-forward' => 'forward',
|
||||
'fa fa-foursquare' => 'foursquare',
|
||||
'fa fa-free-code-camp' => 'free-code-camp',
|
||||
'fa fa-frown-o' => 'frown-o',
|
||||
'fa fa-futbol-o' => 'futbol-o',
|
||||
'fa fa-gamepad' => 'gamepad',
|
||||
'fa fa-gavel' => 'gavel',
|
||||
'fa fa-gbp' => 'gbp',
|
||||
'fa fa-ge' => 'ge',
|
||||
'fa fa-gear' => 'gear',
|
||||
'fa fa-gears' => 'gears',
|
||||
'fa fa-genderless' => 'genderless',
|
||||
'fa fa-get-pocket' => 'get-pocket',
|
||||
'fa fa-gg' => 'gg',
|
||||
'fa fa-gg-circle' => 'gg-circle',
|
||||
'fa fa-gift' => 'gift',
|
||||
'fa fa-git' => 'git',
|
||||
'fa fa-git-square' => 'git-square',
|
||||
'fa fa-github' => 'github',
|
||||
'fa fa-github-alt' => 'github-alt',
|
||||
'fa fa-github-square' => 'github-square',
|
||||
'fa fa-gitlab' => 'gitlab',
|
||||
'fa fa-gittip' => 'gittip',
|
||||
'fa fa-glass' => 'glass',
|
||||
'fa fa-glide' => 'glide',
|
||||
'fa fa-glide-g' => 'glide-g',
|
||||
'fa fa-globe' => 'globe',
|
||||
'fa fa-google' => 'google',
|
||||
'fa fa-google-plus' => 'google-plus',
|
||||
'fa fa-google-plus-circle' => 'google-plus-circle',
|
||||
'fa fa-google-plus-official' => 'google-plus-official',
|
||||
'fa fa-google-plus-square' => 'google-plus-square',
|
||||
'fa fa-google-wallet' => 'google-wallet',
|
||||
'fa fa-graduation-cap' => 'graduation-cap',
|
||||
'fa fa-gratipay' => 'gratipay',
|
||||
'fa fa-grav' => 'grav',
|
||||
'fa fa-group' => 'group',
|
||||
'fa fa-h-square' => 'h-square',
|
||||
'fa fa-hacker-news' => 'hacker-news',
|
||||
'fa fa-hand-grab-o' => 'hand-grab-o',
|
||||
'fa fa-hand-lizard-o' => 'hand-lizard-o',
|
||||
'fa fa-hand-o-down' => 'hand-o-down',
|
||||
'fa fa-hand-o-left' => 'hand-o-left',
|
||||
'fa fa-hand-o-right' => 'hand-o-right',
|
||||
'fa fa-hand-o-up' => 'hand-o-up',
|
||||
'fa fa-hand-paper-o' => 'hand-paper-o',
|
||||
'fa fa-hand-peace-o' => 'hand-peace-o',
|
||||
'fa fa-hand-pointer-o' => 'hand-pointer-o',
|
||||
'fa fa-hand-rock-o' => 'hand-rock-o',
|
||||
'fa fa-hand-scissors-o' => 'hand-scissors-o',
|
||||
'fa fa-hand-spock-o' => 'hand-spock-o',
|
||||
'fa fa-hand-stop-o' => 'hand-stop-o',
|
||||
'fa fa-handshake-o' => 'handshake-o',
|
||||
'fa fa-hard-of-hearing' => 'hard-of-hearing',
|
||||
'fa fa-hashtag' => 'hashtag',
|
||||
'fa fa-hdd-o' => 'hdd-o',
|
||||
'fa fa-header' => 'header',
|
||||
'fa fa-headphones' => 'headphones',
|
||||
'fa fa-heart' => 'heart',
|
||||
'fa fa-heart-o' => 'heart-o',
|
||||
'fa fa-heartbeat' => 'heartbeat',
|
||||
'fa fa-history' => 'history',
|
||||
'fa fa-home' => 'home',
|
||||
'fa fa-hospital-o' => 'hospital-o',
|
||||
'fa fa-hotel' => 'hotel',
|
||||
'fa fa-hourglass' => 'hourglass',
|
||||
'fa fa-hourglass-1' => 'hourglass-1',
|
||||
'fa fa-hourglass-2' => 'hourglass-2',
|
||||
'fa fa-hourglass-3' => 'hourglass-3',
|
||||
'fa fa-hourglass-end' => 'hourglass-end',
|
||||
'fa fa-hourglass-half' => 'hourglass-half',
|
||||
'fa fa-hourglass-o' => 'hourglass-o',
|
||||
'fa fa-hourglass-start' => 'hourglass-start',
|
||||
'fa fa-houzz' => 'houzz',
|
||||
'fa fa-html5' => 'html5',
|
||||
'fa fa-i-cursor' => 'i-cursor',
|
||||
'fa fa-id-badge' => 'id-badge',
|
||||
'fa fa-id-card' => 'id-card',
|
||||
'fa fa-id-card-o' => 'id-card-o',
|
||||
'fa fa-ils' => 'ils',
|
||||
'fa fa-image' => 'image',
|
||||
'fa fa-imdb' => 'imdb',
|
||||
'fa fa-inbox' => 'inbox',
|
||||
'fa fa-indent' => 'indent',
|
||||
'fa fa-industry' => 'industry',
|
||||
'fa fa-info' => 'info',
|
||||
'fa fa-info-circle' => 'info-circle',
|
||||
'fa fa-inr' => 'inr',
|
||||
'fa fa-instagram' => 'instagram',
|
||||
'fa fa-institution' => 'institution',
|
||||
'fa fa-internet-explorer' => 'internet-explorer',
|
||||
'fa fa-intersex' => 'intersex',
|
||||
'fa fa-ioxhost' => 'ioxhost',
|
||||
'fa fa-italic' => 'italic',
|
||||
'fa fa-joomla' => 'joomla',
|
||||
'fa fa-jpy' => 'jpy',
|
||||
'fa fa-jsfiddle' => 'jsfiddle',
|
||||
'fa fa-key' => 'key',
|
||||
'fa fa-keyboard-o' => 'keyboard-o',
|
||||
'fa fa-krw' => 'krw',
|
||||
'fa fa-language' => 'language',
|
||||
'fa fa-laptop' => 'laptop',
|
||||
'fa fa-lastfm' => 'lastfm',
|
||||
'fa fa-lastfm-square' => 'lastfm-square',
|
||||
'fa fa-leaf' => 'leaf',
|
||||
'fa fa-leanpub' => 'leanpub',
|
||||
'fa fa-legal' => 'legal',
|
||||
'fa fa-lemon-o' => 'lemon-o',
|
||||
'fa fa-level-down' => 'level-down',
|
||||
'fa fa-level-up' => 'level-up',
|
||||
'fa fa-life-bouy' => 'life-bouy',
|
||||
'fa fa-life-buoy' => 'life-buoy',
|
||||
'fa fa-life-ring' => 'life-ring',
|
||||
'fa fa-life-saver' => 'life-saver',
|
||||
'fa fa-lightbulb-o' => 'lightbulb-o',
|
||||
'fa fa-line-chart' => 'line-chart',
|
||||
'fa fa-link' => 'link',
|
||||
'fa fa-linkedin' => 'linkedin',
|
||||
'fa fa-linkedin-square' => 'linkedin-square',
|
||||
'fa fa-linode' => 'linode',
|
||||
'fa fa-linux' => 'linux',
|
||||
'fa fa-list' => 'list',
|
||||
'fa fa-list-alt' => 'list-alt',
|
||||
'fa fa-list-ol' => 'list-ol',
|
||||
'fa fa-list-ul' => 'list-ul',
|
||||
'fa fa-location-arrow' => 'location-arrow',
|
||||
'fa fa-lock' => 'lock',
|
||||
'fa fa-long-arrow-down' => 'long-arrow-down',
|
||||
'fa fa-long-arrow-left' => 'long-arrow-left',
|
||||
'fa fa-long-arrow-right' => 'long-arrow-right',
|
||||
'fa fa-long-arrow-up' => 'long-arrow-up',
|
||||
'fa fa-low-vision' => 'low-vision',
|
||||
'fa fa-magic' => 'magic',
|
||||
'fa fa-magnet' => 'magnet',
|
||||
'fa fa-mail-forward' => 'mail-forward',
|
||||
'fa fa-mail-reply' => 'mail-reply',
|
||||
'fa fa-mail-reply-all' => 'mail-reply-all',
|
||||
'fa fa-male' => 'male',
|
||||
'fa fa-map' => 'map',
|
||||
'fa fa-map-marker' => 'map-marker',
|
||||
'fa fa-map-o' => 'map-o',
|
||||
'fa fa-map-pin' => 'map-pin',
|
||||
'fa fa-map-signs' => 'map-signs',
|
||||
'fa fa-mars' => 'mars',
|
||||
'fa fa-mars-double' => 'mars-double',
|
||||
'fa fa-mars-stroke' => 'mars-stroke',
|
||||
'fa fa-mars-stroke-h' => 'mars-stroke-h',
|
||||
'fa fa-mars-stroke-v' => 'mars-stroke-v',
|
||||
'fa fa-maxcdn' => 'maxcdn',
|
||||
'fa fa-meanpath' => 'meanpath',
|
||||
'fa fa-medium' => 'medium',
|
||||
'fa fa-medkit' => 'medkit',
|
||||
'fa fa-meetup' => 'meetup',
|
||||
'fa fa-meh-o' => 'meh-o',
|
||||
'fa fa-mercury' => 'mercury',
|
||||
'fa fa-microchip' => 'microchip',
|
||||
'fa fa-microphone' => 'microphone',
|
||||
'fa fa-microphone-slash' => 'microphone-slash',
|
||||
'fa fa-minus' => 'minus',
|
||||
'fa fa-minus-circle' => 'minus-circle',
|
||||
'fa fa-minus-square' => 'minus-square',
|
||||
'fa fa-minus-square-o' => 'minus-square-o',
|
||||
'fa fa-mixcloud' => 'mixcloud',
|
||||
'fa fa-mobile' => 'mobile',
|
||||
'fa fa-mobile-phone' => 'mobile-phone',
|
||||
'fa fa-modx' => 'modx',
|
||||
'fa fa-money' => 'money',
|
||||
'fa fa-moon-o' => 'moon-o',
|
||||
'fa fa-mortar-board' => 'mortar-board',
|
||||
'fa fa-motorcycle' => 'motorcycle',
|
||||
'fa fa-mouse-pointer' => 'mouse-pointer',
|
||||
'fa fa-music' => 'music',
|
||||
'fa fa-navicon' => 'navicon',
|
||||
'fa fa-neuter' => 'neuter',
|
||||
'fa fa-newspaper-o' => 'newspaper-o',
|
||||
'fa fa-object-group' => 'object-group',
|
||||
'fa fa-object-ungroup' => 'object-ungroup',
|
||||
'fa fa-odnoklassniki' => 'odnoklassniki',
|
||||
'fa fa-odnoklassniki-square' => 'odnoklassniki-square',
|
||||
'fa fa-opencart' => 'opencart',
|
||||
'fa fa-openid' => 'openid',
|
||||
'fa fa-opera' => 'opera',
|
||||
'fa fa-optin-monster' => 'optin-monster',
|
||||
'fa fa-outdent' => 'outdent',
|
||||
'fa fa-pagelines' => 'pagelines',
|
||||
'fa fa-paint-brush' => 'paint-brush',
|
||||
'fa fa-paper-plane' => 'paper-plane',
|
||||
'fa fa-paper-plane-o' => 'paper-plane-o',
|
||||
'fa fa-paperclip' => 'paperclip',
|
||||
'fa fa-paragraph' => 'paragraph',
|
||||
'fa fa-paste' => 'paste',
|
||||
'fa fa-pause' => 'pause',
|
||||
'fa fa-pause-circle' => 'pause-circle',
|
||||
'fa fa-pause-circle-o' => 'pause-circle-o',
|
||||
'fa fa-paw' => 'paw',
|
||||
'fa fa-paypal' => 'paypal',
|
||||
'fa fa-pencil' => 'pencil',
|
||||
'fa fa-pencil-square' => 'pencil-square',
|
||||
'fa fa-pencil-square-o' => 'pencil-square-o',
|
||||
'fa fa-percent' => 'percent',
|
||||
'fa fa-phone' => 'phone',
|
||||
'fa fa-phone-square' => 'phone-square',
|
||||
'fa fa-photo' => 'photo',
|
||||
'fa fa-picture-o' => 'picture-o',
|
||||
'fa fa-pie-chart' => 'pie-chart',
|
||||
'fa fa-pied-piper' => 'pied-piper',
|
||||
'fa fa-pied-piper-alt' => 'pied-piper-alt',
|
||||
'fa fa-pied-piper-pp' => 'pied-piper-pp',
|
||||
'fa fa-pinterest' => 'pinterest',
|
||||
'fa fa-pinterest-p' => 'pinterest-p',
|
||||
'fa fa-pinterest-square' => 'pinterest-square',
|
||||
'fa fa-plane' => 'plane',
|
||||
'fa fa-play' => 'play',
|
||||
'fa fa-play-circle' => 'play-circle',
|
||||
'fa fa-play-circle-o' => 'play-circle-o',
|
||||
'fa fa-plug' => 'plug',
|
||||
'fa fa-plus' => 'plus',
|
||||
'fa fa-plus-circle' => 'plus-circle',
|
||||
'fa fa-plus-square' => 'plus-square',
|
||||
'fa fa-plus-square-o' => 'plus-square-o',
|
||||
'fa fa-podcast' => 'podcast',
|
||||
'fa fa-power-off' => 'power-off',
|
||||
'fa fa-print' => 'print',
|
||||
'fa fa-product-hunt' => 'product-hunt',
|
||||
'fa fa-pull-left' => 'pull-left',
|
||||
'fa fa-pull-right' => 'pull-right',
|
||||
'fa fa-puzzle-piece' => 'puzzle-piece',
|
||||
'fa fa-qq' => 'qq',
|
||||
'fa fa-qrcode' => 'qrcode',
|
||||
'fa fa-question' => 'question',
|
||||
'fa fa-question-circle' => 'question-circle',
|
||||
'fa fa-question-circle-o' => 'question-circle-o',
|
||||
'fa fa-quora' => 'quora',
|
||||
'fa fa-quote-left' => 'quote-left',
|
||||
'fa fa-quote-right' => 'quote-right',
|
||||
'fa fa-ra' => 'ra',
|
||||
'fa fa-random' => 'random',
|
||||
'fa fa-ravelry' => 'ravelry',
|
||||
'fa fa-rebel' => 'rebel',
|
||||
'fa fa-recycle' => 'recycle',
|
||||
'fa fa-reddit' => 'reddit',
|
||||
'fa fa-reddit-alien' => 'reddit-alien',
|
||||
'fa fa-reddit-square' => 'reddit-square',
|
||||
'fa fa-refresh' => 'refresh',
|
||||
'fa fa-registered' => 'registered',
|
||||
'fa fa-remove' => 'remove',
|
||||
'fa fa-renren' => 'renren',
|
||||
'fa fa-reorder' => 'reorder',
|
||||
'fa fa-repeat' => 'repeat',
|
||||
'fa fa-reply' => 'reply',
|
||||
'fa fa-reply-all' => 'reply-all',
|
||||
'fa fa-resistance' => 'resistance',
|
||||
'fa fa-retweet' => 'retweet',
|
||||
'fa fa-rmb' => 'rmb',
|
||||
'fa fa-road' => 'road',
|
||||
'fa fa-rocket' => 'rocket',
|
||||
'fa fa-rotate-left' => 'rotate-left',
|
||||
'fa fa-rotate-right' => 'rotate-right',
|
||||
'fa fa-rouble' => 'rouble',
|
||||
'fa fa-rss' => 'rss',
|
||||
'fa fa-rss-square' => 'rss-square',
|
||||
'fa fa-rub' => 'rub',
|
||||
'fa fa-ruble' => 'ruble',
|
||||
'fa fa-rupee' => 'rupee',
|
||||
'fa fa-s15' => 's15',
|
||||
'fa fa-safari' => 'safari',
|
||||
'fa fa-save' => 'save',
|
||||
'fa fa-scissors' => 'scissors',
|
||||
'fa fa-scribd' => 'scribd',
|
||||
'fa fa-search' => 'search',
|
||||
'fa fa-search-minus' => 'search-minus',
|
||||
'fa fa-search-plus' => 'search-plus',
|
||||
'fa fa-sellsy' => 'sellsy',
|
||||
'fa fa-send' => 'send',
|
||||
'fa fa-send-o' => 'send-o',
|
||||
'fa fa-server' => 'server',
|
||||
'fa fa-share' => 'share',
|
||||
'fa fa-share-alt' => 'share-alt',
|
||||
'fa fa-share-alt-square' => 'share-alt-square',
|
||||
'fa fa-share-square' => 'share-square',
|
||||
'fa fa-share-square-o' => 'share-square-o',
|
||||
'fa fa-shekel' => 'shekel',
|
||||
'fa fa-sheqel' => 'sheqel',
|
||||
'fa fa-shield' => 'shield',
|
||||
'fa fa-ship' => 'ship',
|
||||
'fa fa-shirtsinbulk' => 'shirtsinbulk',
|
||||
'fa fa-shopping-bag' => 'shopping-bag',
|
||||
'fa fa-shopping-basket' => 'shopping-basket',
|
||||
'fa fa-shopping-cart' => 'shopping-cart',
|
||||
'fa fa-shower' => 'shower',
|
||||
'fa fa-sign-in' => 'sign-in',
|
||||
'fa fa-sign-language' => 'sign-language',
|
||||
'fa fa-sign-out' => 'sign-out',
|
||||
'fa fa-signal' => 'signal',
|
||||
'fa fa-signing' => 'signing',
|
||||
'fa fa-simplybuilt' => 'simplybuilt',
|
||||
'fa fa-sitemap' => 'sitemap',
|
||||
'fa fa-skyatlas' => 'skyatlas',
|
||||
'fa fa-skype' => 'skype',
|
||||
'fa fa-slack' => 'slack',
|
||||
'fa fa-sliders' => 'sliders',
|
||||
'fa fa-slideshare' => 'slideshare',
|
||||
'fa fa-smile-o' => 'smile-o',
|
||||
'fa fa-snapchat' => 'snapchat',
|
||||
'fa fa-snapchat-ghost' => 'snapchat-ghost',
|
||||
'fa fa-snapchat-square' => 'snapchat-square',
|
||||
'fa fa-snowflake-o' => 'snowflake-o',
|
||||
'fa fa-soccer-ball-o' => 'soccer-ball-o',
|
||||
'fa fa-sort' => 'sort',
|
||||
'fa fa-sort-alpha-asc' => 'sort-alpha-asc',
|
||||
'fa fa-sort-alpha-desc' => 'sort-alpha-desc',
|
||||
'fa fa-sort-amount-asc' => 'sort-amount-asc',
|
||||
'fa fa-sort-amount-desc' => 'sort-amount-desc',
|
||||
'fa fa-sort-asc' => 'sort-asc',
|
||||
'fa fa-sort-desc' => 'sort-desc',
|
||||
'fa fa-sort-down' => 'sort-down',
|
||||
'fa fa-sort-numeric-asc' => 'sort-numeric-asc',
|
||||
'fa fa-sort-numeric-desc' => 'sort-numeric-desc',
|
||||
'fa fa-sort-up' => 'sort-up',
|
||||
'fa fa-soundcloud' => 'soundcloud',
|
||||
'fa fa-space-shuttle' => 'space-shuttle',
|
||||
'fa fa-spinner' => 'spinner',
|
||||
'fa fa-spoon' => 'spoon',
|
||||
'fa fa-spotify' => 'spotify',
|
||||
'fa fa-square' => 'square',
|
||||
'fa fa-square-o' => 'square-o',
|
||||
'fa fa-stack-exchange' => 'stack-exchange',
|
||||
'fa fa-stack-overflow' => 'stack-overflow',
|
||||
'fa fa-star' => 'star',
|
||||
'fa fa-star-half' => 'star-half',
|
||||
'fa fa-star-half-empty' => 'star-half-empty',
|
||||
'fa fa-star-half-full' => 'star-half-full',
|
||||
'fa fa-star-half-o' => 'star-half-o',
|
||||
'fa fa-star-o' => 'star-o',
|
||||
'fa fa-steam' => 'steam',
|
||||
'fa fa-steam-square' => 'steam-square',
|
||||
'fa fa-step-backward' => 'step-backward',
|
||||
'fa fa-step-forward' => 'step-forward',
|
||||
'fa fa-stethoscope' => 'stethoscope',
|
||||
'fa fa-sticky-note' => 'sticky-note',
|
||||
'fa fa-sticky-note-o' => 'sticky-note-o',
|
||||
'fa fa-stop' => 'stop',
|
||||
'fa fa-stop-circle' => 'stop-circle',
|
||||
'fa fa-stop-circle-o' => 'stop-circle-o',
|
||||
'fa fa-street-view' => 'street-view',
|
||||
'fa fa-strikethrough' => 'strikethrough',
|
||||
'fa fa-stumbleupon' => 'stumbleupon',
|
||||
'fa fa-stumbleupon-circle' => 'stumbleupon-circle',
|
||||
'fa fa-subscript' => 'subscript',
|
||||
'fa fa-subway' => 'subway',
|
||||
'fa fa-suitcase' => 'suitcase',
|
||||
'fa fa-sun-o' => 'sun-o',
|
||||
'fa fa-superpowers' => 'superpowers',
|
||||
'fa fa-superscript' => 'superscript',
|
||||
'fa fa-support' => 'support',
|
||||
'fa fa-table' => 'table',
|
||||
'fa fa-tablet' => 'tablet',
|
||||
'fa fa-tachometer' => 'tachometer',
|
||||
'fa fa-tag' => 'tag',
|
||||
'fa fa-tags' => 'tags',
|
||||
'fa fa-tasks' => 'tasks',
|
||||
'fa fa-taxi' => 'taxi',
|
||||
'fa fa-telegram' => 'telegram',
|
||||
'fa fa-television' => 'television',
|
||||
'fa fa-tencent-weibo' => 'tencent-weibo',
|
||||
'fa fa-terminal' => 'terminal',
|
||||
'fa fa-text-height' => 'text-height',
|
||||
'fa fa-text-width' => 'text-width',
|
||||
'fa fa-th' => 'th',
|
||||
'fa fa-th-large' => 'th-large',
|
||||
'fa fa-th-list' => 'th-list',
|
||||
'fa fa-themeisle' => 'themeisle',
|
||||
'fa fa-thermometer' => 'thermometer',
|
||||
'fa fa-thermometer-0' => 'thermometer-0',
|
||||
'fa fa-thermometer-1' => 'thermometer-1',
|
||||
'fa fa-thermometer-2' => 'thermometer-2',
|
||||
'fa fa-thermometer-3' => 'thermometer-3',
|
||||
'fa fa-thermometer-4' => 'thermometer-4',
|
||||
'fa fa-thermometer-empty' => 'thermometer-empty',
|
||||
'fa fa-thermometer-full' => 'thermometer-full',
|
||||
'fa fa-thermometer-half' => 'thermometer-half',
|
||||
'fa fa-thermometer-quarter' => 'thermometer-quarter',
|
||||
'fa fa-thermometer-three-quarters' => 'thermometer-three-quarters',
|
||||
'fa fa-thumb-tack' => 'thumb-tack',
|
||||
'fa fa-thumbs-down' => 'thumbs-down',
|
||||
'fa fa-thumbs-o-down' => 'thumbs-o-down',
|
||||
'fa fa-thumbs-o-up' => 'thumbs-o-up',
|
||||
'fa fa-thumbs-up' => 'thumbs-up',
|
||||
'fa fa-ticket' => 'ticket',
|
||||
'fa fa-times' => 'times',
|
||||
'fa fa-times-circle' => 'times-circle',
|
||||
'fa fa-times-circle-o' => 'times-circle-o',
|
||||
'fa fa-times-rectangle' => 'times-rectangle',
|
||||
'fa fa-times-rectangle-o' => 'times-rectangle-o',
|
||||
'fa fa-tint' => 'tint',
|
||||
'fa fa-toggle-down' => 'toggle-down',
|
||||
'fa fa-toggle-left' => 'toggle-left',
|
||||
'fa fa-toggle-off' => 'toggle-off',
|
||||
'fa fa-toggle-on' => 'toggle-on',
|
||||
'fa fa-toggle-right' => 'toggle-right',
|
||||
'fa fa-toggle-up' => 'toggle-up',
|
||||
'fa fa-trademark' => 'trademark',
|
||||
'fa fa-train' => 'train',
|
||||
'fa fa-transgender' => 'transgender',
|
||||
'fa fa-transgender-alt' => 'transgender-alt',
|
||||
'fa fa-trash' => 'trash',
|
||||
'fa fa-trash-o' => 'trash-o',
|
||||
'fa fa-tree' => 'tree',
|
||||
'fa fa-trello' => 'trello',
|
||||
'fa fa-tripadvisor' => 'tripadvisor',
|
||||
'fa fa-trophy' => 'trophy',
|
||||
'fa fa-truck' => 'truck',
|
||||
'fa fa-try' => 'try',
|
||||
'fa fa-tty' => 'tty',
|
||||
'fa fa-tumblr' => 'tumblr',
|
||||
'fa fa-tumblr-square' => 'tumblr-square',
|
||||
'fa fa-turkish-lira' => 'turkish-lira',
|
||||
'fa fa-tv' => 'tv',
|
||||
'fa fa-twitch' => 'twitch',
|
||||
'fa fa-twitter' => 'twitter',
|
||||
'fa fa-twitter-square' => 'twitter-square',
|
||||
'fa fa-umbrella' => 'umbrella',
|
||||
'fa fa-underline' => 'underline',
|
||||
'fa fa-undo' => 'undo',
|
||||
'fa fa-universal-access' => 'universal-access',
|
||||
'fa fa-university' => 'university',
|
||||
'fa fa-unlink' => 'unlink',
|
||||
'fa fa-unlock' => 'unlock',
|
||||
'fa fa-unlock-alt' => 'unlock-alt',
|
||||
'fa fa-unsorted' => 'unsorted',
|
||||
'fa fa-upload' => 'upload',
|
||||
'fa fa-usb' => 'usb',
|
||||
'fa fa-usd' => 'usd',
|
||||
'fa fa-user' => 'user',
|
||||
'fa fa-user-circle' => 'user-circle',
|
||||
'fa fa-user-circle-o' => 'user-circle-o',
|
||||
'fa fa-user-md' => 'user-md',
|
||||
'fa fa-user-o' => 'user-o',
|
||||
'fa fa-user-plus' => 'user-plus',
|
||||
'fa fa-user-secret' => 'user-secret',
|
||||
'fa fa-user-times' => 'user-times',
|
||||
'fa fa-users' => 'users',
|
||||
'fa fa-vcard' => 'vcard',
|
||||
'fa fa-vcard-o' => 'vcard-o',
|
||||
'fa fa-venus' => 'venus',
|
||||
'fa fa-venus-double' => 'venus-double',
|
||||
'fa fa-venus-mars' => 'venus-mars',
|
||||
'fa fa-viacoin' => 'viacoin',
|
||||
'fa fa-viadeo' => 'viadeo',
|
||||
'fa fa-viadeo-square' => 'viadeo-square',
|
||||
'fa fa-video-camera' => 'video-camera',
|
||||
'fa fa-vimeo' => 'vimeo',
|
||||
'fa fa-vimeo-square' => 'vimeo-square',
|
||||
'fa fa-vine' => 'vine',
|
||||
'fa fa-vk' => 'vk',
|
||||
'fa fa-volume-control-phone' => 'volume-control-phone',
|
||||
'fa fa-volume-down' => 'volume-down',
|
||||
'fa fa-volume-off' => 'volume-off',
|
||||
'fa fa-volume-up' => 'volume-up',
|
||||
'fa fa-warning' => 'warning',
|
||||
'fa fa-wechat' => 'wechat',
|
||||
'fa fa-weibo' => 'weibo',
|
||||
'fa fa-weixin' => 'weixin',
|
||||
'fa fa-whatsapp' => 'whatsapp',
|
||||
'fa fa-wheelchair' => 'wheelchair',
|
||||
'fa fa-wheelchair-alt' => 'wheelchair-alt',
|
||||
'fa fa-wifi' => 'wifi',
|
||||
'fa fa-wikipedia-w' => 'wikipedia-w',
|
||||
'fa fa-window-close' => 'window-close',
|
||||
'fa fa-window-close-o' => 'window-close-o',
|
||||
'fa fa-window-maximize' => 'window-maximize',
|
||||
'fa fa-window-minimize' => 'window-minimize',
|
||||
'fa fa-window-restore' => 'window-restore',
|
||||
'fa fa-windows' => 'windows',
|
||||
'fa fa-won' => 'won',
|
||||
'fa fa-wordpress' => 'wordpress',
|
||||
'fa fa-wpbeginner' => 'wpbeginner',
|
||||
'fa fa-wpexplorer' => 'wpexplorer',
|
||||
'fa fa-wpforms' => 'wpforms',
|
||||
'fa fa-wrench' => 'wrench',
|
||||
'fa fa-xing' => 'xing',
|
||||
'fa fa-xing-square' => 'xing-square',
|
||||
'fa fa-y-combinator' => 'y-combinator',
|
||||
'fa fa-y-combinator-square' => 'y-combinator-square',
|
||||
'fa fa-yahoo' => 'yahoo',
|
||||
'fa fa-yc' => 'yc',
|
||||
'fa fa-yc-square' => 'yc-square',
|
||||
'fa fa-yelp' => 'yelp',
|
||||
'fa fa-yen' => 'yen',
|
||||
'fa fa-yoast' => 'yoast',
|
||||
'fa fa-youtube' => 'youtube',
|
||||
'fa fa-youtube-play' => 'youtube-play',
|
||||
'fa fa-youtube-square' => 'youtube-square',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icons control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the icons control. Used to return the default
|
||||
* settings while initializing the icons control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @deprecated 2.6.0 Use `Control_Icons` class instead.
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'options' => self::get_icons(),
|
||||
'include' => '',
|
||||
'exclude' => '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render icons control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @deprecated 2.6.0 Use `Control_Icons` class instead.
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<select id="<?php $this->print_control_uid(); ?>" class="elementor-control-icon" data-setting="{{ data.name }}" data-placeholder="<?php echo esc_attr__( 'Select Icon', 'elementor' ); ?>">
|
||||
<option value=""><?php echo esc_html__( 'Select Icon', 'elementor' ); ?></option>
|
||||
<# _.each( data.options, function( option_title, option_value ) { #>
|
||||
<option value="{{ option_value }}">{{{ option_title }}}</option>
|
||||
<# } ); #>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{ data.description }}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
240
wp-content/plugins/elementor/includes/controls/icons.php
Normal file
240
wp-content/plugins/elementor/includes/controls/icons.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor Icons control.
|
||||
*
|
||||
* A base control for creating a Icons chooser control.
|
||||
* Used to select an Icon.
|
||||
*
|
||||
* Usage: @see https://developers.elementor.com/elementor-controls/icons-control
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
class Control_Icons extends Control_Base_Multiple {
|
||||
|
||||
/**
|
||||
* Get media control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `media`.
|
||||
*
|
||||
* @access public
|
||||
* @since 2.6.0
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'icons';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Icons control default values.
|
||||
*
|
||||
* Retrieve the default value of the Icons control. Used to return the default
|
||||
* values while initializing the Icons control.
|
||||
*
|
||||
* @access public
|
||||
* @since 2.6.0
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [
|
||||
'value' => '',
|
||||
'library' => '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Icons control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<# if ( 'inline' === data.skin ) { #>
|
||||
<?php $this->render_inline_skin(); ?>
|
||||
<# } else { #>
|
||||
<?php $this->render_media_skin(); ?>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render_media_skin() {
|
||||
?>
|
||||
<div class="elementor-control-field elementor-control-media">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<div class="elementor-control-media__content elementor-control-tag-area elementor-control-preview-area">
|
||||
<div class="elementor-control-media-upload-button elementor-control-media__content__upload-button">
|
||||
<i class="eicon-plus-circle" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Add', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="elementor-control-media-area">
|
||||
<div class="elementor-control-media__remove elementor-control-media__content__remove" title="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>">
|
||||
<i class="eicon-trash-o" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="elementor-control-media__preview"></div>
|
||||
</div>
|
||||
<div class="elementor-control-media__tools elementor-control-dynamic-switcher-wrapper">
|
||||
<div class="elementor-control-icon-picker elementor-control-media__tool"><?php echo esc_html__( 'Icon Library', 'elementor' ); ?></div>
|
||||
<div class="elementor-control-svg-uploader elementor-control-media__tool"><?php echo esc_html__( 'Upload SVG', 'elementor' ); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<input type="hidden" data-setting="{{ data.name }}"/>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function render_inline_skin() {
|
||||
?>
|
||||
<#
|
||||
const defaultSkinSettings = {
|
||||
none: {
|
||||
label: '<?php echo esc_html__( 'None', 'elementor' ); ?>',
|
||||
icon: 'eicon-ban',
|
||||
},
|
||||
svg: {
|
||||
label: '<?php echo esc_html__( 'Upload SVG', 'elementor' ); ?>',
|
||||
icon: 'eicon-upload',
|
||||
},
|
||||
icon: {
|
||||
label: '<?php echo esc_html__( 'Icon Library', 'elementor' ); ?>',
|
||||
icon: 'eicon-circle',
|
||||
}
|
||||
};
|
||||
|
||||
const skinSettings = data.skin_settings.inline;
|
||||
|
||||
const get = ( type, key ) => {
|
||||
if ( skinSettings[ type ] ) {
|
||||
return skinSettings[ type ]?.[ key ] || defaultSkinSettings[ type ][ key ];
|
||||
}
|
||||
|
||||
return defaultSkinSettings[ type ][ key ];
|
||||
}
|
||||
#>
|
||||
<div class="elementor-control-field elementor-control-inline-icon">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<div class="elementor-choices">
|
||||
<# if ( ! data.exclude_inline_options.includes( 'none' ) ) { #>
|
||||
<input id="<?php $this->print_control_uid(); ?>-none" type="radio" value="none">
|
||||
<label class="elementor-choices-label elementor-control-unit-1 tooltip-target elementor-control-icons--inline__none" for="<?php $this->print_control_uid(); ?>-none" data-tooltip="{{ get( 'none', 'label' ) }}" title="{{ get( 'none', 'label' ) }}">
|
||||
<i class="{{ get( 'none', 'icon' ) }}" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only">{{ get( 'none', 'label' ) }}</span>
|
||||
</label>
|
||||
<# }
|
||||
if ( ! data.exclude_inline_options.includes( 'svg' ) ) { #>
|
||||
<input id="<?php $this->print_control_uid(); ?>-svg" type="radio" value="svg">
|
||||
<label class="elementor-choices-label elementor-control-unit-1 tooltip-target elementor-control-icons--inline__svg" for="<?php $this->print_control_uid(); ?>-svg" data-tooltip="{{ get( 'svg', 'label' ) }}" title="{{ get( 'svg', 'label' ) }}">
|
||||
<i class="{{ get( 'svg', 'icon' ) }}" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only">{{ get( 'svg', 'label' ) }}</span>
|
||||
</label>
|
||||
<# }
|
||||
if ( ! data.exclude_inline_options.includes( 'icon' ) ) { #>
|
||||
<input id="<?php $this->print_control_uid(); ?>-icon" type="radio" value="icon">
|
||||
<label class="elementor-choices-label elementor-control-unit-1 tooltip-target elementor-control-icons--inline__icon" for="<?php $this->print_control_uid(); ?>-icon" data-tooltip="{{ get( 'icon', 'label' ) }}" title="{{ get( 'icon', 'label' ) }}">
|
||||
<span class="elementor-control-icons--inline__displayed-icon">
|
||||
<i class="{{ get( 'icon', 'icon' ) }}" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="elementor-screen-only">{{ get( 'icon', 'label' ) }}</span>
|
||||
</label>
|
||||
<# } #>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Icons control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the Icons control. Used to return the default
|
||||
* settings while initializing the Icons control.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'dynamic' => [
|
||||
'categories' => [ TagsModule::IMAGE_CATEGORY ],
|
||||
'returnType' => 'object',
|
||||
],
|
||||
'search_bar' => true,
|
||||
'recommended' => false,
|
||||
'skin' => 'media',
|
||||
'exclude_inline_options' => [],
|
||||
'disable_initial_active_state' => false,
|
||||
'skin_settings' => [
|
||||
'inline' => [
|
||||
'none' => [
|
||||
'label' => esc_html__( 'None', 'elementor' ),
|
||||
'icon' => 'eicon-ban',
|
||||
],
|
||||
'svg' => [
|
||||
'label' => esc_html__( 'Upload SVG', 'elementor' ),
|
||||
'icon' => 'eicon-upload',
|
||||
],
|
||||
'icon' => [
|
||||
'label' => esc_html__( 'Icon Library', 'elementor' ),
|
||||
'icon' => 'eicon-circle',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Support SVG Import
|
||||
*
|
||||
* @deprecated 3.5.0
|
||||
*
|
||||
* @param $mimes
|
||||
* @return mixed
|
||||
*/
|
||||
public function support_svg_import( $mimes ) {
|
||||
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
|
||||
|
||||
$mimes['svg'] = 'image/svg+xml';
|
||||
return $mimes;
|
||||
}
|
||||
|
||||
public function on_import( $settings ) {
|
||||
if ( empty( $settings['library'] ) || 'svg' !== $settings['library'] || empty( $settings['value']['url'] ) ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
$imported = Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings['value'] );
|
||||
|
||||
if ( ! $imported ) {
|
||||
$settings['value'] = '';
|
||||
$settings['library'] = '';
|
||||
} else {
|
||||
$settings['value'] = $imported;
|
||||
}
|
||||
return $settings;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor image dimensions control.
|
||||
*
|
||||
* A base control for creating image dimension control. Displays image width
|
||||
* input, image height input and an apply button.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Image_Dimensions extends Control_Base_Multiple {
|
||||
|
||||
/**
|
||||
* Get image dimensions control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `image_dimensions`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'image_dimensions';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image dimensions control default values.
|
||||
*
|
||||
* Retrieve the default value of the image dimensions control. Used to return the
|
||||
* default values while initializing the image dimensions control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [
|
||||
'width' => '',
|
||||
'height' => '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image dimensions control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the image dimensions control. Used to return
|
||||
* the default settings while initializing the image dimensions control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'show_label' => false,
|
||||
'label_block' => true,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render image dimensions control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
if ( ! $this->is_image_editor_supports() ) : ?>
|
||||
<div class="elementor-panel-alert elementor-panel-alert-danger">
|
||||
<?php echo esc_html__( 'The server does not have ImageMagick or GD installed and/or enabled! Any of these libraries are required for WordPress to be able to resize images. Please contact your server administrator to enable this before continuing.', 'elementor' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
return;
|
||||
endif;
|
||||
?>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<div class="elementor-control-field">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<div class="elementor-image-dimensions-field elementor-control-unit-2">
|
||||
<input id="<?php $this->print_control_uid( 'width' ); ?>" type="number" data-setting="width" />
|
||||
<label for="<?php $this->print_control_uid( 'width' ); ?>" class="elementor-image-dimensions-field-description"><?php echo esc_html__( 'Width', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<div class="elementor-image-dimensions-separator">x</div>
|
||||
<div class="elementor-image-dimensions-field elementor-control-unit-2">
|
||||
<input id="<?php $this->print_control_uid( 'height' ); ?>" type="number" data-setting="height" />
|
||||
<label for="<?php $this->print_control_uid( 'height' ); ?>" class="elementor-image-dimensions-field-description"><?php echo esc_html__( 'Height', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<button class="elementor-button elementor-image-dimensions-apply-button"><?php echo esc_html__( 'Apply', 'elementor' ); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Image editor support.
|
||||
*
|
||||
* Used to determine whether the editor supports a given image mime-type.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
*
|
||||
* @return bool Whether the editor supports the given mime-type.
|
||||
*/
|
||||
private function is_image_editor_supports() {
|
||||
$arg = [
|
||||
'mime_type' => 'image/jpeg',
|
||||
];
|
||||
return ( wp_image_editor_supports( $arg ) );
|
||||
}
|
||||
}
|
||||
454
wp-content/plugins/elementor/includes/controls/media.php
Normal file
454
wp-content/plugins/elementor/includes/controls/media.php
Normal file
@@ -0,0 +1,454 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Files\Uploads_Manager;
|
||||
use Elementor\Core\Utils\Hints;
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor media control.
|
||||
*
|
||||
* A base control for creating a media chooser control. Based on the WordPress
|
||||
* media library. Used to select an image from the WordPress media library.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Media extends Control_Base_Multiple {
|
||||
|
||||
/**
|
||||
* Get media control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `media`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'media';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get media control default values.
|
||||
*
|
||||
* Retrieve the default value of the media control. Used to return the default
|
||||
* values while initializing the media control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [
|
||||
'url' => '',
|
||||
'id' => '',
|
||||
'size' => '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Import media images.
|
||||
*
|
||||
* Used to import media control files from external sites while importing
|
||||
* Elementor template JSON file, and replacing the old data.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $settings Control settings
|
||||
*
|
||||
* @return array Control settings.
|
||||
*/
|
||||
public function on_import( $settings ) {
|
||||
if ( empty( $settings['url'] ) ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
$settings = Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings );
|
||||
|
||||
if ( ! $settings ) {
|
||||
$settings = [
|
||||
'id' => '',
|
||||
'url' => Utils::get_placeholder_image_src(),
|
||||
];
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Support SVG and JSON Import
|
||||
*
|
||||
* Called by the 'upload_mimes' filter. Adds SVG and JSON mime types to the list of WordPress' allowed mime types.
|
||||
*
|
||||
* @since 3.4.6
|
||||
* @deprecated 3.5.0
|
||||
*
|
||||
* @param $mimes
|
||||
* @return mixed
|
||||
*/
|
||||
public function support_svg_and_json_import( $mimes ) {
|
||||
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
|
||||
|
||||
return $mimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue media control scripts and styles.
|
||||
*
|
||||
* Used to register and enqueue custom scripts and styles used by the media
|
||||
* control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {
|
||||
global $wp_version;
|
||||
|
||||
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
||||
wp_enqueue_media();
|
||||
|
||||
wp_enqueue_style(
|
||||
'media',
|
||||
admin_url( '/css/media' . $suffix . '.css' ),
|
||||
[],
|
||||
$wp_version
|
||||
);
|
||||
|
||||
wp_register_script(
|
||||
'image-edit',
|
||||
'/wp-admin/js/image-edit' . $suffix . '.js',
|
||||
[
|
||||
'jquery',
|
||||
'json2',
|
||||
'imgareaselect',
|
||||
],
|
||||
$wp_version,
|
||||
true
|
||||
);
|
||||
|
||||
wp_enqueue_script( 'image-edit' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render media control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<#
|
||||
// For BC.
|
||||
if ( data.media_type ) {
|
||||
data.media_types = [ data.media_type ];
|
||||
}
|
||||
|
||||
if ( data.should_include_svg_inline_option ) {
|
||||
data.media_types.push( 'svg' );
|
||||
}
|
||||
|
||||
// Determine if the current media type is viewable.
|
||||
const isViewable = () => {
|
||||
const viewable = [
|
||||
'image',
|
||||
'video',
|
||||
'svg',
|
||||
];
|
||||
|
||||
// Make sure that all media types are viewable.
|
||||
return data.media_types.every( ( type ) => viewable.includes( type ) );
|
||||
};
|
||||
|
||||
// Get the preview type for the current media type.
|
||||
const getPreviewType = () => {
|
||||
if ( data.media_types.includes( 'video' ) ) {
|
||||
return 'video';
|
||||
}
|
||||
|
||||
if ( data.media_types.includes( 'image' ) || data.media_types.includes( 'svg' ) ) {
|
||||
return 'image';
|
||||
}
|
||||
|
||||
return 'none';
|
||||
}
|
||||
|
||||
// Retrieve a button label by media type.
|
||||
const getButtonLabel = ( mediaType ) => {
|
||||
switch( mediaType ) {
|
||||
case 'image':
|
||||
return '<?php esc_html_e( 'Choose Image', 'elementor' ); ?>';
|
||||
|
||||
case 'video':
|
||||
return '<?php esc_html_e( 'Choose Video', 'elementor' ); ?>';
|
||||
|
||||
case 'svg':
|
||||
return '<?php esc_html_e( 'Choose SVG', 'elementor' ); ?>';
|
||||
|
||||
default:
|
||||
return '<?php esc_html_e( 'Choose File', 'elementor' ); ?>';
|
||||
}
|
||||
}
|
||||
#>
|
||||
<div class="elementor-control-field elementor-control-media">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<#
|
||||
if ( isViewable() ) {
|
||||
let inputWrapperClasses = 'elementor-control-input-wrapper';
|
||||
|
||||
if ( ! data.label_block ) {
|
||||
inputWrapperClasses += ' elementor-control-unit-5';
|
||||
}
|
||||
#>
|
||||
<div class="{{{ inputWrapperClasses }}}">
|
||||
<div class="elementor-control-media__content elementor-control-tag-area elementor-control-preview-area">
|
||||
<div class="elementor-control-media-area">
|
||||
<div class="elementor-control-media__remove elementor-control-media__content__remove" title="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>">
|
||||
<i class="eicon-trash-o" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<#
|
||||
switch( getPreviewType() ) {
|
||||
case 'image':
|
||||
#>
|
||||
<div class="elementor-control-media__preview"></div>
|
||||
<#
|
||||
break;
|
||||
|
||||
case 'video':
|
||||
#>
|
||||
<video class="elementor-control-media-video" preload="metadata"></video>
|
||||
<i class="eicon-video-camera" aria-hidden="true"></i>
|
||||
<#
|
||||
break;
|
||||
}
|
||||
#>
|
||||
</div>
|
||||
<div class="elementor-control-media-upload-button elementor-control-media__content__upload-button">
|
||||
<i class="eicon-plus-circle" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Add', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="elementor-control-media__tools elementor-control-dynamic-switcher-wrapper">
|
||||
<#
|
||||
data.media_types.forEach( ( type ) => {
|
||||
#>
|
||||
<div class="elementor-control-media__tool elementor-control-media__replace" data-media-type="{{{ type }}}">{{{ getButtonLabel( type ) }}}</div>
|
||||
<#
|
||||
} );
|
||||
#>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php /* ?>
|
||||
<div class="elementor-control-media__warnings" role="alert" style="display: none;">
|
||||
<?php
|
||||
Hints::get_notice_template( [
|
||||
'type' => 'warning',
|
||||
'content' => esc_html__( 'This image doesn’t contain ALT text - which is necessary for accessibility and SEO.', 'elementor' ),
|
||||
'icon' => true,
|
||||
] );
|
||||
?>
|
||||
</div>
|
||||
<?php */ ?>
|
||||
|
||||
<?php if ( Hints::should_display_hint( 'image-optimization' ) ) : ?>
|
||||
<div class="elementor-control-media__promotions" role="alert" style="display: none;">
|
||||
<?php
|
||||
Hints::get_notice_template( [
|
||||
'display' => ! Hints::is_dismissed( 'image-optimization' ),
|
||||
'type' => 'info',
|
||||
'content' => __( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ),
|
||||
'icon' => true,
|
||||
'dismissible' => 'image_optimizer_hint',
|
||||
'button_text' => Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate Plugin', 'elementor' ) : __( 'Install Plugin', 'elementor' ),
|
||||
'button_event' => 'image_optimizer_hint',
|
||||
'button_data' => [
|
||||
'action_url' => Hints::get_plugin_action_url( 'image-optimization' ),
|
||||
],
|
||||
] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<# } /* endif isViewable() */ else { #>
|
||||
<div class="elementor-control-media__file elementor-control-preview-area">
|
||||
<div class="elementor-control-media__file__content">
|
||||
<div class="elementor-control-media__file__content__label"><?php echo esc_html__( 'Click the media icon to upload file', 'elementor' ); ?></div>
|
||||
<div class="elementor-control-media__file__content__info">
|
||||
<div class="elementor-control-media__file__content__info__icon">
|
||||
<i class="eicon-document-file"></i>
|
||||
</div>
|
||||
<div class="elementor-control-media__file__content__info__name"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="elementor-control-media__file__controls">
|
||||
<div class="elementor-control-media__remove elementor-control-media__file__controls__remove" title="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>">
|
||||
<i class="eicon-trash-o" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="elementor-control-media__file__controls__upload-button elementor-control-media-upload-button" title="<?php echo esc_attr__( 'Upload', 'elementor' ); ?>">
|
||||
<i class="eicon-upload" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Upload', 'elementor' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<# } #>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.has_sizes ) { #>
|
||||
<div class="elementor-control-type-select e-control-image-size">
|
||||
<div class="elementor-control-field">
|
||||
<label class="elementor-control-title" data-e-responsive-switcher-sibling="false" for="<?php $this->print_control_uid( 'size' ); ?>"><?php echo esc_html__( 'Image Resolution', 'elementor' ); ?></label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-unit-5">
|
||||
<select class="e-image-size-select" id="<?php $this->print_control_uid( 'size' ); ?>" data-setting="size">
|
||||
<?php foreach ( $this->get_image_sizes() as $size_key => $size_title ) : ?>
|
||||
<option value="<?php echo esc_attr( $size_key ); ?>"><?php echo esc_html( $size_title ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<# } #>
|
||||
|
||||
<input type="hidden" data-setting="{{ data.name }}"/>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function get_image_sizes() : array {
|
||||
$wp_image_sizes = Group_Control_Image_Size::get_all_image_sizes();
|
||||
|
||||
$image_sizes = [];
|
||||
|
||||
foreach ( $wp_image_sizes as $size_key => $size_attributes ) {
|
||||
$control_title = ucwords( str_replace( '_', ' ', $size_key ) );
|
||||
if ( is_array( $size_attributes ) ) {
|
||||
$control_title .= sprintf( ' - %d x %d', $size_attributes['width'], $size_attributes['height'] );
|
||||
}
|
||||
|
||||
$image_sizes[ $size_key ] = $control_title;
|
||||
}
|
||||
|
||||
$image_sizes[''] = esc_html_x( 'Full', 'Image Size Control', 'elementor' );
|
||||
|
||||
return $image_sizes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get media control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the media control. Used to return the default
|
||||
* settings while initializing the media control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'has_sizes' => false,
|
||||
'ai' => [
|
||||
'active' => true,
|
||||
'type' => 'media',
|
||||
'category' => 'photographic',
|
||||
],
|
||||
'media_types' => [
|
||||
'image',
|
||||
],
|
||||
'dynamic' => [
|
||||
'categories' => [ TagsModule::IMAGE_CATEGORY ],
|
||||
'returnType' => 'object',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get media control image title.
|
||||
*
|
||||
* Retrieve the `title` of the image selected by the media control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param array $attachment Media attachment.
|
||||
*
|
||||
* @return string Image title.
|
||||
*/
|
||||
public static function get_image_title( $attachment ) {
|
||||
if ( empty( $attachment['id'] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return get_the_title( $attachment['id'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get media control image alt.
|
||||
*
|
||||
* Retrieve the `alt` value of the image selected by the media control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param array $instance Media attachment.
|
||||
*
|
||||
* @return string Image alt.
|
||||
*/
|
||||
public static function get_image_alt( $instance ) {
|
||||
if ( empty( $instance['id'] ) ) {
|
||||
// For `Insert From URL` images.
|
||||
return isset( $instance['alt'] ) ? trim( self::sanitise_text( $instance['alt'] ) ) : '';
|
||||
}
|
||||
|
||||
$attachment_id = $instance['id'];
|
||||
if ( ! $attachment_id ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$attachment = get_post( $attachment_id );
|
||||
if ( ! $attachment ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
|
||||
if ( ! $alt ) {
|
||||
$alt = $attachment->post_excerpt;
|
||||
if ( ! $alt ) {
|
||||
$alt = $attachment->post_title;
|
||||
}
|
||||
}
|
||||
return trim( self::sanitise_text( $alt ) );
|
||||
}
|
||||
|
||||
public function get_style_value( $css_property, $control_value, array $control_data ) {
|
||||
if ( 'URL' !== $css_property || empty( $control_value['id'] ) ) {
|
||||
return parent::get_style_value( $css_property, $control_value, $control_data );
|
||||
}
|
||||
|
||||
if ( empty( $control_value['size'] ) ) {
|
||||
$control_value['size'] = 'full';
|
||||
}
|
||||
|
||||
return wp_get_attachment_image_url( $control_value['id'], $control_value['size'] );
|
||||
}
|
||||
|
||||
public static function sanitise_text( $string ) {
|
||||
return esc_attr( strip_tags( $string ) );
|
||||
}
|
||||
}
|
||||
116
wp-content/plugins/elementor/includes/controls/notice.php
Normal file
116
wp-content/plugins/elementor/includes/controls/notice.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor Notice control.
|
||||
*
|
||||
* A base control specific for creating Notices in the Editor panels.
|
||||
*
|
||||
* @since 3.19.0
|
||||
*/
|
||||
class Control_Notice extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get notice control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `notice`.
|
||||
*
|
||||
* @since 3.19.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'notice';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render notice control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 3.19.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<#
|
||||
if ( ! data.shouldRenderNotice ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const validNoticeTypes = [ 'info', 'success', 'warning', 'danger' ];
|
||||
const showIcon = validNoticeTypes.includes( data.notice_type );
|
||||
data.content = elementor.compileTemplate( data.content, { view } );
|
||||
#>
|
||||
<div class="elementor-control-notice elementor-control-notice-type-{{ data.notice_type }}">
|
||||
<# if ( showIcon && data.icon ) { #>
|
||||
<div class="elementor-control-notice-icon">
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.25 9H3M9 2.25V3M15 9H15.75M4.2 4.2L4.725 4.725M13.8 4.2L13.275 4.725M7.27496 12.75H10.725M6.75 12C6.12035 11.5278 5.65525 10.8694 5.42057 10.1181C5.1859 9.36687 5.19355 8.56082 5.44244 7.81415C5.69133 7.06748 6.16884 6.41804 6.80734 5.95784C7.44583 5.49764 8.21294 5.25 9 5.25C9.78706 5.25 10.5542 5.49764 11.1927 5.95784C11.8312 6.41804 12.3087 7.06748 12.5576 7.81415C12.8065 8.56082 12.8141 9.36687 12.5794 10.1181C12.3448 10.8694 11.8796 11.5278 11.25 12C10.9572 12.2899 10.7367 12.6446 10.6064 13.0355C10.4761 13.4264 10.4397 13.8424 10.5 14.25C10.5 14.6478 10.342 15.0294 10.0607 15.3107C9.77936 15.592 9.39782 15.75 9 15.75C8.60218 15.75 8.22064 15.592 7.93934 15.3107C7.65804 15.0294 7.5 14.6478 7.5 14.25C7.56034 13.8424 7.52389 13.4264 7.3936 13.0355C7.2633 12.6446 7.04282 12.2899 6.75 12Z" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</div>
|
||||
<# } #>
|
||||
<div class="elementor-control-notice-main">
|
||||
<# if ( data.heading ) { #>
|
||||
<div class="elementor-control-notice-main-heading">{{{ data.heading }}}</div>
|
||||
<# } #>
|
||||
<# if ( data.content ) { #>
|
||||
<div class="elementor-control-notice-main-content">{{{ data.content }}}</div>
|
||||
<# } #>
|
||||
<# if ( data.button_text || data.button_text2 ) { #>
|
||||
<div class="elementor-control-notice-main-actions">
|
||||
<# if ( data.button_text || data.button_event ) { #>
|
||||
<button type="button" class="e-btn e-{{{ data.notice_type }}} e-btn-1" data-event="{{{ data.button_event }}}">
|
||||
{{{ data.button_text }}}
|
||||
</button>
|
||||
<# } #>
|
||||
<# if ( data.button_text2 || data.button_event2 ) { #>
|
||||
<button type="button" class="e-btn e-{{{ data.notice_type }}} e-btn-2" data-event="{{{ data.button_event2 }}}">
|
||||
{{{ data.button_text2 }}}
|
||||
</button>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# if ( data.dismissible ) { #>
|
||||
<button class="elementor-control-notice-dismiss tooltip-target" data-tooltip="<?php echo esc_attr__( 'Don’t show again.', 'elementor' ); ?>">
|
||||
<i class="eicon eicon-close" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Don’t show again.', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<# } #>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get notice control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the notice control. Used to return the
|
||||
* default settings while initializing the notice control.
|
||||
*
|
||||
* @since 3.19.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'notice_type' => '', // info, success, warning, danger
|
||||
'icon' => true,
|
||||
'dismissible' => false,
|
||||
'heading' => '',
|
||||
'content' => '',
|
||||
'button_text' => '',
|
||||
'button_event' => '',
|
||||
'button_text2' => '',
|
||||
'button_event2' => '',
|
||||
];
|
||||
}
|
||||
}
|
||||
80
wp-content/plugins/elementor/includes/controls/number.php
Normal file
80
wp-content/plugins/elementor/includes/controls/number.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor number control.
|
||||
*
|
||||
* A base control for creating a number control. Displays a simple number input.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Number extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get number control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `number`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'number';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the number control. Used to return the
|
||||
* default settings while initializing the number control.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'min' => '',
|
||||
'max' => '',
|
||||
'step' => '',
|
||||
'placeholder' => '',
|
||||
'title' => '',
|
||||
'dynamic' => [
|
||||
'categories' => [ TagsModule::NUMBER_CATEGORY ],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render number control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
|
||||
<input id="<?php $this->print_control_uid(); ?>" type="number" min="{{ data.min }}" max="{{ data.max }}" step="{{ data.step }}" class="tooltip-target elementor-control-tag-area elementor-control-unit-2" data-tooltip="{{ data.title }}" title="{{ data.title }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}" />
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor popover toggle control.
|
||||
*
|
||||
* A base control for creating a popover toggle control. By default displays a toggle
|
||||
* button to open and close a popover.
|
||||
*
|
||||
* @since 1.9.0
|
||||
*/
|
||||
class Control_Popover_Toggle extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get popover toggle control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `popover_toggle`.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'popover_toggle';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get popover toggle control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the popover toggle control. Used to
|
||||
* return the default settings while initializing the popover toggle
|
||||
* control.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'return_value' => 'yes',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render popover toggle control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<input id="<?php $this->print_control_uid(); ?>-custom" class="elementor-control-popover-toggle-toggle" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ data.return_value }}">
|
||||
<label class="elementor-control-popover-toggle-toggle-label elementor-control-unit-1" for="<?php $this->print_control_uid(); ?>-custom">
|
||||
<i class="eicon-edit" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Edit', 'elementor' ); ?></span>
|
||||
</label>
|
||||
<input id="<?php $this->print_control_uid(); ?>-default" class="elementor-control-popover-toggle-reset" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="">
|
||||
<label class="elementor-control-popover-toggle-reset-label tooltip-target" for="<?php $this->print_control_uid(); ?>-default" data-tooltip="<?php echo esc_attr__( 'Back to default', 'elementor' ); ?>" data-tooltip-pos="s">
|
||||
<i class="eicon-undo" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Back to default', 'elementor' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
69
wp-content/plugins/elementor/includes/controls/raw-html.php
Normal file
69
wp-content/plugins/elementor/includes/controls/raw-html.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor raw HTML control.
|
||||
*
|
||||
* A base control for creating raw HTML control. Displays HTML markup between
|
||||
* controls in the panel.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Raw_Html extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get raw html control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `raw_html`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'raw_html';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render raw html control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<# data.raw = elementor.compileTemplate( data.raw, { view } );
|
||||
if ( data.label ) { #>
|
||||
<span class="elementor-control-title">{{{ data.label }}}</span>
|
||||
<# } #>
|
||||
<div class="elementor-control-raw-html {{ data.content_classes }}">{{{ data.raw }}}</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get raw html control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the raw html control. Used to return the
|
||||
* default settings while initializing the raw html control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'raw' => '',
|
||||
'content_classes' => '',
|
||||
];
|
||||
}
|
||||
}
|
||||
201
wp-content/plugins/elementor/includes/controls/repeater.php
Normal file
201
wp-content/plugins/elementor/includes/controls/repeater.php
Normal file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor repeater control.
|
||||
*
|
||||
* A base control for creating repeater control. Repeater control allows you to
|
||||
* build repeatable blocks of fields. You can create, for example, a set of
|
||||
* fields that will contain a title and a WYSIWYG text - the user will then be
|
||||
* able to add "rows", and each row will contain a title and a text. The data
|
||||
* can be wrapper in custom HTML tags, designed using CSS, and interact using JS
|
||||
* or external libraries.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Repeater extends Base_Data_Control implements Has_Validation {
|
||||
|
||||
/**
|
||||
* Get repeater control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `repeater`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'repeater';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repeater control default value.
|
||||
*
|
||||
* Retrieve the default value of the data control. Used to return the default
|
||||
* values while initializing the repeater control.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repeater control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the repeater control. Used to return the
|
||||
* default settings while initializing the repeater control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'fields' => [],
|
||||
'title_field' => '',
|
||||
'prevent_empty' => true,
|
||||
'is_repeater' => true,
|
||||
'max_items' => 0,
|
||||
'min_items' => 0,
|
||||
'item_actions' => [
|
||||
'add' => true,
|
||||
'duplicate' => true,
|
||||
'remove' => true,
|
||||
'sort' => true,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repeater control value.
|
||||
*
|
||||
* Retrieve the value of the repeater control from a specific Controls_Stack.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $control Control
|
||||
* @param array $settings Controls_Stack settings
|
||||
*
|
||||
* @return mixed Control values.
|
||||
*/
|
||||
public function get_value( $control, $settings ) {
|
||||
$value = parent::get_value( $control, $settings );
|
||||
|
||||
if ( ! empty( $value ) ) {
|
||||
foreach ( $value as &$item ) {
|
||||
foreach ( $control['fields'] as $field ) {
|
||||
$control_obj = Plugin::$instance->controls_manager->get_control( $field['type'] );
|
||||
|
||||
// Prior to 1.5.0 the fields may contains non-data controls.
|
||||
if ( ! $control_obj instanceof Base_Data_Control ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$item[ $field['name'] ] = $control_obj->get_value( $field, $item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import repeater.
|
||||
*
|
||||
* Used as a wrapper method for inner controls while importing Elementor
|
||||
* template JSON file, and replacing the old data.
|
||||
*
|
||||
* @since 1.8.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $settings Control settings.
|
||||
* @param array $control_data Optional. Control data. Default is an empty array.
|
||||
*
|
||||
* @return array Control settings.
|
||||
*/
|
||||
public function on_import( $settings, $control_data = [] ) {
|
||||
if ( empty( $settings ) || empty( $control_data['fields'] ) ) {
|
||||
return $settings;
|
||||
}
|
||||
|
||||
$method = 'on_import';
|
||||
|
||||
foreach ( $settings as &$item ) {
|
||||
foreach ( $control_data['fields'] as $field ) {
|
||||
if ( empty( $field['name'] ) || empty( $item[ $field['name'] ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$control_obj = Plugin::$instance->controls_manager->get_control( $field['type'] );
|
||||
|
||||
if ( ! $control_obj ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( method_exists( $control_obj, $method ) ) {
|
||||
$item[ $field['name'] ] = $control_obj->{$method}( $item[ $field['name'] ], $field );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render repeater control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<label>
|
||||
<span class="elementor-control-title">{{{ data.label }}}</span>
|
||||
</label>
|
||||
<div class="elementor-repeater-fields-wrapper"></div>
|
||||
<# if ( itemActions.add ) { #>
|
||||
<div class="elementor-button-wrapper">
|
||||
<button class="elementor-button elementor-repeater-add" type="button">
|
||||
<i class="eicon-plus" aria-hidden="true"></i>
|
||||
<# if ( data.button_text ) { #>
|
||||
{{{ data.button_text }}}
|
||||
<# } else { #>
|
||||
<?php echo esc_html__( 'Add Item', 'elementor' ); ?>
|
||||
<# } #>
|
||||
</button>
|
||||
</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function validate( array $control_data ): bool {
|
||||
if ( isset( $control_data['min_items'] ) ) {
|
||||
|
||||
if (
|
||||
! isset( $control_data['default'] ) ||
|
||||
count( $control_data['default'] ) < $control_data['min_items']
|
||||
) {
|
||||
throw new \Exception(
|
||||
__( 'In a Repeater control, if you specify a minimum number of items, you must also specify a default value that contains at least that number of items.', 'elementor' )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
55
wp-content/plugins/elementor/includes/controls/section.php
Normal file
55
wp-content/plugins/elementor/includes/controls/section.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor section control.
|
||||
*
|
||||
* A base control for creating section control. Displays a header that
|
||||
* functions as a toggle to show or hide a set of controls.
|
||||
*
|
||||
* Note: Do not use it directly, instead use `$widget->start_controls_section()`
|
||||
* and `$widget->end_controls_section()` to wrap a set of controls.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Section extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get section control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `section`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'section';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render section control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<button class="elementor-panel-heading">
|
||||
<div class="elementor-panel-heading-toggle elementor-section-toggle" data-collapse_id="{{ data.name }}">
|
||||
<i class="eicon" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="elementor-panel-heading-title elementor-section-title">{{{ data.label }}}</div>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
99
wp-content/plugins/elementor/includes/controls/select.php
Normal file
99
wp-content/plugins/elementor/includes/controls/select.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor select control.
|
||||
*
|
||||
* A base control for creating select control. Displays a simple select box.
|
||||
* It accepts an array in which the `key` is the option value and the `value` is
|
||||
* the option name.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Select extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get select control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `select`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'select';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get select control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the select control. Used to return the
|
||||
* default settings while initializing the select control.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'options' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render select control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field {{ data.content_classes }}">
|
||||
<# if ( data.label ) {#>
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<# } #>
|
||||
<div class="elementor-control-input-wrapper elementor-control-unit-5">
|
||||
<select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
|
||||
<#
|
||||
var printOptions = function( options ) {
|
||||
_.each( options, function( option_title, option_value ) { #>
|
||||
<?php // If the option title is array of title & icon. ?>
|
||||
<option value="{{ option_value }}">{{{ option_title?.title || option_title }}}</option>
|
||||
<# } );
|
||||
};
|
||||
|
||||
if ( data.groups ) {
|
||||
for ( var groupIndex in data.groups ) {
|
||||
var groupArgs = data.groups[ groupIndex ];
|
||||
if ( groupArgs.options ) { #>
|
||||
<optgroup label="{{ groupArgs.label }}">
|
||||
<# printOptions( groupArgs.options ) #>
|
||||
</optgroup>
|
||||
<# } else if ( _.isString( groupArgs ) ) { #>
|
||||
<option value="{{ groupIndex }}">{{{ groupArgs }}}</option>
|
||||
<# }
|
||||
}
|
||||
} else {
|
||||
printOptions( data.options );
|
||||
}
|
||||
#>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
94
wp-content/plugins/elementor/includes/controls/select2.php
Normal file
94
wp-content/plugins/elementor/includes/controls/select2.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor select2 control.
|
||||
*
|
||||
* A base control for creating select2 control. Displays a select box control
|
||||
* based on select2 jQuery plugin @see https://select2.github.io/ .
|
||||
* It accepts an array in which the `key` is the value and the `value` is the
|
||||
* option name. Set `multiple` to `true` to allow multiple value selection.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Select2 extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get select2 control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `select2`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'select2';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get select2 control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the select2 control. Used to return the
|
||||
* default settings while initializing the select2 control.
|
||||
*
|
||||
* @since 1.8.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'options' => [],
|
||||
'multiple' => false,
|
||||
// Select2 library options
|
||||
'select2options' => [],
|
||||
// the lockedOptions array can be passed option keys. The passed option keys will be non-deletable.
|
||||
'lockedOptions' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render select2 control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<# if ( data.label ) {#>
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<# } #>
|
||||
<div class="elementor-control-input-wrapper elementor-control-unit-5">
|
||||
<# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
|
||||
<select id="<?php $this->print_control_uid(); ?>" class="elementor-select2" type="select2" {{ multiple }} data-setting="{{ data.name }}">
|
||||
<# _.each( data.options, function( option_title, option_value ) {
|
||||
var value = data.controlValue;
|
||||
if ( typeof value == 'string' ) {
|
||||
var selected = ( option_value === value ) ? 'selected' : '';
|
||||
} else if ( null !== value ) {
|
||||
var value = _.values( value );
|
||||
var selected = ( -1 !== value.indexOf( option_value ) ) ? 'selected' : '';
|
||||
}
|
||||
#>
|
||||
<option {{ selected }} value="{{ _.escape( option_value ) }}">{{{ _.escape( option_title ) }}}</option>
|
||||
<# } ); #>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
128
wp-content/plugins/elementor/includes/controls/slider.php
Normal file
128
wp-content/plugins/elementor/includes/controls/slider.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor slider control.
|
||||
*
|
||||
* A base control for creating slider control. Displays a draggable range slider.
|
||||
* The slider control can optionally have a number of unit types (`size_units`)
|
||||
* for the user to choose from. The control also accepts a range argument that
|
||||
* allows you to set the `min`, `max` and `step` values per unit type.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Slider extends Control_Base_Units {
|
||||
|
||||
/**
|
||||
* Get slider control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `slider`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'slider';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slider control default values.
|
||||
*
|
||||
* Retrieve the default value of the slider control. Used to return the default
|
||||
* values while initializing the slider control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return array_merge(
|
||||
parent::get_default_value(), [
|
||||
'size' => '',
|
||||
'sizes' => [],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slider control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the slider control. Used to return the
|
||||
* default settings while initializing the slider control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return array_merge(
|
||||
parent::get_default_settings(), [
|
||||
'label_block' => true,
|
||||
'labels' => [],
|
||||
'scales' => 0,
|
||||
'handles' => 'default',
|
||||
'dynamic' => [
|
||||
'categories' => [ TagsModule::NUMBER_CATEGORY ],
|
||||
'property' => 'size',
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render slider control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<?php $this->print_units_template(); ?>
|
||||
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper elementor-clearfix elementor-control-tag-area">
|
||||
<# if ( isMultiple && ( data.labels.length || data.scales ) ) { #>
|
||||
<div class="elementor-slider__extra">
|
||||
<# if ( data.labels.length ) { #>
|
||||
<div class="elementor-slider__labels">
|
||||
<# jQuery.each( data.labels, ( index, label ) => { #>
|
||||
<div class="elementor-slider__label">{{{ label }}}</div>
|
||||
<# } ); #>
|
||||
</div>
|
||||
<# } if ( data.scales ) { #>
|
||||
<div class="elementor-slider__scales">
|
||||
<# for ( var i = 0; i < data.scales; i++ ) { #>
|
||||
<div class="elementor-slider__scale"></div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
<div class="elementor-slider"></div>
|
||||
<# if ( ! isMultiple ) { #>
|
||||
<div class="elementor-slider-input">
|
||||
<input id="<?php $this->print_control_uid(); ?>" type="text" min="{{ data.min }}" max="{{ data.max }}" step="{{ data.step }}" placeholder="{{ view.getControlPlaceholder()?.size }}" data-setting="size" />
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
91
wp-content/plugins/elementor/includes/controls/structure.php
Normal file
91
wp-content/plugins/elementor/includes/controls/structure.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor structure control.
|
||||
*
|
||||
* A base control for creating structure control. A private control for section
|
||||
* columns structure.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Structure extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get structure control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `structure`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'structure';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render structure control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<#
|
||||
var morePresets = getMorePresets();
|
||||
|
||||
if ( morePresets.length ) { #>
|
||||
<div class="elementor-control-structure-presets">
|
||||
<# _.each( morePresets, function( preset ) { #>
|
||||
<div class="elementor-control-structure-preset-wrapper">
|
||||
<input id="<?php $this->print_control_uid( '{{ preset.key }}' ); ?>" type="radio" name="elementor-control-structure-preset-{{ data._cid }}" data-setting="structure" value="{{ preset.key }}">
|
||||
<label for="<?php $this->print_control_uid( '{{ preset.key }}' ); ?>" class="elementor-control-structure-preset">
|
||||
{{{ elementor.presetsFactory.getPresetSVG( preset.preset, 102, 42 ).outerHTML }}}
|
||||
</label>
|
||||
<div class="elementor-control-structure-preset-title">{{{ preset.preset.join( ', ' ) }}}</div>
|
||||
</div>
|
||||
<# } ); #>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<div class="elementor-control-structure-reset">
|
||||
<i class="eicon-undo" aria-hidden="true"></i>
|
||||
<?php echo esc_html__( 'Reset', 'elementor' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get structure control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the structure control. Used to return the
|
||||
* default settings while initializing the structure control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'show_label' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
78
wp-content/plugins/elementor/includes/controls/switcher.php
Normal file
78
wp-content/plugins/elementor/includes/controls/switcher.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor switcher control.
|
||||
*
|
||||
* A base control for creating switcher control. Displays an on/off switcher,
|
||||
* basically a fancy UI representation of a checkbox.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Switcher extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get switcher control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `switcher`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'switcher';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render switcher control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<label class="elementor-switch elementor-control-unit-2">
|
||||
<input id="<?php $this->print_control_uid(); ?>" type="checkbox" data-setting="{{ data.name }}" class="elementor-switch-input" value="{{ data.return_value }}">
|
||||
<span class="elementor-switch-label" data-on="{{ data.label_on }}" data-off="{{ data.label_off }}"></span>
|
||||
<span class="elementor-switch-handle"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get switcher control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the switcher control. Used to return the
|
||||
* default settings while initializing the switcher control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_off' => esc_html__( 'No', 'elementor' ),
|
||||
'label_on' => esc_html__( 'Yes', 'elementor' ),
|
||||
'return_value' => 'yes',
|
||||
];
|
||||
}
|
||||
}
|
||||
52
wp-content/plugins/elementor/includes/controls/tab.php
Normal file
52
wp-content/plugins/elementor/includes/controls/tab.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor tab control.
|
||||
*
|
||||
* A base control for creating tab control. Displays a tab header for a set of
|
||||
* controls.
|
||||
*
|
||||
* Note: Do not use it directly, instead use: `$widget->start_controls_tab()`
|
||||
* and in the end `$widget->end_controls_tab()`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Tab extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get tab control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `tab`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'tab';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render tab control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-panel-tab-heading">
|
||||
{{{ data.label }}}
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
46
wp-content/plugins/elementor/includes/controls/tabs.php
Normal file
46
wp-content/plugins/elementor/includes/controls/tabs.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor tabs control.
|
||||
*
|
||||
* A base control for creating tabs control. Displays a tabs header for `tab`
|
||||
* controls.
|
||||
*
|
||||
* Note: Do not use it directly, instead use: `$widget->start_controls_tabs()`
|
||||
* and in the end `$widget->end_controls_tabs()`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Tabs extends Base_UI_Control {
|
||||
|
||||
/**
|
||||
* Get tabs control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `tabs`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'tabs';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render tabs control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {}
|
||||
}
|
||||
118
wp-content/plugins/elementor/includes/controls/text-shadow.php
Normal file
118
wp-content/plugins/elementor/includes/controls/text-shadow.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor text shadow control.
|
||||
*
|
||||
* A base control for creating text shadows control. Displays input fields for
|
||||
* horizontal shadow, vertical shadow, shadow blur and shadow color.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
class Control_Text_Shadow extends Control_Base_Multiple {
|
||||
|
||||
/**
|
||||
* Get text shadow control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `text_shadow`.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'text_shadow';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text shadow control default values.
|
||||
*
|
||||
* Retrieve the default value of the text shadow control. Used to return the
|
||||
* default values while initializing the text shadow control.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [
|
||||
'horizontal' => 0,
|
||||
'vertical' => 0,
|
||||
'blur' => 10,
|
||||
'color' => 'rgba(0,0,0,0.3)',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text shadow control sliders.
|
||||
*
|
||||
* Retrieve the sliders of the text shadow control. Sliders are used while
|
||||
* rendering the control output in the editor.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control sliders.
|
||||
*/
|
||||
public function get_sliders() {
|
||||
return [
|
||||
'blur' => [
|
||||
'label' => esc_html__( 'Blur', 'elementor' ),
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
],
|
||||
'horizontal' => [
|
||||
'label' => esc_html__( 'Horizontal', 'elementor' ),
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
'vertical' => [
|
||||
'label' => esc_html__( 'Vertical', 'elementor' ),
|
||||
'min' => -100,
|
||||
'max' => 100,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render text shadow control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.6.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-shadow-box">
|
||||
<div class="elementor-control-field elementor-color-picker-wrapper">
|
||||
<label class="elementor-control-title"><?php echo esc_html__( 'Color', 'elementor' ); ?></label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-unit-1">
|
||||
<div class="elementor-color-picker-placeholder"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
foreach ( $this->get_sliders() as $slider_name => $slider ) :
|
||||
?>
|
||||
<div class="elementor-shadow-slider elementor-control-type-slider">
|
||||
<label for="<?php $this->print_control_uid( $slider_name ); ?>" class="elementor-control-title"><?php echo esc_html( $slider['label'] ); ?></label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<div class="elementor-slider" data-input="<?php echo esc_attr( $slider_name ); ?>"></div>
|
||||
<div class="elementor-slider-input elementor-control-unit-2">
|
||||
<input id="<?php $this->print_control_uid( $slider_name ); ?>" type="number" min="<?php echo esc_attr( $slider['min'] ); ?>" max="<?php echo esc_attr( $slider['max'] ); ?>" data-setting="<?php echo esc_attr( $slider_name ); ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
86
wp-content/plugins/elementor/includes/controls/text.php
Normal file
86
wp-content/plugins/elementor/includes/controls/text.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor text control.
|
||||
*
|
||||
* A base control for creating text control. Displays a simple text input.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Text extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get text control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `text`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'text';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render text control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<# if ( data.label ) {#>
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<# } #>
|
||||
<div class="elementor-control-input-wrapper elementor-control-unit-5 elementor-control-dynamic-switcher-wrapper">
|
||||
<input id="<?php $this->print_control_uid(); ?>" type="{{ data.input_type }}" class="tooltip-target elementor-control-tag-area" data-tooltip="{{ data.title }}" title="{{ data.title }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}" />
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the text control. Used to return the
|
||||
* default settings while initializing the text control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'input_type' => 'text',
|
||||
'placeholder' => '',
|
||||
'title' => '',
|
||||
'ai' => [
|
||||
'active' => true,
|
||||
'type' => 'text',
|
||||
],
|
||||
'dynamic' => [
|
||||
'categories' => [
|
||||
TagsModule::TEXT_CATEGORY,
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
82
wp-content/plugins/elementor/includes/controls/textarea.php
Normal file
82
wp-content/plugins/elementor/includes/controls/textarea.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor textarea control.
|
||||
*
|
||||
* A base control for creating textarea control. Displays a classic textarea.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Textarea extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get textarea control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `textarea`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'textarea';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get textarea control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the textarea control. Used to return the
|
||||
* default settings while initializing the textarea control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'rows' => 5,
|
||||
'placeholder' => '',
|
||||
'ai' => [
|
||||
'active' => true,
|
||||
'type' => 'textarea',
|
||||
],
|
||||
'dynamic' => [
|
||||
'categories' => [ TagsModule::TEXT_CATEGORY ],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render textarea control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
|
||||
<textarea id="<?php $this->print_control_uid(); ?>" class="elementor-control-tag-area" rows="{{ data.rows }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
134
wp-content/plugins/elementor/includes/controls/url.php
Normal file
134
wp-content/plugins/elementor/includes/controls/url.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor URL control.
|
||||
*
|
||||
* A base control for creating url control. Displays a URL input with the
|
||||
* ability to set the target of the link to `_blank` to open in a new tab.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_URL extends Control_Base_Multiple {
|
||||
|
||||
/**
|
||||
* Get url control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `url`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'url';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url control default values.
|
||||
*
|
||||
* Retrieve the default value of the url control. Used to return the default
|
||||
* values while initializing the url control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [
|
||||
'url' => '',
|
||||
'is_external' => '',
|
||||
'nofollow' => '',
|
||||
'custom_attributes' => '',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the url control. Used to return the default
|
||||
* settings while initializing the url control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'placeholder' => esc_html__( 'Paste URL or type', 'elementor' ),
|
||||
'autocomplete' => true,
|
||||
'options' => [ 'is_external', 'nofollow', 'custom_attributes' ],
|
||||
'dynamic' => [
|
||||
'categories' => [ TagsModule::URL_CATEGORY ],
|
||||
'property' => 'url',
|
||||
],
|
||||
'custom_attributes_description' => sprintf(
|
||||
'%1$s <a target="_blank" href="https://go.elementor.com/panel-link-custom-attributes/">%2$s</a>',
|
||||
esc_html__( 'Set custom attributes for the link element. Separate attribute keys from values using the | (pipe) character. Separate key-value pairs with a comma.', 'elementor' ),
|
||||
esc_html__( 'Learn more', 'elementor' )
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render url control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field elementor-control-url-external-{{{ ( data.options.length || data.show_external ) ? 'show' : 'hide' }}}">
|
||||
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
|
||||
<i class="elementor-control-url-autocomplete-spinner eicon-loading eicon-animation-spin" aria-hidden="true"></i>
|
||||
<input id="<?php $this->print_control_uid(); ?>" class="elementor-control-tag-area elementor-input" data-setting="url" placeholder="{{ view.getControlPlaceholder() }}" />
|
||||
<?php // PHPCS - Nonces don't require escaping. ?>
|
||||
<input id="_ajax_linking_nonce" type="hidden" value="<?php echo wp_create_nonce( 'internal-linking' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" />
|
||||
<# if ( !! data.options ) { #>
|
||||
<button class="elementor-control-url-more tooltip-target elementor-control-unit-1" data-tooltip="<?php echo esc_attr__( 'Link Options', 'elementor' ); ?>">
|
||||
<i class="eicon-cog" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Link Options', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<# } #>
|
||||
</div>
|
||||
<# if ( !! data.options ) { #>
|
||||
<div class="elementor-control-url-more-options">
|
||||
<div class="elementor-control-url-option">
|
||||
<input id="<?php $this->print_control_uid( 'is_external' ); ?>" type="checkbox" class="elementor-control-url-option-input" data-setting="is_external">
|
||||
<label for="<?php $this->print_control_uid( 'is_external' ); ?>"><?php echo esc_html__( 'Open in new window', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<div class="elementor-control-url-option">
|
||||
<input id="<?php $this->print_control_uid( 'nofollow' ); ?>" type="checkbox" class="elementor-control-url-option-input" data-setting="nofollow">
|
||||
<label for="<?php $this->print_control_uid( 'nofollow' ); ?>"><?php echo esc_html__( 'Add nofollow', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<div class="elementor-control-url__custom-attributes">
|
||||
<label for="<?php $this->print_control_uid( 'custom_attributes' ); ?>" class="elementor-control-url__custom-attributes-label"><?php echo esc_html__( 'Custom Attributes', 'elementor' ); ?></label>
|
||||
<input type="text" id="<?php $this->print_control_uid( 'custom_attributes' ); ?>" class="elementor-control-unit-5" placeholder="key|value" data-setting="custom_attributes">
|
||||
</div>
|
||||
<# if ( ( data.options && -1 !== data.options.indexOf( 'custom_attributes' ) ) && data.custom_attributes_description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.custom_attributes_description }}}</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
64
wp-content/plugins/elementor/includes/controls/wp-widget.php
Normal file
64
wp-content/plugins/elementor/includes/controls/wp-widget.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor WordPress widget control.
|
||||
*
|
||||
* A base control for creating WordPress widget control. Displays native
|
||||
* WordPress widgets. This a private control for internal use.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_WP_Widget extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get WordPress widget control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `wp_widget`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'wp_widget';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get WordPress widget control default values.
|
||||
*
|
||||
* Retrieve the default value of the WordPress widget control. Used to return the
|
||||
* default values while initializing the WordPress widget control.
|
||||
*
|
||||
* @since 1.4.3
|
||||
* @access public
|
||||
*
|
||||
* @return array Control default value.
|
||||
*/
|
||||
public function get_default_value() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Render WordPress widget control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<div class="wp-widget-form-loading">Loading..</div>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
80
wp-content/plugins/elementor/includes/controls/wysiwyg.php
Normal file
80
wp-content/plugins/elementor/includes/controls/wysiwyg.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Modules\DynamicTags\Module as TagsModule;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor WYSIWYG control.
|
||||
*
|
||||
* A base control for creating WYSIWYG control. Displays a WordPress WYSIWYG
|
||||
* (TinyMCE) editor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Control_Wysiwyg extends Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get wysiwyg control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `wysiwyg`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'wysiwyg';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render wysiwyg control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<div class="elementor-control-title">{{{ data.label }}}</div>
|
||||
<div class="elementor-control-input-wrapper elementor-control-tag-area"></div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve textarea control default settings.
|
||||
*
|
||||
* Get the default settings of the textarea control. Used to return the
|
||||
* default settings while initializing the textarea control.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return [
|
||||
'label_block' => true,
|
||||
'ai' => [
|
||||
'active' => true,
|
||||
'type' => 'textarea',
|
||||
],
|
||||
'dynamic' => [
|
||||
'active' => true,
|
||||
'categories' => [ TagsModule::TEXT_CATEGORY ],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
578
wp-content/plugins/elementor/includes/db.php
Normal file
578
wp-content/plugins/elementor/includes/db.php
Normal file
@@ -0,0 +1,578 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Base\Document;
|
||||
use Elementor\Core\DynamicTags\Manager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor database.
|
||||
*
|
||||
* Elementor database handler class is responsible for communicating with the
|
||||
* DB, save and retrieve Elementor data and meta data.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class DB {
|
||||
|
||||
/**
|
||||
* Current DB version of the editor.
|
||||
*/
|
||||
const DB_VERSION = '0.4';
|
||||
|
||||
/**
|
||||
* Post publish status.
|
||||
*
|
||||
* @deprecated 3.1.0 Use `Document::STATUS_PUBLISH` const instead.
|
||||
*/
|
||||
const STATUS_PUBLISH = Document::STATUS_PUBLISH;
|
||||
|
||||
/**
|
||||
* Post draft status.
|
||||
*
|
||||
* @deprecated 3.1.0 Use `Document::STATUS_DRAFT` const instead.
|
||||
*/
|
||||
const STATUS_DRAFT = Document::STATUS_DRAFT;
|
||||
|
||||
/**
|
||||
* Post private status.
|
||||
*
|
||||
* @deprecated 3.1.0 Use `Document::STATUS_PRIVATE` const instead.
|
||||
*/
|
||||
const STATUS_PRIVATE = Document::STATUS_PRIVATE;
|
||||
|
||||
/**
|
||||
* Post autosave status.
|
||||
*
|
||||
* @deprecated 3.1.0 Use `Document::STATUS_AUTOSAVE` const instead.
|
||||
*/
|
||||
const STATUS_AUTOSAVE = Document::STATUS_AUTOSAVE;
|
||||
|
||||
/**
|
||||
* Post pending status.
|
||||
*
|
||||
* @deprecated 3.1.0 Use `Document::STATUS_PENDING` const instead.
|
||||
*/
|
||||
const STATUS_PENDING = Document::STATUS_PENDING;
|
||||
|
||||
/**
|
||||
* Switched post data.
|
||||
*
|
||||
* Holds the switched post data.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access protected
|
||||
*
|
||||
* @var array Switched post data. Default is an empty array.
|
||||
*/
|
||||
protected $switched_post_data = [];
|
||||
|
||||
/**
|
||||
* Switched data.
|
||||
*
|
||||
* Holds the switched data.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @var array Switched data. Default is an empty array.
|
||||
*/
|
||||
protected $switched_data = [];
|
||||
|
||||
/**
|
||||
* Get builder.
|
||||
*
|
||||
* Retrieve editor data from the database.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @deprecated 3.1.0 Use `Plugin::$instance->documents->get( $post_id )->get_elements_raw_data( null, true )` OR `Plugin::$instance->documents->get_doc_or_auto_save( $post_id )->get_elements_raw_data( null, true )` instead.
|
||||
* @access public
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
* @param string $status Optional. Post status. Default is `publish`.
|
||||
*
|
||||
* @return array Editor data.
|
||||
*/
|
||||
public function get_builder( $post_id, $status = Document::STATUS_PUBLISH ) {
|
||||
Plugin::$instance->modules_manager
|
||||
->get_modules( 'dev-tools' )
|
||||
->deprecation
|
||||
->deprecated_function(
|
||||
__METHOD__,
|
||||
'3.1.0',
|
||||
'`Plugin::$instance->documents->get( $post_id )->get_elements_raw_data( null, true )` OR `Plugin::$instance->documents->get_doc_or_auto_save( $post_id )->get_elements_raw_data( null, true )`'
|
||||
);
|
||||
|
||||
if ( Document::STATUS_DRAFT === $status ) {
|
||||
$document = Plugin::$instance->documents->get_doc_or_auto_save( $post_id );
|
||||
} else {
|
||||
$document = Plugin::$instance->documents->get( $post_id );
|
||||
}
|
||||
|
||||
if ( $document ) {
|
||||
$editor_data = $document->get_elements_raw_data( null, true );
|
||||
} else {
|
||||
$editor_data = [];
|
||||
}
|
||||
|
||||
return $editor_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get JSON meta.
|
||||
*
|
||||
* Retrieve post meta data, and return the JSON decoded data.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
* @param string $key The meta key to retrieve.
|
||||
*
|
||||
* @return array Decoded JSON data from post meta.
|
||||
*/
|
||||
protected function _get_json_meta( $post_id, $key ) {
|
||||
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0' );
|
||||
|
||||
$meta = get_post_meta( $post_id, $key, true );
|
||||
|
||||
if ( is_string( $meta ) && ! empty( $meta ) ) {
|
||||
$meta = json_decode( $meta, true );
|
||||
}
|
||||
|
||||
if ( empty( $meta ) ) {
|
||||
$meta = [];
|
||||
}
|
||||
|
||||
return $meta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is using Elementor.
|
||||
*
|
||||
* Set whether the page is using Elementor or not.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @deprecated 3.1.0 Use `Plugin::$instance->documents->get( $post_id )->set_is_build_with_elementor( $is_elementor )` instead.
|
||||
* @access public
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
* @param bool $is_elementor Optional. Whether the page is elementor page.
|
||||
* Default is true.
|
||||
*/
|
||||
public function set_is_elementor_page( $post_id, $is_elementor = true ) {
|
||||
Plugin::$instance->modules_manager
|
||||
->get_modules( 'dev-tools' )
|
||||
->deprecation
|
||||
->deprecated_function(
|
||||
__METHOD__,
|
||||
'3.1.0',
|
||||
'Plugin::$instance->documents->get( $post_id )->set_is_build_with_elementor( $is_elementor )'
|
||||
);
|
||||
|
||||
$document = Plugin::$instance->documents->get( $post_id );
|
||||
|
||||
if ( ! $document ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$document->set_is_built_with_elementor( $is_elementor );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render element plain content.
|
||||
*
|
||||
* When saving data in the editor, this method renders recursively the plain
|
||||
* content containing only the content and the HTML. No CSS data.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
*
|
||||
* @param array $element_data Element data.
|
||||
*/
|
||||
private function render_element_plain_content( $element_data ) {
|
||||
if ( 'widget' === $element_data['elType'] ) {
|
||||
/** @var Widget_Base $widget */
|
||||
$widget = Plugin::$instance->elements_manager->create_element_instance( $element_data );
|
||||
|
||||
if ( $widget ) {
|
||||
$widget->render_plain_content();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $element_data['elements'] ) ) {
|
||||
foreach ( $element_data['elements'] as $element ) {
|
||||
$this->render_element_plain_content( $element );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save plain text.
|
||||
*
|
||||
* Retrieves the raw content, removes all kind of unwanted HTML tags and saves
|
||||
* the content as the `post_content` field in the database.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
*/
|
||||
public function save_plain_text( $post_id ) {
|
||||
// Switch $dynamic_tags to parsing mode = remove.
|
||||
$dynamic_tags = Plugin::$instance->dynamic_tags;
|
||||
$parsing_mode = $dynamic_tags->get_parsing_mode();
|
||||
$dynamic_tags->set_parsing_mode( Manager::MODE_REMOVE );
|
||||
|
||||
$plain_text = $this->get_plain_text( $post_id );
|
||||
|
||||
wp_update_post(
|
||||
[
|
||||
'ID' => $post_id,
|
||||
'post_content' => $plain_text,
|
||||
]
|
||||
);
|
||||
|
||||
// Restore parsing mode.
|
||||
$dynamic_tags->set_parsing_mode( $parsing_mode );
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate data.
|
||||
*
|
||||
* Accept any type of Elementor data and a callback function. The callback
|
||||
* function runs recursively for each element and his child elements.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $data_container Any type of elementor data.
|
||||
* @param callable $callback A function to iterate data by.
|
||||
* @param array $args Array of args pointers for passing parameters in & out of the callback
|
||||
*
|
||||
* @return mixed Iterated data.
|
||||
*/
|
||||
public function iterate_data( $data_container, $callback, $args = [] ) {
|
||||
if ( isset( $data_container['elType'] ) ) {
|
||||
if ( ! empty( $data_container['elements'] ) ) {
|
||||
$data_container['elements'] = $this->iterate_data( $data_container['elements'], $callback, $args );
|
||||
}
|
||||
|
||||
return call_user_func( $callback, $data_container, $args );
|
||||
}
|
||||
|
||||
foreach ( $data_container as $element_key => $element_value ) {
|
||||
$element_data = $this->iterate_data( $data_container[ $element_key ], $callback, $args );
|
||||
|
||||
if ( null === $element_data ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data_container[ $element_key ] = $element_data;
|
||||
}
|
||||
|
||||
return $data_container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely copy Elementor meta.
|
||||
*
|
||||
* Make sure the original page was built with Elementor and the post is not
|
||||
* auto-save. Only then copy elementor meta from one post to another using
|
||||
* `copy_elementor_meta()`.
|
||||
*
|
||||
* @since 1.9.2
|
||||
* @access public
|
||||
*
|
||||
* @param int $from_post_id Original post ID.
|
||||
* @param int $to_post_id Target post ID.
|
||||
*/
|
||||
public function safe_copy_elementor_meta( $from_post_id, $to_post_id ) {
|
||||
// It's from WP-Admin & not from Elementor.
|
||||
if ( ! did_action( 'elementor/db/before_save' ) ) {
|
||||
$from_document = Plugin::$instance->documents->get( $from_post_id );
|
||||
|
||||
if ( ! $from_document || ! $from_document->is_built_with_elementor() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// It's an exited Elementor auto-save
|
||||
if ( get_post_meta( $to_post_id, '_elementor_data', true ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->copy_elementor_meta( $from_post_id, $to_post_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy Elementor meta.
|
||||
*
|
||||
* Duplicate the data from one post to another.
|
||||
*
|
||||
* Consider using `safe_copy_elementor_meta()` method instead.
|
||||
*
|
||||
* @since 1.1.0
|
||||
* @access public
|
||||
*
|
||||
* @param int $from_post_id Original post ID.
|
||||
* @param int $to_post_id Target post ID.
|
||||
*/
|
||||
public function copy_elementor_meta( $from_post_id, $to_post_id ) {
|
||||
$from_post_meta = get_post_meta( $from_post_id );
|
||||
$core_meta = [
|
||||
'_wp_page_template',
|
||||
'_thumbnail_id',
|
||||
];
|
||||
|
||||
foreach ( $from_post_meta as $meta_key => $values ) {
|
||||
// Copy only meta with the `_elementor` prefix
|
||||
if ( 0 === strpos( $meta_key, '_elementor' ) || in_array( $meta_key, $core_meta, true ) ) {
|
||||
$value = $values[0];
|
||||
|
||||
// The elementor JSON needs slashes before saving
|
||||
if ( '_elementor_data' === $meta_key ) {
|
||||
$value = wp_slash( $value );
|
||||
} else {
|
||||
$value = maybe_unserialize( $value );
|
||||
}
|
||||
|
||||
// Don't use `update_post_meta` that can't handle `revision` post type
|
||||
update_metadata( 'post', $to_post_id, $meta_key, $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is built with Elementor.
|
||||
*
|
||||
* Check whether the post was built with Elementor.
|
||||
*
|
||||
* @since 1.0.10
|
||||
* @deprecated 3.2.0 Use `Plugin::$instance->documents->get( $post_id )->is_built_with_elementor()` instead.
|
||||
* @access public
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
*
|
||||
* @return bool Whether the post was built with Elementor.
|
||||
*/
|
||||
public function is_built_with_elementor( $post_id ) {
|
||||
Plugin::$instance->modules_manager
|
||||
->get_modules( 'dev-tools' )
|
||||
->deprecation
|
||||
->deprecated_function(
|
||||
__METHOD__,
|
||||
'3.2.0',
|
||||
'Plugin::$instance->documents->get( $post_id )->is_built_with_elementor()'
|
||||
);
|
||||
|
||||
$document = Plugin::$instance->documents->get( $post_id );
|
||||
|
||||
if ( ! $document ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $document->is_built_with_elementor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to post.
|
||||
*
|
||||
* Change the global WordPress post to the requested post.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*
|
||||
* @param int $post_id Post ID to switch to.
|
||||
*/
|
||||
public function switch_to_post( $post_id ) {
|
||||
$post_id = absint( $post_id );
|
||||
// If is already switched, or is the same post, return.
|
||||
if ( get_the_ID() === $post_id ) {
|
||||
$this->switched_post_data[] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
$this->switched_post_data[] = [
|
||||
'switched_id' => $post_id,
|
||||
'original_id' => get_the_ID(), // Note, it can be false if the global isn't set
|
||||
];
|
||||
|
||||
$GLOBALS['post'] = get_post( $post_id ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
setup_postdata( $GLOBALS['post'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore current post.
|
||||
*
|
||||
* Rollback to the previous global post, rolling back from `DB::switch_to_post()`.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
*/
|
||||
public function restore_current_post() {
|
||||
$data = array_pop( $this->switched_post_data );
|
||||
|
||||
// If not switched, return.
|
||||
if ( ! $data ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// It was switched from an empty global post, restore this state and unset the global post
|
||||
if ( false === $data['original_id'] ) {
|
||||
unset( $GLOBALS['post'] );
|
||||
return;
|
||||
}
|
||||
|
||||
$GLOBALS['post'] = get_post( $data['original_id'] ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
setup_postdata( $GLOBALS['post'] );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Switch to query.
|
||||
*
|
||||
* Change the WordPress query to a new query with the requested
|
||||
* query variables.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $query_vars New query variables.
|
||||
* @param bool $force_global_post
|
||||
*/
|
||||
public function switch_to_query( $query_vars, $force_global_post = false ) {
|
||||
global $wp_query;
|
||||
$current_query_vars = $wp_query->query;
|
||||
|
||||
// If is already switched, or is the same query, return.
|
||||
if ( $current_query_vars === $query_vars ) {
|
||||
$this->switched_data[] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
$new_query = new \WP_Query( $query_vars );
|
||||
|
||||
$switched_data = [
|
||||
'switched' => $new_query,
|
||||
'original' => $wp_query,
|
||||
];
|
||||
|
||||
if ( ! empty( $GLOBALS['post'] ) ) {
|
||||
$switched_data['post'] = $GLOBALS['post'];
|
||||
}
|
||||
|
||||
$this->switched_data[] = $switched_data;
|
||||
|
||||
$wp_query = $new_query; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
// Ensure the global post is set only if needed
|
||||
unset( $GLOBALS['post'] );
|
||||
|
||||
if ( isset( $new_query->posts[0] ) ) {
|
||||
if ( $force_global_post || $new_query->is_singular() ) {
|
||||
$GLOBALS['post'] = $new_query->posts[0]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
setup_postdata( $GLOBALS['post'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $new_query->is_author() ) {
|
||||
$GLOBALS['authordata'] = get_userdata( $new_query->get( 'author' ) ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore current query.
|
||||
*
|
||||
* Rollback to the previous query, rolling back from `DB::switch_to_query()`.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function restore_current_query() {
|
||||
$data = array_pop( $this->switched_data );
|
||||
|
||||
// If not switched, return.
|
||||
if ( ! $data ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $wp_query;
|
||||
|
||||
$wp_query = $data['original']; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
// Ensure the global post/authordata is set only if needed.
|
||||
unset( $GLOBALS['post'] );
|
||||
unset( $GLOBALS['authordata'] );
|
||||
|
||||
if ( ! empty( $data['post'] ) ) {
|
||||
$GLOBALS['post'] = $data['post']; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
setup_postdata( $GLOBALS['post'] );
|
||||
}
|
||||
|
||||
if ( $wp_query->is_author() ) {
|
||||
$GLOBALS['authordata'] = get_userdata( $wp_query->get( 'author' ) ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plain text.
|
||||
*
|
||||
* Retrieve the post plain text.
|
||||
*
|
||||
* @since 1.9.0
|
||||
* @access public
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
*
|
||||
* @return string Post plain text.
|
||||
*/
|
||||
public function get_plain_text( $post_id ) {
|
||||
$document = Plugin::$instance->documents->get( $post_id );
|
||||
$data = $document ? $document->get_elements_data() : [];
|
||||
|
||||
return $this->get_plain_text_from_data( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plain text from data.
|
||||
*
|
||||
* Retrieve the post plain text from any given Elementor data.
|
||||
*
|
||||
* @since 1.9.2
|
||||
* @access public
|
||||
*
|
||||
* @param array $data Post ID.
|
||||
*
|
||||
* @return string Post plain text.
|
||||
*/
|
||||
public function get_plain_text_from_data( $data ) {
|
||||
ob_start();
|
||||
if ( $data ) {
|
||||
foreach ( $data as $element_data ) {
|
||||
$this->render_element_plain_content( $element_data );
|
||||
}
|
||||
}
|
||||
|
||||
$plain_text = ob_get_clean();
|
||||
|
||||
// Remove unnecessary tags.
|
||||
$plain_text = preg_replace( '/<\/?div[^>]*\>/i', '', $plain_text );
|
||||
$plain_text = preg_replace( '/<\/?span[^>]*\>/i', '', $plain_text );
|
||||
$plain_text = preg_replace( '#<script(.*?)>(.*?)</script>#is', '', $plain_text );
|
||||
$plain_text = preg_replace( '/<i [^>]*><\\/i[^>]*>/', '', $plain_text );
|
||||
$plain_text = preg_replace( '/ class=".*?"/', '', $plain_text );
|
||||
|
||||
// Remove empty lines.
|
||||
$plain_text = preg_replace( '/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/', "\n", $plain_text );
|
||||
|
||||
$plain_text = trim( $plain_text );
|
||||
|
||||
return $plain_text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
global $wp_version;
|
||||
|
||||
$body_classes = [
|
||||
'elementor-editor-active',
|
||||
'wp-version-' . str_replace( '.', '-', $wp_version ),
|
||||
];
|
||||
|
||||
if ( is_rtl() ) {
|
||||
$body_classes[] = 'rtl';
|
||||
}
|
||||
|
||||
if ( ! Plugin::$instance->role_manager->user_can( 'design' ) ) {
|
||||
$body_classes[] = 'elementor-editor-content-only';
|
||||
}
|
||||
|
||||
$notice = Plugin::$instance->editor->notice_bar->get_notice();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title><?php echo sprintf( esc_html__( 'Edit "%s" with Elementor', 'elementor' ), esc_html( get_the_title() ) ); ?></title>
|
||||
<?php wp_head(); ?>
|
||||
<script>
|
||||
var ajaxurl = '<?php Utils::print_unescaped_internal_string( admin_url( 'admin-ajax.php', 'relative' ) ); ?>';
|
||||
</script>
|
||||
</head>
|
||||
<body class="<?php echo esc_attr( implode( ' ', $body_classes ) ); ?>">
|
||||
<?php
|
||||
if ( isset( $body_file_path ) ) {
|
||||
include $body_file_path;
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
wp_footer();
|
||||
/** This action is documented in wp-admin/admin-footer.php */
|
||||
do_action( 'admin_print_footer_scripts' );
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
function echo_select_your_structure_title() {
|
||||
echo esc_html__( 'Select your structure', 'elementor' );
|
||||
}
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-empty-preview">
|
||||
<div class="elementor-first-add">
|
||||
<div class="elementor-icon eicon-plus"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-add-section">
|
||||
<# if ( $e.components.get( 'document/elements' ).utils.allowAddingWidgets() ) { #>
|
||||
<div class="elementor-add-section-inner">
|
||||
<div class="elementor-add-section-close elementor-wizard-icon">
|
||||
<i class="eicon-close" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Close', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<?php
|
||||
$experiments_manager = Plugin::$instance->experiments;
|
||||
if ( $experiments_manager->is_feature_active( 'container_grid' ) ) { ?>
|
||||
<div class="elementor-add-section-back elementor-wizard-icon">
|
||||
<i class="eicon-chevron-left" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Back', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="e-view elementor-add-new-section">
|
||||
<?php
|
||||
$add_container_title = esc_html__( 'Add New Container', 'elementor' );
|
||||
$add_section_title = esc_html__( 'Add New Section', 'elementor' );
|
||||
|
||||
$button_title = ( $experiments_manager->is_feature_active( 'container' ) ) ? $add_container_title : $add_section_title;
|
||||
?>
|
||||
<div class="elementor-add-section-area-button elementor-add-section-button" title="<?php echo esc_attr( $button_title ); ?>">
|
||||
<i class="eicon-plus"></i>
|
||||
</div>
|
||||
<# if ( 'loop-item' !== elementor.documents.getCurrent()?.config?.type || elementorCommon.config.experimentalFeatures[ 'container' ] ) {
|
||||
const additionalClass = 'loop-item' === elementor.documents.getCurrent()?.config?.type && elementor.documents.getCurrent()?.config?.settings?.settings?.source?.includes( 'taxonomy' )
|
||||
? 'elementor-edit-hidden'
|
||||
: ''; #>
|
||||
<div class="{{ additionalClass }} elementor-add-section-area-button elementor-add-template-button" title="<?php echo esc_attr__( 'Add Template', 'elementor' ); ?>">
|
||||
<i class="eicon-folder"></i>
|
||||
</div>
|
||||
<# } #>
|
||||
<div class="elementor-add-section-drag-title"><?php echo esc_html__( 'Drag widget here', 'elementor' ); ?></div>
|
||||
</div>
|
||||
<div class="e-view e-con-shared-styles e-con-select-type">
|
||||
<div class="e-con-select-type__title"><?php echo esc_html__( 'Which layout would you like to use?', 'elementor' ); ?></div>
|
||||
<div class="e-con-select-type__icons">
|
||||
<div class="e-con-select-type__icons__icon flex-preset-button">
|
||||
<svg width="85" height="85" viewBox="0 0 85 85" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="41.698" height="84.9997" fill="#D5DADE"/>
|
||||
<rect x="43.3018" width="41.698" height="41.6498" fill="#D5DADE"/>
|
||||
<rect x="43.3018" y="43.3506" width="41.698" height="41.6498" fill="#D5DADE"/>
|
||||
</svg>
|
||||
<div class="e-con-select-type__icons__icon__subtitle"><?php echo esc_html__( 'Flexbox', 'elementor' ); ?></div>
|
||||
</div>
|
||||
<div class="e-con-select-type__icons__icon grid-preset-button">
|
||||
<svg width="85" height="85" viewBox="0 0 85 85" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0.5" y="0.5" width="83.9997" height="84" stroke="#9DA5AE" stroke-dasharray="2 2"/>
|
||||
<path d="M42.501 0.484375V84.6259" stroke="#9DA5AE" stroke-dasharray="1 1"/>
|
||||
<path d="M84.623 42.501L-0.00038953 42.501" stroke="#9DA5AE" stroke-dasharray="1 1"/>
|
||||
</svg>
|
||||
<div class="e-con-select-type__icons__icon__subtitle"><?php echo esc_html__( 'Grid', 'elementor' ); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="e-view elementor-select-preset">
|
||||
<div class="elementor-select-preset-title"><?php echo_select_your_structure_title(); ?></div>
|
||||
<ul class="elementor-select-preset-list">
|
||||
<#
|
||||
const structures = [ 10, 20, 30, 40, 21, 22, 31, 32, 33, 50, 34, 60 ];
|
||||
|
||||
structures.forEach( ( structure ) => {
|
||||
const preset = elementor.presetsFactory.getPresetByStructure( structure ); #>
|
||||
|
||||
<li class="elementor-preset elementor-column elementor-col-16" data-structure="{{ structure }}">
|
||||
{{{ elementor.presetsFactory.getPresetSVG( preset.preset ).outerHTML }}}
|
||||
</li>
|
||||
<# } ); #>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="e-view e-con-select-preset">
|
||||
<div class="e-con-select-preset__title"><?php echo_select_your_structure_title(); ?></div>
|
||||
<div class="e-con-select-preset__list">
|
||||
<#
|
||||
elementor.presetsFactory.getContainerPresets().forEach( ( preset ) => {
|
||||
#>
|
||||
<div class="e-con-preset" data-preset="{{ preset }}">
|
||||
{{{ elementor.presetsFactory.generateContainerPreset( preset ) }}}
|
||||
</div>
|
||||
<#
|
||||
} );
|
||||
#>
|
||||
</div>
|
||||
</div>
|
||||
<div class="e-view e-con-shared-styles e-con-select-preset-grid">
|
||||
<div class="e-con-select-preset-grid__title"><?php echo_select_your_structure_title(); ?></div>
|
||||
<div class="e-con-select-preset-grid__list">
|
||||
<#
|
||||
elementor.presetsFactory.getContainerGridPresets().forEach( ( preset ) => {
|
||||
#>
|
||||
<div class="e-con-choose-grid-preset" data-structure="{{ preset }}">
|
||||
{{{ elementor.presetsFactory.generateContainerGridPreset( preset ) }}}
|
||||
</div>
|
||||
<#
|
||||
} );
|
||||
#>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<# } #>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-tag-controls-stack-empty">
|
||||
<?php echo esc_html__( 'This tag has no settings.', 'elementor' ); ?>
|
||||
</script>
|
||||
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Editor\Editor;
|
||||
use Elementor\Utils;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$is_editor_v2_active = Plugin::$instance->experiments->is_feature_active( Editor::EDITOR_V2_EXPERIMENT_NAME );
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-hotkeys">
|
||||
<# var ctrlLabel = environment.mac ? '⌘' : 'Ctrl'; #>
|
||||
<div id="elementor-hotkeys__content">
|
||||
|
||||
<div class="elementor-hotkeys__col">
|
||||
|
||||
<h3 class="elementor-hotkeys__header"><?php echo esc_html__( 'Actions', 'elementor' ); ?></h3>
|
||||
|
||||
<ul class="elementor-hotkeys__list">
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Undo', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>Z</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Redo', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>Z</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Copy', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>C</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Paste', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>V</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Paste Style', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>V</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Delete', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>Delete</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Duplicate', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>D</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Save', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>S</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="elementor-hotkeys__col">
|
||||
|
||||
<h3 class="elementor-hotkeys__header"><?php echo esc_html__( 'Panels', 'elementor' ); ?></h3>
|
||||
|
||||
<ul class="elementor-hotkeys__list">
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Finder', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>E</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Show / Hide Panel', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>P</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Site Settings', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>K</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php
|
||||
echo $is_editor_v2_active
|
||||
? esc_html__( 'Structure', 'elementor' )
|
||||
: esc_html__( 'Navigator', 'elementor' );
|
||||
?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>I</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Page Settings', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>Y</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'History', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>H</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'User Preferences', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>U</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="elementor-hotkeys__col">
|
||||
|
||||
<h3 class="elementor-hotkeys__header"><?php echo esc_html__( 'Go To', 'elementor' ); ?></h3>
|
||||
|
||||
<ul class="elementor-hotkeys__list">
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Responsive Mode', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>M</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Template Library', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>{{{ ctrlLabel }}}</kbd>
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>L</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php if ( Utils::has_pro() ) : ?>
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Notes', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>C</kbd>
|
||||
</div>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Keyboard Shortcuts', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>Shift</kbd>
|
||||
<kbd>?</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="elementor-hotkeys__item">
|
||||
<div class="elementor-hotkeys__item--label"><?php echo esc_html__( 'Quit', 'elementor' ); ?></div>
|
||||
<div class="elementor-hotkeys__item--shortcut">
|
||||
<kbd>Esc</kbd>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-templates-modal__header">
|
||||
<div class="elementor-templates-modal__header__logo-area"></div>
|
||||
<div class="elementor-templates-modal__header__menu-area"></div>
|
||||
<div class="elementor-templates-modal__header__items-area">
|
||||
<# if ( closeType ) { #>
|
||||
<div class="elementor-templates-modal__header__close elementor-templates-modal__header__close--{{{ closeType }}} elementor-templates-modal__header__item">
|
||||
<# if ( 'skip' === closeType ) { #>
|
||||
<span><?php echo esc_html__( 'Skip', 'elementor' ); ?></span>
|
||||
<# } #>
|
||||
<i class="eicon-close"
|
||||
aria-hidden="true"
|
||||
title="{{{ $e.components?.get( 'document/elements' )?.utils?.getTitleForLibraryClose() }}}"></i>
|
||||
<span class="elementor-screen-only">{{{ $e.components?.get( 'document/elements' )?.utils?.getTitleForLibraryClose() }}}</span>
|
||||
</div>
|
||||
<# } #>
|
||||
<div id="elementor-template-library-header-tools"></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-templates-modal__header__logo">
|
||||
<span class="elementor-templates-modal__header__logo__icon-wrapper e-logo-wrapper">
|
||||
<i class="eicon-elementor"></i>
|
||||
</span>
|
||||
<span class="elementor-templates-modal__header__logo__title">{{{ title }}}</span>
|
||||
</script>
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Editor\Editor;
|
||||
use Elementor\Utils;
|
||||
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$is_editor_v2_active = Plugin::$instance->experiments->is_feature_active( Editor::EDITOR_V2_EXPERIMENT_NAME );
|
||||
|
||||
$has_pro = Utils::has_pro();
|
||||
$elements_list_class = '';
|
||||
|
||||
if ( ! $has_pro ) {
|
||||
$promotion_data = [
|
||||
'text' => esc_html__( 'Access all Pro widgets', 'elementor' ),
|
||||
'url_label' => esc_html__( 'Upgrade Now', 'elementor' ),
|
||||
'url' => 'https://go.elementor.com/go-pro-structure-panel/',
|
||||
];
|
||||
|
||||
$promotion_data = Filtered_Promotions_Manager::get_filtered_promotion_data(
|
||||
$promotion_data,
|
||||
'elementor/navigator/custom_promotion',
|
||||
'url'
|
||||
);
|
||||
$elements_list_class = 'elementor-navigator-list__promotion';
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-navigator">
|
||||
<div id="elementor-navigator__header">
|
||||
<button id="elementor-navigator__toggle-all" data-elementor-action="expand">
|
||||
<i class="eicon-expand" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php esc_html__( 'Expand all elements', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<h2 id="elementor-navigator__header__title"><?php
|
||||
echo $is_editor_v2_active
|
||||
? esc_html__( 'Structure', 'elementor' )
|
||||
: esc_html__( 'Navigator', 'elementor' );
|
||||
?></h2>
|
||||
<button id="elementor-navigator__close">
|
||||
<i class="eicon-close" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php
|
||||
echo $is_editor_v2_active
|
||||
? esc_html__( 'Close structure', 'elementor' )
|
||||
: esc_html__( 'Close navigator', 'elementor' );
|
||||
?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="elementor-navigator__elements"
|
||||
<?php if ( ! empty( $elements_list_class ) ) : ?>
|
||||
class="<?php echo esc_attr( $elements_list_class ); ?>"
|
||||
<?php endif; ?>
|
||||
>
|
||||
</div>
|
||||
<div id="elementor-navigator__footer">
|
||||
<?php if ( ! $has_pro && ! empty( $promotion_data ) ) : ?>
|
||||
<div id="elementor-navigator__footer__promotion">
|
||||
<div class="elementor-navigator__promotion-text">
|
||||
<?php echo esc_attr( $promotion_data['text'] ); ?>.
|
||||
<a href="<?php echo esc_url( $promotion_data['url'] ); ?>" target="_blank" class="e-link-promotion"><?php echo esc_attr( $promotion_data['url_label'] ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="elementor-navigator__footer__resize-bar">
|
||||
<i class="eicon-ellipsis-h" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php
|
||||
echo $is_editor_v2_active
|
||||
? esc_html__( 'Resize structure', 'elementor' )
|
||||
: esc_html__( 'Resize navigator', 'elementor' );
|
||||
?></span>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-navigator__elements">
|
||||
<# if ( obj.elType ) { #>
|
||||
<div class="elementor-navigator__item" data-locked="{{ obj.isLocked ? 'true' : 'false' }}" tabindex="0">
|
||||
<div class="elementor-navigator__element__list-toggle">
|
||||
<i class="eicon-sort-down" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Show/hide inner elements', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<#
|
||||
if ( icon ) { #>
|
||||
<div class="elementor-navigator__element__element-type">
|
||||
<i class="{{{ icon }}}" aria-hidden="true"></i>
|
||||
</div>
|
||||
<# } #>
|
||||
<div class="elementor-navigator__element__title">
|
||||
<span class="elementor-navigator__element__title__text">{{{ title }}}</span>
|
||||
</div>
|
||||
<div class="elementor-navigator__element__toggle">
|
||||
<i class="eicon-preview-medium" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Show/hide Element', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="elementor-navigator__element__indicators"></div>
|
||||
</div>
|
||||
<# } #>
|
||||
<div class="elementor-navigator__elements"></div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-navigator__elements--empty">
|
||||
<div class="elementor-empty-view__title"><?php echo esc_html__( 'Empty', 'elementor' ); ?></div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-navigator__root--empty">
|
||||
<img class="elementor-nerd-box-icon" src="<?php echo ELEMENTOR_ASSETS_URL . 'images/information.svg'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" loading="lazy" alt="<?php echo esc_attr__( 'Elementor', 'elementor' ); ?>" />
|
||||
<div class="elementor-nerd-box-title"><?php echo esc_html__( 'Easy Navigation is Here!', 'elementor' ); ?></div>
|
||||
<div class="elementor-nerd-box-message"><?php echo esc_html__( 'Once you fill your page with content, this window will give you an overview display of all the page elements. This way, you can easily move around any section, column, or widget.', 'elementor' ); ?></div>
|
||||
</script>
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Utils;
|
||||
use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-panel-elements">
|
||||
<# if ( $e.components.get( 'document/elements' ).utils.allowAddingWidgets()) { #>
|
||||
<div id="elementor-panel-elements-navigation" class="elementor-panel-navigation">
|
||||
<button class="elementor-component-tab elementor-panel-navigation-tab" data-tab="categories"><?php echo esc_html__( 'Elements', 'elementor' ); ?></button>
|
||||
<button class="elementor-component-tab elementor-panel-navigation-tab" data-tab="global"><?php echo esc_html__( 'Globals', 'elementor' ); ?></button>
|
||||
</div>
|
||||
<# } #>
|
||||
<div id="elementor-panel-elements-search-area"></div>
|
||||
<div id="elementor-panel-elements-notice-area"></div>
|
||||
<div id="elementor-panel-elements-wrapper"></div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-categories">
|
||||
<div id="elementor-panel-categories"></div>
|
||||
<?php
|
||||
$get_pro_details = apply_filters( 'elementor/editor/panel/get_pro_details', [
|
||||
'link' => 'https://go.elementor.com/pro-widgets/',
|
||||
'message' => __( 'Get more with Elementor Pro', 'elementor' ),
|
||||
'button_text' => __( 'Upgrade Now', 'elementor' ),
|
||||
] );
|
||||
$promotion_data_sticky = [
|
||||
'url' => 'https://go.elementor.com/go-pro-sticky-widget-panel/',
|
||||
'message' => __( 'Access all Pro widgets.', 'elementor' ),
|
||||
'button_text' => __( 'Upgrade Now', 'elementor' ),
|
||||
];
|
||||
$promotion_data_sticky = Filtered_Promotions_Manager::get_filtered_promotion_data( $promotion_data_sticky, 'elementor/editor/panel/get_pro_details-sticky', 'url' );
|
||||
$has_pro = Utils::has_pro();
|
||||
?>
|
||||
<div id="elementor-panel-get-pro-elements" class="elementor-nerd-box">
|
||||
<img class="elementor-nerd-box-icon" src="<?php echo ELEMENTOR_ASSETS_URL . 'images/go-pro.svg'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" loading="lazy" alt="<?php echo esc_attr__( 'Upgrade', 'elementor' ); ?>" />
|
||||
<div class="elementor-nerd-box-message"><?php echo esc_html( $get_pro_details['message'] ); ?></div>
|
||||
<a class="elementor-button go-pro" target="_blank" href="<?php echo esc_url( $get_pro_details['link'] ); ?>"><?php echo esc_html( $get_pro_details['button_text'] ); ?></a>
|
||||
</div>
|
||||
<?php if ( ! $has_pro ) : ?>
|
||||
<div id="elementor-panel-get-pro-elements-sticky">
|
||||
<img class="elementor-nerd-box-icon" src="<?php echo ELEMENTOR_ASSETS_URL . 'images/unlock-sticky.svg'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" loading="lazy" alt="<?php echo esc_attr__( 'Upgrade', 'elementor' ); ?>"/>
|
||||
<div class="elementor-get-pro-sticky-message">
|
||||
<?php echo esc_html( $promotion_data_sticky['message'] ); ?>
|
||||
<a target="_blank" href="<?php echo esc_url( $promotion_data_sticky['url'] ); ?>"><?php echo esc_html( $promotion_data_sticky['button_text'] ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-elements-category">
|
||||
<button class="elementor-panel-heading elementor-panel-category-title">
|
||||
<span class="elementor-panel-heading-toggle">
|
||||
<i class="eicon" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="elementor-panel-heading-title">{{{ title }}}</span>
|
||||
<# if ( 'undefined' !== typeof promotion && promotion ) { #>
|
||||
<span class="elementor-panel-heading-promotion">
|
||||
<a href="{{{ promotion.url }}}" target="_blank">
|
||||
<i class="eicon-upgrade-crown"></i><?php echo esc_html__( 'Upgrade', 'elementor' ); ?>
|
||||
</a>
|
||||
</span>
|
||||
<# } #>
|
||||
</button>
|
||||
<div class="elementor-panel-category-items elementor-responsive-panel"></div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-elements-notice">
|
||||
<div class="elementor-panel-notice">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-element-search">
|
||||
<label for="elementor-panel-elements-search-input" class="screen-reader-text"><?php echo esc_html__( 'Search Widget:', 'elementor' ); ?></label>
|
||||
<input type="search" id="elementor-panel-elements-search-input" placeholder="<?php esc_attr_e( 'Search Widget...', 'elementor' ); ?>" autocomplete="off"/>
|
||||
<i class="eicon-search-bold" aria-hidden="true"></i>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-element-library-element">
|
||||
<button class="elementor-element">
|
||||
<# if ( false === obj.editable ) { #>
|
||||
<i class="eicon-lock"></i>
|
||||
<# } #>
|
||||
<div class="icon">
|
||||
<i class="{{ icon }}" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="title-wrapper">
|
||||
<div class="title">{{{ title }}}</div>
|
||||
</div>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-global">
|
||||
<div class="elementor-nerd-box">
|
||||
<img class="elementor-nerd-box-icon" src="<?php echo ELEMENTOR_ASSETS_URL . 'images/information.svg'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" loading="lazy" alt="<?php echo esc_attr__( 'Elementor', 'elementor' ); ?>" />
|
||||
<div class="elementor-nerd-box-title"><?php echo esc_html__( 'Meet Our Global Widget', 'elementor' ); ?></div>
|
||||
<div class="elementor-nerd-box-message"><?php echo esc_html__( 'With this feature, you can save a widget as global, then add it to multiple areas. All areas will be editable from one single place.', 'elementor' ); ?></div>
|
||||
<a class="elementor-button go-pro" target="_blank" href="https://go.elementor.com/pro-global/"><?php echo esc_html__( 'Upgrade Now', 'elementor' ); ?></a>
|
||||
</div>
|
||||
</script>
|
||||
345
wp-content/plugins/elementor/includes/editor-templates/panel.php
Normal file
345
wp-content/plugins/elementor/includes/editor-templates/panel.php
Normal file
@@ -0,0 +1,345 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Editor\Editor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$document = Plugin::$instance->documents->get( Plugin::$instance->editor->get_post_id() );
|
||||
$is_editor_v2_active = Plugin::$instance->experiments->is_feature_active( Editor::EDITOR_V2_EXPERIMENT_NAME );
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-panel">
|
||||
<div id="elementor-panel-state-loading">
|
||||
<i class="eicon-loading eicon-animation-spin"></i>
|
||||
</div>
|
||||
<header id="elementor-panel-header-wrapper"></header>
|
||||
<main id="elementor-panel-content-wrapper"></main>
|
||||
<footer id="elementor-panel-footer">
|
||||
<div class="elementor-panel-container"></div>
|
||||
</footer>
|
||||
<div id="elementor-mode-switcher"></div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-menu">
|
||||
<div id="elementor-panel-page-menu-content"></div>
|
||||
<# if ( elementor.config.document.panel.needHelpUrl ) { #>
|
||||
<div id="elementor-panel__editor__help">
|
||||
<a id="elementor-panel__editor__help__link" href="{{{ elementor.config.document.panel.needHelpUrl }}}" target="_blank">
|
||||
<?php echo esc_html__( 'Need Help', 'elementor' ); ?>
|
||||
<i class="eicon-help-o" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
<# } #>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-menu-group">
|
||||
<div class="elementor-panel-menu-group-title">{{{ title }}}</div>
|
||||
<div class="elementor-panel-menu-items"></div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-menu-item">
|
||||
<div class="elementor-panel-menu-item-icon">
|
||||
<i class="{{ icon }}"></i>
|
||||
</div>
|
||||
<# if ( 'undefined' === typeof type || 'link' !== type ) { #>
|
||||
<div class="elementor-panel-menu-item-title">{{{ title }}}</div>
|
||||
<# } else {
|
||||
let target = ( 'undefined' !== typeof newTab && newTab ) ? '_blank' : '_self';
|
||||
#>
|
||||
<a href="{{ link }}" target="{{ target }}"><div class="elementor-panel-menu-item-title">{{{ title }}}</div></a>
|
||||
<# } #>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-exit-dialog">
|
||||
<div><?php echo esc_html__( 'Now you can choose where you want to go on the site from the following options', 'elementor' ); ?></div>
|
||||
<div>
|
||||
<!-- translators: 1: Opening HTML <a> tag, 2: closing HTML <a> tag. -->
|
||||
<?php echo sprintf(
|
||||
esc_html__( 'Any time you can change the settings in %1$sUser Preferences%2$s', 'elementor' ),
|
||||
'<a id="user-preferences">',
|
||||
'</a>'
|
||||
); ?>
|
||||
</div>
|
||||
<select id="exit-to-preferences"></select> <!-- Adding options by JS -->
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-header">
|
||||
<button id="elementor-panel-header-menu-button" class="elementor-header-button">
|
||||
<i class="elementor-icon eicon-menu-bar tooltip-target" aria-hidden="true" data-tooltip="<?php esc_attr_e( 'Menu', 'elementor' ); ?>"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Menu', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<h2 id="elementor-panel-header-title"></h2>
|
||||
<# const extraClass = $e.components.get( 'document/elements' ).utils.allowAddingWidgets() ? '' : 'elementor-visibility-hidden'; #>
|
||||
<button id="elementor-panel-header-add-button" class="elementor-header-button {{{ extraClass }}}">
|
||||
<i class="elementor-icon eicon-apps tooltip-target" aria-hidden="true" data-tooltip="<?php esc_attr_e( 'Widgets Panel', 'elementor' ); ?>"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Widgets Panel', 'elementor' ); ?></span>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-footer-content">
|
||||
<button id="elementor-panel-footer-settings" class="elementor-panel-footer-tool elementor-leave-open tooltip-target" data-tooltip="<?php esc_attr_e( 'Settings', 'elementor' ); ?>">
|
||||
<i class="eicon-cog" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php printf( esc_html__( '%s Settings', 'elementor' ), esc_html( $document::get_title() ) ); ?></span>
|
||||
</button>
|
||||
<# if ( $e.components.get( 'document/elements' ).utils.showNavigator() ) { #>
|
||||
<button id="elementor-panel-footer-navigator" class="elementor-panel-footer-tool tooltip-target" data-tooltip="<?php
|
||||
echo $is_editor_v2_active
|
||||
? esc_attr__( 'Structure', 'elementor' )
|
||||
: esc_attr__( 'Navigator', 'elementor' );
|
||||
?>">
|
||||
<i class="eicon-navigator" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php
|
||||
echo $is_editor_v2_active
|
||||
? esc_html__( 'Structure', 'elementor' )
|
||||
: esc_html__( 'Navigator', 'elementor' );
|
||||
?></span>
|
||||
</button>
|
||||
<# } #>
|
||||
<button id="elementor-panel-footer-history" class="elementor-panel-footer-tool elementor-leave-open tooltip-target" data-tooltip="<?php esc_attr_e( 'History', 'elementor' ); ?>">
|
||||
<i class="eicon-history" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'History', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<button id="elementor-panel-footer-responsive" class="elementor-panel-footer-tool elementor-toggle-state tooltip-target" data-tooltip="<?php esc_attr_e( 'Responsive Mode', 'elementor' ); ?>">
|
||||
<i class="eicon-device-responsive" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only">
|
||||
<?php echo esc_html__( 'Responsive Mode', 'elementor' ); ?>
|
||||
</span>
|
||||
</button>
|
||||
<button id="elementor-panel-footer-saver-preview" class="elementor-panel-footer-tool tooltip-target" data-tooltip="<?php esc_attr_e( 'Preview Changes', 'elementor' ); ?>">
|
||||
<span id="elementor-panel-footer-saver-preview-label">
|
||||
<i class="eicon-preview-medium" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Preview Changes', 'elementor' ); ?></span>
|
||||
</span>
|
||||
</button>
|
||||
<div id="elementor-panel-footer-saver-publish" class="elementor-panel-footer-tool">
|
||||
<# const publishTitle = $e.components.get( 'document/elements' ).utils.getTitleForPublishButton(); #>
|
||||
<button id="elementor-panel-saver-button-publish" class="elementor-button e-primary elementor-disabled" title="{{{ publishTitle }}}">
|
||||
<span class="elementor-state-icon">
|
||||
<i class="eicon-loading eicon-animation-spin" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span id="elementor-panel-saver-button-publish-label">
|
||||
<?php echo esc_html__( 'Publish', 'elementor' ); ?>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="elementor-panel-footer-saver-options" class="elementor-panel-footer-tool elementor-toggle-state">
|
||||
<button id="elementor-panel-saver-button-save-options" class="elementor-button e-primary tooltip-target elementor-disabled" data-tooltip="<?php esc_attr_e( 'Save Options', 'elementor' ); ?>" data-tooltip-offset="7">
|
||||
<i class="eicon-chevron-right" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Save Options', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<div class="elementor-panel-footer-sub-menu-wrapper">
|
||||
<p class="elementor-last-edited-wrapper">
|
||||
<span class="elementor-state-icon">
|
||||
<i class="eicon-loading eicon-animation-spin" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span class="elementor-last-edited">
|
||||
</span>
|
||||
</p>
|
||||
<div class="elementor-panel-footer-sub-menu">
|
||||
<div id="elementor-panel-footer-sub-menu-item-save-draft" class="elementor-panel-footer-sub-menu-item elementor-disabled">
|
||||
<i class="elementor-icon eicon-save" aria-hidden="true"></i>
|
||||
<span class="elementor-title"><?php echo esc_html__( 'Save Draft', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div id="elementor-panel-footer-sub-menu-item-save-template" class="elementor-panel-footer-sub-menu-item">
|
||||
<i class="elementor-icon eicon-folder" aria-hidden="true"></i>
|
||||
<span class="elementor-title"><?php echo esc_html__( 'Save as Template', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<# if ( $e.components.get( 'document/elements' ).utils.showCopyAndShareButton() ) { #>
|
||||
<div id="elementor-panel-footer-sub-menu-item-copy-share-link" class="elementor-panel-footer-sub-menu-item">
|
||||
<i class="elementor-icon eicon-link" aria-hidden="true"></i>
|
||||
<span class="elementor-title"><?php echo esc_html__( 'Copy and Share Link', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<# } #>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-mode-switcher-content">
|
||||
<label for="elementor-mode-switcher-preview-input" id="elementor-mode-switcher-preview" title="<?php esc_attr_e( 'Hide Panel', 'elementor' ); ?>">
|
||||
<i class="eicon" aria-hidden="true" tabindex="0"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Hide Panel', 'elementor' ); ?></span>
|
||||
</label>
|
||||
<input id="elementor-mode-switcher-preview-input" type="checkbox">
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-editor-content">
|
||||
<div class="elementor-panel-navigation">
|
||||
<# _.each( elementData.tabs_controls, function( tabTitle, tabSlug ) {
|
||||
if ( 'content' !== tabSlug && ! elementor.userCan( 'design' ) ) {
|
||||
return;
|
||||
}
|
||||
$e.bc.ensureTab( 'panel/editor', tabSlug );
|
||||
#>
|
||||
<button class="elementor-component-tab elementor-panel-navigation-tab elementor-tab-control-{{ tabSlug }}" data-tab="{{ tabSlug }}">
|
||||
<span>{{{ tabTitle }}}</span>
|
||||
</button>
|
||||
<# } ); #>
|
||||
</div>
|
||||
<# if ( elementData.reload_preview ) { #>
|
||||
<div class="elementor-update-preview">
|
||||
<div class="elementor-update-preview-title"><?php echo esc_html__( 'Update changes to page', 'elementor' ); ?></div>
|
||||
<div class="elementor-update-preview-button-wrapper">
|
||||
<button class="elementor-update-preview-button elementor-button"><?php echo esc_html__( 'Apply', 'elementor' ); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<# } #>
|
||||
<div id="elementor-controls"></div>
|
||||
<# if ( elementData.help_url ) { #>
|
||||
<div id="elementor-panel__editor__help">
|
||||
<a id="elementor-panel__editor__help__link" href="{{ elementData.help_url }}" target="_blank">
|
||||
<?php echo esc_html__( 'Need Help', 'elementor' ); ?>
|
||||
<i class="eicon-help-o" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
<# } #>
|
||||
|
||||
<# if ( elementData.upsale_data && elementData.upsale_data.condition ) { #>
|
||||
<div class="elementor-nerd-box elementor-nerd-box--upsale">
|
||||
<# if ( elementData.upsale_data.image ) { #>
|
||||
<img class="elementor-nerd-box-icon" src="{{ elementData.upsale_data.image }}" loading="lazy" alt="{{ elementData.upsale_data.image_alt }}" />
|
||||
<# } #>
|
||||
<# if ( elementData.upsale_data.title ) { #>
|
||||
<div class="elementor-nerd-box-title">{{{ elementData.upsale_data.title }}}</div>
|
||||
<# } #>
|
||||
<# if ( elementData.upsale_data.description ) { #>
|
||||
<div class="elementor-nerd-box-message">{{{ elementData.upsale_data.description }}}</div>
|
||||
<# } #>
|
||||
<# if ( elementData.upsale_data.upgrade_url && elementData.upsale_data.upgrade_text ) { #>
|
||||
<a class="elementor-button go-pro" href="{{ elementData.upsale_data.upgrade_url }}" target="_blank">{{{ elementData.upsale_data.upgrade_text }}}</a>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-schemes-disabled">
|
||||
<img class="elementor-nerd-box-icon" src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/information.svg' ); ?>" loading="lazy" alt="<?php echo esc_attr__( 'Elementor', 'elementor' ); ?>" />
|
||||
<div class="elementor-nerd-box-title">{{{ '<?php echo esc_html__( '%s are disabled', 'elementor' ); // phpcs:ignore WordPress.WP.I18n.MissingTranslatorsComment ?>'.replace( '%s', disabledTitle ) }}}</div>
|
||||
<div class="elementor-nerd-box-message"><?php
|
||||
printf(
|
||||
/* translators: %1$s Link open tag, %2$s: Link close tag. */
|
||||
esc_html__( 'You can enable it from the %1$sElementor settings page%2$s.', 'elementor' ),
|
||||
'<a href="' . esc_url( Settings::get_url() ) . '" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?></div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-scheme-color-item">
|
||||
<div class="elementor-panel-scheme-color-picker-placeholder"></div>
|
||||
<div class="elementor-panel-scheme-color-title">{{{ title }}}</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-panel-scheme-typography-item">
|
||||
<div class="elementor-panel-heading">
|
||||
<div class="elementor-panel-heading-toggle">
|
||||
<i class="eicon" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="elementor-panel-heading-title">{{{ title }}}</div>
|
||||
</div>
|
||||
<div class="elementor-panel-scheme-typography-items elementor-panel-box-content">
|
||||
<?php
|
||||
$scheme_fields_keys = Group_Control_Typography::get_scheme_fields_keys();
|
||||
|
||||
$typography_group = Plugin::$instance->controls_manager->get_control_groups( 'typography' );
|
||||
$typography_fields = $typography_group->get_fields();
|
||||
|
||||
$scheme_fields = array_intersect_key( $typography_fields, array_flip( $scheme_fields_keys ) );
|
||||
|
||||
foreach ( $scheme_fields as $option_name => $option ) :
|
||||
?>
|
||||
<div class="elementor-panel-scheme-typography-item elementor-control elementor-control-type-select">
|
||||
<div class="elementor-panel-scheme-item-title elementor-control-title"><?php echo esc_html( $option['label'] ); ?></div>
|
||||
<div class="elementor-panel-scheme-typography-item-value elementor-control-input-wrapper">
|
||||
<?php if ( 'select' === $option['type'] ) : ?>
|
||||
<select name="<?php echo esc_attr( $option_name ); ?>" class="elementor-panel-scheme-typography-item-field">
|
||||
<?php foreach ( $option['options'] as $field_key => $field_value ) : ?>
|
||||
<option value="<?php echo esc_attr( $field_key ); ?>"><?php echo esc_html( $field_value ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php elseif ( 'font' === $option['type'] ) : ?>
|
||||
<select name="<?php echo esc_attr( $option_name ); ?>" class="elementor-panel-scheme-typography-item-field">
|
||||
<option value=""><?php echo esc_html__( 'Default', 'elementor' ); ?></option>
|
||||
<?php foreach ( Fonts::get_font_groups() as $group_type => $group_label ) : ?>
|
||||
<optgroup label="<?php echo esc_attr( $group_label ); ?>">
|
||||
<?php foreach ( Fonts::get_fonts_by_groups( [ $group_type ] ) as $font_title => $font_type ) : ?>
|
||||
<option value="<?php echo esc_attr( $font_title ); ?>"><?php echo esc_html( $font_title ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php elseif ( 'text' === $option['type'] ) : ?>
|
||||
<input name="<?php echo esc_attr( $option_name ); ?>" class="elementor-panel-scheme-typography-item-field" />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-control-responsive-switchers">
|
||||
<div class="elementor-control-responsive-switchers">
|
||||
<div class="elementor-control-responsive-switchers__holder">
|
||||
<#
|
||||
const activeBreakpoints = elementor.config.responsive.activeBreakpoints,
|
||||
devicesForDisplay = elementor.breakpoints.getActiveBreakpointsList( { largeToSmall: true, withDesktop: true } );
|
||||
|
||||
var devices = responsive.devices || devicesForDisplay;
|
||||
|
||||
_.each( devices, function( device ) {
|
||||
// The 'Desktop' label is made accessible via the global config because it needs to be translated.
|
||||
var deviceLabel = 'desktop' === device ? '<?php esc_html_e( 'Desktop', 'elementor' ); ?>' : activeBreakpoints[ device ].label,
|
||||
tooltipDir = "<?php echo is_rtl() ? 'e' : 'w'; ?>";
|
||||
#>
|
||||
<button class="elementor-responsive-switcher tooltip-target elementor-responsive-switcher-{{ device }}" data-device="{{ device }}" data-tooltip="{{ deviceLabel }}" data-tooltip-pos="{{ tooltipDir }}">
|
||||
<i class="{{ elementor.config.responsive.icons_map[ device ] }}" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only">{{ deviceLabel }}</span>
|
||||
</button>
|
||||
<# } );
|
||||
#>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-control-dynamic-switcher">
|
||||
<button class="elementor-control-dynamic-switcher elementor-control-unit-1" data-tooltip="<?php echo esc_attr__( 'Dynamic Tags', 'elementor' ); ?>">
|
||||
<i class="eicon-database" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Dynamic Tags', 'elementor' ); ?></span>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-control-element-color-picker">
|
||||
<button class="elementor-control-element-color-picker e-control-tool" data-tooltip="<?php echo esc_attr__( 'Color Sampler', 'elementor' ); ?>">
|
||||
<i class="eicon-eyedropper" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Color Sampler', 'elementor' ); ?></span>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-control-dynamic-cover">
|
||||
<div class="elementor-dynamic-cover__settings">
|
||||
<i class="eicon-{{ hasSettings ? 'wrench' : 'database' }}"></i>
|
||||
</div>
|
||||
<div class="elementor-dynamic-cover__title" title="{{{ title + ' ' + content }}}">{{{ title + ' ' + content }}}</div>
|
||||
<# if ( isRemovable ) { #>
|
||||
<div class="elementor-dynamic-cover__remove">
|
||||
<i class="eicon-close-circle"></i>
|
||||
</div>
|
||||
<# } #>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-dynamic-tags-promo">
|
||||
<div class="elementor-tags-list__teaser">
|
||||
<div class="elementor-tags-list__group-title elementor-tags-list__teaser-title">
|
||||
<i class="eicon-info-circle"></i><?php echo esc_html__( 'Elementor Dynamic Content', 'elementor' ); ?>
|
||||
</div>
|
||||
<div class="elementor-tags-list__teaser-text">
|
||||
<?php echo esc_html__( 'You’re missing out!', 'elementor' ); ?><br />
|
||||
<?php echo esc_html__( 'Get more dynamic capabilities by incorporating dozens of Elementor\'s native dynamic tags.', 'elementor' ); ?>
|
||||
<a href="{{{ promotionUrl }}}" class="elementor-tags-list__teaser-link" target="_blank">
|
||||
<?php echo esc_html__( 'Upgrade', 'elementor' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-repeater-row">
|
||||
<div class="elementor-repeater-row-tools">
|
||||
<# if ( itemActions.drag_n_drop ) { #>
|
||||
<button class="elementor-repeater-row-handle-sortable">
|
||||
<i class="eicon-ellipsis-v" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Drag & Drop', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<# } #>
|
||||
<button class="elementor-repeater-row-item-title"></button>
|
||||
<# if ( itemActions.duplicate ) { #>
|
||||
<button class="elementor-repeater-row-tool elementor-repeater-tool-duplicate">
|
||||
<i class="eicon-copy" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Duplicate', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<# }
|
||||
if ( itemActions.remove ) { #>
|
||||
<button class="elementor-repeater-row-tool elementor-repeater-tool-remove">
|
||||
<i class="eicon-close" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<# } #>
|
||||
</div>
|
||||
<div class="elementor-repeater-row-controls"></div>
|
||||
</script>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Breakpoints\Breakpoint;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// TODO: Use API data instead of this static array, once it is available.
|
||||
$active_breakpoints = Plugin::$instance->breakpoints->get_active_breakpoints();
|
||||
$active_devices = Plugin::$instance->breakpoints->get_active_devices_list( [ 'reverse' => true ] );
|
||||
|
||||
$breakpoint_classes_map = array_intersect_key( Plugin::$instance->breakpoints->get_responsive_icons_classes_map(), array_flip( $active_devices ) );
|
||||
?>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-templates-responsive-bar">
|
||||
<div id="e-responsive-bar__center">
|
||||
<div id="e-responsive-bar-switcher" class="e-responsive-bar--pipe">
|
||||
<?php foreach ( $active_devices as $device_key ) {
|
||||
if ( 'desktop' === $device_key ) {
|
||||
$tooltip_label = esc_html__( 'Desktop <br> Settings added for the base device will apply to all breakpoints unless edited', 'elementor' );
|
||||
} elseif ( 'widescreen' === $device_key ) {
|
||||
$tooltip_label = sprintf(
|
||||
/* translators: %d: Breakpoint screen size. */
|
||||
esc_html__( 'Widescreen <br> Settings added for the Widescreen device will apply to screen sizes %dpx and up', 'elementor' ),
|
||||
$active_breakpoints[ $device_key ]->get_value()
|
||||
);
|
||||
} else {
|
||||
$tooltip_label = sprintf(
|
||||
/* translators: %1$s: Device name, %2$s: Breakpoint screen size. */
|
||||
esc_html__( '%1$s <br> Settings added for the %1$s device will apply to %2$spx screens and down', 'elementor' ),
|
||||
$active_breakpoints[ $device_key ]->get_label(), $active_breakpoints[ $device_key ]->get_value()
|
||||
);
|
||||
}
|
||||
printf( '<label
|
||||
id="e-responsive-bar-switcher__option-%1$s"
|
||||
class="e-responsive-bar-switcher__option"
|
||||
for="e-responsive-bar-switch-%1$s"
|
||||
data-tooltip="%2$s">
|
||||
|
||||
<input type="radio" name="breakpoint" id="e-responsive-bar-switch-%1$s" value="%1$s">
|
||||
<i class="%3$s" aria-hidden="true"></i>
|
||||
<span class="screen-reader-text">%2$s</span>
|
||||
</label>', esc_attr( $device_key ), esc_attr( $tooltip_label ), esc_attr( $breakpoint_classes_map[ $device_key ] ) );
|
||||
} ?>
|
||||
</div>
|
||||
<div id="e-responsive-bar-scale">
|
||||
<div id="e-responsive-bar-scale__minus"></div>
|
||||
<div id="e-responsive-bar-scale__value-wrapper"><span id="e-responsive-bar-scale__value">100</span>%</div>
|
||||
<div id="e-responsive-bar-scale__plus"><i class="eicon-plus" aria-hidden="true"></i></div>
|
||||
<div id="e-responsive-bar-scale__reset"><i class="eicon-undo" aria-hidden="true"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="e-responsive-bar__end">
|
||||
<div id="e-responsive-bar__size-inputs-wrapper" class="e-flex e-align-items-center">
|
||||
<label for="e-responsive-bar__input-width">W</label>
|
||||
<input type="number" id="e-responsive-bar__input-width" class="e-responsive-bar__input-size" autocomplete="off">
|
||||
<label for="e-responsive-bar__input-height">H</label>
|
||||
<input type="number" id="e-responsive-bar__input-height" class="e-responsive-bar__input-size" autocomplete="off">
|
||||
</div>
|
||||
<button id="e-responsive-bar__settings-button" class="e-responsive-bar__button e-responsive-bar--pipe"
|
||||
data-tooltip="<?php echo esc_attr__( 'Manage Breakpoints', 'elementor' ); ?>">
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Settings', 'elementor' ); ?></span>
|
||||
<i class="eicon-cog" aria-hidden="true"></i>
|
||||
</button>
|
||||
<button id="e-responsive-bar__close-button" class="e-responsive-bar__button"
|
||||
data-tooltip="<?php echo esc_attr__( 'Close', 'elementor' ); ?>">
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Close', 'elementor' ); ?></span>
|
||||
<i class="eicon-close" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
@@ -0,0 +1,319 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<script type="text/template" id="tmpl-elementor-template-library-header-actions">
|
||||
<?php if ( User::is_current_user_can_upload_json() ) { ?>
|
||||
<div id="elementor-template-library-header-import" class="elementor-templates-modal__header__item">
|
||||
<i class="eicon-upload-circle-o" aria-hidden="true" title="<?php esc_attr_e( 'Import Template', 'elementor' ); ?>"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Import Template', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div id="elementor-template-library-header-sync" class="elementor-templates-modal__header__item">
|
||||
<i class="eicon-sync" aria-hidden="true" title="<?php esc_attr_e( 'Sync Library', 'elementor' ); ?>"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Sync Library', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div id="elementor-template-library-header-save" class="elementor-templates-modal__header__item">
|
||||
<i class="eicon-save-o" aria-hidden="true" title="<?php esc_attr_e( 'Save', 'elementor' ); ?>"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Save', 'elementor' ); ?></span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-header-menu">
|
||||
<# jQuery.each( tabs, ( tab, args ) => { #>
|
||||
<div class="elementor-component-tab elementor-template-library-menu-item" data-tab="{{{ tab }}}">{{{ args.title }}}</div>
|
||||
<# } ); #>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-header-preview">
|
||||
<div id="elementor-template-library-header-preview-insert-wrapper" class="elementor-templates-modal__header__item">
|
||||
{{{ elementor.templates.layout.getTemplateActionButton( obj ) }}}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-header-back">
|
||||
<i class="eicon-" aria-hidden="true"></i>
|
||||
<span><?php echo esc_html__( 'Back to Library', 'elementor' ); ?></span>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-loading">
|
||||
<div class="elementor-loader-wrapper">
|
||||
<div class="elementor-loader">
|
||||
<div class="elementor-loader-boxes">
|
||||
<div class="elementor-loader-box"></div>
|
||||
<div class="elementor-loader-box"></div>
|
||||
<div class="elementor-loader-box"></div>
|
||||
<div class="elementor-loader-box"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="elementor-loading-title"><?php echo esc_html__( 'Loading', 'elementor' ); ?></div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-templates">
|
||||
<#
|
||||
var activeSource = elementor.templates.getFilter('source');
|
||||
#>
|
||||
<div id="elementor-template-library-toolbar">
|
||||
<# if ( 'remote' === activeSource ) {
|
||||
var activeType = elementor.templates.getFilter('type');
|
||||
#>
|
||||
<div id="elementor-template-library-filter-toolbar-remote" class="elementor-template-library-filter-toolbar">
|
||||
<# if ( 'page' === activeType ) { #>
|
||||
<div id="elementor-template-library-order">
|
||||
<input type="radio" id="elementor-template-library-order-new" class="elementor-template-library-order-input" name="elementor-template-library-order" value="date">
|
||||
<label for="elementor-template-library-order-new" class="elementor-template-library-order-label"><?php echo esc_html__( 'New', 'elementor' ); ?></label>
|
||||
<input type="radio" id="elementor-template-library-order-trend" class="elementor-template-library-order-input" name="elementor-template-library-order" value="trendIndex">
|
||||
<label for="elementor-template-library-order-trend" class="elementor-template-library-order-label"><?php echo esc_html__( 'Trend', 'elementor' ); ?></label>
|
||||
<input type="radio" id="elementor-template-library-order-popular" class="elementor-template-library-order-input" name="elementor-template-library-order" value="popularityIndex">
|
||||
<label for="elementor-template-library-order-popular" class="elementor-template-library-order-label"><?php echo esc_html__( 'Popular', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<# } else if ( 'lb' !== activeType ) {
|
||||
var config = elementor.templates.getConfig( activeType );
|
||||
if ( config.categories ) { #>
|
||||
<div id="elementor-template-library-filter">
|
||||
<select id="elementor-template-library-filter-subtype" class="elementor-template-library-filter-select" data-elementor-filter="subtype">
|
||||
<option></option>
|
||||
<# config.categories.forEach( function( category ) {
|
||||
var selected = category === elementor.templates.getFilter( 'subtype' ) ? ' selected' : '';
|
||||
#>
|
||||
<option value="{{ category }}"{{{ selected }}}>{{{ category }}}</option>
|
||||
<# } ); #>
|
||||
</select>
|
||||
</div>
|
||||
<# }
|
||||
} #>
|
||||
<div id="elementor-template-library-my-favorites">
|
||||
<# var checked = elementor.templates.getFilter( 'favorite' ) ? ' checked' : ''; #>
|
||||
<input id="elementor-template-library-filter-my-favorites" type="checkbox"{{{ checked }}}>
|
||||
<label id="elementor-template-library-filter-my-favorites-label" for="elementor-template-library-filter-my-favorites">
|
||||
<i class="eicon" aria-hidden="true"></i>
|
||||
<?php echo esc_html__( 'My Favorites', 'elementor' ); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<# } else { #>
|
||||
<div id="elementor-template-library-filter-toolbar-local" class="elementor-template-library-filter-toolbar"></div>
|
||||
<# } #>
|
||||
<div id="elementor-template-library-filter-text-wrapper">
|
||||
<label for="elementor-template-library-filter-text" class="elementor-screen-only"><?php echo esc_html__( 'Search Templates:', 'elementor' ); ?></label>
|
||||
<input id="elementor-template-library-filter-text" placeholder="<?php echo esc_attr__( 'Search', 'elementor' ); ?>">
|
||||
<i class="eicon-search"></i>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( 'local' === activeSource ) { #>
|
||||
<div id="elementor-template-library-order-toolbar-local">
|
||||
<div class="elementor-template-library-local-column-1">
|
||||
<input type="radio" id="elementor-template-library-order-local-title" class="elementor-template-library-order-input" name="elementor-template-library-order-local" value="title" data-default-ordering-direction="asc">
|
||||
<label for="elementor-template-library-order-local-title" class="elementor-template-library-order-label"><?php echo esc_html__( 'Name', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<div class="elementor-template-library-local-column-2">
|
||||
<input type="radio" id="elementor-template-library-order-local-type" class="elementor-template-library-order-input" name="elementor-template-library-order-local" value="type" data-default-ordering-direction="asc">
|
||||
<label for="elementor-template-library-order-local-type" class="elementor-template-library-order-label"><?php echo esc_html__( 'Type', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<div class="elementor-template-library-local-column-3">
|
||||
<input type="radio" id="elementor-template-library-order-local-author" class="elementor-template-library-order-input" name="elementor-template-library-order-local" value="author" data-default-ordering-direction="asc">
|
||||
<label for="elementor-template-library-order-local-author" class="elementor-template-library-order-label"><?php echo esc_html__( 'Created By', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<div class="elementor-template-library-local-column-4">
|
||||
<input type="radio" id="elementor-template-library-order-local-date" class="elementor-template-library-order-input" name="elementor-template-library-order-local" value="date">
|
||||
<label for="elementor-template-library-order-local-date" class="elementor-template-library-order-label"><?php echo esc_html__( 'Creation Date', 'elementor' ); ?></label>
|
||||
</div>
|
||||
<div class="elementor-template-library-local-column-5">
|
||||
<div class="elementor-template-library-order-label"><?php echo esc_html__( 'Actions', 'elementor' ); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<# } #>
|
||||
<div id="elementor-template-library-templates-container"></div>
|
||||
<# if ( 'remote' === activeSource ) { #>
|
||||
<div id="elementor-template-library-footer-banner">
|
||||
<img class="elementor-nerd-box-icon" src="<?php
|
||||
Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/information.svg' );
|
||||
?>" loading="lazy" alt="<?php echo esc_attr__( 'Elementor', 'elementor' ); ?>" />
|
||||
<div class="elementor-excerpt"><?php echo esc_html__( 'Stay tuned! More awesome templates coming real soon.', 'elementor' ); ?></div>
|
||||
</div>
|
||||
<# } #>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-template-remote">
|
||||
<div class="elementor-template-library-template-body">
|
||||
<?php // 'lp' stands for Landing Pages Library type. ?>
|
||||
<# if ( 'page' === type || 'lp' === type ) { #>
|
||||
<div class="elementor-template-library-template-screenshot" style="background-image: url({{ thumbnail }});"></div>
|
||||
<# } else { #>
|
||||
<img src="{{ thumbnail }}" loading="lazy">
|
||||
<# } #>
|
||||
<div class="elementor-template-library-template-preview">
|
||||
<i class="eicon-zoom-in-bold" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="elementor-template-library-template-footer">
|
||||
{{{ elementor.templates.layout.getTemplateActionButton( obj ) }}}
|
||||
<div class="elementor-template-library-template-name">{{{ title }}} - {{{ type }}}</div>
|
||||
<div class="elementor-template-library-favorite">
|
||||
<input id="elementor-template-library-template-{{ template_id }}-favorite-input" class="elementor-template-library-template-favorite-input" type="checkbox"{{ favorite ? " checked" : "" }}>
|
||||
<label for="elementor-template-library-template-{{ template_id }}-favorite-input" class="elementor-template-library-template-favorite-label">
|
||||
<i class="eicon-heart-o" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Favorite', 'elementor' ); ?></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-template-local">
|
||||
<div class="elementor-template-library-template-name elementor-template-library-local-column-1">{{ title }}</div>
|
||||
<div class="elementor-template-library-template-meta elementor-template-library-template-type elementor-template-library-local-column-2">{{{ elementor.translate( type ) }}}</div>
|
||||
<div class="elementor-template-library-template-meta elementor-template-library-template-author elementor-template-library-local-column-3">{{{ author }}}</div>
|
||||
<div class="elementor-template-library-template-meta elementor-template-library-template-date elementor-template-library-local-column-4">{{{ human_date }}}</div>
|
||||
<div class="elementor-template-library-template-controls elementor-template-library-local-column-5">
|
||||
<div class="elementor-template-library-template-preview elementor-button e-btn-txt">
|
||||
<i class="eicon-preview-medium" aria-hidden="true"></i>
|
||||
<span class="elementor-template-library-template-control-title"><?php echo esc_html__( 'Preview', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<button class="elementor-template-library-template-action elementor-template-library-template-insert elementor-button e-primary e-btn-txt">
|
||||
<i class="eicon-file-download" aria-hidden="true"></i>
|
||||
<span class="elementor-button-title"><?php echo esc_html__( 'Insert', 'elementor' ); ?></span>
|
||||
</button>
|
||||
<div class="elementor-template-library-template-more-toggle">
|
||||
<i class="eicon-ellipsis-h" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'More actions', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="elementor-template-library-template-more">
|
||||
<div class="elementor-template-library-template-delete">
|
||||
<i class="eicon-trash-o" aria-hidden="true"></i>
|
||||
<span class="elementor-template-library-template-control-title"><?php echo esc_html__( 'Delete', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="elementor-template-library-template-export">
|
||||
<a href="{{ export_link }}">
|
||||
<i class="eicon-sign-out" aria-hidden="true"></i>
|
||||
<span class="elementor-template-library-template-control-title"><?php echo esc_html__( 'Export', 'elementor' ); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-insert-button">
|
||||
<a class="elementor-template-library-template-action elementor-template-library-template-insert elementor-button e-primary">
|
||||
<i class="eicon-file-download" aria-hidden="true"></i>
|
||||
<span class="elementor-button-title"><?php echo esc_html__( 'Insert', 'elementor' ); ?></span>
|
||||
</a>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-apply-ai-button">
|
||||
<a class="elementor-template-library-template-action elementor-template-library-template-apply-ai elementor-button e-primary">
|
||||
<i class="eicon-file-download" aria-hidden="true"></i>
|
||||
<span class="elementor-button-title"><?php echo esc_html__( 'Apply', 'elementor' ); ?></span>
|
||||
</a>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-insert-and-ai-variations-buttons">
|
||||
<a class="elementor-template-library-template-action elementor-template-library-template-insert elementor-button e-primary">
|
||||
<i class="eicon-file-download" aria-hidden="true"></i>
|
||||
<span class="elementor-button-title"><?php echo esc_html__( 'Insert', 'elementor' ); ?></span>
|
||||
</a>
|
||||
<a class="elementor-template-library-template-action elementor-template-library-template-generate-variation elementor-button e-btn-txt e-btn-txt-border">
|
||||
<i class="eicon-ai" aria-hidden="true"></i>
|
||||
<span class="elementor-button-title"><?php echo esc_html__( 'Generate Variations', 'elementor' ); ?></span>
|
||||
</a>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-upgrade-plan-button">
|
||||
<a
|
||||
class="elementor-template-library-template-action elementor-button go-pro"
|
||||
href="{{{ promotionLink }}}"
|
||||
target="_blank"
|
||||
>
|
||||
<span class="elementor-button-title">{{{ promotionText }}}</span>
|
||||
</a>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-save-template">
|
||||
<div class="elementor-template-library-blank-icon">
|
||||
<i class="eicon-library-upload" aria-hidden="true"></i>
|
||||
<span class="elementor-screen-only"><?php echo esc_html__( 'Save', 'elementor' ); ?></span>
|
||||
</div>
|
||||
<div class="elementor-template-library-blank-title">{{{ title }}}</div>
|
||||
<div class="elementor-template-library-blank-message">{{{ description }}}</div>
|
||||
<form id="elementor-template-library-save-template-form">
|
||||
<input type="hidden" name="post_id" value="<?php echo get_the_ID(); ?>">
|
||||
<input id="elementor-template-library-save-template-name" name="title" placeholder="<?php echo esc_attr__( 'Enter Template Name', 'elementor' ); ?>" required>
|
||||
<button id="elementor-template-library-save-template-submit" class="elementor-button e-primary">
|
||||
<span class="elementor-state-icon">
|
||||
<i class="eicon-loading eicon-animation-spin" aria-hidden="true"></i>
|
||||
</span>
|
||||
<?php echo esc_html__( 'Save', 'elementor' ); ?>
|
||||
</button>
|
||||
</form>
|
||||
<div class="elementor-template-library-blank-footer">
|
||||
<?php echo esc_html__( 'Want to learn more about the Elementor library?', 'elementor' ); ?>
|
||||
<a class="elementor-template-library-blank-footer-link" href="https://go.elementor.com/docs-library/" target="_blank"><?php echo esc_html__( 'Click here', 'elementor' ); ?></a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-import">
|
||||
<form id="elementor-template-library-import-form">
|
||||
<div class="elementor-template-library-blank-icon">
|
||||
<i class="eicon-library-upload" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="elementor-template-library-blank-title"><?php echo esc_html__( 'Import Template to Your Library', 'elementor' ); ?></div>
|
||||
<div class="elementor-template-library-blank-message"><?php echo esc_html__( 'Drag & drop your .JSON or .zip template file', 'elementor' ); ?></div>
|
||||
<div id="elementor-template-library-import-form-or"><?php echo esc_html__( 'or', 'elementor' ); ?></div>
|
||||
<label for="elementor-template-library-import-form-input" id="elementor-template-library-import-form-label" class="elementor-button e-primary"><?php echo esc_html__( 'Select File', 'elementor' ); ?></label>
|
||||
<input id="elementor-template-library-import-form-input" type="file" name="file" accept=".json,.zip" required/>
|
||||
<div class="elementor-template-library-blank-footer">
|
||||
<?php echo esc_html__( 'Want to learn more about the Elementor library?', 'elementor' ); ?>
|
||||
<a class="elementor-template-library-blank-footer-link" href="https://go.elementor.com/docs-library/" target="_blank"><?php echo esc_html__( 'Click here', 'elementor' ); ?></a>
|
||||
</div>
|
||||
</form>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-templates-empty">
|
||||
<div class="elementor-template-library-blank-icon">
|
||||
<img src="<?php Utils::print_unescaped_internal_string( ELEMENTOR_ASSETS_URL . 'images/no-search-results.svg' ); ?>" class="elementor-template-library-no-results" loading="lazy" />
|
||||
</div>
|
||||
<div class="elementor-template-library-blank-title"></div>
|
||||
<div class="elementor-template-library-blank-message"></div>
|
||||
<div class="elementor-template-library-blank-footer">
|
||||
<?php echo esc_html__( 'Want to learn more about the Elementor library?', 'elementor' ); ?>
|
||||
<a class="elementor-template-library-blank-footer-link" href="https://go.elementor.com/docs-library/" target="_blank"><?php echo esc_html__( 'Click here', 'elementor' ); ?></a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-preview">
|
||||
<iframe></iframe>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="tmpl-elementor-template-library-connect">
|
||||
<div id="elementor-template-library-connect-logo" class="e-logo-wrapper">
|
||||
<i class="eicon-elementor" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="elementor-template-library-blank-title">
|
||||
{{{ title }}}
|
||||
</div>
|
||||
<div class="elementor-template-library-blank-message">
|
||||
{{{ message }}}
|
||||
</div>
|
||||
<?php
|
||||
$url = Plugin::$instance->common->get_component( 'connect' )->get_app( 'library' )->get_admin_url( 'authorize', [
|
||||
'utm_source' => 'template-library',
|
||||
'utm_medium' => 'wp-dash',
|
||||
'utm_campaign' => 'library-connect',
|
||||
'utm_content' => '%%template_type%%', // will be replaced in the frontend
|
||||
] );
|
||||
?>
|
||||
<a id="elementor-template-library-connect__button" class="elementor-button e-primary" href="<?php echo esc_url( $url ); ?>">
|
||||
{{{ button }}}
|
||||
</a>
|
||||
<?php
|
||||
$base_images_url = $this->get_assets_base_url() . '/assets/images/library-connect/';
|
||||
|
||||
$images = [ 'left-1', 'left-2', 'right-1', 'right-2' ];
|
||||
|
||||
foreach ( $images as $image ) : ?>
|
||||
<img id="elementor-template-library-connect__background-image-<?php Utils::print_unescaped_internal_string( $image ); ?>" class="elementor-template-library-connect__background-image" src="<?php Utils::print_unescaped_internal_string( $base_images_url . $image ); ?>.png" draggable="false" loading="lazy" />
|
||||
<?php endforeach; ?>
|
||||
</script>
|
||||
1060
wp-content/plugins/elementor/includes/elements/column.php
Normal file
1060
wp-content/plugins/elementor/includes/elements/column.php
Normal file
File diff suppressed because it is too large
Load Diff
1845
wp-content/plugins/elementor/includes/elements/container.php
Normal file
1845
wp-content/plugins/elementor/includes/elements/container.php
Normal file
File diff suppressed because it is too large
Load Diff
158
wp-content/plugins/elementor/includes/elements/repeater.php
Normal file
158
wp-content/plugins/elementor/includes/elements/repeater.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor repeater element.
|
||||
*
|
||||
* Elementor repeater handler class is responsible for initializing the repeater.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Repeater extends Element_Base {
|
||||
|
||||
/**
|
||||
* Repeater counter.
|
||||
*
|
||||
* Holds the Repeater counter data. Default is `0`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var int Repeater counter.
|
||||
*/
|
||||
private static $counter = 0;
|
||||
|
||||
/**
|
||||
* Holds the count of the CURRENT instance
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* Repeater constructor.
|
||||
*
|
||||
* Initializing Elementor repeater element.
|
||||
*
|
||||
* @since 1.0.7
|
||||
* @access public
|
||||
*
|
||||
* @param array $data Optional. Element data. Default is an empty array.
|
||||
* @param array|null $args Optional. Element default arguments. Default is null.
|
||||
*
|
||||
*/
|
||||
public function __construct( array $data = [], array $args = null ) {
|
||||
self::$counter++;
|
||||
|
||||
$this->id = self::$counter;
|
||||
|
||||
parent::__construct( $data, $args );
|
||||
|
||||
$this->add_control(
|
||||
'_id',
|
||||
[
|
||||
'type' => Controls_Manager::HIDDEN,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repeater name.
|
||||
*
|
||||
* Retrieve the repeater name.
|
||||
*
|
||||
* @since 1.0.7
|
||||
* @access public
|
||||
*
|
||||
* @return string Repeater name.
|
||||
*/
|
||||
public function get_name() {
|
||||
return 'repeater-' . $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repeater type.
|
||||
*
|
||||
* Retrieve the repeater type.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @return string Repeater type.
|
||||
*/
|
||||
public static function get_type() {
|
||||
return 'repeater';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new repeater control to stack.
|
||||
*
|
||||
* Register a repeater control to allow the user to set/update data.
|
||||
*
|
||||
* This method should be used inside `register_controls()`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $id Repeater control ID.
|
||||
* @param array $args Repeater control arguments.
|
||||
* @param array $options Optional. Repeater control options. Default is an
|
||||
* empty array.
|
||||
*
|
||||
* @return bool True if repeater control added, False otherwise.
|
||||
*/
|
||||
public function add_control( $id, array $args, $options = [] ) {
|
||||
$current_tab = $this->get_current_tab();
|
||||
|
||||
if ( null !== $current_tab ) {
|
||||
$args = array_merge( $args, $current_tab );
|
||||
}
|
||||
|
||||
return parent::add_control( $id, $args, $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get repeater fields.
|
||||
*
|
||||
* Retrieve the fields from the current repeater control.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @deprecated 2.1.0 Use `get_controls()` method instead.
|
||||
* @access public
|
||||
*
|
||||
* @return array Repeater fields.
|
||||
*/
|
||||
public function get_fields() {
|
||||
_deprecated_function( __METHOD__, '2.1.0', 'get_controls()' );
|
||||
|
||||
return array_values( $this->get_controls() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default child type.
|
||||
*
|
||||
* Retrieve the repeater child type based on element data.
|
||||
*
|
||||
* Note that repeater does not support children, therefore it returns false.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @param array $element_data Element ID.
|
||||
*
|
||||
* @return false Repeater default child type or False if type not found.
|
||||
*/
|
||||
protected function _get_default_child_type( array $element_data ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function handle_control_position( array $args, $control_id, $overwrite ) {
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
1584
wp-content/plugins/elementor/includes/elements/section.php
Normal file
1584
wp-content/plugins/elementor/includes/elements/section.php
Normal file
File diff suppressed because it is too large
Load Diff
293
wp-content/plugins/elementor/includes/embed.php
Normal file
293
wp-content/plugins/elementor/includes/embed.php
Normal file
@@ -0,0 +1,293 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor embed.
|
||||
*
|
||||
* Elementor embed handler class is responsible for Elementor embed functionality.
|
||||
* The class holds the supported providers with their embed patters, and handles
|
||||
* their custom properties to create custom HTML with the embeded content.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class Embed {
|
||||
|
||||
/**
|
||||
* Provider match masks.
|
||||
*
|
||||
* Holds a list of supported providers with their URL structure in a regex format.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var array Provider URL structure regex.
|
||||
*/
|
||||
private static $provider_match_masks = [
|
||||
'youtube' => '/^.*(?:youtu\.be\/|youtube(?:-nocookie)?\.com\/(?:(?:watch)?\?(?:.*&)?vi?=|(?:embed|v|vi|user)\/))([^\?&\"\'>]+)/',
|
||||
'vimeo' => '/^.*vimeo\.com\/(?:[a-z]*\/)*([0-9]{6,11})[?]?.*/',
|
||||
'dailymotion' => '/^.*dailymotion.com\/(?:video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/',
|
||||
'videopress' => [
|
||||
'/^(?:http(?:s)?:\/\/)?videos\.files\.wordpress\.com\/([a-zA-Z\d]{8,})\//i',
|
||||
'/^(?:http(?:s)?:\/\/)?(?:www\.)?video(?:\.word)?press\.com\/(?:v|embed)\/([a-zA-Z\d]{8,})(.+)?/i',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Embed patterns.
|
||||
*
|
||||
* Holds a list of supported providers with their embed patters.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access private
|
||||
* @static
|
||||
*
|
||||
* @var array Embed patters.
|
||||
*/
|
||||
private static $embed_patterns = [
|
||||
'youtube' => 'https://www.youtube{NO_COOKIE}.com/embed/{VIDEO_ID}?feature=oembed',
|
||||
'vimeo' => 'https://player.vimeo.com/video/{VIDEO_ID}#t={TIME}',
|
||||
'dailymotion' => 'https://dailymotion.com/embed/video/{VIDEO_ID}',
|
||||
'videopress' => 'https://videopress.com/embed/{VIDEO_ID}',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get video properties.
|
||||
*
|
||||
* Retrieve the video properties for a given video URL.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param string $video_url Video URL.
|
||||
*
|
||||
* @return null|array The video properties, or null.
|
||||
*/
|
||||
public static function get_video_properties( $video_url ) {
|
||||
foreach ( self::$provider_match_masks as $provider => $match_mask ) {
|
||||
if ( ! is_array( $match_mask ) ) {
|
||||
$match_mask = [ $match_mask ];
|
||||
}
|
||||
|
||||
foreach ( $match_mask as $mask ) {
|
||||
if ( preg_match( $mask, $video_url, $matches ) ) {
|
||||
return [
|
||||
'provider' => $provider,
|
||||
'video_id' => $matches[1],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get embed URL.
|
||||
*
|
||||
* Retrieve the embed URL for a given video.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param string $video_url Video URL.
|
||||
* @param array $embed_url_params Optional. Embed parameters. Default is an
|
||||
* empty array.
|
||||
* @param array $options Optional. Embed options. Default is an
|
||||
* empty array.
|
||||
*
|
||||
* @return null|array The video properties, or null.
|
||||
*/
|
||||
public static function get_embed_url( $video_url, array $embed_url_params = [], array $options = [] ) {
|
||||
$video_properties = self::get_video_properties( $video_url );
|
||||
|
||||
if ( ! $video_properties ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$embed_pattern = self::$embed_patterns[ $video_properties['provider'] ];
|
||||
|
||||
$replacements = [
|
||||
'{VIDEO_ID}' => $video_properties['video_id'],
|
||||
];
|
||||
|
||||
if ( 'youtube' === $video_properties['provider'] ) {
|
||||
$replacements['{NO_COOKIE}'] = ! empty( $options['privacy'] ) ? '-nocookie' : '';
|
||||
} elseif ( 'vimeo' === $video_properties['provider'] ) {
|
||||
$time_text = '';
|
||||
|
||||
if ( ! empty( $options['start'] ) ) {
|
||||
$time_text = date( 'H\hi\ms\s', $options['start'] ); // PHPCS:Ignore WordPress.DateTime.RestrictedFunctions.date_date
|
||||
}
|
||||
|
||||
$replacements['{TIME}'] = $time_text;
|
||||
|
||||
/**
|
||||
* Handle Vimeo private videos
|
||||
*
|
||||
* Vimeo requires an additional parameter when displaying private/unlisted videos. It has two ways of
|
||||
* passing that parameter:
|
||||
* * as an endpoint - vimeo.com/{video_id}/{privacy_token}
|
||||
* OR
|
||||
* * as a GET parameter named `h` - vimeo.com/{video_id}?h={privacy_token}
|
||||
*
|
||||
* The following regex match looks for either of these methods in the Vimeo URL, and if it finds a privacy
|
||||
* token, it adds it to the embed params array as the `h` parameter (which is how Vimeo can receive it when
|
||||
* using Oembed).
|
||||
*/
|
||||
$h_param = [];
|
||||
preg_match( '/(?|(?:[\?|\&]h={1})([\w]+)|\d\/([\w]+))/', $video_url, $h_param );
|
||||
|
||||
if ( ! empty( $h_param ) ) {
|
||||
$embed_url_params['h'] = $h_param[1];
|
||||
}
|
||||
}
|
||||
|
||||
$embed_pattern = str_replace( array_keys( $replacements ), $replacements, $embed_pattern );
|
||||
|
||||
return add_query_arg( $embed_url_params, $embed_pattern );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get embed HTML.
|
||||
*
|
||||
* Retrieve the final HTML of the embedded URL.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param string $video_url Video URL.
|
||||
* @param array $embed_url_params Optional. Embed parameters. Default is an
|
||||
* empty array.
|
||||
* @param array $options Optional. Embed options. Default is an
|
||||
* empty array.
|
||||
* @param array $frame_attributes Optional. IFrame attributes. Default is an
|
||||
* empty array.
|
||||
*
|
||||
* @return string The embed HTML.
|
||||
*/
|
||||
public static function get_embed_html( $video_url, array $embed_url_params = [], array $options = [], array $frame_attributes = [] ) {
|
||||
$video_properties = self::get_video_properties( $video_url );
|
||||
|
||||
$default_frame_attributes = [
|
||||
'class' => 'elementor-video-iframe',
|
||||
'allowfullscreen',
|
||||
'allow' => 'clipboard-write',
|
||||
'title' => sprintf(
|
||||
/* translators: %s: Video provider */
|
||||
__( '%s Video Player', 'elementor' ),
|
||||
$video_properties['provider']
|
||||
),
|
||||
];
|
||||
|
||||
$video_embed_url = self::get_embed_url( $video_url, $embed_url_params, $options );
|
||||
if ( ! $video_embed_url ) {
|
||||
return null;
|
||||
}
|
||||
if ( ! isset( $options['lazy_load'] ) || ! $options['lazy_load'] ) {
|
||||
$default_frame_attributes['src'] = $video_embed_url;
|
||||
} else {
|
||||
$default_frame_attributes['data-lazy-load'] = $video_embed_url;
|
||||
}
|
||||
|
||||
if ( isset( $embed_url_params['autoplay'] ) ) {
|
||||
$default_frame_attributes['allow'] = 'autoplay';
|
||||
}
|
||||
|
||||
$frame_attributes = array_merge( $default_frame_attributes, $frame_attributes );
|
||||
|
||||
$attributes_for_print = [];
|
||||
|
||||
foreach ( $frame_attributes as $attribute_key => $attribute_value ) {
|
||||
$attribute_value = esc_attr( $attribute_value );
|
||||
|
||||
if ( is_numeric( $attribute_key ) ) {
|
||||
$attributes_for_print[] = $attribute_value;
|
||||
} else {
|
||||
$attributes_for_print[] = sprintf( '%1$s="%2$s"', $attribute_key, $attribute_value );
|
||||
}
|
||||
}
|
||||
|
||||
$attributes_for_print = implode( ' ', $attributes_for_print );
|
||||
|
||||
$iframe_html = "<iframe $attributes_for_print></iframe>";
|
||||
|
||||
/** This filter is documented in wp-includes/class-oembed.php */
|
||||
return apply_filters( 'oembed_result', $iframe_html, $video_url, $frame_attributes );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get oembed data from the cache.
|
||||
* if not exists in the cache it will fetch from provider and then save to the cache.
|
||||
*
|
||||
* @param $oembed_url
|
||||
* @param $cached_post_id
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public static function get_oembed_data( $oembed_url, $cached_post_id ) {
|
||||
$cached_oembed_data = json_decode( get_post_meta( $cached_post_id, '_elementor_oembed_cache', true ), true );
|
||||
|
||||
if ( isset( $cached_oembed_data[ $oembed_url ] ) ) {
|
||||
return $cached_oembed_data[ $oembed_url ];
|
||||
}
|
||||
|
||||
$normalize_oembed_data = self::fetch_oembed_data( $oembed_url );
|
||||
|
||||
if ( ! $cached_oembed_data ) {
|
||||
$cached_oembed_data = [];
|
||||
}
|
||||
|
||||
update_post_meta( $cached_post_id, '_elementor_oembed_cache', wp_json_encode( array_merge(
|
||||
$cached_oembed_data,
|
||||
[
|
||||
$oembed_url => $normalize_oembed_data,
|
||||
]
|
||||
) ) );
|
||||
|
||||
return $normalize_oembed_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch oembed data from oembed provider.
|
||||
*
|
||||
* @param $oembed_url
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public static function fetch_oembed_data( $oembed_url ) {
|
||||
$oembed_data = _wp_oembed_get_object()->get_data( $oembed_url );
|
||||
|
||||
if ( ! $oembed_data ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
'thumbnail_url' => $oembed_data->thumbnail_url,
|
||||
'title' => $oembed_data->title,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $oembed_url
|
||||
* @param null|string|int $cached_post_id
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public static function get_embed_thumbnail_html( $oembed_url, $cached_post_id = null ) {
|
||||
$oembed_data = self::get_oembed_data( $oembed_url, $cached_post_id );
|
||||
|
||||
if ( ! $oembed_data ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return '<div class="elementor-image">' . sprintf( '<img src="%1$s" alt="%2$s" title="%2$s" width="%3$s" loading="lazy" />', $oembed_data['thumbnail_url'], esc_attr( $oembed_data['title'] ), '100%' ) . '</div>';
|
||||
}
|
||||
}
|
||||
1888
wp-content/plugins/elementor/includes/fonts.php
Normal file
1888
wp-content/plugins/elementor/includes/fonts.php
Normal file
File diff suppressed because it is too large
Load Diff
1540
wp-content/plugins/elementor/includes/frontend.php
Normal file
1540
wp-content/plugins/elementor/includes/frontend.php
Normal file
File diff suppressed because it is too large
Load Diff
97
wp-content/plugins/elementor/includes/heartbeat.php
Normal file
97
wp-content/plugins/elementor/includes/heartbeat.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor heartbeat.
|
||||
*
|
||||
* Elementor heartbeat handler class is responsible for initializing Elementor
|
||||
* heartbeat. The class communicates with WordPress Heartbeat API while working
|
||||
* with Elementor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Heartbeat {
|
||||
|
||||
/**
|
||||
* Heartbeat received.
|
||||
*
|
||||
* Locks the Heartbeat response received when editing with Elementor.
|
||||
*
|
||||
* Fired by `heartbeat_received` filter.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $response The Heartbeat response.
|
||||
* @param array $data The `$_POST` data sent.
|
||||
*
|
||||
* @return array Heartbeat response received.
|
||||
*/
|
||||
public function heartbeat_received( $response, $data ) {
|
||||
if ( isset( $data['elementor_post_lock']['post_ID'] ) ) {
|
||||
$post_id = $data['elementor_post_lock']['post_ID'];
|
||||
$locked_user = Plugin::$instance->editor->get_locked_user( $post_id );
|
||||
|
||||
if ( ! $locked_user || ! empty( $data['elementor_force_post_lock'] ) ) {
|
||||
Plugin::$instance->editor->lock_post( $post_id );
|
||||
} else {
|
||||
$response['locked_user'] = $locked_user->display_name;
|
||||
}
|
||||
|
||||
/** @var Core\Common\Modules\Ajax\Module $ajax */
|
||||
$ajax = Plugin::$instance->common->get_component( 'ajax' );
|
||||
|
||||
$response['elementorNonce'] = $ajax->create_nonce();
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh nonces.
|
||||
*
|
||||
* Filter the nonces to send to the editor when editing with Elementor. Used
|
||||
* to refresh the nonce when the nonce expires while editing. This way the
|
||||
* user doesn't need to log-in again as Elementor fetches the new nonce from
|
||||
* the server using ajax.
|
||||
*
|
||||
* Fired by `wp_refresh_nonces` filter.
|
||||
*
|
||||
* @since 1.8.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $response The no-priv Heartbeat response object or array.
|
||||
* @param array $data The `$_POST` data sent.
|
||||
*
|
||||
* @return array Refreshed nonces.
|
||||
*/
|
||||
public function refresh_nonces( $response, $data ) {
|
||||
if ( isset( $data['elementor_post_lock']['post_ID'] ) ) {
|
||||
/** @var Core\Common\Modules\Ajax\Module $ajax */
|
||||
$ajax = Plugin::$instance->common->get_component( 'ajax' );
|
||||
|
||||
$response['elementor-refresh-nonces'] = [
|
||||
'elementorNonce' => $ajax->create_nonce(),
|
||||
'heartbeatNonce' => wp_create_nonce( 'heartbeat-nonce' ),
|
||||
];
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Heartbeat constructor.
|
||||
*
|
||||
* Initializing Elementor heartbeat.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function __construct() {
|
||||
add_filter( 'heartbeat_received', [ $this, 'heartbeat_received' ], 10, 2 );
|
||||
add_filter( 'wp_refresh_nonces', [ $this, 'refresh_nonces' ], 30, 2 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Group control interface.
|
||||
*
|
||||
* An interface for Elementor group control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
interface Group_Control_Interface {
|
||||
|
||||
/**
|
||||
* Get group control type.
|
||||
*
|
||||
* Retrieve the group control type.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function get_type();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor;
|
||||
|
||||
/**
|
||||
* Elementor has validation interface.
|
||||
*
|
||||
* @param array $control_data The value to validate.
|
||||
* @return bool True on valid, throws an exception on error.
|
||||
* @throws \Exception If validation fails.
|
||||
*/
|
||||
interface Has_Validation {
|
||||
public function validate( array $control_data ): bool;
|
||||
}
|
||||
@@ -0,0 +1,799 @@
|
||||
<?php
|
||||
/*
|
||||
* bfi_thumb - WP Image Resizer v1.3
|
||||
*
|
||||
* (c) 2013 Benjamin F. Intal / Gambit
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** Uses WP's Image Editor Class to resize and filter images
|
||||
*
|
||||
* @param $url string the local image URL to manipulate
|
||||
* @param $params array the options to perform on the image. Keys and values supported:
|
||||
* 'width' int pixels
|
||||
* 'height' int pixels
|
||||
* 'opacity' int 0-100
|
||||
* 'color' string hex-color #000000-#ffffff
|
||||
* 'grayscale' bool
|
||||
* 'negate' bool
|
||||
* 'crop' bool
|
||||
* 'crop_only' bool
|
||||
* 'crop_x' bool string
|
||||
* 'crop_y' bool string
|
||||
* 'crop_width' bool string
|
||||
* 'crop_height' bool string
|
||||
* 'quality' int 1-100
|
||||
* @param $single boolean, if false then an array of data will be returned
|
||||
*
|
||||
* @return string|array containing the url of the resized modified image
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
|
||||
|
||||
if ( ! defined( 'BFITHUMB_UPLOAD_DIR' ) ) {
|
||||
define( 'BFITHUMB_UPLOAD_DIR', 'elementor/thumbs' );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'bfi_thumb' ) ) {
|
||||
|
||||
function bfi_thumb( $url, $params = array(), $single = true ) {
|
||||
$class = BFI_Class_Factory::getNewestVersion( 'BFI_Thumb' );
|
||||
|
||||
return call_user_func( array( $class, 'thumb' ), $url, $params, $single );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class factory, this is to make sure that when multiple bfi_thumb scripts
|
||||
* are used (e.g. a plugin and a theme both use it), we always use the
|
||||
* latest version.
|
||||
*/
|
||||
if ( ! class_exists( 'BFI_Class_Factory' ) ) {
|
||||
|
||||
class BFI_Class_Factory {
|
||||
|
||||
public static $versions = array();
|
||||
public static $latestClass = array();
|
||||
|
||||
public static function addClassVersion( $baseClassName, $className, $version ) {
|
||||
if ( empty( self::$versions[ $baseClassName ] ) ) {
|
||||
self::$versions[ $baseClassName ] = array();
|
||||
}
|
||||
self::$versions[ $baseClassName ][] = array(
|
||||
'class' => $className,
|
||||
'version' => $version,
|
||||
);
|
||||
}
|
||||
|
||||
public static function getNewestVersion( $baseClassName ) {
|
||||
if ( empty( self::$latestClass[ $baseClassName ] ) ) {
|
||||
usort( self::$versions[ $baseClassName ], array( __CLASS__, "versionCompare" ) );
|
||||
self::$latestClass[ $baseClassName ] = self::$versions[ $baseClassName ][0]['class'];
|
||||
unset( self::$versions[ $baseClassName ] );
|
||||
}
|
||||
|
||||
return self::$latestClass[ $baseClassName ];
|
||||
}
|
||||
|
||||
public static function versionCompare( $a, $b ) {
|
||||
return version_compare( $a['version'], $b['version'] ) == 1 ? -1 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Change the default image editors
|
||||
*/
|
||||
add_filter( 'wp_image_editors', 'bfi_wp_image_editor' );
|
||||
|
||||
// Instead of using the default image editors, use our extended ones
|
||||
if ( ! function_exists( 'bfi_wp_image_editor' ) ) {
|
||||
|
||||
function bfi_wp_image_editor( $editorArray ) {
|
||||
// Make sure that we use the latest versions
|
||||
return array(
|
||||
BFI_Class_Factory::getNewestVersion( 'BFI_Image_Editor_GD' ),
|
||||
BFI_Class_Factory::getNewestVersion( 'BFI_Image_Editor_Imagick' ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Include the WP Image classes
|
||||
*/
|
||||
|
||||
require_once ABSPATH . WPINC . '/class-wp-image-editor.php';
|
||||
require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
|
||||
require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php';
|
||||
|
||||
|
||||
/*
|
||||
* Enhanced Imagemagick Image Editor
|
||||
*/
|
||||
|
||||
|
||||
if ( ! class_exists( 'BFI_Image_Editor_Imagick_1_3' ) ) {
|
||||
|
||||
BFI_Class_Factory::addClassVersion( 'BFI_Image_Editor_Imagick', 'BFI_Image_Editor_Imagick_1_3', '1.3' );
|
||||
|
||||
class BFI_Image_Editor_Imagick_1_3 extends WP_Image_Editor_Imagick {
|
||||
|
||||
/** Changes the opacity of the image
|
||||
*
|
||||
* @supports 3.5.1
|
||||
* @access public
|
||||
*
|
||||
* @param float $opacity (0.0-1.0)
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function opacity( $opacity ) {
|
||||
$opacity /= 100;
|
||||
|
||||
try {
|
||||
// From: http://stackoverflow.com/questions/3538851/php-imagick-setimageopacity-destroys-transparency-and-does-nothing
|
||||
// preserves transparency
|
||||
//$this->image->setImageOpacity($opacity);
|
||||
return $this->image->evaluateImage( Imagick::EVALUATE_MULTIPLY, $opacity, Imagick::CHANNEL_ALPHA );
|
||||
} catch ( Exception $e ) {
|
||||
return new WP_Error( 'image_opacity_error', $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/** Tints the image a different color
|
||||
*
|
||||
* @supports 3.5.1
|
||||
* @access public
|
||||
*
|
||||
* @param string hex color e.g. #ff00ff
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function colorize( $hexColor ) {
|
||||
try {
|
||||
return $this->image->colorizeImage( $hexColor, 1.0 );
|
||||
} catch ( Exception $e ) {
|
||||
return new WP_Error( 'image_colorize_error', $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/** Makes the image grayscale
|
||||
*
|
||||
* @supports 3.5.1
|
||||
* @access public
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function grayscale() {
|
||||
try {
|
||||
return $this->image->modulateImage( 100, 0, 100 );
|
||||
} catch ( Exception $e ) {
|
||||
return new WP_Error( 'image_grayscale_error', $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/** Negates the image
|
||||
*
|
||||
* @supports 3.5.1
|
||||
* @access public
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function negate() {
|
||||
try {
|
||||
return $this->image->negateImage( false );
|
||||
} catch ( Exception $e ) {
|
||||
return new WP_Error( 'image_negate_error', $e->getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Enhanced GD Image Editor
|
||||
*/
|
||||
|
||||
|
||||
if ( ! class_exists( 'BFI_Image_Editor_GD_1_3' ) ) {
|
||||
|
||||
BFI_Class_Factory::addClassVersion( 'BFI_Image_Editor_GD', 'BFI_Image_Editor_GD_1_3', '1.3' );
|
||||
|
||||
class BFI_Image_Editor_GD_1_3 extends WP_Image_Editor_GD {
|
||||
|
||||
/** Rotates current image counter-clockwise by $angle.
|
||||
* Ported from image-edit.php
|
||||
* Added presevation of alpha channels
|
||||
*
|
||||
* @since 3.5.0
|
||||
* @access public
|
||||
*
|
||||
* @param float $angle
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function rotate( $angle ) {
|
||||
if ( function_exists( 'imagerotate' ) ) {
|
||||
$rotated = imagerotate( $this->image, $angle, 0 );
|
||||
|
||||
// Add alpha blending
|
||||
imagealphablending( $rotated, true );
|
||||
imagesavealpha( $rotated, true );
|
||||
|
||||
if ( is_resource( $rotated ) ) {
|
||||
imagedestroy( $this->image );
|
||||
$this->image = $rotated;
|
||||
$this->update_size();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return new WP_Error( 'image_rotate_error', 'Image rotate failed.', $this->file );
|
||||
}
|
||||
|
||||
/** Changes the opacity of the image
|
||||
*
|
||||
* @supports 3.5.1
|
||||
* @access public
|
||||
*
|
||||
* @param float $opacity (0.0-1.0)
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function opacity( $opacity ) {
|
||||
$opacity /= 100;
|
||||
|
||||
$filtered = $this->_opacity( $this->image, $opacity );
|
||||
|
||||
if ( is_resource( $filtered ) ) {
|
||||
// imagedestroy($this->image);
|
||||
$this->image = $filtered;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return new WP_Error( 'image_opacity_error', 'Image opacity change failed.', $this->file );
|
||||
}
|
||||
|
||||
|
||||
// from: http://php.net/manual/en/function.imagefilter.php
|
||||
// params: image resource id, opacity (eg. 0.0-1.0)
|
||||
protected function _opacity( $image, $opacity ) {
|
||||
if ( ! function_exists( 'imagealphablending' ) || ! function_exists( 'imagecolorat' ) || ! function_exists( 'imagecolorallocatealpha' ) || ! function_exists( 'imagesetpixel' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// get image width and height
|
||||
$w = imagesx( $image );
|
||||
$h = imagesy( $image );
|
||||
|
||||
// turn alpha blending off
|
||||
imagealphablending( $image, false );
|
||||
|
||||
// find the most opaque pixel in the image (the one with the smallest alpha value)
|
||||
$minalpha = 127;
|
||||
for ( $x = 0; $x < $w; $x++ ) {
|
||||
for ( $y = 0; $y < $h; $y++ ) {
|
||||
$alpha = ( imagecolorat( $image, $x, $y ) >> 24 ) & 0xFF;
|
||||
if ( $alpha < $minalpha ) {
|
||||
$minalpha = $alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// loop through image pixels and modify alpha for each
|
||||
for ( $x = 0; $x < $w; $x++ ) {
|
||||
for ( $y = 0; $y < $h; $y++ ) {
|
||||
|
||||
// get current alpha value (represents the TANSPARENCY!)
|
||||
$colorxy = imagecolorat( $image, $x, $y );
|
||||
$alpha = ( $colorxy >> 24 ) & 0xFF;
|
||||
|
||||
// calculate new alpha
|
||||
if ( $minalpha !== 127 ) {
|
||||
$alpha = 127 + 127 * $opacity * ( $alpha - 127 ) / ( 127 - $minalpha );
|
||||
} else {
|
||||
$alpha += 127 * $opacity;
|
||||
}
|
||||
|
||||
// get the color index with new alpha
|
||||
$alphacolorxy = imagecolorallocatealpha( $image, ( $colorxy >> 16 ) & 0xFF, ( $colorxy >> 8 ) & 0xFF, $colorxy & 0xFF, $alpha );
|
||||
|
||||
// set pixel with the new color + opacity
|
||||
if ( ! imagesetpixel( $image, $x, $y, $alphacolorxy ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
imagesavealpha( $image, true );
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
/** Tints the image a different color
|
||||
*
|
||||
* @supports 3.5.1
|
||||
* @access public
|
||||
*
|
||||
* @param string hex color e.g. #ff00ff
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function colorize( $hexColor ) {
|
||||
if ( function_exists( 'imagefilter' ) && function_exists( 'imagesavealpha' ) && function_exists( 'imagealphablending' ) ) {
|
||||
|
||||
$hexColor = preg_replace( '#^\##', '', $hexColor );
|
||||
$r = hexdec( substr( $hexColor, 0, 2 ) );
|
||||
$g = hexdec( substr( $hexColor, 2, 2 ) );
|
||||
$b = hexdec( substr( $hexColor, 2, 2 ) );
|
||||
|
||||
imagealphablending( $this->image, false );
|
||||
if ( imagefilter( $this->image, IMG_FILTER_COLORIZE, $r, $g, $b, 0 ) ) {
|
||||
imagesavealpha( $this->image, true );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return new WP_Error( 'image_colorize_error', 'Image color change failed.', $this->file );
|
||||
}
|
||||
|
||||
/** Makes the image grayscale
|
||||
*
|
||||
* @supports 3.5.1
|
||||
* @access public
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function grayscale() {
|
||||
if ( function_exists( 'imagefilter' ) ) {
|
||||
if ( imagefilter( $this->image, IMG_FILTER_GRAYSCALE ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return new WP_Error( 'image_grayscale_error', 'Image grayscale failed.', $this->file );
|
||||
}
|
||||
|
||||
/** Negates the image
|
||||
*
|
||||
* @supports 3.5.1
|
||||
* @access public
|
||||
*
|
||||
* @return boolean|WP_Error
|
||||
*/
|
||||
public function negate() {
|
||||
if ( function_exists( 'imagefilter' ) ) {
|
||||
if ( imagefilter( $this->image, IMG_FILTER_NEGATE ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return new WP_Error( 'image_negate_error', 'Image negate failed.', $this->file );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Main Class
|
||||
*/
|
||||
if ( ! class_exists( 'BFI_Thumb_1_3' ) ) {
|
||||
|
||||
BFI_Class_Factory::addClassVersion( 'BFI_Thumb', 'BFI_Thumb_1_3', '1.3' );
|
||||
|
||||
class BFI_Thumb_1_3 {
|
||||
|
||||
/** Uses WP's Image Editor Class to resize and filter images
|
||||
* Inspired by: https://github.com/sy4mil/Aqua-Resizer/blob/master/aq_resizer.php
|
||||
*
|
||||
* @param $url string the local image URL to manipulate
|
||||
* @param $params array the options to perform on the image. Keys and values supported:
|
||||
* 'width' int pixels
|
||||
* 'height' int pixels
|
||||
* 'opacity' int 0-100
|
||||
* 'color' string hex-color #000000-#ffffff
|
||||
* 'grayscale' bool
|
||||
* 'crop' bool
|
||||
* 'negate' bool
|
||||
* 'crop_only' bool
|
||||
* 'crop_x' bool string
|
||||
* 'crop_y' bool string
|
||||
* 'crop_width' bool string
|
||||
* 'crop_height' bool string
|
||||
* 'quality' int 1-100
|
||||
* @param $single boolean, if false then an array of data will be returned
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
public static function thumb( $url, $params = array(), $single = true ) {
|
||||
extract( $params );
|
||||
|
||||
//validate inputs
|
||||
if ( ! $url ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$crop_only = isset( $crop_only ) ? $crop_only : false;
|
||||
|
||||
//define upload path & dir
|
||||
$upload_info = wp_upload_dir();
|
||||
$upload_dir = $upload_info['basedir'];
|
||||
$upload_url = $upload_info['baseurl'];
|
||||
$theme_url = get_template_directory_uri();
|
||||
$theme_dir = get_template_directory();
|
||||
|
||||
// find the path of the image. Perform 2 checks:
|
||||
// #1 check if the image is in the uploads folder
|
||||
if ( strpos( $url, $upload_url ) !== false ) {
|
||||
$rel_path = str_replace( $upload_url, '', $url );
|
||||
$img_path = $upload_dir . $rel_path;
|
||||
// #2 check if the image is in the current theme folder
|
||||
} else if ( strpos( $url, $theme_url ) !== false ) {
|
||||
$rel_path = str_replace( $theme_url, '', $url );
|
||||
$img_path = $theme_dir . $rel_path;
|
||||
}
|
||||
|
||||
// Fail if we can't find the image in our WP local directory
|
||||
if ( empty( $img_path ) ) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
// check if img path exists, and is an image indeed
|
||||
if ( ! @file_exists( $img_path ) || ! getimagesize( $img_path ) ) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
// This is the filename
|
||||
$basename = basename( $img_path );
|
||||
|
||||
//get image info
|
||||
$info = pathinfo( $img_path );
|
||||
$ext = $info['extension'];
|
||||
list( $orig_w, $orig_h ) = getimagesize( $img_path );
|
||||
|
||||
// support percentage dimensions. compute percentage based on
|
||||
// the original dimensions
|
||||
if ( isset( $width ) ) {
|
||||
if ( stripos( $width, '%' ) !== false ) {
|
||||
$width = (int) ( (float) str_replace( '%', '', $width ) / 100 * $orig_w );
|
||||
}
|
||||
}
|
||||
if ( isset( $height ) ) {
|
||||
if ( stripos( $height, '%' ) !== false ) {
|
||||
$height = (int) ( (float) str_replace( '%', '', $height ) / 100 * $orig_h );
|
||||
}
|
||||
}
|
||||
|
||||
// The only purpose of this is to determine the final width and height
|
||||
// without performing any actual image manipulation, which will be used
|
||||
// to check whether a resize was previously done.
|
||||
if ( isset( $width ) && $crop_only === false ) {
|
||||
//get image size after cropping
|
||||
$dims = image_resize_dimensions( $orig_w, $orig_h, $width, isset( $height ) ? $height : null, isset( $crop ) ? $crop : false );
|
||||
$dst_w = isset( $dims[4] ) ? $dims[4] : null;
|
||||
$dst_h = isset( $dims[5] ) ? $dims[5] : null;
|
||||
} else if ( $crop_only === true ) {
|
||||
// we don't want a resize,
|
||||
// but only a crop in the image
|
||||
|
||||
// get x position to start croping
|
||||
$src_x = ( isset( $crop_x ) ) ? $crop_x : 0;
|
||||
|
||||
// get y position to start croping
|
||||
$src_y = ( isset( $crop_y ) ) ? $crop_y : 0;
|
||||
|
||||
// width of the crop
|
||||
if ( isset( $crop_width ) ) {
|
||||
$src_w = $crop_width;
|
||||
} else if ( isset( $width ) ) {
|
||||
$src_w = $width;
|
||||
} else {
|
||||
$src_w = $orig_w;
|
||||
}
|
||||
|
||||
// height of the crop
|
||||
if ( isset( $crop_height ) ) {
|
||||
$src_h = $crop_height;
|
||||
} else if ( isset( $height ) ) {
|
||||
$src_h = $height;
|
||||
} else {
|
||||
$src_h = $orig_h;
|
||||
}
|
||||
|
||||
// set the width resize with the crop
|
||||
if ( isset( $crop_width ) && isset( $width ) ) {
|
||||
$dst_w = $width;
|
||||
} else {
|
||||
$dst_w = null;
|
||||
}
|
||||
|
||||
// set the height resize with the crop
|
||||
if ( isset( $crop_height ) && isset( $height ) ) {
|
||||
$dst_h = $height;
|
||||
} else {
|
||||
$dst_h = null;
|
||||
}
|
||||
|
||||
// allow percentages
|
||||
if ( isset( $dst_w ) ) {
|
||||
if ( stripos( $dst_w, '%' ) !== false ) {
|
||||
$dst_w = (int) ( (float) str_replace( '%', '', $dst_w ) / 100 * $orig_w );
|
||||
}
|
||||
}
|
||||
if ( isset( $dst_h ) ) {
|
||||
if ( stripos( $dst_h, '%' ) !== false ) {
|
||||
$dst_h = (int) ( (float) str_replace( '%', '', $dst_h ) / 100 * $orig_h );
|
||||
}
|
||||
}
|
||||
|
||||
$dims = image_resize_dimensions( $src_w, $src_h, $dst_w, $dst_h, false );
|
||||
$dst_w = $dims[4];
|
||||
$dst_h = $dims[5];
|
||||
|
||||
// Make the pos x and pos y work with percentages
|
||||
if ( stripos( $src_x, '%' ) !== false ) {
|
||||
$src_x = (int) ( (float) str_replace( '%', '', $width ) / 100 * $orig_w );
|
||||
}
|
||||
if ( stripos( $src_y, '%' ) !== false ) {
|
||||
$src_y = (int) ( (float) str_replace( '%', '', $height ) / 100 * $orig_h );
|
||||
}
|
||||
|
||||
// allow center to position crop start
|
||||
if ( $src_x === 'center' ) {
|
||||
$src_x = ( $orig_w - $src_w ) / 2;
|
||||
}
|
||||
if ( $src_y === 'center' ) {
|
||||
$src_y = ( $orig_h - $src_h ) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
// create the suffix for the saved file
|
||||
// we can use this to check whether we need to create a new file or just use an existing one.
|
||||
$suffix = (string) filemtime( $img_path ) . ( isset( $width ) ? str_pad( (string) $width, 5, '0', STR_PAD_LEFT ) : '00000' ) . ( isset( $height ) ? str_pad( (string) $height, 5, '0', STR_PAD_LEFT ) : '00000' ) . ( isset( $opacity ) ? str_pad( (string) $opacity, 3, '0', STR_PAD_LEFT ) : '100' ) . ( isset( $color ) ? str_pad( preg_replace( '#^\##', '', $color ), 8, '0', STR_PAD_LEFT ) : '00000000' ) . ( isset( $grayscale ) ? ( $grayscale ? '1' : '0' ) : '0' ) . ( isset( $crop ) ? ( $crop ? '1' : '0' ) : '0' ) . ( isset( $negate ) ? ( $negate ? '1' : '0' ) : '0' ) . ( isset( $crop_only ) ? ( $crop_only ? '1' : '0' ) : '0' ) . ( isset( $src_x ) ? str_pad( (string) $src_x, 5, '0', STR_PAD_LEFT ) : '00000' ) . ( isset( $src_y ) ? str_pad( (string) $src_y, 5, '0', STR_PAD_LEFT ) : '00000' ) . ( isset( $src_w ) ? str_pad( (string) $src_w, 5, '0', STR_PAD_LEFT ) : '00000' ) . ( isset( $src_h ) ? str_pad( (string) $src_h, 5, '0', STR_PAD_LEFT ) : '00000' ) . ( isset( $dst_w ) ? str_pad( (string) $dst_w, 5, '0', STR_PAD_LEFT ) : '00000' ) . ( isset( $dst_h ) ? str_pad( (string) $dst_h, 5, '0', STR_PAD_LEFT ) : '00000' ) . ( ( isset ( $quality ) && $quality > 0 && $quality <= 100 ) ? ( $quality ? (string) $quality : '0' ) : '0' );
|
||||
$suffix = self::base_convert_arbitrary( $suffix, 10, 36 );
|
||||
|
||||
// use this to check if cropped image already exists, so we can return that instead
|
||||
$dst_rel_path = str_replace( '.' . $ext, '', basename( $img_path ) );
|
||||
|
||||
// If opacity is set, change the image type to png
|
||||
if ( isset( $opacity ) ) {
|
||||
$ext = 'png';
|
||||
}
|
||||
|
||||
|
||||
// Create the upload subdirectory, this is where
|
||||
// we store all our generated images
|
||||
if ( defined( 'BFITHUMB_UPLOAD_DIR' ) ) {
|
||||
$upload_dir .= "/" . BFITHUMB_UPLOAD_DIR;
|
||||
$upload_url .= "/" . BFITHUMB_UPLOAD_DIR;
|
||||
} else {
|
||||
$upload_dir .= "/bfi_thumb";
|
||||
$upload_url .= "/bfi_thumb";
|
||||
}
|
||||
if ( ! is_dir( $upload_dir ) ) {
|
||||
wp_mkdir_p( $upload_dir );
|
||||
}
|
||||
|
||||
|
||||
// desination paths and urls
|
||||
$destfilename = "{$upload_dir}/{$dst_rel_path}-{$suffix}.{$ext}";
|
||||
|
||||
// The urls generated have lower case extensions regardless of the original case
|
||||
$ext = strtolower( $ext );
|
||||
$img_url = "{$upload_url}/{$dst_rel_path}-{$suffix}.{$ext}";
|
||||
|
||||
// if file exists, just return it
|
||||
if ( @file_exists( $destfilename ) && getimagesize( $destfilename ) ) {
|
||||
} else {
|
||||
// perform resizing and other filters
|
||||
$editor = wp_get_image_editor( $img_path );
|
||||
|
||||
if ( is_wp_error( $editor ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Perform image manipulations
|
||||
*/
|
||||
if ( $crop_only === false ) {
|
||||
if ( ( isset( $width ) && $width ) || ( isset( $height ) && $height ) ) {
|
||||
if ( is_wp_error( $editor->resize( isset( $width ) ? $width : null, isset( $height ) ? $height : null, isset( $crop ) ? $crop : false ) ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( is_wp_error( $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h ) ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $negate ) ) {
|
||||
if ( $negate ) {
|
||||
if ( is_wp_error( $editor->negate() ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $opacity ) ) {
|
||||
if ( is_wp_error( $editor->opacity( $opacity ) ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $grayscale ) ) {
|
||||
if ( $grayscale ) {
|
||||
if ( is_wp_error( $editor->grayscale() ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $color ) ) {
|
||||
if ( is_wp_error( $editor->colorize( $color ) ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// set the image quality (1-100) to save this image at
|
||||
if ( isset( $quality ) && $quality > 0 && $quality <= 100 && $ext != 'png' ) {
|
||||
$editor->set_quality( $quality );
|
||||
}
|
||||
|
||||
// save our new image
|
||||
$mime_type = isset( $opacity ) ? 'image/png' : null;
|
||||
$resized_file = $editor->save( $destfilename, $mime_type );
|
||||
}
|
||||
|
||||
//return the output
|
||||
if ( $single ) {
|
||||
$image = $img_url;
|
||||
} else {
|
||||
//array return
|
||||
$image = array(
|
||||
0 => $img_url,
|
||||
1 => isset( $dst_w ) ? $dst_w : $orig_w,
|
||||
2 => isset( $dst_h ) ? $dst_h : $orig_h,
|
||||
);
|
||||
}
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
/** Shortens a number into a base 36 string
|
||||
*
|
||||
* @param $number string a string of numbers to convert
|
||||
* @param $fromBase starting base
|
||||
* @param $toBase base to convert the number to
|
||||
*
|
||||
* @return string base converted characters
|
||||
*/
|
||||
protected static function base_convert_arbitrary( $number, $fromBase, $toBase ) {
|
||||
$digits = '0123456789abcdefghijklmnopqrstuvwxyz';
|
||||
$length = strlen( $number );
|
||||
$result = '';
|
||||
|
||||
$nibbles = array();
|
||||
for ( $i = 0; $i < $length; ++$i ) {
|
||||
$nibbles[ $i ] = strpos( $digits, $number[ $i ] );
|
||||
}
|
||||
|
||||
do {
|
||||
$value = 0;
|
||||
$newlen = 0;
|
||||
|
||||
for ( $i = 0; $i < $length; ++$i ) {
|
||||
|
||||
$value = $value * $fromBase + $nibbles[ $i ];
|
||||
|
||||
if ( $value >= $toBase ) {
|
||||
$nibbles[ $newlen++ ] = (int) ( $value / $toBase );
|
||||
$value %= $toBase;
|
||||
} else if ( $newlen > 0 ) {
|
||||
$nibbles[ $newlen++ ] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$length = $newlen;
|
||||
$result = $digits[ $value ] . $result;
|
||||
} while ( $newlen != 0 );
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// don't use the default resizer since we want to allow resizing to larger sizes (than the original one)
|
||||
// Parts are copied from media.php
|
||||
// Crop is always applied (just like timthumb)
|
||||
// Don't use this inside the admin since sometimes images in the media library get resized
|
||||
if ( ! is_admin() ) {
|
||||
add_filter( 'image_resize_dimensions', 'bfi_image_resize_dimensions', 10, 5 );
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'bfi_image_resize_dimensions' ) ) {
|
||||
function bfi_image_resize_dimensions( $payload, $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
|
||||
$aspect_ratio = $orig_w / $orig_h;
|
||||
|
||||
$new_w = $dest_w;
|
||||
$new_h = $dest_h;
|
||||
|
||||
if ( empty( $new_w ) || $new_w < 0 ) {
|
||||
$new_w = intval( $new_h * $aspect_ratio );
|
||||
}
|
||||
|
||||
if ( empty( $new_h ) || $new_h < 0 ) {
|
||||
$new_h = intval( $new_w / $aspect_ratio );
|
||||
}
|
||||
|
||||
$size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
|
||||
|
||||
$crop_w = round( $new_w / $size_ratio );
|
||||
$crop_h = round( $new_h / $size_ratio );
|
||||
$s_x = floor( ( $orig_w - $crop_w ) / 2 );
|
||||
$s_y = floor( ( $orig_h - $crop_h ) / 2 );
|
||||
|
||||
// Safe guard against super large or zero images which might cause 500 errors
|
||||
if ( $new_w > 5000 || $new_h > 5000 || $new_w <= 0 || $new_h <= 0 ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// the return array matches the parameters to imagecopyresampled()
|
||||
// int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
|
||||
return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function allows us to latch on WP image functions such as
|
||||
// the_post_thumbnail, get_image_tag and wp_get_attachment_image_src
|
||||
// so that you won't have to use the function bfi_thumb in order to do resizing.
|
||||
// To make this work, in the WP image functions, when specifying an
|
||||
// array for the image dimensions, add a 'bfi_thumb' => true to
|
||||
// the array, then add your normal $params arguments.
|
||||
//
|
||||
// e.g. the_post_thumbnail( array( 1024, 400, 'bfi_thumb' => true, 'grayscale' => true ) );
|
||||
add_filter( 'image_downsize', 'bfi_image_downsize', 1, 3 );
|
||||
|
||||
if ( ! function_exists( 'bfi_image_downsize' ) ) {
|
||||
function bfi_image_downsize( $out, $id, $size ) {
|
||||
if ( ! is_array( $size ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( ! array_key_exists( 'bfi_thumb', $size ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( empty( $size['bfi_thumb'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$img_url = wp_get_attachment_url( $id );
|
||||
|
||||
$params = $size;
|
||||
$params['width'] = $size[0];
|
||||
$params['height'] = $size[1];
|
||||
|
||||
$resized_img_url = bfi_thumb( $img_url, $params );
|
||||
|
||||
return array( $resized_img_url, $size[0], $size[1], false );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// TODO: _deprecated_file( __FILE__, '3.0.7', '\Elementor\Core\Base\BackgroundProcess\WP_Async_Request' );
|
||||
|
||||
if ( ! class_exists( 'WP_Async_Request' ) ) {
|
||||
abstract class WP_Async_Request extends \Elementor\Core\Base\BackgroundProcess\WP_Async_Request {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// TODO: _deprecated_file( __FILE__, '3.0.7', '\Elementor\Core\Base\BackgroundProcess\WP_Background_Process' );
|
||||
|
||||
if ( ! class_exists( 'WP_Background_Process' ) ) {
|
||||
abstract class WP_Background_Process extends \Elementor\Core\Base\BackgroundProcess\WP_Background_Process {
|
||||
}
|
||||
}
|
||||
383
wp-content/plugins/elementor/includes/maintenance-mode.php
Normal file
383
wp-content/plugins/elementor/includes/maintenance-mode.php
Normal file
@@ -0,0 +1,383 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\TemplateLibrary\Source_Local;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor maintenance mode.
|
||||
*
|
||||
* Elementor maintenance mode handler class is responsible for the Elementor
|
||||
* "Maintenance Mode" and the "Coming Soon" features.
|
||||
*
|
||||
* @since 1.4.0
|
||||
*/
|
||||
class Maintenance_Mode {
|
||||
|
||||
/**
|
||||
* The options prefix.
|
||||
*/
|
||||
const OPTION_PREFIX = 'elementor_maintenance_mode_';
|
||||
|
||||
/**
|
||||
* The maintenance mode.
|
||||
*/
|
||||
const MODE_MAINTENANCE = 'maintenance';
|
||||
|
||||
/**
|
||||
* The coming soon mode.
|
||||
*/
|
||||
const MODE_COMING_SOON = 'coming_soon';
|
||||
|
||||
/**
|
||||
* Get elementor option.
|
||||
*
|
||||
* Retrieve elementor option from the database.
|
||||
*
|
||||
* @since 1.4.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param string $option Option name. Expected to not be SQL-escaped.
|
||||
* @param mixed $default Optional. Default value to return if the option
|
||||
* does not exist. Default is false.
|
||||
*
|
||||
* @return bool False if value was not updated and true if value was updated.
|
||||
*/
|
||||
public static function get( $option, $default = false ) {
|
||||
return get_option( self::OPTION_PREFIX . $option, $default );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set elementor option.
|
||||
*
|
||||
* Update elementor option in the database.
|
||||
*
|
||||
* @since 1.4.0
|
||||
* @access public
|
||||
* @static
|
||||
*
|
||||
* @param string $option Option name. Expected to not be SQL-escaped.
|
||||
* @param mixed $value Option value. Must be serializable if non-scalar.
|
||||
* Expected to not be SQL-escaped.
|
||||
*
|
||||
* @return bool False if value was not updated and true if value was updated.
|
||||
*/
|
||||
public static function set( $option, $value ) {
|
||||
return update_option( self::OPTION_PREFIX . $option, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Body class.
|
||||
*
|
||||
* Add "Maintenance Mode" CSS classes to the body tag.
|
||||
*
|
||||
* Fired by `body_class` filter.
|
||||
*
|
||||
* @since 1.4.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $classes An array of body classes.
|
||||
*
|
||||
* @return array An array of body classes.
|
||||
*/
|
||||
public function body_class( $classes ) {
|
||||
$classes[] = 'elementor-maintenance-mode';
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Template redirect.
|
||||
*
|
||||
* Redirect to the "Maintenance Mode" template.
|
||||
*
|
||||
* Fired by `template_redirect` action.
|
||||
*
|
||||
* @since 1.4.0
|
||||
* @access public
|
||||
*/
|
||||
public function template_redirect() {
|
||||
if ( Plugin::$instance->preview->is_preview_mode() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = wp_get_current_user();
|
||||
|
||||
$exclude_mode = self::get( 'exclude_mode', [] );
|
||||
|
||||
$is_login_page = false;
|
||||
|
||||
/**
|
||||
* Is login page
|
||||
*
|
||||
* Filters whether the maintenance mode displaying the login page or a regular page.
|
||||
*
|
||||
* @since 1.0.4
|
||||
*
|
||||
* @param bool $is_login_page Whether its a login page.
|
||||
*/
|
||||
$is_login_page = apply_filters( 'elementor/maintenance_mode/is_login_page', $is_login_page );
|
||||
|
||||
if ( $is_login_page ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'logged_in' === $exclude_mode && is_user_logged_in() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'custom' === $exclude_mode ) {
|
||||
$exclude_roles = self::get( 'exclude_roles', [] );
|
||||
$user_roles = $user->roles;
|
||||
|
||||
if ( is_multisite() && is_super_admin() ) {
|
||||
$user_roles[] = 'super_admin';
|
||||
}
|
||||
|
||||
$compare_roles = array_intersect( $user_roles, $exclude_roles );
|
||||
|
||||
if ( ! empty( $compare_roles ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'body_class', [ $this, 'body_class' ] );
|
||||
|
||||
if ( 'maintenance' === self::get( 'mode' ) ) {
|
||||
$protocol = wp_get_server_protocol();
|
||||
header( "$protocol 503 Service Unavailable", true, 503 );
|
||||
header( 'Content-Type: text/html; charset=utf-8' );
|
||||
header( 'Retry-After: 600' );
|
||||
}
|
||||
|
||||
// Setup global post for Elementor\frontend so `_has_elementor_in_page = true`.
|
||||
$GLOBALS['post'] = get_post( self::get( 'template_id' ) ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||
|
||||
// Set the template as `$wp_query->current_object` for `wp_title` and etc.
|
||||
query_posts( [
|
||||
'p' => self::get( 'template_id' ),
|
||||
'post_type' => Source_Local::CPT,
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register settings fields.
|
||||
*
|
||||
* Adds new "Maintenance Mode" settings fields to Elementor admin page.
|
||||
*
|
||||
* The method need to receive the an instance of the Tools settings page
|
||||
* to add the new maintenance mode functionality.
|
||||
*
|
||||
* Fired by `elementor/admin/after_create_settings/{$page_id}` action.
|
||||
*
|
||||
* @since 1.4.0
|
||||
* @access public
|
||||
*
|
||||
* @param Tools $tools An instance of the Tools settings page.
|
||||
*/
|
||||
public function register_settings_fields( Tools $tools ) {
|
||||
$templates = Plugin::$instance->templates_manager->get_source( 'local' )->get_items( [
|
||||
'type' => 'page',
|
||||
] );
|
||||
|
||||
$templates_options = [];
|
||||
|
||||
foreach ( $templates as $template ) {
|
||||
$templates_options[ $template['template_id'] ] = esc_html( $template['title'] );
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
$this->print_template_description();
|
||||
|
||||
$template_description = ob_get_clean();
|
||||
|
||||
$tools->add_tab(
|
||||
'maintenance_mode', [
|
||||
'label' => esc_html__( 'Maintenance Mode', 'elementor' ),
|
||||
'sections' => [
|
||||
'maintenance_mode' => [
|
||||
'callback' => function() {
|
||||
echo '<h2>' . esc_html__( 'Maintenance Mode', 'elementor' ) . '</h2>';
|
||||
echo '<p>' . esc_html__( 'Set your entire website as MAINTENANCE MODE, meaning the site is offline temporarily for maintenance, or set it as COMING SOON mode, meaning the site is offline until it is ready to be launched.', 'elementor' ) . '</p>';
|
||||
},
|
||||
'fields' => [
|
||||
'maintenance_mode_mode' => [
|
||||
'label' => esc_html__( 'Choose Mode', 'elementor' ),
|
||||
'field_args' => [
|
||||
'type' => 'select',
|
||||
'std' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'Disabled', 'elementor' ),
|
||||
self::MODE_COMING_SOON => esc_html__( 'Coming Soon', 'elementor' ),
|
||||
self::MODE_MAINTENANCE => esc_html__( 'Maintenance', 'elementor' ),
|
||||
],
|
||||
'desc' => '<div class="elementor-maintenance-mode-description" data-value="" style="display: none">' .
|
||||
esc_html__( 'Choose between Coming Soon mode (returning HTTP 200 code) or Maintenance Mode (returning HTTP 503 code).', 'elementor' ) .
|
||||
'</div>' .
|
||||
'<div class="elementor-maintenance-mode-description" data-value="maintenance" style="display: none">' .
|
||||
esc_html__( 'Maintenance Mode returns HTTP 503 code, so search engines know to come back a short time later. It is not recommended to use this mode for more than a couple of days.', 'elementor' ) .
|
||||
'</div>' .
|
||||
'<div class="elementor-maintenance-mode-description" data-value="coming_soon" style="display: none">' .
|
||||
esc_html__( 'Coming Soon returns HTTP 200 code, meaning the site is ready to be indexed.', 'elementor' ) .
|
||||
'</div>',
|
||||
],
|
||||
],
|
||||
'maintenance_mode_exclude_mode' => [
|
||||
'label' => esc_html__( 'Who Can Access', 'elementor' ),
|
||||
'field_args' => [
|
||||
'class' => 'elementor-default-hide',
|
||||
'type' => 'select',
|
||||
'std' => 'logged_in',
|
||||
'options' => [
|
||||
'logged_in' => esc_html__( 'Logged In', 'elementor' ),
|
||||
'custom' => esc_html__( 'Custom', 'elementor' ),
|
||||
],
|
||||
],
|
||||
],
|
||||
'maintenance_mode_exclude_roles' => [
|
||||
'label' => esc_html__( 'Roles', 'elementor' ),
|
||||
'field_args' => [
|
||||
'class' => 'elementor-default-hide',
|
||||
'type' => 'checkbox_list_roles',
|
||||
],
|
||||
'setting_args' => [ __NAMESPACE__ . '\Settings_Validations', 'checkbox_list' ],
|
||||
],
|
||||
'maintenance_mode_template_id' => [
|
||||
'label' => esc_html__( 'Choose Template', 'elementor' ),
|
||||
'field_args' => [
|
||||
'class' => 'elementor-default-hide',
|
||||
'type' => 'select',
|
||||
'std' => '',
|
||||
'show_select' => true,
|
||||
'options' => $templates_options,
|
||||
'desc' => $template_description,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add menu in admin bar.
|
||||
*
|
||||
* Adds "Maintenance Mode" items to the WordPress admin bar.
|
||||
*
|
||||
* Fired by `admin_bar_menu` filter.
|
||||
*
|
||||
* @since 1.4.0
|
||||
* @access public
|
||||
*
|
||||
* @param \WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference.
|
||||
*/
|
||||
public function add_menu_in_admin_bar( \WP_Admin_Bar $wp_admin_bar ) {
|
||||
$wp_admin_bar->add_node( [
|
||||
'id' => 'elementor-maintenance-on',
|
||||
'title' => esc_html__( 'Maintenance Mode ON', 'elementor' ),
|
||||
'href' => Tools::get_url() . '#tab-maintenance_mode',
|
||||
] );
|
||||
|
||||
$document = Plugin::$instance->documents->get( self::get( 'template_id' ) );
|
||||
|
||||
$wp_admin_bar->add_node( [
|
||||
'id' => 'elementor-maintenance-edit',
|
||||
'parent' => 'elementor-maintenance-on',
|
||||
'title' => esc_html__( 'Edit Template', 'elementor' ),
|
||||
'href' => $document ? $document->get_edit_url() : '',
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Print style.
|
||||
*
|
||||
* Adds custom CSS to the HEAD html tag. The CSS that emphasise the maintenance
|
||||
* mode with red colors.
|
||||
*
|
||||
* Fired by `admin_head` and `wp_head` filters.
|
||||
*
|
||||
* @since 1.4.0
|
||||
* @access public
|
||||
*/
|
||||
public function print_style() {
|
||||
?>
|
||||
<style>#wp-admin-bar-elementor-maintenance-on > a { background-color: #dc3232; }
|
||||
#wp-admin-bar-elementor-maintenance-on > .ab-item:before { content: "\f160"; top: 2px; }</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function on_update_mode( $old_value, $value ) {
|
||||
if ( $old_value !== $value ) {
|
||||
do_action( 'elementor/maintenance_mode/mode_changed', $old_value, $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maintenance mode constructor.
|
||||
*
|
||||
* Initializing Elementor maintenance mode.
|
||||
*
|
||||
* @since 1.4.0
|
||||
* @access public
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'update_option_elementor_maintenance_mode_mode', [ $this, 'on_update_mode' ], 10, 2 );
|
||||
|
||||
$is_enabled = (bool) self::get( 'mode' ) && (bool) self::get( 'template_id' );
|
||||
|
||||
if ( is_admin() ) {
|
||||
$page_id = Tools::PAGE_ID;
|
||||
add_action( "elementor/admin/after_create_settings/{$page_id}", [ $this, 'register_settings_fields' ] );
|
||||
}
|
||||
|
||||
if ( ! $is_enabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_action( 'admin_bar_menu', [ $this, 'add_menu_in_admin_bar' ], 300 );
|
||||
add_action( 'admin_head', [ $this, 'print_style' ] );
|
||||
add_action( 'wp_head', [ $this, 'print_style' ] );
|
||||
|
||||
// Priority = 11 that is *after* WP default filter `redirect_canonical` in order to avoid redirection loop.
|
||||
add_action( 'template_redirect', [ $this, 'template_redirect' ], 11 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Print Template Description
|
||||
*
|
||||
* Prints the template description
|
||||
*
|
||||
* @since 2.2.0
|
||||
* @access private
|
||||
*/
|
||||
private function print_template_description() {
|
||||
$template_id = self::get( 'template_id' );
|
||||
|
||||
$edit_url = '';
|
||||
|
||||
if ( $template_id && get_post( $template_id ) ) {
|
||||
$edit_url = Plugin::$instance->documents->get( $template_id )->get_edit_url();
|
||||
}
|
||||
|
||||
?>
|
||||
<a target="_blank" class="elementor-edit-template" style="display: none" href="<?php echo esc_url( $edit_url ); ?>"><?php echo esc_html__( 'Edit Template', 'elementor' ); ?></a>
|
||||
<div class="elementor-maintenance-mode-error"><?php echo esc_html__( 'To enable maintenance mode you have to set a template for the maintenance mode page.', 'elementor' ); ?></div>
|
||||
<div class="elementor-maintenance-mode-error">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s Link open tag, %2$s: Link close tag. */
|
||||
esc_html__( 'Select one or go ahead and %1$screate one%2$s now.', 'elementor' ),
|
||||
'<a target="_blank" href="' . esc_url( admin_url( 'post-new.php?post_type=' . Source_Local::CPT ) ) . '">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
123
wp-content/plugins/elementor/includes/maintenance.php
Normal file
123
wp-content/plugins/elementor/includes/maintenance.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Kits\Manager;
|
||||
use Elementor\Core\Upgrade\Manager as Upgrade_Manager;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor maintenance.
|
||||
*
|
||||
* Elementor maintenance handler class is responsible for setting up Elementor
|
||||
* activation and uninstallation hooks.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Maintenance {
|
||||
|
||||
/**
|
||||
* Activate Elementor.
|
||||
*
|
||||
* Set Elementor activation hook.
|
||||
*
|
||||
* Fired by `register_activation_hook` when the plugin is activated.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function activation( $network_wide ) {
|
||||
wp_clear_scheduled_hook( 'elementor/tracker/send_event' );
|
||||
|
||||
wp_schedule_event( time(), 'daily', 'elementor/tracker/send_event' );
|
||||
flush_rewrite_rules();
|
||||
|
||||
if ( is_multisite() && $network_wide ) {
|
||||
static::create_default_kit(
|
||||
get_sites( [
|
||||
'fields' => 'ids',
|
||||
] )
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static::create_default_kit();
|
||||
static::insert_defaults_options();
|
||||
|
||||
set_transient( 'elementor_activation_redirect', true, MINUTE_IN_SECONDS );
|
||||
}
|
||||
|
||||
public static function insert_defaults_options() {
|
||||
$history = Upgrade_Manager::get_installs_history();
|
||||
if ( empty( $history ) ) {
|
||||
$default_options = [
|
||||
'elementor_font_display' => 'swap',
|
||||
];
|
||||
foreach ( $default_options as $option_name => $option_value ) {
|
||||
if ( \Elementor\Utils::is_empty( get_option( $option_name ) ) ) {
|
||||
add_option( $option_name, $option_value );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall Elementor.
|
||||
*
|
||||
* Set Elementor uninstallation hook.
|
||||
*
|
||||
* Fired by `register_uninstall_hook` when the plugin is uninstalled.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function uninstall() {
|
||||
wp_clear_scheduled_hook( 'elementor/tracker/send_event' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Init.
|
||||
*
|
||||
* Initialize Elementor Maintenance.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
public static function init() {
|
||||
register_activation_hook( ELEMENTOR_PLUGIN_BASE, [ __CLASS__, 'activation' ] );
|
||||
register_uninstall_hook( ELEMENTOR_PLUGIN_BASE, [ __CLASS__, 'uninstall' ] );
|
||||
|
||||
add_action( 'wpmu_new_blog', function ( $site_id ) {
|
||||
if ( ! is_plugin_active_for_network( ELEMENTOR_PLUGIN_BASE ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
static::create_default_kit( [ $site_id ] );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $site_ids
|
||||
*/
|
||||
private static function create_default_kit( array $site_ids = [] ) {
|
||||
if ( ! empty( $site_ids ) ) {
|
||||
foreach ( $site_ids as $site_id ) {
|
||||
switch_to_blog( $site_id );
|
||||
|
||||
Manager::create_default_kit();
|
||||
|
||||
restore_current_blog();
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Manager::create_default_kit();
|
||||
}
|
||||
}
|
||||
1397
wp-content/plugins/elementor/includes/managers/controls.php
Normal file
1397
wp-content/plugins/elementor/includes/managers/controls.php
Normal file
File diff suppressed because it is too large
Load Diff
365
wp-content/plugins/elementor/includes/managers/elements.php
Normal file
365
wp-content/plugins/elementor/includes/managers/elements.php
Normal file
@@ -0,0 +1,365 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Includes\Elements\Container;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor elements manager.
|
||||
*
|
||||
* Elementor elements manager handler class is responsible for registering and
|
||||
* initializing all the supported elements.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Elements_Manager {
|
||||
|
||||
/**
|
||||
* Element types.
|
||||
*
|
||||
* Holds the list of all the element types.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @var Element_Base[]
|
||||
*/
|
||||
private $_element_types;
|
||||
|
||||
/**
|
||||
* Element categories.
|
||||
*
|
||||
* Holds the list of all the element categories.
|
||||
*
|
||||
* @access private
|
||||
*
|
||||
* @var
|
||||
*/
|
||||
private $categories;
|
||||
|
||||
/**
|
||||
* Elements constructor.
|
||||
*
|
||||
* Initializing Elementor elements manager.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->require_files();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create element instance.
|
||||
*
|
||||
* This method creates a new element instance for any given element.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param array $element_data Element data.
|
||||
* @param array $element_args Optional. Element arguments. Default is
|
||||
* an empty array.
|
||||
* @param Element_Base $element_type Optional. Element type. Default is null.
|
||||
*
|
||||
* @return Element_Base|null Element instance if element created, or null
|
||||
* otherwise.
|
||||
*/
|
||||
public function create_element_instance( array $element_data, array $element_args = [], Element_Base $element_type = null ) {
|
||||
if ( null === $element_type ) {
|
||||
if ( 'widget' === $element_data['elType'] ) {
|
||||
$element_type = Plugin::$instance->widgets_manager->get_widget_types( $element_data['widgetType'] );
|
||||
} else {
|
||||
$element_type = $this->get_element_types( $element_data['elType'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $element_type ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$args = array_merge( $element_type->get_default_args(), $element_args );
|
||||
|
||||
$element_class = $element_type->get_class_name();
|
||||
|
||||
try {
|
||||
$element = new $element_class( $element_data, $args );
|
||||
} catch ( \Exception $e ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element categories.
|
||||
*
|
||||
* Retrieve the list of categories the element belongs to.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Element categories.
|
||||
*/
|
||||
public function get_categories() {
|
||||
if ( null === $this->categories ) {
|
||||
$this->init_categories();
|
||||
}
|
||||
|
||||
return $this->categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add element category.
|
||||
*
|
||||
* Register new category for the element.
|
||||
*
|
||||
* @since 1.7.12
|
||||
* @access public
|
||||
*
|
||||
* @param string $category_name Category name.
|
||||
* @param array $category_properties Category properties.
|
||||
*/
|
||||
public function add_category( $category_name, $category_properties ) {
|
||||
if ( null === $this->categories ) {
|
||||
$this->get_categories();
|
||||
}
|
||||
|
||||
if ( ! isset( $this->categories[ $category_name ] ) ) {
|
||||
$this->categories[ $category_name ] = $category_properties;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register element type.
|
||||
*
|
||||
* Add new type to the list of registered types.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param Element_Base $element Element instance.
|
||||
*
|
||||
* @return bool Whether the element type was registered.
|
||||
*/
|
||||
public function register_element_type( Element_Base $element ) {
|
||||
$this->_element_types[ $element->get_name() ] = $element;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister element type.
|
||||
*
|
||||
* Remove element type from the list of registered types.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $name Element name.
|
||||
*
|
||||
* @return bool Whether the element type was unregister, or not.
|
||||
*/
|
||||
public function unregister_element_type( $name ) {
|
||||
if ( ! isset( $this->_element_types[ $name ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unset( $this->_element_types[ $name ] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element types.
|
||||
*
|
||||
* Retrieve the list of all the element types, or if a specific element name
|
||||
* was provided retrieve his element types.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @param string $element_name Optional. Element name. Default is null.
|
||||
*
|
||||
* @return null|Element_Base|Element_Base[] Element types, or a list of all the element
|
||||
* types, or null if element does not exist.
|
||||
*/
|
||||
public function get_element_types( $element_name = null ) {
|
||||
if ( is_null( $this->_element_types ) ) {
|
||||
$this->init_elements();
|
||||
}
|
||||
|
||||
if ( null !== $element_name ) {
|
||||
return isset( $this->_element_types[ $element_name ] ) ? $this->_element_types[ $element_name ] : null;
|
||||
}
|
||||
|
||||
return $this->_element_types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element types config.
|
||||
*
|
||||
* Retrieve the config of all the element types.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return array Element types config.
|
||||
*/
|
||||
public function get_element_types_config() {
|
||||
$config = [];
|
||||
|
||||
foreach ( $this->get_element_types() as $element ) {
|
||||
$config[ $element->get_name() ] = $element->get_config();
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render elements content.
|
||||
*
|
||||
* Used to generate the elements templates on the editor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function render_elements_content() {
|
||||
foreach ( $this->get_element_types() as $element_type ) {
|
||||
$element_type->print_template();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Init elements.
|
||||
*
|
||||
* Initialize Elementor elements by registering the supported elements.
|
||||
* Elementor supports by default `section` element and `column` element.
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function init_elements() {
|
||||
$this->_element_types = [];
|
||||
|
||||
foreach ( [ 'section', 'column' ] as $element_name ) {
|
||||
$class_name = __NAMESPACE__ . '\Element_' . $element_name;
|
||||
|
||||
$this->register_element_type( new $class_name() );
|
||||
}
|
||||
|
||||
$experiments_manager = Plugin::$instance->experiments;
|
||||
|
||||
if ( $experiments_manager->is_feature_active( 'container' ) ) {
|
||||
$this->register_element_type( new Container() );
|
||||
}
|
||||
|
||||
/**
|
||||
* After elements registered.
|
||||
*
|
||||
* Fires after Elementor elements are registered.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
do_action( 'elementor/elements/elements_registered', $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Init categories.
|
||||
*
|
||||
* Initialize the element categories.
|
||||
*
|
||||
* @since 1.7.12
|
||||
* @access private
|
||||
*/
|
||||
private function init_categories() {
|
||||
$this->categories = [
|
||||
'layout' => [
|
||||
'title' => esc_html__( 'Layout', 'elementor' ),
|
||||
'hideIfEmpty' => true,
|
||||
],
|
||||
'basic' => [
|
||||
'title' => esc_html__( 'Basic', 'elementor' ),
|
||||
'icon' => 'eicon-font',
|
||||
],
|
||||
'pro-elements' => [
|
||||
'title' => esc_html__( 'Pro', 'elementor' ),
|
||||
'promotion' => [
|
||||
'url' => esc_url( 'https://go.elementor.com/go-pro-section-pro-widget-panel/' ),
|
||||
],
|
||||
],
|
||||
'general' => [
|
||||
'title' => esc_html__( 'General', 'elementor' ),
|
||||
'icon' => 'eicon-font',
|
||||
],
|
||||
'link-in-bio' => [
|
||||
'title' => esc_html__( 'Link In Bio', 'elementor' ),
|
||||
'hideIfEmpty' => true,
|
||||
],
|
||||
'theme-elements' => [
|
||||
'title' => esc_html__( 'Site', 'elementor' ),
|
||||
'active' => false,
|
||||
'promotion' => [
|
||||
'url' => esc_url( 'https://go.elementor.com/go-pro-section-site-widget-panel/' ),
|
||||
],
|
||||
],
|
||||
'woocommerce-elements' => [
|
||||
'title' => esc_html__( 'WooCommerce', 'elementor' ),
|
||||
'active' => false,
|
||||
'promotion' => [
|
||||
'url' => esc_url( 'https://go.elementor.com/go-pro-section-woocommerce-widget-panel/' ),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Not using the `add_category` because it doesn't allow 3rd party to inject a category on top the others.
|
||||
$this->categories = array_merge_recursive( [
|
||||
'favorites' => [
|
||||
'title' => esc_html__( 'Favorites', 'elementor' ),
|
||||
'icon' => 'eicon-heart',
|
||||
'sort' => 'a-z',
|
||||
'hideIfEmpty' => false,
|
||||
],
|
||||
], $this->categories );
|
||||
|
||||
/**
|
||||
* When categories are registered.
|
||||
*
|
||||
* Fires after basic categories are registered, before WordPress
|
||||
* category have been registered.
|
||||
*
|
||||
* This is where categories registered by external developers are
|
||||
* added.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param Elements_Manager $this Elements manager instance.
|
||||
*/
|
||||
do_action( 'elementor/elements/categories_registered', $this );
|
||||
|
||||
$this->categories['wordpress'] = [
|
||||
'title' => esc_html__( 'WordPress', 'elementor' ),
|
||||
'icon' => 'eicon-wordpress',
|
||||
'active' => false,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Require files.
|
||||
*
|
||||
* Require Elementor element base class and column, section and repeater
|
||||
* elements.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access private
|
||||
*/
|
||||
private function require_files() {
|
||||
require_once ELEMENTOR_PATH . 'includes/base/element-base.php';
|
||||
|
||||
require ELEMENTOR_PATH . 'includes/elements/column.php';
|
||||
require ELEMENTOR_PATH . 'includes/elements/section.php';
|
||||
require ELEMENTOR_PATH . 'includes/elements/repeater.php';
|
||||
}
|
||||
}
|
||||
619
wp-content/plugins/elementor/includes/managers/icons.php
Normal file
619
wp-content/plugins/elementor/includes/managers/icons.php
Normal file
@@ -0,0 +1,619 @@
|
||||
<?php
|
||||
namespace Elementor;
|
||||
|
||||
use Elementor\Core\Files\File_Types\Svg;
|
||||
use Elementor\Core\Page_Assets\Data_Managers\Font_Icon_Svg\Manager as Font_Icon_Svg_Data_Manager;
|
||||
use Elementor\Utils;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
/**
|
||||
* Elementor icons manager.
|
||||
*
|
||||
* Elementor icons manager handler class
|
||||
*
|
||||
* @since 2.4.0
|
||||
*/
|
||||
class Icons_Manager {
|
||||
|
||||
const NEEDS_UPDATE_OPTION = 'icon_manager_needs_update';
|
||||
|
||||
const FONT_ICON_SVG_CLASS_NAME = 'e-font-icon-svg';
|
||||
|
||||
const LOAD_FA4_SHIM_OPTION_KEY = 'elementor_load_fa4_shim';
|
||||
|
||||
const ELEMENTOR_ICONS_VERSION = '5.30.0';
|
||||
|
||||
/**
|
||||
* Tabs.
|
||||
*
|
||||
* Holds the list of all the tabs.
|
||||
*
|
||||
* @access private
|
||||
* @static
|
||||
* @since 2.4.0
|
||||
* @var array
|
||||
*/
|
||||
private static $tabs;
|
||||
|
||||
private static $data_manager;
|
||||
|
||||
private static function get_needs_upgrade_option() {
|
||||
return get_option( 'elementor_' . self::NEEDS_UPDATE_OPTION, null );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $icon
|
||||
* @param $attributes
|
||||
* @param $tag
|
||||
* @return bool|mixed|string
|
||||
*/
|
||||
public static function try_get_icon_html( $icon, $attributes = [], $tag = 'i' ) {
|
||||
if ( empty( $icon['library'] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return static::get_icon_html( $icon, $attributes, $tag );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $icon
|
||||
* @param array $attributes
|
||||
* @param $tag
|
||||
* @return bool|mixed|string
|
||||
*/
|
||||
private static function get_icon_html( array $icon, array $attributes, $tag ) {
|
||||
/**
|
||||
* When the library value is svg it means that it's a SVG media attachment uploaded by the user.
|
||||
* Otherwise, it's the name of the font family that the icon belongs to.
|
||||
*/
|
||||
if ( 'svg' === $icon['library'] ) {
|
||||
$output = self::render_uploaded_svg_icon( $icon['value'] );
|
||||
} else {
|
||||
$output = self::render_font_icon( $icon, $attributes, $tag );
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* register styles
|
||||
*
|
||||
* Used to register all icon types stylesheets so they could be enqueued later by widgets
|
||||
*/
|
||||
public function register_styles() {
|
||||
$config = self::get_icon_manager_tabs_config();
|
||||
|
||||
$shared_styles = [];
|
||||
|
||||
foreach ( $config as $type => $icon_type ) {
|
||||
if ( ! isset( $icon_type['url'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$dependencies = [];
|
||||
if ( ! empty( $icon_type['enqueue'] ) ) {
|
||||
foreach ( (array) $icon_type['enqueue'] as $font_css_url ) {
|
||||
if ( ! in_array( $font_css_url, array_keys( $shared_styles ), true ) ) {
|
||||
$style_handle = 'elementor-icons-shared-' . count( $shared_styles );
|
||||
wp_register_style(
|
||||
$style_handle,
|
||||
$font_css_url,
|
||||
[],
|
||||
$icon_type['ver']
|
||||
);
|
||||
$shared_styles[ $font_css_url ] = $style_handle;
|
||||
}
|
||||
$dependencies[] = $shared_styles[ $font_css_url ];
|
||||
}
|
||||
}
|
||||
wp_register_style(
|
||||
'elementor-icons-' . $icon_type['name'],
|
||||
$icon_type['url'],
|
||||
$dependencies,
|
||||
$icon_type['ver']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Tabs
|
||||
*
|
||||
* Initiate Icon Manager Tabs.
|
||||
*
|
||||
* @access private
|
||||
* @static
|
||||
* @since 2.4.0
|
||||
*/
|
||||
private static function init_tabs() {
|
||||
$initial_tabs = [
|
||||
'fa-regular' => [
|
||||
'name' => 'fa-regular',
|
||||
'label' => esc_html__( 'Font Awesome - Regular', 'elementor' ),
|
||||
'url' => self::get_fa_asset_url( 'regular' ),
|
||||
'enqueue' => [ self::get_fa_asset_url( 'fontawesome' ) ],
|
||||
'prefix' => 'fa-',
|
||||
'displayPrefix' => 'far',
|
||||
'labelIcon' => 'fab fa-font-awesome-alt',
|
||||
'ver' => '5.15.3',
|
||||
'fetchJson' => self::get_fa_asset_url( 'regular', 'js', false ),
|
||||
'native' => true,
|
||||
],
|
||||
'fa-solid' => [
|
||||
'name' => 'fa-solid',
|
||||
'label' => esc_html__( 'Font Awesome - Solid', 'elementor' ),
|
||||
'url' => self::get_fa_asset_url( 'solid' ),
|
||||
'enqueue' => [ self::get_fa_asset_url( 'fontawesome' ) ],
|
||||
'prefix' => 'fa-',
|
||||
'displayPrefix' => 'fas',
|
||||
'labelIcon' => 'fab fa-font-awesome',
|
||||
'ver' => '5.15.3',
|
||||
'fetchJson' => self::get_fa_asset_url( 'solid', 'js', false ),
|
||||
'native' => true,
|
||||
],
|
||||
'fa-brands' => [
|
||||
'name' => 'fa-brands',
|
||||
'label' => esc_html__( 'Font Awesome - Brands', 'elementor' ),
|
||||
'url' => self::get_fa_asset_url( 'brands' ),
|
||||
'enqueue' => [ self::get_fa_asset_url( 'fontawesome' ) ],
|
||||
'prefix' => 'fa-',
|
||||
'displayPrefix' => 'fab',
|
||||
'labelIcon' => 'fab fa-font-awesome-flag',
|
||||
'ver' => '5.15.3',
|
||||
'fetchJson' => self::get_fa_asset_url( 'brands', 'js', false ),
|
||||
'native' => true,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Initial icon manager tabs.
|
||||
*
|
||||
* Filters the list of initial icon manager tabs.
|
||||
*
|
||||
* @param array $icon_manager_tabs Initial icon manager tabs.
|
||||
*/
|
||||
$initial_tabs = apply_filters( 'elementor/icons_manager/native', $initial_tabs );
|
||||
|
||||
self::$tabs = $initial_tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Icon Manager Tabs
|
||||
* @return array
|
||||
*/
|
||||
public static function get_icon_manager_tabs() {
|
||||
if ( self::is_font_icon_inline_svg() && ! Plugin::$instance->editor->is_edit_mode() && ! Plugin::$instance->preview->is_preview_mode() ) {
|
||||
self::$tabs = [];
|
||||
} elseif ( ! self::$tabs ) {
|
||||
self::init_tabs();
|
||||
}
|
||||
|
||||
$additional_tabs = [];
|
||||
|
||||
/**
|
||||
* Additional icon manager tabs.
|
||||
*
|
||||
* Filters additional icon manager tabs.
|
||||
*
|
||||
* @param array $additional_tabs Additional icon manager tabs. Default is an empty array.
|
||||
*/
|
||||
$additional_tabs = apply_filters( 'elementor/icons_manager/additional_tabs', $additional_tabs );
|
||||
|
||||
return array_replace( self::$tabs, $additional_tabs );
|
||||
}
|
||||
|
||||
public static function enqueue_shim() {
|
||||
//phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter
|
||||
wp_enqueue_script(
|
||||
'font-awesome-4-shim',
|
||||
self::get_fa_asset_url( 'v4-shims', 'js' ),
|
||||
[],
|
||||
ELEMENTOR_VERSION
|
||||
);
|
||||
// Make sure that the CSS in the 'all' file does not override FA Pro's CSS
|
||||
if ( ! wp_script_is( 'font-awesome-pro' ) ) {
|
||||
wp_enqueue_style(
|
||||
'font-awesome-5-all',
|
||||
self::get_fa_asset_url( 'all' ),
|
||||
[],
|
||||
ELEMENTOR_VERSION
|
||||
);
|
||||
}
|
||||
wp_enqueue_style(
|
||||
'font-awesome-4-shim',
|
||||
self::get_fa_asset_url( 'v4-shims' ),
|
||||
[],
|
||||
ELEMENTOR_VERSION
|
||||
);
|
||||
}
|
||||
|
||||
private static function get_fa_asset_url( $filename, $ext_type = 'css', $add_suffix = true ) {
|
||||
static $is_test_mode = null;
|
||||
if ( null === $is_test_mode ) {
|
||||
$is_test_mode = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG || defined( 'ELEMENTOR_TESTS' ) && ELEMENTOR_TESTS;
|
||||
}
|
||||
$url = ELEMENTOR_ASSETS_URL . 'lib/font-awesome/' . $ext_type . '/' . $filename;
|
||||
if ( ! $is_test_mode && $add_suffix ) {
|
||||
$url .= '.min';
|
||||
}
|
||||
|
||||
return $url . '.' . $ext_type;
|
||||
}
|
||||
|
||||
public static function get_icon_manager_tabs_config() {
|
||||
$tabs = [
|
||||
'all' => [
|
||||
'name' => 'all',
|
||||
'label' => esc_html__( 'All Icons', 'elementor' ),
|
||||
'labelIcon' => 'eicon-filter',
|
||||
'native' => true,
|
||||
],
|
||||
];
|
||||
|
||||
return array_values( array_merge( $tabs, self::get_icon_manager_tabs() ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* is_font_awesome_inline
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function is_font_icon_inline_svg() {
|
||||
return Plugin::$instance->experiments->is_feature_active( 'e_font_icon_svg' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.8.0
|
||||
*/
|
||||
public static function render_svg_symbols() {}
|
||||
|
||||
public static function get_icon_svg_data( $icon ) {
|
||||
return self::$data_manager->get_font_icon_svg_data( $icon );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get font awesome svg.
|
||||
* @param $icon array [ 'value' => string, 'library' => string ]
|
||||
*
|
||||
* @return bool|mixed|string
|
||||
*/
|
||||
public static function get_font_icon_svg( $icon, $attributes = [] ) {
|
||||
// Load the SVG from the database.
|
||||
$icon_data = self::get_icon_svg_data( $icon );
|
||||
|
||||
if ( ! $icon_data['path'] ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( ! empty( $attributes['class'] ) && ! is_array( $attributes['class'] ) ) {
|
||||
$attributes['class'] = [ $attributes['class'] ];
|
||||
}
|
||||
|
||||
$attributes['class'][] = self::FONT_ICON_SVG_CLASS_NAME;
|
||||
$attributes['class'][] = 'e-' . $icon_data['key'];
|
||||
$attributes['viewBox'] = '0 0 ' . $icon_data['width'] . ' ' . $icon_data['height'];
|
||||
$attributes['xmlns'] = 'http://www.w3.org/2000/svg';
|
||||
|
||||
return (
|
||||
'<svg ' . Utils::render_html_attributes( $attributes ) . '>' .
|
||||
'<path d="' . esc_attr( $icon_data['path'] ) . '"></path>' .
|
||||
'</svg>'
|
||||
);
|
||||
}
|
||||
|
||||
public static function render_uploaded_svg_icon( $value ) {
|
||||
if ( ! isset( $value['id'] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return Svg::get_inline_svg( $value['id'] );
|
||||
}
|
||||
|
||||
public static function render_font_icon( $icon, $attributes = [], $tag = 'i' ) {
|
||||
$icon_types = self::get_icon_manager_tabs();
|
||||
|
||||
if ( isset( $icon_types[ $icon['library'] ]['render_callback'] ) && is_callable( $icon_types[ $icon['library'] ]['render_callback'] ) ) {
|
||||
return call_user_func_array( $icon_types[ $icon['library'] ]['render_callback'], [ $icon, $attributes, $tag ] );
|
||||
}
|
||||
|
||||
$content = '';
|
||||
|
||||
$font_icon_svg_family = self::is_font_icon_inline_svg() ? Font_Icon_Svg_Data_Manager::get_font_family( $icon['library'] ) : '';
|
||||
|
||||
if ( $font_icon_svg_family ) {
|
||||
$icon['font_family'] = $font_icon_svg_family;
|
||||
|
||||
$content = self::get_font_icon_svg( $icon, $attributes );
|
||||
|
||||
if ( $content ) {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $content ) {
|
||||
if ( empty( $attributes['class'] ) ) {
|
||||
$attributes['class'] = $icon['value'];
|
||||
} else {
|
||||
if ( is_array( $attributes['class'] ) ) {
|
||||
$attributes['class'][] = $icon['value'];
|
||||
} else {
|
||||
$attributes['class'] .= ' ' . $icon['value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '<' . $tag . ' ' . Utils::render_html_attributes( $attributes ) . '>' . $content . '</' . $tag . '>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Icon
|
||||
*
|
||||
* Used to render Icon for \Elementor\Controls_Manager::ICONS
|
||||
* @param array $icon Icon Type, Icon value
|
||||
* @param array $attributes Icon HTML Attributes
|
||||
* @param string $tag Icon HTML tag, defaults to <i>
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
public static function render_icon( $icon, $attributes = [], $tag = 'i' ) {
|
||||
if ( empty( $icon['library'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$output = static::get_icon_html( $icon, $attributes, $tag );
|
||||
|
||||
Utils::print_unescaped_internal_string( $output );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Font Awesome 4 to font Awesome 5 Value Migration
|
||||
*
|
||||
* used to convert string value of Icon control to array value of Icons control
|
||||
* ex: 'fa fa-star' => [ 'value' => 'fas fa-star', 'library' => 'fa-solid' ]
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function fa4_to_fa5_value_migration( $value ) {
|
||||
static $migration_dictionary = false;
|
||||
if ( '' === $value ) {
|
||||
return [
|
||||
'value' => '',
|
||||
'library' => '',
|
||||
];
|
||||
}
|
||||
if ( false === $migration_dictionary ) {
|
||||
$migration_dictionary = json_decode( Utils::file_get_contents( ELEMENTOR_ASSETS_PATH . 'lib/font-awesome/migration/mapping.js' ), true );
|
||||
}
|
||||
if ( isset( $migration_dictionary[ $value ] ) ) {
|
||||
return $migration_dictionary[ $value ];
|
||||
}
|
||||
|
||||
return [
|
||||
'value' => 'fas ' . str_replace( 'fa ', '', $value ),
|
||||
'library' => 'fa-solid',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* on_import_migration
|
||||
* @param array $element settings array
|
||||
* @param string $old_control old control id
|
||||
* @param string $new_control new control id
|
||||
* @param bool $remove_old boolean weather to remove old control or not
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function on_import_migration( array $element, $old_control = '', $new_control = '', $remove_old = false ) {
|
||||
|
||||
if ( ! isset( $element['settings'][ $old_control ] ) || isset( $element['settings'][ $new_control ] ) ) {
|
||||
return $element;
|
||||
}
|
||||
|
||||
// Case when old value is saved as empty string
|
||||
$new_value = [
|
||||
'value' => '',
|
||||
'library' => '',
|
||||
];
|
||||
|
||||
// Case when old value needs migration
|
||||
if ( ! empty( $element['settings'][ $old_control ] ) && ! self::is_migration_allowed() ) {
|
||||
$new_value = self::fa4_to_fa5_value_migration( $element['settings'][ $old_control ] );
|
||||
}
|
||||
|
||||
$element['settings'][ $new_control ] = $new_value;
|
||||
|
||||
//remove old value
|
||||
if ( $remove_old ) {
|
||||
unset( $element['settings'][ $old_control ] );
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* is_migration_allowed
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_migration_allowed() {
|
||||
static $migration_allowed = false;
|
||||
if ( false === $migration_allowed ) {
|
||||
$migration_allowed = null === self::get_needs_upgrade_option();
|
||||
|
||||
/**
|
||||
* Is icon migration allowed.
|
||||
*
|
||||
* Filters whether the icons migration allowed.
|
||||
*
|
||||
* @param bool $migration_allowed Is icon migration is allowed.
|
||||
*/
|
||||
$migration_allowed = apply_filters( 'elementor/icons_manager/migration_allowed', $migration_allowed );
|
||||
}
|
||||
return $migration_allowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register_Admin Settings
|
||||
*
|
||||
* adds Font Awesome migration / update admin settings
|
||||
* @param Settings $settings
|
||||
*/
|
||||
public function register_admin_settings( Settings $settings ) {
|
||||
$settings->add_field(
|
||||
Settings::TAB_ADVANCED,
|
||||
Settings::TAB_ADVANCED,
|
||||
'load_fa4_shim',
|
||||
[
|
||||
'label' => esc_html__( 'Load Font Awesome 4 Support', 'elementor' ),
|
||||
'field_args' => [
|
||||
'type' => 'select',
|
||||
'std' => '',
|
||||
'options' => [
|
||||
'' => esc_html__( 'No', 'elementor' ),
|
||||
'yes' => esc_html__( 'Yes', 'elementor' ),
|
||||
],
|
||||
'desc' => esc_html__( 'Font Awesome 4 support script (shim.js) is a script that makes sure all previously selected Font Awesome 4 icons are displayed correctly while using Font Awesome 5 library.', 'elementor' ),
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function register_admin_tools_settings( Tools $settings ) {
|
||||
$settings->add_tab( 'fontawesome4_migration', [ 'label' => esc_html__( 'Font Awesome Upgrade', 'elementor' ) ] );
|
||||
|
||||
$settings->add_section( 'fontawesome4_migration', 'fontawesome4_migration', [
|
||||
'callback' => function() {
|
||||
echo '<h2>' . esc_html__( 'Font Awesome Upgrade', 'elementor' ) . '</h2>';
|
||||
echo '<p>' . // PHPCS - Plain Text
|
||||
esc_html__( 'Access 1,500+ amazing Font Awesome 5 icons and enjoy faster performance and design flexibility.', 'elementor' ) . '<br>' . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
esc_html__( 'By upgrading, whenever you edit a page containing a Font Awesome 4 icon, Elementor will convert it to the new Font Awesome 5 icon.', 'elementor' ) . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'</p><p><strong>' .
|
||||
esc_html__( 'Please note that the upgrade process may cause some of the previously used Font Awesome 4 icons to look a bit different due to minor design changes made by Font Awesome.', 'elementor' ) . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'</strong></p><p>' .
|
||||
esc_html__( 'The upgrade process includes a database update', 'elementor' ) . ' - ' . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
esc_html__( 'We highly recommend backing up your database before performing this upgrade.', 'elementor' ) . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'</p>' .
|
||||
esc_html__( 'This action is not reversible and cannot be undone by rolling back to previous versions.', 'elementor' ) . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
'</p>';
|
||||
},
|
||||
'fields' => [
|
||||
[
|
||||
'label' => esc_html__( 'Font Awesome Upgrade', 'elementor' ),
|
||||
'field_args' => [
|
||||
'type' => 'raw_html',
|
||||
'html' => sprintf( '<span data-action="%s" data-_nonce="%s" data-redirect-url="%s" class="button" id="elementor_upgrade_fa_button">%s</span>',
|
||||
self::NEEDS_UPDATE_OPTION . '_upgrade',
|
||||
wp_create_nonce( self::NEEDS_UPDATE_OPTION ),
|
||||
esc_url( $this->get_upgrade_redirect_url() ),
|
||||
esc_html__( 'Upgrade To Font Awesome 5', 'elementor' )
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get redirect URL when upgrading font awesome.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_upgrade_redirect_url() {
|
||||
|
||||
if ( ! wp_verify_nonce( Utils::get_super_global_value( $_GET, '_wpnonce' ), 'tools-page-from-editor' ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$document_id = ! empty( $_GET['redirect_to_document'] ) ? absint( $_GET['redirect_to_document'] ) : null;
|
||||
|
||||
if ( ! $document_id ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$document = Plugin::$instance->documents->get( $document_id );
|
||||
|
||||
if ( ! $document ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $document->get_edit_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax Upgrade to FontAwesome 5
|
||||
*/
|
||||
public function ajax_upgrade_to_fa5() {
|
||||
check_ajax_referer( self::NEEDS_UPDATE_OPTION, '_nonce' );
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_send_json_error( 'Permission denied' );
|
||||
}
|
||||
|
||||
delete_option( 'elementor_' . self::NEEDS_UPDATE_OPTION );
|
||||
|
||||
wp_send_json_success( [ 'message' => esc_html__( 'Hurray! The upgrade process to Font Awesome 5 was completed successfully.', 'elementor' ) ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Update Needed Flag
|
||||
* @param array $settings
|
||||
*
|
||||
* @return array;
|
||||
*/
|
||||
public function add_update_needed_flag( $settings ) {
|
||||
$settings['icons_update_needed'] = true;
|
||||
return $settings;
|
||||
}
|
||||
|
||||
public function enqueue_fontawesome_css() {
|
||||
if ( ! self::is_migration_allowed() ) {
|
||||
wp_enqueue_style( 'font-awesome' );
|
||||
} else {
|
||||
$current_filter = current_filter();
|
||||
$load_shim = get_option( self::LOAD_FA4_SHIM_OPTION_KEY, false );
|
||||
if ( 'elementor/editor/after_enqueue_styles' === $current_filter ) {
|
||||
self::enqueue_shim();
|
||||
} elseif ( 'yes' === $load_shim ) {
|
||||
self::enqueue_shim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.1.0
|
||||
*/
|
||||
public function add_admin_strings() {
|
||||
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0' );
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Icons Manager constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( is_admin() ) {
|
||||
// @todo: remove once we deprecate fa4
|
||||
add_action( 'elementor/admin/after_create_settings/' . Settings::PAGE_ID, [ $this, 'register_admin_settings' ], 100 );
|
||||
}
|
||||
|
||||
if ( self::is_font_icon_inline_svg() ) {
|
||||
self::$data_manager = new Font_Icon_Svg_Data_Manager();
|
||||
}
|
||||
|
||||
add_action( 'elementor/frontend/after_enqueue_styles', [ $this, 'enqueue_fontawesome_css' ] );
|
||||
add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] );
|
||||
|
||||
if ( ! self::is_migration_allowed() ) {
|
||||
add_filter( 'elementor/editor/localize_settings', [ $this, 'add_update_needed_flag' ] );
|
||||
add_action( 'elementor/admin/after_create_settings/' . Tools::PAGE_ID, [ $this, 'register_admin_tools_settings' ], 100 );
|
||||
|
||||
if ( ! empty( $_POST ) ) { // phpcs:ignore -- nonce validation done in callback
|
||||
add_action( 'wp_ajax_' . self::NEEDS_UPDATE_OPTION . '_upgrade', [ $this, 'ajax_upgrade_to_fa5' ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user