@@ -10,22 +10,22 @@ |
||
| 10 | 10 | $search_field = $gravityview_view->search_field; |
| 11 | 11 | |
| 12 | 12 | // Make sure that there are choices to display |
| 13 | -if( empty( $search_field['choices'] ) ) { |
|
| 13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 14 | 14 | gravityview()->log->debug( 'search-field-checkbox.php - No choices for field' ); |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | ?> |
| 19 | 19 | <div class="gv-search-box gv-search-field-checkbox"> |
| 20 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 22 | 22 | <?php } ?> |
| 23 | 23 | <p> |
| 24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
| 24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
| 25 | 25 | |
| 26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
| 27 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>[]" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true, 'checked' ); ?>> |
|
| 28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
| 26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
| 27 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true, 'checked' ); ?>> |
|
| 28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
| 29 | 29 | </label> |
| 30 | 30 | |
| 31 | 31 | <?php } ?> |
@@ -10,22 +10,22 @@ |
||
| 10 | 10 | $search_field = $gravityview_view->search_field; |
| 11 | 11 | |
| 12 | 12 | // Make sure that there are choices to display |
| 13 | -if( empty( $search_field['choices'] ) ) { |
|
| 13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 14 | 14 | gravityview()->log->debug( 'search-field-radio.php - No choices for field' ); |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | ?> |
| 19 | 19 | <div class="gv-search-box gv-search-field-radio"> |
| 20 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 22 | 22 | <?php } ?> |
| 23 | 23 | <p> |
| 24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
| 24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
| 25 | 25 | |
| 26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
| 27 | - <input type="radio" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php checked( $choice['value'], $search_field['value'], true ); ?>> |
|
| 28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
| 26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
| 27 | + <input type="radio" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php checked( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>> |
|
| 28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
| 29 | 29 | </label> |
| 30 | 30 | |
| 31 | 31 | <?php } ?> |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | $search_field = $gravityview_view->search_field; |
| 11 | 11 | |
| 12 | 12 | // Make sure that there are choices to display |
| 13 | -if( empty( $search_field['choices'] ) ) { |
|
| 13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
| 14 | 14 | gravityview()->log->debug( 'search-field-multiselect.php - No choices for field' ); |
| 15 | 15 | return; |
| 16 | 16 | } |
@@ -21,19 +21,19 @@ discard block |
||
| 21 | 21 | * @param string $default_option Default: `—` (—) |
| 22 | 22 | * @param string $field_type Field type: "select" or "multiselect" |
| 23 | 23 | */ |
| 24 | -$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'multiselect' ); |
|
| 24 | +$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'multiselect' ); |
|
| 25 | 25 | |
| 26 | 26 | ?> |
| 27 | 27 | <div class="gv-search-box gv-search-field-multiselect"> |
| 28 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 29 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 28 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 29 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 30 | 30 | <?php } ?> |
| 31 | 31 | <p> |
| 32 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" multiple> |
|
| 33 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
| 32 | + <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" multiple> |
|
| 33 | + <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
| 34 | 34 | <?php |
| 35 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
| 36 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
| 35 | + foreach ( $search_field[ 'choices' ] as $choice ) : ?> |
|
| 36 | + <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
| 37 | 37 | <?php endforeach; ?> |
| 38 | 38 | </select> |
| 39 | 39 | </p> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | ?> |
| 10 | 10 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 11 | 11 | |
| 12 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 12 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 14 | 14 | ?><div> |
| 15 | 15 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | function render_input( $override_input = null ) { |
| 22 | - if( isset( $override_input ) ) { |
|
| 22 | + if ( isset( $override_input ) ) { |
|
| 23 | 23 | echo $override_input; |
| 24 | 24 | return; |
| 25 | 25 | } |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
| 32 | 32 | $class .= ' merge-tag-support mt-position-right '; |
| 33 | 33 | |
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 34 | + if ( empty( $this->field[ 'show_all_fields' ] ) ) { |
|
| 35 | 35 | $class .= ' mt-hide_all_fields '; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $placeholder = \GV\Utils::get( $this->field, 'placeholder' ); |
| 40 | 40 | $rows = \GV\Utils::get( $this->field, 'rows', 5 ); |
| 41 | 41 | ?> |
| 42 | - <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo intval( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 42 | + <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo intval( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 43 | 43 | <?php |
| 44 | 44 | } |
| 45 | 45 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | ?> |
| 9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 10 | 10 | |
| 11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 12 | 12 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 13 | 13 | ?><div> |
| 14 | 14 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | function render_input( $override_input = null ) { |
| 21 | 21 | |
| 22 | - if( isset( $override_input ) ) { |
|
| 22 | + if ( isset( $override_input ) ) { |
|
| 23 | 23 | echo $override_input; |
| 24 | 24 | return; |
| 25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
| 32 | 32 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 33 | 33 | } |
| 34 | 34 | $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | * @param array $callback_args Arguments passed to the callback |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | - function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) { |
|
| 100 | + function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) { |
|
| 101 | 101 | |
| 102 | - $this->id = $this->prefix.$id; |
|
| 102 | + $this->id = $this->prefix . $id; |
|
| 103 | 103 | $this->title = $title; |
| 104 | 104 | $this->render_template_file = $file; |
| 105 | 105 | $this->callback = $callback; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | function parse_icon_class_name( $icon_class_name = '' ) { |
| 120 | 120 | |
| 121 | - if( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
| 121 | + if ( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
| 122 | 122 | $icon_class_name = 'dashicons ' . $icon_class_name; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -142,29 +142,29 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function render( $post ) { |
| 144 | 144 | |
| 145 | - if( !empty( $this->render_template_file ) ) { |
|
| 145 | + if ( ! empty( $this->render_template_file ) ) { |
|
| 146 | 146 | |
| 147 | 147 | $file = $this->render_template_file; |
| 148 | 148 | |
| 149 | 149 | // If the full path exists, use it |
| 150 | - if( file_exists( $file ) ) { |
|
| 150 | + if ( file_exists( $file ) ) { |
|
| 151 | 151 | $path = $file; |
| 152 | 152 | } else { |
| 153 | - $path = GRAVITYVIEW_DIR .'includes/admin/metaboxes/views/'.$file; |
|
| 153 | + $path = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/views/' . $file; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if( file_exists( $path ) ) { |
|
| 156 | + if ( file_exists( $path ) ) { |
|
| 157 | 157 | include $path; |
| 158 | 158 | } else { |
| 159 | 159 | gravityview()->log->error( 'Metabox template file not found', array( 'data' => $this ) ); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - } else if( !empty( $this->callback ) ) { |
|
| 162 | + } else if ( ! empty( $this->callback ) ) { |
|
| 163 | 163 | |
| 164 | - if( is_callable( $this->callback ) ) { |
|
| 164 | + if ( is_callable( $this->callback ) ) { |
|
| 165 | 165 | |
| 166 | 166 | /** @see do_accordion_sections() */ |
| 167 | - call_user_func( $this->callback, $post, (array) $this ); |
|
| 167 | + call_user_func( $this->callback, $post, (array)$this ); |
|
| 168 | 168 | |
| 169 | 169 | } else { |
| 170 | 170 | gravityview()->log->error( 'Metabox callback was not callable', array( 'data' => $this ) ); |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @since 1.11 |
| 53 | 53 | * @param boolean $boolean Whether to trigger update on user registration (default: true) |
| 54 | 54 | */ |
| 55 | - if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
| 55 | + if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
| 56 | 56 | |
| 57 | - add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 ); |
|
| 57 | + add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 ); |
|
| 58 | 58 | |
| 59 | 59 | // last resort in case the current user display name don't match any of the defaults |
| 60 | 60 | add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 ); |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function update_user( $form = array(), $entry_id = 0 ) { |
| 74 | 74 | |
| 75 | - if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) { |
|
| 75 | + if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) { |
|
| 76 | 76 | gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' ); |
| 77 | 77 | return; |
| 78 | - } elseif( empty( $entry_id ) ) { |
|
| 78 | + } elseif ( empty( $entry_id ) ) { |
|
| 79 | 79 | gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) ); |
| 80 | 80 | return; |
| 81 | 81 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // If an Update feed, make sure the conditions are met. |
| 104 | 104 | if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) { |
| 105 | - if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) { |
|
| 105 | + if ( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | remove_filter( 'send_email_change_email', '__return_false', 3 ); |
| 119 | 119 | |
| 120 | 120 | // Prevent double-triggering by removing the hook |
| 121 | - remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 ); |
|
| 121 | + remove_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10 ); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -151,17 +151,17 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry ); |
| 153 | 153 | |
| 154 | - if( $preserve_role ) { |
|
| 155 | - $config['meta']['role'] = 'gfur_preserve_role'; |
|
| 154 | + if ( $preserve_role ) { |
|
| 155 | + $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role'; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $displayname = $this->match_current_display_name( $entry['created_by'] ); |
|
| 158 | + $displayname = $this->match_current_display_name( $entry[ 'created_by' ] ); |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * Make sure the current display name is not changed with the update user method. |
| 162 | 162 | * @since 1.15 |
| 163 | 163 | */ |
| 164 | - $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname']; |
|
| 164 | + $config[ 'meta' ][ 'displayname' ] = $displayname ? $displayname : $config[ 'meta' ][ 'displayname' ]; |
|
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $user = get_userdata( $user_id ); |
| 190 | 190 | |
| 191 | - if( ! $user ) { |
|
| 191 | + if ( ! $user ) { |
|
| 192 | 192 | return false; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook |
| 201 | 201 | * @see restore_display_name |
| 202 | 202 | */ |
| 203 | - if( false === $format ) { |
|
| 203 | + if ( false === $format ) { |
|
| 204 | 204 | $this->_user_before_update = $user; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -218,20 +218,20 @@ discard block |
||
| 218 | 218 | public function generate_display_names( $profileuser ) { |
| 219 | 219 | |
| 220 | 220 | $public_display = array(); |
| 221 | - $public_display['nickname'] = $profileuser->nickname; |
|
| 222 | - $public_display['username'] = $profileuser->user_login; |
|
| 221 | + $public_display[ 'nickname' ] = $profileuser->nickname; |
|
| 222 | + $public_display[ 'username' ] = $profileuser->user_login; |
|
| 223 | 223 | |
| 224 | - if ( !empty($profileuser->first_name) ) { |
|
| 225 | - $public_display['firstname'] = $profileuser->first_name; |
|
| 224 | + if ( ! empty( $profileuser->first_name ) ) { |
|
| 225 | + $public_display[ 'firstname' ] = $profileuser->first_name; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if ( !empty($profileuser->last_name) ) { |
|
| 229 | - $public_display['lastname'] = $profileuser->last_name; |
|
| 228 | + if ( ! empty( $profileuser->last_name ) ) { |
|
| 229 | + $public_display[ 'lastname' ] = $profileuser->last_name; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
|
| 233 | - $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
| 234 | - $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
| 232 | + if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) { |
|
| 233 | + $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
| 234 | + $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $public_display = array_map( 'trim', $public_display ); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * - or we don't need as we found the correct format before updating user. |
| 271 | 271 | * @since 1.14.4 |
| 272 | 272 | */ |
| 273 | - if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
| 273 | + if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
| 274 | 274 | return null; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | $updated = wp_update_user( $restored_user ); |
| 304 | 304 | |
| 305 | - if( is_wp_error( $updated ) ) { |
|
| 305 | + if ( is_wp_error( $updated ) ) { |
|
| 306 | 306 | gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) ); |
| 307 | 307 | } else { |
| 308 | 308 | gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) ); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | static function getInstance() { |
| 43 | 43 | gravityview()->log->notice( '\GravityView_oEmbed is deprecated. Use \GV\oEmbed instead.' ); |
| 44 | 44 | |
| 45 | - if( empty( self::$instance ) ) { |
|
| 45 | + if ( empty( self::$instance ) ) { |
|
| 46 | 46 | self::$instance = new self; |
| 47 | 47 | self::$instance->initialize(); |
| 48 | 48 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $widget_ops = array( |
| 13 | 13 | 'classname' => 'widget_gravityview_search', |
| 14 | - 'description' => __( 'A search form for a specific GravityView.', 'gravityview') |
|
| 14 | + 'description' => __( 'A search form for a specific GravityView.', 'gravityview' ) |
|
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | 17 | $widget_display = array( |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | private function load_required_files() { |
| 37 | - if( !class_exists( 'GravityView_Widget_Search' ) ) { |
|
| 37 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
| 38 | 38 | gravityview_register_gravityview_widgets(); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | public function widget( $args, $instance ) { |
| 54 | 54 | |
| 55 | 55 | // Don't show unless a View ID has been set. |
| 56 | - if( empty( $instance['view_id'] ) ) { |
|
| 56 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
| 57 | 57 | |
| 58 | 58 | gravityview()->log->debug( 'No View ID has been defined. Not showing the widget.', array( 'data' => $instance ) ); |
| 59 | 59 | |
@@ -61,22 +61,22 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 64 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
|
| 64 | + $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base ); |
|
| 65 | 65 | |
| 66 | - echo $args['before_widget']; |
|
| 66 | + echo $args[ 'before_widget' ]; |
|
| 67 | 67 | |
| 68 | 68 | if ( $title ) { |
| 69 | - echo $args['before_title'] . $title . $args['after_title']; |
|
| 69 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // @todo Add to the widget configuration form |
| 73 | - $instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
| 73 | + $instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
| 74 | 74 | |
| 75 | - $instance['context'] = 'wp_widget'; |
|
| 75 | + $instance[ 'context' ] = 'wp_widget'; |
|
| 76 | 76 | |
| 77 | 77 | // form |
| 78 | - $instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] ); |
|
| 79 | - $instance['form'] = GVCommon::get_form( $instance['form_id'] ); |
|
| 78 | + $instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] ); |
|
| 79 | + $instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] ); |
|
| 80 | 80 | |
| 81 | 81 | // We don't want to overwrite existing context, etc. |
| 82 | 82 | $previous_view = GravityView_View::getInstance(); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | new GravityView_View( $previous_view ); |
| 94 | 94 | |
| 95 | - echo $args['after_widget']; |
|
| 95 | + echo $args[ 'after_widget' ]; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -102,27 +102,27 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $instance = $old_instance; |
| 104 | 104 | |
| 105 | - if( $this->is_preview() ) { |
|
| 105 | + if ( $this->is_preview() ) { |
|
| 106 | 106 | //Oh! Sorry but still not fully compatible with customizer |
| 107 | 107 | return $instance; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() ); |
|
| 110 | + $new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() ); |
|
| 111 | 111 | |
| 112 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 113 | - $instance['view_id'] = absint( $new_instance['view_id'] ); |
|
| 114 | - $instance['search_fields'] = $new_instance['search_fields']; |
|
| 115 | - $instance['post_id'] = $new_instance['post_id']; |
|
| 116 | - $instance['search_clear'] = $new_instance['search_clear']; |
|
| 117 | - $instance['search_mode'] = $new_instance['search_mode']; |
|
| 112 | + $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] ); |
|
| 113 | + $instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] ); |
|
| 114 | + $instance[ 'search_fields' ] = $new_instance[ 'search_fields' ]; |
|
| 115 | + $instance[ 'post_id' ] = $new_instance[ 'post_id' ]; |
|
| 116 | + $instance[ 'search_clear' ] = $new_instance[ 'search_clear' ]; |
|
| 117 | + $instance[ 'search_mode' ] = $new_instance[ 'search_mode' ]; |
|
| 118 | 118 | |
| 119 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true ); |
|
| 119 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true ); |
|
| 120 | 120 | |
| 121 | 121 | //check if post_id is a valid post with embedded View |
| 122 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
| 122 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
| 123 | 123 | |
| 124 | 124 | // Share that the widget isn't brand new |
| 125 | - $instance['updated'] = 1; |
|
| 125 | + $instance[ 'updated' ] = 1; |
|
| 126 | 126 | |
| 127 | 127 | return $instance; |
| 128 | 128 | } |
@@ -133,28 +133,28 @@ discard block |
||
| 133 | 133 | public function form( $instance ) { |
| 134 | 134 | |
| 135 | 135 | // @todo Make compatible with Customizer |
| 136 | - if( $this->is_preview() ) { |
|
| 136 | + if ( $this->is_preview() ) { |
|
| 137 | 137 | |
| 138 | - $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' ); |
|
| 138 | + $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' ); |
|
| 139 | 139 | |
| 140 | 140 | echo wpautop( GravityView_Admin::get_floaty() . $warning ); |
| 141 | 141 | |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $instance = wp_parse_args( (array) $instance, self::get_defaults() ); |
|
| 145 | + $instance = wp_parse_args( (array)$instance, self::get_defaults() ); |
|
| 146 | 146 | |
| 147 | - $title = $instance['title']; |
|
| 148 | - $view_id = $instance['view_id']; |
|
| 149 | - $post_id = $instance['post_id']; |
|
| 150 | - $search_fields = $instance['search_fields']; |
|
| 151 | - $search_clear = $instance['search_clear']; |
|
| 152 | - $search_mode = $instance['search_mode']; |
|
| 147 | + $title = $instance[ 'title' ]; |
|
| 148 | + $view_id = $instance[ 'view_id' ]; |
|
| 149 | + $post_id = $instance[ 'post_id' ]; |
|
| 150 | + $search_fields = $instance[ 'search_fields' ]; |
|
| 151 | + $search_clear = $instance[ 'search_clear' ]; |
|
| 152 | + $search_mode = $instance[ 'search_mode' ]; |
|
| 153 | 153 | |
| 154 | 154 | $views = GVCommon::get_all_views(); |
| 155 | 155 | |
| 156 | 156 | // If there are no views set up yet, we get outta here. |
| 157 | - if( empty( $views ) ) { ?> |
|
| 157 | + if ( empty( $views ) ) { ?> |
|
| 158 | 158 | <div id="select_gravityview_view"> |
| 159 | 159 | <div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div> |
| 160 | 160 | </div> |
@@ -162,17 +162,17 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | ?> |
| 164 | 164 | |
| 165 | - <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
| 165 | + <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
| 166 | 166 | |
| 167 | 167 | <?php |
| 168 | 168 | /** |
| 169 | 169 | * Display errors generated for invalid embed IDs |
| 170 | 170 | * @see GravityView_View_Data::is_valid_embed_id |
| 171 | 171 | */ |
| 172 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
| 172 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
| 173 | 173 | ?> |
| 174 | 174 | <div class="error inline hide-on-view-change"> |
| 175 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
| 175 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
| 176 | 176 | </div> |
| 177 | 177 | <?php |
| 178 | 178 | unset ( $error ); |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | <p> |
| 183 | 183 | <label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label> |
| 184 | - <select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat"> |
|
| 184 | + <select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat"> |
|
| 185 | 185 | <option value=""><?php esc_html_e( '— Select a View —', 'gravityview' ); ?></option> |
| 186 | 186 | <?php |
| 187 | - foreach( $views as $view_option ) { |
|
| 188 | - $title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
| 189 | - echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>'; |
|
| 187 | + foreach ( $views as $view_option ) { |
|
| 188 | + $title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title; |
|
| 189 | + echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>'; |
|
| 190 | 190 | } |
| 191 | 191 | ?> |
| 192 | 192 | </select> |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | * Display errors generated for invalid embed IDs |
| 199 | 199 | * @see GravityView_View_Data::is_valid_embed_id |
| 200 | 200 | */ |
| 201 | - if( !empty( $instance['error_post_id'] ) ) { |
|
| 201 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
| 202 | 202 | ?> |
| 203 | 203 | <div class="error inline"> |
| 204 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
| 204 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
| 205 | 205 | </div> |
| 206 | 206 | <?php |
| 207 | 207 | unset ( $error ); |
@@ -209,40 +209,40 @@ discard block |
||
| 209 | 209 | ?> |
| 210 | 210 | |
| 211 | 211 | <p> |
| 212 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
| 213 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
| 212 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
| 213 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
| 214 | 214 | <span class="howto"><?php |
| 215 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
| 216 | - echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
| 215 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
| 216 | + echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
| 217 | 217 | ?></span> |
| 218 | 218 | </p> |
| 219 | 219 | |
| 220 | 220 | <p> |
| 221 | - <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
| 222 | - <input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0"> |
|
| 223 | - <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
| 221 | + <label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
| 222 | + <input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0"> |
|
| 223 | + <input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
| 224 | 224 | </p> |
| 225 | 225 | |
| 226 | 226 | <p> |
| 227 | 227 | <label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label> |
| 228 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_any"> |
|
| 229 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
| 228 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any"> |
|
| 229 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
| 230 | 230 | <?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?> |
| 231 | 231 | </label> |
| 232 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_all"> |
|
| 233 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
| 232 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all"> |
|
| 233 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
| 234 | 234 | <?php esc_html_e( 'Match All Fields', 'gravityview' ); ?> |
| 235 | 235 | </label> |
| 236 | - <span class="howto"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
| 236 | + <span class="howto"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
| 237 | 237 | </p> |
| 238 | 238 | |
| 239 | 239 | <hr /> |
| 240 | 240 | |
| 241 | 241 | <?php // @todo: move style to CSS ?> |
| 242 | 242 | <div style="margin-bottom: 1em;"> |
| 243 | - <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
| 244 | - <div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>"> |
|
| 245 | - <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
| 243 | + <label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
| 244 | + <div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>"> |
|
| 245 | + <input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
| 246 | 246 | </div> |
| 247 | 247 | |
| 248 | 248 | </div> |