芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/www/wp-content/plugins/premium-addons-for-elementor/includes/addons-cross-cp.php
db->iterate_data( $media_import, function ( $element ) { $element['id'] = Utils::generate_random_string(); return $element; } ); } /** * Media import copy content. * * @since 3.21.1 * * @param object $media_import media to import. */ protected static function cross_cp_import_copy_content( $media_import ) { return \Elementor\Plugin::instance()->db->iterate_data( $media_import, function ( $element_data ) { $element = \Elementor\Plugin::instance()->elements_manager->create_element_instance( $element_data ); // If the widget/element isn't exist, like a plugin that creates a widget but deactivated. if ( ! $element ) { return null; } return self::cross_cp_import_element( $element ); } ); } /** * Start element copy content for media import. * * @since 3.21.1 * * @param Controls_Stack $element element to import. */ protected static function cross_cp_import_element( Controls_Stack $element ) { $element_data = $element->get_data(); $method = 'on_import'; if ( method_exists( $element, $method ) ) { // TODO: Use the internal element data without parameters. $element_data = $element->{$method}( $element_data ); } foreach ( $element->get_controls() as $control ) { $control_class = \Elementor\Plugin::instance()->controls_manager->get_control( $control['type'] ); // If the control isn't exist, like a plugin that creates the control but deactivated. if ( ! $control_class ) { return $element_data; } if ( method_exists( $control_class, $method ) ) { if ( 'media' !== $control['type'] && 'hedia' !== $control['type'] && 'repeater' !== $control['type'] ) { $element_data['settings'][ $control['name'] ] = $control_class->{$method}( $element->get_settings( $control['name'] ), $control ); } elseif ( 'repeater' === $control['type'] ) { $element_data['settings'][ $control['name'] ] = self::on_import_repeater( $element->get_settings( $control['name'] ), $control ); } elseif ( ! empty( $element_data['settings'][ $control['name'] ]['url'] ) ) { $element_data['settings'][ $control['name'] ] = self::on_import_media( $element->get_settings( $control['name'] ) ); } } } return $element_data; } protected static function on_import_media( $settings ) { if ( empty( $settings['url'] ) || false != strpos( $settings['url'], 'placeholder' ) ) { return $settings; } $settings = \Elementor\Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings ); return $settings; } protected static function on_import_repeater( $settings, $control_data = array() ) { 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 = \Elementor\Plugin::$instance->controls_manager->get_control( $field['type'] ); if ( ! $control_obj ) { continue; } if ( method_exists( $control_obj, $method ) ) { if ( 'media' !== $field['type'] && 'hedia' !== $field['type'] ) { $item[ $field['name'] ] = $control_obj->{$method}( $item[ $field['name'] ], $field ); } elseif ( ! empty( $item[ $field['name'] ]['url'] ) ) { $item[ $field['name'] ] = self::on_import_media( $item[ $field['name'] ] ); } } } } return $settings; } /** * Returns the instance. * * @since 3.21.1 * @return object * * @param array $shortcodes shortcodes. */ public static function get_instance( $shortcodes = array() ) { if ( ! isset( self::$instance ) ) { self::$instance = new self( $shortcodes ); } return self::$instance; } } }