8889841ctags/post-terms.php 0000644 00000005106 15051517101 0010326 0 ustar 00 true,
'object_type' => [ get_post_type() ],
];
/**
* Dynamic tags taxonomy args.
*
* Filters the taxonomy arguments used to retrieve the registered taxonomies
* displayed in the taxonomy dynamic tag.
*
* @since 2.0.0
*
* @param array $taxonomy_filter_args An array of `key => value` arguments to
* match against the taxonomy objects inside
* the `get_taxonomies()` function.
*/
$taxonomy_filter_args = apply_filters( 'elementor_pro/dynamic_tags/post_terms/taxonomy_args', $taxonomy_filter_args );
$taxonomies = Utils::get_taxonomies( $taxonomy_filter_args, 'objects' );
$options = [];
foreach ( $taxonomies as $taxonomy => $object ) {
$options[ $taxonomy ] = $object->label;
}
$this->add_control(
'taxonomy',
[
'label' => esc_html__( 'Taxonomy', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => $options,
'default' => 'post_tag',
]
);
$this->add_control(
'separator',
[
'label' => esc_html__( 'Separator', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'default' => ', ',
]
);
$this->add_control(
'link',
[
'label' => esc_html__( 'Link', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
}
public function render() {
$settings = $this->get_settings();
if ( 'yes' === $settings['link'] ) {
$value = get_the_term_list( get_the_ID(), $settings['taxonomy'], '', $settings['separator'] );
} else {
$terms = get_the_terms( get_the_ID(), $settings['taxonomy'] );
if ( is_wp_error( $terms ) || empty( $terms ) ) {
return '';
}
$term_names = [];
foreach ( $terms as $term ) {
$term_names[] = '' . $term->name . '';
}
$value = implode( $settings['separator'], $term_names );
}
echo wp_kses_post( $value );
}
}
tags/site-tagline.php 0000644 00000001173 15051517101 0010576 0 ustar 00 get_settings();
$type = $settings['type'];
$url = '';
if ( 'post' === $type && ! empty( $settings['post_id'] ) ) {
$url = get_permalink( (int) $settings['post_id'] );
} elseif ( 'taxonomy' === $type && ! empty( $settings['taxonomy_id'] ) ) {
$url = get_term_link( (int) $settings['taxonomy_id'] );
} elseif ( 'attachment' === $type && ! empty( $settings['attachment_id'] ) ) {
$url = get_attachment_link( (int) $settings['attachment_id'] );
} elseif ( 'author' === $type && ! empty( $settings['author_id'] ) ) {
$url = get_author_posts_url( (int) $settings['author_id'] );
}
if ( ! is_wp_error( $url ) ) {
return $url;
}
return '';
}
protected function register_controls() {
$this->add_control( 'type', [
'label' => esc_html__( 'Type', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'post' => esc_html__( 'Content', 'elementor-pro' ),
'taxonomy' => esc_html__( 'Taxonomy', 'elementor-pro' ),
'attachment' => esc_html__( 'Media', 'elementor-pro' ),
'author' => esc_html__( 'Author', 'elementor-pro' ),
],
] );
$this->add_control( 'post_id', [
'label' => esc_html__( 'Search & Select', 'elementor-pro' ),
'type' => QueryModule::QUERY_CONTROL_ID,
'options' => [],
'label_block' => true,
'autocomplete' => [
'object' => QueryModule::QUERY_OBJECT_POST,
'display' => 'detailed',
'query' => [
'post_type' => 'any',
],
],
'condition' => [
'type' => 'post',
],
] );
$this->add_control( 'taxonomy_id', [
'label' => esc_html__( 'Search & Select', 'elementor-pro' ),
'type' => QueryModule::QUERY_CONTROL_ID,
'options' => [],
'label_block' => true,
'autocomplete' => [
'object' => QueryModule::QUERY_OBJECT_TAX,
'display' => 'detailed',
],
'condition' => [
'type' => 'taxonomy',
],
] );
$this->add_control( 'attachment_id', [
'label' => esc_html__( 'Search & Select', 'elementor-pro' ),
'type' => QueryModule::QUERY_CONTROL_ID,
'options' => [],
'label_block' => true,
'autocomplete' => [
'object' => QueryModule::QUERY_OBJECT_ATTACHMENT,
'display' => 'detailed',
],
'condition' => [
'type' => 'attachment',
],
] );
$this->add_control( 'author_id', [
'label' => esc_html__( 'Search & Select', 'elementor-pro' ),
'type' => QueryModule::QUERY_CONTROL_ID,
'options' => [],
'label_block' => true,
'autocomplete' => [
'object' => QueryModule::QUERY_OBJECT_AUTHOR,
'display' => 'detailed',
],
'condition' => [
'type' => 'author',
],
] );
}
}
tags/author-name.php 0000644 00000001156 15051517101 0010432 0 ustar 00 get_settings( 'include_context' );
$title = Utils::get_page_title( $include_context );
echo wp_kses_post( $title );
}
protected function register_controls() {
$this->add_control(
'include_context',
[
'label' => esc_html__( 'Include Context', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
}
}
tags/post-date.php 0000644 00000005123 15051517101 0010110 0 ustar 00 add_control(
'type',
[
'label' => esc_html__( 'Type', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'post_date_gmt' => esc_html__( 'Post Published', 'elementor-pro' ),
'post_modified_gmt' => esc_html__( 'Post Modified', 'elementor-pro' ),
],
'default' => 'post_date_gmt',
]
);
$this->add_control(
'format',
[
'label' => esc_html__( 'Format', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'elementor-pro' ),
'F j, Y' => gmdate( 'F j, Y' ),
'Y-m-d' => gmdate( 'Y-m-d' ),
'm/d/Y' => gmdate( 'm/d/Y' ),
'd/m/Y' => gmdate( 'd/m/Y' ),
'human' => esc_html__( 'Human Readable', 'elementor-pro' ),
'custom' => esc_html__( 'Custom', 'elementor-pro' ),
],
'default' => 'default',
]
);
$this->add_control(
'custom_format',
[
'label' => esc_html__( 'Custom Format', 'elementor-pro' ),
'default' => '',
'description' => sprintf( '%s', esc_html__( 'Documentation on date and time formatting', 'elementor-pro' ) ),
'condition' => [
'format' => 'custom',
],
]
);
}
public function render() {
$date_type = $this->get_settings( 'type' );
$format = $this->get_settings( 'format' );
if ( 'human' === $format ) {
/* translators: %s: Human readable date/time. */
$value = sprintf( esc_html__( '%s ago', 'elementor-pro' ), human_time_diff( strtotime( get_post()->{$date_type} ) ) );
} else {
switch ( $format ) {
case 'default':
$date_format = '';
break;
case 'custom':
$date_format = $this->get_settings( 'custom_format' );
break;
default:
$date_format = $format;
break;
}
if ( 'post_date_gmt' === $date_type ) {
$value = get_the_date( $date_format );
} else {
$value = get_the_modified_date( $date_format );
}
}
echo wp_kses_post( $value );
}
}
tags/archive-description.php 0000644 00000001224 15051517101 0012150 0 ustar 00 get_settings();
$request_type = isset( $settings['request_type'] ) ? strtoupper( $settings['request_type'] ) : false;
$param_name = isset( $settings['param_name'] ) ? $settings['param_name'] : false;
$value = '';
if ( ! $param_name || ! $request_type ) {
return '';
}
switch ( $request_type ) {
case 'POST':
$value = Utils::_unstable_get_super_global_value( $_POST, $param_name ) ?? ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing
break;
case 'GET':
$value = Utils::_unstable_get_super_global_value( $_GET, $param_name ) ?? ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
break;
case 'QUERY_VAR':
$value = get_query_var( $param_name );
break;
}
echo htmlentities( wp_kses_post( $value ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
protected function register_controls() {
$this->add_control(
'request_type',
[
'label' => esc_html__( 'Type', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'get',
'options' => [
'get' => 'Get',
'post' => 'Post',
'query_var' => 'Query Var',
],
]
);
$this->add_control(
'param_name',
[
'label' => esc_html__( 'Parameter Name', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
]
);
}
}
tags/comments-number.php 0000644 00000004175 15051517101 0011331 0 ustar 00 add_control(
'format_no_comments',
[
'label' => esc_html__( 'No Comments Format', 'elementor-pro' ),
'default' => esc_html__( 'No Responses', 'elementor-pro' ),
]
);
$this->add_control(
'format_one_comments',
[
'label' => esc_html__( 'One Comment Format', 'elementor-pro' ),
'default' => esc_html__( 'One Response', 'elementor-pro' ),
]
);
$this->add_control(
'format_many_comments',
[
'label' => esc_html__( 'Many Comment Format', 'elementor-pro' ),
'default' => esc_html__( '{number} Responses', 'elementor-pro' ),
]
);
$this->add_control(
'link_to',
[
'label' => esc_html__( 'Link', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__( 'None', 'elementor-pro' ),
'comments_link' => esc_html__( 'Comments Link', 'elementor-pro' ),
],
]
);
}
public function render() {
$settings = $this->get_settings();
$comments_number = get_comments_number();
if ( ! $comments_number ) {
$count = $settings['format_no_comments'];
} elseif ( 1 === $comments_number ) {
$count = $settings['format_one_comments'];
} else {
$count = strtr( $settings['format_many_comments'], [
'{number}' => number_format_i18n( $comments_number ),
] );
}
if ( 'comments_link' === $this->get_settings( 'link_to' ) ) {
$count = sprintf( '%s', get_comments_link(), $count );
}
echo wp_kses_post( $count );
}
}
tags/post-custom-field.php 0000644 00000003702 15051517101 0011567 0 ustar 00 add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => $this->get_custom_keys_array(),
]
);
$this->add_control(
'custom_key',
[
'label' => esc_html__( 'Custom Key', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'placeholder' => 'key',
'condition' => [
'key' => '',
],
]
);
}
public function render() {
$key = $this->get_settings( 'key' );
if ( empty( $key ) ) {
$key = $this->get_settings( 'custom_key' );
}
if ( empty( $key ) ) {
return;
}
$value = get_post_meta( get_the_ID(), $key, true );
echo wp_kses_post( $value );
}
private function get_custom_keys_array() {
$custom_keys = get_post_custom_keys();
$options = [
'' => esc_html__( 'Select...', 'elementor-pro' ),
];
if ( ! empty( $custom_keys ) ) {
foreach ( $custom_keys as $custom_key ) {
if ( '_' !== substr( $custom_key, 0, 1 ) ) {
$options[ $custom_key ] = $custom_key;
}
}
}
return $options;
}
}
tags/lightbox.php 0000644 00000006171 15051517101 0010034 0 ustar 00 add_control(
'type',
[
'label' => esc_html__( 'Type', 'elementor-pro' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'video' => [
'title' => esc_html__( 'Video', 'elementor-pro' ),
'icon' => 'eicon-video-camera',
],
'image' => [
'title' => esc_html__( 'Image', 'elementor-pro' ),
'icon' => 'eicon-image-bold',
],
],
]
);
$this->add_control(
'image',
[
'label' => esc_html__( 'Image', 'elementor-pro' ),
'type' => Controls_Manager::MEDIA,
'condition' => [
'type' => 'image',
],
]
);
$this->add_control(
'video_url',
[
'label' => esc_html__( 'Video URL', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'condition' => [
'type' => 'video',
],
]
);
}
private function get_image_settings( $settings ) {
$image_settings = [
'url' => $settings['image']['url'],
'type' => 'image',
];
$image_id = $settings['image']['id'];
if ( $image_id ) {
$lightbox_image_attributes = Plugin::elementor()->images_manager->get_lightbox_image_attributes( $image_id );
$image_settings = array_merge( $image_settings, $lightbox_image_attributes );
}
return $image_settings;
}
private function get_video_settings( $settings ) {
$video_properties = Embed::get_video_properties( $settings['video_url'] );
$video_url = null;
if ( ! $video_properties ) {
$video_type = 'hosted';
$video_url = $settings['video_url'];
} else {
$video_type = $video_properties['provider'];
$video_url = Embed::get_embed_url( $settings['video_url'] );
}
if ( null === $video_url ) {
return '';
}
return [
'type' => 'video',
'videoType' => $video_type,
'url' => $video_url,
];
}
public function render() {
$settings = $this->get_settings();
$value = [];
if ( ! $settings['type'] ) {
return;
}
if ( 'image' === $settings['type'] && $settings['image'] ) {
$value = $this->get_image_settings( $settings );
} elseif ( 'video' === $settings['type'] && $settings['video_url'] ) {
$value = $this->get_video_settings( $settings );
}
if ( ! $value ) {
return;
}
// PHPCS - the method Plugin::elementor()->frontend->create_action_hash is safe.
echo Plugin::elementor()->frontend->create_action_hash( 'lightbox', $value ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
tags/author-info.php 0000644 00000002350 15051517101 0010442 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return;
}
$value = get_the_author_meta( $key );
echo wp_kses_post( $value );
}
public function get_panel_template_setting_key() {
return 'key';
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Field', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'description',
'options' => [
'description' => esc_html__( 'Bio', 'elementor-pro' ),
'email' => esc_html__( 'Email', 'elementor-pro' ),
'url' => esc_html__( 'Website', 'elementor-pro' ),
],
]
);
}
}
tags/post-excerpt.php 0000644 00000005020 15051517101 0010641 0 ustar 00 add_control(
'max_length',
[
'label' => esc_html__( 'Excerpt Length', 'elementor-pro' ),
'type' => Controls_Manager::NUMBER,
]
);
$this->add_control(
'apply_to_post_content',
[
'label' => esc_html__( 'Apply to post content', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Yes', 'elementor-pro' ),
'label_off' => esc_html__( 'No', 'elementor-pro' ),
'default' => 'no',
]
);
}
public function get_categories() {
return [ Module::TEXT_CATEGORY ];
}
public function should_get_excerpt_from_post_content( $settings ) {
return 'yes' === $settings['apply_to_post_content'];
}
public function is_post_excerpt_valid( $settings, $post ) {
if ( ! $post ) {
return false;
}
if ( empty( $post->post_excerpt ) && ! $this->should_get_excerpt_from_post_content( $settings ) ) {
return false;
}
if ( empty( $post->post_excerpt ) && empty( $post->post_content ) && $this->should_get_excerpt_from_post_content( $settings ) ) {
return false;
}
if ( empty( $post->post_excerpt ) && empty( $post->post_content ) ) {
return false;
}
return true;
}
public function get_post_excerpt( $settings, $post ) {
$post_excerpt = $post->post_excerpt ?? '';
if ( empty( $post_excerpt ) && ! empty( $post->post_content ) && $this->should_get_excerpt_from_post_content( $settings ) ) {
$post_excerpt = apply_filters( 'the_excerpt', get_the_excerpt( $post ) );
}
return $post_excerpt;
}
public function render() {
// Allow only a real `post_excerpt` and not the trimmed `post_content` from the `get_the_excerpt` filter
$post = get_post();
$settings = $this->get_settings_for_display();
if ( ! $this->is_post_excerpt_valid( $settings, $post ) ) {
return;
}
$max_length = (int) $settings['max_length'];
$excerpt = $this->get_post_excerpt( $settings, $post );
$excerpt = Utils::trim_words( $excerpt, $max_length );
echo wp_kses_post( $excerpt );
}
}
tags/author-meta.php 0000644 00000001674 15051517101 0010445 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return;
}
$value = get_the_author_meta( $key );
echo wp_kses_post( $value );
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Meta Key', 'elementor-pro' ),
]
);
}
}
tags/post-gallery.php 0000644 00000002516 15051517101 0010635 0 ustar 00 ID, array_column( $value, 'id' ), true ) ) {
$value[] = [
'id' => $image->ID,
];
}
}
return $value;
}
}
tags/current-date-time.php 0000644 00000005450 15051517101 0011544 0 ustar 00 add_control(
'date_format',
[
'label' => esc_html__( 'Date Format', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'elementor-pro' ),
'' => esc_html__( 'None', 'elementor-pro' ),
'F j, Y' => gmdate( 'F j, Y' ),
'Y-m-d' => gmdate( 'Y-m-d' ),
'm/d/Y' => gmdate( 'm/d/Y' ),
'd/m/Y' => gmdate( 'd/m/Y' ),
'custom' => esc_html__( 'Custom', 'elementor-pro' ),
],
'default' => 'default',
]
);
$this->add_control(
'time_format',
[
'label' => esc_html__( 'Time Format', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'elementor-pro' ),
'' => esc_html__( 'None', 'elementor-pro' ),
'g:i a' => gmdate( 'g:i a' ),
'g:i A' => gmdate( 'g:i A' ),
'H:i' => gmdate( 'H:i' ),
],
'default' => 'default',
'condition' => [
'date_format!' => 'custom',
],
]
);
$this->add_control(
'custom_format',
[
'label' => esc_html__( 'Custom Format', 'elementor-pro' ),
'default' => get_option( 'date_format' ) . ' ' . get_option( 'time_format' ),
'description' => sprintf( '%s', esc_html__( 'Documentation on date and time formatting', 'elementor-pro' ) ),
'condition' => [
'date_format' => 'custom',
],
]
);
}
public function render() {
$settings = $this->get_settings();
if ( 'custom' === $settings['date_format'] ) {
$format = $settings['custom_format'];
} else {
$date_format = $settings['date_format'];
$time_format = $settings['time_format'];
$format = '';
if ( 'default' === $date_format ) {
$date_format = get_option( 'date_format' );
}
if ( 'default' === $time_format ) {
$time_format = get_option( 'time_format' );
}
if ( $date_format ) {
$format = $date_format;
$has_date = true;
} else {
$has_date = false;
}
if ( $time_format ) {
if ( $has_date ) {
$format .= ' ';
}
$format .= $time_format;
}
}
$value = date_i18n( $format );
echo wp_kses_post( $value );
}
}
tags/archive-url.php 0000644 00000001361 15051517101 0010431 0 ustar 00 get_settings();
$attachment = $this->get_attacment();
if ( ! $attachment ) {
return;
}
$value = '';
switch ( $settings['attachment_data'] ) {
case 'alt':
$value = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true );
break;
case 'caption':
$value = $attachment->post_excerpt;
break;
case 'description':
$value = $attachment->post_content;
break;
case 'href':
$value = get_permalink( $attachment->ID );
break;
case 'src':
$value = $attachment->guid;
break;
case 'title':
$value = $attachment->post_title;
break;
}
echo wp_kses_post( $value );
}
protected function register_controls() {
$this->add_control(
'attachment_data',
[
'label' => esc_html__( 'Data', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'title',
'options' => [
'title' => esc_html__( 'Title', 'elementor-pro' ),
'alt' => esc_html__( 'Alt', 'elementor-pro' ),
'caption' => esc_html__( 'Caption', 'elementor-pro' ),
'description' => esc_html__( 'Description', 'elementor-pro' ),
'src' => esc_html__( 'File URL', 'elementor-pro' ),
'href' => esc_html__( 'Attachment URL', 'elementor-pro' ),
],
]
);
}
}
tags/post-id.php 0000644 00000001155 15051517101 0007570 0 ustar 00 get_settings( 'type' );
$user = wp_get_current_user();
if ( empty( $type ) || 0 === $user->ID ) {
return;
}
$value = '';
switch ( $type ) {
case 'login':
case 'email':
case 'url':
case 'nicename':
$field = 'user_' . $type;
$value = isset( $user->$field ) ? $user->$field : '';
break;
case 'id':
$value = $user->ID;
break;
case 'description':
case 'first_name':
case 'last_name':
case 'display_name':
$value = isset( $user->$type ) ? $user->$type : '';
break;
case 'meta':
$key = $this->get_settings( 'meta_key' );
if ( ! empty( $key ) ) {
$value = get_user_meta( $user->ID, $key, true );
}
break;
}
echo wp_kses_post( $value );
}
public function get_panel_template_setting_key() {
return 'type';
}
protected function register_controls() {
$this->add_control(
'type',
[
'label' => esc_html__( 'Field', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'' => esc_html__( 'Choose', 'elementor-pro' ),
'id' => esc_html__( 'ID', 'elementor-pro' ),
'display_name' => esc_html__( 'Display Name', 'elementor-pro' ),
'login' => esc_html__( 'Username', 'elementor-pro' ),
'first_name' => esc_html__( 'First Name', 'elementor-pro' ),
'last_name' => esc_html__( 'Last Name', 'elementor-pro' ),
'description' => esc_html__( 'Bio', 'elementor-pro' ),
'email' => esc_html__( 'Email', 'elementor-pro' ),
'url' => esc_html__( 'Website', 'elementor-pro' ),
'meta' => esc_html__( 'User Meta', 'elementor-pro' ),
],
]
);
$this->add_control(
'meta_key',
[
'label' => esc_html__( 'Meta Key', 'elementor-pro' ),
'condition' => [
'type' => 'meta',
],
]
);
}
}
tags/base/data-tag.php 0000644 00000000403 15051517101 0010600 0 ustar 00 get_settings( 'show_home_title' ) ) {
return;
}
if ( Plugin::elementor()->common ) {
$current_action_data = Plugin::elementor()->common->get_component( 'ajax' )->get_current_action_data();
if ( $current_action_data && 'render_tags' === $current_action_data['action'] ) {
// Override the global $post for the render.
query_posts(
[
'p' => get_the_ID(),
'post_type' => 'any',
]
);
}
}
$include_context = 'yes' === $this->get_settings( 'include_context' );
$title = Utils::get_page_title( $include_context );
echo wp_kses_post( $title );
}
protected function register_controls() {
$this->add_control(
'include_context',
[
'label' => esc_html__( 'Include Context', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
$this->add_control(
'show_home_title',
[
'label' => esc_html__( 'Show Home Title', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
]
);
}
}
tags/contact-url.php 0000644 00000026345 15051517101 0010454 0 ustar 00 add_control(
'link_type',
[
'label' => esc_html__( 'Type', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'' => '— ' . esc_html__( 'Select', 'elementor-pro' ) . ' —',
'email' => esc_html__( 'Email', 'elementor-pro' ),
'tel' => esc_html__( 'Tel', 'elementor-pro' ),
'sms' => esc_html__( 'SMS', 'elementor-pro' ),
'whatsapp' => esc_html__( 'WhatsApp', 'elementor-pro' ),
'skype' => esc_html__( 'Skype', 'elementor-pro' ),
'messenger' => esc_html__( 'Messenger', 'elementor-pro' ),
'viber' => esc_html__( 'Viber', 'elementor-pro' ),
'waze' => esc_html__( 'Waze', 'elementor-pro' ),
'google_calendar' => esc_html__( 'Google Calendar', 'elementor-pro' ),
'outlook_calendar' => esc_html__( 'Outlook Calendar', 'elementor-pro' ),
'yahoo_calendar' => esc_html__( 'Yahoo Calendar', 'elementor-pro' ),
],
]
);
$this->add_control(
'mail_to',
[
'label' => esc_html__( 'Email', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'condition' => [
'link_type' => 'email',
],
]
);
$this->add_control(
'mail_subject',
[
'label' => esc_html__( 'Subject', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'label_block' => 'true',
'condition' => [
'link_type' => 'email',
],
]
);
$this->add_control(
'mail_body',
[
'label' => esc_html__( 'Message', 'elementor-pro' ),
'type' => Controls_Manager::TEXTAREA,
'condition' => [
'link_type' => 'email',
],
]
);
$this->add_control(
'tel_number',
[
'label' => esc_html__( 'Number', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'condition' => [
'link_type' => [
'tel',
'sms',
'whatsapp',
'viber',
],
],
]
);
$this->add_control(
'username',
[
'label' => esc_html__( 'Username', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'condition' => [
'link_type' => [ 'skype', 'messenger' ],
],
]
);
$this->add_control(
'viber_action',
[
'label' => esc_html__( 'Action', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'contact' => esc_html__( 'Contact', 'elementor-pro' ),
'add' => esc_html__( 'Add', 'elementor-pro' ),
],
'default' => 'contact',
'condition' => [
'link_type' => 'viber',
],
]
);
$this->add_control(
'skype_action',
[
'label' => esc_html__( 'Action', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'call' => esc_html__( 'Call', 'elementor-pro' ),
'chat' => esc_html__( 'Chat', 'elementor-pro' ),
'userinfo' => esc_html__( 'Show Profile', 'elementor-pro' ),
'add' => esc_html__( 'Add to Contacts', 'elementor-pro' ),
'voicemail' => esc_html__( 'Send Voice Mail', 'elementor-pro' ),
],
'default' => 'call',
'condition' => [
'link_type' => 'skype',
],
]
);
$this->add_control(
'waze_address',
[
'label' => esc_html__( 'Location', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'label_block' => 'true',
'condition' => [
'link_type' => 'waze',
],
]
);
$this->add_control(
'event_title',
[
'label' => esc_html__( 'Title', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'label_block' => 'true',
'condition' => [
'link_type' => [
'google_calendar',
'outlook_calendar',
'yahoo_calendar',
],
],
]
);
$this->add_control(
'event_description',
[
'label' => esc_html__( 'Description', 'elementor-pro' ),
'type' => Controls_Manager::TEXTAREA,
'condition' => [
'link_type' => [
'google_calendar',
'outlook_calendar',
'yahoo_calendar',
],
],
]
);
$this->add_control(
'event_location',
[
'label' => esc_html__( 'Location', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'label_block' => 'true',
'condition' => [
'link_type' => [
'google_calendar',
'outlook_calendar',
'yahoo_calendar',
],
],
]
);
$this->add_control(
'event_start_date',
[
'label' => esc_html__( 'Start', 'elementor-pro' ),
'type' => Controls_Manager::DATE_TIME,
'condition' => [
'link_type' => [
'google_calendar',
'outlook_calendar',
'yahoo_calendar',
],
],
]
);
$this->add_control(
'event_end_date',
[
'label' => esc_html__( 'End', 'elementor-pro' ),
'type' => Controls_Manager::DATE_TIME,
'condition' => [
'link_type' => [
'google_calendar',
'outlook_calendar',
'yahoo_calendar',
],
],
]
);
}
protected function register_advanced_section() {}
private function build_mail_to_link( $settings ) {
if ( empty( $settings['mail_to'] ) ) {
return '';
}
$link = 'mailto:' . $settings['mail_to'] . '?';
$build_parts = [];
if ( ! empty( $settings['mail_subject'] ) ) {
$build_parts['subject'] = $this->escape_space_in_url( $settings['mail_subject'] );
}
if ( ! empty( $settings['mail_body'] ) ) {
$build_parts['body'] = $this->escape_space_in_url( $settings['mail_body'] );
}
return add_query_arg( $build_parts, $link );
}
private function build_sms_link( $settings ) {
if ( empty( $settings['tel_number'] ) ) {
return '';
}
$value = 'sms:' . $settings['tel_number'];
return $value;
}
private function build_whatsapp_link( $settings ) {
if ( empty( $settings['tel_number'] ) ) {
return '';
}
return 'https://api.whatsapp.com/send?phone=' . $settings['tel_number'];
}
private function build_skype_link( $settings ) {
if ( empty( $settings['username'] ) ) {
return '';
}
$action = 'call';
if ( ! empty( $settings['skype_action'] ) ) {
$action = $settings['skype_action'];
}
$link = 'skype:' . $settings['username'] . '?' . $action;
return $link;
}
private function build_waze_link( $settings ) {
$link = 'https://waze.com/ul?';
$build_parts = [
'q' => $settings['waze_address'],
'z' => 10,
'navigate' => 'yes',
];
return add_query_arg( $build_parts, $link );
}
private function date_to_iso( $date, $all_day = false ) {
$time = strtotime( $date );
if ( $all_day ) {
return gmdate( 'Ymd\/Ymd', $time );
}
return gmdate( 'Ymd\THis', $time );
}
private function date_to_ics( $date ) {
$time = strtotime( $date );
return gmdate( 'Y-m-d\Th:i:s', $time );
}
private function escape_space_in_url( $url ) {
return str_replace( ' ', '%20', $url );
}
private function build_google_calendar_link( $settings ) {
$dates = '';
if ( ! empty( $settings['event_start_date'] ) ) {
if ( empty( $settings['event_end_date'] ) ) {
$dates = $this->date_to_iso( $settings['event_start_date'], true );
} else {
$dates = $this->date_to_iso( $settings['event_start_date'] ) . '/' . $this->date_to_iso( $settings['event_end_date'] );
}
}
$link = 'https://www.google.com/calendar/render?action=TEMPLATE&';
$build_parts = [
'text' => empty( $settings['event_title'] ) ? '' : $this->escape_space_in_url( $settings['event_title'] ),
'details' => empty( $settings['event_description'] ) ? '' : $this->escape_space_in_url( $settings['event_description'] ),
'dates' => $dates,
'location' => empty( $settings['event_location'] ) ? '' : $this->escape_space_in_url( $settings['event_location'] ),
];
return add_query_arg( $build_parts, $link );
}
private function build_outlook_calendar_link( $settings ) {
$link = 'https://outlook.office.com/owa/?path=/calendar/action/compose&';
$build_parts = [
'subject' => empty( $settings['event_title'] ) ? '' : urlencode( $settings['event_title'] ),
'body' => empty( $settings['event_description'] ) ? '' : urlencode( $settings['event_description'] ),
'location' => empty( $settings['event_location'] ) ? '' : urlencode( $settings['event_location'] ),
];
if ( ! empty( $settings['event_start_date'] ) ) {
$build_parts['startdt'] = urlencode( $this->date_to_ics( $settings['event_start_date'] ) );
}
if ( ! empty( $settings['event_end_date'] ) ) {
$build_parts['enddt'] = urlencode( $this->date_to_ics( $settings['event_end_date'] ) );
}
return add_query_arg( $build_parts, $link );
}
private function build_messenger_link( $settings ) {
if ( empty( $settings['username'] ) ) {
return '';
}
return 'https://m.me/' . $settings['username'];
}
private function build_yahoo_calendar_link( $settings ) {
$link = 'https://calendar.yahoo.com/?v=60&view=d&type=20';
$build_parts = [
'title' => empty( $settings['event_title'] ) ? '' : urlencode( $settings['event_title'] ),
'desc' => empty( $settings['event_description'] ) ? '' : urlencode( $settings['event_description'] ),
'in_loc' => empty( $settings['event_location'] ) ? '' : urlencode( $settings['event_location'] ),
];
if ( ! empty( $settings['event_start_date'] ) ) {
$build_parts['st'] = urlencode( gmdate( 'Ymd\This', strtotime( $settings['event_start_date'] ) ) );
}
if ( ! empty( $settings['event_end_date'] ) ) {
$build_parts['et'] = urlencode( gmdate( 'Ymd\This', strtotime( $settings['event_end_date'] ) ) );
}
return add_query_arg( $build_parts, $link );
}
public function build_viber_link( $settings ) {
if ( empty( $settings['tel_number'] ) ) {
return '';
}
$action = 'contact';
if ( ! empty( $settings['viber_action'] ) ) {
$action = $settings['viber_action'];
}
return add_query_arg( [
'number' => urlencode( $settings['tel_number'] ),
], 'viber://' . $action );
}
public function render() {
$settings = $this->get_settings();
if ( empty( $settings['link_type'] ) ) {
return '';
}
$value = '';
switch ( $settings['link_type'] ) {
case 'email':
$value = $this->build_mail_to_link( $settings );
break;
case 'tel':
$value = ( empty( $settings['tel_number'] ) ? '' : 'tel:' . $settings['tel_number'] );
break;
case 'sms':
$value = $this->build_sms_link( $settings );
break;
case 'messenger':
$value = $this->build_messenger_link( $settings );
break;
case 'whatsapp':
$value = $this->build_whatsapp_link( $settings );
break;
case 'skype':
$value = $this->build_skype_link( $settings );
break;
case 'waze':
$value = $this->build_waze_link( $settings );
break;
case 'google_calendar':
$value = $this->build_google_calendar_link( $settings );
break;
case 'outlook_calendar':
$value = $this->build_outlook_calendar_link( $settings );
break;
case 'yahoo_calendar':
$value = $this->build_yahoo_calendar_link( $settings );
break;
case 'viber':
$value = $this->build_viber_link( $settings );
break;
}
echo esc_html( $value );
}
}
tags/site-logo.php 0000644 00000001606 15051517101 0010114 0 ustar 00 $custom_logo_id,
'url' => $url,
];
}
}
tags/post-title.php 0000644 00000001147 15051517101 0010316 0 ustar 00 add_control(
'type',
[
'label' => esc_html__( 'Type', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'post_date_gmt' => esc_html__( 'Post Published', 'elementor-pro' ),
'post_modified_gmt' => esc_html__( 'Post Modified', 'elementor-pro' ),
],
'default' => 'post_date_gmt',
]
);
$this->add_control(
'format',
[
'label' => esc_html__( 'Format', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'elementor-pro' ),
'g:i a' => gmdate( 'g:i a' ),
'g:i A' => gmdate( 'g:i A' ),
'H:i' => gmdate( 'H:i' ),
'custom' => esc_html__( 'Custom', 'elementor-pro' ),
],
'default' => 'default',
]
);
$this->add_control(
'custom_format',
[
'label' => esc_html__( 'Custom Format', 'elementor-pro' ),
'default' => '',
'description' => sprintf( '%s', esc_html__( 'Documentation on date and time formatting', 'elementor-pro' ) ),
'condition' => [
'format' => 'custom',
],
]
);
}
public function render() {
$time_type = $this->get_settings( 'type' );
$format = $this->get_settings( 'format' );
switch ( $format ) {
case 'default':
$date_format = '';
break;
case 'custom':
$date_format = $this->get_settings( 'custom_format' );
break;
default:
$date_format = $format;
break;
}
if ( 'post_date_gmt' === $time_type ) {
$value = get_the_time( $date_format );
} else {
$value = get_the_modified_time( $date_format );
}
echo wp_kses_post( $value );
}
}
tags/post-featured-image.php 0000644 00000002226 15051517101 0012053 0 ustar 00 $thumbnail_id,
'url' => wp_get_attachment_image_src( $thumbnail_id, 'full' )[0],
];
} else {
$image_data = $this->get_settings( 'fallback' );
}
return $image_data;
}
protected function register_controls() {
$this->add_control(
'fallback',
[
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
'type' => Controls_Manager::MEDIA,
]
);
}
}
tags/user-profile-picture.php 0000644 00000000754 15051517101 0012302 0 ustar 00 '',
'url' => get_avatar_url( get_current_user_id() ),
];
}
}
tags/site-title.php 0000644 00000001146 15051517101 0010274 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return;
}
$value = '';
if ( is_category() || is_tax() ) {
$value = get_term_meta( get_queried_object_id(), $key, true );
} elseif ( is_author() ) {
$value = get_user_meta( get_queried_object_id(), $key, true );
}
echo wp_kses_post( $value );
}
public function get_panel_template_setting_key() {
return 'key';
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Meta Key', 'elementor-pro' ),
]
);
}
}
tags/author-url.php 0000644 00000002531 15051517101 0010312 0 ustar 00 get_settings( 'url' ) ) {
global $authordata;
if ( $authordata ) {
$value = get_author_posts_url( $authordata->ID, $authordata->user_nicename );
}
} else {
$value = get_the_author_meta( 'url' );
}
return $value;
}
protected function register_controls() {
$this->add_control(
'url',
[
'label' => esc_html__( 'URL', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'default' => 'archive',
'options' => [
'archive' => esc_html__( 'Author Archive', 'elementor-pro' ),
'website' => esc_html__( 'Author Website', 'elementor-pro' ),
],
]
);
}
}
tags/author-profile-picture.php 0000644 00000001512 15051517101 0012617 0 ustar 00 '',
'url' => get_avatar_url( (int) get_the_author_meta( 'ID' ) ),
];
}
}
tags/shortcode.php 0000644 00000003313 15051517101 0010201 0 ustar 00 add_control(
'shortcode',
[
'label' => esc_html__( 'Shortcode', 'elementor-pro' ),
'type' => Controls_Manager::TEXTAREA,
]
);
}
public function render() {
$settings = $this->get_settings();
if ( empty( $settings['shortcode'] ) ) {
return;
}
$shortcode_string = $settings['shortcode'];
$value = do_shortcode( $shortcode_string );
$should_escape = true;
/**
* Should escape shortcodes.
*
* By default shortcodes in dynamic tags are escaped. This hook allows developers
* to avoid shortcodes from beeing escaped. Defaults to true.
*
* @since 2.2.1
*
* @param bool $should_escape Whether to escape shortcodes in dynamic tags.
*/
$should_escape = apply_filters( 'elementor_pro/dynamic_tags/shortcode/should_escape', $should_escape );
if ( $should_escape ) {
$value = wp_kses_post( $value );
}
// PHPCS - the variable $value is safe.
echo $value; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
toolset/tags/toolset-url.php 0000644 00000004163 15051517101 0012175 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return;
}
list( $field_group, $field_key ) = explode( ':', $key );
$field = wpcf_admin_fields_get_field( $field_key );
if ( $field && ! empty( $field['type'] ) ) {
$value = '';
switch ( $field['type'] ) {
case 'email':
$value = 'mailto:' . types_render_field( $field_key, [ 'output' => 'raw' ] );
break;
case 'image':
$value = types_render_field( $field_key, [ 'url' => true ] );
break;
default:
$value = types_render_field( $field_key, [ 'output' => 'raw' ] );
} // End switch().
}
if ( empty( $value ) && $this->get_settings( 'fallback' ) ) {
$value = $this->get_settings( 'fallback' );
}
return wp_kses_post( $value );
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
$this->add_control(
'fallback',
[
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
]
);
}
protected function get_supported_fields() {
return [
'email',
'image',
'file',
'audio',
'url',
];
}
}
toolset/tags/toolset-image.php 0000644 00000003650 15051517101 0012455 0 ustar 00 get_settings( 'key' );
$image_data = $this->get_settings( 'fallback' );
if ( empty( $key ) ) {
return $image_data;
}
list( $field_group, $field_key ) = explode( ':', $key );
$field = wpcf_admin_fields_get_field( $field_key );
if ( $field && ! empty( $field['type'] ) ) {
$url = types_render_field( $field_key, [ 'url' => true ] );
if ( empty( $url ) ) {
return $image_data;
}
$image_data = [
'id' => attachment_url_to_postid( $url ),
'url' => $url,
];
}
return $image_data;
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
$this->add_control(
'fallback',
[
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
'type' => Controls_Manager::MEDIA,
]
);
}
protected function get_supported_fields() {
return [
'toolset_image',
];
}
}
toolset/tags/toolset-text.php 0000644 00000002776 15051517101 0012367 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return;
}
list( $field_group, $field_key ) = explode( ':', $key );
$field = wpcf_admin_fields_get_field( $field_key );
if ( $field && ! empty( $field['type'] ) ) {
$value = '';
switch ( $field['type'] ) {
case 'google_address':
$value = types_render_field( $field_key, [ 'format' => 'FIELD_ADDRESS' ] );
break;
case 'email':
case 'embed':
$value = types_render_field( $field_key, [ 'output' => 'raw' ] );
break;
default:
$value = types_render_field( $field_key );
break;
} // End switch().
} else {
// Field settings has been deleted or not available.
$value = types_render_field( $field_key );
} // End if().
echo wp_kses_post( $value );
}
protected function get_supported_fields() {
return [
'textfield',
'phone',
'textarea',
'checkbox',
'select',
'numeric',
'email',
'embed',
'google_address',
'wysiwyg',
'radio',
];
}
}
toolset/tags/toolset-date.php 0000644 00000005206 15051517101 0012307 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return;
}
list( $field_group, $field_key ) = explode( ':', $key );
$field = wpcf_admin_fields_get_field( $field_key );
$value = '';
if ( $field && ! empty( $field['type'] ) && 'date' === $field['type'] ) {
$format = $this->get_settings( 'format' );
$timestamp = types_render_field( $field_key, [
'output' => 'raw',
'style' => 'text',
] );
if ( empty( $timestamp ) ) {
return $value;
}
if ( 'human' === $format ) {
/* translators: %s: Human readable date/time. */
$value = human_time_diff( $timestamp );
} else {
switch ( $format ) {
case 'default':
$date_format = get_option( 'date_format' );
break;
case 'custom':
$date_format = $this->get_settings( 'custom_format' );
break;
default:
$date_format = $format;
break;
}
$value = date_i18n( $date_format, $timestamp );
}
}
echo wp_kses_post( $value );
}
public function get_panel_template_setting_key() {
return 'key';
}
protected function register_controls() {
parent::register_controls();
$this->add_control(
'format',
[
'label' => esc_html__( 'Format', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'elementor-pro' ),
'F j, Y' => gmdate( 'F j, Y' ),
'Y-m-d' => gmdate( 'Y-m-d' ),
'm/d/Y' => gmdate( 'm/d/Y' ),
'd/m/Y' => gmdate( 'd/m/Y' ),
'human' => esc_html__( 'Human Readable', 'elementor-pro' ),
'custom' => esc_html__( 'Custom', 'elementor-pro' ),
],
'default' => 'default',
]
);
$this->add_control(
'custom_format',
[
'label' => esc_html__( 'Custom Format', 'elementor-pro' ),
'default' => '',
'description' => sprintf( '%s', esc_html__( 'Documentation on date and time formatting', 'elementor-pro' ) ),
'condition' => [
'format' => 'custom',
],
]
);
}
protected function get_supported_fields() {
return [ 'date' ];
}
}
toolset/tags/toolset-base.php 0000644 00000001467 15051517101 0012311 0 ustar 00 add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
}
protected function get_supported_fields() {
return [];
}
}
toolset/tags/toolset-gallery.php 0000644 00000004630 15051517101 0013031 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return [];
}
$images = [];
list( $field_group, $field_key ) = explode( ':', $key );
$field = wpcf_admin_fields_get_field( $field_key );
if ( $field && ! empty( $field['type'] ) ) {
$galley_images = types_render_field( $field_key, [
'separator' => '|',
'url' => true,
] );
$galley_images = explode( '|', $galley_images );
foreach ( $galley_images as $image_url ) {
$images[] = [
'id' => $this->get_cached_attachment_url_to_post_id( $image_url ),
'url' => $image_url,
];
}
}
return $images;
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
}
protected function get_supported_fields() {
return [
'toolset_gallery',
];
}
/**
* @param $attachment_url
*
* @return false|int|mixed
*/
private function get_cached_attachment_url_to_post_id( $attachment_url ) {
$id = wp_cache_get( $attachment_url, __CLASS__ );
if ( false === $id ) {
$id = attachment_url_to_postid( $attachment_url );
wp_cache_set( $attachment_url, $id, __CLASS__ );
}
return $id;
}
/**
* Toolset_Gallery constructor.
*
* @param array $data
*/
public function __construct( array $data = [] ) {
parent::__construct( $data );
wp_cache_add_non_persistent_groups( __CLASS__ );
}
}
toolset/module.php 0000644 00000004354 15051517101 0010235 0 ustar 00 $field ) {
if ( ! is_array( $field ) || empty( $field['type'] ) ) {
continue;
}
if ( ! self::valid_field_type( $types, $field ) ) {
continue;
}
// Use group ID for unique keys
$key = $group['slug'] . ':' . $field_key;
$options[ $key ] = $field['name'];
}
if ( empty( $options ) ) {
continue;
}
if ( 1 === count( $options ) ) {
$options = [ -1 => ' -- ' ] + $options;
}
$groups[] = [
'label' => $group['name'],
'options' => $options,
];
}
return $groups;
}
public static function toolset_image_mapping( $field, $single = true ) {
if ( 'image' !== $field['type'] ) {
return false;
}
$limit = $single ? '0' : '1';
if ( empty( $field['data'] ) || $limit !== $field['data']['repetitive'] ) {
return false;
}
return true;
}
public static function valid_field_type( $types, $field ) {
// Only file field with single image value
if ( in_array( 'toolset_image', $types, true ) && self::toolset_image_mapping( $field ) ) {
return true;
}
// Only file with multiple images allowed
if ( in_array( 'toolset_gallery', $types, true ) && self::toolset_image_mapping( $field, false ) ) {
return true;
}
// Any other type
if ( in_array( $field['type'], $types, true ) ) {
return true;
}
return false;
}
public function get_tag_classes_names() {
return [
'Toolset_Text',
'Toolset_Date',
'Toolset_Image',
'Toolset_URL',
'Toolset_Gallery',
];
}
public function get_groups() {
return [
self::TOOLSET_GROUP => [
'title' => esc_html__( 'Toolset', 'elementor-pro' ),
],
];
}
}
module.php 0000644 00000011406 15051517101 0006540 0 ustar 00 add_component( 'acf', new ACF\Module() );
}
if ( function_exists( 'wpcf_admin_fields_get_groups' ) && API::is_licence_has_feature( self::LICENSE_FEATURE_TOOLSET_NAME, API::BC_VALIDATION_CALLBACK ) ) {
$this->add_component( 'toolset', new Toolset\Module() );
}
if ( function_exists( 'pods' ) && API::is_licence_has_feature( self::LICENSE_FEATURE_PODS_NAME, API::BC_VALIDATION_CALLBACK ) ) {
$this->add_component( 'pods', new Pods\Module() );
}
/*
* WooCommerce Add To Cart Dynamic Tag.
*
* The WC ATC Dynamic Tag returns a URL that adds items to a users cart
* via the URL parameters `?add-to-cart=' . $product_id . '&quantity=' . $quantity`.
* Normally this URL method redirects to the website's Home page after adding the items to
* the cart.
*
* Since the behavior of the Tag should be identical to the "Add to Cart" widget, clicking an
* element that is using the tag needs to redirect to the Single Product page for the added
* product or the Cart page after this process if the user selected that setting in WooCommerce.
*
* To accomplish that, an extra parameter in the URL ('&e-redirect=') is used. When this
* paramater is found, the WooCommerce Add to Cart Dynamic Tag will redirect to the
* appropriate page.
*/
//phpcs:ignore WordPress.Security.NonceVerification.Recommended -- The nonce is verified in the WC class.
$add_to_cart = Utils::_unstable_get_super_global_value( $_REQUEST, 'add-to-cart' );
//phpcs:ignore WordPress.Security.NonceVerification.Recommended -- The nonce is verified in the WC class.
$redirect = Utils::_unstable_get_super_global_value( $_REQUEST, 'e-redirect' );
if ( $add_to_cart && $redirect ) {
add_filter( 'woocommerce_add_to_cart_redirect', [ $this, 'filter_woocommerce_add_to_cart_redirect' ], 10, 1 );
}
}
public function filter_woocommerce_add_to_cart_redirect( $wc_get_cart_url ) {
//phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here.
return esc_url( Utils::_unstable_get_super_global_value( $_REQUEST, 'e-redirect' ) );
}
public function get_name() {
return 'tags';
}
public function get_tag_classes_names() {
return [
'Archive_Description',
'Archive_Meta',
'Archive_Title',
'Archive_URL',
'Author_Info',
'Author_Meta',
'Author_Name',
'Author_Profile_Picture',
'Author_URL',
'Comments_Number',
'Comments_URL',
'Page_Title',
'Post_Custom_Field',
'Post_Date',
'Post_Excerpt',
'Post_Featured_Image',
'Post_Gallery',
'Post_ID',
'Post_Terms',
'Post_Time',
'Post_Title',
'Post_URL',
'Site_Logo',
'Site_Tagline',
'Site_Title',
'Site_URL',
'Internal_URL',
'Current_Date_Time',
'Request_Parameter',
'Lightbox',
'Featured_Image_Data',
'Shortcode',
'Contact_URL',
'User_Info',
'User_Profile_Picture',
];
}
public function get_groups() {
return [
self::POST_GROUP => [
'title' => esc_html__( 'Post', 'elementor-pro' ),
],
self::ARCHIVE_GROUP => [
'title' => esc_html__( 'Archive', 'elementor-pro' ),
],
self::SITE_GROUP => [
'title' => esc_html__( 'Site', 'elementor-pro' ),
],
self::MEDIA_GROUP => [
'title' => esc_html__( 'Media', 'elementor-pro' ),
],
self::ACTION_GROUP => [
'title' => esc_html__( 'Actions', 'elementor-pro' ),
],
self::AUTHOR_GROUP => [
'title' => esc_html__( 'Author', 'elementor-pro' ),
],
self::COMMENTS_GROUP => [
'title' => esc_html__( 'Comments', 'elementor-pro' ),
],
self::WOOCOMMERCE_GROUP => [
'title' => esc_html__( 'WooCommerce', 'elementor-pro' ),
],
];
}
}
pods/tags/pods-gallery.php 0000644 00000003175 15051517101 0011564 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return false;
}
$images = [];
list( $pod_name, $pod_id, $meta_key ) = explode( ':', $key );
/**
* @var \Pods
*/
$pod = pods( $pod_name, get_the_ID() );
if ( false === $pod ) {
return [];
}
$galley_images = $pod->field( $meta_key );
if ( empty( $galley_images ) || ! is_array( $galley_images ) ) {
return $images;
}
foreach ( $galley_images as $image ) {
$images[] = [
'id' => $image['ID'],
];
}
return $images;
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
}
protected function get_supported_fields() {
return [
'pods_gallery',
];
}
}
pods/tags/pods-numeric.php 0000644 00000001542 15051517101 0011563 0 ustar 00 get_field();
$value = ! empty( $field_data['value'] ) && is_numeric( $field_data['value'] ) ? $field_data['value'] : '';
echo wp_kses_post( $value );
}
protected function get_supported_fields() {
return [
'numeric',
];
}
}
pods/tags/pods-text.php 0000644 00000002063 15051517101 0011104 0 ustar 00 get_field();
$field = $field_data['field'];
$value = empty( $field_data['value'] ) ? '' : $field_data['value'];
if ( ! empty( $field['type'] ) ) {
switch ( $field['type'] ) {
case 'paragraph':
$value = $field_data['display'];
break;
case 'pick':
$value = $field_data['display'];
if ( is_array( $value ) ) {
$value = implode( ', ', $value );
}
break;
}
}
echo wp_kses_post( $value );
}
protected function get_supported_fields() {
return [
'text',
'phone',
'paragraph',
'relationship',
'pick',
'numeric',
'email',
'oembed',
'google_address',
'wysiwyg',
'time',
];
}
}
pods/tags/pods-date-time.php 0000644 00000004071 15051517101 0011772 0 ustar 00 dynamic_value_provider->get_value(
$this->get_settings( 'key' )
);
$value = $field['value'] ?? '';
if ( ! empty( $value ) ) {
$value = gmdate( 'Y-m-d H:i:s', strtotime( $value ) );
}
if ( empty( $value ) && $this->get_settings( 'fallback' ) ) {
$value = $this->get_settings( 'fallback' );
}
return wp_kses_post( $value );
}
public function get_panel_template_setting_key() {
return 'key';
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
$this->add_control(
'fallback',
[
'type' => Controls_Manager::DATE_TIME,
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
]
);
}
protected function get_supported_fields() {
return [
'datetime',
];
}
public function __construct( array $data = [], $dynamic_value_provider = null ) {
parent::__construct( $data );
$this->dynamic_value_provider = $dynamic_value_provider ?? new Dynamic_Value_Provider();
}
}
pods/tags/pods-base.php 0000644 00000002416 15051517101 0011034 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return false;
}
list( $pod_name, $pod_id, $meta_key ) = explode( ':', $key );
/**
* @var \Pods
*/
$pod = pods( $pod_name, get_the_ID() );
if ( false === $pod ) {
return [];
}
return [
'field' => $pod->fields[ $meta_key ],
'value' => $pod->field( $meta_key ),
'display' => $pod->display( $meta_key ),
'pod' => $pod,
'key' => $meta_key,
];
}
public function get_categories() {
return [
Module::TEXT_CATEGORY,
Module::POST_META_CATEGORY,
];
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
}
protected function get_supported_fields() {
return [];
}
}
pods/tags/pods-date.php 0000644 00000004456 15051517101 0011045 0 ustar 00 get_field();
$field = $field_data['field'];
$value = empty( $field_data['value'] ) ? '' : $field_data['value'];
if ( $field && ! empty( $field['type'] ) && in_array( $field['type'], [ 'date', 'datetime' ] ) ) {
$format = $this->get_settings( 'format' );
$timestamp = strtotime( $value );
if ( 'human' === $format ) {
$value = human_time_diff( $timestamp );
} else {
switch ( $format ) {
case 'default':
$date_format = get_option( 'date_format' );
break;
case 'custom':
$date_format = $this->get_settings( 'custom_format' );
break;
default:
$date_format = $format;
break;
}
$value = gmdate( $date_format, $timestamp );
}
}
echo wp_kses_post( $value );
}
public function get_panel_template_setting_key() {
return 'key';
}
protected function register_controls() {
parent::register_controls();
$this->add_control(
'format',
[
'label' => esc_html__( 'Format', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default', 'elementor-pro' ),
'F j, Y' => gmdate( 'F j, Y' ),
'Y-m-d' => gmdate( 'Y-m-d' ),
'm/d/Y' => gmdate( 'm/d/Y' ),
'd/m/Y' => gmdate( 'd/m/Y' ),
'human' => esc_html__( 'Human Readable', 'elementor-pro' ),
'custom' => esc_html__( 'Custom', 'elementor-pro' ),
],
'default' => 'default',
]
);
$this->add_control(
'custom_format',
[
'label' => esc_html__( 'Custom Format', 'elementor-pro' ),
'default' => '',
'description' => sprintf( '%s', esc_html__( 'Documentation on date and time formatting', 'elementor-pro' ) ),
'condition' => [
'format' => 'custom',
],
]
);
}
protected function get_supported_fields() {
return [
'datetime',
'date',
];
}
}
pods/tags/pods-url.php 0000644 00000003750 15051517101 0010726 0 ustar 00 get_settings( 'key' );
if ( empty( $key ) ) {
return false;
}
list( $pod_name, $pod_id, $meta_key ) = explode( ':', $key );
/**
* @var \Pods
*/
$pod = pods( $pod_name, get_the_ID() );
if ( false === $pod ) {
return [];
}
$field = $pod->fields[ $meta_key ];
$value = $pod->field( $meta_key );
if ( $field && ! empty( $field['type'] ) ) {
switch ( $field['type'] ) {
case 'phone':
$value = 'tel:' . $value;
break;
case 'file':
$value = empty( $value['guid'] ) ? '' : $value['guid'];
break;
case 'email':
$value = 'mailto:' . $value;
break;
} // End switch().
}
if ( empty( $value ) && $this->get_settings( 'fallback' ) ) {
$value = $this->get_settings( 'fallback' );
}
return wp_kses_post( $value );
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
$this->add_control(
'fallback',
[
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
]
);
}
protected function get_supported_fields() {
return [ 'pods_url' ];
}
}
pods/tags/pods-image.php 0000644 00000003435 15051517101 0011206 0 ustar 00 get_settings( 'key' );
$image_data = $this->get_settings( 'fallback' );
if ( empty( $key ) ) {
return $image_data;
}
list( $pod_name, $pod_id, $meta_key ) = explode( ':', $key );
/**
* @var \Pods
*/
$pod = pods( $pod_name, get_the_ID() );
if ( false === $pod ) {
return [];
}
$image = $pod->field( $meta_key );
$image_data = [
'id' => empty( $image['ID'] ) ? $image_data['id'] : $image['ID'],
'url' => empty( $image['guid'] ) ? $image_data['url'] : $image['guid'],
];
return $image_data;
}
protected function register_controls() {
$this->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => Module::get_control_options( $this->get_supported_fields() ),
]
);
$this->add_control(
'fallback',
[
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
'type' => Controls_Manager::MEDIA,
]
);
}
protected function get_supported_fields() {
return [
'pods_image',
];
}
}
pods/module.php 0000644 00000005522 15051517101 0007507 0 ustar 00 load_pods( [
'table_info' => true,
'fields' => true,
] );
$groups = [];
foreach ( $all_pods as $group ) {
$options = [];
foreach ( $group['fields'] as $field ) {
if ( ! self::valid_field_type( $types, $field ) ) {
continue;
}
// Use pods ID for unique keys
$key = $group['name'] . ':' . $field['pod_id'] . ':' . $field['name'];
$options[ $key ] = $field['label'];
}
if ( empty( $options ) ) {
continue;
}
if ( 1 === count( $options ) ) {
$options = [ -1 => ' -- ' ] + $options;
}
$groups[] = [
'label' => $group['name'],
'options' => $options,
];
}
return $groups;
}
public static function valid_field_type( $types, $field ) {
// Only file field with single image value
if ( in_array( 'pods_image', $types, true ) && self::pods_image_mapping( $field ) ) {
return true;
}
if ( in_array( 'pods_url', $types, true ) && in_array( $field['type'], [ 'email', 'file', 'website', 'phone' ] ) ) {
// Only file with single value allowed
if ( 'file' === $field['type'] && ! self::pods_file_mapping( $field ) ) {
return false;
}
return true;
}
// Only file with multiple images allowed
if ( in_array( 'pods_gallery', $types, true ) && self::pods_image_mapping( $field, false ) ) {
return true;
}
// Any other type
if ( in_array( $field['type'], $types, true ) ) {
return true;
}
return false;
}
public static function pods_file_mapping( $field, $single = true ) {
if ( 'file' !== $field['type'] ) {
return false;
}
$limit = $single ? 'single' : 'multi';
if ( $limit !== $field['options']['file_format_type'] ) {
return false;
}
return true;
}
public static function pods_image_mapping( $field, $single = true ) {
if ( ! isset( $field['options'] ) || ! isset( $field['options']['file_type'] ) ) {
return false;
}
if ( 'images' !== $field['options']['file_type'] ) {
return false;
}
if ( ! self::pods_file_mapping( $field, $single ) ) {
return false;
}
return true;
}
public function get_tag_classes_names() {
return [
'Pods_Text',
'Pods_Date',
'Pods_Date_Time',
'Pods_Image',
'Pods_Gallery',
'Pods_URL',
'Pods_Numeric',
];
}
public function get_groups() {
return [
self::PODS_GROUP => [
'title' => esc_html__( 'Pods', 'elementor-pro' ),
],
];
}
}
pods/dynamic-value-provider.php 0000644 00000002320 15051517101 0012601 0 ustar 00 is_valid_field_key( $key ) ) {
return [];
}
list( $pod_name, , $meta_key ) = explode( ':', $key );
$pod = $this->get_pods_value( $pod_name, get_the_ID() );
if ( false === $pod ) {
return [];
}
return [
'field' => $pod->fields[ $meta_key ],
'value' => $pod->field( $meta_key ),
'display' => $pod->display( $meta_key ),
'pod' => $pod,
'key' => $meta_key,
];
}
/**
* Retrieve the Pod value from `Pods` plugin.
* Used for testing.
*
* @param $type
* @param $id
*
* @return bool|\Pods
*/
protected function get_pods_value( $type, $id ) {
return pods( $type, $id );
}
private function is_valid_field_key( $key ) {
$key = trim( $key );
if ( empty( $key ) ) {
return false;
}
$colon_count = substr_count( $key, ':' );
// Key structure looks like: `page:699:pods_date_time`.
return ( 2 === $colon_count );
}
}
acf/tags/acf-number.php 0000644 00000002324 15051517101 0010760 0 ustar 00 dynamic_value_provider->get_value(
$this->get_settings( 'key' )
);
if ( empty( $field_settings ) ) {
return '';
}
$field = $field_settings[0];
$value = '';
if ( $field ) {
$date_time = \DateTime::createFromFormat( $field['return_format'], $field['value'] );
$value = $date_time instanceof \DateTime
? $date_time->format( 'Y-m-d H:i:s' )
: '';
}
if ( empty( $value ) && $this->get_settings( 'fallback' ) ) {
$value = $this->get_settings( 'fallback' );
}
return wp_kses_post( $value );
}
public function get_panel_template_setting_key() {
return 'key';
}
protected function register_controls() {
Module::add_key_control( $this );
$this->add_control(
'fallback',
[
'type' => Controls_Manager::DATE_TIME,
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
]
);
}
public function get_supported_fields() {
return [
'date_time_picker',
];
}
public function __construct( array $data = [], $dynamic_value_provider = null ) {
parent::__construct( $data );
$this->dynamic_value_provider = $dynamic_value_provider ?? new Dynamic_Value_Provider();
}
}
acf/tags/acf-file.php 0000644 00000001063 15051517101 0010406 0 ustar 00 get_settings( 'fallback' ) ) {
$value = $this->get_settings( 'fallback' );
}
return $value;
}
protected function register_controls() {
Module::add_key_control( $this );
}
public function get_supported_fields() {
return [
'color_picker',
];
}
}
acf/tags/acf-image.php 0000644 00000004166 15051517101 0010560 0 ustar 00 null,
'url' => '',
];
list( $field, $meta_key ) = Module::get_tag_value_field( $this );
if ( $field && is_array( $field ) ) {
$field['return_format'] = isset( $field['save_format'] ) ? $field['save_format'] : $field['return_format'];
switch ( $field['return_format'] ) {
case 'object':
case 'array':
$value = $field['value'];
break;
case 'url':
$value = [
'id' => 0,
'url' => $field['value'],
];
break;
case 'id':
$src = wp_get_attachment_image_src( $field['value'], $field['preview_size'] );
$value = [
'id' => $field['value'],
'url' => $src[0],
];
break;
}
}
if ( ! isset( $value ) ) {
// Field settings has been deleted or not available.
$value = get_field( $meta_key );
}
if ( empty( $value ) && $this->get_settings( 'fallback' ) ) {
$value = $this->get_settings( 'fallback' );
}
if ( ! empty( $value ) && is_array( $value ) ) {
$image_data['id'] = $value['id'];
$image_data['url'] = $value['url'];
}
return $image_data;
}
protected function register_controls() {
Module::add_key_control( $this );
$this->add_control(
'fallback',
[
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
'type' => Controls_Manager::MEDIA,
]
);
}
public function get_supported_fields() {
return [
'image',
];
}
}
acf/tags/acf-gallery.php 0000644 00000002432 15051517101 0011127 0 ustar 00 $image['ID'],
];
}
}
return $images;
}
protected function register_controls() {
Module::add_key_control( $this );
}
public function get_supported_fields() {
return [
'gallery',
];
}
}
acf/tags/acf-text.php 0000644 00000005450 15051517101 0010457 0 ustar 00 $item ) {
if ( isset( $field['choices'][ $item ] ) ) {
$values[ $key ] = $field['choices'][ $item ];
}
}
$value = implode( ', ', $values );
break;
case 'checkbox':
$value = (array) $value;
$values = [];
foreach ( $value as $item ) {
if ( isset( $field['choices'][ $item ] ) ) {
$values[] = $field['choices'][ $item ];
} else {
$values[] = $item;
}
}
$value = implode( ', ', $values );
break;
case 'oembed':
// Get from db without formatting.
$value = $this->get_queried_object_meta( $meta_key );
break;
case 'google_map':
$meta = $this->get_queried_object_meta( $meta_key );
$value = isset( $meta['address'] ) ? $meta['address'] : '';
break;
} // End switch().
} else {
// Field settings has been deleted or not available.
$value = get_field( $meta_key );
} // End if().
echo wp_kses_post( $value );
}
public function get_panel_template_setting_key() {
return 'key';
}
protected function register_controls() {
Module::add_key_control( $this );
}
public function get_supported_fields() {
return [
'text',
'textarea',
'number',
'email',
'password',
'wysiwyg',
'select',
'checkbox',
'radio',
'true_false',
// Pro
'oembed',
'google_map',
'date_picker',
'time_picker',
'date_time_picker',
'color_picker',
];
}
private function get_queried_object_meta( $meta_key ) {
$value = '';
if ( is_singular() ) {
$value = get_post_meta( get_the_ID(), $meta_key, true );
} elseif ( is_tax() || is_category() || is_tag() ) {
$value = get_term_meta( get_queried_object_id(), $meta_key, true );
}
return $value;
}
}
acf/tags/acf-url.php 0000644 00000004746 15051517101 0010304 0 ustar 00 get_settings( 'fallback' ) ) {
$value = $this->get_settings( 'fallback' );
}
return wp_kses_post( $value );
}
protected function register_controls() {
Module::add_key_control( $this );
$this->add_control(
'fallback',
[
'label' => esc_html__( 'Fallback', 'elementor-pro' ),
]
);
}
public function get_supported_fields() {
return [
'text',
'email',
'image',
'file',
'page_link',
'post_object',
'relationship',
'taxonomy',
'url',
];
}
}
acf/module.php 0000644 00000007266 15051517101 0007302 0 ustar 00 = 5.0.0
if ( function_exists( 'acf_get_field_groups' ) ) {
$acf_groups = acf_get_field_groups();
} else {
$acf_groups = apply_filters( 'acf/get_field_groups', [] );
}
$groups = [];
$options_page_groups_ids = [];
if ( function_exists( 'acf_options_page' ) ) {
$pages = acf_options_page()->get_pages();
foreach ( $pages as $slug => $page ) {
$options_page_groups = acf_get_field_groups( [
'options_page' => $slug,
] );
foreach ( $options_page_groups as $options_page_group ) {
$options_page_groups_ids[] = $options_page_group['ID'];
}
}
}
foreach ( $acf_groups as $acf_group ) {
// ACF >= 5.0.0
if ( function_exists( 'acf_get_fields' ) ) {
if ( isset( $acf_group['ID'] ) && ! empty( $acf_group['ID'] ) ) {
$fields = acf_get_fields( $acf_group['ID'] );
} else {
$fields = acf_get_fields( $acf_group );
}
} else {
$fields = apply_filters( 'acf/field_group/get_fields', [], $acf_group['id'] );
}
$options = [];
if ( ! is_array( $fields ) ) {
continue;
}
$has_option_page_location = in_array( $acf_group['ID'], $options_page_groups_ids, true );
$is_only_options_page = $has_option_page_location && 1 === count( $acf_group['location'] );
foreach ( $fields as $field ) {
if ( ! in_array( $field['type'], $types, true ) ) {
continue;
}
// Use group ID for unique keys
if ( $has_option_page_location ) {
$key = 'options:' . $field['name'];
$options[ $key ] = esc_html__( 'Options', 'elementor-pro' ) . ':' . $field['label'];
if ( $is_only_options_page ) {
continue;
}
}
$key = $field['key'] . ':' . $field['name'];
$options[ $key ] = $field['label'];
}
if ( empty( $options ) ) {
continue;
}
if ( 1 === count( $options ) ) {
$options = [ -1 => ' -- ' ] + $options;
}
$groups[] = [
'label' => $acf_group['title'],
'options' => $options,
];
} // End foreach().
return $groups;
}
public static function add_key_control( Base_Tag $tag ) {
$tag->add_control(
'key',
[
'label' => esc_html__( 'Key', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'groups' => self::get_control_options( $tag->get_supported_fields() ),
]
);
}
public function get_tag_classes_names() {
return [
'ACF_Text',
'ACF_Image',
'ACF_URL',
'ACF_Gallery',
'ACF_File',
'ACF_Number',
'ACF_Color',
'ACF_Date_Time',
];
}
// For use by ACF tags
public static function get_tag_value_field( Base_Tag $tag ) {
$key = $tag->get_settings( 'key' );
// TODO: The tags should use the `Dynamic_Value_Provider::get_value()` method, but it involves
// heavily refactoring them, so currently this method is just a proxy and also kept for BC.
if ( ! static::$dynamic_value_provider ) {
static::$dynamic_value_provider = new Dynamic_Value_Provider();
}
return static::$dynamic_value_provider->get_value( $key );
}
public function get_groups() {
return [
self::ACF_GROUP => [
'title' => esc_html__( 'ACF', 'elementor-pro' ),
],
];
}
}
acf/dynamic-value-provider.php 0000644 00000002150 15051517101 0012366 0 ustar 00 documents->get_current();
if ( 'options' === $field_key ) {
$field = $this->get_field_object( $meta_key, $field_key );
} elseif ( ! empty( $document ) && LoopBuilderModule::TEMPLATE_LIBRARY_TYPE_SLUG === $document::get_type() ) {
$field = $this->get_field_object( $field_key, get_the_ID() );
} else {
$field = $this->get_field_object( $field_key, get_queried_object() );
}
return [ $field, $meta_key ];
}
/**
* Retrieve the custom field value from `ACF` plugin.
* Used for testing.
*
* @param $selector
* @param $post_id
*
* @return array|false
*/
protected function get_field_object( $selector, $post_id ) {
return get_field_object( $selector, $post_id );
}
}