@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public static function get_instance() { |
| 96 | 96 | |
| 97 | - if( empty( self::$instance ) ) { |
|
| 97 | + if ( empty( self::$instance ) ) { |
|
| 98 | 98 | self::$instance = new self; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
| 130 | 130 | |
| 131 | - if( $with_values ) { |
|
| 131 | + if ( $with_values ) { |
|
| 132 | 132 | $operators_with_values = array(); |
| 133 | - foreach( $operators as $key ) { |
|
| 133 | + foreach ( $operators as $key ) { |
|
| 134 | 134 | $operators_with_values[ $key ] = ''; |
| 135 | 135 | } |
| 136 | 136 | return $operators_with_values; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $operators = $this->get_operators( false ); |
| 151 | 151 | |
| 152 | - if( !in_array( $operation, $operators ) ) { |
|
| 152 | + if ( ! in_array( $operation, $operators ) ) { |
|
| 153 | 153 | gravityview()->log->debug( ' Attempted to add invalid operation type. {operation}', array( 'operation' => $operation ) ); |
| 154 | 154 | return false; |
| 155 | 155 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | return null; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if( empty( $atts ) ) { |
|
| 204 | + if ( empty( $atts ) ) { |
|
| 205 | 205 | gravityview()->log->error( '$atts are empty.', array( 'data' => $atts ) ); |
| 206 | 206 | return null; |
| 207 | 207 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $setup = $this->setup_operation_and_comparison(); |
| 226 | 226 | |
| 227 | 227 | // We need an operation and comparison value |
| 228 | - if( ! $setup ) { |
|
| 228 | + if ( ! $setup ) { |
|
| 229 | 229 | gravityview()->log->error( 'No valid operators were passed.', array( 'data' => $this->atts ) ); |
| 230 | 230 | return null; |
| 231 | 231 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $logged_in_match = ! $this->logged_in ^ is_user_logged_in(); // XNOR |
| 278 | 278 | |
| 279 | 279 | // Only logged-in match |
| 280 | - if( 1 === sizeof( $this->passed_atts ) ) { |
|
| 280 | + if ( 1 === sizeof( $this->passed_atts ) ) { |
|
| 281 | 281 | $this->is_match = $logged_in_match; |
| 282 | 282 | } else { |
| 283 | 283 | $this->is_match = $logged_in_match && $comparison_match; |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | private function get_output() { |
| 293 | 293 | |
| 294 | - if( $this->is_match ) { |
|
| 294 | + if ( $this->is_match ) { |
|
| 295 | 295 | $output = $this->content; |
| 296 | 296 | } else { |
| 297 | 297 | $output = $this->else_content; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @param string $output HTML/text output |
| 310 | 310 | * @param GVLogic_Shortcode $this This class |
| 311 | 311 | */ |
| 312 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
| 312 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
| 313 | 313 | |
| 314 | 314 | gravityview()->log->debug( 'Output: ', array( 'data' => $output ) ); |
| 315 | 315 | |
@@ -329,14 +329,14 @@ discard block |
||
| 329 | 329 | list( $before_else, $after_else ) = array_pad( explode( '[else]', $passed_content ), 2, NULL ); |
| 330 | 330 | list( $before_else_if, $after_else_if ) = array_pad( explode( '[else', $passed_content ), 2, NULL ); |
| 331 | 331 | |
| 332 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
| 332 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
| 333 | 333 | $else_content = isset( $after_else ) ? $after_else : $else_attr; |
| 334 | 334 | |
| 335 | 335 | // The content is everything OTHER than the [else] |
| 336 | 336 | $this->content = $before_else_if; |
| 337 | 337 | |
| 338 | 338 | if ( ! $this->is_match ) { |
| 339 | - if( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 339 | + if ( $elseif_content = $this->process_elseif( $before_else ) ) { |
|
| 340 | 340 | $this->else_content = $elseif_content; |
| 341 | 341 | } else { |
| 342 | 342 | $this->else_content = $else_content; |
@@ -364,16 +364,16 @@ discard block |
||
| 364 | 364 | foreach ( $else_if_matches as $key => $else_if_match ) { |
| 365 | 365 | |
| 366 | 366 | // If $else_if_match[5] exists and has content, check for more shortcodes |
| 367 | - preg_match_all( '/' . $regex . '/', $else_if_match[5] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 367 | + preg_match_all( '/' . $regex . '/', $else_if_match[ 5 ] . '[/else]', $recursive_matches, PREG_SET_ORDER ); |
|
| 368 | 368 | |
| 369 | 369 | // If the logic passes, this is the value that should be used for $this->else_content |
| 370 | - $else_if_value = $else_if_match[5]; |
|
| 371 | - $check_elseif_match = $else_if_match[0]; |
|
| 370 | + $else_if_value = $else_if_match[ 5 ]; |
|
| 371 | + $check_elseif_match = $else_if_match[ 0 ]; |
|
| 372 | 372 | |
| 373 | 373 | // Retrieve the value of the match that is currently being checked, without any other [else] tags |
| 374 | - if( ! empty( $recursive_matches[0][0] ) ) { |
|
| 375 | - $else_if_value = str_replace( $recursive_matches[0][0], '', $else_if_value ); |
|
| 376 | - $check_elseif_match = str_replace( $recursive_matches[0][0], '', $check_elseif_match ); |
|
| 374 | + if ( ! empty( $recursive_matches[ 0 ][ 0 ] ) ) { |
|
| 375 | + $else_if_value = str_replace( $recursive_matches[ 0 ][ 0 ], '', $else_if_value ); |
|
| 376 | + $check_elseif_match = str_replace( $recursive_matches[ 0 ][ 0 ], '', $check_elseif_match ); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $check_elseif_match = str_replace( '[else', '[gvlogicelse', $check_elseif_match ); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | // Process any remaining [else] tags |
| 393 | - return $this->process_elseif( $else_if_match[5] ); |
|
| 393 | + return $this->process_elseif( $else_if_match[ 5 ] ); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | return false; |
@@ -417,11 +417,11 @@ discard block |
||
| 417 | 417 | $this->atts = array_intersect_key( $this->passed_atts, $this->atts ); |
| 418 | 418 | |
| 419 | 419 | // Strip whitespace if it's not default false |
| 420 | - $this->if = ( isset( $this->atts['if'] ) && is_string( $this->atts['if'] ) ) ? trim( $this->atts['if'] ) : false; |
|
| 420 | + $this->if = ( isset( $this->atts[ 'if' ] ) && is_string( $this->atts[ 'if' ] ) ) ? trim( $this->atts[ 'if' ] ) : false; |
|
| 421 | 421 | |
| 422 | - if ( isset( $this->atts['logged_in'] ) ) { |
|
| 422 | + if ( isset( $this->atts[ 'logged_in' ] ) ) { |
|
| 423 | 423 | // Truthy |
| 424 | - if ( in_array( strtolower( $this->atts['logged_in'] ), array( '0', 'false', 'no' ) ) ) { |
|
| 424 | + if ( in_array( strtolower( $this->atts[ 'logged_in' ] ), array( '0', 'false', 'no' ) ) ) { |
|
| 425 | 425 | $this->logged_in = false; |
| 426 | 426 | } else { |
| 427 | 427 | $this->logged_in = true; |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | do_action( 'gravityview/gvlogic/parse_atts/after', $this ); |
| 438 | 438 | |
| 439 | 439 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
| 440 | - unset( $this->atts['if'] ); |
|
| 440 | + unset( $this->atts[ 'if' ] ); |
|
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | |
@@ -69,22 +69,22 @@ discard block |
||
| 69 | 69 | if ( is_array( $sorts ) ) { |
| 70 | 70 | foreach ( (array)$sorts as $key => $direction ) { |
| 71 | 71 | if ( $key == $context->field->ID ) { |
| 72 | - $sorting['key'] = $context->field->ID; |
|
| 73 | - $sorting['direction'] = strtolower( $direction ); |
|
| 72 | + $sorting[ 'key' ] = $context->field->ID; |
|
| 73 | + $sorting[ 'direction' ] = strtolower( $direction ); |
|
| 74 | 74 | break; |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | } else { |
| 78 | 78 | if ( $sorts == $context->field->ID ) { |
| 79 | - $sorting['key'] = $context->field->ID; |
|
| 80 | - $sorting['direction'] = strtolower( Utils::_GET( 'dir', '' ) ); |
|
| 79 | + $sorting[ 'key' ] = $context->field->ID; |
|
| 80 | + $sorting[ 'direction' ] = strtolower( Utils::_GET( 'dir', '' ) ); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | } else { |
| 84 | 84 | foreach ( (array)$context->view->settings->get( 'sort_field', array() ) as $i => $sort_field ) { |
| 85 | 85 | if ( $sort_field == $context->field->ID ) { |
| 86 | - $sorting['key'] = $sort_field; |
|
| 87 | - $sorting['direction'] = strtolower( Utils::get( $directions, $i, '' ) ); |
|
| 86 | + $sorting[ 'key' ] = $sort_field; |
|
| 87 | + $sorting[ 'direction' ] = strtolower( Utils::get( $directions, $i, '' ) ); |
|
| 88 | 88 | break; // Only get the first sort |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -100,21 +100,21 @@ discard block |
||
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | // If we are already sorting by the current field... |
| 103 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 103 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 104 | 104 | |
| 105 | - switch( $sorting['direction'] ) { |
|
| 105 | + switch ( $sorting[ 'direction' ] ) { |
|
| 106 | 106 | // No sort |
| 107 | 107 | case '': |
| 108 | - $sort_args[1] = 'asc'; |
|
| 108 | + $sort_args[ 1 ] = 'asc'; |
|
| 109 | 109 | $class .= ' gv-icon-caret-up-down'; |
| 110 | 110 | break; |
| 111 | 111 | case 'desc': |
| 112 | - $sort_args[1] = ''; |
|
| 112 | + $sort_args[ 1 ] = ''; |
|
| 113 | 113 | $class .= ' gv-icon-sort-asc'; |
| 114 | 114 | break; |
| 115 | 115 | case 'asc': |
| 116 | 116 | default: |
| 117 | - $sort_args[1] = 'desc'; |
|
| 117 | + $sort_args[ 1 ] = 'desc'; |
|
| 118 | 118 | $class .= ' gv-icon-sort-desc'; |
| 119 | 119 | break; |
| 120 | 120 | } |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | $url = remove_query_arg( 'sort', $url ); |
| 128 | 128 | $multisort_url = self::_get_multisort_url( $url, $sort_args, $context->field->ID ); |
| 129 | 129 | |
| 130 | - $url = add_query_arg( $sort_args[0], $sort_args[1], $url ); |
|
| 130 | + $url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $url ); |
|
| 131 | 131 | |
| 132 | - $return = '<a href="'. esc_url_raw( $url ) .'"'; |
|
| 132 | + $return = '<a href="' . esc_url_raw( $url ) . '"'; |
|
| 133 | 133 | |
| 134 | 134 | if ( ! empty( $multisort_url ) ) { |
| 135 | - $return .= ' data-multisort-href="'. esc_url_raw( $multisort_url ) . '"'; |
|
| 135 | + $return .= ' data-multisort-href="' . esc_url_raw( $multisort_url ) . '"'; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $return .= ' class="'. $class .'" ></a> '. $column_label; |
|
| 138 | + $return .= ' class="' . $class . '" ></a> ' . $column_label; |
|
| 139 | 139 | |
| 140 | 140 | return $return; |
| 141 | 141 | } |
@@ -168,19 +168,19 @@ discard block |
||
| 168 | 168 | if ( ! in_array( $field_id, $keys = array_keys( $sorts ) ) ) { |
| 169 | 169 | if ( count( $keys ) ) { |
| 170 | 170 | $multisort_url = add_query_arg( sprintf( 'sort[%s]', end( $keys ) ), $sorts[ end( $keys ) ], $multisort_url ); |
| 171 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
| 171 | + $multisort_url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $multisort_url ); |
|
| 172 | 172 | } else { |
| 173 | - $multisort_url = add_query_arg( $sort_args[0], $sort_args[1], $multisort_url ); |
|
| 173 | + $multisort_url = add_query_arg( $sort_args[ 0 ], $sort_args[ 1 ], $multisort_url ); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | // Otherwise, we are just updating the sort order |
| 177 | 177 | else { |
| 178 | 178 | |
| 179 | 179 | // Pass empty value to unset |
| 180 | - if( '' === $sort_args[1] ) { |
|
| 180 | + if ( '' === $sort_args[ 1 ] ) { |
|
| 181 | 181 | unset( $sorts[ $field_id ] ); |
| 182 | 182 | } else { |
| 183 | - $sorts[ $field_id ] = $sort_args[1]; |
|
| 183 | + $sorts[ $field_id ] = $sort_args[ 1 ]; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $multisort_url = add_query_arg( array( 'sort' => $sorts ), $multisort_url ); |
@@ -318,9 +318,9 @@ discard block |
||
| 318 | 318 | do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() ); |
| 319 | 319 | |
| 320 | 320 | foreach ( $fields->all() as $field ) { |
| 321 | - if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) { |
|
| 322 | - if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) { |
|
| 323 | - $field = $this->view->unions[ $entry['form_id'] ][ $field->ID ]; |
|
| 321 | + if ( isset( $this->view->unions[ $entry[ 'form_id' ] ] ) ) { |
|
| 322 | + if ( isset( $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ] ) ) { |
|
| 323 | + $field = $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ]; |
|
| 324 | 324 | } else { |
| 325 | 325 | if ( ! $field instanceof Internal_Field ) { |
| 326 | 326 | $field = Internal_Field::from_configuration( array( 'id' => 'custom' ) ); |