@@ -55,10 +55,10 @@ |
||
| 55 | 55 | $search_criteria[ $key ] = $field_filters; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if ( ! empty( $b[ $key ]['mode'] ) ) { |
|
| 59 | - $search_criteria[ $key ]['mode' ] = $b[ $key ]['mode']; |
|
| 60 | - } else if ( ! empty( $a[ $key ]['mode'] ) ) { |
|
| 61 | - $search_criteria[ $key ]['mode' ] = $a[ $key ]['mode']; |
|
| 58 | + if ( ! empty( $b[ $key ][ 'mode' ] ) ) { |
|
| 59 | + $search_criteria[ $key ][ 'mode' ] = $b[ $key ][ 'mode' ]; |
|
| 60 | + } else if ( ! empty( $a[ $key ][ 'mode' ] ) ) { |
|
| 61 | + $search_criteria[ $key ][ 'mode' ] = $a[ $key ][ 'mode' ]; |
|
| 62 | 62 | } |
| 63 | 63 | break; |
| 64 | 64 | case 'start_date': |
@@ -11,10 +11,10 @@ |
||
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | <div class="gv-search-box gv-search-date"> |
| 14 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 16 | 16 | <?php } ?> |
| 17 | 17 | <p> |
| 18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 19 | 19 | </p> |
| 20 | 20 | </div> |
| 21 | 21 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | |
| 11 | 11 | ?> |
| 12 | 12 | <div class="gv-search-box gv-search-field-text"> |
| 13 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 14 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 13 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 14 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 15 | 15 | <?php } ?> |
| 16 | 16 | <p> |
| 17 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
| 17 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
| 18 | 18 | </p> |
| 19 | 19 | </div> |
| 20 | 20 | \ No newline at end of file |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | <div class="gv-search-box gv-search-field-single_checkbox"> |
| 15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio"> |
|
| 16 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>> |
|
| 17 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { echo esc_html( $search_field['label'] ); } ?> |
|
| 15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" class="gv-check-radio"> |
|
| 16 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" <?php checked( '1', $search_field[ 'value' ], true ); ?>> |
|
| 17 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { echo esc_html( $search_field[ 'label' ] ); } ?> |
|
| 18 | 18 | </label> |
| 19 | 19 | </div> |
| 20 | 20 | \ No newline at end of file |
@@ -42,16 +42,16 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $args = wp_parse_args( $args, $defaults ); |
| 44 | 44 | |
| 45 | - $forms = gravityview_get_forms( (bool) $args['active'], (bool) $args['trash'] ); |
|
| 45 | + $forms = gravityview_get_forms( (bool)$args[ 'active' ], (bool)$args[ 'trash' ] ); |
|
| 46 | 46 | |
| 47 | - if( array() === $args['options'] ) { |
|
| 47 | + if ( array() === $args[ 'options' ] ) { |
|
| 48 | 48 | foreach ( $forms as $form ) { |
| 49 | 49 | |
| 50 | - if ( in_array( $form['id'], $args['exclude'] ) ) { |
|
| 50 | + if ( in_array( $form[ 'id' ], $args[ 'exclude' ] ) ) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $args['options'][ $form['id'] ] = esc_html( $form['title'] ); |
|
| 54 | + $args[ 'options' ][ $form[ 'id' ] ] = esc_html( $form[ 'title' ] ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $args = wp_parse_args( $args, $defaults ); |
| 85 | 85 | |
| 86 | - if( empty( $args['form_id'] ) ) { |
|
| 86 | + if ( empty( $args[ 'form_id' ] ) ) { |
|
| 87 | 87 | return ''; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $fields = GVCommon::get_sortable_fields_array( $args['form_id'] ); |
|
| 90 | + $fields = GVCommon::get_sortable_fields_array( $args[ 'form_id' ] ); |
|
| 91 | 91 | |
| 92 | - if( array() === $args['options'] ) { |
|
| 92 | + if ( array() === $args[ 'options' ] ) { |
|
| 93 | 93 | foreach ( $fields as $field_id => $field ) { |
| 94 | - $args['options'][ $field_id ] = esc_html( $field['label'] ); |
|
| 94 | + $args[ 'options' ][ $field_id ] = esc_html( $field[ 'label' ] ); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -127,43 +127,43 @@ discard block |
||
| 127 | 127 | $args = wp_parse_args( $args, $defaults ); |
| 128 | 128 | |
| 129 | 129 | $data_elements = ''; |
| 130 | - foreach ( $args['data'] as $key => $value ) { |
|
| 130 | + foreach ( $args[ 'data' ] as $key => $value ) { |
|
| 131 | 131 | $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if( $args['multiple'] ) { |
|
| 134 | + if ( $args[ 'multiple' ] ) { |
|
| 135 | 135 | $multiple = ' MULTIPLE'; |
| 136 | 136 | } else { |
| 137 | 137 | $multiple = ''; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if( $args['placeholder'] ) { |
|
| 141 | - $placeholder = $args['placeholder']; |
|
| 140 | + if ( $args[ 'placeholder' ] ) { |
|
| 141 | + $placeholder = $args[ 'placeholder' ]; |
|
| 142 | 142 | } else { |
| 143 | 143 | $placeholder = ''; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $disabled = $args['disabled'] ? ' disabled="disabled"' : ''; |
|
| 147 | - $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) ); |
|
| 148 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( str_replace( '-', '_', $args['id'] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"'. $data_elements . '>'; |
|
| 146 | + $disabled = $args[ 'disabled' ] ? ' disabled="disabled"' : ''; |
|
| 147 | + $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args[ 'class' ] ) ) ); |
|
| 148 | + $output = '<select name="' . esc_attr( $args[ 'name' ] ) . '" id="' . esc_attr( str_replace( '-', '_', $args[ 'id' ] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>'; |
|
| 149 | 149 | |
| 150 | - if ( ! empty( $args['options'] ) ) { |
|
| 150 | + if ( ! empty( $args[ 'options' ] ) ) { |
|
| 151 | 151 | |
| 152 | - if ( $args['show_option_none'] ) { |
|
| 153 | - if( $args['multiple'] ) { |
|
| 154 | - $selected = selected( true, in_array( -1, $args['selected'] ), false ); |
|
| 152 | + if ( $args[ 'show_option_none' ] ) { |
|
| 153 | + if ( $args[ 'multiple' ] ) { |
|
| 154 | + $selected = selected( true, in_array( -1, $args[ 'selected' ] ), false ); |
|
| 155 | 155 | } else { |
| 156 | - $selected = selected( $args['selected'], -1, false ); |
|
| 156 | + $selected = selected( $args[ 'selected' ], -1, false ); |
|
| 157 | 157 | } |
| 158 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
| 158 | + $output .= '<option value="-1"' . $selected . '>' . esc_html( $args[ 'show_option_none' ] ) . '</option>'; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - foreach( $args['options'] as $key => $option ) { |
|
| 161 | + foreach ( $args[ 'options' ] as $key => $option ) { |
|
| 162 | 162 | |
| 163 | - if( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
| 164 | - $selected = selected( true, in_array( $key, $args['selected'], true ), false ); |
|
| 163 | + if ( $args[ 'multiple' ] && is_array( $args[ 'selected' ] ) ) { |
|
| 164 | + $selected = selected( true, in_array( $key, $args[ 'selected' ], true ), false ); |
|
| 165 | 165 | } else { |
| 166 | - $selected = selected( $args['selected'], $key, false ); |
|
| 166 | + $selected = selected( $args[ 'selected' ], $key, false ); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | function parse_um_profile_post_content( $args = array() ) { |
| 44 | 44 | global $ultimatemember; |
| 45 | 45 | |
| 46 | - if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
| 46 | + if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // @todo Support Ultimate Member 2.0 - for now, prevent fatal error |
| 51 | - if( ! isset( $ultimatemember->profile ) ) { |
|
| 51 | + if ( ! isset( $ultimatemember->profile ) ) { |
|
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content ); |
|
| 67 | + GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content ); |
|
| 68 | 68 | |
| 69 | 69 | wp_reset_postdata(); |
| 70 | 70 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public static function get_instance() { |
| 35 | 35 | |
| 36 | - if( ! self::$instance ) { |
|
| 36 | + if ( ! self::$instance ) { |
|
| 37 | 37 | self::$instance = new self; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) ); |
| 57 | 57 | add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 ); |
| 58 | 58 | add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 ); |
| 59 | - add_action( 'admin_init', array( $this, 'add_caps') ); |
|
| 59 | + add_action( 'admin_init', array( $this, 'add_caps' ) ); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -77,18 +77,18 @@ discard block |
||
| 77 | 77 | public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) { |
| 78 | 78 | |
| 79 | 79 | // Empty caps_to_check array |
| 80 | - if( ! $usercaps || ! $caps ) { |
|
| 80 | + if ( ! $usercaps || ! $caps ) { |
|
| 81 | 81 | return $usercaps; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled |
| 86 | 86 | */ |
| 87 | - if( ! empty( $usercaps['gravityview_full_access'] ) ) { |
|
| 87 | + if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) { |
|
| 88 | 88 | |
| 89 | 89 | $all_gravityview_caps = self::all_caps(); |
| 90 | 90 | |
| 91 | - foreach( $all_gravityview_caps as $gv_cap ) { |
|
| 91 | + foreach ( $all_gravityview_caps as $gv_cap ) { |
|
| 92 | 92 | $usercaps[ $gv_cap ] = true; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $all = $administrator; |
| 307 | 307 | |
| 308 | 308 | // If role is set, return caps_to_check for just that role. |
| 309 | - if( $single_role ) { |
|
| 309 | + if ( $single_role ) { |
|
| 310 | 310 | $caps = isset( ${$single_role} ) ? ${$single_role} : false; |
| 311 | 311 | return $flat_array ? $caps : array( $single_role => $caps ); |
| 312 | 312 | } |
@@ -355,9 +355,9 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | if ( true === $allow_logged_out ) { |
| 357 | 357 | |
| 358 | - $all_caps = self::all_caps('editor'); |
|
| 358 | + $all_caps = self::all_caps( 'editor' ); |
|
| 359 | 359 | |
| 360 | - if( array_intersect( $all_caps, (array) $caps_to_check ) ) { |
|
| 360 | + if ( array_intersect( $all_caps, (array)$caps_to_check ) ) { |
|
| 361 | 361 | return true; |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -378,13 +378,13 @@ discard block |
||
| 378 | 378 | $caps_to_check = self::maybe_add_full_access_caps( $caps_to_check ); |
| 379 | 379 | |
| 380 | 380 | foreach ( $caps_to_check as $cap ) { |
| 381 | - if( ! is_null( $object_id ) ) { |
|
| 381 | + if ( ! is_null( $object_id ) ) { |
|
| 382 | 382 | $has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id ); |
| 383 | 383 | } else { |
| 384 | 384 | $has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap ); |
| 385 | 385 | } |
| 386 | 386 | // At the first successful response, stop checking |
| 387 | - if( $has_cap ) { |
|
| 387 | + if ( $has_cap ) { |
|
| 388 | 388 | break; |
| 389 | 389 | } |
| 390 | 390 | } |
@@ -408,15 +408,15 @@ discard block |
||
| 408 | 408 | $all_gravityview_caps = self::all_caps(); |
| 409 | 409 | |
| 410 | 410 | // Are there any $caps_to_check that are from GravityView? |
| 411 | - if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) { |
|
| 412 | - $caps_to_check[] = 'gravityview_full_access'; |
|
| 411 | + if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) { |
|
| 412 | + $caps_to_check[ ] = 'gravityview_full_access'; |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | $all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array(); |
| 416 | 416 | |
| 417 | 417 | // Are there any $caps_to_check that are from Gravity Forms? |
| 418 | - if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) { |
|
| 419 | - $caps_to_check[] = 'gform_full_access'; |
|
| 418 | + if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) { |
|
| 419 | + $caps_to_check[ ] = 'gform_full_access'; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | return array_unique( $caps_to_check ); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $capabilities = self::all_caps(); |
| 439 | 439 | |
| 440 | 440 | // Loop through each role and remove GV caps_to_check |
| 441 | - foreach( $wp_roles->get_names() as $role_slug => $role_name ) { |
|
| 441 | + foreach ( $wp_roles->get_names() as $role_slug => $role_name ) { |
|
| 442 | 442 | foreach ( $capabilities as $cap ) { |
| 443 | 443 | $wp_roles->remove_cap( $role_slug, $cap ); |
| 444 | 444 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public static function remove() { |
| 78 | 78 | $shortcode = new static(); |
| 79 | - unset( self::$shortcodes[$shortcode->name] ); |
|
| 79 | + unset( self::$shortcodes[ $shortcode->name ] ); |
|
| 80 | 80 | remove_shortcode( $shortcode->name ); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); |
| 109 | 109 | |
| 110 | 110 | foreach ( $matches as $shortcode ) { |
| 111 | - $shortcode_name = $shortcode[2]; |
|
| 111 | + $shortcode_name = $shortcode[ 2 ]; |
|
| 112 | 112 | |
| 113 | - $shortcode_atts = shortcode_parse_atts( $shortcode[3] ); |
|
| 114 | - $shortcode_content = $shortcode[5]; |
|
| 113 | + $shortcode_atts = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
| 114 | + $shortcode_content = $shortcode[ 5 ]; |
|
| 115 | 115 | |
| 116 | 116 | /** This is a registered GravityView shortcode. */ |
| 117 | - if ( !empty( self::$shortcodes[$shortcode_name] ) ) { |
|
| 118 | - $shortcode = clone self::$shortcodes[$shortcode_name]; |
|
| 117 | + if ( ! empty( self::$shortcodes[ $shortcode_name ] ) ) { |
|
| 118 | + $shortcode = clone self::$shortcodes[ $shortcode_name ]; |
|
| 119 | 119 | } else { |
| 120 | 120 | /** This is some generic shortcode. */ |
| 121 | 121 | $shortcode = new self; |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | global $post; |
| 35 | 35 | |
| 36 | 36 | if ( $post ) { |
| 37 | - $context['post'] = $post; |
|
| 37 | + $context[ 'post' ] = $post; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | \GV\Mocks\Legacy_Context::push( $context ); |