PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 12.1
Jetpack – WP Security, Backup, Speed, & Growth v12.1
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / widgets / twitter-timeline.php

twitter-timeline.php in Jetpack – WP Security, Backup, Speed, & Growth 12.1, at modules/widgets/twitter-timeline.php

596 lines 19.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * Twitter Timeline Widget.
4 *
5 * Based on Evolution Twitter Timeline
6 * (https://wordpress.org/extend/plugins/evolution-twitter-timeline/)
7 * For details on Twitter Timelines see:
8 * - https://twitter.com/settings/widgets
9 * - https://dev.twitter.com/docs/embedded-timelines
10 *
11 * @package automattic/jetpack
12 */
13
14 // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files.
15
16 use Automattic\Jetpack\Assets;
17 use Automattic\Jetpack\Redirect;
18
19 /**
20 * Register the widget for use in Appearance -> Widgets
21 */
22 function jetpack_twitter_timeline_widget_init() {
23 register_widget( 'Jetpack_Twitter_Timeline_Widget' );
24 }
25 add_action( 'widgets_init', 'jetpack_twitter_timeline_widget_init' );
26
27 /**
28 * Widget class.
29 */
30 class Jetpack_Twitter_Timeline_Widget extends WP_Widget {
31 /**
32 * Register widget with WordPress.
33 */
34 public function __construct() {
35 parent::__construct(
36 'twitter_timeline',
37 /** This filter is documented in modules/widgets/facebook-likebox.php */
38 apply_filters( 'jetpack_widget_name', esc_html__( 'Twitter Timeline', 'jetpack' ) ),
39 array(
40 'classname' => 'widget_twitter_timeline',
41 'description' => __( 'Display an official Twitter Embedded Timeline widget.', 'jetpack' ),
42 'customize_selective_refresh' => true,
43 )
44 );
45
46 if ( is_active_widget( false, false, $this->id_base ) || is_active_widget( false, false, 'monster' ) || is_customize_preview() ) {
47 add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
48 }
49
50 add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
51 add_filter( 'widget_types_to_hide_from_legacy_widget_block', array( $this, 'hide_widget_in_block_editor' ) );
52 }
53
54 /**
55 * Remove the "Twitter Timeline" widget from the Legacy Widget block
56 *
57 * @param array $widget_types List of widgets that are currently removed from the Legacy Widget block.
58 * @return array $widget_types New list of widgets that will be removed.
59 */
60 public function hide_widget_in_block_editor( $widget_types ) {
61 $widget_types[] = 'twitter_timeline';
62 return $widget_types;
63 }
64
65 /**
66 * Enqueue scripts.
67 */
68 public function enqueue_scripts() {
69 if ( ! class_exists( 'Jetpack_AMP_Support' ) || ! Jetpack_AMP_Support::is_amp_request() ) {
70 wp_enqueue_script( 'jetpack-twitter-timeline' );
71 }
72 }
73
74 /**
75 * Enqueue script to improve admin UI
76 *
77 * @param string $hook Page hook.
78 */
79 public function admin_scripts( $hook ) {
80 // This is still 'widgets.php' when managing widgets via the Customizer.
81 if ( 'widgets.php' === $hook ) {
82 wp_enqueue_script(
83 'twitter-timeline-admin',
84 Assets::get_file_url_for_environment(
85 '_inc/build/widgets/twitter-timeline-admin.min.js',
86 'modules/widgets/twitter-timeline-admin.js'
87 ),
88 array( 'jquery' ),
89 JETPACK__VERSION,
90 true
91 );
92 }
93 }
94
95 /**
96 * Front-end display of widget.
97 *
98 * @see WP_Widget::widget()
99 *
100 * @param array $args Widget arguments.
101 * @param array $instance Saved values from database.
102 */
103 public function widget( $args, $instance ) {
104 $output = '';
105
106 // Twitter deprecated `data-widget-id` on 2018-05-25,
107 // with cease support deadline on 2018-07-27.
108 if ( isset( $instance['type'] ) && 'widget-id' === $instance['type'] ) {
109 if ( current_user_can( 'edit_theme_options' ) ) {
110 $output .= $args['before_widget']
111 . $args['before_title'] . esc_html__( 'Twitter Timeline', 'jetpack' ) . $args['after_title']
112 . '<p>' . esc_html__( "The Twitter Timeline widget can't display tweets based on searches or hashtags. To display a simple list of tweets instead, change the Widget ID to a Twitter username. Otherwise, delete this widget.", 'jetpack' ) . '</p>'
113 . '<p>' . esc_html__( '(Only administrators will see this message.)', 'jetpack' ) . '</p>'
114 . $args['after_widget'];
115 }
116
117 echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
118 return;
119 }
120
121 $instance['lang'] = substr( strtoupper( get_locale() ), 0, 2 );
122
123 $output .= $args['before_widget'];
124
125 $title = isset( $instance['title'] ) ? $instance['title'] : '';
126
127 /** This filter is documented in core/src/wp-includes/default-widgets.php */
128 $title = apply_filters( 'widget_title', $title );
129 if ( ! empty( $title ) ) {
130 $output .= $args['before_title'] . $title . $args['after_title'];
131 }
132
133 $possible_data_attribs = array(
134 'width',
135 'height',
136 'theme',
137 'border-color',
138 'tweet-limit',
139 'lang',
140 );
141 $data_attrs = '';
142 foreach ( $possible_data_attribs as $att ) {
143 if ( ! empty( $instance[ $att ] ) && ! is_array( $instance[ $att ] ) ) {
144 $data_attrs .= ' data-' . esc_attr( $att ) . '="' . esc_attr( $instance[ $att ] ) . '"';
145 }
146 }
147
148 /** This filter is documented in modules/shortcodes/tweet.php */
149 $partner = apply_filters( 'jetpack_twitter_partner_id', 'jetpack' );
150 if ( ! empty( $partner ) ) {
151 $data_attrs .= ' data-partner="' . esc_attr( $partner ) . '"';
152 }
153
154 /**
155 * Allow the activation of Do Not Track for the Twitter Timeline Widget.
156 *
157 * @see https://developer.twitter.com/en/docs/twitter-for-websites/timelines/guides/parameter-reference.html
158 *
159 * @module widgets
160 *
161 * @since 6.9.0
162 *
163 * @param bool false Should the Twitter Timeline use the DNT attribute? Default to false.
164 */
165 $dnt = apply_filters( 'jetpack_twitter_timeline_default_dnt', false );
166 if ( true === $dnt ) {
167 $data_attrs .= ' data-dnt="true"';
168 }
169
170 if ( ! empty( $instance['chrome'] ) && is_array( $instance['chrome'] ) ) {
171 $data_attrs .= ' data-chrome="' . esc_attr( join( ' ', $instance['chrome'] ) ) . '"';
172 }
173
174 $timeline_placeholder = __( 'My Tweets', 'jetpack' );
175
176 /**
177 * Filter the Timeline placeholder text.
178 *
179 * @module widgets
180 *
181 * @since 3.4.0
182 *
183 * @param string $timeline_placeholder Timeline placeholder text.
184 */
185 $timeline_placeholder = apply_filters( 'jetpack_twitter_timeline_placeholder', $timeline_placeholder );
186
187 $type = ( isset( $instance['type'] ) ? $instance['type'] : '' );
188 $widget_id = ( isset( $instance['widget-id'] ) ? $instance['widget-id'] : '' );
189
190 if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
191 $width = ! empty( $instance['width'] ) ? $instance['width'] : 600;
192 $height = ! empty( $instance['height'] ) ? $instance['height'] : 480;
193 $output .= '<amp-twitter' . $data_attrs . ' layout="responsive" data-timeline-source-type="profile" data-timeline-screen-name="' . esc_attr( $widget_id ) . '" width="' . absint( $width ) . '" height="' . absint( $height ) . '">'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
194 $output .= esc_html( $timeline_placeholder ) . '</amp-twitter>';
195
196 echo $output . $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
197 return;
198 }
199
200 // Start tag output
201 // This tag is transformed into the widget markup by Twitter's
202 // widgets.js code.
203 $output .= '<a class="twitter-timeline"' . $data_attrs; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
204 switch ( $type ) {
205 case 'profile':
206 $output .= ' href="https://twitter.com/' . esc_attr( $widget_id ) . '"';
207 break;
208 case 'widget-id':
209 default:
210 $output .= ' data-widget-id="' . esc_attr( $widget_id ) . '"';
211 break;
212 }
213 $output .= ' href="https://twitter.com/' . esc_attr( $widget_id ) . '"';
214
215 // End tag output.
216 $output .= '>';
217
218 $output .= esc_html( $timeline_placeholder ) . '</a>';
219
220 // End tag output.
221
222 echo $output . $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
223
224 /** This action is documented in modules/widgets/gravatar-profile.php */
225 do_action( 'jetpack_stats_extra', 'widget_view', 'twitter_timeline' );
226 }
227
228 /**
229 * Sanitize widget form values as they are saved.
230 *
231 * @see WP_Widget::update()
232 *
233 * @param array $new_instance Values just sent to be saved.
234 * @param array $old_instance Previously saved values from database.
235 *
236 * @return array Updated safe values to be saved.
237 */
238 public function update( $new_instance, $old_instance ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
239 $instance = array();
240
241 $instance['title'] = sanitize_text_field( $new_instance['title'] );
242
243 $width = (int) $new_instance['width'];
244 if ( $width ) {
245 // From publish.twitter.com: 220 <= width <= 1200.
246 $instance['width'] = min( max( $width, 220 ), 1200 );
247 } else {
248 // Set default width value to minimum.
249 $instance['width'] = 220;
250 }
251
252 $tweet_display = sanitize_text_field( $new_instance['tweet-display'] );
253 $instance['tweet-display'] = $tweet_display;
254 /**
255 * A timeline with a specified limit is expanded to the height of those Tweets.
256 * The specified height value no longer applies, so reject the height value
257 * when a valid limit is set: a widget attempting to save both limit 5 and
258 * height 400 would be saved with just limit 5.
259 * So if the tweet display option is set to 'dynamic' the limit will be unset and we'll
260 * take into account the height value.
261 * If the tweet display option is set to 'fixed' the height will be unset and we'll
262 * take into account the limit value.
263 */
264 $instance['height'] = '';
265 $instance['tweet-limit'] = null;
266
267 switch ( $tweet_display ) {
268 case 'dynamic':
269 $height = (int) $new_instance['height'];
270 // From publish.twitter.com: height >= 200.
271 $instance['height'] = max( $height, 200 );
272 break;
273 case 'fixed':
274 $tweet_limit = (int) $new_instance['tweet-limit'];
275 // From publish.twitter.com: 1 >= tweet-limit >= 20.
276 $instance['tweet-limit'] = min( max( $tweet_limit, 1 ), 20 );
277 break;
278 }
279
280 // If they entered something that might be a full URL, try to parse it out.
281 if ( is_string( $new_instance['widget-id'] ) ) {
282 if ( preg_match(
283 '#https?://twitter\.com/settings/widgets/(\d+)#s',
284 $new_instance['widget-id'],
285 $matches
286 ) ) {
287 $new_instance['widget-id'] = $matches[1];
288 }
289 }
290
291 $instance['widget-id'] = sanitize_text_field( $new_instance['widget-id'] );
292
293 $new_border_color = sanitize_hex_color( $new_instance['border-color'] );
294 if ( ! empty( $new_border_color ) ) {
295 $instance['border-color'] = $new_border_color;
296 }
297
298 $instance['type'] = 'profile';
299
300 $instance['theme'] = 'light';
301 if ( in_array( $new_instance['theme'], array( 'light', 'dark' ), true ) ) {
302 $instance['theme'] = $new_instance['theme'];
303 }
304
305 $instance['chrome'] = array();
306 $chrome_settings = array(
307 'noheader',
308 'nofooter',
309 'noborders',
310 'transparent',
311 'noscrollbar',
312 );
313
314 foreach ( $chrome_settings as $chrome ) {
315 switch ( $chrome ) {
316 case 'noheader':
317 case 'nofooter':
318 case 'noborders':
319 case 'noscrollbar':
320 if ( ! isset( $new_instance['chrome'] ) || ! in_array( $chrome, $new_instance['chrome'], true ) ) {
321 $instance['chrome'][] = $chrome;
322 }
323 break;
324 default:
325 if ( isset( $new_instance['chrome'] ) && in_array( $chrome, $new_instance['chrome'], true ) ) {
326 $instance['chrome'][] = $chrome;
327 }
328 break;
329 }
330 }
331
332 return $instance;
333 }
334
335 /**
336 * Returns a link to the documentation for a feature of this widget on
337 * Jetpack or WordPress.com.
338 *
339 * @param string $hash anchor to potentially append to URL to target specific paragraph in page.
340 */
341 public function get_docs_link( $hash = '' ) {
342 if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
343 $base_url = 'https://wordpress.com/support/widgets/twitter-timeline-widget/';
344 } else {
345 $base_url = esc_url( Redirect::get_url( 'jetpack-support-extra-sidebar-widgets-twitter-timeline-widget' ) );
346 }
347 return '<a class="widget-access-link" href="' . $base_url . $hash . '" target="_blank"> Need help?</a>';
348 }
349
350 /**
351 * Back end widget form.
352 *
353 * @see WP_Widget::form()
354 *
355 * @param array $instance Previously saved values from database.
356 */
357 public function form( $instance ) {
358 $defaults = array(
359 'title' => esc_html__( 'Follow me on Twitter', 'jetpack' ),
360 'width' => '220',
361 'height' => '200',
362 'type' => 'profile',
363 'widget-id' => '',
364 'border-color' => '#f0f0f1',
365 'theme' => 'light',
366 'chrome' => array(),
367 'tweet-limit' => 1,
368 'tweet-display' => 'dynamic',
369 );
370
371 $instance = wp_parse_args( (array) $instance, $defaults );
372
373 if ( 'widget-id' === $instance['type'] ) {
374 $instance['widget-id'] = '';
375 }
376
377 $instance['type'] = 'profile';
378
379 /**
380 * Set the tweet-display option to 'fixed' if height is empty and tweet-limit set
381 * to ensure backwards compatibility with pre-existing widgets.
382 */
383 if ( empty( $instance['height'] ) && isset( $instance['tweet-limit'] ) ) {
384 $instance['tweet-display'] = 'fixed';
385 }
386 ?>
387
388 <p class="jetpack-twitter-timeline-widget-id-container">
389 <label for="<?php echo esc_attr( $this->get_field_id( 'widget-id' ) ); ?>">
390 <?php esc_html_e( 'Twitter username:', 'jetpack' ); ?>
391 <?php
392 echo wp_kses(
393 $this->get_docs_link( '#twitter-username' ),
394 array(
395 'a' => array(
396 'href' => array(),
397 'rel' => array(),
398 'target' => array(),
399 'class' => array(),
400 ),
401 )
402 );
403 ?>
404 </label>
405 <input
406 class="widefat"
407 id="<?php echo esc_attr( $this->get_field_id( 'widget-id' ) ); ?>"
408 name="<?php echo esc_attr( $this->get_field_name( 'widget-id' ) ); ?>"
409 type="text"
410 value="<?php echo esc_attr( $instance['widget-id'] ); ?>"
411 />
412 </p>
413
414 <p>
415 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
416 <?php esc_html_e( 'Title:', 'jetpack' ); ?>
417 </label>
418 <input
419 class="widefat"
420 id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
421 name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
422 type="text"
423 value="<?php echo esc_attr( $instance['title'] ); ?>"
424 />
425 </p>
426
427 <p>
428 <label>
429 <strong><?php esc_html_e( 'Number of tweets shown:', 'jetpack' ); ?></strong>
430 </label>
431 <ul>
432 <li>
433 <label>
434 <input
435 id="<?php echo esc_attr( $this->get_field_id( 'tweet-display' ) ); ?>-dynamic"
436 name="<?php echo esc_attr( $this->get_field_name( 'tweet-display' ) ); ?>"
437 type="radio"
438 class="jetpack-twitter-timeline-widget-tweet-display-radio"
439 value="dynamic"
440 <?php checked( 'dynamic', $instance['tweet-display'] ); ?>
441 />
442 <?php esc_html_e( 'Dynamic', 'jetpack' ); ?>
443 </label>
444 </li>
445 <li>
446 <label>
447 <input
448 id="<?php echo esc_attr( $this->get_field_id( 'tweet-display' ) ); ?>-fixed"
449 name="<?php echo esc_attr( $this->get_field_name( 'tweet-display' ) ); ?>"
450 type="radio"
451 class="jetpack-twitter-timeline-widget-tweet-display-radio"
452 value="fixed"
453 <?php checked( 'fixed', $instance['tweet-display'] ); ?>
454 />
455 <?php esc_html_e( 'Fixed', 'jetpack' ); ?>
456 </label>
457 </li>
458 </ul>
459 </p>
460
461 <p class="jetpack-twitter-timeline-widget-height-container" <?php echo ( 'fixed' === $instance['tweet-display'] ) ? ' style="display:none;"' : ''; ?>>
462 <label for="<?php echo esc_attr( $this->get_field_id( 'height' ) ); ?>">
463 <?php esc_html_e( 'Height (in pixels; at least 200):', 'jetpack' ); ?>
464 </label>
465 <input
466 class="widefat"
467 id="<?php echo esc_attr( $this->get_field_id( 'height' ) ); ?>"
468 name="<?php echo esc_attr( $this->get_field_name( 'height' ) ); ?>"
469 type="number" min="200"
470 value="<?php echo esc_attr( $instance['height'] ); ?>"
471 />
472 </p>
473
474 <p class="jetpack-twitter-timeline-widget-tweet-limit-container" <?php echo ( 'dynamic' === $instance['tweet-display'] ) ? ' style="display:none;"' : ''; ?>>
475 <label for="<?php echo esc_attr( $this->get_field_id( 'tweet-limit' ) ); ?>">
476 <?php esc_html_e( 'Number of tweets in the timeline (1 to 20):', 'jetpack' ); ?>
477 </label>
478 <input
479 class="widefat"
480 id="<?php echo esc_attr( $this->get_field_id( 'tweet-limit' ) ); ?>"
481 name="<?php echo esc_attr( $this->get_field_name( 'tweet-limit' ) ); ?>"
482 type="number" min="1" max="20"
483 value="<?php echo esc_attr( $instance['tweet-limit'] ); ?>"
484 />
485 </p>
486
487 <p>
488 <label for="<?php echo esc_attr( $this->get_field_id( 'width' ) ); ?>">
489 <?php esc_html_e( 'Maximum width (in pixels; 220 to 1200):', 'jetpack' ); ?>
490 </label>
491 <input
492 class="widefat"
493 id="<?php echo esc_attr( $this->get_field_id( 'width' ) ); ?>"
494 name="<?php echo esc_attr( $this->get_field_name( 'width' ) ); ?>"
495 type="number" min="220" max="1200"
496 value="<?php echo esc_attr( $instance['width'] ); ?>"
497 />
498 </p>
499
500 <p>
501 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-noheader' ) ); ?>">
502 <strong><?php esc_html_e( 'Layout options:', 'jetpack' ); ?></strong>
503 </label>
504 </p>
505 <p>
506 <input
507 type="checkbox"
508 <?php checked( false, in_array( 'noheader', $instance['chrome'], true ) ); ?>
509 id="<?php echo esc_attr( $this->get_field_id( 'chrome-noheader' ) ); ?>"
510 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
511 value="noheader"
512 />
513 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-noheader' ) ); ?>">
514 <?php esc_html_e( 'Show header', 'jetpack' ); ?>
515 </label>
516 <br />
517 <input
518 type="checkbox"
519 <?php checked( false, in_array( 'nofooter', $instance['chrome'], true ) ); ?>
520 id="<?php echo esc_attr( $this->get_field_id( 'chrome-nofooter' ) ); ?>"
521 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
522 value="nofooter"
523 />
524 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-nofooter' ) ); ?>">
525 <?php esc_html_e( 'Show footer', 'jetpack' ); ?>
526 </label>
527 <br />
528 <input
529 type="checkbox"
530 <?php checked( false, in_array( 'noborders', $instance['chrome'], true ) ); ?>
531 id="<?php echo esc_attr( $this->get_field_id( 'chrome-noborders' ) ); ?>"
532 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
533 value="noborders"
534 />
535 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-noborders' ) ); ?>">
536 <?php esc_html_e( 'Show borders', 'jetpack' ); ?>
537 </label>
538 <br />
539 <input
540 type="checkbox"
541 <?php checked( false, in_array( 'noscrollbar', $instance['chrome'], true ) ); ?>
542 id="<?php echo esc_attr( $this->get_field_id( 'chrome-noscrollbar' ) ); ?>"
543 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
544 value="noscrollbar"
545 <?php disabled( 'fixed', $instance['tweet-display'] ); ?>
546 />
547 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-noscrollbar' ) ); ?>">
548 <?php esc_html_e( 'Show scrollbar', 'jetpack' ); ?>
549 </label>
550 <br />
551 <input
552 type="checkbox"
553 <?php checked( in_array( 'transparent', $instance['chrome'], true ) ); ?>
554 id="<?php echo esc_attr( $this->get_field_id( 'chrome-transparent' ) ); ?>"
555 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
556 value="transparent"
557 />
558 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-transparent' ) ); ?>">
559 <?php esc_html_e( 'Transparent background', 'jetpack' ); ?>
560 </label>
561 </p>
562
563 <p>
564 <label for="<?php echo esc_attr( $this->get_field_id( 'border-color' ) ); ?>">
565 <?php esc_html_e( 'Border color (in hex format):', 'jetpack' ); ?>
566 </label>
567 <input
568 class="widefat"
569 id="<?php echo esc_attr( $this->get_field_id( 'border-color' ) ); ?>"
570 name="<?php echo esc_attr( $this->get_field_name( 'border-color' ) ); ?>"
571 type="text"
572 value="<?php echo esc_attr( $instance['border-color'] ); ?>"
573 />
574 </p>
575
576 <p>
577 <label for="<?php echo esc_attr( $this->get_field_id( 'theme' ) ); ?>">
578 <?php esc_html_e( 'Color scheme:', 'jetpack' ); ?>
579 </label>
580 <select
581 name="<?php echo esc_attr( $this->get_field_name( 'theme' ) ); ?>"
582 id="<?php echo esc_attr( $this->get_field_id( 'theme' ) ); ?>"
583 class="widefat"
584 >
585 <option value="light"<?php selected( $instance['theme'], 'light' ); ?>>
586 <?php esc_html_e( 'Light', 'jetpack' ); ?>
587 </option>
588 <option value="dark"<?php selected( $instance['theme'], 'dark' ); ?>>
589 <?php esc_html_e( 'Dark', 'jetpack' ); ?>
590 </option>
591 </select>
592 </p>
593 <?php
594 }
595 }
596