PluginProbe
Boxzilla – WordPress Popup Builder / 3.1.1
Boxzilla – WordPress Popup Builder v3.1.1
3.4.11 3.4.10 3.4.9 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 trunk 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 All 72 releases
boxzilla / src / admin / views / metaboxes / box-option-controls.php

box-option-controls.php in Boxzilla – WordPress Popup Builder 3.1.1, at src/admin/views/metaboxes/box-option-controls.php

218 lines 11.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) or exit;
4
5 /** @var \Boxzilla\Box $box */
6 /** @var array $opts */
7 /** @var array $global_opts */
8
9 /** @var array $rule_options */
10 $rule_options = array(
11 '' => __( "Select a condition", 'boxzilla' ),
12 'everywhere' => __( 'everywhere', 'boxzilla' ),
13 'is_page' => __( 'if page', 'boxzilla' ),
14 'is_single' => __( 'if post', 'boxzilla' ),
15 'is_post_with_tag' => __( 'if post tag', 'boxzilla' ),
16 'is_post_in_category' => __( 'if post category', 'boxzilla' ),
17 'is_post_type' => __( 'if post type', 'boxzilla' ),
18 'is_url' => __( 'if URL', 'boxzilla' ),
19 'is_referer' => __( 'if referer', 'boxzilla' ),
20 );
21
22 /**
23 * @ignore
24 */
25 $rule_options = apply_filters( 'boxzilla_rules_options', $rule_options );
26
27 ?>
28 <table class="form-table">
29 <?php
30
31 /**
32 * @ignore
33 */
34 do_action( 'boxzilla_before_box_option_controls', $box, $opts );
35
36 ?>
37 <tr>
38 <th><?php _e( 'Load this box if', 'boxzilla' ); ?></th>
39 <td>
40 <label>
41 <?php _e( 'Request matches', 'boxzilla' ); ?>
42 <select name="boxzilla_box[rules_comparision]">
43 <option value="any" <?php selected( $opts['rules_comparision'], 'any' ); ?>><?php _e( 'any', 'boxzilla' ); ?></option>
44 <option value="all" <?php selected( $opts['rules_comparision'], 'all' ); ?>><?php _e( 'all', 'boxzilla' ); ?></option>
45 </select>
46 <?php _e( 'of the following conditions.', 'boxzilla' ); ?>
47 </label>
48 </td>
49 </tr>
50 <tbody id="boxzilla-box-rules">
51 <?php
52 $key = 0;
53 foreach( $opts['rules'] as $rule ) { if( ! array_key_exists( 'condition', $rule ) ) { continue; } ?>
54 <tr valign="top" class="boxzilla-rule-row boxzilla-rule-row-<?php echo $key; ?>">
55 <th style="text-align: right; font-weight: normal;">
56 <span class="boxzilla-close boxzilla-remove-rule"><span class="dashicons dashicons-dismiss"></span></span>
57 </th>
58 <td>
59 <select class="boxzilla-rule-condition" name="boxzilla_box[rules][<?php echo $key; ?>][condition]">
60 <?php foreach( $rule_options as $value => $label ) {
61 $readonly = $value == '' ? 'readonly': '';
62 printf( '<option value="%s" %s %s>%s</option>', $value, $readonly, selected( $rule['condition'], $value ), $label );
63 } ?>
64 </select>
65
66 <select class="boxzilla-rule-qualifier" name="boxzilla_box[rules][<?php echo $key; ?>][qualifier]">
67 <option value="1" <?php selected( ! isset( $rule['qualifier'] ) || $rule['qualifier'] ); ?>><?php _e( 'is', 'boxzilla' ); ?></option>
68 <option value="0" <?php selected( isset( $rule['qualifier'] ) && !$rule['qualifier'] ); ?>><?php _e( 'is not', 'boxzilla' ); ?></option>
69 </select>
70
71 <input class="boxzilla-rule-value regular-text" name="boxzilla_box[rules][<?php echo $key; ?>][value]" type="text" value="<?php echo esc_attr( $rule['value'] ); ?>" placeholder="<?php _e( 'Leave empty for any or enter (comma-separated) names or ID\'s', 'boxzilla' ); ?>" style="<?php if( in_array( $rule['condition'], array( '', 'everywhere' ) ) ) { echo 'display: none;'; } ?>" />
72 </td>
73 </tr>
74 <?php $key++;
75 } ?>
76 </tbody>
77 <tr>
78 <th></th>
79 <td><button type="button" class="button boxzilla-add-rule"><?php _e( 'Add rule', 'boxzilla' ); ?></button></td>
80 </tr>
81 <tr valign="top">
82 <th><label for="boxzilla_position"><?php _e( 'Box Position', 'boxzilla' ); ?></label></th>
83 <td>
84 <table class="window-positions">
85 <tr>
86 <td>
87 <?php
88 $value = 'top-left'; $label = __( 'Top Left', 'boxzilla' );
89 printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
90 ?>
91 </td>
92 <td></td>
93 <td>
94 <?php
95 $value = 'top-right'; $label = __( 'Top Right', 'boxzilla' );
96 printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
97 ?>
98 </td>
99 </tr>
100 <tr>
101 <td></td>
102 <td>
103 <?php
104 $value = 'center'; $label = __( 'Center', 'boxzilla' );
105 printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
106 ?>
107 </td>
108 <td></td>
109 </tr>
110 <tr>
111 <td>
112 <?php
113 $value = 'bottom-left'; $label = __( 'Bottom Left', 'boxzilla' );
114 printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
115 ?>
116 </td>
117 <td></td>
118 <td>
119 <?php
120 $value = 'bottom-right'; $label = __( 'Bottom Right', 'boxzilla' );
121 printf( '<label><input type="radio" name="boxzilla_box[css][position]" value="%s" %s> &nbsp; %s</label>', $value, checked( $opts['css']['position'], $value, false ), $label );
122 ?>
123 </td>
124 </tr>
125 </table>
126 </td>
127 </tr>
128 <tr valign="top">
129 <th><label><?php _e( 'Animation', 'boxzilla' ); ?></label></th>
130 <td>
131 <label><input type="radio" name="boxzilla_box[animation]" value="fade" <?php checked($opts['animation'], 'fade'); ?> /> <?php _e( 'Fade In', 'boxzilla' ); ?></label> &nbsp;
132 <label><input type="radio" name="boxzilla_box[animation]" value="slide" <?php checked($opts['animation'], 'slide'); ?> /> <?php _e( 'Slide In', 'boxzilla' ); ?></label>
133 <p class="help"><?php _e( 'Which animation type should be used to show the box when triggered?', 'boxzilla' ); ?></p>
134 </td>
135 </tr>
136 <tr valign="top">
137 <th><label for="boxzilla_trigger"><?php _e( 'Auto-show box?', 'boxzilla' ); ?></label></th>
138 <td>
139 <label><input type="radio" class="boxzilla-auto-show-trigger" name="boxzilla_box[trigger]" value="" <?php checked( $opts['trigger'], '' ); ?> /> <?php _e( 'Never', 'boxzilla' ); ?></label><br />
140 <label><input type="radio" class="boxzilla-auto-show-trigger" name="boxzilla_box[trigger]" value="time_on_page" <?php checked( $opts['trigger'], 'time_on_page' ); ?> /> <?php printf( __( 'Yes, after %s seconds on the page.', 'boxzilla' ), '<input type="number" name="boxzilla_box[trigger_time_on_page]" min="0" value="' . esc_attr( $opts['trigger_time_on_page'] ) . '" />' ); ?></label><br />
141 <label><input type="radio" class="boxzilla-auto-show-trigger" name="boxzilla_box[trigger]" value="percentage" <?php checked( $opts['trigger'], 'percentage' ); ?> /> <?php printf( __( 'Yes, when at %s of page height', 'boxzilla' ), '<input type="number" name="boxzilla_box[trigger_percentage]" min="0" max="100" value="' . esc_attr( $opts['trigger_percentage'] ) . '" />%' ); ?></label><br />
142 <label><input type="radio" class="boxzilla-auto-show-trigger" name="boxzilla_box[trigger]" value="element" <?php checked( $opts['trigger'], 'element' ); ?> /> <?php printf( __( 'Yes, when at element %s', 'boxzilla' ), '<input type="text" name="boxzilla_box[trigger_element]" value="' . esc_attr( $opts['trigger_element'] ) . '" placeholder="' . __( 'Example: #comments', 'boxzilla') .'" />' ); ?></label><br />
143 <?php do_action( 'boxzilla_output_auto_show_trigger_options', $opts ); ?>
144 </td>
145 </tr>
146 <tbody class="boxzilla-trigger-options" style="display: <?php echo ( $opts['trigger'] === '' ) ? 'none' : 'table-row-group'; ?>;">
147 <tr valign="top">
148 <th><label for="boxzilla_cookie"><?php _e( 'Cookie expiration', 'boxzilla' ); ?></label></th>
149 <td>
150 <div style="display: inline-block; margin-right: 20px;">
151 <label for="boxzilla_cookie_triggered" style="font-weight: bold; display: block;"><?php esc_html_e( 'Triggered', 'mailchimp-for-wp' ); ?></label>
152 <input type="number" id="boxzilla_cookie_triggered" name="boxzilla_box[cookie][triggered]" min="0" step="1" value="<?php echo esc_attr($opts['cookie']['triggered']); ?>" />
153 <small><?php _e( 'hours', 'boxzilla' ); ?></small>
154 </div>
155 <div style="display: inline-block;">
156 <label for="boxzilla_cookie_dismissed" style="font-weight: bold; display: block;"><?php esc_html_e( 'Dismissed', 'mailchimp-for-wp' ); ?></label>
157 <input type="number" id="boxzilla_cookie_dismissed" name="boxzilla_box[cookie][dismissed]" min="0" step="1" value="<?php echo esc_attr($opts['cookie']['dismissed']); ?>" />
158 <small><?php _e( 'hours', 'boxzilla' ); ?></small>
159 </div>
160 <br />
161
162 <p class="help"><?php _e( 'After this box is triggered or dismissed, how many hours should it stay hidden?', 'boxzilla' ); ?></p>
163 </td>
164 </tr>
165 <tr valign="top">
166 <th><label for="boxzilla_hide_on_screen_size"><?php _e( 'Do not auto-show box on small screens?', 'boxzilla' ); ?></label></th>
167 <td>
168 <p><?php printf( __( 'Do not auto-show on screens smaller than %s.', 'boxzilla' ), '<input type="number" min="0" name="boxzilla_box[hide_on_screen_size]" value="' . esc_attr( $opts['hide_on_screen_size'] ) . '" style="max-width: 70px;" />px' ); ?></p>
169 <p class="help"><?php _e( 'Leave empty if you <strong>do</strong> want to auto-show the box on small screens.', 'boxzilla' ); ?></p>
170 </td>
171
172 </tr>
173 <tr valign="top">
174 <th><label for="boxzilla_auto_hide"><?php _e( 'Auto-hide?', 'boxzilla' ); ?></label></th>
175 <td>
176 <label><input type="radio" name="boxzilla_box[auto_hide]" value="1" <?php checked( $opts['auto_hide'], 1 ); ?> /> <?php _e( 'Yes' ); ?></label> &nbsp;
177 <label><input type="radio" name="boxzilla_box[auto_hide]" value="0" <?php checked( $opts['auto_hide'], 0 ); ?> /> <?php _e( 'No' ); ?></label> &nbsp;
178 <p class="help"><?php _e( 'Hide box again when visitors scroll back up?', 'boxzilla' ); ?></p>
179 </td>
180 </tr>
181 <tr valign="top">
182 <th><label for="boxzilla_test_mode"><?php _e( 'Enable test mode?', 'boxzilla' ); ?></label></th>
183 <td>
184 <label><input type="radio" id="boxzilla_test_mode_1" name="boxzilla_global_settings[test_mode]" value="1" <?php checked( $global_opts['test_mode'], 1 ); ?> /> <?php _e( 'Yes' ); ?></label> &nbsp;
185 <label><input type="radio" id="boxzilla_test_mode_0" name="boxzilla_global_settings[test_mode]" value="0" <?php checked( $global_opts['test_mode'], 0 ); ?> /> <?php _e( 'No' ); ?></label> &nbsp;
186 <p class="help"><?php _e( 'If test mode is enabled, all boxes will show up regardless of whether a cookie has been set.', 'boxzilla' ); ?></p>
187 </td>
188 </tr>
189 <?php
190
191 /**
192 * @ignore
193 */
194 do_action( 'boxzilla_after_box_option_controls', $box, $opts ); ?>
195 </tbody>
196 </table>
197
198
199 <script type="text/html" id="tmpl-rule-row-template">
200 <tr valign="top" class="boxzilla-rule-row boxzilla-rule-row-{{{data.key}}}">
201 <th style="text-align: right; font-weight: normal;">
202 <span class="boxzilla-close boxzilla-remove-rule"><span class="dashicons dashicons-dismiss"></span></span>
203 </th>
204 <td class="boxzilla-sm">
205 <select class="boxzilla-rule-condition" name="boxzilla_box[rules][{{{data.key}}}][condition]">
206 <?php foreach( $rule_options as $value => $label ) {
207 printf( '<option value="%s" %s %s>%s</option>', $value, disabled( $value, '', false ), '', $label );
208 } ?>
209 </select>
210 <select class="boxzilla-rule-qualifier" name="boxzilla_box[rules][{{{data.key}}}][qualifier]" style="display: none;" >
211 <option value="1" selected><?php _e( 'is', 'boxzilla' ); ?></option>
212 <option value="0"><?php _e( 'is not', 'boxzilla' ); ?></option>
213 </select>
214
215 <input class="boxzilla-rule-value regular-text" name="boxzilla_box[rules][{{{data.key}}}][value]" type="text" value="" placeholder="<?php _e( 'Leave empty for any or enter (comma-separated) names or ID\'s', 'boxzilla' ); ?>" style="display: none;" />
216 </td>
217 </tr>
218 </script>