Completed
Push — develop ( 502ca6...cbcfaf )
by Zack
04:26
created
includes/class-gvlogic-shortcode.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function get_instance() {
87 87
 
88
-		if( empty( self::$instance ) ) {
88
+		if ( empty( self::$instance ) ) {
89 89
 			self::$instance = new self;
90 90
 		}
91 91
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS );
120 120
 
121
-		if( $with_values ) {
121
+		if ( $with_values ) {
122 122
 			$operators_with_values = array();
123
-			foreach( $operators as $key ) {
123
+			foreach ( $operators as $key ) {
124 124
 				$operators_with_values[ $key ] = '';
125 125
 			}
126 126
 			return $operators_with_values;
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	function set_operation( $operation = '' ) {
139 139
 
140
-		if( empty( $operation ) ) {
140
+		if ( empty( $operation ) ) {
141 141
 			return false;
142 142
 		}
143 143
 
144 144
 		$operators = $this->get_operators( false );
145 145
 
146
-		if( !in_array( $operation, $operators ) ) {
147
-			do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation );
146
+		if ( ! in_array( $operation, $operators ) ) {
147
+			do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation );
148 148
 			return false;
149 149
 		}
150 150
 
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	private function setup_operation_and_comparison() {
166 166
 
167
-		foreach( $this->atts as $key => $value ) {
167
+		foreach ( $this->atts as $key => $value ) {
168 168
 
169 169
 			$valid = $this->set_operation( $key );
170 170
 
171
-			if( $valid ) {
171
+			if ( $valid ) {
172 172
 				$this->comparison = $value;
173 173
 				return true;
174 174
 			}
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 			return null;
192 192
 		}
193 193
 
194
-		if( empty( $atts ) ) {
195
-			do_action( 'gravityview_log_error', __METHOD__.' $atts are empty.', $atts );
194
+		if ( empty( $atts ) ) {
195
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts are empty.', $atts );
196 196
 			return null;
197 197
 		}
198 198
 
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
 		$this->parse_atts();
204 204
 
205 205
 		// We need an "if"
206
-		if( false === $this->if ) {
207
-			do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts );
206
+		if ( false === $this->if ) {
207
+			do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts );
208 208
 			return null;
209 209
 		}
210 210
 
211 211
 		$setup = $this->setup_operation_and_comparison();
212 212
 
213 213
 		// We need an operation and comparison value
214
-		if( ! $setup ) {
215
-			do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts );
214
+		if ( ! $setup ) {
215
+			do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts );
216 216
 			return null;
217 217
 		}
218 218
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	private function get_output() {
247 247
 
248
-		if( $this->is_match ) {
248
+		if ( $this->is_match ) {
249 249
 			$output = $this->content;
250 250
 		} else {
251 251
 			$output = $this->else_content;
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
 		 * @param string $output HTML/text output
260 260
 		 * @param GVLogic_Shortcode $this This class
261 261
 		 */
262
-		$output = apply_filters('gravityview/gvlogic/output', $output, $this );
262
+		$output = apply_filters( 'gravityview/gvlogic/output', $output, $this );
263 263
 
264
-		do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output );
264
+		do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output );
265 265
 
266 266
 		return $output;
267 267
 	}
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 
278 278
 		$content = explode( '[else]', $this->passed_content );
279 279
 
280
-		$this->content = $content[0];
280
+		$this->content = $content[ 0 ];
281 281
 
282
-		$else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL;
282
+		$else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL;
283 283
 
284
-		$this->else_content = isset( $content[1] ) ? $content[1] : $else_attr;
284
+		$this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr;
285 285
 	}
286 286
 
287 287
 	/**
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		$this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts;
305 305
 
306 306
 		// Strip whitespace if it's not default false
307
-		$this->if = is_string( $this->atts['if'] ) ? trim( $this->atts['if'] ) : false;
307
+		$this->if = is_string( $this->atts[ 'if' ] ) ? trim( $this->atts[ 'if' ] ) : false;
308 308
 
309 309
 		// Make sure the "if" isn't processed in self::setup_operation_and_comparison()
310
-		unset( $this->atts['if'] );
310
+		unset( $this->atts[ 'if' ] );
311 311
 	}
312 312
 }
313 313
 
Please login to merge, or discard this patch.