PluginProbe ʕ •ᴥ•ʔ
YITH WooCommerce Wishlist / 4.0.1
YITH WooCommerce Wishlist v4.0.1
4.16.0 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.17 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.18 3.0.19 3.0.2 3.0.20 3.0.21 3.0.22 3.0.23 3.0.25 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.10.0 3.11.0 3.12.0 3.13.0 3.14.0 3.15.0 3.16.0 3.17.0 3.18.0 3.19.0 3.2.0 3.20.0 3.21.0 3.22.0 3.23.0 3.24.0 3.25.0 3.26.0 3.27.0 3.28.0 3.29.0 3.3.0 3.30.0 3.31.0 3.32.0 3.33.0 3.34.0 3.35.0 3.36.0 3.37.0 3.38.0 3.4.0 3.5.0 3.6.0 3.7.0 3.8.0 3.9.0 4.0.0 4.0.1 4.1.0 4.10.0 4.10.1 4.10.2 4.11.0 4.12.0 4.13.0 4.14.0 4.15.0 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.8.0 4.9.0
yith-woocommerce-wishlist / plugin-fw / templates / metaboxes / tab.php
yith-woocommerce-wishlist / plugin-fw / templates / metaboxes Last commit date
field-row.php 5 years ago tab.php 3 years ago
tab.php
166 lines
1 <?php
2 /**
3 * The Template for displaying meta-box tabs.
4 *
5 * @var array $tabs The tabs.
6 * @var string $class The CSS Class.
7 * @var string $meta_box_id The ID of the meta-box.
8 * @package YITH\PluginFramework\Templates
9 */
10
11 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
12
13 global $post;
14 $classes = apply_filters( 'yith_plugin_fw_metabox_class', $class, $post );
15 $classes = yith_plugin_fw_remove_duplicate_classes( $classes );
16 $ul_style = count( $tabs ) <= 1 ? 'display:none;' : '';
17 $i = 0;
18 do_action( 'yit_before_metaboxes_tab' );
19
20 // Allow style for SVGs.
21 $label_extra_allowed_tags = array(
22 'style' => array(
23 'type' => true,
24 ),
25 );
26
27 $label_allowed_tags = array_merge( wp_kses_allowed_html( 'post' ), yith_plugin_fw_kses_allowed_svg_tags(), $label_extra_allowed_tags );
28 $label_allowed_tags = apply_filters( 'yith_plugin_fw_metabox_label_allowed_tags', $label_allowed_tags, $meta_box_id );
29
30 ?>
31 <div class="yith-plugin-fw metaboxes-tab <?php echo esc_attr( $classes ); ?>">
32 <?php do_action( 'yit_before_metaboxes_labels' ); ?>
33 <ul class="metaboxes-tabs clearfix yith-plugin-fw__tabs" style="<?php echo esc_attr( $ul_style ); ?>" data-tab-additional-active-class="tabs">
34 <?php foreach ( $tabs as $key => $_tab ) : ?>
35
36 <?php
37 if ( empty( $_tab['fields'] ) ) {
38 continue;
39 }
40 $anchor_id = 'yith-plugin-fw-metabox-tab-' . urldecode( $key ) . '-anchor';
41
42 // Parse deps for the tab visibility.
43 if ( isset( $_tab['deps'] ) ) {
44 $_tab['deps']['target-id'] = isset( $_tab['deps']['target-id'] ) ? $_tab['deps']['target-id'] : $anchor_id;
45 if ( isset( $_tab['deps']['id'] ) && strpos( $_tab['deps']['id'], '_' ) !== 0 ) {
46 $_tab['deps']['id'] = '_' . $_tab['deps']['id'];
47 }
48 if ( isset( $_tab['deps']['ids'] ) && strpos( $_tab['deps']['ids'], '_' ) !== 0 ) {
49 $_tab['deps']['ids'] = '_' . $_tab['deps']['ids'];
50 }
51
52 $_tab['deps']['type'] = 'hideme';
53 }
54
55 $class = 'yith-plugin-fw__tab';
56 if ( ! $i ) {
57 $class .= ' tabs yith-plugin-fw__tab--active';
58 }
59 $i ++;
60 ?>
61 <li id="<?php echo esc_attr( $anchor_id ); ?>" class="<?php echo esc_attr( $class ); ?>" <?php echo yith_field_deps_data( $_tab ); ?>>
62 <a href="#<?php echo esc_attr( urldecode( $key ) ); ?>" class="yith-plugin-fw__tab__handler">
63 <?php echo wp_kses( $_tab['label'], $label_allowed_tags ); ?>
64 </a>
65 </li>
66 <?php endforeach; ?>
67 </ul>
68
69 <?php do_action( 'yit_after_metaboxes_labels' ); ?>
70
71 <?php
72 if ( isset( $_tab['label'] ) ) {
73 do_action( 'yit_before_metabox_option_' . urldecode( $key ) );
74 }
75 ?>
76
77 <?php wp_nonce_field( 'metaboxes-fields-nonce', 'yit_metaboxes_nonce' ); ?>
78
79 <?php foreach ( $tabs as $key => $_tab ) : ?>
80 <div class="tabs-panel yith-plugin-fw__tab-panel" id="<?php echo esc_attr( urldecode( $key ) ); ?>">
81 <?php
82 if ( empty( $_tab['fields'] ) ) {
83 continue;
84 }
85
86 $_tab['fields'] = apply_filters( 'yit_metabox_' . $key . '_tab_fields', $_tab['fields'] );
87 ?>
88
89 <?php foreach ( $_tab['fields'] as $id_tab => $field ) : ?>
90 <?php
91 $field_name = $field['name'];
92 $field_name = str_replace( 'yit_metaboxes[', '', $field_name );
93 $pos = strpos( $field_name, ']' );
94 if ( $pos ) {
95 $field_name = substr_replace( $field_name, '', $pos, 1 );
96 }
97
98 /**
99 * APPLY_FILTER: yith_plugin_fw_metabox_{meta_box_id}_field_pre_get_value
100 * Allow filtering values for meta-box fields instead of retrieving them by post_meta(s).
101 *
102 * @param mixed|null $value The value to be filtered. Set 'null' to retrieve it by the related post_meta (Default: null).
103 * @param int $post_id The post ID.
104 * @param string $field_name The field name.
105 * @param array $field The field.
106 *
107 * @since 3.7.6
108 */
109 $value = apply_filters( "yith_plugin_fw_metabox_{$meta_box_id}_field_pre_get_value", null, $post->ID, $field_name, $field );
110 if ( is_null( $value ) ) {
111 $value = yit_get_post_meta( $post->ID, $field_name );
112 }
113
114 $field['value'] = false === $value ? ( isset( $field['std'] ) ? $field['std'] : '' ) : $value;
115 $field['checkboxgroup'] = ( 'checkbox' === $field['type'] && isset( $field['checkboxgroup'] ) ) ? ' ' . $field['checkboxgroup'] : '';
116 $container_classes = 'the-metabox ' . $field['type'] . $field['checkboxgroup'] . ' clearfix ';
117 $extra_row_class = isset( $field['extra_row_class'] ) ? $field['extra_row_class'] : '';
118
119 $container_classes .= empty( $field['label'] ) ? 'no-label' : '';
120 $container_classes .= ' ' . $extra_row_class;
121
122 ?>
123 <div class="<?php echo esc_attr( $container_classes ); ?>">
124 <?php
125 $field_template_path = yith_plugin_fw_get_field_template_path( $field );
126 if ( $field_template_path ) {
127 $display_row = 'hidden' !== $field['type'];
128 $display_row = isset( $field['yith-display-row'] ) ? ! ! $field['yith-display-row'] : $display_row;
129 $field['display-field-only'] = in_array( $field['type'], array( 'hidden', 'html', 'sep', 'simple-text', 'title', 'list-table' ), true );
130
131 if ( $display_row ) {
132
133 $field_row_path = apply_filters( 'yith_plugin_fw_metabox_field_row_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/metaboxes/field-row.php', $field );
134 file_exists( $field_row_path ) && include $field_row_path;
135 } else {
136 yith_plugin_fw_get_field( $field, true );
137 }
138 } else {
139 // Backward compatibility.
140 $args = apply_filters(
141 'yit_fw_metaboxes_type_args',
142 array(
143 'basename' => YIT_CORE_PLUGIN_PATH,
144 'path' => '/metaboxes/types/',
145 'type' => $field['type'],
146 'args' => array( 'args' => $field ),
147 )
148 );
149 $basename = $args['basename'];
150 $field_path = $args['path'];
151 $field_type = $args['type'];
152 $field_args = $args['args'];
153
154 yit_plugin_get_template( $basename, $field_path . $field_type . '.php', $field_args );
155 }
156 ?>
157 </div>
158 <?php endforeach ?>
159 </div>
160 <?php endforeach ?>
161 </div>
162
163 <?php
164
165 do_action( 'yit_after_metaboxes_tab' );
166