ata.
*/
public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ) : array {
return $config;
}
/**
* Start injection.
*
* Used to inject controls and sections to a specific position in the stack.
*
* When you use this method, all the registered controls and sections will
* be injected to a specific position in the stack, until you stop the
* injection using `end_injection()` method.
*
* @since 1.7.1
* @access public
*
* @param array $position {
* The position where to start the injection.
*
* @type string $type Injection type, either `control` or `section`.
* Default is `control`.
* @type string $at Where to inject. If `$type` is `control` accepts
* `before` and `after`. If `$type` is `section`
* accepts `start` and `end`. Default values based on
* the `type`.
* @type string $of Control/Section ID.
* }
*/
final public function start_injection( array $position ) {
if ( $this->injection_point ) {
wp_die( 'A controls injection is already opened. Please close current injection before starting a new one (use `end_injection`).' );
}
$this->injection_point = $this->get_position_info( $position );
}
/**
* End injection.
*
* Used to close an existing opened injection point.
*
* When you use this method it stops adding new controls and sections to
* this point and continue to add controls to the regular position in the
* stack.
*
* @since 1.7.1
* @access public
*/
final public function end_injection() {
$this->injection_point = null;
}
/**
* Get injection point.
*
* Retrieve the injection point in the stack where new controls and sections
* will be inserted.
*
* @since 1.9.2
* @access public
*
* @return array|null An array when an injection point is defined, null
* otherwise.
*/
final public function get_injection_point() {
return $this->injection_point;
}
/**
* Register controls.
*
* Used to add new controls to any element type. For example, external
* developers use this method to register controls in a widget.
*
* Should be inherited and register new controls using `add_control()`,
* `add_responsive_control()` and `add_group_control()`, inside control
* wrappers like `start_controls_section()`, `start_controls_tabs()` and
* `start_controls_tab()`.
*
* @since 1.4.0
* @access protected
* @deprecated 3.1.0 Use `register_controls()` method instead.
*/
protected function _register_controls() {
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', 'register_controls()' );
$this->register_controls();
}
/**
* Register controls.
*
* Used to add new controls to any element type. For example, external
* developers use this method to register controls in a widget.
*
* Should be inherited and register new controls using `add_control()`,
* `add_responsive_control()` and `add_group_control()`, inside control
* wrappers like `start_controls_section()`, `start_controls_tabs()` and
* `start_controls_tab()`.
*
* @since 3.1.0
* @access protected
*/
protected function register_controls() {}
/**
* Get default data.
*
* Retrieve the default data. Used to reset the data on initialization.
*
* @since 1.4.0
* @access protected
*
* @return array Default data.
*/
protected function get_default_data() {
return [
'id' => 0,
'settings' => [],
];
}
/**
* @since 2.3.0
* @access protected
*/
protected function get_init_settings() {
$settings = $this->get_data( 'settings' );
$controls_objs = Plugin::$instance->controls_manager->get_controls();
foreach ( $this->get_controls() as $control ) {
$control_obj = $controls_objs[ $control['type'] ] ?? null;
if ( ! $control_obj instanceof Base_Data_Control ) {
continue;
}
$control = array_merge_recursive( $control_obj->get_settings(), $control );
$settings[ $control['name'] ] = $control_obj->get_value( $control, $settings );
}
return $settings;
}
/**
* Get initial config.
*
* Retrieve the current element initial configuration - controls list and
* the tabs assigned to the control.
*
* @since 2.9.0
* @access protected
*
* @return array The initial config.
*/
protected function get_initial_config() {
return [
'controls' => $this->get_controls(),
];
}
/**
* Get initial config.
*
* Retrieve the current element initial configuration - controls list and
* the tabs assigned to the control.
*
* @since 1.4.0
* @deprecated 2.9.0 Use `get_initial_config()` method instead.
* @access protected
*
* @return array The initial config.
*/
protected function _get_initial_config() {
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '2.9.0', 'get_initial_config()' );
return $this->get_initial_config();
}
/**
* Get section arguments.
*
* Retrieve the section arguments based on section ID.
*
* @since 1.4.0
* @access protected
*
* @param string $section_id Section ID.
*
* @return array Section arguments.
*/
protected function get_section_args( $section_id ) {
$section_control = $this->get_controls( $section_id );
$section_args_keys = [ 'tab', 'condition' ];
$args = array_intersect_key( $section_control, array_flip( $section_args_keys ) );
$args['section'] = $section_id;
return $args;
}
/**
* Render element.
*
* Generates the final HTML on the frontend.
*
* @since 2.0.0
* @access protected
*/
protected function render() {}
/**
* Render element in static mode.
*
* If not inherent will call the base render.
*/
protected function render_static() {
$this->render();
}
/**
* Determine the render logic.
*/
protected function render_by_mode() {
if ( Plugin::$instance->frontend->is_static_render_mode() ) {
$this->render_static();
return;
}
$this->render();
}
/**
* Print content template.
*
* Used to generate the content template on the editor, using a
* Backbone JavaScript template.
*
* @access protected
* @since 2.0.0
*
* @param string $template_content Template content.
*/
protected function print_template_content( $template_content ) {
echo $template_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Render element output in the editor.
*
* Used to generate the live preview, using a Backbone JavaScript template.
*
* @since 2.9.0
* @access protected
*/
protected function content_template() {}
/**
* Render element output in the editor.
*
* Used to generate the live preview, using a Backbone JavaScript template.
*
* @since 2.0.0
* @deprecated 2.9.0 Use `content_template()` method instead.
* @access protected
*/
protected function _content_template() {
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '2.9.0', 'content_template()' );
$this->content_template();
}
/**
* Initialize controls.
*
* Register the all controls added by `register_controls()`.
*
* @since 2.0.0
* @access protected
*/
protected function init_controls() {
Plugin::$instance->controls_manager->open_stack( $this );
// TODO: This is for backwards compatibility starting from 2.9.0
// This `if` statement should be removed when the method is removed
if ( $this->has_own_method( '_register_controls', self::class ) ) {
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( '_register_controls', '3.1.0', __CLASS__ . '::register_controls()' );
$this->_register_controls();
} else {
$this->register_controls();
}
}
protected function handle_control_position( array $args, $control_id, $overwrite ) {
if ( isset( $args['type'] ) && in_array( $args['type'], [ Controls_Manager::SECTION, Controls_Manager::WP_WIDGET ], true ) ) {
return $args;
}
$target_section_args = $this->current_section;
$target_tab = $this->current_tab;
if ( $this->injection_point ) {
$target_section_args = $this->injection_point['section'];
if ( ! empty( $this->injection_point['tab'] ) ) {
$target_tab = $this->injection_point['tab'];
}
}
if ( null !== $target_section_args ) {
if ( ! empty( $args['section'] ) || ! empty( $args['tab'] ) ) {
_doing_it_wrong( sprintf( '%s::%s', get_called_class(), __FUNCTION__ ), sprintf( 'Cannot redeclare control with `tab` or `section` args inside section "%s".', $control_id ), '1.0.0' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
$args = array_replace_recursive( $target_section_args, $args );
if ( null !== $target_tab ) {
$args = array_replace_recursive( $target_tab, $args );
}
} elseif ( empty( $args['section'] ) && ( ! $overwrite || is_wp_error( Plugin::$instance->controls_manager->get_control_from_stack( $this->get_unique_name(), $control_id ) ) ) ) {
if ( ! Performance::should_optimize_controls() ) {
wp_die( sprintf( '%s::%s: Cannot add a control outside of a section (use `start_controls_section`).', get_called_class(), __FUNCTION__ ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
return $args;
}
/**
* Initialize the class.
*
* Set the raw data, the ID and the parsed settings.
*
* @since 2.9.0
* @access protected
*
* @param array $data Initial data.
*/
protected function init( $data ) {
$this->data = array_merge( $this->get_default_data(), $data );
$this->id = $data['id'];
}
/**
* Initialize the class.
*
* Set the raw data, the ID and the parsed settings.
*
* @since 1.4.0
* @deprecated 2.9.0 Use `init()` method instead.
* @access protected
*
* @param array $data Initial data.
*/
protected function _init( $data ) {
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '2.9.0', 'init()' );
$this->init( $data );
}
/**
* Sanitize initial data.
*
* Performs settings cleaning and sanitization.
*
* @since 2.1.5
* @access private
*
* @param array $settings Settings to sanitize.
* @param array $controls Optional. An array of controls. Default is an
* empty array.
*
* @return array Sanitized settings.
*/
private function sanitize_settings( array $settings, array $controls = [] ) {
if ( ! $controls ) {
$controls = $this->get_controls();
}
foreach ( $controls as $control ) {
$control_obj = Plugin::$instance->controls_manager->get_control( $control['type'] );
if ( $control_obj instanceof Control_Repeater ) {
if ( empty( $settings[ $control['name'] ] ) ) {
continue;
}
foreach ( $settings[ $control['name'] ] as $index => $repeater_row_data ) {
$sanitized_row_data = $this->sanitize_settings( $repeater_row_data, $control['fields'] );
$settings[ $control['name'] ][ $index ] = $sanitized_row_data;
}
continue;
}
$is_dynamic = isset( $settings[ Manager::DYNAMIC_SETTING_KEY ][ $control['name'] ] );
if ( ! $is_dynamic ) {
continue;
}
$value_to_check = $settings[ Manager::DYNAMIC_SETTING_KEY ][ $control['name'] ];
$tag_text_data = Plugin::$instance->dynamic_tags->tag_text_to_tag_data( $value_to_check );
if ( ! Plugin::$instance->dynamic_tags->get_tag_info( $tag_text_data['name'] ) ) {
unset( $settings[ Manager::DYNAMIC_SETTING_KEY ][ $control['name'] ] );
}
}
return $settings;
}
/**
* Controls stack constructor.
*
* Initializing the control stack class using `$data`. The `$data` is required
* for a normal instance. It is optional only for internal `type instance`.
*
* @since 1.4.0
* @access public
*
* @param array $data Optional. Control stack data. Default is an empty array.
*/
public function __construct( array $data = [] ) {
if ( $data ) {
// TODO: This is for backwards compatibility starting from 2.9.0
// This if statement should be removed when the method is hard-deprecated
if ( $this->has_own_method( '_init', self::class ) ) {
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( '_init', '2.9.0', __CLASS__ . '::init()' );
$this->_init( $data );
} else {
$this->init( $data );
}
}
}
}
Fatal error: Uncaught Error: Class 'Elementor\Controls_Stack' not found in /home/rahjooian/public_html/wp-content/plugins/elementor/core/base/document.php:36
Stack trace:
#0 /home/rahjooian/public_html/wp-content/plugins/elementor/includes/autoloader.php(294): require()
#1 /home/rahjooian/public_html/wp-content/plugins/elementor/includes/autoloader.php(330): Elementor\Autoloader::load_class('Core\\Base\\Docum...')
#2 [internal function]: Elementor\Autoloader::autoload('Elementor\\Core\\...')
#3 /home/rahjooian/public_html/wp-content/plugins/elementor/includes/plugin.php(712): spl_autoload_call('Elementor\\Core\\...')
#4 /home/rahjooian/public_html/wp-content/plugins/elementor/includes/plugin.php(647): Elementor\Plugin->init_components()
#5 /home/rahjooian/public_html/wp-includes/class-wp-hook.php(324): Elementor\Plugin->init('')
#6 /home/rahjooian/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#7 /home/rahjooian/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#8 /hom in /home/rahjooian/public_html/wp-content/plugins/elementor/core/base/document.php on line 36