Файловый менеджер - Редактировать - /var/www/xthruster/html/wp-content/uploads/flags/library.tar
Назад
classes/shortcode.php 0000644 00000004171 14720520437 0010713 0 ustar 00 <?php namespace ElementorPro\Modules\Library\Classes; use Elementor\TemplateLibrary\Source_Local; use ElementorPro\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Shortcode { const SHORTCODE = 'elementor-template'; public function __construct() { $this->add_actions(); } public function admin_columns_headers( $defaults ) { $defaults['shortcode'] = esc_html__( 'Shortcode', 'elementor-pro' ); return $defaults; } public function admin_columns_content( $column_name, $post_id ) { if ( 'shortcode' !== $column_name ) { return; } printf( '<label class="screen-reader-text" for="%1$s">%2$s</label><input class="elementor-shortcode-input" type="text" id="%1$s" readonly onfocus="this.select()" value="%3$s" />', sprintf( /* translators: %s: Template ID. */ esc_attr( 'elementor-templte-%s-shortcode' ), $post_id // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ), sprintf( /* translators: %s: Template ID. */ esc_html__( 'Elementor template shortcode for template %s', 'elementor-pro' ), $post_id // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ), sprintf( /* translators: %s: Shortcode, %d: Template ID. */ esc_attr( '[%s id="%d"]' ), self::SHORTCODE, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $post_id // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ) ); } public function shortcode( $attributes = [] ) { if ( empty( $attributes['id'] ) ) { return ''; } $include_css = false; if ( isset( $attributes['css'] ) && 'false' !== $attributes['css'] ) { $include_css = (bool) $attributes['css']; } return Plugin::elementor()->frontend->get_builder_content_for_display( $attributes['id'], $include_css ); } private function add_actions() { if ( is_admin() ) { add_action( 'manage_' . Source_Local::CPT . '_posts_columns', [ $this, 'admin_columns_headers' ] ); add_action( 'manage_' . Source_Local::CPT . '_posts_custom_column', [ $this, 'admin_columns_content' ], 10, 2 ); } add_shortcode( self::SHORTCODE, [ $this, 'shortcode' ] ); } } wp-widgets/elementor-library.php 0000644 00000012005 14720520437 0013005 0 ustar 00 <?php namespace ElementorPro\Modules\Library\WP_Widgets; use Elementor\Core\Base\Document; use ElementorPro\Modules\Library\Module; use ElementorPro\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Elementor_Library extends \WP_Widget { private $sidebar_id; public function __construct() { parent::__construct( 'elementor-library', esc_html__( 'Elementor Library', 'elementor-pro' ), [ 'description' => esc_html__( 'Embed your saved elements.', 'elementor-pro' ), ] ); } /** * @param array $args * @param array $instance */ public function widget( $args, $instance ) { // PHPCS - Theme arg echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( ! empty( $instance['title'] ) ) { /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); // PHPCS - Theme arg echo $args['before_title'] . esc_html( $title ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } if ( ! empty( $instance['template_id'] ) && 'publish' === get_post_status( $instance['template_id'] ) ) { $this->sidebar_id = $args['id']; add_filter( 'elementor/frontend/builder_content_data', [ $this, 'filter_content_data' ] ); // PHPCS - the main content echo Plugin::elementor()->frontend->get_builder_content_for_display( $instance['template_id'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped remove_filter( 'elementor/frontend/builder_content_data', [ $this, 'filter_content_data' ] ); unset( $this->sidebar_id ); } // PHPCS - Theme arg echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Avoid nesting a sidebar within a template that will appear in the sidebar itself * * @param array $data * * @return mixed */ public function filter_content_data( $data ) { if ( ! empty( $data ) ) { $data = Plugin::elementor()->db->iterate_data( $data, function( $element ) { if ( 'widget' === $element['elType'] && 'sidebar' === $element['widgetType'] && $this->sidebar_id === $element['settings']['sidebar'] ) { $element['settings']['sidebar'] = null; } return $element; } ); } return $data; } /** * @param array $instance * * @return void */ public function form( $instance ) { $default = [ 'title' => '', 'template_id' => '', ]; $instance = array_merge( $default, $instance ); $templates = Module::get_templates(); if ( ! $templates ) { // PHPCS - the method empty_templates_message is safe. echo Module::empty_templates_message(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped return; } ?> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title', 'elementor-pro' ); ?>:</label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>"> </p> <p> <label for="<?php echo esc_attr( $this->get_field_id( 'template_id' ) ); ?>"><?php esc_attr_e( 'Choose Template', 'elementor-pro' ); ?>:</label> <select class="widefat elementor-widget-template-select" id="<?php echo esc_attr( $this->get_field_id( 'template_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'template_id' ) ); ?>"> <option value="">— <?php echo esc_html__( 'Select', 'elementor-pro' ); ?> —</option> <?php foreach ( $templates as $template ) : ?> <option value="<?php echo esc_html( $template['template_id'] ); ?>" <?php selected( $template['template_id'], $instance['template_id'] ); ?> data-type="<?php echo esc_attr( $template['type'] ); ?>" > <?php echo esc_html( $template['title'] ); ?> (<?php echo esc_html( $template['type'] ); ?>) </option> <?php endforeach; ?> </select> <?php $style = ' style="display:none"'; $template_type = get_post_meta( $instance['template_id'], Document::TYPE_META_KEY, true ); // 'widget' is editable only from an Elementor page if ( 'page' === $template_type ) { $style = ''; } ?> <a target="_blank" class="elementor-edit-template"<?php echo $style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> href="<?php echo esc_url( add_query_arg( 'elementor', '', get_permalink( $instance['template_id'] ) ) ); ?>" > <i class="eicon-pencil"></i> <?php echo esc_html__( 'Edit Template', 'elementor-pro' ); ?> </a> </p> <?php } /** * * @param array $new_instance * @param array $old_instance * * @return array */ public function update( $new_instance, $old_instance ) { $instance = []; $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; $instance['template_id'] = $new_instance['template_id']; return $instance; } } module.php 0000644 00000010066 14720520437 0006551 0 ustar 00 <?php namespace ElementorPro\Modules\Library; use Elementor\Core\Base\Document; use Elementor\TemplateLibrary\Source_Local; use ElementorPro\Base\Module_Base; use ElementorPro\Modules\Library\Classes\Shortcode; use ElementorPro\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Module extends Module_Base { public function get_widgets() { return [ 'Template', ]; } public function __construct() { parent::__construct(); $this->add_filters(); $this->add_actions(); new Shortcode(); } public function get_name() { return 'library'; } public function register_wp_widgets() { register_widget( 'ElementorPro\Modules\Library\WP_Widgets\Elementor_Library' ); } public function add_to_results_for_library_widget_templates( $val, $post, $request ) { $document = Plugin::elementor()->documents->get( $post->ID ); if ( $document ) { return true; } return false; } public function format_post_title_for_library_widget_templates( $post_title, $post_id, $request ) { $document = Plugin::elementor()->documents->get( $post_id ); return $post_title . ' (' . $document->get_post_type_title() . ')'; } public function add_actions() { add_action( 'widgets_init', [ $this, 'register_wp_widgets' ] ); } /** * @deprecated 2.6.0 No longer used by internal code. See Autocomplete documentation in Query-Control Module. * @param array $results * @param array $data * * @return array */ public function get_autocomplete_for_library_widget_templates( array $results, array $data ) { $document_types = Plugin::elementor()->documents->get_document_types( [ 'show_in_library' => true, ] ); $query_params = [ 's' => $data['q'], 'post_type' => Source_Local::CPT, 'posts_per_page' => -1, 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => [ [ 'key' => Document::TYPE_META_KEY, 'value' => array_keys( $document_types ), 'compare' => 'IN', ], ], ]; $query = new \WP_Query( $query_params ); $results = []; foreach ( $query->posts as $post ) { $document = Plugin::elementor()->documents->get( $post->ID ); if ( $document ) { $results[] = [ 'id' => $post->ID, 'text' => esc_html( $post->post_title ) . ' (' . $document->get_post_type_title() . ')', ]; } } return $results; } /** * @deprecated 2.6.0 No longer used by internal code. See Autocomplete documentation in Query-Control Module. * @param $results * @param $request * * @return mixed */ public function get_value_title_for_library_widget_templates( $results, $request ) { $ids = (array) $request['id']; $query = new \WP_Query( [ 'post_type' => Source_Local::CPT, 'post__in' => $ids, 'posts_per_page' => -1, ] ); foreach ( $query->posts as $post ) { $document = Plugin::elementor()->documents->get( $post->ID ); if ( $document ) { $results[ $post->ID ] = esc_html( $post->post_title ) . ' (' . $document->get_post_type_title() . ')'; } } return $results; } public function add_filters() { add_filter( 'elementor/widgets/black_list', function( $black_list ) { $black_list[] = 'ElementorPro\Modules\Library\WP_Widgets\Elementor_Library'; return $black_list; } ); } public static function get_templates() { return Plugin::elementor()->templates_manager->get_source( 'local' )->get_items(); } public static function empty_templates_message() { return '<div id="elementor-widget-template-empty-templates"> <div class="elementor-widget-template-empty-templates-icon"><i class="eicon-nerd" aria-hidden="true"></i></div> <div class="elementor-widget-template-empty-templates-title">' . esc_html__( 'You Haven’t Saved Templates Yet.', 'elementor-pro' ) . '</div> <div class="elementor-widget-template-empty-templates-footer">' . esc_html__( 'Want to learn more about Elementor library?', 'elementor-pro' ) . ' <a class="elementor-widget-template-empty-templates-footer-url" href="https://go.elementor.com/docs-library/" target="_blank">' . esc_html__( 'Click Here', 'elementor-pro' ) . '</a> </div> </div>'; } } widgets/template.php 0000644 00000004662 14720520437 0010552 0 ustar 00 <?php namespace ElementorPro\Modules\Library\Widgets; use Elementor\Core\Base\Document; use ElementorPro\Base\Base_Widget; use ElementorPro\Modules\QueryControl\Module as QueryControlModule; use ElementorPro\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Template extends Base_Widget { public function get_name() { return 'template'; } public function get_title() { return esc_html__( 'Template', 'elementor-pro' ); } public function get_icon() { return 'eicon-document-file'; } public function get_keywords() { return [ 'elementor', 'template', 'library', 'block', 'page' ]; } public function is_reload_preview_required() { return false; } /** * @since 3.6.0 * * @deprecated 3.8.0 * On_Import_Trait::on_import_update_dynamic_content() should be used instead. * Remove in the future. */ public static function on_import_replace_dynamic_content( $config, $map_old_new_post_ids ) { if ( isset( $config['settings']['template_id'] ) ) { $config['settings']['template_id'] = $map_old_new_post_ids[ $config['settings']['template_id'] ]; } return $config; } protected function register_controls() { $this->start_controls_section( 'section_template', [ 'label' => esc_html__( 'Template', 'elementor-pro' ), ] ); $document_types = Plugin::elementor()->documents->get_document_types( [ 'show_in_library' => true, ] ); $this->add_control( 'template_id', [ 'label' => esc_html__( 'Choose Template', 'elementor-pro' ), 'type' => QueryControlModule::QUERY_CONTROL_ID, 'label_block' => true, 'autocomplete' => [ 'object' => QueryControlModule::QUERY_OBJECT_LIBRARY_TEMPLATE, 'query' => [ 'meta_query' => [ [ 'key' => Document::TYPE_META_KEY, 'value' => array_keys( $document_types ), 'compare' => 'IN', ], ], ], ], ] ); $this->end_controls_section(); } protected function render() { $template_id = $this->get_settings( 'template_id' ); if ( empty( $template_id ) ) { return; } if ( 'publish' !== get_post_status( $template_id ) ) { return; } ?> <div class="elementor-template"> <?php // PHPCS - should not be escaped. echo Plugin::elementor()->frontend->get_builder_content_for_display( $template_id ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </div> <?php } public function render_plain_content() {} } traits/library.php 0000644 00000002021 14720522070 0010221 0 ustar 00 <?php namespace Elementor\Modules\Library\Traits; use Elementor\TemplateLibrary\Source_Local; /** * Elementor Library Trait * * This trait is used by all Library Documents and Landing Pages. * * @since 3.1.0 */ trait Library { /** * Print Admin Column Type * * Runs on WordPress' 'manage_{custom post type}_posts_custom_column' hook to modify each row's content. * * @since 3.1.0 * @access public */ public function print_admin_column_type() { $admin_filter_url = admin_url( Source_Local::ADMIN_MENU_SLUG . '&elementor_library_type=' . $this->get_name() ); //PHPCS - Not a user input printf( '<a href="%s">%s</a>', $admin_filter_url, $this->get_title() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Save document type. * * Set new/updated document type. * * @since 3.1.0 * @access public */ public function save_template_type() { parent::save_template_type(); wp_set_object_terms( $this->post->ID, $this->get_name(), Source_Local::TAXONOMY_TYPE_SLUG ); } } user-favorites.php 0000644 00000005265 14720522070 0010242 0 ustar 00 <?php namespace Elementor\Modules\Library; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class User_Favorites { const USER_META_KEY = 'elementor_library_favorites'; /** * @var int */ private $user_id; /** * @var array|null */ private $cache; /** * User_Favorites constructor. * * @param $user_id */ public function __construct( $user_id ) { $this->user_id = $user_id; } /** * @param null $vendor * @param null $resource * @param false $ignore_cache * * @return array */ public function get( $vendor = null, $resource = null, $ignore_cache = false ) { if ( $ignore_cache || empty( $this->cache ) ) { $this->cache = get_user_meta( $this->user_id, self::USER_META_KEY, true ); } if ( ! $this->cache || ! is_array( $this->cache ) ) { return []; } if ( $vendor && $resource ) { $key = $this->get_key( $vendor, $resource ); return isset( $this->cache[ $key ] ) ? $this->cache[ $key ] : []; } return $this->cache; } /** * @param $vendor * @param $resource * @param $id * * @return bool */ public function exists( $vendor, $resource, $id ) { return in_array( $id, $this->get( $vendor, $resource ), true ); } /** * @param $vendor * @param $resource * @param array $value * * @return $this * @throws \Exception */ public function save( $vendor, $resource, $value = [] ) { $all_favorites = $this->get(); $all_favorites[ $this->get_key( $vendor, $resource ) ] = $value; $result = update_user_meta( $this->user_id, self::USER_META_KEY, $all_favorites ); if ( false === $result ) { throw new \Exception( 'Failed to save user favorites.' ); } $this->cache = $all_favorites; return $this; } /** * @param $vendor * @param $resource * @param $id * * @return $this * @throws \Exception */ public function add( $vendor, $resource, $id ) { $favorites = $this->get( $vendor, $resource ); if ( in_array( $id, $favorites, true ) ) { return $this; } $favorites[] = $id; $this->save( $vendor, $resource, $favorites ); return $this; } /** * @param $vendor * @param $resource * @param $id * * @return $this * @throws \Exception */ public function remove( $vendor, $resource, $id ) { $favorites = $this->get( $vendor, $resource ); if ( ! in_array( $id, $favorites, true ) ) { return $this; } $favorites = array_filter( $favorites, function ( $item ) use ( $id ) { return $item !== $id; } ); $this->save( $vendor, $resource, $favorites ); return $this; } /** * @param $vendor * @param $resource * * @return string */ private function get_key( $vendor, $resource ) { return "{$vendor}/{$resource}"; } } documents/not-supported.php 0000644 00000002673 14720522070 0012110 0 ustar 00 <?php namespace Elementor\Modules\Library\Documents; use Elementor\TemplateLibrary\Source_Local; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } /** * Elementor section library document. * * Elementor section library document handler class is responsible for * handling a document of a section type. * */ class Not_Supported extends Library_Document { /** * Get document properties. * * Retrieve the document properties. * * @access public * @static * * @return array Document properties. */ public static function get_properties() { $properties = parent::get_properties(); $properties['admin_tab_group'] = ''; $properties['register_type'] = false; $properties['is_editable'] = false; $properties['show_in_library'] = false; $properties['show_in_finder'] = false; return $properties; } public static function get_type() { return 'not-supported'; } /** * Get document title. * * Retrieve the document title. * * @access public * @static * * @return string Document title. */ public static function get_title() { return esc_html__( 'Not Supported', 'elementor' ); } public function save_template_type() { // Do nothing. } public function print_admin_column_type() { Utils::print_unescaped_internal_string( self::get_title() ); } public function filter_admin_row_actions( $actions ) { unset( $actions['view'] ); return $actions; } } documents/container.php 0000644 00000002135 14720522070 0011240 0 ustar 00 <?php namespace Elementor\Modules\Library\Documents; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } /** * Elementor container library document. * * Elementor container library document handler class is responsible for * handling a document of a container type. * * @since 2.0.0 */ class Container extends Library_Document { public static function get_properties() { $properties = parent::get_properties(); $properties['support_kit'] = true; return $properties; } /** * Get document name. * * Retrieve the document name. * * @since 2.0.0 * @access public * * @return string Document name. */ public function get_name() { return 'container'; } /** * Get document title. * * Retrieve the document title. * * @since 2.0.0 * @access public * @static * * @return string Document title. */ public static function get_title() { return esc_html__( 'Container', 'elementor' ); } /** * Get Type * * Return the container document type. * * @return string */ public static function get_type() { return 'container'; } } documents/page.php 0000644 00000003521 14720522070 0010172 0 ustar 00 <?php namespace Elementor\Modules\Library\Documents; use Elementor\Core\DocumentTypes\Post; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } /** * Elementor page library document. * * Elementor page library document handler class is responsible for * handling a document of a page type. * * @since 2.0.0 */ class Page extends Library_Document { /** * Get document properties. * * Retrieve the document properties. * * @since 2.0.0 * @access public * @static * * @return array Document properties. */ public static function get_properties() { $properties = parent::get_properties(); $properties['support_wp_page_templates'] = true; $properties['support_kit'] = true; $properties['show_in_finder'] = true; return $properties; } public static function get_type() { return 'page'; } /** * Get document title. * * Retrieve the document title. * * @since 2.0.0 * @access public * @static * * @return string Document title. */ public static function get_title() { return esc_html__( 'Page', 'elementor' ); } public static function get_plural_title() { return esc_html__( 'Pages', 'elementor' ); } public static function get_add_new_title() { return esc_html__( 'Add New Page Template', 'elementor' ); } /** * @since 2.1.3 * @access public */ public function get_css_wrapper_selector() { return 'body.elementor-page-' . $this->get_main_id(); } /** * @since 3.1.0 * @access protected */ protected function register_controls() { parent::register_controls(); Post::register_hide_title_control( $this ); Post::register_style_controls( $this ); } protected function get_remote_library_config() { $config = parent::get_remote_library_config(); $config['type'] = 'page'; $config['default_route'] = 'templates/pages'; return $config; } } documents/library-document.php 0000644 00000003261 14720522070 0012537 0 ustar 00 <?php namespace Elementor\Modules\Library\Documents; use Elementor\Core\Base\Document; use Elementor\Modules\Library\Traits\Library; use Elementor\TemplateLibrary\Source_Local; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } /** * Elementor library document. * * Elementor library document handler class is responsible for handling * a document of the library type. * * @since 2.0.0 */ abstract class Library_Document extends Document { // Library Document Trait use Library; /** * The taxonomy type slug for the library document. */ const TAXONOMY_TYPE_SLUG = 'elementor_library_type'; /** * Get document properties. * * Retrieve the document properties. * * @since 2.0.0 * @access public * @static * * @return array Document properties. */ public static function get_properties() { $properties = parent::get_properties(); $properties['admin_tab_group'] = 'library'; $properties['show_in_library'] = true; $properties['register_type'] = true; $properties['cpt'] = [ Source_Local::CPT ]; return $properties; } /** * Get initial config. * * Retrieve the current element initial configuration. * * Adds more configuration on top of the controls list and the tabs assigned * to the control. This method also adds element name, type, icon and more. * * @since 2.9.0 * @access protected * * @return array The initial config. */ public function get_initial_config() { $config = parent::get_initial_config(); $config['library'] = [ 'save_as_same_type' => true, ]; return $config; } public function get_content( $with_css = false ) { return do_shortcode( parent::get_content( $with_css ) ); } } documents/section.php 0000644 00000001665 14720522070 0010731 0 ustar 00 <?php namespace Elementor\Modules\Library\Documents; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } /** * Elementor section library document. * * Elementor section library document handler class is responsible for * handling a document of a section type. * * @since 2.0.0 */ class Section extends Library_Document { public static function get_properties() { $properties = parent::get_properties(); $properties['support_kit'] = true; $properties['show_in_finder'] = true; return $properties; } public static function get_type() { return 'section'; } /** * Get document title. * * Retrieve the document title. * * @since 2.0.0 * @access public * @static * * @return string Document title. */ public static function get_title() { return esc_html__( 'Section', 'elementor' ); } public static function get_plural_title() { return esc_html__( 'Sections', 'elementor' ); } } Requests.php 0000644 00000000405 14721717330 0007074 0 ustar 00 <?php /** * Loads the old Requests class file when the autoloader * references the original PSR-0 Requests class. * * @deprecated 6.2.0 * @package WordPress * @subpackage Requests * @since 6.2.0 */ include_once ABSPATH . WPINC . '/class-requests.php';
| ver. 1.4 |
Github
|
.
| PHP 7.4.3-4ubuntu2.24 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка