Completed
Push — develop ( 578953...555ad7 )
by Zack
26:20 queued 13:08
created
plugin-and-theme-hooks/class-gravityview-plugin-hooks-pageviews.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 		parent::add_hooks();
44 44
 
45
-		add_shortcode( 'gv_pageviews', array( $this, 'pageviews') );
45
+		add_shortcode( 'gv_pageviews', array( $this, 'pageviews' ) );
46 46
 
47 47
 		add_filter( 'gravityview/fields/custom/decode_shortcodes', array( $this, 'inject_entry_id' ), 10, 3 );
48 48
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * Used as sort of an action via the gravityview/fields/custom/decode_shortcodes filter.
69 69
 	 */
70 70
 	public function inject_entry_id( $r, $content, $context ) {
71
-		if ( ! empty( $context->entry['id'] ) ) {
72
-			$this->next_id = $context->entry['id'];
71
+		if ( ! empty( $context->entry[ 'id' ] ) ) {
72
+			$this->next_id = $context->entry[ 'id' ];
73 73
 		} else {
74 74
 			$this->next_id = false; // Nothing to look at, move along
75 75
 		}
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 			'id'        => $this->next_id,
98 98
 		), $atts );
99 99
 
100
-		if ( ! $this->atts['id'] ) {
100
+		if ( ! $this->atts[ 'id' ] ) {
101 101
 			return; // The ID was not set
102 102
 		}
103 103
 
104 104
 		add_filter( 'pageviews_placeholder_preload', array( $this, 'preload_callback' ) );
105 105
 
106
-		$output = Pageviews::placeholder( 'GV' . $this->atts['id'] ); // Prefix the ID to avoid collissions with default post IDs
106
+		$output = Pageviews::placeholder( 'GV' . $this->atts[ 'id' ] ); // Prefix the ID to avoid collissions with default post IDs
107 107
 
108 108
 		remove_filter( 'pageviews_placeholder_preload', array( $this, 'preload_callback' ) );
109 109
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * Set the preload text.
115 115
 	 */
116 116
 	public function preload_callback( $preload ) {
117
-		return $this->atts['preload'];
117
+		return $this->atts[ 'preload' ];
118 118
 	}
119 119
 
120 120
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function increment_callback() {
124 124
 		if ( $entry = gravityview()->request->is_entry() ) {
125
-			$increment = 'GV' . $entry['id'];
125
+			$increment = 'GV' . $entry[ 'id' ];
126 126
 			?>
127 127
 				_pv_config.incr = <?php echo json_encode( $increment ); ?>;
128 128
 			<?php
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gvlogic.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -248,6 +248,8 @@
 block discarded – undo
248 248
 
249 249
 	/**
250 250
 	 * Process the attributes passed to the shortcode. Make sure they're valid
251
+	 * @param string $content
252
+	 * @param string $tag
251 253
 	 * @return void
252 254
 	 */
253 255
 	private function parse_atts( $atts, $content, $tag ) {
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 		$value    = $this->get_value( $atts );
58 58
 
59 59
 		if ( false === $operator && is_null( $value ) ) {
60
-			if ( false !== $atts['if'] ) { // Only-if test
61
-				$match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) );
60
+			if ( false !== $atts[ 'if' ] ) { // Only-if test
61
+				$match = $authed && ! in_array( strtolower( $atts[ 'if' ] ), array( '', '0', 'false', 'no' ) );
62 62
 			} else {
63 63
 				$match = $authed; // Just login test
64 64
 			}
65 65
 		} else { // Regular test
66
-			$match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator );
66
+			$match = $authed && \GVCommon::matches_operation( $atts[ 'if' ], $value, $operator );
67 67
 		}
68 68
 
69 69
 		// Output and get recursive!
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @return bool Yes, or no.
82 82
 	 */
83 83
 	private function authorized( $atts ) {
84
-		if ( is_null( $needs_login  = \GV\Utils::get( $atts, 'logged_in', null ) ) ) {
84
+		if ( is_null( $needs_login = \GV\Utils::get( $atts, 'logged_in', null ) ) ) {
85 85
 			return true; // No auth requirements have been set
86 86
 		}
87 87
 		return ! $needs_login ^ is_user_logged_in(); // XNOR
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @return string The output.
144 144
 	 */
145 145
 	private function get_output( $match, $atts, $content ) {
146
-		if ( ! $match && ! empty( $atts['else'] ) ) {
147
-			return $atts['else']; // Attributized else is easy :)
146
+		if ( ! $match && ! empty( $atts[ 'else' ] ) ) {
147
+			return $atts[ 'else' ]; // Attributized else is easy :)
148 148
 		}
149 149
 
150 150
 		$if = '';
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 		$atts = array_intersect_key( $supplied_atts, $atts );
268 268
 
269 269
 		// Strip whitespace if it's not default false
270
-		if ( isset( $atts['if'] ) && is_string( $atts['if'] ) ) {
271
-			$atts['if'] = trim( $atts['if'] );
270
+		if ( isset( $atts[ 'if' ] ) && is_string( $atts[ 'if' ] ) ) {
271
+			$atts[ 'if' ] = trim( $atts[ 'if' ] );
272 272
 		} else {
273
-			$atts['if'] = false;
273
+			$atts[ 'if' ] = false;
274 274
 		}
275 275
 
276
-		if ( isset( $atts['logged_in'] ) ) {
276
+		if ( isset( $atts[ 'logged_in' ] ) ) {
277 277
 			// Truthy
278
-			if ( in_array( strtolower( $atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) {
279
-				$atts['logged_in'] = false;
278
+			if ( in_array( strtolower( $atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) {
279
+				$atts[ 'logged_in' ] = false;
280 280
 			} else {
281
-				$atts['logged_in'] = true;
281
+				$atts[ 'logged_in' ] = true;
282 282
 			}
283 283
 		}
284 284
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,12 +57,14 @@  discard block
 block discarded – undo
57 57
 		$value    = $this->get_value( $atts );
58 58
 
59 59
 		if ( false === $operator && is_null( $value ) ) {
60
-			if ( false !== $atts['if'] ) { // Only-if test
60
+			if ( false !== $atts['if'] ) {
61
+// Only-if test
61 62
 				$match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) );
62 63
 			} else {
63 64
 				$match = $authed; // Just login test
64 65
 			}
65
-		} else { // Regular test
66
+		} else {
67
+// Regular test
66 68
 			$match = $authed && \GVCommon::matches_operation( $atts['if'], $value, $operator );
67 69
 		}
68 70
 
@@ -153,11 +155,14 @@  discard block
 block discarded – undo
153 155
 		$opens = 0; // inner opens
154 156
 		$found = false; // found split position
155 157
 
156
-		while ( $content ) { // scan
158
+		while ( $content ) {
159
+// scan
157 160
 			if ( ! preg_match( '#(.*?)(\[\/?(gvlogic|else).*?])(.*)#', $content, $matches ) ) {
158
-				if ( ! $found ) { // We're still iffing.
161
+				if ( ! $found ) {
162
+// We're still iffing.
159 163
 					$if .= $content;
160
-				} else { // We are elsing
164
+				} else {
165
+// We are elsing
161 166
 					$else .= $content;
162 167
 				}
163 168
 				break; // No more shortcodes
@@ -165,9 +170,11 @@  discard block
 block discarded – undo
165 170
 
166 171
 			list( $_, $before_shortcode, $shortcode, $_, $after_shortcode ) = $matches;
167 172
 
168
-			if ( ! $found ) { // We're still iffing.
173
+			if ( ! $found ) {
174
+// We're still iffing.
169 175
 				$if .= $before_shortcode;
170
-			} else { // We are elsing
176
+			} else {
177
+// We are elsing
171 178
 				$else .= $before_shortcode;
172 179
 			}
173 180
 
@@ -191,9 +198,11 @@  discard block
 block discarded – undo
191 198
 				}
192 199
 
193 200
 				// Tack on the shortcode
194
-				if ( ! $found ) { // We're still iffing.
201
+				if ( ! $found ) {
202
+// We're still iffing.
195 203
 					$if .= $shortcode;
196
-				} else { // We are elsing
204
+				} else {
205
+// We are elsing
197 206
 					$else .= $shortcode;
198 207
 				}
199 208
 			}
Please login to merge, or discard this patch.
includes/class-gvlogic-shortcode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 		return self::$instance;
18 18
 	}
19 19
 
20
-	public function shortcode( $atts, $content = '', $tag = '') {
20
+	public function shortcode( $atts, $content = '', $tag = '' ) {
21 21
 		$shortcode = new \GV\Shortcodes\gvlogic();
22 22
 		return $shortcode->callback( $atts, $content, $tag );
23 23
 	}
Please login to merge, or discard this patch.