PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 10.8
Jetpack – WP Security, Backup, Speed, & Growth v10.8
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 / publicize / ui.php

ui.php in Jetpack – WP Security, Backup, Speed, & Growth 10.8, at modules/publicize/ui.php

696 lines 21.1 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 * Publicize_UI class.
4 *
5 * @package automattic/jetpack
6 */
7
8 /**
9 * Only user facing pieces of Publicize are found here.
10 */
11 class Publicize_UI {
12 /**
13 * Contains an instance of class 'Publicize' which loads Keyring, sets up services, etc.
14 *
15 * @var Publicize Instance of Publicize
16 */
17 public $publicize;
18
19 /**
20 * URL to Sharing settings page in wordpress.com
21 *
22 * @var string
23 */
24 protected $publicize_settings_url = '';
25
26 /**
27 * Hooks into WordPress to display the various pieces of UI and load our assets
28 */
29 public function __construct() {
30 global $publicize;
31
32 $publicize = new Publicize();
33 $this->publicize = $publicize;
34
35 add_action( 'init', array( $this, 'init' ) );
36 }
37
38 /**
39 * Initialize UI-related functionality.
40 */
41 public function init() {
42 $this->publicize_settings_url = publicize_calypso_url();
43
44 // Show only to users with the capability required to manage their Publicize connections.
45 if ( ! $this->publicize->current_user_can_access_publicize_data() ) {
46 return;
47 }
48
49 // Assets (css, js).
50 if ( $this->in_jetpack ) {
51 add_action( 'load-settings_page_sharing', array( $this, 'load_assets' ) );
52 }
53 add_action( 'admin_head-post.php', array( $this, 'post_page_metabox_assets' ) );
54 add_action( 'admin_head-post-new.php', array( $this, 'post_page_metabox_assets' ) );
55
56 // Management of publicize (sharing screen, ajax/lightbox popup, and metabox on post screen).
57 add_action( 'pre_admin_screen_sharing', array( $this, 'admin_page' ) );
58 add_action( 'post_submitbox_misc_actions', array( $this, 'post_page_metabox' ) );
59 }
60
61 /**
62 * If the ShareDaddy plugin is not active we need to add the sharing settings page to the menu still
63 */
64 public function sharing_menu() {
65 add_submenu_page(
66 'options-general.php',
67 esc_html__( 'Sharing Settings', 'jetpack' ),
68 esc_html__( 'Sharing', 'jetpack' ),
69 'publish_posts',
70 'sharing',
71 array( $this, 'wrapper_admin_page' )
72 );
73 }
74
75 /**
76 * Add admin page with wrapper.
77 */
78 public function wrapper_admin_page() {
79 Jetpack_Admin_Page::wrap_ui( array( $this, 'management_page' ) );
80 }
81
82 /**
83 * Management page to load if Sharedaddy is not active so the 'pre_admin_screen_sharing' action exists.
84 */
85 public function management_page() {
86 ?>
87 <div class="wrap">
88 <div class="icon32" id="icon-options-general"><br /></div>
89 <h1><?php esc_html_e( 'Sharing Settings', 'jetpack' ); ?></h1>
90
91 <?php
92 /** This action is documented in modules/sharedaddy/sharing.php */
93 do_action( 'pre_admin_screen_sharing' );
94 ?>
95 </div>
96 <?php
97 }
98
99 /**
100 * Styling for the sharing screen and popups
101 * JS for the options and switching
102 */
103 public function load_assets() {
104 Jetpack_Admin_Page::load_wrapper_styles();
105 }
106
107 /**
108 * Lists the current user's publicized accounts for the blog
109 * looks exactly like Publicize v1 for now, UI and functionality updates will come after the move to keyring
110 */
111 public function admin_page() {
112 ?>
113 <h2 id="publicize"><?php esc_html_e( 'Publicize', 'jetpack' ); ?></h2>
114 <p><?php esc_html_e( 'Connect social media services to automatically share new posts.', 'jetpack' ); ?></p>
115 <h4>
116 <?php
117 printf(
118 wp_kses(
119 /* translators: %s is the link to the Publicize page in Calypso */
120 __( "We've made some updates to Publicize. Please visit the <a href='%s' class='jptracks' data-jptracks-name='legacy_publicize_settings'>WordPress.com sharing page</a> to manage your publicize connections or use the button below.", 'jetpack' ),
121 array(
122 'a' => array(
123 'href' => array(),
124 'class' => array(),
125 'data-jptracks-name' => array(),
126 ),
127 )
128 ),
129 esc_url( publicize_calypso_url() )
130 );
131 ?>
132 </h4>
133
134 <a href="<?php echo esc_url( publicize_calypso_url() ); ?>" class="button button-primary jptracks" data-jptracks-name='legacy_publicize_settings'><?php esc_html_e( 'Publicize Settings', 'jetpack' ); ?></a>
135 <?php
136 }
137
138 /**
139 * CSS for styling the publicize message box and counter that displays on the post page.
140 * There is also some JavaScript for length counting and some basic display effects.
141 */
142 public function post_page_metabox_assets() {
143 $default_prefix = $this->publicize->default_prefix;
144 $default_prefix = preg_replace( '/%([0-9])\$s/', "' + %\\1\$s + '", esc_js( $default_prefix ) );
145
146 $default_message = $this->publicize->default_message;
147 $default_message = preg_replace( '/%([0-9])\$s/', "' + %\\1\$s + '", esc_js( $default_message ) );
148
149 $default_suffix = $this->publicize->default_suffix;
150 $default_suffix = preg_replace( '/%([0-9])\$s/', "' + %\\1\$s + '", esc_js( $default_suffix ) );
151
152 $max_length = defined( 'JETPACK_PUBLICIZE_TWITTER_LENGTH' ) ? JETPACK_PUBLICIZE_TWITTER_LENGTH : 280;
153 $max_length = $max_length - 24; // t.co link, space.
154
155 ?>
156
157 <script type="text/javascript">
158 jQuery( function($) {
159 var wpasTitleCounter = $( '#wpas-title-counter' ),
160 wpasTwitterCheckbox = $( '.wpas-submit-twitter' ).length,
161 postTitle = $( '#title' ),
162 wpasTitle = $( '#wpas-title' ).keyup( function() {
163 var postTitleVal,
164 length = wpasTitle.val().length;
165
166 if ( ! length ) {
167 length = wpasTitle.attr( 'placeholder' ).length;
168 }
169
170 wpasTitleCounter.text( length ).trigger( 'change' );
171 } ),
172 authClick = false;
173
174 wpasTitleCounter.on( 'change', function( e ) {
175 if ( wpasTwitterCheckbox && parseInt( $( e.currentTarget ).text(), 10 ) > <?php echo (int) $max_length; ?> ) {
176 wpasTitleCounter.addClass( 'wpas-twitter-length-limit' );
177 } else {
178 wpasTitleCounter.removeClass( 'wpas-twitter-length-limit' );
179 }
180 } );
181
182 // Keep the postTitle and the placeholder in sync
183 postTitle.on( 'keyup', function( e ) {
184 var url = $( '#sample-permalink' ).text();
185 <?php // phpcs:ignore ?>
186 var defaultMessage = $.trim( '<?php printf( $default_prefix, 'url' ); printf( $default_message, 'e.currentTarget.value', 'url' ); printf( $default_suffix, 'url' ); ?>' )
187 .replace( /<[^>]+>/g,'');
188
189 wpasTitle.attr( 'placeholder', defaultMessage );
190 wpasTitle.trigger( 'keyup' );
191 } );
192
193 // set the initial placeholder
194 postTitle.trigger( 'keyup' );
195
196 // If a custom message has been provided, open the UI so the author remembers
197 if ( wpasTitle.val() && ! wpasTitle.prop( 'disabled' ) && wpasTitle.attr( 'placeholder' ) !== wpasTitle.val() ) {
198 $( '#publicize-form' ).show();
199 $( '#publicize-defaults' ).hide();
200 $( '#publicize-form-edit' ).hide();
201 }
202
203 $('#publicize-disconnected-form-show').click( function() {
204 $('#publicize-form').slideDown( 'fast' );
205 $(this).hide();
206 } );
207
208 $('#publicize-disconnected-form-hide').click( function() {
209 $('#publicize-form').slideUp( 'fast' );
210 $('#publicize-disconnected-form-show').show();
211 } );
212
213 $('#publicize-form-edit').click( function() {
214 $('#publicize-form').slideDown( 'fast', function() {
215 var selBeg = 0, selEnd = 0;
216 wpasTitle.focus();
217
218 if ( ! wpasTitle.text() ) {
219 wpasTitle.text( wpasTitle.attr( 'placeholder' ) );
220
221 selBeg = wpasTitle.text().indexOf( postTitle.val() );
222 if ( selBeg < 0 ) {
223 selBeg = 0;
224 } else {
225 selEnd = selBeg + postTitle.val().length;
226 }
227
228 var domObj = wpasTitle.get(0);
229 if ( domObj.setSelectionRange ) {
230 domObj.setSelectionRange( selBeg, selEnd );
231 } else if ( domObj.createTextRange ) {
232 var r = domObj.createTextRange();
233 r.moveStart( 'character', selBeg );
234 r.moveEnd( 'character', selEnd );
235 r.select();
236 }
237 }
238 } );
239
240 $('#publicize-defaults').hide();
241 $(this).hide();
242 return false;
243 } );
244
245 $('#publicize-form-hide').click( function() {
246 var newList = $.map( $('#publicize-form').slideUp( 'fast' ).find( ':checked' ), function( el ) {
247 return $.trim( $(el).parent( 'label' ).text() );
248 } );
249 $('#publicize-defaults').html( '<strong>' + newList.join( '</strong>, <strong>' ) + '</strong>' ).show();
250 $('#publicize-form-edit').show();
251 return false;
252 } );
253
254 $('.authorize-link').click( function() {
255 if ( authClick ) {
256 return false;
257 }
258 authClick = true;
259 $(this).after( '<img src="images/loading.gif" class="alignleft" style="margin: 0 .5em" />' );
260 $.ajaxSetup( { async: false } );
261
262 if ( window.wp && window.wp.autosave ) {
263 window.wp.autosave.server.triggerSave();
264 } else {
265 autosave();
266 }
267
268 return true;
269 } );
270
271 $( '.pub-service' ).click( function() {
272 var service = $(this).data( 'service' ),
273 fakebox = '<input id="wpas-submit-' + service + '" type="hidden" value="1" name="wpas[submit][' + service + ']" />';
274 $( '#add-publicize-check' ).append( fakebox );
275 } );
276
277 publicizeConnTestStart = function() {
278 $( '#pub-connection-tests' )
279 .removeClass( 'below-h2' )
280 .removeClass( 'error' )
281 .removeClass( 'publicize-token-refresh-message' )
282 .addClass( 'test-in-progress' )
283 .html( '' );
284 $.post( ajaxurl, { action: 'test_publicize_conns' }, publicizeConnTestComplete );
285 }
286
287 publicizeConnRefreshClick = function( event ) {
288 event.preventDefault();
289 var popupURL = event.currentTarget.href;
290 var popupTitle = event.currentTarget.title;
291 // open a popup window
292 // when it is closed, kick off the tests again
293 var popupWin = window.open( popupURL, popupTitle, '' );
294 var popupWinTimer= window.setInterval( function() {
295 if ( popupWin.closed !== false ) {
296 window.clearInterval( popupWinTimer );
297 publicizeConnTestStart();
298 }
299 }, 500 );
300 }
301
302 publicizeConnTestComplete = function( response ) {
303 var testsSelector = $( '#pub-connection-tests' );
304 testsSelector
305 .removeClass( 'test-in-progress' )
306 .removeClass( 'below-h2' )
307 .removeClass( 'error' )
308 .removeClass( 'publicize-token-refresh-message' )
309 .html( '' );
310
311 // If any of the tests failed, show some stuff
312 var somethingShownAlready = false;
313 var facebookNotice = false;
314 $.each( response.data, function( index, testResult ) {
315 // find the li for this connection
316 if ( ! testResult.connectionTestPassed && testResult.userCanRefresh ) {
317 if ( ! somethingShownAlready ) {
318 testsSelector
319 .addClass( 'below-h2' )
320 .addClass( 'error' )
321 .addClass( 'publicize-token-refresh-message' )
322 .append( "<p><?php echo esc_html( __( 'Before you hit Publish, please refresh the following connection(s) to make sure we can Publicize your post:', 'jetpack' ) ); ?></p>" );
323 somethingShownAlready = true;
324 }
325
326 if ( testResult.userCanRefresh ) {
327 testsSelector.append( '<p/>' );
328 $( '<a/>', {
329 'class' : 'pub-refresh-button button',
330 'title' : testResult.refreshText,
331 'href' : testResult.refreshURL,
332 'text' : testResult.refreshText,
333 'target' : '_refresh_' + testResult.serviceName
334 } )
335 .appendTo( testsSelector.children().last() )
336 .click( publicizeConnRefreshClick );
337 }
338 }
339
340 if( ! testResult.connectionTestPassed && ! testResult.userCanRefresh ) {
341 $( '#wpas-submit-' + testResult.unique_id ).prop( "checked", false ).prop( "disabled", true );
342 if ( ! facebookNotice ) {
343 var message = '<p>'
344 + testResult.connectionTestMessage
345 + '</p><p>'
346 + ' <a class="button" href="<?php echo esc_url( $this->publicize_settings_url ); ?>" rel="noopener noreferrer" target="_blank">'
347 + '<?php echo esc_html( __( 'Update Your Sharing Settings', 'jetpack' ) ); ?>'
348 + '</a>'
349 + '<p>';
350
351 testsSelector
352 .addClass( 'below-h2' )
353 .addClass( 'error' )
354 .addClass( 'publicize-token-refresh-message' )
355 .append( message );
356 facebookNotice = true;
357 }
358 }
359 } );
360 }
361
362 $( document ).ready( function() {
363 // If we have the #pub-connection-tests div present, kick off the connection test
364 if ( $( '#pub-connection-tests' ).length ) {
365 publicizeConnTestStart();
366 }
367 } );
368
369 } );
370 </script>
371
372 <style type="text/css">
373 #publicize {
374 line-height: 1.5;
375 }
376 #publicize ul {
377 margin: 4px 0 4px 6px;
378 }
379 #publicize li {
380 margin: 0;
381 }
382 #publicize textarea {
383 margin: 4px 0 0;
384 width: 100%
385 }
386 #publicize ul.not-connected {
387 list-style: square;
388 padding-left: 1em;
389 }
390 .publicize__notice-warning {
391 display: block;
392 padding: 7px 10px;
393 margin: 5px 0;
394 border-left-width: 4px;
395 border-left-style: solid;
396 font-size: 12px;
397 box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
398 }
399 .publicize-external-link {
400 display: block;
401 text-decoration: none;
402 margin-top: 8px;
403 }
404 .publicize-external-link__text {
405 text-decoration: underline;
406 }
407 #publicize-title:before {
408 content: "\f237";
409 font: normal 20px/1 dashicons;
410 speak: none;
411 margin-left: -1px;
412 padding-right: 3px;
413 vertical-align: top;
414 -webkit-font-smoothing: antialiased;
415 color: #8c8f94;
416 }
417 .post-new-php .authorize-link, .post-php .authorize-link {
418 line-height: 1.5em;
419 }
420 .post-new-php .authorize-message, .post-php .authorize-message {
421 margin-bottom: 0;
422 }
423 #poststuff #publicize .updated p {
424 margin: .5em 0;
425 }
426 .wpas-twitter-length-limit {
427 color: red;
428 }
429 .publicize__notice-warning .dashicons {
430 font-size: 16px;
431 text-decoration: none;
432 }
433 </style>
434 <?php
435 }
436
437 /**
438 * Get the connection label.
439 *
440 * @param string $service_label Service's human-readable Label ("Facebook", "Twitter", ...).
441 * @param string $display_name Connection's human-readable Username ("@jetpack", ...).
442 * @return string
443 */
444 private function connection_label( $service_label, $display_name ) {
445 return sprintf(
446 /* translators: %1$s: Service Name (Facebook, Twitter, ...), %2$s: Username on Service (@jetpack, ...) */
447 __( '%1$s: %2$s', 'jetpack' ),
448 $service_label,
449 $display_name
450 );
451 }
452
453 /**
454 * Extracts the connections that require reauthentication, for example, LinkedIn, when it switched v1 to v2 of its API.
455 *
456 * @return array Connections that must be reauthenticated
457 */
458 public function get_must_reauth_connections() {
459 $must_reauth = array();
460 $connections = $this->publicize->get_connections( 'linkedin' );
461 if ( is_array( $connections ) ) {
462 foreach ( $connections as $index => $connection ) {
463 if ( $this->publicize->is_invalid_linkedin_connection( $connection ) ) {
464 $must_reauth[ $index ] = 'LinkedIn';
465 }
466 }
467 }
468 return $must_reauth;
469 }
470
471 /**
472 * Controls the metabox that is displayed on the post page
473 * Allows the user to customize the message that will be sent out to the social network, as well as pick which
474 * networks to publish to. Also displays the character counter and some other information.
475 */
476 public function post_page_metabox() {
477 global $post;
478
479 if ( ! $this->publicize->post_type_is_publicizeable( $post->post_type ) ) {
480 return;
481 }
482
483 $connections_data = $this->publicize->get_filtered_connection_data();
484
485 $available_services = $this->publicize->get_services( 'all' );
486
487 if ( ! is_array( $available_services ) ) {
488 $available_services = array();
489 }
490
491 if ( ! is_array( $connections_data ) ) {
492 $connections_data = array();
493 }
494 ?>
495 <div id="publicize" class="misc-pub-section misc-pub-section-last">
496 <span id="publicize-title">
497 <?php
498 esc_html_e( 'Publicize:', 'jetpack' );
499
500 if ( ! empty( $connections_data ) ) :
501 $publicize_form = $this->get_metabox_form_connected( $connections_data );
502
503 $must_reauth = $this->get_must_reauth_connections();
504 if ( ! empty( $must_reauth ) ) {
505 foreach ( $must_reauth as $connection_name ) {
506 ?>
507 <span class="notice-warning publicize__notice-warning">
508 <?php
509 printf(
510 /* translators: %s is the name of a Publicize service like "LinkedIn" */
511 esc_html__(
512 'Your %s connection needs to be reauthenticated to continue working – head to Sharing to take care of it.',
513 'jetpack'
514 ),
515 $connection_name // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
516 );
517 ?>
518 <a
519 class="publicize-external-link"
520 href="<?php echo esc_url( publicize_calypso_url() ); ?>"
521 target="_blank"
522 >
523 <span class="publicize-external-link__text"><?php esc_html_e( 'Go to Sharing settings', 'jetpack' ); ?></span>
524 <span class="dashicons dashicons-external"></span>
525 </a>
526 </span>
527 <?php
528 }
529 }
530
531 $labels = array();
532
533 foreach ( $connections_data as $connection_data ) {
534 if ( ! $connection_data['enabled'] ) {
535 continue;
536 }
537
538 $labels[] = sprintf(
539 '<strong>%s</strong>',
540 esc_html( $this->connection_label( $connection_data['service_label'], $connection_data['display_name'] ) )
541 );
542 }
543
544 ?>
545 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- labels are already escaped above ?>
546 <span id="publicize-defaults"><?php echo join( ', ', $labels ); ?></span>
547 <a href="#" id="publicize-form-edit"><?php esc_html_e( 'Edit', 'jetpack' ); ?></a>&nbsp;<a href="<?php echo esc_url( $this->publicize_settings_url ); ?>" rel="noopener noreferrer" target="_blank"><?php esc_html_e( 'Settings', 'jetpack' ); ?></a><br />
548 <?php
549
550 else :
551 $publicize_form = $this->get_metabox_form_disconnected( $available_services );
552 ?>
553 <strong><?php esc_html_e( 'Not Connected', 'jetpack' ); ?></strong>
554 <a href="#" id="publicize-disconnected-form-show"><?php esc_html_e( 'Edit', 'jetpack' ); ?></a><br />
555 <?php
556
557 endif;
558 ?>
559 </span>
560 <?php
561 /**
562 * Filter the Publicize details form.
563 *
564 * @module publicize
565 *
566 * @since 2.0.0
567 *
568 * @param string $publicize_form Publicize Details form appearing above Publish button in the editor.
569 */
570 echo apply_filters( 'publicize_form', $publicize_form ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Parts of the form are escaped individually in the code above.
571 ?>
572 </div>
573 <?php
574 }
575
576 /**
577 * Generates HTML content for connections form.
578 *
579 * @since 6.7
580 *
581 * @global WP_Post $post The current post instance being published.
582 *
583 * @param array $connections_data Array of connections.
584 * @return array {
585 * Array of content for generating connection form.
586 *
587 * @type string HTML content of form
588 * @type array {
589 * Array of connection labels for active connections only.
590 *
591 * @type string Connection label string.
592 * }
593 * }
594 */
595 private function get_metabox_form_connected( $connections_data ) {
596 global $post;
597
598 $all_done = $this->publicize->post_is_done_sharing();
599 $all_connections_done = true;
600
601 ob_start();
602
603 ?>
604 <div id="publicize-form" class="hide-if-js">
605 <ul>
606 <?php
607
608 foreach ( $connections_data as $connection_data ) {
609 $all_connections_done = $all_connections_done && $connection_data['done'];
610 ?>
611
612 <li>
613 <label for="wpas-submit-<?php echo esc_attr( $connection_data['unique_id'] ); ?>">
614 <input
615 type="checkbox"
616 name="wpas[submit][<?php echo esc_attr( $connection_data['unique_id'] ); ?>]"
617 id="wpas-submit-<?php echo esc_attr( $connection_data['unique_id'] ); ?>"
618 class="wpas-submit-<?php echo esc_attr( $connection_data['service_name'] ); ?>"
619 value="1"
620 <?php
621 checked( true, $connection_data['enabled'] );
622 disabled( false, $connection_data['toggleable'] );
623 ?>
624 />
625 <?php if ( $connection_data['enabled'] && ! $connection_data['toggleable'] ) : // Need to submit a value to force a global connection to POST. ?>
626 <input
627 type="hidden"
628 name="wpas[submit][<?php echo esc_attr( $connection_data['unique_id'] ); ?>]"
629 value="1"
630 />
631 <?php endif; ?>
632
633 <?php echo esc_html( $this->connection_label( $connection_data['service_label'], $connection_data['display_name'] ) ); ?>
634
635 </label>
636 </li>
637 <?php
638 }
639
640 $title = get_post_meta( $post->ID, $this->publicize->POST_MESS, true );
641 if ( ! $title ) {
642 $title = '';
643 }
644
645 $all_done = $all_done || $all_connections_done;
646
647 ?>
648
649 </ul>
650
651 <label for="wpas-title"><?php esc_html_e( 'Custom Message:', 'jetpack' ); ?></label>
652 <span id="wpas-title-counter" class="alignright hide-if-no-js">0</span>
653 <textarea name="wpas_title" id="wpas-title"<?php disabled( $all_done ); ?>><?php echo esc_textarea( $title ); ?></textarea>
654 <a href="#" class="hide-if-no-js button" id="publicize-form-hide"><?php esc_html_e( 'OK', 'jetpack' ); ?></a>
655 <input type="hidden" name="wpas[0]" value="1" />
656 </div>
657
658 <?php if ( ! $all_done ) : ?>
659 <div id="pub-connection-tests"></div>
660 <?php endif; ?>
661 <?php
662
663 return ob_get_clean();
664 }
665
666 /**
667 * Metabox that is shown when no services are connected.
668 *
669 * @param array $available_services Array of available services for connecting.
670 */
671 private function get_metabox_form_disconnected( $available_services ) {
672 ob_start();
673 ?>
674 <div id="publicize-form" class="hide-if-js">
675 <div id="add-publicize-check" style="display: none;"></div>
676
677 <?php esc_html_e( 'Connect to', 'jetpack' ); ?>:
678
679 <ul class="not-connected">
680 <?php foreach ( $available_services as $service_name => $service ) : ?>
681 <li>
682 <?php /* translators: %s is the name of a Publicize service such as "LinkedIn" */ ?>
683 <a class="pub-service" data-service="<?php echo esc_attr( $service_name ); ?>" title="<?php echo esc_attr( sprintf( __( 'Connect and share your posts on %s', 'jetpack' ), $this->publicize->get_service_label( $service_name ) ) ); ?>" rel="noopener noreferrer" target="_blank" href="<?php echo esc_url( $this->publicize->connect_url( $service_name ) ); ?>">
684 <?php echo esc_html( $this->publicize->get_service_label( $service_name ) ); ?>
685 </a>
686 </li>
687 <?php endforeach; ?>
688 </ul>
689 <a href="#" class="hide-if-no-js button" id="publicize-disconnected-form-hide"><?php esc_html_e( 'OK', 'jetpack' ); ?></a>
690 </div>
691 <?php
692
693 return ob_get_clean();
694 }
695 }
696