@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | $field_info_items = array(); |
14 | 14 | |
15 | - if( !empty( $this->item['description'] ) ) { |
|
15 | + if ( ! empty( $this->item[ 'description' ] ) ) { |
|
16 | 16 | |
17 | - $field_info_items[] = array( |
|
18 | - 'value' => $this->item['description'] |
|
17 | + $field_info_items[ ] = array( |
|
18 | + 'value' => $this->item[ 'description' ] |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | } |
@@ -15,29 +15,29 @@ |
||
15 | 15 | $field_info_items = array(); |
16 | 16 | |
17 | 17 | // Fields with IDs, not like Source URL or Entry ID |
18 | - if( is_numeric( $this->id ) ) { |
|
18 | + if ( is_numeric( $this->id ) ) { |
|
19 | 19 | |
20 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
20 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
21 | 21 | |
22 | - $field_info_items[] = array( |
|
23 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
22 | + $field_info_items[ ] = array( |
|
23 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ) |
|
24 | 24 | ); |
25 | 25 | |
26 | - $field_info_items[] = array( |
|
27 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
26 | + $field_info_items[ ] = array( |
|
27 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | } |
31 | 31 | |
32 | - if( !empty( $this->item['desc'] ) ) { |
|
33 | - $field_info_items[] = array( |
|
34 | - 'value' => $this->item['desc'] |
|
32 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
33 | + $field_info_items[ ] = array( |
|
34 | + 'value' => $this->item[ 'desc' ] |
|
35 | 35 | ); |
36 | 36 | } |
37 | 37 | |
38 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
39 | - $field_info_items[] = array( |
|
40 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
38 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
39 | + $field_info_items[ ] = array( |
|
40 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
41 | 41 | 'class' => 'gv-sublabel' |
42 | 42 | ); |
43 | 43 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | |
21 | 21 | function __construct() { |
22 | 22 | |
23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
24 | 24 | |
25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
26 | 26 | |
27 | 27 | // adding styles and scripts |
28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
29 | 29 | |
30 | 30 | // ajax - populate sort fields based on the selected view |
31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function is_post_editor_screen() { |
42 | 42 | global $current_screen, $pagenow; |
43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @since 1.15.3 |
57 | 57 | */ |
58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if( !$this->is_post_editor_screen() ) { |
|
62 | + if ( ! $this->is_post_editor_screen() ) { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | ?> |
66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
67 | 67 | <?php |
68 | 68 | |
69 | 69 | } |
@@ -79,17 +79,17 @@ discard block |
||
79 | 79 | function add_shortcode_popup() { |
80 | 80 | global $post; |
81 | 81 | |
82 | - if( !$this->is_post_editor_screen() ) { |
|
82 | + if ( ! $this->is_post_editor_screen() ) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | - $post_type = get_post_type_object($post->post_type); |
|
86 | + $post_type = get_post_type_object( $post->post_type ); |
|
87 | 87 | |
88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
89 | 89 | |
90 | 90 | // If there are no views set up yet, we get outta here. |
91 | - if( empty( $views ) ) { |
|
92 | - echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>'; |
|
91 | + if ( empty( $views ) ) { |
|
92 | + echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Post_Types::no_views_text() . '</div></div>'; |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
103 | 103 | |
104 | 104 | <div> |
105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
109 | 109 | <?php |
110 | - foreach( $views as $view ) { |
|
111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
110 | + foreach ( $views as $view ) { |
|
111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
113 | 113 | } |
114 | 114 | ?> |
115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | foreach ( $settings as $key => $setting ) { |
127 | 127 | |
128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
129 | 129 | |
130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | </table> |
135 | 135 | |
136 | 136 | <div class="submit"> |
137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
139 | 139 | </div> |
140 | 140 | |
141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function add_scripts_and_styles() { |
158 | 158 | |
159 | - if( ! $this->is_post_editor_screen() ) { |
|
159 | + if ( ! $this->is_post_editor_screen() ) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | |
168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
169 | 169 | |
170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
171 | 171 | |
172 | 172 | //enqueue styles |
173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
175 | 175 | |
176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
177 | 177 | |
178 | 178 | // custom js |
179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
185 | - )); |
|
184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
185 | + ) ); |
|
186 | 186 | |
187 | 187 | } |
188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | function get_sortable_fields() { |
199 | 199 | |
200 | 200 | // Not properly formatted request |
201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
202 | 202 | exit( false ); |
203 | 203 | } |
204 | 204 | |
205 | 205 | // Not valid request |
206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
207 | 207 | exit( false ); |
208 | 208 | } |
209 | 209 | |
210 | - $viewid = (int)$_POST['viewid']; |
|
210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
211 | 211 | |
212 | 212 | // fetch form id assigned to the view |
213 | 213 | $formid = gravityview_get_form_id( $viewid ); |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) { |
48 | 48 | |
49 | 49 | // If not set, the entry hasn't started a workflow |
50 | - $has_workflow_step = isset( $entry['workflow_step'] ); |
|
50 | + $has_workflow_step = isset( $entry[ 'workflow_step' ] ); |
|
51 | 51 | |
52 | - if( $has_workflow_step ) { |
|
52 | + if ( $has_workflow_step ) { |
|
53 | 53 | |
54 | - $GFlow = new Gravity_Flow_API( $entry['form_id'] ); |
|
54 | + $GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] ); |
|
55 | 55 | |
56 | 56 | if ( $current_step = $GFlow->get_current_step( $entry ) ) { |
57 | 57 | $output = esc_html( $current_step->get_name() ); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | preg_match( '/workflow_step_status_(\d+)/', $key, $matches ); |
80 | 80 | |
81 | 81 | if ( ! empty( $matches ) ) { |
82 | - $workflow_step_id = intval( $matches[1] ); |
|
82 | + $workflow_step_id = intval( $matches[ 1 ] ); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | return $workflow_step_id; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $return = $label; |
100 | 100 | |
101 | - if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field['field'] ) ) { |
|
101 | + if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field[ 'field' ] ) ) { |
|
102 | 102 | |
103 | 103 | $step = $this->get_workflow_step( $workflow_step_id ); |
104 | 104 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | $workflow_step = $GFlow->get_step( $workflow_step_id ); |
130 | 130 | |
131 | - if( ! $GFlow || ! $workflow_step ) { |
|
131 | + if ( ! $GFlow || ! $workflow_step ) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | foreach ( $search_fields as & $search_field ) { |
152 | 152 | |
153 | - if ( $this->name === $search_field['key'] ) { |
|
153 | + if ( $this->name === $search_field[ 'key' ] ) { |
|
154 | 154 | |
155 | 155 | $form_id = GravityView_View::getInstance()->getFormId(); |
156 | 156 | |
@@ -159,21 +159,21 @@ discard block |
||
159 | 159 | $choices = array(); |
160 | 160 | |
161 | 161 | foreach ( $workflow_steps as $step ) { |
162 | - $choices[] = array( |
|
162 | + $choices[ ] = array( |
|
163 | 163 | 'text' => $step->get_name(), |
164 | 164 | 'value' => $step->get_id(), |
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
168 | - $search_field['choices'] = $choices; |
|
168 | + $search_field[ 'choices' ] = $choices; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | // Workflow Step Statuses |
172 | - else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field['key'] ) ) { |
|
172 | + else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field[ 'key' ] ) ) { |
|
173 | 173 | |
174 | 174 | $status_key = sprintf( 'workflow_step_status_%d', $workflow_step_id ); |
175 | 175 | |
176 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key ); |
|
176 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key ); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | |
115 | 115 | add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 ); |
116 | 116 | |
117 | - if( $this->_custom_merge_tag ) { |
|
117 | + if ( $this->_custom_merge_tag ) { |
|
118 | 118 | add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 ); |
119 | 119 | add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 ); |
120 | 120 | } |
121 | 121 | |
122 | - if( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
122 | + if ( 'meta' === $this->group || '' !== $this->default_search_label ) { |
|
123 | 123 | add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 ); |
124 | 124 | } |
125 | 125 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | function set_default_search_label( $label = '', $gf_field = null, $field = array() ) { |
143 | 143 | |
144 | - if( $this->name === $field['field'] && '' === $label ) { |
|
144 | + if ( $this->name === $field[ 'field' ] && '' === $label ) { |
|
145 | 145 | $label = esc_html( $this->default_search_label ); |
146 | 146 | } |
147 | 147 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text. |
164 | 164 | */ |
165 | - public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
165 | + public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
166 | 166 | |
167 | 167 | /** |
168 | 168 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @see GFCommon::replace_variables_prepopulate() |
171 | 171 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
172 | 172 | */ |
173 | - if( false === $form ) { |
|
173 | + if ( false === $form ) { |
|
174 | 174 | return $text; |
175 | 175 | } |
176 | 176 | |
@@ -203,19 +203,19 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
205 | 205 | |
206 | - foreach( $matches as $match ) { |
|
206 | + foreach ( $matches as $match ) { |
|
207 | 207 | |
208 | - $full_tag = $match[0]; |
|
208 | + $full_tag = $match[ 0 ]; |
|
209 | 209 | |
210 | 210 | // Strip the Merge Tags |
211 | - $tag = str_replace( array( '{', '}'), '', $full_tag ); |
|
211 | + $tag = str_replace( array( '{', '}' ), '', $full_tag ); |
|
212 | 212 | |
213 | 213 | // Replace the value from the entry, if exists |
214 | - if( isset( $entry[ $tag ] ) ) { |
|
214 | + if ( isset( $entry[ $tag ] ) ) { |
|
215 | 215 | |
216 | 216 | $value = $entry[ $tag ]; |
217 | 217 | |
218 | - if( is_callable( array( $this, 'get_content') ) ) { |
|
218 | + if ( is_callable( array( $this, 'get_content' ) ) ) { |
|
219 | 219 | $value = $this->get_content( $value ); |
220 | 220 | } |
221 | 221 | |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function _filter_sortable_fields( $not_sortable ) { |
290 | 290 | |
291 | - if( ! $this->is_sortable ) { |
|
292 | - $not_sortable[] = $this->name; |
|
291 | + if ( ! $this->is_sortable ) { |
|
292 | + $not_sortable[ ] = $this->name; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | return $not_sortable; |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | 'date_display' => array( |
319 | 319 | 'type' => 'text', |
320 | 320 | 'label' => __( 'Override Date Format', 'gravityview' ), |
321 | - 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
321 | + 'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ), |
|
322 | 322 | /** |
323 | 323 | * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time) |
324 | 324 | * @param[in,out] null|string $date_format Date Format (default: null) |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | $options = $this->field_support_options(); |
345 | 345 | |
346 | - if( isset( $options[ $key ] ) ) { |
|
346 | + if ( isset( $options[ $key ] ) ) { |
|
347 | 347 | $field_options[ $key ] = $options[ $key ]; |
348 | 348 | } |
349 | 349 | |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | $connected_form = rgpost( 'form_id' ); |
408 | 408 | |
409 | 409 | // Otherwise, get the Form ID from the Post page |
410 | - if( empty( $connected_form ) ) { |
|
410 | + if ( empty( $connected_form ) ) { |
|
411 | 411 | $connected_form = gravityview_get_form_id( get_the_ID() ); |
412 | 412 | } |
413 | 413 | |
414 | - if( empty( $connected_form ) ) { |
|
414 | + if ( empty( $connected_form ) ) { |
|
415 | 415 | do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) ); |
416 | 416 | return false; |
417 | 417 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) { |
43 | 43 | |
44 | - if( ! empty( $output ) ) { |
|
44 | + if ( ! empty( $output ) ) { |
|
45 | 45 | $output = gravity_flow()->translate_status_label( $output ); |
46 | 46 | } |
47 | 47 | |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | function modify_search_filters( $search_fields = array(), GravityView_Widget_Search $widget, $widget_args = array() ) { |
60 | 60 | |
61 | 61 | foreach ( $search_fields as & $search_field ) { |
62 | - if ( $this->name === $search_field['key'] ) { |
|
63 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
62 | + if ( $this->name === $search_field[ 'key' ] ) { |
|
63 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | parent::add_hooks(); |
35 | 35 | |
36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
37 | 37 | |
38 | 38 | } |
39 | 39 | |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
54 | 54 | |
55 | - if( empty( $form_id ) ) { |
|
55 | + if ( empty( $form_id ) ) { |
|
56 | 56 | $form_id = GravityView_View::getInstance()->getFormId(); |
57 | 57 | } |
58 | 58 | |
59 | 59 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
60 | 60 | |
61 | - return (array) rgars( $entry_meta, $status_key . '/filter/choices' ); |
|
61 | + return (array)rgars( $entry_meta, $status_key . '/filter/choices' ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $workflow_steps = $GFlow->get_steps(); |
82 | 82 | |
83 | - if( $workflow_steps ) { |
|
83 | + if ( $workflow_steps ) { |
|
84 | 84 | |
85 | 85 | foreach ( $workflow_steps as $step ) { |
86 | 86 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | ); |
93 | 93 | } |
94 | 94 | |
95 | - $fields['workflow_step'] = array( |
|
95 | + $fields[ 'workflow_step' ] = array( |
|
96 | 96 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
97 | 97 | 'type' => 'select', |
98 | 98 | ); |
99 | 99 | |
100 | - $fields['workflow_final_status'] = array( |
|
100 | + $fields[ 'workflow_final_status' ] = array( |
|
101 | 101 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
102 | 102 | 'type' => 'select', |
103 | 103 | ); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $return = $input_type; |
47 | 47 | |
48 | - if( 'survey' === $field_type ) { |
|
48 | + if ( 'survey' === $field_type ) { |
|
49 | 49 | $return = 'select'; |
50 | 50 | } |
51 | 51 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | public function fix_survey_fields( $fields ) { |
66 | 66 | |
67 | 67 | /** @var GF_Field $field */ |
68 | - foreach( $fields as &$field ) { |
|
69 | - if( 'survey' === $field->type ) { |
|
68 | + foreach ( $fields as &$field ) { |
|
69 | + if ( 'survey' === $field->type ) { |
|
70 | 70 | $field->allowsPrepopulate = true; |
71 | 71 | } |
72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | function add_render_hooks() { |
85 | - add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10, 3 ); |
|
85 | + add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10, 3 ); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | function remove_render_hooks() { |
98 | - remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10 ); |
|
98 | + remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10 ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function fix_survey_field_value( $value, $field, $name ) { |
115 | 115 | |
116 | - if( 'survey' === $field->type ) { |
|
116 | + if ( 'survey' === $field->type ) { |
|
117 | 117 | |
118 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
118 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
119 | 119 | |
120 | 120 | // We need to run through each survey row until we find a match for expected values |
121 | 121 | foreach ( $entry as $field_id => $field_value ) { |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | - if( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { |
|
127 | + if ( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { |
|
128 | 128 | list( $row_val, $col_val ) = explode( ':', $field_value, 2 ); |
129 | 129 | |
130 | 130 | // If the $name matches the $row_val, we are processing the correct row |
131 | - if( $row_val === $name ) { |
|
131 | + if ( $row_val === $name ) { |
|
132 | 132 | $value = $field_value; |
133 | 133 | break; |
134 | 134 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -234,15 +234,15 @@ discard block |
||
234 | 234 | |
235 | 235 | $this->context_view_id = $view_id; |
236 | 236 | |
237 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
237 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
238 | 238 | /** |
239 | 239 | * used on a has_multiple_views context |
240 | 240 | * @see GravityView_API::entry_link |
241 | 241 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
242 | 242 | */ |
243 | - $this->context_view_id = $_GET['gvid']; |
|
243 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
244 | 244 | |
245 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
245 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
246 | 246 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
247 | 247 | $this->context_view_id = array_pop( $array_keys ); |
248 | 248 | unset( $array_keys ); |
@@ -277,23 +277,23 @@ discard block |
||
277 | 277 | global $wp_rewrite; |
278 | 278 | |
279 | 279 | $is_front_page = ( $query->is_home || $query->is_page ); |
280 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
281 | - $front_page_id = get_option('page_on_front'); |
|
280 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
281 | + $front_page_id = get_option( 'page_on_front' ); |
|
282 | 282 | |
283 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
283 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
284 | 284 | |
285 | 285 | // Force to be an array, potentially a query string ( entry=16 ) |
286 | 286 | $_query = wp_parse_args( $query->query ); |
287 | 287 | |
288 | 288 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
289 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
290 | - unset( $_query['pagename'] ); |
|
289 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
290 | + unset( $_query[ 'pagename' ] ); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // this is where will break from core wordpress |
294 | 294 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
295 | 295 | foreach ( $wp_rewrite->endpoints as $endpoint ) { |
296 | - $ignore[] = $endpoint[1]; |
|
296 | + $ignore[ ] = $endpoint[ 1 ]; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | // Modify the query if: |
@@ -302,21 +302,21 @@ discard block |
||
302 | 302 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
303 | 303 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
304 | 304 | |
305 | - $qv =& $query->query_vars; |
|
305 | + $qv = & $query->query_vars; |
|
306 | 306 | |
307 | 307 | // Prevent redirect when on the single entry endpoint |
308 | - if( self::is_single_entry() ) { |
|
308 | + if ( self::is_single_entry() ) { |
|
309 | 309 | add_filter( 'redirect_canonical', '__return_false' ); |
310 | 310 | } |
311 | 311 | |
312 | 312 | $query->is_page = true; |
313 | 313 | $query->is_home = false; |
314 | - $qv['page_id'] = $front_page_id; |
|
314 | + $qv[ 'page_id' ] = $front_page_id; |
|
315 | 315 | |
316 | 316 | // Correct <!--nextpage--> for page_on_front |
317 | - if ( ! empty( $qv['paged'] ) ) { |
|
318 | - $qv['page'] = $qv['paged']; |
|
319 | - unset( $qv['paged'] ); |
|
317 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
318 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
319 | + unset( $qv[ 'paged' ] ); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | global $post; |
335 | 335 | |
336 | 336 | // If in admin and NOT AJAX request, get outta here. |
337 | - if ( GravityView_Plugin::is_admin() ) { |
|
337 | + if ( GravityView_Plugin::is_admin() ) { |
|
338 | 338 | return; |
339 | 339 | } |
340 | 340 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
348 | 348 | |
349 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
349 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
350 | 350 | $this->setPostId( $post_id ); |
351 | 351 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
352 | 352 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
384 | 384 | |
385 | - if( 'post' === $search_method ) { |
|
385 | + if ( 'post' === $search_method ) { |
|
386 | 386 | $get = $_POST; |
387 | 387 | } else { |
388 | 388 | $get = $_GET; |
@@ -438,20 +438,20 @@ discard block |
||
438 | 438 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
439 | 439 | * @param array $entry Current entry |
440 | 440 | */ |
441 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
441 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
442 | 442 | |
443 | 443 | if ( ! $apply_outside_loop ) { |
444 | 444 | return $title; |
445 | 445 | } |
446 | 446 | |
447 | 447 | // User reported WooCommerce doesn't pass two args. |
448 | - if ( empty( $passed_post_id ) ) { |
|
448 | + if ( empty( $passed_post_id ) ) { |
|
449 | 449 | return $title; |
450 | 450 | } |
451 | 451 | |
452 | 452 | // Don't modify the title for anything other than the current view/post. |
453 | 453 | // This is true for embedded shortcodes and Views. |
454 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
454 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
455 | 455 | return $title; |
456 | 456 | } |
457 | 457 | |
@@ -461,19 +461,19 @@ discard block |
||
461 | 461 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
462 | 462 | } else { |
463 | 463 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
464 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
464 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
465 | 465 | $view_meta = $view_data; |
466 | 466 | break; |
467 | 467 | } |
468 | 468 | } |
469 | 469 | } |
470 | 470 | |
471 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
471 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
472 | 472 | |
473 | - $title = $view_meta['atts']['single_title']; |
|
473 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
474 | 474 | |
475 | 475 | // We are allowing HTML in the fields, so no escaping the output |
476 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
476 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
477 | 477 | |
478 | 478 | $title = do_shortcode( $title ); |
479 | 479 | } |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | public function render_view( $passed_args ) { |
575 | 575 | |
576 | 576 | // validate attributes |
577 | - if ( empty( $passed_args['id'] ) ) { |
|
577 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
578 | 578 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
579 | 579 | return null; |
580 | 580 | } |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | return null; |
597 | 597 | } |
598 | 598 | |
599 | - $view_id = $passed_args['id']; |
|
599 | + $view_id = $passed_args[ 'id' ]; |
|
600 | 600 | |
601 | 601 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
602 | 602 | |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | $passed_args = array_filter( $passed_args, 'strlen' ); |
610 | 610 | |
611 | 611 | //Override shortcode args over View template settings |
612 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
612 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
613 | 613 | |
614 | 614 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
615 | 615 | |
@@ -632,14 +632,14 @@ discard block |
||
632 | 632 | * @since 1.15 |
633 | 633 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
634 | 634 | */ |
635 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
635 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
636 | 636 | |
637 | 637 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
638 | 638 | |
639 | 639 | return null; |
640 | 640 | } |
641 | 641 | |
642 | - if( $this->isGravityviewPostType() ) { |
|
642 | + if ( $this->isGravityviewPostType() ) { |
|
643 | 643 | |
644 | 644 | /** |
645 | 645 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | */ |
652 | 652 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
653 | 653 | |
654 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
654 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
655 | 655 | |
656 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
656 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
657 | 657 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
658 | 658 | } |
659 | 659 | } |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | |
669 | 669 | $gravityview_view = new GravityView_View( $view_data ); |
670 | 670 | |
671 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
671 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
672 | 672 | |
673 | 673 | $gravityview_view->setPostId( $post_id ); |
674 | 674 | |
@@ -678,20 +678,20 @@ discard block |
||
678 | 678 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
679 | 679 | |
680 | 680 | //fetch template and slug |
681 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
681 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
682 | 682 | |
683 | 683 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
684 | 684 | |
685 | 685 | /** |
686 | 686 | * Disable fetching initial entries for views that don't need it (DataTables) |
687 | 687 | */ |
688 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
688 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
689 | 689 | |
690 | 690 | /** |
691 | 691 | * Hide View data until search is performed |
692 | 692 | * @since 1.5.4 |
693 | 693 | */ |
694 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
694 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
695 | 695 | $gravityview_view->setHideUntilSearched( true ); |
696 | 696 | $get_entries = false; |
697 | 697 | } |
@@ -699,23 +699,23 @@ discard block |
||
699 | 699 | |
700 | 700 | if ( $get_entries ) { |
701 | 701 | |
702 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
702 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
703 | 703 | // add filter to enable column sorting |
704 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
704 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
705 | 705 | } |
706 | 706 | |
707 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
707 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
708 | 708 | |
709 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
709 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
710 | 710 | |
711 | 711 | } else { |
712 | 712 | |
713 | 713 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
714 | 714 | |
715 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
715 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
716 | 716 | } |
717 | 717 | |
718 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
718 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
719 | 719 | $gravityview_view->setContext( 'directory' ); |
720 | 720 | $sections = array( 'header', 'body', 'footer' ); |
721 | 721 | |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
730 | 730 | * @since 1.17 |
731 | 731 | */ |
732 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
732 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
733 | 733 | |
734 | 734 | $entry = $this->getEntry(); |
735 | 735 | |
@@ -756,20 +756,20 @@ discard block |
||
756 | 756 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
757 | 757 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
758 | 758 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
759 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
759 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
760 | 760 | return null; |
761 | 761 | } |
762 | 762 | |
763 | 763 | //fetch template and slug |
764 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
764 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
765 | 765 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
766 | 766 | |
767 | 767 | //fetch entry detail |
768 | - $view_entries['count'] = 1; |
|
769 | - $view_entries['entries'][] = $entry; |
|
770 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
768 | + $view_entries[ 'count' ] = 1; |
|
769 | + $view_entries[ 'entries' ][ ] = $entry; |
|
770 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
771 | 771 | |
772 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
772 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
773 | 773 | |
774 | 774 | // set back link label |
775 | 775 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -779,11 +779,11 @@ discard block |
||
779 | 779 | } |
780 | 780 | |
781 | 781 | // add template style |
782 | - self::add_style( $view_data['template_id'] ); |
|
782 | + self::add_style( $view_data[ 'template_id' ] ); |
|
783 | 783 | |
784 | 784 | // Prepare to render view and set vars |
785 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
786 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
785 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
786 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
787 | 787 | |
788 | 788 | // If Edit |
789 | 789 | if ( 'edit' === gravityview_get_context() ) { |
@@ -796,11 +796,11 @@ discard block |
||
796 | 796 | |
797 | 797 | } else { |
798 | 798 | // finaly we'll render some html |
799 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
799 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
800 | 800 | |
801 | 801 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
802 | 802 | foreach ( $sections as $section ) { |
803 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
803 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
804 | 804 | $gravityview_view->render( $view_slug, $section, false ); |
805 | 805 | } |
806 | 806 | } |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | $datetime_format = 'Y-m-d H:i:s'; |
855 | 855 | $search_is_outside_view_bounds = false; |
856 | 856 | |
857 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
857 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
858 | 858 | |
859 | 859 | $search_date = strtotime( $search_criteria[ $key ] ); |
860 | 860 | |
@@ -882,14 +882,14 @@ discard block |
||
882 | 882 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
883 | 883 | |
884 | 884 | // Then we override the search and re-set the start date |
885 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
885 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | } |
889 | 889 | |
890 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
890 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
891 | 891 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
892 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
892 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
893 | 893 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
894 | 894 | } |
895 | 895 | } |
@@ -907,9 +907,9 @@ discard block |
||
907 | 907 | */ |
908 | 908 | public static function process_search_only_approved( $args, $search_criteria ) { |
909 | 909 | |
910 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
911 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
912 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
910 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
911 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
912 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
913 | 913 | |
914 | 914 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
915 | 915 | } |
@@ -933,12 +933,12 @@ discard block |
||
933 | 933 | */ |
934 | 934 | public static function is_entry_approved( $entry, $args = array() ) { |
935 | 935 | |
936 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
936 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
937 | 937 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
938 | 938 | return true; |
939 | 939 | } |
940 | 940 | |
941 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
941 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
942 | 942 | |
943 | 943 | if ( $is_approved ) { |
944 | 944 | return true; |
@@ -976,26 +976,26 @@ discard block |
||
976 | 976 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
977 | 977 | |
978 | 978 | // implicity search |
979 | - if ( ! empty( $args['search_value'] ) ) { |
|
979 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
980 | 980 | |
981 | 981 | // Search operator options. Options: `is` or `contains` |
982 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
982 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
983 | 983 | |
984 | - $search_criteria['field_filters'][] = array( |
|
984 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
985 | 985 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
986 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
986 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
987 | 987 | 'operator' => $operator, |
988 | 988 | ); |
989 | 989 | } |
990 | 990 | |
991 | - if( $search_criteria !== $original_search_criteria ) { |
|
991 | + if ( $search_criteria !== $original_search_criteria ) { |
|
992 | 992 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
993 | 993 | } |
994 | 994 | |
995 | 995 | // Handle setting date range |
996 | 996 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
997 | 997 | |
998 | - if( $search_criteria !== $original_search_criteria ) { |
|
998 | + if ( $search_criteria !== $original_search_criteria ) { |
|
999 | 999 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1007 | 1007 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1008 | 1008 | */ |
1009 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1009 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1010 | 1010 | |
1011 | 1011 | return $search_criteria; |
1012 | 1012 | } |
@@ -1052,16 +1052,16 @@ discard block |
||
1052 | 1052 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
1053 | 1053 | |
1054 | 1054 | // Paging & offset |
1055 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
1055 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
1056 | 1056 | |
1057 | 1057 | if ( -1 === $page_size ) { |
1058 | 1058 | $page_size = PHP_INT_MAX; |
1059 | 1059 | } |
1060 | 1060 | |
1061 | - if ( isset( $args['offset'] ) ) { |
|
1062 | - $offset = intval( $args['offset'] ); |
|
1061 | + if ( isset( $args[ 'offset' ] ) ) { |
|
1062 | + $offset = intval( $args[ 'offset' ] ); |
|
1063 | 1063 | } else { |
1064 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1064 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1065 | 1065 | $offset = ( $curr_page - 1 ) * $page_size; |
1066 | 1066 | } |
1067 | 1067 | |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | 'search_criteria' => $search_criteria, |
1080 | 1080 | 'sorting' => $sorting, |
1081 | 1081 | 'paging' => $paging, |
1082 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1082 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1083 | 1083 | ); |
1084 | 1084 | |
1085 | 1085 | /** |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1105 | 1105 | * @param array $args View configuration args. |
1106 | 1106 | */ |
1107 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
1107 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
1108 | 1108 | |
1109 | 1109 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
1110 | 1110 | |
@@ -1144,8 +1144,8 @@ discard block |
||
1144 | 1144 | */ |
1145 | 1145 | public static function updateViewSorting( $args, $form_id ) { |
1146 | 1146 | $sorting = array(); |
1147 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
1148 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
1147 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
1148 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
1149 | 1149 | |
1150 | 1150 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
1151 | 1151 | |
@@ -1185,7 +1185,7 @@ discard block |
||
1185 | 1185 | |
1186 | 1186 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1187 | 1187 | |
1188 | - switch ( $sort_field['type'] ) { |
|
1188 | + switch ( $sort_field[ 'type' ] ) { |
|
1189 | 1189 | |
1190 | 1190 | case 'address': |
1191 | 1191 | // Sorting by full address |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | */ |
1203 | 1203 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1204 | 1204 | |
1205 | - switch( strtolower( $address_part ) ){ |
|
1205 | + switch ( strtolower( $address_part ) ) { |
|
1206 | 1206 | case 'street': |
1207 | 1207 | $sort_field_id .= '.1'; |
1208 | 1208 | break; |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | */ |
1283 | 1283 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1284 | 1284 | |
1285 | - if ( empty( $single_entry ) ){ |
|
1285 | + if ( empty( $single_entry ) ) { |
|
1286 | 1286 | return false; |
1287 | 1287 | } else { |
1288 | 1288 | return $single_entry; |
@@ -1309,7 +1309,7 @@ discard block |
||
1309 | 1309 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1310 | 1310 | * @since 1.15 |
1311 | 1311 | */ |
1312 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1312 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1313 | 1313 | continue; |
1314 | 1314 | } |
1315 | 1315 | |
@@ -1318,19 +1318,19 @@ discard block |
||
1318 | 1318 | $css_dependencies = array(); |
1319 | 1319 | |
1320 | 1320 | // If the thickbox is enqueued, add dependencies |
1321 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
1321 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
1322 | 1322 | |
1323 | 1323 | /** |
1324 | 1324 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
1325 | 1325 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
1326 | 1326 | */ |
1327 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1327 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
1328 | 1328 | |
1329 | 1329 | /** |
1330 | 1330 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
1331 | 1331 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
1332 | 1332 | */ |
1333 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1333 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | /** |
@@ -1338,25 +1338,25 @@ discard block |
||
1338 | 1338 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1339 | 1339 | * @since 1.15 |
1340 | 1340 | */ |
1341 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1342 | - $css_dependencies[] = 'dashicons'; |
|
1341 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1342 | + $css_dependencies[ ] = 'dashicons'; |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1346 | 1346 | |
1347 | 1347 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1348 | 1348 | |
1349 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1349 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1350 | 1350 | |
1351 | 1351 | wp_enqueue_script( 'gravityview-fe-view' ); |
1352 | 1352 | |
1353 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1353 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1354 | 1354 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | $this->enqueue_default_style( $css_dependencies ); |
1358 | 1358 | |
1359 | - self::add_style( $data['template_id'] ); |
|
1359 | + self::add_style( $data[ 'template_id' ] ); |
|
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | } elseif ( empty( $template_id ) ) { |
1419 | 1419 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
1420 | 1420 | } else { |
1421 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
1421 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
1422 | 1422 | } |
1423 | 1423 | |
1424 | 1424 | } |
@@ -1443,11 +1443,11 @@ discard block |
||
1443 | 1443 | * Not a table-based template; don't add sort icons |
1444 | 1444 | * @since 1.12 |
1445 | 1445 | */ |
1446 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1446 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1447 | 1447 | return $label; |
1448 | 1448 | } |
1449 | 1449 | |
1450 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1450 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1451 | 1451 | return $label; |
1452 | 1452 | } |
1453 | 1453 | |
@@ -1455,29 +1455,29 @@ discard block |
||
1455 | 1455 | |
1456 | 1456 | $class = 'gv-sort'; |
1457 | 1457 | |
1458 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1458 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1459 | 1459 | |
1460 | 1460 | $sort_args = array( |
1461 | - 'sort' => $field['id'], |
|
1461 | + 'sort' => $field[ 'id' ], |
|
1462 | 1462 | 'dir' => 'asc', |
1463 | 1463 | ); |
1464 | 1464 | |
1465 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1465 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1466 | 1466 | //toggle sorting direction. |
1467 | - if ( 'asc' === $sorting['direction'] ) { |
|
1468 | - $sort_args['dir'] = 'desc'; |
|
1467 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1468 | + $sort_args[ 'dir' ] = 'desc'; |
|
1469 | 1469 | $class .= ' gv-icon-sort-desc'; |
1470 | 1470 | } else { |
1471 | - $sort_args['dir'] = 'asc'; |
|
1471 | + $sort_args[ 'dir' ] = 'asc'; |
|
1472 | 1472 | $class .= ' gv-icon-sort-asc'; |
1473 | 1473 | } |
1474 | 1474 | } else { |
1475 | 1475 | $class .= ' gv-icon-caret-up-down'; |
1476 | 1476 | } |
1477 | 1477 | |
1478 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1478 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1479 | 1479 | |
1480 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1480 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1481 | 1481 | |
1482 | 1482 | } |
1483 | 1483 | |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | |
1496 | 1496 | $field_type = $field_id; |
1497 | 1497 | |
1498 | - if( is_numeric( $field_id ) ) { |
|
1498 | + if ( is_numeric( $field_id ) ) { |
|
1499 | 1499 | $field = GFFormsModel::get_field( $form, $field_id ); |
1500 | 1500 | $field_type = $field->type; |
1501 | 1501 | } |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | return false; |
1519 | 1519 | } |
1520 | 1520 | |
1521 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1521 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1522 | 1522 | |
1523 | 1523 | } |
1524 | 1524 |