Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 213
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * EU Cookie Law Widget form.
4 *
5 * @html-template Jetpack_EU_Cookie_Law_Widget::form
6 * @package automattic/jetpack
7 */
8
9use Automattic\Jetpack\Redirect;
10
11if ( ! defined( 'ABSPATH' ) ) {
12    exit( 0 );
13}
14
15// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- HTML template, let Phan handle it.
16
17?>
18<p>
19    <strong>
20        <?php esc_html_e( 'Banner text', 'jetpack' ); ?>
21    </strong>
22    <ul>
23        <li>
24            <label>
25                <input
26                    <?php checked( $instance['text'], 'default' ); ?>
27                    name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"
28                    type="radio"
29                    value="default"
30                />
31                <?php esc_html_e( 'Default', 'jetpack' ); ?>
32            </label>
33        </li>
34        <li>
35            <label>
36                <input
37                    <?php checked( $instance['text'], 'custom' ); ?>
38                    name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"
39                    type="radio"
40                    value="custom"
41                />
42                <?php esc_html_e( 'Custom:', 'jetpack' ); ?>
43            </label>
44        </li>
45    </ul>
46    <textarea
47        class="widefat"
48        name="<?php echo esc_attr( $this->get_field_name( 'customtext' ) ); ?>"
49        placeholder="<?php echo esc_attr( $instance['default-text'] ); ?>"
50    ><?php echo esc_html( $instance['customtext'] ); ?></textarea>
51</p>
52
53<hr />
54
55<p>
56    <strong>
57        <?php esc_html_e( 'Privacy Policy Link', 'jetpack' ); ?>
58    </strong>
59    <ul class="eu-cookie-law-widget-policy-url">
60        <li>
61            <label>
62                <input
63                    <?php checked( $instance['policy-url'], 'default' ); ?>
64                    name="<?php echo esc_attr( $this->get_field_name( 'policy-url' ) ); ?>"
65                    type="radio"
66                    value="default"
67                />
68                <?php esc_html_e( 'Default', 'jetpack' ); ?>
69            </label>
70        </li>
71        <li>
72            <label>
73                <input
74                    <?php checked( $instance['policy-url'], 'custom' ); ?>
75                    name="<?php echo esc_attr( $this->get_field_name( 'policy-url' ) ); ?>"
76                    type="radio"
77                    value="custom"
78                />
79                <?php esc_html_e( 'Custom URL:', 'jetpack' ); ?>
80            </label>
81            <input
82                class="widefat"
83                name="<?php echo esc_attr( $this->get_field_name( 'custom-policy-url' ) ); ?>"
84                placeholder="<?php echo esc_url( $instance['default-policy-url'] ); ?>"
85                style="margin-top: .5em;"
86                type="text"
87                value="<?php echo esc_url( $instance['custom-policy-url'] ); ?>"
88            />
89            <span class="notice notice-warning default-policy" style="display: none;">
90                <span style="display: block; margin: .5em 0;">
91                    <strong><?php esc_html_e( 'Caution:', 'jetpack' ); ?></strong>
92                    <?php esc_html_e( 'The default policy URL only covers cookies set by Jetpack. If you’re running other plugins, custom cookies, or third-party tracking technologies, you should create and link to your own cookie statement.', 'jetpack' ); ?>
93                </span>
94            </span>
95            <?php if ( Jetpack::is_module_active( 'wordads' ) ) : ?>
96                <span class="notice notice-warning custom-policy" style="display: none;">
97                    <span style="display: block; margin: .5em 0;">
98                        <strong><?php esc_html_e( 'Caution:', 'jetpack' ); ?></strong>
99                        <?php
100                        printf(
101                            wp_kses(
102                                /* Translators: %s is the URL to a Jetpack support article. */
103                                __( 'For GDPR compliance, please make sure your policy contains <a href="%s" target="_blank">privacy information relating to WordAds</a>.', 'jetpack' ),
104                                array(
105                                    'a' => array(
106                                        'href'   => array(),
107                                        'target' => array(),
108                                    ),
109                                )
110                            ),
111                            esc_url( Redirect::get_url( 'jetpack-support-ads', array( 'anchor' => 'privacy' ) ) )
112                        );
113                        ?>
114                    </span>
115                </span>
116            <?php endif; ?>
117        </li>
118    </ul>
119</p>
120
121<p>
122    <strong>
123        <?php esc_html_e( 'Link text', 'jetpack' ); ?>
124    </strong>
125    <label>
126        <input
127            class="widefat"
128            name="<?php echo esc_attr( $this->get_field_name( 'policy-link-text' ) ); ?>"
129            type="text"
130            value="<?php echo esc_attr( $instance['policy-link-text'] ); ?>"
131        />
132    </label>
133</p>
134
135<hr />
136
137<p>
138    <strong>
139        <?php esc_html_e( 'Button text', 'jetpack' ); ?>
140    </strong>
141    <label>
142        <input
143            class="widefat"
144            name="<?php echo esc_attr( $this->get_field_name( 'button' ) ); ?>"
145            type="text"
146            value="<?php echo esc_attr( $instance['button'] ); ?>"
147        />
148    </label>
149</p>
150
151<hr />
152
153<p>
154    <strong>
155        <?php echo esc_html_x( 'Capture consent & hide the banner', 'action', 'jetpack' ); ?>
156    </strong>
157    <ul>
158        <li>
159            <label>
160                <input
161                    <?php checked( $instance['hide'], 'button' ); ?>
162                    name="<?php echo esc_attr( $this->get_field_name( 'hide' ) ); ?>"
163                    type="radio"
164                    value="button"
165                    <?php echo Jetpack::is_module_active( 'wordads' ) ? 'disabled' : ''; ?>
166                />
167                <?php esc_html_e( 'after the user clicks the dismiss button', 'jetpack' ); ?>
168            </label>
169        </li>
170        <li>
171            <label>
172                <input
173                    <?php checked( $instance['hide'], 'scroll' ); ?>
174                    name="<?php echo esc_attr( $this->get_field_name( 'hide' ) ); ?>"
175                    type="radio"
176                    value="scroll"
177                    <?php echo Jetpack::is_module_active( 'wordads' ) ? 'disabled' : ''; ?>
178                />
179                <?php esc_html_e( 'after the user scrolls the page', 'jetpack' ); ?>
180            </label>
181        </li>
182        <li>
183            <label>
184                <input
185                    <?php checked( $instance['hide'], 'time' ); ?>
186                    name="<?php echo esc_attr( $this->get_field_name( 'hide' ) ); ?>"
187                    type="radio"
188                    value="time"
189                    <?php echo Jetpack::is_module_active( 'wordads' ) ? 'disabled' : ''; ?>
190                />
191                <?php esc_html_e( 'after this amount of time', 'jetpack' ); ?>
192            </label>
193            <input
194                max="1000"
195                min="3"
196                name="<?php echo esc_attr( $this->get_field_name( 'hide-timeout' ) ); ?>"
197                style="padding: 3px 5px; width: 3em;"
198                type="number"
199                value="<?php echo esc_attr( $instance['hide-timeout'] ); ?>"
200            />
201            <?php esc_html_e( 'seconds', 'jetpack' ); ?>
202        </li>
203    </ul>
204    <?php if ( Jetpack::is_module_active( 'wordads' ) ) : ?>
205        <span class="notice notice-warning" style="display: block;">
206            <span style="display: block; margin: .5em 0;">
207                <?php esc_html_e( 'Visitors must provide consent by clicking the dismiss button when WordAds is turned on.', 'jetpack' ); ?>
208            </span>
209        </span>
210    <?php endif; ?>
211</p>
212
213<hr />
214
215<p>
216    <strong>
217        <?php echo esc_html_x( 'Consent expires after', 'action', 'jetpack' ); ?>
218    </strong>
219    <ul>
220        <li>
221            <input
222                max="365"
223                min="1"
224                name="<?php echo esc_attr( $this->get_field_name( 'consent-expiration' ) ); ?>"
225                style="padding: 3px 5px; width: 3.75em;"
226                type="number"
227                value="<?php echo esc_attr( $instance['consent-expiration'] ); ?>"
228            />
229            <?php esc_html_e( 'days', 'jetpack' ); ?>
230        </li>
231    </ul>
232</p>
233
234<hr />
235
236<p>
237    <strong>
238        <?php esc_html_e( 'Color scheme', 'jetpack' ); ?>
239    </strong>
240    <ul>
241        <li>
242            <label>
243                <input
244                    <?php checked( $instance['color-scheme'], 'default' ); ?>
245                    name="<?php echo esc_attr( $this->get_field_name( 'color-scheme' ) ); ?>"
246                    type="radio"
247                    value="default"
248                />
249                <?php esc_html_e( 'Light', 'jetpack' ); ?>
250            </label>
251        </li>
252        <li>
253            <label>
254                <input
255                    <?php checked( $instance['color-scheme'], 'negative' ); ?>
256                    name="<?php echo esc_attr( $this->get_field_name( 'color-scheme' ) ); ?>"
257                    type="radio"
258                    value="negative"
259                />
260                <?php esc_html_e( 'Dark', 'jetpack' ); ?>
261            </label>
262        </li>
263    </ul>
264</p>
265
266<hr />
267
268<p>
269    <strong>
270        <?php esc_html_e( 'Position', 'jetpack' ); ?>
271    </strong>
272    <ul>
273        <li>
274            <label>
275                <input
276                    <?php checked( $instance['position'], 'bottom' ); ?>
277                    name="<?php echo esc_attr( $this->get_field_name( 'position' ) ); ?>"
278                    type="radio"
279                    value="bottom"
280                />
281                <?php esc_html_e( 'Bottom', 'jetpack' ); ?>
282            </label>
283        </li>
284        <li>
285            <label>
286                <input
287                    <?php checked( $instance['position'], 'top' ); ?>
288                    name="<?php echo esc_attr( $this->get_field_name( 'position' ) ); ?>"
289                    type="radio"
290                    value="top"
291                />
292                <?php esc_html_e( 'Top', 'jetpack' ); ?>
293            </label>
294        </li>
295    </ul>
296</p>
297
298<hr />
299
300<p class="small">
301    <?php esc_html_e( 'It is your own responsibility to ensure that your site complies with the relevant laws.', 'jetpack' ); ?>
302    <a href="<?php echo esc_url( Redirect::get_url( 'jetpack-support-extra-sidebar-widgets-eu-cookie-law-widget' ) ); ?>">
303        <?php esc_html_e( 'Click here for more information', 'jetpack' ); ?>
304    </a>
305</p>