Completed
Push — master-stable ( 123e21...46eadb )
by
unknown
62:16 queued 49:39
created

Publicize_UI::admin_page()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 19
rs 9.4286
cc 1
eloc 14
nc 1
nop 0
1
<?php
2
3
/**
4
* Only user facing pieces of Publicize are found here.
5
*/
6
class Publicize_UI {
7
8
	/**
9
	* Contains an instance of class 'publicize' which loads Keyring, sets up services, etc.
10
	*/
11
	public $publicize;
12
13
	/**
14
	* Hooks into WordPress to display the various pieces of UI and load our assets
15
	*/
16
	function __construct() {
17
		global $publicize;
18
19
		$this->publicize = $publicize = new Publicize;
20
21
		add_action( 'init', array( $this, 'init' ) );
22
	}
23
24
	function init() {
25
		// Show only to users with the capability required to create/delete global connections.
26
		if ( ! current_user_can( $this->publicize->GLOBAL_CAP ) ) {
27
			return;
28
		}
29
30
		// assets (css, js)
31
		add_action( 'admin_head-post.php', array( $this, 'post_page_metabox_assets' ) );
32
		add_action( 'admin_head-post-new.php', array( $this, 'post_page_metabox_assets' ) );
33
34
		// management of publicize (sharing screen, ajax/lightbox popup, and metabox on post screen)
35
		add_action( 'pre_admin_screen_sharing', array( $this, 'admin_page' ) );
36
		add_action( 'post_submitbox_misc_actions', array( $this, 'post_page_metabox' ) );
37
	}
38
39
	/**
40
	* If the ShareDaddy plugin is not active we need to add the sharing settings page to the menu still
41
	*/
42
	function sharing_menu() {
43
		add_submenu_page( 'options-general.php', __( 'Sharing Settings', 'jetpack' ), __( 'Sharing', 'jetpack' ), 'publish_posts', 'sharing', array( $this, 'management_page' ) );
44
	}
45
46
47
	/**
48
	* Management page to load if Sharedaddy is not active so the 'pre_admin_screen_sharing' action exists.
49
	*/
50
	function management_page() { ?>
51
		<div class="wrap">
52
			<div class="icon32" id="icon-options-general"><br /></div>
53
			<h1><?php _e( 'Sharing Settings', 'jetpack' ); ?></h1>
54
55
				<?php
56
				/** This action is documented in modules/sharedaddy/sharing.php */
57
				do_action( 'pre_admin_screen_sharing' );
58
				?>
59
60
		</div> <?php
61
	}
62
63
	function admin_page() {
64
		?>
65
		<h3 id="publicize"><?php esc_html_e( 'Publicize', 'jetpack' ) ?></h3>
66
		<p><?php esc_html_e( 'Connect social media services to automatically share new posts.', 'jetpack' ) ?></p>
67
		<h4><?php
68
			printf(
69
				wp_kses(
70
					__( "We've updated Publicize. Please visit the <a href='%s'>WordPress.com sharing page</a> to manage your publicize connections or use the button below.", 'jetpack' ),
71
					array( 'a' => array( 'href' => array() ) )
72
				),
73
				esc_url( publicize_calypso_url() )
74
			);
75
			?>
76
		</h4>
77
78
		<a href="<?php echo esc_url( publicize_calypso_url() ); ?>" class="button button-primary"><?php esc_html_e( 'Publicize Settings', 'jetpack' ); ?></a>
79
80
		<?php
81
	}
82
83
	/**
84
	* CSS for styling the publicize message box and counter that displays on the post page.
85
	* There is also some JavaScript for length counting and some basic display effects.
86
	*/
87
	function post_page_metabox_assets() {
88
		global $post;
89
		$user_id = empty( $post->post_author ) ? $GLOBALS['user_ID'] : $post->post_author;
0 ignored issues
show
Unused Code introduced by
$user_id is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
90
91
		$default_prefix = $this->publicize->default_prefix;
92
		$default_prefix = preg_replace( '/%([0-9])\$s/', "' + %\\1\$s + '", esc_js( $default_prefix ) );
93
94
		$default_message = $this->publicize->default_message;
95
		$default_message = preg_replace( '/%([0-9])\$s/', "' + %\\1\$s + '", esc_js( $default_message ) );
96
97
		$default_suffix = $this->publicize->default_suffix;
98
		$default_suffix = preg_replace( '/%([0-9])\$s/', "' + %\\1\$s + '", esc_js( $default_suffix ) ); ?>
99
100
<script type="text/javascript">
101
jQuery( function($) {
102
	var wpasTitleCounter    = $( '#wpas-title-counter' ),
103
		wpasTwitterCheckbox = $( '.wpas-submit-twitter' ).size(),
104
		wpasTitle = $('#wpas-title').keyup( function() {
105
		var length = wpasTitle.val().length;
106
		wpasTitleCounter.text( length );
107
		if ( wpasTwitterCheckbox && length > 140 ) {
108
			wpasTitleCounter.addClass( 'wpas-twitter-length-limit' );
109
		} else {
110
			wpasTitleCounter.removeClass( 'wpas-twitter-length-limit' );
111
		}
112
		} ),
113
		authClick = false;
114
115
	$('#publicize-disconnected-form-show').click( function() {
116
		$('#publicize-form').slideDown( 'fast' );
117
		$(this).hide();
118
	} );
119
120
	$('#publicize-disconnected-form-hide').click( function() {
121
		$('#publicize-form').slideUp( 'fast' );
122
		$('#publicize-disconnected-form-show').show();
123
	} );
124
125
	$('#publicize-form-edit').click( function() {
126
		$('#publicize-form').slideDown( 'fast', function() {
127
			wpasTitle.focus();
128
			if ( !wpasTitle.text() ) {
129
				var url = $('#shortlink').size() ? $('#shortlink').val() : '';
130
131
				var defaultMessage = $.trim( '<?php printf( $default_prefix, 'url' ); printf( $default_message, '$("#title").val()', 'url' ); printf( $default_suffix, 'url' ); ?>' );
0 ignored issues
show
Coding Style introduced by
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
132
133
				wpasTitle.append( defaultMessage.replace( /<[^>]+>/g,'') );
134
135
				var selBeg = defaultMessage.indexOf( $("#title").val() );
136
				if ( selBeg < 0 ) {
137
					selBeg = 0;
138
					selEnd = 0;
139
				} else {
140
					selEnd = selBeg + $("#title").val().length;
141
				}
142
143
				var domObj = wpasTitle.get(0);
144
				if ( domObj.setSelectionRange ) {
145
					domObj.setSelectionRange( selBeg, selEnd );
146
				} else if ( domObj.createTextRange ) {
147
					var r = domObj.createTextRange();
148
					r.moveStart( 'character', selBeg );
149
					r.moveEnd( 'character', selEnd );
150
					r.select();
151
				}
152
			}
153
			wpasTitle.keyup();
154
		} );
155
		$('#publicize-defaults').hide();
156
		$(this).hide();
157
		return false;
158
	} );
159
160
	$('#publicize-form-hide').click( function() {
161
		var newList = $.map( $('#publicize-form').slideUp( 'fast' ).find( ':checked' ), function( el ) {
162
			return $.trim( $(el).parent( 'label' ).text() );
163
		} );
164
		$('#publicize-defaults').html( '<strong>' + newList.join( '</strong>, <strong>' ) + '</strong>' ).show();
165
		$('#publicize-form-edit').show();
166
		return false;
167
	} );
168
169
	$('.authorize-link').click( function() {
170
		if ( authClick ) {
171
			return false;
172
		}
173
		authClick = true;
174
		$(this).after( '<img src="images/loading.gif" class="alignleft" style="margin: 0 .5em" />' );
175
		$.ajaxSetup( { async: false } );
176
177
		if ( window.wp && window.wp.autosave ) {
178
			window.wp.autosave.server.triggerSave();
179
		} else {
180
			autosave();
181
		}
182
183
		return true;
184
	} );
185
186
	$( '.pub-service' ).click( function() {
187
		var service = $(this).data( 'service' ),
188
			fakebox = '<input id="wpas-submit-' + service + '" type="hidden" value="1" name="wpas[submit][' + service + ']" />';
189
		$( '#add-publicize-check' ).append( fakebox );
190
	} );
191
192
	publicizeConnTestStart = function() {
193
		$( '#pub-connection-tests' )
194
			.removeClass( 'below-h2' )
195
			.removeClass( 'error' )
196
			.removeClass( 'publicize-token-refresh-message' )
197
			.addClass( 'test-in-progress' )
198
			.html( '' );
199
		$.post( ajaxurl, { action: 'test_publicize_conns' }, publicizeConnTestComplete );
200
	}
201
202
	publicizeConnRefreshClick = function( event ) {
203
		event.preventDefault();
204
		var popupURL = event.currentTarget.href;
205
		var popupTitle = event.currentTarget.title;
206
		// open a popup window
207
		// when it is closed, kick off the tests again
208
		var popupWin = window.open( popupURL, popupTitle, '' );
209
		var popupWinTimer= window.setInterval( function() {
210
			if ( popupWin.closed !== false ) {
211
				window.clearInterval( popupWinTimer );
212
				publicizeConnTestStart();
213
			}
214
		}, 500 );
215
	}
216
217
	publicizeConnTestComplete = function( response ) {
218
		var testsSelector = $( '#pub-connection-tests' );
219
		testsSelector
220
			.removeClass( 'test-in-progress' )
221
			.removeClass( 'below-h2' )
222
			.removeClass( 'error' )
223
			.removeClass( 'publicize-token-refresh-message' )
224
			.html( '' );
225
226
		// If any of the tests failed, show some stuff
227
		var somethingShownAlready = false;
228
		$.each( response.data, function( index, testResult ) {
229
			// find the li for this connection
230
			if ( ! testResult.connectionTestPassed ) {
231
				if ( ! somethingShownAlready ) {
232
					testsSelector
233
						.addClass( 'below-h2' )
234
						.addClass( 'error' )
235
						.addClass( 'publicize-token-refresh-message' )
236
						.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>" );
237
					somethingShownAlready = true;
238
				}
239
240
				if ( testResult.userCanRefresh ) {
241
					testsSelector.append( '<p/>' );
242
					$( '<a/>', {
243
						'class'  : 'pub-refresh-button button',
244
						'title'  : testResult.refreshText,
245
						'href'   : testResult.refreshURL,
246
						'text'   : testResult.refreshText,
247
						'target' : '_refresh_' + testResult.serviceName
248
					} )
249
						.appendTo( testsSelector.children().last() )
250
						.click( publicizeConnRefreshClick );
251
				}
252
			}
253
		} );
254
	}
255
256
	$( document ).ready( function() {
257
		// If we have the #pub-connection-tests div present, kick off the connection test
258
		if ( $( '#pub-connection-tests' ).length ) {
259
			publicizeConnTestStart();
260
		}
261
	} );
262
263
} );
264
</script>
265
266
<style type="text/css">
267
#publicize {
268
	line-height: 1.5;
269
}
270
#publicize ul {
271
	margin: 4px 0 4px 6px;
272
}
273
#publicize li {
274
	margin: 0;
275
}
276
#publicize textarea {
277
	margin: 4px 0 0;
278
	width: 100%
279
}
280
#publicize ul.not-connected {
281
	list-style: square;
282
	padding-left: 1em;
283
}
284
.post-new-php .authorize-link, .post-php .authorize-link {
285
	line-height: 1.5em;
286
}
287
.post-new-php .authorize-message, .post-php .authorize-message {
288
	margin-bottom: 0;
289
}
290
#poststuff #publicize .updated p {
291
	margin: .5em 0;
292
}
293
.wpas-twitter-length-limit {
294
	color: red;
295
}
296
</style><?php
297
	}
298
299
	/**
300
	* Controls the metabox that is displayed on the post page
301
	* Allows the user to customize the message that will be sent out to the social network, as well as pick which
302
	* networks to publish to. Also displays the character counter and some other information.
303
	*/
304
	function post_page_metabox() {
305
		global $post;
306
307
		if ( ! $this->publicize->post_type_is_publicizeable( $post->post_type ) )
308
			return;
309
310
		$user_id = empty( $post->post_author ) ? $GLOBALS['user_ID'] : $post->post_author;
0 ignored issues
show
Unused Code introduced by
$user_id is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
311
		$services = $this->publicize->get_services( 'connected' );
312
		$available_services = $this->publicize->get_services( 'all' );
313
314
		if ( ! is_array( $available_services ) )
315
			$available_services = array();
316
317
		if ( ! is_array( $services ) )
318
			$services = array();
319
320
		$active = array(); ?>
321
322
		<div id="publicize" class="misc-pub-section misc-pub-section-last">
323
			<?php
324
			_e( 'Publicize:', 'jetpack' );
325
326
			if ( 0 < count( $services ) ) :
327
					ob_start();
328
				?>
329
330
				<div id="publicize-form" class="hide-if-js">
331
					<ul>
332
333
					<?php
334
					// We can set an _all flag to indicate that this post is completely done as
335
					// far as Publicize is concerned. Jetpack uses this approach. All published posts in Jetpack
336
					// have Publicize disabled.
337
					$all_done = get_post_meta( $post->ID, $this->publicize->POST_DONE . 'all', true ) || ( $this->in_jetpack && 'publish' == $post->post_status );
0 ignored issues
show
Bug introduced by
The property in_jetpack does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
338
339
					// We don't allow Publicizing to the same external id twice, to prevent spam
340
					$service_id_done = (array) get_post_meta( $post->ID, $this->publicize->POST_SERVICE_DONE, true );
341
342
					foreach ( $services as $name => $connections ) {
343
						foreach ( $connections as $connection ) {
344
							$connection_data = '';
345 View Code Duplication
							if ( method_exists( $connection, 'get_meta' ) )
346
								$connection_data = $connection->get_meta( 'connection_data' );
347
							elseif ( ! empty( $connection['connection_data'] ) )
348
								$connection_data = $connection['connection_data'];
349
350
							/**
351
							 * Filter whether a post should be publicized to a given service.
352
							 *
353
							 * @module publicize
354
							 *
355
							 * @since 2.0.0
356
							 *
357
							 * @param bool true Should the post be publicized to a given service? Default to true.
358
							 * @param int $post->ID Post ID.
359
							 * @param string $name Service name.
360
							 * @param array $connection_data Array of information about all Publicize details for the site.
361
							 */
362
							if ( ! $continue = apply_filters( 'wpas_submit_post?', true, $post->ID, $name, $connection_data ) ) {
363
								continue;
364
							}
365
366 View Code Duplication
							if ( ! empty( $connection->unique_id ) ) {
367
								$unique_id = $connection->unique_id;
368
							} else if ( ! empty( $connection['connection_data']['token_id'] ) ) {
369
								$unique_id = $connection['connection_data']['token_id'];
370
							}
371
372
							// Should we be skipping this one?
373
							$skip = (
374
								(
375
									in_array( $post->post_status, array( 'publish', 'draft', 'future' ) )
376
									&&
377
									get_post_meta( $post->ID, $this->publicize->POST_SKIP . $unique_id, true )
0 ignored issues
show
Bug introduced by
The variable $unique_id does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
378
								)
379
								||
380
								(
381
									is_array( $connection )
382
									&&
383
									(
384
										( isset( $connection['meta']['external_id'] ) && ! empty( $service_id_done[ $name ][ $connection['meta']['external_id'] ] ) )
385
										||
386
										// Jetpack's connection data looks a little different.
387
										( isset( $connection['external_id'] ) && ! empty( $service_id_done[ $name ][ $connection['external_id'] ] ) )
388
									)
389
								)
390
							);
391
392
							// Was this connections (OR, old-format service) already Publicized to?
393
							$done = ( 1 == get_post_meta( $post->ID, $this->publicize->POST_DONE . $unique_id, true ) ||  1 == get_post_meta( $post->ID, $this->publicize->POST_DONE . $name, true ) ); // New and old style flags
394
395
							// If this one has already been publicized to, don't let it happen again
396
							$disabled = '';
397
							if ( $done )
398
								$disabled = ' disabled="disabled"';
399
400
							// If this is a global connection and this user doesn't have enough permissions to modify
401
							// those connections, don't let them change it
402
							$cmeta = $this->publicize->get_connection_meta( $connection );
403
							$hidden_checkbox = false;
404
							if ( !$done && ( 0 == $cmeta['connection_data']['user_id'] && !current_user_can( $this->publicize->GLOBAL_CAP ) ) ) {
405
								$disabled = ' disabled="disabled"';
406
								/**
407
								 * Filters the checkboxes for global connections with non-prilvedged users.
408
								 *
409
								 * @module publicize
410
								 *
411
								 * @since 3.7.0
412
								 *
413
								 * @param bool   $checked Indicates if this connection should be enabled. Default true.
414
								 * @param int    $post->ID ID of the current post
415
								 * @param string $name Name of the connection (Facebook, Twitter, etc)
416
								 * @param array  $connection Array of data about the connection.
417
								 */
418
								$hidden_checkbox = apply_filters( 'publicize_checkbox_global_default', true, $post->ID, $name, $connection );
419
							}
420
421
							// Determine the state of the checkbox (on/off) and allow filtering
422
							$checked = $skip != 1 || $done;
423
							/**
424
							 * Filter the checkbox state of each Publicize connection appearing in the post editor.
425
							 *
426
							 * @module publicize
427
							 *
428
							 * @since 2.0.1
429
							 *
430
							 * @param bool $checked Should the Publicize checkbox be enabled for a given service.
431
							 * @param int $post->ID Post ID.
432
							 * @param string $name Service name.
433
							 * @param array $connection Array of connection details.
434
							 */
435
							$checked = apply_filters( 'publicize_checkbox_default', $checked, $post->ID, $name, $connection );
436
437
							// Force the checkbox to be checked if the post was DONE, regardless of what the filter does
438
							if ( $done ) {
439
								$checked = true;
440
							}
441
442
							// This post has been handled, so disable everything
443
							if ( $all_done ) {
444
								$disabled = ' disabled="disabled"';
445
							}
446
447
							$label = sprintf(
448
								_x( '%1$s: %2$s', 'Service: Account connected as', 'jetpack' ),
449
								esc_html( $this->publicize->get_service_label( $name ) ),
450
								esc_html( $this->publicize->get_display_name( $name, $connection ) )
451
							);
452
							if ( !$skip || $done ) {
453
								$active[] = $label;
454
							}
455
							?>
456
							<li>
457
								<label for="wpas-submit-<?php echo esc_attr( $unique_id ); ?>">
458
									<input type="checkbox" name="wpas[submit][<?php echo $unique_id; ?>]" id="wpas-submit-<?php echo $unique_id; ?>" class="wpas-submit-<?php echo $name; ?>" value="1" <?php
459
										checked( true, $checked );
460
										echo $disabled;
461
									?> />
462
									<?php
463
									if ( $hidden_checkbox ) {
464
										// Need to submit a value to force a global connection to post
465
										echo '<input type="hidden" name="wpas[submit][' . $unique_id . ']" value="1" />';
466
									}
467
									echo esc_html( $label );
468
									?>
469
								</label>
470
							</li>
471
							<?php
472
						}
473
					}
474
475
					if ( $title = get_post_meta( $post->ID, $this->publicize->POST_MESS, true ) ) {
476
						$title = esc_html( $title );
477
					} else {
478
						$title = '';
479
					}
480
					?>
481
482
					</ul>
483
484
					<label for="wpas-title"><?php _e( 'Custom Message:', 'jetpack' ); ?></label>
485
					<span id="wpas-title-counter" class="alignright hide-if-no-js">0</span>
486
487
					<textarea name="wpas_title" id="wpas-title"<?php disabled( $all_done ); ?>><?php echo $title; ?></textarea>
488
489
					<a href="#" class="hide-if-no-js" id="publicize-form-hide"><?php _e( 'Hide', 'jetpack' ); ?></a>
490
					<input type="hidden" name="wpas[0]" value="1" />
491
492
				</div>
493
				<div id="pub-connection-tests"></div>
494
				<?php // #publicize-form
495
496
				$publicize_form = ob_get_clean();
497
			else :
498
				echo "&nbsp;" . __( 'Not Connected', 'jetpack' );
499
					ob_start();
500
				?>
501
502
				<div id="publicize-form" class="hide-if-js">
503
					<div id="add-publicize-check" style="display: none;"></div>
504
505
					<strong><?php _e( 'Connect to', 'jetpack' ); ?>:</strong>
506
507
					<ul class="not-connected">
508
						<?php foreach ( $available_services as $service_name => $service ) : ?>
509
						<li>
510
							<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 ) ) ); ?>" target="_blank" href="<?php echo $this->publicize->connect_url( $service_name ); ?>">
0 ignored issues
show
Bug introduced by
The method connect_url() does not seem to exist on object<Publicize>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
511
								<?php echo esc_html( $this->publicize->get_service_label( $service_name ) ); ?>
512
							</a>
513
						</li>
514
						<?php endforeach; ?>
515
					</ul>
516
517
					<?php if ( 0 < count( $services ) ) : ?>
518
						<a href="#" class="hide-if-no-js" id="publicize-form-hide"><?php _e( 'Hide', 'jetpack' ); ?></a>
519
					<?php else : ?>
520
						<a href="#" class="hide-if-no-js" id="publicize-disconnected-form-hide"><?php _e( 'Hide', 'jetpack' ); ?></a>
521
					<?php endif; ?>
522
				</div> <?php // #publicize-form
523
524
				$publicize_form = ob_get_clean();
525
			endif;
526
			?>
527
528
			<span id="publicize-defaults"><strong><?php echo join( '</strong>, <strong>', array_map( 'esc_html', $active ) ); ?></strong></span><br />
529
530
			<?php if ( 0 < count( $services ) ) : ?>
531
				<a href="#" id="publicize-form-edit"><?php _e( 'Edit Details', 'jetpack' ); ?></a>&nbsp;<a href="<?php echo admin_url( 'options-general.php?page=sharing' ); ?>" target="_blank"><?php _e( 'Settings', 'jetpack' ); ?></a><br />
532
			<?php else : ?>
533
				<a href="#" id="publicize-disconnected-form-show"><?php _e( 'Show', 'jetpack' ); ?></a><br />
534
			<?php endif; ?>
535
536
			<?php
537
			/**
538
			 * Filter the Publicize details form.
539
			 *
540
			 * @module publicize
541
			 *
542
			 * @since 2.0.0
543
			 *
544
			 * @param string $publicize_form Publicize Details form appearing above Publish button in the editor.
545
			 */
546
			echo apply_filters( 'publicize_form', $publicize_form );
547
			?>
548
549
		</div> <?php // #publicize
550
	}
551
552
}
553