PluginProbe ʕ •ᴥ•ʔ
YITH WooCommerce Wishlist / 3.18.0
YITH WooCommerce Wishlist v3.18.0
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 4 years ago
tab.php
217 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 *
9 * @package YITH\PluginFramework\Templates
10 */
11
12 defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
13
14 global $post;
15 $classes = apply_filters( 'yith_plugin_fw_metabox_class', $class, $post );
16 $classes = yith_plugin_fw_remove_duplicate_classes( $classes );
17 $ul_style = count( $tabs ) <= 1 ? 'display:none;' : '';
18 $i = 0;
19 do_action( 'yit_before_metaboxes_tab' );
20
21 // Allow SVGs.
22 $label_extra_allowed_tags = array(
23 'svg' => array(
24 'class' => true,
25 'aria-hidden' => true,
26 'aria-labelledby' => true,
27 'role' => true,
28 'xmlns' => true,
29 'width' => true,
30 'height' => true,
31 'viewbox' => true,
32 'version' => true,
33 'x' => true,
34 'y' => true,
35 'style' => true,
36 ),
37 'circle' => array(
38 'class' => true,
39 'cx' => true,
40 'cy' => true,
41 'r' => true,
42 ),
43 'g' => array( 'fill' => true ),
44 'polyline' => array(
45 'class' => true,
46 'points' => true,
47 ),
48 'polygon' => array(
49 'class' => true,
50 'points' => true,
51 ),
52 'line' => array(
53 'class' => true,
54 'x1' => true,
55 'x2' => true,
56 'y1' => true,
57 'y2' => true,
58 ),
59 'title' => array( 'title' => true ),
60 'path' => array(
61 'class' => true,
62 'd' => true,
63 'fill' => true,
64 ),
65 'rect' => array(
66 'class' => true,
67 'x' => true,
68 'y' => true,
69 'fill' => true,
70 'width' => true,
71 'height' => true,
72 ),
73 'style' => array(
74 'type' => true,
75 ),
76 );
77
78 $label_allowed_tags = array_merge( wp_kses_allowed_html( 'post' ), $label_extra_allowed_tags );
79 $label_allowed_tags = apply_filters( 'yith_plugin_fw_metabox_label_allowed_tags', $label_allowed_tags, $meta_box_id );
80
81 ?>
82 <div class="yith-plugin-fw metaboxes-tab <?php echo esc_attr( $classes ); ?>">
83 <?php do_action( 'yit_before_metaboxes_labels' ); ?>
84 <ul class="metaboxes-tabs clearfix yith-plugin-fw__tabs" style="<?php echo esc_attr( $ul_style ); ?>" data-tab-additional-active-class="tabs">
85 <?php foreach ( $tabs as $key => $_tab ) : ?>
86
87 <?php
88 if ( empty( $_tab['fields'] ) ) {
89 continue;
90 }
91 $anchor_id = 'yith-plugin-fw-metabox-tab-' . urldecode( $key ) . '-anchor';
92
93 // Parse deps for the tab visibility.
94 if ( isset( $_tab['deps'] ) ) {
95 $_tab['deps']['target-id'] = isset( $_tab['deps']['target-id'] ) ? $_tab['deps']['target-id'] : $anchor_id;
96 if ( isset( $_tab['deps']['id'] ) && strpos( $_tab['deps']['id'], '_' ) !== 0 ) {
97 $_tab['deps']['id'] = '_' . $_tab['deps']['id'];
98 }
99 if ( isset( $_tab['deps']['ids'] ) && strpos( $_tab['deps']['ids'], '_' ) !== 0 ) {
100 $_tab['deps']['ids'] = '_' . $_tab['deps']['ids'];
101 }
102
103 $_tab['deps']['type'] = 'hideme';
104 }
105
106 $class = 'yith-plugin-fw__tab';
107 if ( ! $i ) {
108 $class .= ' tabs yith-plugin-fw__tab--active';
109 }
110 $i ++;
111 ?>
112 <li id="<?php echo esc_attr( $anchor_id ); ?>" class="<?php echo esc_attr( $class ); ?>" <?php echo yith_field_deps_data( $_tab ); ?>>
113 <a href="#<?php echo esc_attr( urldecode( $key ) ); ?>" class="yith-plugin-fw__tab__handler">
114 <?php echo wp_kses( $_tab['label'], $label_allowed_tags ); ?>
115 </a>
116 </li>
117 <?php endforeach; ?>
118 </ul>
119
120 <?php do_action( 'yit_after_metaboxes_labels' ); ?>
121
122 <?php
123 if ( isset( $_tab['label'] ) ) {
124 do_action( 'yit_before_metabox_option_' . urldecode( $key ) );
125 }
126 ?>
127
128 <?php wp_nonce_field( 'metaboxes-fields-nonce', 'yit_metaboxes_nonce' ); ?>
129
130 <?php foreach ( $tabs as $key => $_tab ) : ?>
131 <div class="tabs-panel yith-plugin-fw__tab-panel" id="<?php echo esc_attr( urldecode( $key ) ); ?>">
132 <?php
133 if ( empty( $_tab['fields'] ) ) {
134 continue;
135 }
136
137 $_tab['fields'] = apply_filters( 'yit_metabox_' . $key . '_tab_fields', $_tab['fields'] );
138 ?>
139
140 <?php foreach ( $_tab['fields'] as $id_tab => $field ) : ?>
141 <?php
142 $field_name = $field['name'];
143 $field_name = str_replace( 'yit_metaboxes[', '', $field_name );
144 $pos = strpos( $field_name, ']' );
145 if ( $pos ) {
146 $field_name = substr_replace( $field_name, '', $pos, 1 );
147 }
148
149 /**
150 * APPLY_FILTER: yith_plugin_fw_metabox_{meta_box_id}_field_pre_get_value
151 * Allow filtering values for meta-box fields instead of retrieving them by post_meta(s).
152 *
153 * @param mixed|null $value The value to be filtered. Set 'null' to retrieve it by the related post_meta (Default: null).
154 * @param int $post_id The post ID.
155 * @param string $field_name The field name.
156 * @param array $field The field.
157 *
158 * @since 3.7.6
159 */
160 $value = apply_filters( "yith_plugin_fw_metabox_{$meta_box_id}_field_pre_get_value", null, $post->ID, $field_name, $field );
161 if ( is_null( $value ) ) {
162 $value = yit_get_post_meta( $post->ID, $field_name );
163 }
164
165 $field['value'] = false === $value ? ( isset( $field['std'] ) ? $field['std'] : '' ) : $value;
166 $field['checkboxgroup'] = ( 'checkbox' === $field['type'] && isset( $field['checkboxgroup'] ) ) ? ' ' . $field['checkboxgroup'] : '';
167 $container_classes = 'the-metabox ' . $field['type'] . $field['checkboxgroup'] . ' clearfix ';
168 $extra_row_class = isset( $field['extra_row_class'] ) ? $field['extra_row_class'] : '';
169
170 $container_classes .= empty( $field['label'] ) ? 'no-label' : '';
171 $container_classes .= ' ' . $extra_row_class;
172
173 ?>
174 <div class="<?php echo esc_attr( $container_classes ); ?>">
175 <?php
176 $field_template_path = yith_plugin_fw_get_field_template_path( $field );
177 if ( $field_template_path ) {
178 $display_row = 'hidden' !== $field['type'];
179 $display_row = isset( $field['yith-display-row'] ) ? ! ! $field['yith-display-row'] : $display_row;
180 $field['display-field-only'] = in_array( $field['type'], array( 'hidden', 'html', 'sep', 'simple-text', 'title', 'list-table' ), true );
181
182 if ( $display_row ) {
183
184 $field_row_path = apply_filters( 'yith_plugin_fw_metabox_field_row_template_path', YIT_CORE_PLUGIN_TEMPLATE_PATH . '/metaboxes/field-row.php', $field );
185 file_exists( $field_row_path ) && include $field_row_path;
186 } else {
187 yith_plugin_fw_get_field( $field, true );
188 }
189 } else {
190 // Backward compatibility.
191 $args = apply_filters(
192 'yit_fw_metaboxes_type_args',
193 array(
194 'basename' => YIT_CORE_PLUGIN_PATH,
195 'path' => '/metaboxes/types/',
196 'type' => $field['type'],
197 'args' => array( 'args' => $field ),
198 )
199 );
200 $basename = $args['basename'];
201 $field_path = $args['path'];
202 $field_type = $args['type'];
203 $field_args = $args['args'];
204
205 yit_plugin_get_template( $basename, $field_path . $field_type . '.php', $field_args );
206 }
207 ?>
208 </div>
209 <?php endforeach ?>
210 </div>
211 <?php endforeach ?>
212 </div>
213
214 <?php
215
216 do_action( 'yit_after_metaboxes_tab' );
217