@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | return $searchable_fields; |
60 | 60 | } |
61 | 61 | |
62 | - foreach( $searchable_fields as $searchable_field ) { |
|
62 | + foreach ( $searchable_fields as $searchable_field ) { |
|
63 | 63 | |
64 | 64 | if ( self::INPUT_TYPE !== \GV\Utils::get( $searchable_field, 'input' ) ) { |
65 | 65 | continue; |
66 | 66 | } |
67 | 67 | |
68 | - $field = GFAPI::get_field( $searchable_field['form_id'], $searchable_field['field'] ); |
|
68 | + $field = GFAPI::get_field( $searchable_field[ 'form_id' ], $searchable_field[ 'field' ] ); |
|
69 | 69 | |
70 | - foreach( $field->get_entry_inputs() as $input ) { |
|
71 | - $searchable_fields[] = array( |
|
72 | - 'field' => $input['id'], |
|
70 | + foreach ( $field->get_entry_inputs() as $input ) { |
|
71 | + $searchable_fields[ ] = array( |
|
72 | + 'field' => $input[ 'id' ], |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function print_styles( $search_widget, $search_field ) { |
89 | 89 | |
90 | - if( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) { |
|
90 | + if ( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function print_scripts( $search_widget, $search_field ) { |
140 | 140 | |
141 | - if( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) { |
|
141 | + if ( self::INPUT_TYPE !== \GV\Utils::get( $search_field, 'type' ) ) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | foreach ( $gf_field->get_entry_inputs() as $input ) { |
179 | 179 | |
180 | 180 | // Inputs are converted from . to _ |
181 | - $input_url_arg = 'input_' . str_replace( '.', '_', $input['id'] ); |
|
181 | + $input_url_arg = 'input_' . str_replace( '.', '_', $input[ 'id' ] ); |
|
182 | 182 | |
183 | - $field_values[ $input['id'] ] = \GV\Utils::_REQUEST( $input_url_arg ); |
|
183 | + $field_values[ $input[ 'id' ] ] = \GV\Utils::_REQUEST( $input_url_arg ); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | return $field_values; |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function modify_searchable_fields( $fields, $form_id ) { |
207 | 207 | |
208 | - foreach( $fields as $key => $field ) { |
|
209 | - if( 'chainedselect' === $field['type'] && ! empty( $field['parent'] ) ) { |
|
208 | + foreach ( $fields as $key => $field ) { |
|
209 | + if ( 'chainedselect' === $field[ 'type' ] && ! empty( $field[ 'parent' ] ) ) { |
|
210 | 210 | unset( $fields[ $key ] ); |
211 | 211 | } |
212 | 212 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return string |
237 | 237 | */ |
238 | - public function set_input_type( $input_type, $field_type, $field_id ) { |
|
238 | + public function set_input_type( $input_type, $field_type, $field_id ) { |
|
239 | 239 | |
240 | 240 | if ( ! in_array( $field_type, array( 'chainedselect' ) ) ) { |
241 | 241 | return $input_type; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | // Dequeue other jQuery styles even if no-conflict is off. |
124 | 124 | // Terrible-looking tabs help no one. |
125 | - if( !empty( $wp_styles->registered ) ) { |
|
125 | + if( !empty( $wp_styles->registered ) ) { |
|
126 | 126 | foreach ($wp_styles->registered as $key => $style) { |
127 | 127 | if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
128 | 128 | wp_dequeue_style( $key ); |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | |
206 | 206 | //unregistering scripts |
207 | 207 | $registered = array(); |
208 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
209 | - if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){ |
|
208 | + foreach( $wp_objects->registered as $handle => $script_registration ) { |
|
209 | + if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) { |
|
210 | 210 | $registered[ $handle ] = $script_registration; |
211 | 211 | } |
212 | 212 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - if( ! is_admin() ) { return; } |
|
21 | + if ( ! is_admin() ) { return; } |
|
22 | 22 | |
23 | 23 | $this->add_hooks(); |
24 | 24 | } |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | */ |
33 | 33 | private function add_hooks() { |
34 | 34 | //Hooks for no-conflict functionality |
35 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
36 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
35 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); |
|
36 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); |
|
37 | 37 | |
38 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
39 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
40 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
41 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
38 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); |
|
39 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); |
|
40 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); |
|
41 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | function no_conflict_scripts() { |
52 | 52 | global $wp_scripts; |
53 | 53 | |
54 | - if( ! gravityview()->request->is_admin( '', null ) ) { |
|
54 | + if ( ! gravityview()->request->is_admin( '', null ) ) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | 58 | $no_conflict_mode = gravityview()->plugin->settings->get( 'no_conflict_mode' ); |
59 | 59 | |
60 | - if( empty( $no_conflict_mode ) ) { |
|
60 | + if ( empty( $no_conflict_mode ) ) { |
|
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | function no_conflict_styles() { |
114 | 114 | global $wp_styles; |
115 | 115 | |
116 | - if( ! gravityview()->request->is_admin( '', null ) ) { |
|
116 | + if ( ! gravityview()->request->is_admin( '', null ) ) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Dequeue other jQuery styles even if no-conflict is off. |
121 | 121 | // Terrible-looking tabs help no one. |
122 | - if( !empty( $wp_styles->registered ) ) { |
|
123 | - foreach ($wp_styles->registered as $key => $style) { |
|
124 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
122 | + if ( ! empty( $wp_styles->registered ) ) { |
|
123 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
124 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
125 | 125 | wp_dequeue_style( $key ); |
126 | 126 | } |
127 | 127 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $no_conflict_mode = gravityview()->plugin->settings->get( 'no_conflict_mode' ); |
131 | 131 | |
132 | 132 | // If no conflict is off, jQuery will suffice. |
133 | - if( empty( $no_conflict_mode ) ) { |
|
133 | + if ( empty( $no_conflict_mode ) ) { |
|
134 | 134 | return; |
135 | 135 | } |
136 | 136 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
160 | 160 | */ |
161 | - do_action('gravityview_remove_conflicts_after'); |
|
161 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | |
194 | 194 | //reset queue |
195 | 195 | $queue = array(); |
196 | - foreach( $wp_objects->queue as $object ) { |
|
197 | - if( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) { |
|
198 | - $queue[] = $object; |
|
196 | + foreach ( $wp_objects->queue as $object ) { |
|
197 | + if ( in_array( $object, $required_objects ) || preg_match( $allow_regex, $object ) ) { |
|
198 | + $queue[ ] = $object; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | $wp_objects->queue = $queue; |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | |
205 | 205 | //unregistering scripts |
206 | 206 | $registered = array(); |
207 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
208 | - if( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ){ |
|
207 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
208 | + if ( in_array( $handle, $required_objects ) || preg_match( $allow_regex, $handle ) ) { |
|
209 | 209 | $registered[ $handle ] = $script_registration; |
210 | 210 | } |
211 | 211 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @param array $registered [description] |
221 | 221 | * @param array $scripts [description] |
222 | 222 | */ |
223 | - private function add_script_dependencies($registered, $scripts) { |
|
223 | + private function add_script_dependencies( $registered, $scripts ) { |
|
224 | 224 | |
225 | 225 | //gets all dependent scripts linked to the $scripts array passed |
226 | 226 | do { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
230 | 230 | foreach ( $deps as $dep ) { |
231 | 231 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
232 | - $dependents[] = $dep; |
|
232 | + $dependents[ ] = $dep; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | } |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | |
26 | 26 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
27 | 27 | |
28 | - unset ( $field_options['search_filter'] ); |
|
28 | + unset ( $field_options[ 'search_filter' ] ); |
|
29 | 29 | |
30 | - if( 'edit' === $context ) { |
|
30 | + if ( 'edit' === $context ) { |
|
31 | 31 | return $field_options; |
32 | 32 | } |
33 | 33 | |
34 | - $this->add_field_support('link_to_post', $field_options ); |
|
34 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
35 | 35 | |
36 | 36 | // @since 1.5.4 |
37 | - $this->add_field_support('dynamic_data', $field_options ); |
|
37 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
38 | 38 | |
39 | 39 | return $field_options; |
40 | 40 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $url = $title = $caption = $description = ''; |
62 | 62 | |
63 | 63 | // If there's a |:| match, process. Otherwise, empty array! |
64 | - if( preg_match( '/\|\:\|/', $value ) ) { |
|
64 | + if ( preg_match( '/\|\:\|/', $value ) ) { |
|
65 | 65 | list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false ); |
66 | 66 | } |
67 | 67 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Image $field = null ) { |
92 | 92 | |
93 | - $id = (int) $field->id; |
|
94 | - $form_id = $form['id']; |
|
93 | + $id = (int)$field->id; |
|
94 | + $form_id = $form[ 'id' ]; |
|
95 | 95 | $input_name = "input_{$id}"; |
96 | 96 | $field_id = sprintf( 'input_%d_%d', $form_id, $id ); |
97 | 97 | $img_name = null; |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | // Convert |:| to associative array |
100 | 100 | $img_array = self::explode_value( $value ); |
101 | 101 | |
102 | - if( ! empty( $img_array['url'] ) ) { |
|
102 | + if ( ! empty( $img_array[ 'url' ] ) ) { |
|
103 | 103 | |
104 | - $img_name = basename( $img_array['url'] ); |
|
104 | + $img_name = basename( $img_array[ 'url' ] ); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Set the $uploaded_files value so that the .ginput_preview renders, and the file upload is hidden |
108 | 108 | * @see GF_Field_Post_Image::get_field_input See the `<span class='ginput_preview'>` code |
109 | 109 | * @see GFFormsModel::get_temp_filename See the `rgget( $input_name, self::$uploaded_files[ $form_id ] );` code |
110 | 110 | */ |
111 | - if( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
111 | + if ( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
112 | 112 | GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $img_name; |
113 | 113 | } |
114 | 114 | } |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | * @hack |
138 | 138 | */ |
139 | 139 | if ( null !== $img_name ) { |
140 | - $current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array['url'] ) ); |
|
141 | - $gf_post_image_field_output = str_replace('<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>'.$current_file, $gf_post_image_field_output ); |
|
140 | + $current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array[ 'url' ] ) ); |
|
141 | + $gf_post_image_field_output = str_replace( '<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>' . $current_file, $gf_post_image_field_output ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $gf_post_image_field_output; |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | |
27 | 27 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
28 | 28 | |
29 | - unset( $field_options['show_as_link'] ); |
|
29 | + unset( $field_options[ 'show_as_link' ] ); |
|
30 | 30 | |
31 | - if( 'edit' === $context ) { |
|
31 | + if ( 'edit' === $context ) { |
|
32 | 32 | return $field_options; |
33 | 33 | } |
34 | 34 | |
35 | - $this->add_field_support('dynamic_data', $field_options ); |
|
35 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
36 | 36 | |
37 | 37 | return $field_options; |
38 | 38 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field = null ) { |
51 | 51 | |
52 | - $id = (int) $field->id; |
|
52 | + $id = (int)$field->id; |
|
53 | 53 | $input_name = "input_{$id}"; |
54 | 54 | $class = esc_attr( $field->size ); |
55 | 55 | $tabindex = $field->get_tabindex(); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * |
430 | 430 | * @return void |
431 | 431 | */ |
432 | - public function add_custom_column_content( $column_name = null, $post_id = 0 ) { |
|
432 | + public function add_custom_column_content( $column_name = null, $post_id = 0 ) { |
|
433 | 433 | |
434 | 434 | $output = ''; |
435 | 435 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | */ |
599 | 599 | function save_postdata( $post_id ) { |
600 | 600 | |
601 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
601 | + if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
602 | 602 | return; |
603 | 603 | } |
604 | 604 |
@@ -93,28 +93,28 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | - * When on the Add/Edit View screen, suggest most popular articles related to that |
|
97 | - * |
|
96 | + * When on the Add/Edit View screen, suggest most popular articles related to that |
|
97 | + * |
|
98 | 98 | * @param array $localization_data Data to be passed to the Support Port JS |
99 | 99 | * |
100 | 100 | * @return array |
101 | 101 | */ |
102 | 102 | function suggest_support_articles( $localization_data = array() ) { |
103 | 103 | |
104 | - if( ! gravityview()->request->is_view( false ) ) { |
|
105 | - return $localization_data; |
|
106 | - } |
|
104 | + if( ! gravityview()->request->is_view( false ) ) { |
|
105 | + return $localization_data; |
|
106 | + } |
|
107 | 107 | |
108 | 108 | $localization_data['suggest'] = array( |
109 | - '57ef23539033602e61d4a560', |
|
110 | - '54c67bb9e4b0512429885513', |
|
111 | - '54c67bb9e4b0512429885512', |
|
112 | - '54c67bbbe4b07997ea3f3f6b', |
|
113 | - '54d1a33ae4b086c0c0964ce9', |
|
114 | - '57ef253c9033602e61d4a563', |
|
115 | - '552355bfe4b0221aadf2572b', |
|
116 | - '54c67bcde4b051242988553e', |
|
117 | - ); |
|
109 | + '57ef23539033602e61d4a560', |
|
110 | + '54c67bb9e4b0512429885513', |
|
111 | + '54c67bb9e4b0512429885512', |
|
112 | + '54c67bbbe4b07997ea3f3f6b', |
|
113 | + '54d1a33ae4b086c0c0964ce9', |
|
114 | + '57ef253c9033602e61d4a563', |
|
115 | + '552355bfe4b0221aadf2572b', |
|
116 | + '54c67bcde4b051242988553e', |
|
117 | + ); |
|
118 | 118 | |
119 | 119 | return $localization_data; |
120 | 120 | } |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | |
261 | 261 | if( 'form_list' === GFForms::get_page() ) { |
262 | 262 | $priority = 790; |
263 | - } |
|
263 | + } |
|
264 | 264 | |
265 | 265 | if( empty( $connected_views ) ) { |
266 | 266 | |
267 | - $menu_items['gravityview'] = array( |
|
267 | + $menu_items['gravityview'] = array( |
|
268 | 268 | 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
269 | 269 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5 |
270 | 270 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | // If there were no items added, then let's create the parent menu |
297 | 297 | if( $sub_menu_items ) { |
298 | 298 | |
299 | - $sub_menu_items[] = array( |
|
300 | - 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
|
301 | - 'icon' => '<span class="dashicons dashicons-plus"></span>', |
|
302 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
|
303 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
304 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
305 | - ); |
|
299 | + $sub_menu_items[] = array( |
|
300 | + 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
|
301 | + 'icon' => '<span class="dashicons dashicons-plus"></span>', |
|
302 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
|
303 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
304 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
305 | + ); |
|
306 | 306 | |
307 | 307 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
308 | 308 | $sub_menu_items[] = array( |
@@ -699,11 +699,11 @@ discard block |
||
699 | 699 | /** |
700 | 700 | * Render html for displaying available fields based on a Form ID |
701 | 701 | * |
702 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
702 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
703 | 703 | * |
704 | 704 | * @param int|string $form_id Gravity Forms form ID. Default: 0. |
705 | 705 | * @param string $context (default: 'single') |
706 | - * |
|
706 | + * |
|
707 | 707 | * @return void |
708 | 708 | */ |
709 | 709 | function render_available_fields( $form_id = 0, $context = 'single' ) { |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | |
725 | 725 | if ( ! is_array( $blocklist_field_types ) ) { |
726 | 726 | |
727 | - gravityview()->log->error( '$blocklist_field_types is not an array', array( 'data' => print_r( $blocklist_field_types, true ) ) ); |
|
727 | + gravityview()->log->error( '$blocklist_field_types is not an array', array( 'data' => print_r( $blocklist_field_types, true ) ) ); |
|
728 | 728 | |
729 | 729 | $blocklist_field_types = array(); |
730 | 730 | } |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | } |
1292 | 1292 | |
1293 | 1293 | // Add the GV font (with the Astronaut) |
1294 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
1294 | + wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
1295 | 1295 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
1296 | 1296 | |
1297 | 1297 | wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
@@ -1299,21 +1299,21 @@ discard block |
||
1299 | 1299 | if( GFForms::get_page() === 'form_list' ) { |
1300 | 1300 | wp_enqueue_style( 'gravityview_views_styles' ); |
1301 | 1301 | return; |
1302 | - } |
|
1302 | + } |
|
1303 | 1303 | |
1304 | 1304 | // Don't process any scripts below here if it's not a GravityView page. |
1305 | 1305 | if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
1306 | - return; |
|
1306 | + return; |
|
1307 | 1307 | } |
1308 | 1308 | |
1309 | 1309 | wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
1310 | 1310 | |
1311 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1311 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1312 | 1312 | |
1313 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
1313 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
1314 | 1314 | |
1315 | - // Enqueue scripts |
|
1316 | - wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
|
1315 | + // Enqueue scripts |
|
1316 | + wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
|
1317 | 1317 | |
1318 | 1318 | wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
1319 | 1319 | 'cookiepath' => COOKIEPATH, |
@@ -1340,8 +1340,8 @@ discard block |
||
1340 | 1340 | ) |
1341 | 1341 | ) ); |
1342 | 1342 | |
1343 | - // Enqueue scripts needed for merge tags |
|
1344 | - self::enqueue_gravity_forms_scripts(); |
|
1343 | + // Enqueue scripts needed for merge tags |
|
1344 | + self::enqueue_gravity_forms_scripts(); |
|
1345 | 1345 | |
1346 | 1346 | wp_enqueue_style( 'gravityview_views_styles' ); |
1347 | 1347 | |
@@ -1353,24 +1353,24 @@ discard block |
||
1353 | 1353 | |
1354 | 1354 | /** |
1355 | 1355 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
1356 | - * |
|
1357 | - * @since 1.0.5-beta |
|
1358 | - * |
|
1359 | - * @return void |
|
1356 | + * |
|
1357 | + * @since 1.0.5-beta |
|
1358 | + * |
|
1359 | + * @return void |
|
1360 | 1360 | */ |
1361 | 1361 | static function enqueue_gravity_forms_scripts() { |
1362 | 1362 | GFForms::register_scripts(); |
1363 | 1363 | |
1364 | 1364 | $scripts = array( |
1365 | - 'sack', |
|
1366 | - 'gform_gravityforms', |
|
1367 | - 'gform_forms', |
|
1368 | - 'gform_form_admin', |
|
1369 | - 'jquery-ui-autocomplete' |
|
1365 | + 'sack', |
|
1366 | + 'gform_gravityforms', |
|
1367 | + 'gform_forms', |
|
1368 | + 'gform_form_admin', |
|
1369 | + 'jquery-ui-autocomplete' |
|
1370 | 1370 | ); |
1371 | 1371 | |
1372 | 1372 | if ( wp_is_mobile() ) { |
1373 | - $scripts[] = 'jquery-touch-punch'; |
|
1373 | + $scripts[] = 'jquery-touch-punch'; |
|
1374 | 1374 | } |
1375 | 1375 | |
1376 | 1376 | wp_enqueue_script( $scripts ); |
@@ -27,35 +27,35 @@ discard block |
||
27 | 27 | add_filter( 'gravityview_blocklist_field_types', array( $this, 'default_field_blocklist' ), 10, 2 ); |
28 | 28 | |
29 | 29 | // Tooltips |
30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
31 | 31 | |
32 | 32 | add_filter( 'admin_body_class', array( $this, 'add_gf_version_css_class' ) ); |
33 | 33 | |
34 | 34 | // adding styles and scripts |
35 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
36 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
39 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
40 | - |
|
41 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 5 ); |
|
42 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
43 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 ); |
|
44 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
45 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
46 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
47 | - add_filter( 'gravityview/view/configuration/fields', array( $this, 'set_default_view_fields'), 10, 3 ); |
|
35 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
36 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
39 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
40 | + |
|
41 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 5 ); |
|
42 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
43 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 ); |
|
44 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
45 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
46 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
47 | + add_filter( 'gravityview/view/configuration/fields', array( $this, 'set_default_view_fields' ), 10, 3 ); |
|
48 | 48 | |
49 | 49 | // @todo check if this hook is needed.. |
50 | 50 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
51 | 51 | |
52 | 52 | // Add Connected Form column |
53 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
53 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
54 | 54 | |
55 | 55 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
56 | 56 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
57 | 57 | |
58 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
58 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
59 | 59 | |
60 | 60 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
61 | 61 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $major_version = explode( '.', GFForms::$version ); |
88 | 88 | |
89 | 89 | if ( 2 <= sizeof( $major_version ) ) { |
90 | - $class .= ' gf-minor-version-' . esc_attr( $major_version[0] . '-' . $major_version[1] ); |
|
90 | + $class .= ' gf-minor-version-' . esc_attr( $major_version[ 0 ] . '-' . $major_version[ 1 ] ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $class; |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function suggest_support_articles( $localization_data = array() ) { |
104 | 104 | |
105 | - if( ! gravityview()->request->is_view( false ) ) { |
|
105 | + if ( ! gravityview()->request->is_view( false ) ) { |
|
106 | 106 | return $localization_data; |
107 | 107 | } |
108 | 108 | |
109 | - $localization_data['suggest'] = array( |
|
109 | + $localization_data[ 'suggest' ] = array( |
|
110 | 110 | '57ef23539033602e61d4a560', |
111 | 111 | '54c67bb9e4b0512429885513', |
112 | 112 | '54c67bb9e4b0512429885512', |
@@ -135,20 +135,20 @@ discard block |
||
135 | 135 | return; |
136 | 136 | } |
137 | 137 | |
138 | - if ( ! isset( $query->query_vars['post_type'] ) ) { |
|
138 | + if ( ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | |
142 | - if ( 'gravityview' !== $query->query_vars['post_type'] ) { |
|
142 | + if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) { |
|
143 | 143 | return; |
144 | 144 | } |
145 | 145 | |
146 | - $form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' ); |
|
146 | + $form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' ); |
|
147 | 147 | |
148 | 148 | $meta_query = array(); |
149 | 149 | |
150 | 150 | if ( $form_id ) { |
151 | - $meta_query[] = array( |
|
151 | + $meta_query[ ] = array( |
|
152 | 152 | 'key' => '_gravityview_form_id', |
153 | 153 | 'value' => $form_id, |
154 | 154 | ); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $layout_id = \GV\Utils::_GET( 'gravityview_layout' ); |
158 | 158 | |
159 | 159 | if ( $layout_id ) { |
160 | - $meta_query[] = array( |
|
160 | + $meta_query[ ] = array( |
|
161 | 161 | 'key' => '_gravityview_directory_template', |
162 | 162 | 'value' => esc_attr( $layout_id ), |
163 | 163 | ); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function add_view_dropdown() { |
175 | 175 | $current_screen = get_current_screen(); |
176 | 176 | |
177 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
177 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
183 | 183 | |
184 | 184 | // If there are no forms to select, show no forms. |
185 | - if( ! empty( $forms ) ) { ?> |
|
185 | + if ( ! empty( $forms ) ) { ?> |
|
186 | 186 | <label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gk-gravityview' ); ?></label> |
187 | 187 | <select name="gravityview_form_id" id="gravityview_form_id"> |
188 | 188 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gk-gravityview' ); ?></option> |
189 | - <?php foreach( $forms as $form ) { ?> |
|
190 | - <option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
189 | + <?php foreach ( $forms as $form ) { ?> |
|
190 | + <option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
191 | 191 | <?php } ?> |
192 | 192 | </select> |
193 | 193 | <?php } |
@@ -196,26 +196,26 @@ discard block |
||
196 | 196 | $current_layout = \GV\Utils::_GET( 'gravityview_layout' ); |
197 | 197 | |
198 | 198 | // If there are no forms to select, show no forms. |
199 | - if( ! empty( $layouts ) ) { ?> |
|
199 | + if ( ! empty( $layouts ) ) { ?> |
|
200 | 200 | <label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gk-gravityview' ); ?></label> |
201 | 201 | <select name="gravityview_layout" id="gravityview_layout_name"> |
202 | 202 | <option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gk-gravityview' ); ?></option> |
203 | 203 | <optgroup label="<?php esc_html_e( 'Layouts', 'gk-gravityview' ); ?>"> |
204 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
205 | - if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) { |
|
204 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
205 | + if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) { |
|
206 | 206 | continue; |
207 | 207 | } |
208 | 208 | ?> |
209 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
209 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
210 | 210 | <?php } ?> |
211 | 211 | </optgroup> |
212 | 212 | <optgroup label="<?php esc_html_e( 'Form Presets', 'gk-gravityview' ); ?>"> |
213 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
214 | - if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) { |
|
213 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
214 | + if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) { |
|
215 | 215 | continue; |
216 | 216 | } |
217 | 217 | ?> |
218 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
218 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
219 | 219 | <?php } ?> |
220 | 220 | </optgroup> |
221 | 221 | </select> |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
231 | 231 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
232 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
232 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | |
260 | 260 | $priority = 0; |
261 | 261 | |
262 | - if( 'form_list' === GFForms::get_page() ) { |
|
262 | + if ( 'form_list' === GFForms::get_page() ) { |
|
263 | 263 | $priority = 790; |
264 | 264 | } |
265 | 265 | |
266 | - if( empty( $connected_views ) ) { |
|
266 | + if ( empty( $connected_views ) ) { |
|
267 | 267 | |
268 | - $menu_items['gravityview'] = array( |
|
268 | + $menu_items[ 'gravityview' ] = array( |
|
269 | 269 | 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
270 | 270 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5 |
271 | 271 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | $sub_menu_items = array(); |
282 | 282 | foreach ( (array)$connected_views as $view ) { |
283 | 283 | |
284 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
284 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | |
288 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gk-gravityview' ), $view->ID ) : $view->post_title; |
|
288 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gk-gravityview' ), $view->ID ) : $view->post_title; |
|
289 | 289 | |
290 | - $sub_menu_items[] = array( |
|
290 | + $sub_menu_items[ ] = array( |
|
291 | 291 | 'label' => str_replace( '%', '%%', esc_attr( $label ) ), |
292 | 292 | 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
293 | 293 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | // If there were no items added, then let's create the parent menu |
298 | - if( $sub_menu_items ) { |
|
298 | + if ( $sub_menu_items ) { |
|
299 | 299 | |
300 | - $sub_menu_items[] = array( |
|
300 | + $sub_menu_items[ ] = array( |
|
301 | 301 | 'label' => esc_attr__( 'Create a View', 'gk-gravityview' ), |
302 | 302 | 'icon' => '<span class="dashicons dashicons-plus"></span>', |
303 | 303 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gk-gravityview' ), |
@@ -306,14 +306,14 @@ discard block |
||
306 | 306 | ); |
307 | 307 | |
308 | 308 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
309 | - $sub_menu_items[] = array( |
|
309 | + $sub_menu_items[ ] = array( |
|
310 | 310 | 'url' => '#', |
311 | 311 | 'label' => '', |
312 | 312 | 'menu_class' => 'hidden', |
313 | 313 | 'capabilities' => '', |
314 | 314 | ); |
315 | 315 | |
316 | - $menu_items['gravityview'] = array( |
|
316 | + $menu_items[ 'gravityview' ] = array( |
|
317 | 317 | 'label' => __( 'Connected Views', 'gk-gravityview' ), |
318 | 318 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
319 | 319 | 'title' => __( 'GravityView Views using this form as a data source', 'gk-gravityview' ), |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | $add = array( 'captcha', 'page' ); |
345 | 345 | |
346 | 346 | // Don't allowing editing the following values: |
347 | - if( $context === 'edit' ) { |
|
348 | - $add[] = 'post_id'; |
|
347 | + if ( $context === 'edit' ) { |
|
348 | + $add[ ] = 'post_id'; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | $return = array_merge( $array, $add ); |
@@ -376,27 +376,27 @@ discard block |
||
376 | 376 | foreach ( $default_args as $key => $arg ) { |
377 | 377 | |
378 | 378 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
379 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
379 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
380 | 380 | |
381 | 381 | // By default, use `tooltip` if defined. |
382 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
382 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
383 | 383 | |
384 | 384 | // If there's no tooltip set, continue |
385 | - if( empty( $tooltip ) ) { |
|
385 | + if ( empty( $tooltip ) ) { |
|
386 | 386 | continue; |
387 | 387 | } |
388 | 388 | |
389 | 389 | // Add the tooltip |
390 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
391 | - 'title' => $arg['label'], |
|
390 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
391 | + 'title' => $arg[ 'label' ], |
|
392 | 392 | 'value' => $tooltip, |
393 | 393 | ); |
394 | 394 | |
395 | 395 | } |
396 | 396 | |
397 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
398 | - 'title' => __('CSS Merge Tags', 'gk-gravityview'), |
|
399 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gk-gravityview'), '<code>', '</code>' ) |
|
397 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
398 | + 'title' => __( 'CSS Merge Tags', 'gk-gravityview' ), |
|
399 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gk-gravityview' ), '<code>', '</code>' ) |
|
400 | 400 | ); |
401 | 401 | |
402 | 402 | /** |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | |
415 | 415 | foreach ( $gv_tooltips as $key => $tooltip ) { |
416 | 416 | |
417 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
417 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
418 | 418 | |
419 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
419 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | return $tooltips; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @return void |
432 | 432 | */ |
433 | - public function add_custom_column_content( $column_name = null, $post_id = 0 ) { |
|
433 | + public function add_custom_column_content( $column_name = null, $post_id = 0 ) { |
|
434 | 434 | |
435 | 435 | $output = ''; |
436 | 436 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
453 | 453 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
454 | 454 | |
455 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
455 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
456 | 456 | |
457 | 457 | break; |
458 | 458 | |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
494 | 494 | |
495 | 495 | // Either the form is empty or the form ID is 0, not yet set. |
496 | - if( empty( $form ) ) { |
|
496 | + if ( empty( $form ) ) { |
|
497 | 497 | return ''; |
498 | 498 | } |
499 | 499 | |
500 | 500 | // The $form is passed as the form ID |
501 | - if( !is_array( $form ) ) { |
|
501 | + if ( ! is_array( $form ) ) { |
|
502 | 502 | $form = gravityview_get_form( $form ); |
503 | 503 | } |
504 | 504 | |
@@ -506,35 +506,35 @@ discard block |
||
506 | 506 | return ''; |
507 | 507 | } |
508 | 508 | |
509 | - $form_id = $form['id']; |
|
509 | + $form_id = $form[ 'id' ]; |
|
510 | 510 | $links = array(); |
511 | 511 | |
512 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
512 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
513 | 513 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
514 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
515 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gk-gravityview') ).'</span>'; |
|
514 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
515 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gk-gravityview' ) ) . '</span>'; |
|
516 | 516 | } else { |
517 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
517 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
518 | 518 | } |
519 | 519 | |
520 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
520 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
521 | 521 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
522 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gk-gravityview') ).'</span>'; |
|
522 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gk-gravityview' ) ) . '</span>'; |
|
523 | 523 | } |
524 | 524 | |
525 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
525 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
526 | 526 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
527 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gk-gravityview'), 'title='.__('Edit settings for this form', 'gk-gravityview') ).'</span>'; |
|
527 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gk-gravityview' ), 'title=' . __( 'Edit settings for this form', 'gk-gravityview' ) ) . '</span>'; |
|
528 | 528 | } |
529 | 529 | |
530 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
530 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
531 | 531 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
532 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gk-gravityview'), 'title='.__('Preview this form', 'gk-gravityview') ).'</span>'; |
|
532 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gk-gravityview' ), 'title=' . __( 'Preview this form', 'gk-gravityview' ) ) . '</span>'; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | $output = ''; |
536 | 536 | |
537 | - if( !empty( $include_form_link ) ) { |
|
537 | + if ( ! empty( $include_form_link ) ) { |
|
538 | 538 | $output .= $form_link; |
539 | 539 | } |
540 | 540 | |
@@ -549,11 +549,11 @@ discard block |
||
549 | 549 | $css_class = 'row-actions'; |
550 | 550 | |
551 | 551 | // Is Screen Options > View mode set to "Extended view"? If so, keep actions visible. |
552 | - if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
552 | + if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
553 | 553 | $css_class = 'row-actions visible'; |
554 | 554 | } |
555 | 555 | |
556 | - $output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>'; |
|
556 | + $output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>'; |
|
557 | 557 | |
558 | 558 | return $output; |
559 | 559 | } |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | // Get the date column and save it for later to add back in. |
568 | 568 | // This adds it after the Data Source column. |
569 | 569 | // This way, we don't need to do array_slice, array_merge, etc. |
570 | - $date = $columns['date']; |
|
571 | - unset( $columns['date'] ); |
|
570 | + $date = $columns[ 'date' ]; |
|
571 | + unset( $columns[ 'date' ] ); |
|
572 | 572 | |
573 | 573 | $data_source_required_caps = array( |
574 | 574 | 'gravityforms_edit_forms', |
@@ -579,14 +579,14 @@ discard block |
||
579 | 579 | 'gravityforms_preview_forms', |
580 | 580 | ); |
581 | 581 | |
582 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
583 | - $columns['gv_connected_form'] = __( 'Data Source', 'gk-gravityview' ); |
|
582 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
583 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gk-gravityview' ); |
|
584 | 584 | } |
585 | 585 | |
586 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gk-gravityview' ); |
|
586 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gk-gravityview' ); |
|
587 | 587 | |
588 | 588 | // Add the date back in. |
589 | - $columns['date'] = $date; |
|
589 | + $columns[ 'date' ] = $date; |
|
590 | 590 | |
591 | 591 | return $columns; |
592 | 592 | } |
@@ -599,12 +599,12 @@ discard block |
||
599 | 599 | */ |
600 | 600 | function save_postdata( $post_id ) { |
601 | 601 | |
602 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
602 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
603 | 603 | return; |
604 | 604 | } |
605 | 605 | |
606 | 606 | // validate post_type |
607 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
607 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
608 | 608 | return; |
609 | 609 | } |
610 | 610 | |
@@ -619,63 +619,63 @@ discard block |
||
619 | 619 | $statii = array(); |
620 | 620 | |
621 | 621 | // check if this is a start fresh View |
622 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
622 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
623 | 623 | |
624 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
624 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
625 | 625 | // save form id |
626 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
626 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
627 | 627 | |
628 | 628 | } |
629 | 629 | |
630 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
630 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
631 | 631 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
632 | 632 | return; |
633 | 633 | } |
634 | 634 | |
635 | 635 | // Was this a start fresh? |
636 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
637 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
636 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
637 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
638 | 638 | } else { |
639 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
639 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | // Check if we have a template id |
643 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
643 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
644 | 644 | |
645 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
645 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
646 | 646 | |
647 | 647 | // now save template id |
648 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
648 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | |
652 | 652 | // save View Configuration metabox |
653 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
653 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
654 | 654 | |
655 | 655 | // template settings |
656 | - if( empty( $_POST['template_settings'] ) ) { |
|
657 | - $_POST['template_settings'] = array(); |
|
656 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
657 | + $_POST[ 'template_settings' ] = array(); |
|
658 | 658 | } |
659 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
659 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
660 | 660 | |
661 | 661 | // guard against unloaded View configuration page |
662 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
662 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
663 | 663 | $fields = array(); |
664 | 664 | |
665 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
665 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
666 | 666 | $fields = _gravityview_process_posted_fields(); |
667 | 667 | } |
668 | 668 | |
669 | 669 | $fields = wp_slash( $fields ); |
670 | 670 | |
671 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
671 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | // Directory Visible Widgets |
675 | - if( empty( $_POST['widgets'] ) ) { |
|
676 | - $_POST['widgets'] = array(); |
|
675 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
676 | + $_POST[ 'widgets' ] = array(); |
|
677 | 677 | } |
678 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
678 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
679 | 679 | |
680 | 680 | } // end save view configuration |
681 | 681 | |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
686 | 686 | * @since 1.17.2 |
687 | 687 | */ |
688 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
688 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
689 | 689 | |
690 | 690 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
691 | 691 | } |
@@ -734,20 +734,20 @@ discard block |
||
734 | 734 | |
735 | 735 | $output = ''; |
736 | 736 | |
737 | - if( !empty( $fields ) ) { |
|
737 | + if ( ! empty( $fields ) ) { |
|
738 | 738 | |
739 | - foreach( $fields as $id => $details ) { |
|
739 | + foreach ( $fields as $id => $details ) { |
|
740 | 740 | |
741 | - if( in_array( $details['type'], (array) $blocklist_field_types ) ) { |
|
741 | + if ( in_array( $details[ 'type' ], (array)$blocklist_field_types ) ) { |
|
742 | 742 | continue; |
743 | 743 | } |
744 | 744 | |
745 | 745 | // Edit mode only allows editing the parent fields, not single inputs. |
746 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
746 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
747 | 747 | continue; |
748 | 748 | } |
749 | 749 | |
750 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form_id, $form ); |
|
750 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form_id, $form ); |
|
751 | 751 | |
752 | 752 | } // End foreach |
753 | 753 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | echo $output; |
756 | 756 | |
757 | 757 | // For the EDIT view we only want to allow the form fields. |
758 | - if( $context === 'edit' ) { |
|
758 | + if ( $context === 'edit' ) { |
|
759 | 759 | return; |
760 | 760 | } |
761 | 761 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | $additional_fields = array( |
777 | 777 | array( |
778 | 778 | 'label_text' => __( 'Add All Form Fields', 'gk-gravityview' ), |
779 | - 'desc' => __('Insert all the form fields at once.', 'gk-gravityview'), |
|
779 | + 'desc' => __( 'Insert all the form fields at once.', 'gk-gravityview' ), |
|
780 | 780 | 'field_id' => 'all-fields', |
781 | 781 | 'label_type' => 'field', |
782 | 782 | 'input_type' => null, |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | */ |
793 | 793 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
794 | 794 | |
795 | - foreach ( (array) $additional_fields as $item ) { |
|
795 | + foreach ( (array)$additional_fields as $item ) { |
|
796 | 796 | |
797 | 797 | // Prevent items from not having index set |
798 | 798 | $item = wp_parse_args( $item, array( |
@@ -803,16 +803,16 @@ discard block |
||
803 | 803 | 'field_options' => null, |
804 | 804 | 'settings_html' => null, |
805 | 805 | 'icon' => null, |
806 | - )); |
|
806 | + ) ); |
|
807 | 807 | |
808 | 808 | // Backward compat. |
809 | - if( !empty( $item['field_options'] ) ) { |
|
809 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
810 | 810 | // Use settings_html from now on. |
811 | - $item['settings_html'] = $item['field_options']; |
|
811 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | // Render a label for each of them |
815 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form_id, $form ); |
|
815 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form_id, $form ); |
|
816 | 816 | |
817 | 817 | } |
818 | 818 | |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
825 | 825 | * @return array |
826 | 826 | */ |
827 | - function get_entry_default_fields($form, $zone) { |
|
827 | + function get_entry_default_fields( $form, $zone ) { |
|
828 | 828 | |
829 | 829 | $entry_default_fields = array(); |
830 | 830 | |
831 | 831 | // if in zone directory or single |
832 | - if( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
832 | + if ( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
833 | 833 | |
834 | 834 | $meta_fields = GravityView_Fields::get_all( array( 'meta', 'gravityview', 'add-ons' ) ); |
835 | 835 | |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | * @param string|array $form form_ID or form object |
847 | 847 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
848 | 848 | */ |
849 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
849 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | /** |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | */ |
858 | 858 | function get_available_fields( $form = '', $zone = NULL ) { |
859 | 859 | |
860 | - if( empty( $form ) ) { |
|
860 | + if ( empty( $form ) ) { |
|
861 | 861 | gravityview()->log->error( '$form is empty' ); |
862 | 862 | return array(); |
863 | 863 | } |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | $fields = gravityview_get_form_fields( $form, true ); |
867 | 867 | |
868 | 868 | // get meta fields ( only if form was already created ) |
869 | - if( !is_array( $form ) ) { |
|
869 | + if ( ! is_array( $form ) ) { |
|
870 | 870 | $meta_fields = gravityview_get_entry_meta( $form ); |
871 | 871 | } else { |
872 | 872 | $meta_fields = array(); |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | $fields = $fields + $meta_fields + $default_fields; |
880 | 880 | |
881 | 881 | // Move Custom Content to top |
882 | - if ( isset( $fields['custom'] ) ) { |
|
883 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
882 | + if ( isset( $fields[ 'custom' ] ) ) { |
|
883 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | $gv_fields = GravityView_Fields::get_all(); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | foreach ( $fields as &$field ) { |
889 | 889 | foreach ( $gv_fields as $gv_field ) { |
890 | 890 | if ( \GV\Utils::get( $field, 'type' ) === $gv_field->name ) { |
891 | - $field['icon'] = $gv_field->get_icon(); |
|
891 | + $field[ 'icon' ] = $gv_field->get_icon(); |
|
892 | 892 | } |
893 | 893 | } |
894 | 894 | } |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | } |
917 | 917 | |
918 | 918 | foreach ( $widgets as $id => $details ) { |
919 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
919 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | } |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
947 | 947 | global $post; |
948 | 948 | |
949 | - if( $type === 'widget' ) { |
|
949 | + if ( $type === 'widget' ) { |
|
950 | 950 | $button_label = __( 'Add Widget', 'gk-gravityview' ); |
951 | 951 | } else { |
952 | 952 | $button_label = __( 'Add Field', 'gk-gravityview' ); |
@@ -973,14 +973,14 @@ discard block |
||
973 | 973 | $form = false; |
974 | 974 | |
975 | 975 | // if saved values, get available fields to label everyone |
976 | - if( !empty( $values ) && ( !empty( $post->ID ) || ! empty( $_POST['template_id'] ) || ! empty( $_POST['form_id'] ) ) ) { |
|
976 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) || ! empty( $_POST[ 'form_id' ] ) ) ) { |
|
977 | 977 | |
978 | - if ( ! empty( $_POST['form_id'] ) ) { |
|
979 | - $form_id = (int) \GV\Utils::_POST( 'form_id', 0 ); |
|
978 | + if ( ! empty( $_POST[ 'form_id' ] ) ) { |
|
979 | + $form_id = (int)\GV\Utils::_POST( 'form_id', 0 ); |
|
980 | 980 | $form = gravityview_get_form( $form_id ); |
981 | - } elseif( ! empty( $_POST['template_id'] ) ) { |
|
982 | - $form_id = esc_attr( $_POST['template_id'] ); |
|
983 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
981 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
982 | + $form_id = esc_attr( $_POST[ 'template_id' ] ); |
|
983 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
984 | 984 | } else { |
985 | 985 | $form_id = gravityview_get_form_id( $post->ID ); |
986 | 986 | $form = gravityview_get_form( $form_id ); |
@@ -1001,47 +1001,47 @@ discard block |
||
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | |
1004 | - foreach( $rows as $row ) : |
|
1005 | - foreach( $row as $col => $areas ) : |
|
1006 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
1004 | + foreach ( $rows as $row ) : |
|
1005 | + foreach ( $row as $col => $areas ) : |
|
1006 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
1007 | 1007 | |
1008 | 1008 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
1009 | 1009 | |
1010 | - <?php foreach( $areas as $area ) : ?> |
|
1010 | + <?php foreach ( $areas as $area ) : ?> |
|
1011 | 1011 | |
1012 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1013 | - <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area['subtitle'] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
1014 | - <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area['title'] ); ?></strong> |
|
1012 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1013 | + <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area[ 'subtitle' ] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
1014 | + <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area[ 'title' ] ); ?></strong> |
|
1015 | 1015 | |
1016 | 1016 | <?php if ( 'widget' !== $type ) { ?> |
1017 | - <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php esc_html_e( 'Clear all fields', 'gk-gravityview' ); ?></a> |
|
1017 | + <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php esc_html_e( 'Clear all fields', 'gk-gravityview' ); ?></a> |
|
1018 | 1018 | <?php } ?> |
1019 | 1019 | |
1020 | - <?php if ( ! empty( $area['subtitle'] ) ) { ?> |
|
1021 | - <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area['subtitle'] ); ?>"></span></span> |
|
1020 | + <?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?> |
|
1021 | + <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area[ 'subtitle' ] ); ?>"></span></span> |
|
1022 | 1022 | <?php } ?> |
1023 | 1023 | </p> |
1024 | 1024 | <div class="active-drop-container active-drop-container-<?php echo esc_attr( $type ); ?>"> |
1025 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php // render saved fields |
|
1026 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
1025 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php // render saved fields |
|
1026 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
1027 | 1027 | |
1028 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
1028 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
1029 | 1029 | |
1030 | 1030 | // Maybe has a form ID |
1031 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
1031 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
1032 | 1032 | |
1033 | 1033 | $input_type = null; |
1034 | 1034 | |
1035 | 1035 | if ( $form_id ) { |
1036 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
1036 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
1037 | 1037 | } else { |
1038 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
1038 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | if ( ! $original_item ) { |
1042 | 1042 | |
1043 | 1043 | global $pagenow; |
1044 | - if ( 'post-new.php' !== $pagenow ) { |
|
1044 | + if ( 'post-new.php' !== $pagenow ) { |
|
1045 | 1045 | gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( |
1046 | 1046 | ' data' => array( |
1047 | 1047 | 'available_items' => $available_items, |
@@ -1053,10 +1053,10 @@ discard block |
||
1053 | 1053 | $original_item = $field; |
1054 | 1054 | } |
1055 | 1055 | |
1056 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : null; |
|
1056 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : null; |
|
1057 | 1057 | |
1058 | 1058 | // Field options dialog box |
1059 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1059 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1060 | 1060 | |
1061 | 1061 | $item = array( |
1062 | 1062 | 'input_type' => $input_type, |
@@ -1069,12 +1069,12 @@ discard block |
||
1069 | 1069 | $item = wp_parse_args( $item, $original_item ); |
1070 | 1070 | } |
1071 | 1071 | |
1072 | - switch( $type ) { |
|
1072 | + switch ( $type ) { |
|
1073 | 1073 | case 'widget': |
1074 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
1074 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
1075 | 1075 | break; |
1076 | 1076 | default: |
1077 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id, $form ); |
|
1077 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id, $form ); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | <div class="gv-droppable-area-action"> |
1083 | 1083 | <a href="#" class="gv-add-field button button-link button-hero" title="" |
1084 | 1084 | data-objecttype="<?php echo esc_attr( $type ); ?>" |
1085 | - data-areaid="<?php echo esc_attr( $zone . '_' . $area['areaid'] ); ?>" |
|
1085 | + data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" |
|
1086 | 1086 | data-context="<?php echo esc_attr( $zone ); ?>" |
1087 | 1087 | data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '<span class="dashicons dashicons-plus-alt"></span>' . esc_html( $button_label ); ?></a> |
1088 | 1088 | </div> |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | // This is a new View, prefill the widgets |
1116 | 1116 | $widgets = array( |
1117 | 1117 | 'header_top' => array( |
1118 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
1118 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
1119 | 1119 | 'id' => 'search_bar', |
1120 | 1120 | 'label' => __( 'Search Bar', 'gk-gravityview' ), |
1121 | 1121 | 'search_layout' => 'horizontal', |
@@ -1190,12 +1190,12 @@ discard block |
||
1190 | 1190 | if ( $post ) { |
1191 | 1191 | $source_form_id = gravityview_get_form_id( $post->ID ); |
1192 | 1192 | if ( $source_form_id ) { |
1193 | - $form_ids[] = $source_form_id; |
|
1193 | + $form_ids[ ] = $source_form_id; |
|
1194 | 1194 | } |
1195 | 1195 | |
1196 | 1196 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
1197 | 1197 | foreach ( $joined_forms as $joined_form ) { |
1198 | - $form_ids[] = $joined_form->ID; |
|
1198 | + $form_ids[ ] = $joined_form->ID; |
|
1199 | 1199 | } |
1200 | 1200 | } |
1201 | 1201 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | * @return string HTML of the active areas |
1237 | 1237 | */ |
1238 | 1238 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = 0, $echo = false, $form_id = 0 ) { |
1239 | - if( empty( $template_id ) ) { |
|
1239 | + if ( empty( $template_id ) ) { |
|
1240 | 1240 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
1241 | 1241 | return ''; |
1242 | 1242 | } |
@@ -1250,13 +1250,13 @@ discard block |
||
1250 | 1250 | */ |
1251 | 1251 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
1252 | 1252 | |
1253 | - if( empty( $template_areas ) ) { |
|
1253 | + if ( empty( $template_areas ) ) { |
|
1254 | 1254 | |
1255 | 1255 | gravityview()->log->error( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
1256 | 1256 | |
1257 | 1257 | $output = '<div>'; |
1258 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gk-gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
1259 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gk-gravityview').'</p>'; |
|
1258 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gk-gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
1259 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gk-gravityview' ) . '</p>'; |
|
1260 | 1260 | $output .= '</div>'; |
1261 | 1261 | } else { |
1262 | 1262 | |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | |
1269 | 1269 | } |
1270 | 1270 | |
1271 | - if( $echo ) { |
|
1271 | + if ( $echo ) { |
|
1272 | 1272 | echo $output; |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | |
1300 | 1300 | foreach ( $columns as $column_id => $column ) { |
1301 | 1301 | |
1302 | - $gv_field = GravityView_Fields::get_instance( $column['type'] ); |
|
1302 | + $gv_field = GravityView_Fields::get_instance( $column[ 'type' ] ); |
|
1303 | 1303 | |
1304 | 1304 | if ( ! $gv_field ) { |
1305 | 1305 | continue; |
@@ -1318,7 +1318,7 @@ discard block |
||
1318 | 1318 | $form = GV\GF_Form::by_id( $form_id ); |
1319 | 1319 | $entry_fields = array(); |
1320 | 1320 | |
1321 | - foreach( $form->form['fields'] as $gv_field ) { |
|
1321 | + foreach ( $form->form[ 'fields' ] as $gv_field ) { |
|
1322 | 1322 | |
1323 | 1323 | $entry_fields[ uniqid( '', true ) ] = array( |
1324 | 1324 | 'label' => $gv_field->label, |
@@ -1366,18 +1366,18 @@ discard block |
||
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | // Add the GV font (with the Astronaut) |
1369 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
1369 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
1370 | 1370 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
1371 | 1371 | |
1372 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1372 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1373 | 1373 | |
1374 | - if( GFForms::get_page() === 'form_list' ) { |
|
1374 | + if ( GFForms::get_page() === 'form_list' ) { |
|
1375 | 1375 | wp_enqueue_style( 'gravityview_views_styles' ); |
1376 | 1376 | return; |
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | // Don't process any scripts below here if it's not a GravityView page. |
1380 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1380 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1381 | 1381 | return; |
1382 | 1382 | } |
1383 | 1383 | |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | |
1386 | 1386 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1387 | 1387 | |
1388 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
1388 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
1389 | 1389 | |
1390 | 1390 | // Enqueue scripts |
1391 | 1391 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
@@ -1393,8 +1393,8 @@ discard block |
||
1393 | 1393 | wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
1394 | 1394 | 'cookiepath' => COOKIEPATH, |
1395 | 1395 | 'admin_cookiepath' => ADMIN_COOKIE_PATH, |
1396 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
1397 | - 'has_merge_tag_listener' => (bool) version_compare( GFForms::$version, '2.6.4', '>=' ), |
|
1396 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
1397 | + 'has_merge_tag_listener' => (bool)version_compare( GFForms::$version, '2.6.4', '>=' ), |
|
1398 | 1398 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1399 | 1399 | 'label_viewname' => __( 'Enter View name here', 'gk-gravityview' ), |
1400 | 1400 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gk-gravityview' ), |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | wp_enqueue_style( 'gravityview_views_styles' ); |
1422 | 1422 | |
1423 | 1423 | // 2.5 changed how Merge Tags are enqueued |
1424 | - if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
|
1424 | + if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) { |
|
1425 | 1425 | GFCommon::output_hooks_javascript(); |
1426 | 1426 | } |
1427 | 1427 | } |
@@ -1445,7 +1445,7 @@ discard block |
||
1445 | 1445 | ); |
1446 | 1446 | |
1447 | 1447 | if ( wp_is_mobile() ) { |
1448 | - $scripts[] = 'jquery-touch-punch'; |
|
1448 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1449 | 1449 | } |
1450 | 1450 | |
1451 | 1451 | wp_enqueue_script( $scripts ); |
@@ -18,84 +18,84 @@ discard block |
||
18 | 18 | |
19 | 19 | class GravityView_Edit_Entry { |
20 | 20 | |
21 | - /** |
|
22 | - * @var string |
|
23 | - */ |
|
21 | + /** |
|
22 | + * @var string |
|
23 | + */ |
|
24 | 24 | static $file; |
25 | 25 | |
26 | 26 | static $instance; |
27 | 27 | |
28 | - /** |
|
29 | - * Component instances. |
|
30 | - * @var array |
|
31 | - */ |
|
32 | - public $instances = array(); |
|
28 | + /** |
|
29 | + * Component instances. |
|
30 | + * @var array |
|
31 | + */ |
|
32 | + public $instances = array(); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | function __construct() { |
36 | 36 | |
37 | - self::$file = plugin_dir_path( __FILE__ ); |
|
37 | + self::$file = plugin_dir_path( __FILE__ ); |
|
38 | 38 | |
39 | - if( is_admin() ) { |
|
40 | - $this->load_components( 'admin' ); |
|
41 | - } |
|
39 | + if( is_admin() ) { |
|
40 | + $this->load_components( 'admin' ); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | $this->load_components( 'locking' ); |
44 | 44 | |
45 | - $this->load_components( 'render' ); |
|
45 | + $this->load_components( 'render' ); |
|
46 | 46 | |
47 | - // If GF User Registration Add-on exists |
|
48 | - $this->load_components( 'user-registration' ); |
|
47 | + // If GF User Registration Add-on exists |
|
48 | + $this->load_components( 'user-registration' ); |
|
49 | 49 | |
50 | - $this->add_hooks(); |
|
50 | + $this->add_hooks(); |
|
51 | 51 | |
52 | 52 | // Process hooks for addons that may or may not be present |
53 | 53 | $this->addon_specific_hooks(); |
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | - static function getInstance() { |
|
57 | + static function getInstance() { |
|
58 | 58 | |
59 | - if( empty( self::$instance ) ) { |
|
60 | - self::$instance = new GravityView_Edit_Entry; |
|
61 | - } |
|
59 | + if( empty( self::$instance ) ) { |
|
60 | + self::$instance = new GravityView_Edit_Entry; |
|
61 | + } |
|
62 | 62 | |
63 | - return self::$instance; |
|
64 | - } |
|
63 | + return self::$instance; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - private function load_components( $component ) { |
|
67 | + private function load_components( $component ) { |
|
68 | 68 | |
69 | - $dir = trailingslashit( self::$file ); |
|
69 | + $dir = trailingslashit( self::$file ); |
|
70 | 70 | |
71 | - $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
72 | - $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
71 | + $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
72 | + $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
73 | 73 | |
74 | - // Loads component and pass extension's instance so that component can |
|
75 | - // talk each other. |
|
76 | - require_once $filename; |
|
77 | - $this->instances[ $component ] = new $classname( $this ); |
|
78 | - $this->instances[ $component ]->load(); |
|
74 | + // Loads component and pass extension's instance so that component can |
|
75 | + // talk each other. |
|
76 | + require_once $filename; |
|
77 | + $this->instances[ $component ] = new $classname( $this ); |
|
78 | + $this->instances[ $component ]->load(); |
|
79 | 79 | |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - private function add_hooks() { |
|
82 | + private function add_hooks() { |
|
83 | 83 | |
84 | - // Add front-end access to Gravity Forms delete file action |
|
85 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') ); |
|
84 | + // Add front-end access to Gravity Forms delete file action |
|
85 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') ); |
|
86 | 86 | |
87 | - // Make sure this hook is run for non-admins |
|
88 | - add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') ); |
|
87 | + // Make sure this hook is run for non-admins |
|
88 | + add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') ); |
|
89 | 89 | |
90 | - add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 ); |
|
90 | + add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 ); |
|
91 | 91 | |
92 | - // add template path to check for field |
|
93 | - add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
92 | + // add template path to check for field |
|
93 | + add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
94 | 94 | |
95 | 95 | add_filter( 'gravityview/field/is_visible', array( $this, 'maybe_not_visible' ), 10, 3 ); |
96 | 96 | |
97 | 97 | add_filter( 'gravityview/api/reserved_query_args', array( $this, 'add_reserved_arg' ) ); |
98 | - } |
|
98 | + } |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Adds "edit" to the list of internal reserved query args |
@@ -166,87 +166,87 @@ discard block |
||
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | |
169 | - /** |
|
170 | - * Include this extension templates path |
|
171 | - * @param array $file_paths List of template paths ordered |
|
172 | - */ |
|
173 | - public function add_template_path( $file_paths ) { |
|
174 | - |
|
175 | - // Index 100 is the default GravityView template path. |
|
176 | - $file_paths[ 110 ] = self::$file; |
|
177 | - |
|
178 | - return $file_paths; |
|
179 | - } |
|
180 | - |
|
181 | - /** |
|
182 | - * |
|
183 | - * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
184 | - * |
|
185 | - * @param $view_id int GravityView view id |
|
186 | - * @param $form_id int Gravity Forms form id |
|
187 | - * @param $entry_id int Gravity Forms entry id |
|
188 | - * @return string |
|
189 | - */ |
|
190 | - public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
191 | - return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
192 | - } |
|
193 | - |
|
194 | - |
|
195 | - /** |
|
196 | - * The edit entry link creates a secure link with a nonce |
|
197 | - * |
|
198 | - * It also mimics the URL structure Gravity Forms expects to have so that |
|
199 | - * it formats the display of the edit form like it does in the backend, like |
|
200 | - * "You can edit this post from the post page" fields, for example. |
|
201 | - * |
|
202 | - * @param $entry array Gravity Forms entry object |
|
203 | - * @param $view_id int GravityView view id |
|
204 | - * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
205 | - * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
206 | - * @return string |
|
207 | - */ |
|
208 | - public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
209 | - |
|
210 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
211 | - |
|
212 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
213 | - |
|
214 | - $url = add_query_arg( array( |
|
215 | - 'edit' => wp_create_nonce( $nonce_key ) |
|
216 | - ), $base ); |
|
217 | - |
|
218 | - if ( $post_id ) { |
|
219 | - $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
|
220 | - } |
|
221 | - |
|
222 | - /** |
|
223 | - * Allow passing params to dynamically populate entry with values |
|
224 | - * @since 1.9.2 |
|
225 | - */ |
|
226 | - if( !empty( $field_values ) ) { |
|
227 | - |
|
228 | - if( is_array( $field_values ) ) { |
|
229 | - // If already an array, no parse_str() needed |
|
230 | - $params = $field_values; |
|
231 | - } else { |
|
232 | - parse_str( $field_values, $params ); |
|
233 | - } |
|
234 | - |
|
235 | - $url = add_query_arg( $params, $url ); |
|
236 | - } |
|
237 | - |
|
238 | - /** |
|
239 | - * @filter `gravityview/edit/link` Filter the edit URL link. |
|
240 | - * |
|
241 | - * @since 2.14.6 Added $post param. |
|
242 | - * |
|
243 | - * @param string $url The url. |
|
244 | - * @param array $entry The entry. |
|
245 | - * @param \GV\View $view The View. |
|
246 | - * @param WP_Post|null WP_Post $post WP post. |
|
247 | - */ |
|
248 | - return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ), get_post( $view_id ) ); |
|
249 | - } |
|
169 | + /** |
|
170 | + * Include this extension templates path |
|
171 | + * @param array $file_paths List of template paths ordered |
|
172 | + */ |
|
173 | + public function add_template_path( $file_paths ) { |
|
174 | + |
|
175 | + // Index 100 is the default GravityView template path. |
|
176 | + $file_paths[ 110 ] = self::$file; |
|
177 | + |
|
178 | + return $file_paths; |
|
179 | + } |
|
180 | + |
|
181 | + /** |
|
182 | + * |
|
183 | + * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
184 | + * |
|
185 | + * @param $view_id int GravityView view id |
|
186 | + * @param $form_id int Gravity Forms form id |
|
187 | + * @param $entry_id int Gravity Forms entry id |
|
188 | + * @return string |
|
189 | + */ |
|
190 | + public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
191 | + return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
192 | + } |
|
193 | + |
|
194 | + |
|
195 | + /** |
|
196 | + * The edit entry link creates a secure link with a nonce |
|
197 | + * |
|
198 | + * It also mimics the URL structure Gravity Forms expects to have so that |
|
199 | + * it formats the display of the edit form like it does in the backend, like |
|
200 | + * "You can edit this post from the post page" fields, for example. |
|
201 | + * |
|
202 | + * @param $entry array Gravity Forms entry object |
|
203 | + * @param $view_id int GravityView view id |
|
204 | + * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
205 | + * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
206 | + * @return string |
|
207 | + */ |
|
208 | + public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
209 | + |
|
210 | + $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
211 | + |
|
212 | + $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
213 | + |
|
214 | + $url = add_query_arg( array( |
|
215 | + 'edit' => wp_create_nonce( $nonce_key ) |
|
216 | + ), $base ); |
|
217 | + |
|
218 | + if ( $post_id ) { |
|
219 | + $url = add_query_arg( array( 'gvid' => $view_id ), $url ); |
|
220 | + } |
|
221 | + |
|
222 | + /** |
|
223 | + * Allow passing params to dynamically populate entry with values |
|
224 | + * @since 1.9.2 |
|
225 | + */ |
|
226 | + if( !empty( $field_values ) ) { |
|
227 | + |
|
228 | + if( is_array( $field_values ) ) { |
|
229 | + // If already an array, no parse_str() needed |
|
230 | + $params = $field_values; |
|
231 | + } else { |
|
232 | + parse_str( $field_values, $params ); |
|
233 | + } |
|
234 | + |
|
235 | + $url = add_query_arg( $params, $url ); |
|
236 | + } |
|
237 | + |
|
238 | + /** |
|
239 | + * @filter `gravityview/edit/link` Filter the edit URL link. |
|
240 | + * |
|
241 | + * @since 2.14.6 Added $post param. |
|
242 | + * |
|
243 | + * @param string $url The url. |
|
244 | + * @param array $entry The entry. |
|
245 | + * @param \GV\View $view The View. |
|
246 | + * @param WP_Post|null WP_Post $post WP post. |
|
247 | + */ |
|
248 | + return apply_filters( 'gravityview/edit/link', $url, $entry, \GV\View::by_id( $view_id ), get_post( $view_id ) ); |
|
249 | + } |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * @depecated 2.14 Use {@see GravityView_Edit_Entry::modify_field_blocklist()} |
@@ -337,19 +337,19 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | |
340 | - /** |
|
341 | - * checks if user has permissions to edit a specific entry |
|
342 | - * |
|
343 | - * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
344 | - * |
|
345 | - * @param array $entry Gravity Forms entry array |
|
346 | - * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0 |
|
347 | - * @return bool |
|
348 | - */ |
|
349 | - public static function check_user_cap_edit_entry( $entry, $view = 0 ) { |
|
340 | + /** |
|
341 | + * checks if user has permissions to edit a specific entry |
|
342 | + * |
|
343 | + * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
344 | + * |
|
345 | + * @param array $entry Gravity Forms entry array |
|
346 | + * @param \GV\View|int $view ID of the view you want to check visibility against {@since 1.9.2}. Required since 2.0 |
|
347 | + * @return bool |
|
348 | + */ |
|
349 | + public static function check_user_cap_edit_entry( $entry, $view = 0 ) { |
|
350 | 350 | |
351 | - // No permission by default |
|
352 | - $user_can_edit = false; |
|
351 | + // No permission by default |
|
352 | + $user_can_edit = false; |
|
353 | 353 | |
354 | 354 | // get user_edit setting |
355 | 355 | if ( empty( $view ) ) { |
@@ -367,60 +367,60 @@ discard block |
||
367 | 367 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
368 | 368 | } |
369 | 369 | |
370 | - // If they can edit any entries (as defined in Gravity Forms) |
|
371 | - // Or if they can edit other people's entries |
|
372 | - // Then we're good. |
|
373 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
370 | + // If they can edit any entries (as defined in Gravity Forms) |
|
371 | + // Or if they can edit other people's entries |
|
372 | + // Then we're good. |
|
373 | + if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
374 | 374 | |
375 | - gravityview()->log->debug( 'User has ability to edit all entries.' ); |
|
375 | + gravityview()->log->debug( 'User has ability to edit all entries.' ); |
|
376 | 376 | |
377 | - $user_can_edit = true; |
|
377 | + $user_can_edit = true; |
|
378 | 378 | |
379 | - } else if( !isset( $entry['created_by'] ) ) { |
|
379 | + } else if( !isset( $entry['created_by'] ) ) { |
|
380 | 380 | |
381 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
381 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
382 | 382 | |
383 | - $user_can_edit = false; |
|
383 | + $user_can_edit = false; |
|
384 | 384 | |
385 | - } else { |
|
385 | + } else { |
|
386 | 386 | |
387 | - $current_user = wp_get_current_user(); |
|
387 | + $current_user = wp_get_current_user(); |
|
388 | 388 | |
389 | - // User edit is disabled |
|
390 | - if( empty( $user_edit ) ) { |
|
389 | + // User edit is disabled |
|
390 | + if( empty( $user_edit ) ) { |
|
391 | 391 | |
392 | - gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
|
392 | + gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
|
393 | 393 | |
394 | - $user_can_edit = false; |
|
395 | - } |
|
394 | + $user_can_edit = false; |
|
395 | + } |
|
396 | 396 | |
397 | - // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
398 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
397 | + // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
398 | + else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
399 | 399 | |
400 | - gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
|
400 | + gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
|
401 | 401 | |
402 | - $user_can_edit = true; |
|
402 | + $user_can_edit = true; |
|
403 | 403 | |
404 | - } else if( ! is_user_logged_in() ) { |
|
404 | + } else if( ! is_user_logged_in() ) { |
|
405 | 405 | |
406 | - gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
|
406 | + gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
|
407 | 407 | |
408 | - $user_can_edit = false; // Here just for clarity |
|
409 | - } |
|
408 | + $user_can_edit = false; // Here just for clarity |
|
409 | + } |
|
410 | 410 | |
411 | - } |
|
411 | + } |
|
412 | 412 | |
413 | - /** |
|
414 | - * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
415 | - * @since 1.15 Added `$entry` and `$view_id` parameters |
|
416 | - * @param boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
417 | - * @param array $entry Gravity Forms entry array {@since 1.15} |
|
418 | - * @param int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
419 | - */ |
|
420 | - $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
413 | + /** |
|
414 | + * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
415 | + * @since 1.15 Added `$entry` and `$view_id` parameters |
|
416 | + * @param boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
417 | + * @param array $entry Gravity Forms entry array {@since 1.15} |
|
418 | + * @param int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
419 | + */ |
|
420 | + $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
421 | 421 | |
422 | - return (bool) $user_can_edit; |
|
423 | - } |
|
422 | + return (bool) $user_can_edit; |
|
423 | + } |
|
424 | 424 | |
425 | 425 | /** |
426 | 426 | * Deletes a file. |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
38 | 38 | |
39 | - if( is_admin() ) { |
|
39 | + if ( is_admin() ) { |
|
40 | 40 | $this->load_components( 'admin' ); |
41 | 41 | } |
42 | 42 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | static function getInstance() { |
58 | 58 | |
59 | - if( empty( self::$instance ) ) { |
|
59 | + if ( empty( self::$instance ) ) { |
|
60 | 60 | self::$instance = new GravityView_Edit_Entry; |
61 | 61 | } |
62 | 62 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | private function add_hooks() { |
83 | 83 | |
84 | 84 | // Add front-end access to Gravity Forms delete file action |
85 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file') ); |
|
85 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( $this, 'delete_file' ) ); |
|
86 | 86 | |
87 | 87 | // Make sure this hook is run for non-admins |
88 | - add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file') ); |
|
88 | + add_action( 'wp_ajax_rg_delete_file', array( $this, 'delete_file' ) ); |
|
89 | 89 | |
90 | 90 | add_filter( 'gravityview_blocklist_field_types', array( $this, 'modify_field_blocklist' ), 10, 2 ); |
91 | 91 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function add_reserved_arg( $args ) { |
110 | 110 | |
111 | - $args[] = 'edit'; |
|
111 | + $args[ ] = 'edit'; |
|
112 | 112 | |
113 | 113 | return $args; |
114 | 114 | } |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | */ |
120 | 120 | private function addon_specific_hooks() { |
121 | 121 | |
122 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
123 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
122 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
123 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
209 | 209 | |
210 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
210 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
211 | 211 | |
212 | - $base = gv_entry_link( $entry, $post_id ? : $view_id ); |
|
212 | + $base = gv_entry_link( $entry, $post_id ?: $view_id ); |
|
213 | 213 | |
214 | 214 | $url = add_query_arg( array( |
215 | 215 | 'edit' => wp_create_nonce( $nonce_key ) |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | * Allow passing params to dynamically populate entry with values |
224 | 224 | * @since 1.9.2 |
225 | 225 | */ |
226 | - if( !empty( $field_values ) ) { |
|
226 | + if ( ! empty( $field_values ) ) { |
|
227 | 227 | |
228 | - if( is_array( $field_values ) ) { |
|
228 | + if ( is_array( $field_values ) ) { |
|
229 | 229 | // If already an array, no parse_str() needed |
230 | 230 | $params = $field_values; |
231 | 231 | } else { |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function modify_field_blocklist( $fields = array(), $context = NULL ) { |
275 | 275 | |
276 | - if( empty( $context ) || $context !== 'edit' ) { |
|
276 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
277 | 277 | return $fields; |
278 | 278 | } |
279 | 279 | |
@@ -370,15 +370,15 @@ discard block |
||
370 | 370 | // If they can edit any entries (as defined in Gravity Forms) |
371 | 371 | // Or if they can edit other people's entries |
372 | 372 | // Then we're good. |
373 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
373 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
374 | 374 | |
375 | 375 | gravityview()->log->debug( 'User has ability to edit all entries.' ); |
376 | 376 | |
377 | 377 | $user_can_edit = true; |
378 | 378 | |
379 | - } else if( !isset( $entry['created_by'] ) ) { |
|
379 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
380 | 380 | |
381 | - gravityview()->log->error( 'Entry `created_by` doesn\'t exist.'); |
|
381 | + gravityview()->log->error( 'Entry `created_by` doesn\'t exist.' ); |
|
382 | 382 | |
383 | 383 | $user_can_edit = false; |
384 | 384 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | $current_user = wp_get_current_user(); |
388 | 388 | |
389 | 389 | // User edit is disabled |
390 | - if( empty( $user_edit ) ) { |
|
390 | + if ( empty( $user_edit ) ) { |
|
391 | 391 | |
392 | 392 | gravityview()->log->debug( 'User Edit is disabled. Returning false.' ); |
393 | 393 | |
@@ -395,13 +395,13 @@ discard block |
||
395 | 395 | } |
396 | 396 | |
397 | 397 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
398 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
398 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
399 | 399 | |
400 | 400 | gravityview()->log->debug( 'User {user_id} created the entry.', array( 'user_id', $current_user->ID ) ); |
401 | 401 | |
402 | 402 | $user_can_edit = true; |
403 | 403 | |
404 | - } else if( ! is_user_logged_in() ) { |
|
404 | + } else if ( ! is_user_logged_in() ) { |
|
405 | 405 | |
406 | 406 | gravityview()->log->debug( 'No user defined; edit entry requires logged in user' ); |
407 | 407 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
421 | 421 | |
422 | - return (bool) $user_can_edit; |
|
422 | + return (bool)$user_can_edit; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | * @uses GFForms::delete_file() |
431 | 431 | */ |
432 | 432 | public function delete_file() { |
433 | - add_filter( 'user_has_cap', function ( $caps ) { |
|
434 | - $caps['gravityforms_delete_entries'] = true; |
|
433 | + add_filter( 'user_has_cap', function( $caps ) { |
|
434 | + $caps[ 'gravityforms_delete_entries' ] = true; |
|
435 | 435 | |
436 | 436 | return $caps; |
437 | 437 |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | * @return \GV\GF_Entry|null An instance of this entry or null if not found. |
107 | 107 | */ |
108 | 108 | public static function from_entry( $entry ) { |
109 | - if ( empty( $entry['id'] ) ) { |
|
109 | + if ( empty( $entry[ 'id' ] ) ) { |
|
110 | 110 | return null; |
111 | 111 | } |
112 | 112 | |
113 | 113 | $self = new self(); |
114 | 114 | $self->entry = $entry; |
115 | 115 | |
116 | - $self->ID = $self->entry['id']; |
|
116 | + $self->ID = $self->entry[ 'id' ]; |
|
117 | 117 | $self->slug = $self->get_slug(); |
118 | 118 | |
119 | 119 | return $self; |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | * @since 2.0 |
128 | 128 | * @return bool Whether the offset exists or not. |
129 | 129 | */ |
130 | - #[\ReturnTypeWillChange] |
|
130 | + #[\ReturnTypeWillChange ] |
|
131 | 131 | public function offsetExists( $offset ) { |
132 | - return isset( $this->entry[$offset] ); |
|
132 | + return isset( $this->entry[ $offset ] ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return mixed The value of the requested entry data. |
145 | 145 | */ |
146 | - #[\ReturnTypeWillChange] |
|
146 | + #[\ReturnTypeWillChange ] |
|
147 | 147 | public function offsetGet( $offset ) { |
148 | - return $this->entry[$offset]; |
|
148 | + return $this->entry[ $offset ]; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return void |
159 | 159 | */ |
160 | - #[\ReturnTypeWillChange] |
|
160 | + #[\ReturnTypeWillChange ] |
|
161 | 161 | public function offsetSet( $offset, $value ) { |
162 | 162 | gravityview()->log->error( 'The underlying Gravity Forms entry is immutable. This is a \GV\Entry object and should not be accessed as an array.' ); |
163 | 163 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @since 2.0 |
171 | 171 | * @return void |
172 | 172 | */ |
173 | - #[\ReturnTypeWillChange] |
|
173 | + #[\ReturnTypeWillChange ] |
|
174 | 174 | public function offsetUnset( $offset ) { |
175 | 175 | gravityview()->log->error( 'The underlying Gravity Forms entry is immutable. This is a \GV\Entry object and should not be accessed as an array.' ); |
176 | 176 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $self = new self(); |
56 | 56 | $self->form = $form; |
57 | 57 | |
58 | - $self->ID = intval( $self->form['id'] ); |
|
58 | + $self->ID = intval( $self->form[ 'id' ] ); |
|
59 | 59 | |
60 | 60 | return $self; |
61 | 61 | } |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | * @return \GV\GF_Form|null An instance of this form or null if not found. |
71 | 71 | */ |
72 | 72 | public static function from_form( $form ) { |
73 | - if ( empty( $form['id'] ) ) { |
|
73 | + if ( empty( $form[ 'id' ] ) ) { |
|
74 | 74 | return null; |
75 | 75 | } |
76 | 76 | |
77 | 77 | $self = new self(); |
78 | 78 | $self->form = $form; |
79 | - $self->ID = $self->form['id']; |
|
79 | + $self->ID = $self->form[ 'id' ]; |
|
80 | 80 | |
81 | 81 | return $self; |
82 | 82 | } |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | |
120 | 120 | /** The offset and limit */ |
121 | 121 | if ( ! empty( $offset->limit ) ) { |
122 | - $paging['page_size'] = $offset->limit; |
|
122 | + $paging[ 'page_size' ] = $offset->limit; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if ( ! empty( $offset->offset ) ) { |
126 | - $paging['offset'] = $offset->offset; |
|
126 | + $paging[ 'offset' ] = $offset->offset; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) { |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function get_fields() { |
182 | 182 | $fields = array(); |
183 | - foreach ( $this['fields'] as $field ) { |
|
184 | - foreach ( empty( $field['inputs'] ) ? array( $field['id'] ) : wp_list_pluck( $field['inputs'], 'id' ) as $id ) { |
|
183 | + foreach ( $this[ 'fields' ] as $field ) { |
|
184 | + foreach ( empty( $field[ 'inputs' ] ) ? array( $field[ 'id' ] ) : wp_list_pluck( $field[ 'inputs' ], 'id' ) as $id ) { |
|
185 | 185 | if ( is_numeric( $id ) ) { |
186 | 186 | $fields[ $id ] = self::get_field( $this, $id ); |
187 | 187 | } else { |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * @since 2.0 |
218 | 218 | * @return bool Whether the offset exists or not. |
219 | 219 | */ |
220 | - #[\ReturnTypeWillChange] |
|
220 | + #[\ReturnTypeWillChange ] |
|
221 | 221 | public function offsetExists( $offset ) { |
222 | - return isset( $this->form[$offset] ); |
|
222 | + return isset( $this->form[ $offset ] ); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @return mixed The value of the requested form data. |
235 | 235 | */ |
236 | - #[\ReturnTypeWillChange] |
|
236 | + #[\ReturnTypeWillChange ] |
|
237 | 237 | public function offsetGet( $offset ) { |
238 | - return $this->form[$offset]; |
|
238 | + return $this->form[ $offset ]; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return void |
249 | 249 | */ |
250 | - #[\ReturnTypeWillChange] |
|
250 | + #[\ReturnTypeWillChange ] |
|
251 | 251 | public function offsetSet( $offset, $value ) { |
252 | 252 | gravityview()->log->error( 'The underlying Gravity Forms form is immutable. This is a \GV\Form object and should not be accessed as an array.' ); |
253 | 253 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @since 2.0 |
261 | 261 | * @return void |
262 | 262 | */ |
263 | - #[\ReturnTypeWillChange] |
|
263 | + #[\ReturnTypeWillChange ] |
|
264 | 264 | public function offsetUnset( $offset ) { |
265 | 265 | gravityview()->log->error( 'The underlying Gravity Forms form is immutable. This is a \GV\Form object and should not be accessed as an array.' ); |
266 | 266 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if ( ! $entry instanceof Entry ) { |
45 | 45 | continue; |
46 | 46 | } |
47 | - $_entry->entries[ $entry['form_id'] ] = &$entry; |
|
47 | + $_entry->entries[ $entry[ 'form_id' ] ] = &$entry; |
|
48 | 48 | } |
49 | 49 | return $_entry; |
50 | 50 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | foreach ( $this->entries as $entry ) { |
67 | 67 | $entry = $entry->as_entry(); |
68 | - $_entry['_multi'][ $entry['form_id'] ] = $entry; |
|
68 | + $_entry[ '_multi' ][ $entry[ 'form_id' ] ] = $entry; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function get_permalink( \GV\View $view = null, \GV\Request $request = null, $track_directory = true ) { |
88 | 88 | $slugs = array(); |
89 | 89 | add_filter( 'gravityview/entry/slug', $callback = function( $slug ) use ( &$slugs ) { |
90 | - $slugs[] = $slug; |
|
90 | + $slugs[ ] = $slug; |
|
91 | 91 | return implode( ',', $slugs ); |
92 | 92 | }, 10, 1 ); |
93 | 93 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @since 2.0 |
109 | 109 | * @return bool Whether the offset exists or not. |
110 | 110 | */ |
111 | - #[\ReturnTypeWillChange] |
|
111 | + #[\ReturnTypeWillChange ] |
|
112 | 112 | public function offsetExists( $offset ) { |
113 | 113 | return isset( $this->entries[ $offset ] ); |
114 | 114 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return mixed The value of the requested entry data. |
126 | 126 | */ |
127 | - #[\ReturnTypeWillChange] |
|
127 | + #[\ReturnTypeWillChange ] |
|
128 | 128 | public function offsetGet( $offset ) { |
129 | 129 | if ( ! $this->offsetExists( $offset ) ) { |
130 | 130 | return null; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return void |
143 | 143 | */ |
144 | - #[\ReturnTypeWillChange] |
|
144 | + #[\ReturnTypeWillChange ] |
|
145 | 145 | public function offsetSet( $offset, $value ) { |
146 | 146 | gravityview()->log->error( 'The underlying multi entry is immutable. This is a \GV\Entry object and should not be accessed as an array.' ); |
147 | 147 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @since 2.0 |
155 | 155 | * @return void |
156 | 156 | */ |
157 | - #[\ReturnTypeWillChange] |
|
157 | + #[\ReturnTypeWillChange ] |
|
158 | 158 | public function offsetUnset( $offset ) { |
159 | 159 | gravityview()->log->error( 'The underlying multi entry is immutable. This is a \GV\Entry object and should not be accessed as an array.' ); |
160 | 160 | } |