Completed
Push — master ( 878290...c42111 )
by Gary
02:11
created
react.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	public function __construct() {
13 13
 		$this->enqueue();
14 14
 
15
-		add_action( 'wp_head',     array( $this, 'print_settings' ) );
16
-		add_action( 'wp_footer',   array( $this, 'print_selector' ) );
15
+		add_action('wp_head', array($this, 'print_settings'));
16
+		add_action('wp_footer', array($this, 'print_selector'));
17 17
 
18
- 		add_filter( 'the_content', array( $this, 'the_content'    ) );
18
+ 		add_filter('the_content', array($this, 'the_content'));
19 19
 	}
20 20
 
21 21
 	/**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	public static function init() {
27 27
 		static $instance;
28 28
 
29
-		if ( ! $instance ) {
29
+		if ( ! $instance) {
30 30
 			$instance = new React;
31 31
 		}
32 32
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				window.wp = window.wp || {};
43 43
 				window.wp.react = window.wp.react || {};
44 44
 				window.wp.react.settings = {
45
-					emoji_url: '<?php echo plugins_url( 'emoji.json', __FILE__ ) ?>'
45
+					emoji_url: '<?php echo plugins_url('emoji.json', __FILE__) ?>'
46 46
 				}
47 47
 			</script>
48 48
 		<?php
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 * Enqueue relevant JS and CSS
53 53
 	 */
54 54
 	public function enqueue() {
55
-		wp_enqueue_style( 'react-emoji', plugins_url( 'emoji.css', __FILE__ ) );
55
+		wp_enqueue_style('react-emoji', plugins_url('emoji.css', __FILE__));
56 56
 
57
-		wp_enqueue_script( 'react-emoji', plugins_url( 'emoji.js', __FILE__ ), array(), false, true );
57
+		wp_enqueue_script('react-emoji', plugins_url('emoji.js', __FILE__), array(), false, true);
58 58
 	}
59 59
 
60 60
 	/**
@@ -62,34 +62,34 @@  discard block
 block discarded – undo
62 62
 	 * @param  string $content The content HTML
63 63
 	 * @return string The content HTML, with the react buttons attached
64 64
 	 */
65
-	public function the_content( $content ) {
65
+	public function the_content($content) {
66 66
 		$post_id = get_the_ID();
67
-		if ( ! $post_id ) {
67
+		if ( ! $post_id) {
68 68
 			return $content;
69 69
 		}
70 70
 
71
-		$reactions = get_comments( array(
71
+		$reactions = get_comments(array(
72 72
 			'post_id' => $post_id,
73 73
 			'type'    => 'reaction',
74
-		) );
74
+		));
75 75
 
76 76
 		$reactions_summary = array();
77
-		foreach( $reactions as $reaction ) {
78
-			if ( ! isset( $reactions_summary[ $reaction->comment_content ] ) ) {
79
-				$reactions_summary[ $reaction->comment_content ] = 0;
77
+		foreach ($reactions as $reaction) {
78
+			if ( ! isset($reactions_summary[$reaction->comment_content])) {
79
+				$reactions_summary[$reaction->comment_content] = 0;
80 80
 			}
81 81
 
82
-			$reactions_summary[ $reaction->comment_content ]++;
82
+			$reactions_summary[$reaction->comment_content]++;
83 83
 		}
84 84
 
85 85
 		$content .= '<div class="emoji-reactions">';
86 86
 
87
-		foreach ( $reactions_summary as $emoji => $count ) {
87
+		foreach ($reactions_summary as $emoji => $count) {
88 88
 			$content .= "<div data-emoji='$emoji' data-count='$count' data-post='$post_id' class='emoji-reaction'><div class='emoji'>$emoji</div><div class='count'>$count</div>";
89 89
 		}
90 90
 
91 91
 		/* translators: This is the emoji used for the "Add new emoji reaction" button */
92
-		$content .= '<div data-post="$post_id" class="emoji-reaction-add"><div class="emoji">' . __( '
Please login to merge, or discard this patch.