Completed
Push — master ( e7ef90...760553 )
by J.D.
03:28
created
src/components/points/classes/shortcode/top/users.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@
 block discarded – undo
36 36
 	 */
37 37
 	protected function verify_atts() {
38 38
 
39
-		if ( ! wordpoints_posint( $this->atts['users'] ) ) {
39
+		if ( ! wordpoints_posint($this->atts['users'])) {
40 40
 			return sprintf(
41 41
 				// translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage.
42
-				__( 'The “%1$s” attribute of the %2$s shortcode must be a positive integer. Example: %3$s.', 'wordpoints' )
42
+				__('The “%1$s” attribute of the %2$s shortcode must be a positive integer. Example: %3$s.', 'wordpoints')
43 43
 				, 'users'
44
-				, '<code>[' . sanitize_key( $this->shortcode ) . ']</code>'
45
-				, '<code>[' . sanitize_key( $this->shortcode ) . ' <b>users="10"</b> type="points"]</code>'
44
+				, '<code>[' . sanitize_key($this->shortcode) . ']</code>'
45
+				, '<code>[' . sanitize_key($this->shortcode) . ' <b>users="10"</b> type="points"]</code>'
46 46
 			);
47 47
 		}
48 48
 
Please login to merge, or discard this patch.
src/components/points/classes/shortcode/htgp.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -43,34 +43,34 @@  discard block
 block discarded – undo
43 43
 		 * @param string[] $extra_classes The extra classes for the table element.
44 44
 		 * @param array    $atts          The arguments for table display from the shortcode.
45 45
 		 */
46
-		$extra_classes = apply_filters( 'wordpoints_how_to_get_points_table_extra_classes', array(), $this->atts );
46
+		$extra_classes = apply_filters('wordpoints_how_to_get_points_table_extra_classes', array(), $this->atts);
47 47
 
48
-		$points_heading = _x( 'Points', 'column name', 'wordpoints' );
48
+		$points_heading = _x('Points', 'column name', 'wordpoints');
49 49
 
50 50
 		$points_type_name = wordpoints_get_points_type_setting(
51 51
 			$this->atts['points_type']
52 52
 			, 'name'
53 53
 		);
54 54
 
55
-		if ( ! empty( $points_type_name ) ) {
55
+		if ( ! empty($points_type_name)) {
56 56
 			$points_heading = $points_type_name;
57 57
 		}
58 58
 
59
-		$html = '<table class="wordpoints-how-to-get-points ' . esc_attr( implode( ' ', $extra_classes ) ) . '">
59
+		$html = '<table class="wordpoints-how-to-get-points ' . esc_attr(implode(' ', $extra_classes)) . '">
60 60
 			<thead>
61
-				<tr><th style="padding-right: 10px">' . esc_html( $points_heading ) . '</th>
62
-				<th>' . esc_html_x( 'Action', 'column name', 'wordpoints' ) . '</th></tr>
61
+				<tr><th style="padding-right: 10px">' . esc_html($points_heading) . '</th>
62
+				<th>' . esc_html_x('Action', 'column name', 'wordpoints') . '</th></tr>
63 63
 			</thead>
64 64
 			<tbody>';
65 65
 
66
-		$html .= $this->list_reactions( 'points' );
66
+		$html .= $this->list_reactions('points');
67 67
 		$html .= $this->list_points_hooks();
68 68
 
69
-		if ( is_wordpoints_network_active() ) {
69
+		if (is_wordpoints_network_active()) {
70 70
 
71
-			WordPoints_Points_Hooks::set_network_mode( true );
71
+			WordPoints_Points_Hooks::set_network_mode(true);
72 72
 			$html .= $this->list_points_hooks();
73
-			WordPoints_Points_Hooks::set_network_mode( false );
73
+			WordPoints_Points_Hooks::set_network_mode(false);
74 74
 		}
75 75
 
76 76
 		$html .= '</tbody></table>';
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 		$network = '';
92 92
 
93
-		if ( WordPoints_Points_Hooks::get_network_mode() ) {
93
+		if (WordPoints_Points_Hooks::get_network_mode()) {
94 94
 			$network = 'network_';
95 95
 		}
96 96
 
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
 
101 101
 		$html = '';
102 102
 
103
-		foreach ( $hooks as $hook_id ) {
103
+		foreach ($hooks as $hook_id) {
104 104
 
105
-			$hook = WordPoints_Points_Hooks::get_handler( $hook_id );
105
+			$hook = WordPoints_Points_Hooks::get_handler($hook_id);
106 106
 
107
-			if ( ! $hook ) {
107
+			if ( ! $hook) {
108 108
 				continue;
109 109
 			}
110 110
 
111
-			$points = $hook->get_points( $network . $hook->get_number() );
111
+			$points = $hook->get_points($network . $hook->get_number());
112 112
 
113
-			if ( ! $points ) {
113
+			if ( ! $points) {
114 114
 				continue;
115 115
 			}
116 116
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 			$html .= '<tr>
124 124
 				<td>' . $points . '</td>
125
-				<td>' . esc_html( $hook->get_description() ) . '</td>
125
+				<td>' . esc_html($hook->get_description()) . '</td>
126 126
 				</tr>';
127 127
 		}
128 128
 
@@ -142,21 +142,21 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string The HTML for the table rows.
144 144
 	 */
145
-	protected function list_reactions( $store_slug ) {
145
+	protected function list_reactions($store_slug) {
146 146
 
147 147
 		$html = '';
148 148
 
149
-		foreach ( wordpoints_hooks()->get_reaction_stores( $store_slug ) as $store ) {
149
+		foreach (wordpoints_hooks()->get_reaction_stores($store_slug) as $store) {
150 150
 
151
-			foreach ( $store->get_reactions() as $reaction ) {
151
+			foreach ($store->get_reactions() as $reaction) {
152 152
 
153
-				if ( $reaction->get_meta( 'points_type' ) !== $this->atts['points_type'] ) {
153
+				if ($reaction->get_meta('points_type') !== $this->atts['points_type']) {
154 154
 					continue;
155 155
 				}
156 156
 
157
-				$points = $reaction->get_meta( 'points' );
157
+				$points = $reaction->get_meta('points');
158 158
 
159
-				if ( ! $points ) {
159
+				if ( ! $points) {
160 160
 					continue;
161 161
 				}
162 162
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 				$html .= '<tr>
170 170
 					<td>' . $points . '</td>
171
-					<td>' . esc_html( $reaction->get_meta( 'description' ) ) . '</td>
171
+					<td>' . esc_html($reaction->get_meta('description')) . '</td>
172 172
 					</tr>';
173 173
 			}
174 174
 		}
Please login to merge, or discard this patch.
src/components/points/classes/shortcode/logs.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,26 +40,26 @@
 block discarded – undo
40 40
 	 */
41 41
 	protected function verify_atts() {
42 42
 
43
-		if ( ! wordpoints_is_points_logs_query( $this->atts['query'] ) ) {
43
+		if ( ! wordpoints_is_points_logs_query($this->atts['query'])) {
44 44
 			return sprintf(
45 45
 				// translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage.
46
-				__( 'The &#8220;%1$s&#8221; attribute of the %2$s shortcode must be the slug of a registered points log query. Example: %3$s.', 'wordpoints' )
46
+				__('The &#8220;%1$s&#8221; attribute of the %2$s shortcode must be the slug of a registered points log query. Example: %3$s.', 'wordpoints')
47 47
 				, 'query'
48
-				, '<code>[' . sanitize_key( $this->shortcode ) . ']</code>'
49
-				, '<code>[' . sanitize_key( $this->shortcode ) . ' <b>query="default"</b> points_type="points"]</code>'
48
+				, '<code>[' . sanitize_key($this->shortcode) . ']</code>'
49
+				, '<code>[' . sanitize_key($this->shortcode) . ' <b>query="default"</b> points_type="points"]</code>'
50 50
 			);
51 51
 		}
52 52
 
53
-		if ( false === wordpoints_int( $this->atts['paginate'] ) ) {
53
+		if (false === wordpoints_int($this->atts['paginate'])) {
54 54
 			$this->atts['paginate'] = 1;
55 55
 		}
56 56
 
57 57
 		// Back-compat. Needs to stay here "forever" for legacy installs.
58
-		if ( isset( $this->atts['datatables'] ) ) {
59
-			$this->atts['paginate'] = wordpoints_int( $this->atts['datatables'] );
58
+		if (isset($this->atts['datatables'])) {
59
+			$this->atts['paginate'] = wordpoints_int($this->atts['datatables']);
60 60
 		}
61 61
 
62
-		if ( false === wordpoints_int( $this->atts['show_users'] ) ) {
62
+		if (false === wordpoints_int($this->atts['show_users'])) {
63 63
 			$this->atts['show_users'] = 1;
64 64
 		}
65 65
 
Please login to merge, or discard this patch.
src/components/points/classes/widget/user/points.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -30,47 +30,47 @@  discard block
 block discarded – undo
30 30
 
31 31
 		parent::__construct(
32 32
 			'WordPoints_Points_Widget'
33
-			, __( 'WordPoints', 'wordpoints' )
33
+			, __('WordPoints', 'wordpoints')
34 34
 			, array(
35
-				'description' => __( 'Display the points of the current logged in user.', 'wordpoints' ),
35
+				'description' => __('Display the points of the current logged in user.', 'wordpoints'),
36 36
 				'wordpoints_hook_slug' => 'points',
37 37
 			)
38 38
 		);
39 39
 
40 40
 		$this->defaults = array(
41
-			'title'       => _x( 'My Points', 'widget title', 'wordpoints' ),
41
+			'title'       => _x('My Points', 'widget title', 'wordpoints'),
42 42
 			'points_type' => wordpoints_get_default_points_type(),
43 43
 			// translators: Number of points.
44
-			'text'        => sprintf( __( 'Points: %s', 'wordpoints' ), '%points%' ),
45
-			'alt_text'    => __( 'You must be logged in to view your points.', 'wordpoints' ),
44
+			'text'        => sprintf(__('Points: %s', 'wordpoints'), '%points%'),
45
+			'alt_text'    => __('You must be logged in to view your points.', 'wordpoints'),
46 46
 			'number_logs' => 5,
47 47
 		);
48 48
 
49
-		add_filter( 'wordpoints_points_widget_text', 'esc_html', 20 );
49
+		add_filter('wordpoints_points_widget_text', 'esc_html', 20);
50 50
 	}
51 51
 
52 52
 	/**
53 53
 	 * @since 1.9.0 As part of WordPoints_My_Points_Widget.
54 54
 	 * @since 2.3.0
55 55
 	 */
56
-	protected function verify_settings( $instance ) {
56
+	protected function verify_settings($instance) {
57 57
 
58
-		if ( ! is_user_logged_in() && empty( $instance['alt_text'] ) ) {
58
+		if ( ! is_user_logged_in() && empty($instance['alt_text'])) {
59 59
 			return new WP_Error;
60 60
 		}
61 61
 
62 62
 		if (
63
-			! isset( $instance['number_logs'] )
64
-			|| ! wordpoints_posint( $instance['number_logs'] )
63
+			! isset($instance['number_logs'])
64
+			|| ! wordpoints_posint($instance['number_logs'])
65 65
 		) {
66 66
 			$instance['number_logs'] = 0;
67 67
 		}
68 68
 
69 69
 		// In case the points type isn't set, we do this first.
70
-		$instance = parent::verify_settings( $instance );
70
+		$instance = parent::verify_settings($instance);
71 71
 
72
-		if ( ! is_wp_error( $instance ) && is_user_logged_in() && empty( $instance['text'] ) ) {
73
-			$instance['text'] = wordpoints_get_points_type_setting( $instance['points_type'], 'name' ) . ': %points%';
72
+		if ( ! is_wp_error($instance) && is_user_logged_in() && empty($instance['text'])) {
73
+			$instance['text'] = wordpoints_get_points_type_setting($instance['points_type'], 'name') . ': %points%';
74 74
 		}
75 75
 
76 76
 		return $instance;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 * @since 1.9.0 As part of WordPoints_My_Points_Widget.
81 81
 	 * @since 2.3.0
82 82
 	 */
83
-	protected function widget_body( $instance ) {
83
+	protected function widget_body($instance) {
84 84
 
85
-		if ( is_user_logged_in() ) {
85
+		if (is_user_logged_in()) {
86 86
 
87 87
 			$text = str_replace(
88 88
 				'%points%',
89 89
 				wordpoints_format_points(
90
-					wordpoints_get_points( get_current_user_id(), $instance['points_type'] ),
90
+					wordpoints_get_points(get_current_user_id(), $instance['points_type']),
91 91
 					$instance['points_type'],
92 92
 					'my_points_widget'
93 93
 				),
@@ -113,20 +113,20 @@  discard block
 block discarded – undo
113 113
 		 * @param string $text The text for the widget set by the user.
114 114
 		 * @param array  $instance The settings for this instance of the widget.
115 115
 		 */
116
-		$text = apply_filters( 'wordpoints_points_widget_text', $text, $instance );
116
+		$text = apply_filters('wordpoints_points_widget_text', $text, $instance);
117 117
 
118 118
 		echo '<div class="wordpoints-points-widget-text">', $text, '</div><br />'; // XSS OK, WPCS
119 119
 
120
-		if ( is_user_logged_in() && 0 !== $instance['number_logs'] ) {
120
+		if (is_user_logged_in() && 0 !== $instance['number_logs']) {
121 121
 
122
-			$query_args = wordpoints_get_points_logs_query_args( $instance['points_type'], 'current_user' );
122
+			$query_args = wordpoints_get_points_logs_query_args($instance['points_type'], 'current_user');
123 123
 
124 124
 			$query_args['limit'] = $instance['number_logs'];
125 125
 
126
-			$logs_query = new WordPoints_Points_Logs_Query( $query_args );
127
-			$logs_query->prime_cache( 'current_user:%points_type%:%user_id%' );
126
+			$logs_query = new WordPoints_Points_Logs_Query($query_args);
127
+			$logs_query->prime_cache('current_user:%points_type%:%user_id%');
128 128
 
129
-			wordpoints_show_points_logs( $logs_query, array( 'paginate' => false, 'searchable' => false, 'show_users' => false ) );
129
+			wordpoints_show_points_logs($logs_query, array('paginate' => false, 'searchable' => false, 'show_users' => false));
130 130
 		}
131 131
 	}
132 132
 
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @return array The updated settings for the widget instance.
143 143
 	 */
144
-	public function update( $new_instance, $old_instance ) {
144
+	public function update($new_instance, $old_instance) {
145 145
 
146
-		parent::update( $new_instance, $old_instance );
146
+		parent::update($new_instance, $old_instance);
147 147
 
148
-		$this->instance['text']     = trim( $this->instance['text'] );
149
-		$this->instance['alt_text'] = trim( $this->instance['alt_text'] );
148
+		$this->instance['text']     = trim($this->instance['text']);
149
+		$this->instance['alt_text'] = trim($this->instance['alt_text']);
150 150
 
151
-		if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) {
151
+		if ( ! wordpoints_posint($this->instance['number_logs'])) {
152 152
 			$this->instance['number_logs'] = 0;
153 153
 		}
154 154
 
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 	 * @since 1.0.0 As part of WordPoints_My_Points_Widget.
160 160
 	 * @since 2.3.0
161 161
 	 */
162
-	public function form( $instance ) {
162
+	public function form($instance) {
163 163
 
164
-		parent::form( $instance );
164
+		parent::form($instance);
165 165
 
166 166
 		?>
167 167
 
168 168
 		<p>
169
-			<label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Widget text', 'wordpoints' ); ?></label>
170
-			<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>" value="<?php echo esc_attr( $this->instance['text'] ); ?>" />
169
+			<label for="<?php echo esc_attr($this->get_field_id('text')); ?>"><?php esc_html_e('Widget text', 'wordpoints'); ?></label>
170
+			<input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('text')); ?>" name="<?php echo esc_attr($this->get_field_name('text')); ?>" value="<?php echo esc_attr($this->instance['text']); ?>" />
171 171
 			<?php // translators: Placeholder name. ?>
172
-			<small><i><?php echo esc_html( sprintf( __( '%s will be replaced with the points of the logged in user', 'wordpoints' ), '%points%' ) ); ?></i></small>
172
+			<small><i><?php echo esc_html(sprintf(__('%s will be replaced with the points of the logged in user', 'wordpoints'), '%points%')); ?></i></small>
173 173
 			<?php
174 174
 
175 175
 			/**
@@ -179,19 +179,19 @@  discard block
 block discarded – undo
179 179
 			 *
180 180
 			 * @param array $instance The settings of the current widget instance.
181 181
 			 */
182
-			do_action( 'wordpoints_my_points_widget_below_text_field', $this->instance );
182
+			do_action('wordpoints_my_points_widget_below_text_field', $this->instance);
183 183
 
184 184
 			?>
185 185
 		</p>
186 186
 		<p>
187
-			<label for="<?php echo esc_attr( $this->get_field_id( 'alt_text' ) ); ?>"><?php esc_html_e( 'Text if the user is not logged in', 'wordpoints' ); ?></label>
188
-			<input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'alt_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'alt_text' ) ); ?>" value="<?php echo esc_attr( $this->instance['alt_text'] ); ?>" />
189
-			<small><i><?php esc_html_e( 'Leave this field blank to hide the widget if the user is not logged in', 'wordpoints' ); ?></i></small>
187
+			<label for="<?php echo esc_attr($this->get_field_id('alt_text')); ?>"><?php esc_html_e('Text if the user is not logged in', 'wordpoints'); ?></label>
188
+			<input type="text" class="widefat" id="<?php echo esc_attr($this->get_field_id('alt_text')); ?>" name="<?php echo esc_attr($this->get_field_name('alt_text')); ?>" value="<?php echo esc_attr($this->instance['alt_text']); ?>" />
189
+			<small><i><?php esc_html_e('Leave this field blank to hide the widget if the user is not logged in', 'wordpoints'); ?></i></small>
190 190
 		</p>
191 191
 		<p>
192
-			<label for="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>"><?php esc_html_e( 'Number of latest log entries for this user to display', 'wordpoints' ); ?></label>
193
-			<input type="number" min="0" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number_logs' ) ); ?>" value="<?php echo esc_attr( $this->instance['number_logs'] ); ?>" />
194
-			<small><i><?php esc_html_e( 'Set this to 0 to keep from showing any logs', 'wordpoints' ); ?></i></small>
192
+			<label for="<?php echo esc_attr($this->get_field_id('number_logs')); ?>"><?php esc_html_e('Number of latest log entries for this user to display', 'wordpoints'); ?></label>
193
+			<input type="number" min="0" class="widefat" id="<?php echo esc_attr($this->get_field_id('number_logs')); ?>" name="<?php echo esc_attr($this->get_field_name('number_logs')); ?>" value="<?php echo esc_attr($this->instance['number_logs']); ?>" />
194
+			<small><i><?php esc_html_e('Set this to 0 to keep from showing any logs', 'wordpoints'); ?></i></small>
195 195
 		</p>
196 196
 
197 197
 		<?php
Please login to merge, or discard this patch.
src/components/points/classes/widget/top/users.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 
31 31
 		parent::__construct(
32 32
 			'WordPoints_Top_Users_Widget'
33
-			, _x( 'WordPoints Top Users', 'widget name', 'wordpoints' )
33
+			, _x('WordPoints Top Users', 'widget name', 'wordpoints')
34 34
 			, array(
35
-				'description' => __( 'Showcase the users with the most points.', 'wordpoints' ),
35
+				'description' => __('Showcase the users with the most points.', 'wordpoints'),
36 36
 				'wordpoints_hook_slug' => 'top_users',
37 37
 			)
38 38
 		);
39 39
 
40 40
 		$this->defaults = array(
41
-			'title'       => _x( 'Top Users', 'widget title', 'wordpoints' ),
41
+			'title'       => _x('Top Users', 'widget title', 'wordpoints'),
42 42
 			'points_type' => wordpoints_get_default_points_type(),
43 43
 			'num_users'   => 3,
44 44
 		);
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 	 * @since 1.9.0 As part of WordPoints_Top_Users_Points_Widget.
49 49
 	 * @since 2.3.0
50 50
 	 */
51
-	protected function verify_settings( $instance ) {
51
+	protected function verify_settings($instance) {
52 52
 
53
-		if ( empty( $instance['num_users'] ) ) {
53
+		if (empty($instance['num_users'])) {
54 54
 			$instance['num_users'] = $this->defaults['num_users'];
55 55
 		}
56 56
 
57
-		return parent::verify_settings( $instance );
57
+		return parent::verify_settings($instance);
58 58
 	}
59 59
 
60 60
 	/**
61 61
 	 * @since 1.9.0 As part of WordPoints_Top_Users_Points_Widget.
62 62
 	 * @since 2.3.0
63 63
 	 */
64
-	protected function widget_body( $instance ) {
64
+	protected function widget_body($instance) {
65 65
 
66 66
 		wordpoints_points_show_top_users(
67 67
 			$instance['num_users']
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return array The updated settings for the widget instance.
83 83
 	 */
84
-	public function update( $new_instance, $old_instance ) {
84
+	public function update($new_instance, $old_instance) {
85 85
 
86
-		parent::update( $new_instance, $old_instance );
86
+		parent::update($new_instance, $old_instance);
87 87
 
88
-		if ( ! wordpoints_posint( $this->instance['num_users'] ) ) {
88
+		if ( ! wordpoints_posint($this->instance['num_users'])) {
89 89
 			$this->instance['num_users'] = $this->defaults['num_users'];
90 90
 		}
91 91
 
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
 	 * @since 1.0.0 As part of WordPoints_Top_Users_Points_Widget.
97 97
 	 * @since 2.3.0
98 98
 	 */
99
-	public function form( $instance ) {
99
+	public function form($instance) {
100 100
 
101
-		parent::form( $instance );
101
+		parent::form($instance);
102 102
 
103
-		if ( ! wordpoints_posint( $this->instance['num_users'] ) ) {
103
+		if ( ! wordpoints_posint($this->instance['num_users'])) {
104 104
 			$this->instance['num_users'] = $this->defaults['num_users'];
105 105
 		}
106 106
 
107 107
 		?>
108 108
 
109 109
 		<p>
110
-			<label for="<?php echo esc_attr( $this->get_field_id( 'num_users' ) ); ?>"><?php esc_html_e( 'Number of top users to show', 'wordpoints' ); ?></label>
111
-			<input type="number" min="1" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'num_users' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'num_users' ) ); ?>" value="<?php echo absint( $this->instance['num_users'] ); ?>" />
110
+			<label for="<?php echo esc_attr($this->get_field_id('num_users')); ?>"><?php esc_html_e('Number of top users to show', 'wordpoints'); ?></label>
111
+			<input type="number" min="1" class="widefat" id="<?php echo esc_attr($this->get_field_id('num_users')); ?>" name="<?php echo esc_attr($this->get_field_name('num_users')); ?>" value="<?php echo absint($this->instance['num_users']); ?>" />
112 112
 		</p>
113 113
 
114 114
 		<?php
Please login to merge, or discard this patch.
src/components/points/classes/widget/logs.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 		parent::__construct(
27 27
 			'WordPoints_Points_Logs_Widget'
28
-			, _x( 'Points Logs', 'widget name', 'wordpoints' )
28
+			, _x('Points Logs', 'widget name', 'wordpoints')
29 29
 			, array(
30
-				'description' => __( 'Display the latest points activity.', 'wordpoints' ),
30
+				'description' => __('Display the latest points activity.', 'wordpoints'),
31 31
 				'wordpoints_hook_slug' => 'points_logs',
32 32
 			)
33 33
 		);
34 34
 
35 35
 		$this->defaults = array(
36
-			'title'       => _x( 'Points Logs', 'widget title', 'wordpoints' ),
36
+			'title'       => _x('Points Logs', 'widget title', 'wordpoints'),
37 37
 			'number_logs' => 10,
38 38
 			'points_type' => wordpoints_get_default_points_type(),
39 39
 		);
@@ -43,29 +43,29 @@  discard block
 block discarded – undo
43 43
 	 * @since 1.9.0 As part of WordPoints_Points_Logs_Widget.
44 44
 	 * @since 2.3.0
45 45
 	 */
46
-	protected function verify_settings( $instance ) {
46
+	protected function verify_settings($instance) {
47 47
 
48
-		if ( ! wordpoints_posint( $instance['number_logs'] ) ) {
48
+		if ( ! wordpoints_posint($instance['number_logs'])) {
49 49
 			$instance['number_logs'] = $this->defaults['number_logs'];
50 50
 		}
51 51
 
52
-		return parent::verify_settings( $instance );
52
+		return parent::verify_settings($instance);
53 53
 	}
54 54
 
55 55
 	/**
56 56
 	 * @since 1.9.0 As part of WordPoints_Points_Logs_Widget.
57 57
 	 * @since 2.3.0
58 58
 	 */
59
-	public function widget_body( $instance ) {
59
+	public function widget_body($instance) {
60 60
 
61
-		$query_args = wordpoints_get_points_logs_query_args( $instance['points_type'] );
61
+		$query_args = wordpoints_get_points_logs_query_args($instance['points_type']);
62 62
 
63 63
 		$query_args['limit'] = $instance['number_logs'];
64 64
 
65
-		$logs_query = new WordPoints_Points_Logs_Query( $query_args );
65
+		$logs_query = new WordPoints_Points_Logs_Query($query_args);
66 66
 		$logs_query->prime_cache();
67 67
 
68
-		wordpoints_show_points_logs( $logs_query, array( 'paginate' => false, 'searchable' => false ) );
68
+		wordpoints_show_points_logs($logs_query, array('paginate' => false, 'searchable' => false));
69 69
 	}
70 70
 
71 71
 	/**
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @return array The updated settings for the widget instance.
81 81
 	 */
82
-	public function update( $new_instance, $old_instance ) {
82
+	public function update($new_instance, $old_instance) {
83 83
 
84
-		parent::update( $new_instance, $old_instance );
84
+		parent::update($new_instance, $old_instance);
85 85
 
86
-		if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) {
86
+		if ( ! wordpoints_posint($this->instance['number_logs'])) {
87 87
 			$this->instance['number_logs'] = $this->defaults['number_logs'];
88 88
 		}
89 89
 
@@ -94,19 +94,19 @@  discard block
 block discarded – undo
94 94
 	 * @since 1.0.0 As part of WordPoints_Points_Logs_Widget.
95 95
 	 * @since 2.3.0
96 96
 	 */
97
-	public function form( $instance ) {
97
+	public function form($instance) {
98 98
 
99
-		parent::form( $instance );
99
+		parent::form($instance);
100 100
 
101
-		if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) {
101
+		if ( ! wordpoints_posint($this->instance['number_logs'])) {
102 102
 			$this->instance['number_logs'] = $this->defaults['number_logs'];
103 103
 		}
104 104
 
105 105
 		?>
106 106
 
107 107
 		<p>
108
-			<label for="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>"><?php esc_html_e( 'Number of log entries to display', 'wordpoints' ); ?></label>
109
-			<input type="number" min="1" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number_logs' ) ); ?>" value="<?php echo absint( $this->instance['number_logs'] ); ?>" />
108
+			<label for="<?php echo esc_attr($this->get_field_id('number_logs')); ?>"><?php esc_html_e('Number of log entries to display', 'wordpoints'); ?></label>
109
+			<input type="number" min="1" class="widefat" id="<?php echo esc_attr($this->get_field_id('number_logs')); ?>" name="<?php echo esc_attr($this->get_field_name('number_logs')); ?>" value="<?php echo absint($this->instance['number_logs']); ?>" />
110 110
 		</p>
111 111
 
112 112
 		<?php
Please login to merge, or discard this patch.
src/components/points/classes/log/queries.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	private static function init() {
57 57
 
58
-		if ( self::$initialized ) {
58
+		if (self::$initialized) {
59 59
 			return;
60 60
 		}
61 61
 
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		 *
68 68
 		 * @since 1.0.0
69 69
 		 */
70
-		do_action( 'wordpoints_register_points_logs_queries' );
70
+		do_action('wordpoints_register_points_logs_queries');
71 71
 
72 72
 		// Make sure that the default query is registered.
73
-		self::register_query( 'default', array(), array( 'cache_queries' => true ) );
73
+		self::register_query('default', array(), array('cache_queries' => true));
74 74
 
75 75
 		self::$initialized = true;
76 76
 	}
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return bool Whether the query was registered.
91 91
 	 */
92
-	public static function register_query( $slug, array $args, array $data = array() ) {
92
+	public static function register_query($slug, array $args, array $data = array()) {
93 93
 
94
-		if ( empty( $slug ) || isset( self::$queries[ $slug ] ) ) {
94
+		if (empty($slug) || isset(self::$queries[$slug])) {
95 95
 			return false;
96 96
 		}
97 97
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 			'network_wide'  => false,
102 102
 		);
103 103
 
104
-		self::$queries[ $slug ] = array_merge( $defaults, $data );
105
-		self::$queries[ $slug ]['args'] = $args;
104
+		self::$queries[$slug] = array_merge($defaults, $data);
105
+		self::$queries[$slug]['args'] = $args;
106 106
 
107 107
 		return true;
108 108
 	}
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return bool Whether $slug is the slug of a registered query.
118 118
 	 */
119
-	public static function is_query( $slug ) {
119
+	public static function is_query($slug) {
120 120
 
121 121
 		self::init();
122 122
 
123
-		return isset( self::$queries[ $slug ] );
123
+		return isset(self::$queries[$slug]);
124 124
 	}
125 125
 
126 126
 	/**
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return array The query's args.
148 148
 	 */
149
-	public static function get_query_args( $query_slug ) {
149
+	public static function get_query_args($query_slug) {
150 150
 
151
-		return self::get_query_data( $query_slug, 'args' );
151
+		return self::get_query_data($query_slug, 'args');
152 152
 	}
153 153
 
154 154
 	/**
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return mixed The data, or null if not found.
164 164
 	 */
165
-	public static function get_query_data( $query_slug, $data = null ) {
165
+	public static function get_query_data($query_slug, $data = null) {
166 166
 
167 167
 		self::init();
168 168
 
169
-		if ( isset( self::$queries[ $query_slug ] ) ) {
169
+		if (isset(self::$queries[$query_slug])) {
170 170
 
171
-			if ( empty( $data ) ) {
172
-				return self::$queries[ $query_slug ];
173
-			} elseif ( isset( self::$queries[ $query_slug ][ $data ] ) ) {
174
-				return self::$queries[ $query_slug ][ $data ];
171
+			if (empty($data)) {
172
+				return self::$queries[$query_slug];
173
+			} elseif (isset(self::$queries[$query_slug][$data])) {
174
+				return self::$queries[$query_slug][$data];
175 175
 			}
176 176
 		}
177 177
 
Please login to merge, or discard this patch.