PluginProbe ʕ •ᴥ•ʔ
Jetpack – WP Security, Backup, Speed, & Growth / 14.7.1
Jetpack – WP Security, Backup, Speed, & Growth v14.7.1
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 14.4.2 14.5.1 14.6.1 14.7.1 14.8.1 14.9.2 15.0.3 15.1.2 15.2.1 15.3.2 15.4.1 15.5.1 15.6.1 15.7.2 15.8.1 15.9.2 16.0.2 16.1.3 16.2-a.5 16.2-a.3 16.1.2 16.2-a.1 16.1.1 16.1 16.1-beta 16.1-beta.2 16.1-beta.3 16.1-a.5 16.1-a.3 16.0.1 16.1-a.1 16.0 16.0-beta 16.0-a.7 16.0-a.5 15.9.1 16.0-a.3 16.0-a.1 15.9 15.9-beta 15.9-a.7 15.9-a.5 15.9-a.3 15.9-a.1 15.8 15.8-beta 15.8-a.7 15.8-a.5 5.2.5 5.3.4 5.4.4 5.5.5 5.6.5 5.7.5 5.8.4 5.9.4 6.0.4 6.1 6.1.1 6.1.2 6.1.3 6.1.4 6.1.5 6.2 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.3 6.3.1 6.3.2 6.3.3 6.3.4 6.3.5 6.3.6 6.3.7 6.4 6.4.1 6.4.2 6.4.3 6.4.4 6.4.5 6.4.6 6.5 6.5.1 6.5.2 6.5.3 6.5.4 6.6 6.6.1 6.6.2 6.6.3 6.6.4 6.6.5 6.7 6.7.1 6.7.2 6.7.3 6.7.4 6.8 6.8.1 6.8.2 6.8.3 6.8.4 6.8.5 6.9 6.9.1 6.9.2 6.9.3 6.9.4 7.0 7.0.1 7.0.2 7.0.3 7.0.4 7.0.5 7.1 7.1.1 7.1.2 7.1.3 7.1.4 7.1.5 7.2 7.2.1 7.2.1.1 7.2.2 7.2.3 7.2.4 7.2.5 7.3 7.3.0.1 7.3.1 7.3.1.1 7.3.2 7.3.3 7.3.4 7.3.5 7.4 7.4.1 7.4.2 7.4.3 7.4.4 7.4.5 7.5 7.5.0.1 7.5.1 7.5.2 7.5.3 7.5.4 7.5.5 7.5.6 7.5.7 7.6 7.6.1 7.6.2 7.6.3 7.6.4 7.7 7.7.1 7.7.2 7.7.3 7.7.4 7.7.5 7.7.6 7.8 7.8.1 7.8.2 7.8.3 7.8.4 7.9 7.9.1 7.9.2 7.9.3 7.9.4 8.0 8.0.1 8.0.2 8.0.3 8.1 8.1.1 8.1.2 8.1.3 8.1.4 8.2 8.2.0.1 8.2.1 8.2.2 8.2.3 8.2.4 8.2.5 8.2.6 8.3 8.3.1 8.3.2 8.3.3 8.4 8.4.1 8.4.2 8.4.3 8.4.4 8.4.5 8.5 8.5.1 8.5.2 8.5.3 8.6 8.6.1 8.6.2 8.6.3 8.6.4 8.7 8.7.0.1 8.7.1 8.7.2 8.7.3 8.7.4 8.8 8.8.1 8.8.2 8.8.3 8.8.4 8.8.5 8.9 8.9.1 8.9.2 8.9.3 8.9.4 9.0 9.0.1 9.0.2 9.0.3 9.0.4 9.0.5 9.1 9.1.1 9.1.2 9.1.3 9.2 9.2.1 9.2.2 9.2.3 9.2.4 9.3 9.3.1 9.3.2 9.3.3 9.3.4 9.3.5 9.4 9.4.1 9.4.2 9.4.3 9.4.4 9.5 9.5.1 9.5.2 9.5.3 9.5.4 9.5.5 9.6 9.6.1 9.6.2 9.6.3 9.6.4 9.7 9.7.1 9.7.2 15.7-beta.2 9.7.3 15.7.1 9.8 15.8-a.1 9.8.1 15.8-a.3 9.8.2 2.0.9 9.8.3 2.1.7 9.9 2.2.10 9.9.1 2.3.10 9.9.2 2.4.7 9.9.3 2.5.5 2.6.6 2.7.5 2.8.5 2.9.6 3.0.6 3.1.5 3.2.5 3.3.6 3.4.6 3.5.6 3.6.4 3.7.5 3.8.5 3.9.10 4.0.7 4.1.4 4.2.5 4.3.5 4.4.5 4.5.3 4.6.3 4.7.4 4.8.5 4.9.3 5.0.3 5.1.4 trunk 10.0 10.0.1 10.0.2 10.1 10.1.1 10.1.2 10.2 10.2.1 10.2.2 10.2.3 10.3 10.3.1 10.3.2 10.4 10.4.1 10.4.2 10.5 10.5.1 10.5.2 10.5.3 10.6 10.6.1 10.6.2 10.7 10.7.1 10.7.2 10.8 10.8.1 10.8.2 10.9 10.9.1 10.9.2 10.9.3 11.0 11.0.1 11.0.2 11.1 11.1.1 11.1.2 11.1.3 11.1.4 11.2 11.2.1 11.2.2 11.3 11.3.1 11.3.2 11.3.3 11.3.4 11.4 11.4.1 11.4.2 11.5 11.5.1 11.5.2 11.5.3 11.6 11.6.1 11.6.2 11.7 11.7.1 11.7.2 11.7.3 11.8 11.8.3 11.8.4 11.8.5 11.8.6 11.9 11.9.1 11.9.2 11.9.3 12.0 12.0.1 12.0.2 12.1 12.1.1 12.1.2 12.2 12.2.1 12.2.2 12.3 12.3.1 12.4 12.4.1 12.5 12.5.1 12.6 12.6.1 12.6.2 12.6.3 12.7 12.7.1 12.7.2 12.8 12.8.1 12.8.2 12.9 12.9.1 12.9.2 12.9.3 12.9.4 13.0 13.0.1 13.1 13.1.1 13.1.2 13.1.3 13.1.4 13.2 13.2.1 13.2.2 13.2.3 13.3 13.3.1 13.3.2 13.4 13.4.1 13.4.2 13.4.3 13.4.4 13.5 13.5.1 13.6 13.6.1 13.7 13.7.1 13.8 13.8.1 13.8.2 13.9 13.9.1 14.0 14.1 14.2 14.2.1 14.3 14.4 14.4.1 14.5 14.6 14.7 14.8 14.9 14.9.1 15.0 15.0.1 15.0.2 15.1 15.1.1 15.2 15.3 15.3.1 15.4 15.5 15.6 15.7 15.7-a.1 15.7-a.3 15.7-a.5 15.7-a.7 15.7-beta
jetpack / modules / widgets / twitter-timeline.php
jetpack / modules / widgets Last commit date
authors 1 year ago contact-info 5 years ago eu-cookie-law 1 year ago facebook-likebox 11 years ago flickr 2 years ago gallery 1 year ago goodreads 1 year ago google-translate 1 year ago image-widget 1 year ago instagram 1 year ago internet-defense-league 2 years ago milestone 1 year ago my-community 8 years ago simple-payments 1 year ago social-icons 1 year ago social-media-icons 1 year ago top-posts 1 year ago wordpress-post-widget 2 years ago authors.php 1 year ago blog-stats.php 1 year ago class-jetpack-eu-cookie-law-widget.php 1 year ago class-jetpack-instagram-widget.php 1 year ago contact-info.php 1 year ago customizer-controls.css 1 year ago customizer-utils.js 1 year ago facebook-likebox.php 1 year ago flickr.php 1 year ago gallery.php 1 year ago goodreads.php 1 year ago google-translate.php 1 year ago gravatar-profile.css 1 year ago gravatar-profile.php 1 year ago image-widget.php 1 year ago internet-defense-league.php 1 year ago mailchimp.php 1 year ago milestone.php 5 years ago my-community.php 1 year ago rsslinks-widget.php 3 years ago simple-payments.php 1 year ago social-icons.php 1 year ago social-media-icons.php 1 year ago top-posts.php 1 year ago twitter-timeline-admin.js 1 year ago twitter-timeline.php 1 year ago upcoming-events.php 1 year ago wordpress-post-widget.php 1 year ago
twitter-timeline.php
601 lines
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_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 $explicit_widget_id = isset( $instance['type'] ) && 'widget-id' === $instance['type'];
109 $implicit_widget_id = empty( $instance['type'] ) && ! empty( $instance['widget-id'] ) && is_numeric( $instance['widget-id'] );
110 if ( $explicit_widget_id || $implicit_widget_id ) {
111 if ( current_user_can( 'edit_theme_options' ) ) {
112 $output .= $args['before_widget']
113 . $args['before_title'] . esc_html__( 'Twitter Timeline', 'jetpack' ) . $args['after_title']
114 . '<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>'
115 . '<p>' . esc_html__( '(Only administrators will see this message.)', 'jetpack' ) . '</p>'
116 . $args['after_widget'];
117 }
118
119 echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
120 return;
121 }
122
123 $this->enqueue_scripts();
124
125 $instance['lang'] = substr( strtoupper( get_locale() ), 0, 2 );
126
127 $output .= $args['before_widget'];
128
129 $title = isset( $instance['title'] ) ? $instance['title'] : '';
130
131 /** This filter is documented in core/src/wp-includes/default-widgets.php */
132 $title = apply_filters( 'widget_title', $title );
133 if ( ! empty( $title ) ) {
134 $output .= $args['before_title'] . $title . $args['after_title'];
135 }
136
137 $possible_data_attribs = array(
138 'width',
139 'height',
140 'theme',
141 'border-color',
142 'tweet-limit',
143 'lang',
144 );
145 $data_attrs = '';
146 foreach ( $possible_data_attribs as $att ) {
147 if ( ! empty( $instance[ $att ] ) && ! is_array( $instance[ $att ] ) ) {
148 $data_attrs .= ' data-' . esc_attr( $att ) . '="' . esc_attr( $instance[ $att ] ) . '"';
149 }
150 }
151
152 /** This filter is documented in modules/shortcodes/tweet.php */
153 $partner = apply_filters( 'jetpack_twitter_partner_id', 'jetpack' );
154 if ( ! empty( $partner ) ) {
155 $data_attrs .= ' data-partner="' . esc_attr( $partner ) . '"';
156 }
157
158 /**
159 * Allow the activation of Do Not Track for the Twitter Timeline Widget.
160 *
161 * @see https://developer.twitter.com/en/docs/twitter-for-websites/timelines/guides/parameter-reference.html
162 *
163 * @module widgets
164 *
165 * @since 6.9.0
166 *
167 * @param bool false Should the Twitter Timeline use the DNT attribute? Default to false.
168 */
169 $dnt = apply_filters( 'jetpack_twitter_timeline_default_dnt', false );
170 if ( true === $dnt ) {
171 $data_attrs .= ' data-dnt="true"';
172 }
173
174 if ( ! empty( $instance['chrome'] ) && is_array( $instance['chrome'] ) ) {
175 $data_attrs .= ' data-chrome="' . esc_attr( implode( ' ', $instance['chrome'] ) ) . '"';
176 }
177
178 $timeline_placeholder = __( 'My Tweets', 'jetpack' );
179
180 /**
181 * Filter the Timeline placeholder text.
182 *
183 * @module widgets
184 *
185 * @since 3.4.0
186 *
187 * @param string $timeline_placeholder Timeline placeholder text.
188 */
189 $timeline_placeholder = apply_filters( 'jetpack_twitter_timeline_placeholder', $timeline_placeholder );
190
191 $type = ( isset( $instance['type'] ) ? $instance['type'] : '' );
192 $widget_id = ( isset( $instance['widget-id'] ) ? $instance['widget-id'] : '' );
193
194 if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
195 $width = ! empty( $instance['width'] ) ? $instance['width'] : 600;
196 $height = ! empty( $instance['height'] ) ? $instance['height'] : 480;
197 $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
198 $output .= esc_html( $timeline_placeholder ) . '</amp-twitter>';
199
200 echo $output . $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
201 return;
202 }
203
204 // Start tag output
205 // This tag is transformed into the widget markup by Twitter's
206 // widgets.js code.
207 $output .= '<a class="twitter-timeline"' . $data_attrs; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
208 switch ( $type ) {
209 case 'profile':
210 $output .= ' href="https://twitter.com/' . esc_attr( $widget_id ) . '"';
211 break;
212 case 'widget-id':
213 default:
214 $output .= ' data-widget-id="' . esc_attr( $widget_id ) . '"';
215 break;
216 }
217 $output .= ' href="https://twitter.com/' . esc_attr( $widget_id ) . '"';
218
219 // End tag output.
220 $output .= '>';
221
222 $output .= esc_html( $timeline_placeholder ) . '</a>';
223
224 // End tag output.
225
226 echo $output . $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
227
228 /** This action is documented in modules/widgets/gravatar-profile.php */
229 do_action( 'jetpack_stats_extra', 'widget_view', 'twitter_timeline' );
230 }
231
232 /**
233 * Sanitize widget form values as they are saved.
234 *
235 * @see WP_Widget::update()
236 *
237 * @param array $new_instance Values just sent to be saved.
238 * @param array $old_instance Previously saved values from database.
239 *
240 * @return array Updated safe values to be saved.
241 */
242 public function update( $new_instance, $old_instance ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
243 $instance = array();
244
245 $instance['title'] = sanitize_text_field( $new_instance['title'] );
246
247 $width = (int) $new_instance['width'];
248 if ( $width ) {
249 // From publish.twitter.com: 220 <= width <= 1200.
250 $instance['width'] = min( max( $width, 220 ), 1200 );
251 } else {
252 // Set default width value to minimum.
253 $instance['width'] = 220;
254 }
255
256 $tweet_display = sanitize_text_field( $new_instance['tweet-display'] );
257 $instance['tweet-display'] = $tweet_display;
258 /**
259 * A timeline with a specified limit is expanded to the height of those Tweets.
260 * The specified height value no longer applies, so reject the height value
261 * when a valid limit is set: a widget attempting to save both limit 5 and
262 * height 400 would be saved with just limit 5.
263 * So if the tweet display option is set to 'dynamic' the limit will be unset and we'll
264 * take into account the height value.
265 * If the tweet display option is set to 'fixed' the height will be unset and we'll
266 * take into account the limit value.
267 */
268 $instance['height'] = '';
269 $instance['tweet-limit'] = null;
270
271 switch ( $tweet_display ) {
272 case 'dynamic':
273 $height = (int) $new_instance['height'];
274 // From publish.twitter.com: height >= 200.
275 $instance['height'] = max( $height, 200 );
276 break;
277 case 'fixed':
278 $tweet_limit = (int) $new_instance['tweet-limit'];
279 // From publish.twitter.com: 1 >= tweet-limit >= 20.
280 $instance['tweet-limit'] = min( max( $tweet_limit, 1 ), 20 );
281 break;
282 }
283
284 // If they entered something that might be a full URL, try to parse it out.
285 if ( is_string( $new_instance['widget-id'] ) ) {
286 if ( preg_match(
287 '#https?://twitter\.com/settings/widgets/(\d+)#s',
288 $new_instance['widget-id'],
289 $matches
290 ) ) {
291 $new_instance['widget-id'] = $matches[1];
292 }
293 }
294
295 $instance['widget-id'] = sanitize_text_field( $new_instance['widget-id'] );
296
297 $new_border_color = sanitize_hex_color( $new_instance['border-color'] );
298 if ( ! empty( $new_border_color ) ) {
299 $instance['border-color'] = $new_border_color;
300 }
301
302 $instance['type'] = 'profile';
303
304 $instance['theme'] = 'light';
305 if ( in_array( $new_instance['theme'], array( 'light', 'dark' ), true ) ) {
306 $instance['theme'] = $new_instance['theme'];
307 }
308
309 $instance['chrome'] = array();
310 $chrome_settings = array(
311 'noheader',
312 'nofooter',
313 'noborders',
314 'transparent',
315 'noscrollbar',
316 );
317
318 foreach ( $chrome_settings as $chrome ) {
319 switch ( $chrome ) {
320 case 'noheader':
321 case 'nofooter':
322 case 'noborders':
323 case 'noscrollbar':
324 if ( ! isset( $new_instance['chrome'] ) || ! in_array( $chrome, $new_instance['chrome'], true ) ) {
325 $instance['chrome'][] = $chrome;
326 }
327 break;
328 default:
329 if ( isset( $new_instance['chrome'] ) && in_array( $chrome, $new_instance['chrome'], true ) ) {
330 $instance['chrome'][] = $chrome;
331 }
332 break;
333 }
334 }
335
336 return $instance;
337 }
338
339 /**
340 * Returns a link to the documentation for a feature of this widget on
341 * Jetpack or WordPress.com.
342 *
343 * @param string $hash anchor to potentially append to URL to target specific paragraph in page.
344 */
345 public function get_docs_link( $hash = '' ) {
346 if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
347 $base_url = 'https://wordpress.com/support/widgets/twitter-timeline-widget/';
348 } else {
349 $base_url = esc_url( Redirect::get_url( 'jetpack-support-extra-sidebar-widgets-twitter-timeline-widget' ) );
350 }
351 return '<a class="widget-access-link" href="' . $base_url . $hash . '" target="_blank"> Need help?</a>';
352 }
353
354 /**
355 * Back end widget form.
356 *
357 * @see WP_Widget::form()
358 *
359 * @param array $instance Previously saved values from database.
360 * @return string|void
361 */
362 public function form( $instance ) {
363 $defaults = array(
364 'title' => esc_html__( 'Follow me on Twitter', 'jetpack' ),
365 'width' => '220',
366 'height' => '200',
367 'type' => 'profile',
368 'widget-id' => '',
369 'border-color' => '#f0f0f1',
370 'theme' => 'light',
371 'chrome' => array(),
372 'tweet-limit' => 1,
373 'tweet-display' => 'dynamic',
374 );
375
376 $instance = wp_parse_args( (array) $instance, $defaults );
377
378 if ( 'widget-id' === $instance['type'] ) {
379 $instance['widget-id'] = '';
380 }
381
382 $instance['type'] = 'profile';
383
384 /**
385 * Set the tweet-display option to 'fixed' if height is empty and tweet-limit set
386 * to ensure backwards compatibility with pre-existing widgets.
387 */
388 if ( empty( $instance['height'] ) && isset( $instance['tweet-limit'] ) ) {
389 $instance['tweet-display'] = 'fixed';
390 }
391 ?>
392
393 <p class="jetpack-twitter-timeline-widget-id-container">
394 <label for="<?php echo esc_attr( $this->get_field_id( 'widget-id' ) ); ?>">
395 <?php esc_html_e( 'Twitter username:', 'jetpack' ); ?>
396 <?php
397 echo wp_kses(
398 $this->get_docs_link( '#twitter-username' ),
399 array(
400 'a' => array(
401 'href' => array(),
402 'rel' => array(),
403 'target' => array(),
404 'class' => array(),
405 ),
406 )
407 );
408 ?>
409 </label>
410 <input
411 class="widefat"
412 id="<?php echo esc_attr( $this->get_field_id( 'widget-id' ) ); ?>"
413 name="<?php echo esc_attr( $this->get_field_name( 'widget-id' ) ); ?>"
414 type="text"
415 value="<?php echo esc_attr( $instance['widget-id'] ); ?>"
416 />
417 </p>
418
419 <p>
420 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
421 <?php esc_html_e( 'Title:', 'jetpack' ); ?>
422 </label>
423 <input
424 class="widefat"
425 id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
426 name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
427 type="text"
428 value="<?php echo esc_attr( $instance['title'] ); ?>"
429 />
430 </p>
431
432 <p>
433 <label>
434 <strong><?php esc_html_e( 'Number of tweets shown:', 'jetpack' ); ?></strong>
435 </label>
436 <ul>
437 <li>
438 <label>
439 <input
440 id="<?php echo esc_attr( $this->get_field_id( 'tweet-display' ) ); ?>-dynamic"
441 name="<?php echo esc_attr( $this->get_field_name( 'tweet-display' ) ); ?>"
442 type="radio"
443 class="jetpack-twitter-timeline-widget-tweet-display-radio"
444 value="dynamic"
445 <?php checked( 'dynamic', $instance['tweet-display'] ); ?>
446 />
447 <?php esc_html_e( 'Dynamic', 'jetpack' ); ?>
448 </label>
449 </li>
450 <li>
451 <label>
452 <input
453 id="<?php echo esc_attr( $this->get_field_id( 'tweet-display' ) ); ?>-fixed"
454 name="<?php echo esc_attr( $this->get_field_name( 'tweet-display' ) ); ?>"
455 type="radio"
456 class="jetpack-twitter-timeline-widget-tweet-display-radio"
457 value="fixed"
458 <?php checked( 'fixed', $instance['tweet-display'] ); ?>
459 />
460 <?php esc_html_e( 'Fixed', 'jetpack' ); ?>
461 </label>
462 </li>
463 </ul>
464 </p>
465
466 <p class="jetpack-twitter-timeline-widget-height-container" <?php echo ( 'fixed' === $instance['tweet-display'] ) ? ' style="display:none;"' : ''; ?>>
467 <label for="<?php echo esc_attr( $this->get_field_id( 'height' ) ); ?>">
468 <?php esc_html_e( 'Height (in pixels; at least 200):', 'jetpack' ); ?>
469 </label>
470 <input
471 class="widefat"
472 id="<?php echo esc_attr( $this->get_field_id( 'height' ) ); ?>"
473 name="<?php echo esc_attr( $this->get_field_name( 'height' ) ); ?>"
474 type="number" min="200"
475 value="<?php echo esc_attr( $instance['height'] ); ?>"
476 />
477 </p>
478
479 <p class="jetpack-twitter-timeline-widget-tweet-limit-container" <?php echo ( 'dynamic' === $instance['tweet-display'] ) ? ' style="display:none;"' : ''; ?>>
480 <label for="<?php echo esc_attr( $this->get_field_id( 'tweet-limit' ) ); ?>">
481 <?php esc_html_e( 'Number of tweets in the timeline (1 to 20):', 'jetpack' ); ?>
482 </label>
483 <input
484 class="widefat"
485 id="<?php echo esc_attr( $this->get_field_id( 'tweet-limit' ) ); ?>"
486 name="<?php echo esc_attr( $this->get_field_name( 'tweet-limit' ) ); ?>"
487 type="number" min="1" max="20"
488 value="<?php echo esc_attr( $instance['tweet-limit'] ); ?>"
489 />
490 </p>
491
492 <p>
493 <label for="<?php echo esc_attr( $this->get_field_id( 'width' ) ); ?>">
494 <?php esc_html_e( 'Maximum width (in pixels; 220 to 1200):', 'jetpack' ); ?>
495 </label>
496 <input
497 class="widefat"
498 id="<?php echo esc_attr( $this->get_field_id( 'width' ) ); ?>"
499 name="<?php echo esc_attr( $this->get_field_name( 'width' ) ); ?>"
500 type="number" min="220" max="1200"
501 value="<?php echo esc_attr( $instance['width'] ); ?>"
502 />
503 </p>
504
505 <p>
506 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-noheader' ) ); ?>">
507 <strong><?php esc_html_e( 'Layout options:', 'jetpack' ); ?></strong>
508 </label>
509 </p>
510 <p>
511 <input
512 type="checkbox"
513 <?php checked( false, in_array( 'noheader', $instance['chrome'], true ) ); ?>
514 id="<?php echo esc_attr( $this->get_field_id( 'chrome-noheader' ) ); ?>"
515 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
516 value="noheader"
517 />
518 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-noheader' ) ); ?>">
519 <?php esc_html_e( 'Show header', 'jetpack' ); ?>
520 </label>
521 <br />
522 <input
523 type="checkbox"
524 <?php checked( false, in_array( 'nofooter', $instance['chrome'], true ) ); ?>
525 id="<?php echo esc_attr( $this->get_field_id( 'chrome-nofooter' ) ); ?>"
526 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
527 value="nofooter"
528 />
529 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-nofooter' ) ); ?>">
530 <?php esc_html_e( 'Show footer', 'jetpack' ); ?>
531 </label>
532 <br />
533 <input
534 type="checkbox"
535 <?php checked( false, in_array( 'noborders', $instance['chrome'], true ) ); ?>
536 id="<?php echo esc_attr( $this->get_field_id( 'chrome-noborders' ) ); ?>"
537 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
538 value="noborders"
539 />
540 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-noborders' ) ); ?>">
541 <?php esc_html_e( 'Show borders', 'jetpack' ); ?>
542 </label>
543 <br />
544 <input
545 type="checkbox"
546 <?php checked( false, in_array( 'noscrollbar', $instance['chrome'], true ) ); ?>
547 id="<?php echo esc_attr( $this->get_field_id( 'chrome-noscrollbar' ) ); ?>"
548 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
549 value="noscrollbar"
550 <?php disabled( 'fixed', $instance['tweet-display'] ); ?>
551 />
552 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-noscrollbar' ) ); ?>">
553 <?php esc_html_e( 'Show scrollbar', 'jetpack' ); ?>
554 </label>
555 <br />
556 <input
557 type="checkbox"
558 <?php checked( in_array( 'transparent', $instance['chrome'], true ) ); ?>
559 id="<?php echo esc_attr( $this->get_field_id( 'chrome-transparent' ) ); ?>"
560 name="<?php echo esc_attr( $this->get_field_name( 'chrome' ) ); ?>[]"
561 value="transparent"
562 />
563 <label for="<?php echo esc_attr( $this->get_field_id( 'chrome-transparent' ) ); ?>">
564 <?php esc_html_e( 'Transparent background', 'jetpack' ); ?>
565 </label>
566 </p>
567
568 <p>
569 <label for="<?php echo esc_attr( $this->get_field_id( 'border-color' ) ); ?>">
570 <?php esc_html_e( 'Border color (in hex format):', 'jetpack' ); ?>
571 </label>
572 <input
573 class="widefat"
574 id="<?php echo esc_attr( $this->get_field_id( 'border-color' ) ); ?>"
575 name="<?php echo esc_attr( $this->get_field_name( 'border-color' ) ); ?>"
576 type="text"
577 value="<?php echo esc_attr( $instance['border-color'] ); ?>"
578 />
579 </p>
580
581 <p>
582 <label for="<?php echo esc_attr( $this->get_field_id( 'theme' ) ); ?>">
583 <?php esc_html_e( 'Color scheme:', 'jetpack' ); ?>
584 </label>
585 <select
586 name="<?php echo esc_attr( $this->get_field_name( 'theme' ) ); ?>"
587 id="<?php echo esc_attr( $this->get_field_id( 'theme' ) ); ?>"
588 class="widefat"
589 >
590 <option value="light"<?php selected( $instance['theme'], 'light' ); ?>>
591 <?php esc_html_e( 'Light', 'jetpack' ); ?>
592 </option>
593 <option value="dark"<?php selected( $instance['theme'], 'dark' ); ?>>
594 <?php esc_html_e( 'Dark', 'jetpack' ); ?>
595 </option>
596 </select>
597 </p>
598 <?php
599 }
600 }
601