Completed
Push — update/google-translate-layout ( 38cf64...f54e3d )
by Jeremy
14:26
created

Jetpack_Likes::load_admin_css()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 39
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 39
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * Module Name: Likes
4
 * Module Description: Give visitors an easy way to show they appreciate your content.
5
 * Jumpstart Description: Give visitors an easy way to show they appreciate your content.
6
 * First Introduced: 2.2
7
 * Sort Order: 23
8
 * Requires Connection: Yes
9
 * Auto Activate: No
10
 * Module Tags: Social
11
 * Feature: Engagement, Jumpstart
12
 * Additional Search Queries: like, likes, wordpress.com
13
 */
14
15
Jetpack::dns_prefetch( array(
16
	'//widgets.wp.com',
17
	'//s0.wp.com',
18
	'//0.gravatar.com',
19
	'//1.gravatar.com',
20
	'//2.gravatar.com',
21
) );
22
23
include_once dirname( __FILE__ ) . '/likes/jetpack-likes-master-iframe.php';
24
include_once dirname( __FILE__ ) . '/likes/jetpack-likes-settings.php';
25
26
class Jetpack_Likes {
27
	public static function init() {
28
		static $instance = NULL;
29
30
		if ( ! $instance ) {
31
			$instance = new Jetpack_Likes;
32
		}
33
34
		return $instance;
35
	}
36
37
	function __construct() {
38
		$this->in_jetpack = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? false : true;
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...
39
		$this->settings = new Jetpack_Likes_Settings();
0 ignored issues
show
Bug introduced by
The property settings 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...
40
41
		add_action( 'init', array( &$this, 'action_init' ) );
42
		add_action( 'admin_init', array( $this, 'admin_init' ) );
43
44
		if ( $this->in_jetpack ) {
45
			add_action( 'jetpack_activate_module_likes',   array( $this, 'set_social_notifications_like' ) );
46
			add_action( 'jetpack_deactivate_module_likes', array( $this, 'delete_social_notifications_like' ) );
47
48
			Jetpack::enable_module_configurable( __FILE__ );
49
			Jetpack::module_configuration_load( __FILE__, array( $this, 'configuration_redirect' ) );
50
51
			add_action( 'admin_print_scripts-settings_page_sharing', array( &$this, 'load_jp_css' ) );
52
			add_filter( 'sharing_show_buttons_on_row_start', array( $this, 'configuration_target_area' ) );
53
54
			$active = Jetpack::get_active_modules();
55
56 View Code Duplication
			if ( ! in_array( 'sharedaddy', $active ) && ! in_array( 'publicize', $active ) ) {
57
				// we don't have a sharing page yet
58
				add_action( 'admin_menu', array( $this->settings, 'sharing_menu' ) );
59
			}
60
61 View Code Duplication
			if ( in_array( 'publicize', $active ) && ! in_array( 'sharedaddy', $active ) ) {
62
				// we have a sharing page but not the global options area
63
				add_action( 'pre_admin_screen_sharing', array( $this->settings, 'sharing_block' ), 20 );
64
				add_action( 'pre_admin_screen_sharing', array( $this->settings, 'updated_message' ), -10 );
65
			}
66
67 View Code Duplication
			if( ! in_array( 'sharedaddy', $active ) ) {
68
				add_action( 'admin_init', array( $this->settings, 'process_update_requests_if_sharedaddy_not_loaded' ) );
69
				add_action( 'sharing_global_options', array( $this->settings, 'admin_settings_showbuttonon_init' ), 19 );
70
				add_action( 'sharing_admin_update', array( $this->settings, 'admin_settings_showbuttonon_callback' ), 19 );
71
				add_action( 'admin_init', array( $this->settings, 'add_meta_box' ) );
72
			} else {
73
				add_filter( 'sharing_meta_box_title', array( $this->settings, 'add_likes_to_sharing_meta_box_title' ) );
74
				add_action( 'start_sharing_meta_box_content', array( $this->settings, 'meta_box_content' ) );
75
			}
76
		} else { // wpcom
77
			add_action( 'wpmu_new_blog', array( $this, 'enable_comment_likes' ), 10, 1 );
78
			add_action( 'admin_init', array( $this->settings, 'add_meta_box' ) );
79
			add_action( 'end_likes_meta_box_content', array( $this->settings, 'sharing_meta_box_content' ) );
80
			add_filter( 'likes_meta_box_title', array( $this->settings, 'add_likes_to_sharing_meta_box_title' ) );
81
		}
82
83
		add_action( 'admin_init', array( $this, 'admin_discussion_likes_settings_init' ) ); // Likes notifications
84
85
		add_action( 'admin_bar_menu', array( $this, 'admin_bar_likes' ), 60 );
86
87
		add_action( 'wp_enqueue_scripts', array( $this, 'load_styles_register_scripts' ) );
88
89
		add_action( 'save_post', array( $this->settings, 'meta_box_save' ) );
90
		add_action( 'edit_attachment', array( $this->settings, 'meta_box_save' ) );
91
		add_action( 'sharing_global_options', array( $this->settings, 'admin_settings_init' ), 20 );
92
		add_action( 'sharing_admin_update',   array( $this->settings, 'admin_settings_callback' ), 20 );
93
	}
94
95
	/**
96
	 * Set the social_notifications_like option to `on` when the Likes module is activated.
97
	 *
98
	 * @since 3.7.0
99
	 *
100
	 * @return null
101
	 */
102
	function set_social_notifications_like() {
103
		update_option( 'social_notifications_like', 'on' );
104
	}
105
106
	/**
107
	 * Delete the social_notifications_like option that was set to `on` on module activation.
108
	 *
109
	 * @since 3.7.0
110
	 *
111
	 * @return null
112
	 */
113
	function delete_social_notifications_like() {
114
		delete_option( 'social_notifications_like' );
115
	}
116
117
	/**
118
	 * Redirects to the likes section of the sharing page.
119
	 */
120
	function configuration_redirect() {
121
		wp_safe_redirect( admin_url( 'options-general.php?page=sharing#likes' ) );
122
		die();
0 ignored issues
show
Coding Style Compatibility introduced by
The method configuration_redirect() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
123
	}
124
125
	/**
126
	 * Loads Jetpack's CSS on the sharing page so we can use .jetpack-targetable
127
	 */
128
	function load_jp_css() {
129
		// Do we really need `admin_styles`? With the new admin UI, it's breaking some bits.
130
		// Jetpack::init()->admin_styles();
131
	}
132
133
	/**
134
	 * Load scripts and styles for front end.
135
	 * @return null
136
	 */
137
	function load_styles_register_scripts() {
138
		if ( $this->in_jetpack ) {
139
			wp_enqueue_style( 'jetpack_likes', plugins_url( 'likes/style.css', __FILE__ ), array(), JETPACK__VERSION );
140
			$this->register_scripts();
141
		}
142
	}
143
144
	/**
145
	 * Adds in the jetpack-targetable class so when we visit sharing#likes our like settings get highlighted by a yellow box
146
	 * @param  string $html row heading for the sharedaddy "which page" setting
147
	 * @return string       html with the jetpack-targetable class and likes id. tbody gets closed after the like settings
148
	 */
149
	function configuration_target_area( $html = '' ) {
150
		$html = "<tbody id='likes' class='jetpack-targetable'>" . $html;
151
		return $html;
152
	}
153
154
	/**
155
	 * WordPress.com: Metabox option for sharing (sharedaddy will handle this on the JP blog)
156
	 */
157
	function sharing_meta_box_content( $post ) {
158
		$post_id = ! empty( $post->ID ) ? (int) $post->ID : get_the_ID();
159
		$disabled = get_post_meta( $post_id, 'sharing_disabled', true ); ?>
160
		<p>
161
			<label for="wpl_enable_post_sharing">
162
				<input type="checkbox" name="wpl_enable_post_sharing" id="wpl_enable_post_sharing" value="1" <?php checked( !$disabled ); ?>>
163
				<?php _e( 'Show sharing buttons.', 'jetpack' ); ?>
164
			</label>
165
			<input type="hidden" name="wpl_sharing_status_hidden" value="1" />
166
		</p> <?php
167
	}
168
169
	/**
170
	  * Options to be added to the discussion page (see also admin_settings_init, etc below for Sharing settings page)
171
	  */
172
173 View Code Duplication
	function admin_discussion_likes_settings_init() {
174
		// Add a temporary section, until we can move the setting out of there and with the rest of the email notification settings
175
		add_settings_section( 'likes-notifications', __( 'Likes Notifications', 'jetpack' ), array( $this, 'admin_discussion_likes_settings_section' ), 'discussion' );
176
		add_settings_field( 'social-notifications', __( 'Email me whenever', 'jetpack' ), array( $this, 'admin_discussion_likes_settings_field' ), 'discussion', 'likes-notifications' );
177
		// Register the setting
178
		register_setting( 'discussion', 'social_notifications_like', array( $this, 'admin_discussion_likes_settings_validate' ) );
179
	}
180
181
	function admin_discussion_likes_settings_section() {
182
		// Atypical usage here.  We emit jquery to move likes notification checkbox to be with the rest of the email notification settings
183
?>
184
	<script type="text/javascript">
185
	jQuery( function( $ )  {
186
		var table = $( '#social_notifications_like' ).parents( 'table:first' ),
187
			header = table.prevAll( 'h2:first' ),
188
			newParent = $( '#moderation_notify' ).parent( 'label' ).parent();
189
190
		if ( !table.length || !header.length || !newParent.length ) {
191
			return;
192
		}
193
194
		newParent.append( '<br/>' ).append( table.end().parent( 'label' ).siblings().andSelf() );
195
		header.remove();
196
		table.remove();
197
	} );
198
	</script>
199
<?php
200
	}
201
202
	function admin_likes_get_option( $option ) {
203
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
204
			$option_setting = get_blog_option( get_current_blog_id(), $option, 'on' );
205
		} else {
206
			$option_setting = get_option( $option, 'on' );
207
		}
208
209
		return intval( 'on' == $option_setting );
210
	}
211
212
	function admin_discussion_likes_settings_field() {
213
		$like = $this->admin_likes_get_option( 'social_notifications_like' );
214
?>
215
		<label><input type="checkbox" id="social_notifications_like" name="social_notifications_like" value="1" <?php checked( $like ); ?> /> <?php esc_html_e( 'Someone likes one of my posts', 'jetpack' ); ?></label>
216
<?php
217
	}
218
219
	function admin_discussion_likes_settings_validate( $input ) {
220
		// If it's not set (was unchecked during form submission) or was set to off (during option update), return 'off'.
221
		if ( !$input || 'off' == $input )
222
			return 'off';
223
224
		// Otherwise, return 'on'.
225
		return 'on';
226
	}
227
228
	function admin_init() {
229
		add_filter( 'manage_posts_columns', array( $this, 'add_like_count_column' ) );
230
		add_filter( 'manage_pages_columns', array( $this, 'add_like_count_column' ) );
231
		add_action( 'manage_posts_custom_column', array( $this, 'likes_edit_column' ), 10, 2 );
232
		add_action( 'manage_pages_custom_column', array( $this, 'likes_edit_column' ), 10, 2 );
233
		add_action( 'admin_print_styles-edit.php', array( $this, 'load_admin_css' ) );
234
		add_action( "admin_print_scripts-edit.php", array( $this, 'enqueue_admin_scripts' ) );
235
	}
236
237
	function action_init() {
238
		if ( is_admin() ) {
239
			return;
240
		}
241
242
		if ( ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) ||
243
			 ( defined( 'APP_REQUEST' ) && APP_REQUEST ) ||
244
			 ( defined( 'REST_API_REQUEST' ) && REST_API_REQUEST ) ||
245
			 ( defined( 'COOKIE_AUTH_REQUEST' ) && COOKIE_AUTH_REQUEST ) ||
246
			 ( defined( 'JABBER_SERVER' ) && JABBER_SERVER ) ) {
247
			return;
248
		}
249
250
		if ( $this->in_jetpack ) {
251
			add_filter( 'the_content', array( &$this, 'post_likes' ), 30, 1 );
252
			add_filter( 'the_excerpt', array( &$this, 'post_likes' ), 30, 1 );
253
254
		} else {
255
			add_filter( 'post_flair', array( &$this, 'post_likes' ), 30, 1 );
256
			add_filter( 'post_flair_block_css', array( $this, 'post_flair_service_enabled_like' ) );
257
258
			wp_enqueue_script( 'postmessage', '/wp-content/js/postmessage.js', array( 'jquery' ), JETPACK__VERSION, false );
259
			wp_enqueue_script( 'jetpack_resize', '/wp-content/js/jquery/jquery.jetpack-resize.js', array( 'jquery' ), JETPACK__VERSION, false );
260
			wp_enqueue_script( 'jetpack_likes_queuehandler', plugins_url( 'queuehandler.js' , __FILE__ ), array( 'jquery', 'postmessage', 'jetpack_resize' ), JETPACK__VERSION, true );
261
			wp_enqueue_style( 'jetpack_likes', plugins_url( 'jetpack-likes.css', __FILE__ ), array(), JETPACK__VERSION );
262
		}
263
	}
264
265
	/**
266
	* Register scripts
267
	*/
268
	function register_scripts() {
269
		wp_register_script( 'postmessage', plugins_url( '_inc/postmessage.js', dirname(__FILE__) ), array( 'jquery' ), JETPACK__VERSION, false );
270
		wp_register_script( 'jetpack_resize', plugins_url( '_inc/jquery.jetpack-resize.js' , dirname(__FILE__) ), array( 'jquery' ), JETPACK__VERSION, false );
271
		wp_register_script( 'jetpack_likes_queuehandler', plugins_url( 'likes/queuehandler.js' , __FILE__ ), array( 'jquery', 'postmessage', 'jetpack_resize' ), JETPACK__VERSION, true );
272
	}
273
274
	/**
275
	* Load the CSS needed for the wp-admin area.
276
	*/
277
	function load_admin_css() {
278
	?>
279
		<style type="text/css">
280
			.vers img { display: none; }
281
			.metabox-prefs .vers img { display: inline; }
282
			.fixed .column-likes { width: 5.5em; padding: 8px 0; text-align: left; }
283
			.fixed .column-stats { width: 5em; }
284
			.fixed .column-likes .post-com-count {
285
				-webkit-box-sizing: border-box;
286
				-moz-box-sizing: border-box;
287
				box-sizing: border-box;
288
				display: inline-block;
289
				padding: 0 8px;
290
				height: 2em;
291
				margin-top: 5px;
292
				-webkit-border-radius: 5px;
293
				border-radius: 5px;
294
				background-color: #72777C;
295
				color: #FFF;
296
				font-size: 11px;
297
				line-height: 21px;
298
			}
299
			.fixed .column-likes .post-com-count::after { border: none !important; }
300
			.fixed .column-likes .post-com-count:hover { background-color: #0073AA; }
301
			.fixed .column-likes .vers:before {
302
				font: normal 20px/1 dashicons;
303
				content: '\f155';
304
				speak: none;
305
				-webkit-font-smoothing: antialiased;
306
				-moz-osx-font-smoothing: grayscale;
307
			}
308
			@media screen and (max-width: 782px) {
309
				.fixed .column-likes {
310
					display: none;
311
				}
312
			}
313
		</style>
314
		<?php
315
	}
316
317
	/**
318
	* Load the JS required for loading the like counts.
319
	*/
320
	function enqueue_admin_scripts() {
321
		if ( empty( $_GET['post_type'] ) || 'post' == $_GET['post_type'] || 'page' == $_GET['post_type'] ) {
322
			if ( $this->in_jetpack ) {
323
				wp_enqueue_script( 'likes-post-count', plugins_url( 'modules/likes/post-count.js', dirname( __FILE__ ) ), array( 'jquery' ), JETPACK__VERSION );
324
				wp_enqueue_script( 'likes-post-count-jetpack', plugins_url( 'modules/likes/post-count-jetpack.js', dirname( __FILE__ ) ), array( 'likes-post-count' ), JETPACK__VERSION );
325
			} else {
326
				wp_enqueue_script( 'jquery.wpcom-proxy-request', "/wp-content/js/jquery/jquery.wpcom-proxy-request.js", array('jquery'), NULL, true );
327
				wp_enqueue_script( 'likes-post-count', plugins_url( 'likes/post-count.js', dirname( __FILE__ ) ), array( 'jquery' ), JETPACK__VERSION );
328
				wp_enqueue_script( 'likes-post-count-wpcom', plugins_url( 'likes/post-count-wpcom.js', dirname( __FILE__ ) ), array( 'likes-post-count', 'jquery.wpcom-proxy-request' ), JETPACK__VERSION );
329
			}
330
		}
331
	}
332
333
	/**
334
	* Add "Likes" column data to the post edit table in wp-admin.
335
	*
336
	* @param string $column_name
337
	* @param int $post_id
338
	*/
339
	function likes_edit_column( $column_name, $post_id ) {
340
		if ( 'likes' == $column_name ) {
341
342
			if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
343
				$blog_id = get_current_blog_id();
344
			} else {
345
				$blog_id = Jetpack_Options::get_option( 'id' );
346
			}
347
348
			$permalink = get_permalink( get_the_ID() ); ?>
349
			<a title="" data-post-id="<?php echo (int) $post_id; ?>" class="post-com-count post-like-count" id="post-like-count-<?php echo (int) $post_id; ?>" data-blog-id="<?php echo (int) $blog_id; ?>" href="<?php echo esc_url( $permalink ); ?>#like-<?php echo (int) $post_id; ?>">
350
				<span class="comment-count">0</span>
351
			</a>
352
			<?php
353
		}
354
	}
355
356
	/**
357
	* Add a "Likes" column header to the post edit table in wp-admin.
358
	*
359
	* @param array $columns
360
	* @return array
361
	*/
362
	function add_like_count_column( $columns ) {
363
		$date = $columns['date'];
364
		unset( $columns['date'] );
365
366
		$columns['likes'] = '<span class="vers"><img title="' . esc_attr__( 'Likes', 'jetpack' ) . '" alt="' . esc_attr__( 'Likes', 'jetpack' ) . '" src="//s0.wordpress.com/i/like-grey-icon.png" /></span>';
367
		$columns['date'] = $date;
368
369
		return $columns;
370
	}
371
372
	function post_likes( $content ) {
373
		$post_id = get_the_ID();
374
375
		if ( ! is_numeric( $post_id ) || ! $this->settings->is_likes_visible() )
376
			return $content;
377
378 View Code Duplication
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
379
			$blog_id = get_current_blog_id();
380
			$bloginfo = get_blog_details( (int) $blog_id );
381
			$domain = $bloginfo->domain;
382
		} else {
383
			$blog_id = Jetpack_Options::get_option( 'id' );
384
			$url = home_url();
385
			$url_parts = parse_url( $url );
386
			$domain = $url_parts['host'];
387
		}
388
		// make sure to include the scripts before the iframe otherwise weird things happen
389
		add_action( 'wp_footer', 'jetpack_likes_master_iframe', 21 );
390
391
		/**
392
		* if the same post appears more then once on a page the page goes crazy
393
		* we need a slightly more unique id / name for the widget wrapper.
394
		*/
395
		$uniqid = uniqid();
396
397
		$src = sprintf( 'https://widgets.wp.com/likes/#blog_id=%1$d&amp;post_id=%2$d&amp;origin=%3$s&amp;obj_id=%1$d-%2$d-%4$s', $blog_id, $post_id, $domain, $uniqid );
398
		$name = sprintf( 'like-post-frame-%1$d-%2$d-%3$s', $blog_id, $post_id, $uniqid );
399
		$wrapper = sprintf( 'like-post-wrapper-%1$d-%2$d-%3$s', $blog_id, $post_id, $uniqid );
400
		$headline = sprintf(
401
			/** This filter is already documented in modules/sharedaddy/sharing-service.php */
402
			apply_filters( 'jetpack_sharing_headline_html', '<h3 class="sd-title">%s</h3>', esc_html__( 'Like this:', 'jetpack' ), 'likes' ),
403
			esc_html__( 'Like this:', 'jetpack' )
404
		);
405
406
		$html  = "<div class='sharedaddy sd-block sd-like jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded' id='$wrapper' data-src='$src' data-name='$name'>";
407
		$html .= $headline;
408
		$html .= "<div class='likes-widget-placeholder post-likes-widget-placeholder' style='height: 55px;'><span class='button'><span>" . esc_html__( 'Like', 'jetpack' ) . '</span></span> <span class="loading">' . esc_html__( 'Loading...', 'jetpack' ) . '</span></div>';
409
		$html .= "<span class='sd-text-color'></span><a class='sd-link-color'></a>";
410
		$html .= '</div>';
411
412
		// Let's make sure that the script is enqueued
413
		wp_enqueue_script( 'jetpack_likes_queuehandler' );
414
415
		return $content . $html;
416
	}
417
418
	function post_flair_service_enabled_like( $classes ) {
419
		$classes[] = 'sd-like-enabled';
420
		return $classes;
421
	}
422
423
	function is_admin_bar_button_visible() {
424
		global $wp_admin_bar;
425
426
		if ( ! is_object( $wp_admin_bar ) )
427
			return false;
428
429
		if ( ( ! is_singular( 'post' ) && ! is_attachment() && ! is_page() ) )
430
			return false;
431
432
		if ( ! $this->settings->is_likes_visible() )
433
			return false;
434
435
		if ( ! $this->settings->is_post_likeable() )
436
			return false;
437
438
		/**
439
		 * Filters whether the Like button is enabled in the admin bar.
440
		 *
441
		 * @module likes
442
		 *
443
		 * @since 2.2.0
444
		 *
445
		 * @param bool true Should the Like button be visible in the Admin bar. Default to true.
446
		 */
447
		return (bool) apply_filters( 'jetpack_admin_bar_likes_enabled', true );
448
	}
449
450
	function admin_bar_likes() {
451
		global $wp_admin_bar;
452
453
		$post_id = get_the_ID();
454
455
		if ( ! is_numeric( $post_id ) || ! $this->is_admin_bar_button_visible() ) {
456
			return;
457
		}
458
459
		$protocol = 'http';
460
		if ( is_ssl() )
461
			$protocol = 'https';
462
463 View Code Duplication
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
464
			$blog_id = get_current_blog_id();
465
			$bloginfo = get_blog_details( (int) $blog_id );
466
			$domain = $bloginfo->domain;
467
		} else {
468
			$blog_id = Jetpack_Options::get_option( 'id' );
469
			$url = home_url();
470
			$url_parts = parse_url( $url );
471
			$domain = $url_parts['host'];
472
		}
473
		// make sure to include the scripts before the iframe otherwise weird things happen
474
		add_action( 'wp_footer', 'jetpack_likes_master_iframe', 21 );
475
476
		$src = sprintf( 'https://widgets.wp.com/likes/#blog_id=%2$d&amp;post_id=%3$d&amp;origin=%1$s://%4$s', $protocol, $blog_id, $post_id, $domain );
477
478
		$html = "<iframe class='admin-bar-likes-widget jetpack-likes-widget' scrolling='no' frameBorder='0' name='admin-bar-likes-widget' src='$src'></iframe>";
479
480
		$node = array(
481
				'id'   => 'admin-bar-likes-widget',
482
				'meta' => array(
483
							'html' => $html
484
				)
485
		);
486
487
		$wp_admin_bar->add_node( $node );
488
	}
489
}
490
491
Jetpack_Likes::init();
492