@@ -7,11 +7,11 @@ |
||
7 | 7 | extract( $gravityview_view->getCurrentField() ); |
8 | 8 | |
9 | 9 | // Only show the link to logged-in users with the rigth caps. |
10 | -if( !GravityView_Delete_Entry::check_user_cap_delete_entry( $entry, $field_settings ) ) { |
|
10 | +if ( ! GravityView_Delete_Entry::check_user_cap_delete_entry( $entry, $field_settings ) ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
14 | -$link_text = empty( $field_settings['delete_link'] ) ? __('Delete Entry', 'gravityview') : $field_settings['delete_link']; |
|
14 | +$link_text = empty( $field_settings[ 'delete_link' ] ) ? __( 'Delete Entry', 'gravityview' ) : $field_settings[ 'delete_link' ]; |
|
15 | 15 | |
16 | 16 | $link_text = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ) ); |
17 | 17 |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $redux_settings = $this->get_redux_settings(); |
52 | 52 | |
53 | 53 | // No need to process |
54 | - if( false === $redux_settings ) { |
|
54 | + if ( false === $redux_settings ) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - if( empty( $redux_settings['license_key_status'] ) ) { |
|
58 | + if ( empty( $redux_settings[ 'license_key_status' ] ) ) { |
|
59 | 59 | $redux_settings = $this->get_redux_license_status( $redux_settings ); |
60 | 60 | } |
61 | 61 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | GravityView_Settings::get_instance()->update_app_settings( $updated_settings ); |
70 | 70 | |
71 | 71 | // And now remove the previous option, so this is a one-time thing. |
72 | - delete_option('gravityview_settings'); |
|
73 | - delete_option('gravityview_settings-transients'); |
|
72 | + delete_option( 'gravityview_settings' ); |
|
73 | + delete_option( 'gravityview_settings-transients' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | |
87 | 87 | $data = array( |
88 | 88 | 'edd_action' => 'check_license', |
89 | - 'license' => rgget('license_key', $redux_settings ), |
|
89 | + 'license' => rgget( 'license_key', $redux_settings ), |
|
90 | 90 | 'update' => false, |
91 | 91 | 'format' => 'object', |
92 | 92 | ); |
93 | 93 | |
94 | 94 | $license_call = GravityView_Settings::get_instance()->get_license_handler()->license_call( $data ); |
95 | 95 | |
96 | - if( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
97 | - $redux_settings['license_key_status'] = $license_call->license; |
|
98 | - $redux_settings['license_key_response'] = json_encode( $license_call ); |
|
96 | + if ( is_object( $license_call ) && isset( $license_call->license ) ) { |
|
97 | + $redux_settings[ 'license_key_status' ] = $license_call->license; |
|
98 | + $redux_settings[ 'license_key_response' ] = json_encode( $license_call ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $redux_settings; |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | function get_redux_settings() { |
110 | 110 | |
111 | 111 | // Previous settings set by Redux |
112 | - $redux_option = get_option('gravityview_settings'); |
|
112 | + $redux_option = get_option( 'gravityview_settings' ); |
|
113 | 113 | |
114 | 114 | // No Redux settings? Don't proceed. |
115 | - if( false === $redux_option ) { |
|
115 | + if ( false === $redux_option ) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
@@ -122,21 +122,21 @@ discard block |
||
122 | 122 | 'no-conflict-mode' => ( rgget( 'no-conflict-mode', $redux_option ) ? '1' : '0' ), |
123 | 123 | ); |
124 | 124 | |
125 | - if( $license_array = rgget( 'license', $redux_option ) ) { |
|
125 | + if ( $license_array = rgget( 'license', $redux_option ) ) { |
|
126 | 126 | |
127 | - $redux_settings['license_key'] = $license_key = rgget( 'license', $license_array ); |
|
127 | + $redux_settings[ 'license_key' ] = $license_key = rgget( 'license', $license_array ); |
|
128 | 128 | |
129 | - $redux_last_changed_values = get_option('gravityview_settings-transients'); |
|
129 | + $redux_last_changed_values = get_option( 'gravityview_settings-transients' ); |
|
130 | 130 | |
131 | 131 | // This contains the last response for license validation |
132 | - if( !empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
132 | + if ( ! empty( $redux_last_changed_values ) && $saved_values = rgget( 'changed_values', $redux_last_changed_values ) ) { |
|
133 | 133 | |
134 | - $saved_license = rgget('license', $saved_values ); |
|
134 | + $saved_license = rgget( 'license', $saved_values ); |
|
135 | 135 | |
136 | 136 | // Only use the last-saved values if they are for the same license |
137 | - if( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
138 | - $redux_settings['license_key_status'] = rgget( 'status', $saved_license ); |
|
139 | - $redux_settings['license_key_response'] = rgget( 'response', $saved_license ); |
|
137 | + if ( $saved_license && rgget( 'license', $saved_license ) === $license_key ) { |
|
138 | + $redux_settings[ 'license_key_status' ] = rgget( 'status', $saved_license ); |
|
139 | + $redux_settings[ 'license_key_response' ] = rgget( 'response', $saved_license ); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | /** ---- Migrate from old search widget to new search widget ---- */ |
149 | 149 | function update_search_on_views() { |
150 | 150 | |
151 | - if( !class_exists('GravityView_Widget_Search') ) { |
|
152 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/search-widget/class-search-widget.php' ); |
|
151 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
152 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/search-widget/class-search-widget.php' ); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | // Loop through all the views |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | |
162 | 162 | $views = get_posts( $query_args ); |
163 | 163 | |
164 | - foreach( $views as $view ) { |
|
164 | + foreach ( $views as $view ) { |
|
165 | 165 | |
166 | 166 | $widgets = get_post_meta( $view->ID, '_gravityview_directory_widgets', true ); |
167 | 167 | $search_fields = null; |
168 | 168 | |
169 | - if( empty( $widgets ) || !is_array( $widgets ) ) { continue; } |
|
169 | + if ( empty( $widgets ) || ! is_array( $widgets ) ) { continue; } |
|
170 | 170 | |
171 | 171 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Loading View ID: ', $view->ID ); |
172 | 172 | |
173 | - foreach( $widgets as $area => $ws ) { |
|
174 | - foreach( $ws as $k => $widget ) { |
|
175 | - if( $widget['id'] !== 'search_bar' ) { continue; } |
|
173 | + foreach ( $widgets as $area => $ws ) { |
|
174 | + foreach ( $ws as $k => $widget ) { |
|
175 | + if ( $widget[ 'id' ] !== 'search_bar' ) { continue; } |
|
176 | 176 | |
177 | - if( is_null( $search_fields ) ) { |
|
177 | + if ( is_null( $search_fields ) ) { |
|
178 | 178 | $search_fields = $this->get_search_fields( $view->ID ); |
179 | 179 | } |
180 | 180 | |
@@ -182,24 +182,24 @@ discard block |
||
182 | 182 | // [search_free] => 1 |
183 | 183 | // [search_date] => 1 |
184 | 184 | $search_generic = array(); |
185 | - if( !empty( $widget['search_free'] ) ) { |
|
186 | - $search_generic[] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
185 | + if ( ! empty( $widget[ 'search_free' ] ) ) { |
|
186 | + $search_generic[ ] = array( 'field' => 'search_all', 'input' => 'input_text' ); |
|
187 | 187 | } |
188 | - if( !empty( $widget['search_date'] ) ) { |
|
189 | - $search_generic[] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
188 | + if ( ! empty( $widget[ 'search_date' ] ) ) { |
|
189 | + $search_generic[ ] = array( 'field' => 'entry_date', 'input' => 'date' ); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | $search_config = array_merge( $search_generic, $search_fields ); |
193 | 193 | |
194 | 194 | // don't throw '[]' when json_encode an empty array |
195 | - if( empty( $search_config ) ) { |
|
195 | + if ( empty( $search_config ) ) { |
|
196 | 196 | $search_config = ''; |
197 | 197 | } else { |
198 | 198 | $search_config = json_encode( $search_config ); |
199 | 199 | } |
200 | 200 | |
201 | - $widgets[ $area ][ $k ]['search_fields'] = $search_config; |
|
202 | - $widgets[ $area ][ $k ]['search_layout'] = 'horizontal'; |
|
201 | + $widgets[ $area ][ $k ][ 'search_fields' ] = $search_config; |
|
202 | + $widgets[ $area ][ $k ][ 'search_layout' ] = 'horizontal'; |
|
203 | 203 | |
204 | 204 | do_action( 'gravityview_log_debug', '[GravityView_Migrate/update_search_on_views] Updated Widget: ', $widgets[ $area ][ $k ] ); |
205 | 205 | } |
@@ -227,26 +227,26 @@ discard block |
||
227 | 227 | // check view fields' settings |
228 | 228 | $fields = get_post_meta( $view_id, '_gravityview_directory_fields', true ); |
229 | 229 | |
230 | - if( !empty( $fields ) && is_array( $fields ) ) { |
|
230 | + if ( ! empty( $fields ) && is_array( $fields ) ) { |
|
231 | 231 | |
232 | - foreach( $fields as $t => $fs ) { |
|
232 | + foreach ( $fields as $t => $fs ) { |
|
233 | 233 | |
234 | - foreach( $fs as $k => $field ) { |
|
234 | + foreach ( $fs as $k => $field ) { |
|
235 | 235 | // is field a search_filter ? |
236 | - if( empty( $field['search_filter'] ) ) { continue; } |
|
236 | + if ( empty( $field[ 'search_filter' ] ) ) { continue; } |
|
237 | 237 | |
238 | 238 | // get field type & calculate the input type (by default) |
239 | - $form_field = gravityview_get_field( $form, $field['id'] ); |
|
239 | + $form_field = gravityview_get_field( $form, $field[ 'id' ] ); |
|
240 | 240 | |
241 | - if( empty( $form_field['type'] ) ) { |
|
241 | + if ( empty( $form_field[ 'type' ] ) ) { |
|
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
245 | 245 | // depending on the field type assign a group of possible search field types |
246 | - $type = GravityView_Widget_Search::get_search_input_types( $field['id'], $form_field['type'] ); |
|
246 | + $type = GravityView_Widget_Search::get_search_input_types( $field[ 'id' ], $form_field[ 'type' ] ); |
|
247 | 247 | |
248 | 248 | // add field to config |
249 | - $search_fields[] = array( 'field' => $field['id'], 'input' => $type ); |
|
249 | + $search_fields[ ] = array( 'field' => $field[ 'id' ], 'input' => $type ); |
|
250 | 250 | |
251 | 251 | } |
252 | 252 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | static function getInstance() { |
44 | 44 | |
45 | - if( empty( self::$instance ) ) { |
|
45 | + if ( empty( self::$instance ) ) { |
|
46 | 46 | self::$instance = new self; |
47 | 47 | |
48 | 48 | self::$instance->initialize(); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // Catch either |
95 | 95 | $match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})"; |
96 | 96 | |
97 | - return '#'.$match_regex.'#i'; |
|
97 | + return '#' . $match_regex . '#i'; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | |
114 | 114 | $post_id = url_to_postid( $url ); |
115 | 115 | |
116 | - if( empty( $post_id ) ) { |
|
116 | + if ( empty( $post_id ) ) { |
|
117 | 117 | |
118 | 118 | $args = array( |
119 | 119 | 'post_status' => 'publish', |
120 | 120 | 'name' => $slug, |
121 | - 'post_type' => array('any', 'gravityview'), |
|
121 | + 'post_type' => array( 'any', 'gravityview' ), |
|
122 | 122 | ); |
123 | 123 | |
124 | 124 | $posts = get_posts( $args ); |
125 | 125 | |
126 | - if( !empty( $posts ) ) { |
|
127 | - $post_id = $posts[0]->ID; |
|
126 | + if ( ! empty( $posts ) ) { |
|
127 | + $post_id = $posts[ 0 ]->ID; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -157,17 +157,17 @@ discard block |
||
157 | 157 | public function render_handler( $matches, $attr, $url, $rawattr ) { |
158 | 158 | |
159 | 159 | // If not using permalinks, re-assign values for matching groups |
160 | - if( !empty( $matches['entry_slug2'] ) ) { |
|
161 | - $matches['is_cpt'] = $matches['is_cpt2']; |
|
162 | - $matches['slug'] = $matches['slug2']; |
|
163 | - $matches['entry_slug'] = $matches['entry_slug2']; |
|
164 | - unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] ); |
|
160 | + if ( ! empty( $matches[ 'entry_slug2' ] ) ) { |
|
161 | + $matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ]; |
|
162 | + $matches[ 'slug' ] = $matches[ 'slug2' ]; |
|
163 | + $matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ]; |
|
164 | + unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] ); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // No Entry was found |
168 | - if( empty( $matches['entry_slug'] ) ) { |
|
168 | + if ( empty( $matches[ 'entry_slug' ] ) ) { |
|
169 | 169 | |
170 | - do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
170 | + do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches ); |
|
171 | 171 | |
172 | 172 | return ''; |
173 | 173 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | // Setup the data used |
178 | 178 | $this->set_vars( $matches, $attr, $url, $rawattr ); |
179 | 179 | |
180 | - if( is_admin() && !$this->is_full_oembed_preview ) { |
|
180 | + if ( is_admin() && ! $this->is_full_oembed_preview ) { |
|
181 | 181 | $return = $this->render_admin( $matches, $attr, $url, $rawattr ); |
182 | 182 | } else { |
183 | 183 | |
184 | - if( $this->is_full_oembed_preview ) { |
|
184 | + if ( $this->is_full_oembed_preview ) { |
|
185 | 185 | $return .= $this->generate_preview_notice(); |
186 | 186 | } |
187 | 187 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | private function generate_preview_notice() { |
201 | 201 | $floaty = GravityView_Admin::get_floaty(); |
202 | 202 | $title = esc_html__( 'This will look better when it is embedded.', 'gravityview' ); |
203 | - $message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview'); |
|
204 | - return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>'; |
|
203 | + $message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' ); |
|
204 | + return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function set_vars( $matches, $attr, $url, $rawattr ) { |
216 | 216 | |
217 | - $this->entry_id = $matches['entry_slug']; |
|
217 | + $this->entry_id = $matches[ 'entry_slug' ]; |
|
218 | 218 | |
219 | - $post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] ); |
|
219 | + $post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] ); |
|
220 | 220 | |
221 | 221 | // The URL didn't have the View Custom Post Type structure. |
222 | - if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) { |
|
222 | + if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) { |
|
223 | 223 | |
224 | - do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
224 | + do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches ); |
|
225 | 225 | |
226 | 226 | $this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id ); |
227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that. |
235 | - $this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) ); |
|
235 | + $this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | // Floaty the astronaut |
251 | 251 | $image = GravityView_Admin::get_floaty(); |
252 | 252 | |
253 | - $embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id ); |
|
253 | + $embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id ); |
|
254 | 254 | |
255 | - $embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id ); |
|
255 | + $embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id ); |
|
256 | 256 | |
257 | 257 | return ' |
258 | 258 | <div class="loading-placeholder" style="background-color:#e6f0f5;"> |
259 | - <h3 style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;">'.$image.$embed_heading.'</h3> |
|
259 | + <h3 style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;">'.$image . $embed_heading . '</h3> |
|
260 | 260 | <p style="margin:0; padding:0; font-family: \'Open Sans\', sans-serif;"> |
261 | - '.$embed_text.' |
|
261 | + '.$embed_text . ' |
|
262 | 262 | </p> |
263 | 263 | <br style="clear: both;"> |
264 | 264 | </div>'; |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | private function render_frontend( $matches, $attr, $url, $rawattr ) { |
314 | 314 | |
315 | 315 | // If it's already been parsed, don't re-output it. |
316 | - if( !empty( $this->output[ $this->entry_id ] ) ) { |
|
316 | + if ( ! empty( $this->output[ $this->entry_id ] ) ) { |
|
317 | 317 | return $this->output[ $this->entry_id ]; |
318 | 318 | } |
319 | 319 | |
320 | 320 | $entry_output = $this->generate_entry_output(); |
321 | 321 | |
322 | 322 | // Wrap a container div around the output to allow for custom styling |
323 | - $output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output ); |
|
323 | + $output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output ); |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @var string $url The original URL that was matched by the regex. \n |
334 | 334 | * @var array $rawattr The original unmodified attributes. |
335 | 335 | */ |
336 | - $output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
336 | + $output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) ); |
|
337 | 337 | |
338 | 338 | unset( $entry_output ); |
339 | 339 |
@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | |
5 | 5 | function __construct() { |
6 | 6 | |
7 | - if( ! is_admin() ) { return; } |
|
7 | + if ( ! is_admin() ) { return; } |
|
8 | 8 | |
9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
26 | 26 | |
27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
30 | 30 | } |
31 | 31 | |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
51 | 51 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
52 | 52 | |
53 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
53 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
54 | 54 | |
55 | 55 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
56 | 56 | |
57 | 57 | //Hooks for no-conflict functionality |
58 | - add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000); |
|
59 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9); |
|
58 | + add_action( 'wp_print_scripts', array( $this, 'no_conflict_scripts' ), 1000 ); |
|
59 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_scripts' ), 9 ); |
|
60 | 60 | |
61 | - add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000); |
|
62 | - add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11); |
|
63 | - add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1); |
|
64 | - add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1); |
|
61 | + add_action( 'wp_print_styles', array( $this, 'no_conflict_styles' ), 1000 ); |
|
62 | + add_action( 'admin_print_styles', array( $this, 'no_conflict_styles' ), 11 ); |
|
63 | + add_action( 'admin_print_footer_scripts', array( $this, 'no_conflict_styles' ), 1 ); |
|
64 | + add_action( 'admin_footer', array( $this, 'no_conflict_styles' ), 1 ); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | public function backend_actions() { |
75 | 75 | |
76 | 76 | /** @define "GRAVITYVIEW_DIR" "../" */ |
77 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
78 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-label.php' ); |
|
80 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
81 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
82 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
83 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
77 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
78 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
79 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-label.php' ); |
|
80 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
81 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
82 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
83 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
87 | 87 | * |
88 | 88 | * Nice place to insert extensions' backend stuff |
89 | 89 | */ |
90 | - do_action('gravityview_include_backend_actions'); |
|
90 | + do_action( 'gravityview_include_backend_actions' ); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | |
104 | 104 | $actions = array(); |
105 | 105 | |
106 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
107 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
106 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
107 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
108 | 108 | } |
109 | 109 | |
110 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
111 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
110 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
111 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return array_merge( $actions, $links ); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | function post_updated_messages( $messages, $bulk_counts = NULL ) { |
132 | 132 | global $post; |
133 | 133 | |
134 | - $post_id = isset($_GET['post']) ? intval($_GET['post']) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
134 | + $post_id = isset( $_GET[ 'post' ] ) ? intval( $_GET[ 'post' ] ) : ( is_object( $post ) && isset( $post->ID ) ? $post->ID : NULL ); |
|
135 | 135 | |
136 | 136 | // By default, there will only be one item being modified. |
137 | 137 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
138 | 138 | // of modified items that will override this array. |
139 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
139 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
140 | 140 | |
141 | 141 | |
142 | 142 | // If we're starting fresh, a new form was created. |
@@ -145,53 +145,53 @@ discard block |
||
145 | 145 | |
146 | 146 | $new_form_text = ''; |
147 | 147 | |
148 | - if( !empty( $start_fresh ) ) { |
|
148 | + if ( ! empty( $start_fresh ) ) { |
|
149 | 149 | |
150 | 150 | // Get the form that was created |
151 | 151 | $connected_form = gravityview_get_form_id( $post_id ); |
152 | 152 | |
153 | - if( !empty( $connected_form ) ) { |
|
153 | + if ( ! empty( $connected_form ) ) { |
|
154 | 154 | $form = gravityview_get_form( $connected_form ); |
155 | - $form_name = esc_attr( $form['title'] ); |
|
155 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
156 | 156 | $image = self::get_floaty(); |
157 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
158 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
157 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
158 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
159 | 159 | |
160 | 160 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
161 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
161 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
162 | 162 | $new_form_text = wpautop( $new_form_text ); |
163 | 163 | |
164 | 164 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - $messages['gravityview'] = array( |
|
168 | + $messages[ 'gravityview' ] = array( |
|
169 | 169 | 0 => '', // Unused. Messages start at index 1. |
170 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
171 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
170 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
171 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
172 | 172 | 3 => __( 'View deleted.', 'gravityview' ), |
173 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
173 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
174 | 174 | /* translators: %s: date and time of the revision */ |
175 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
176 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
177 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
175 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
176 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
177 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
178 | 178 | 8 => __( 'View submitted.', 'gravityview' ), |
179 | 179 | 9 => sprintf( |
180 | 180 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
181 | 181 | // translators: Publish box date format, see http://php.net/date |
182 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
182 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
183 | 183 | ) . $new_form_text, |
184 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
184 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
185 | 185 | |
186 | 186 | /** |
187 | 187 | * These apply to `bulk_post_updated_messages` |
188 | 188 | * @file wp-admin/edit.php |
189 | 189 | */ |
190 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
191 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
192 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
193 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
194 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
190 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
191 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
192 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
193 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
194 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
195 | 195 | ); |
196 | 196 | |
197 | 197 | return $messages; |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | function no_conflict_scripts() { |
205 | 205 | global $wp_scripts; |
206 | 206 | |
207 | - if( ! gravityview_is_admin_page() ) { |
|
207 | + if ( ! gravityview_is_admin_page() ) { |
|
208 | 208 | return; |
209 | 209 | } |
210 | 210 | |
211 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
211 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
212 | 212 | |
213 | - if( empty( $no_conflict_mode ) ) { |
|
213 | + if ( empty( $no_conflict_mode ) ) { |
|
214 | 214 | return; |
215 | 215 | } |
216 | 216 | |
@@ -260,24 +260,24 @@ discard block |
||
260 | 260 | function no_conflict_styles() { |
261 | 261 | global $wp_styles; |
262 | 262 | |
263 | - if( ! gravityview_is_admin_page() ) { |
|
263 | + if ( ! gravityview_is_admin_page() ) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | 267 | // Dequeue other jQuery styles even if no-conflict is off. |
268 | 268 | // Terrible-looking tabs help no one. |
269 | - if( !empty( $wp_styles->registered ) ) { |
|
270 | - foreach ($wp_styles->registered as $key => $style) { |
|
271 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
269 | + if ( ! empty( $wp_styles->registered ) ) { |
|
270 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
271 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
272 | 272 | wp_dequeue_style( $key ); |
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
277 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
277 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
278 | 278 | |
279 | 279 | // If no conflict is off, jQuery will suffice. |
280 | - if( empty( $no_conflict_mode ) ) { |
|
280 | + if ( empty( $no_conflict_mode ) ) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | /** |
305 | 305 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
306 | 306 | */ |
307 | - do_action('gravityview_remove_conflicts_after'); |
|
307 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | |
327 | 327 | //reset queue |
328 | 328 | $queue = array(); |
329 | - foreach( $wp_objects->queue as $object ) { |
|
330 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
331 | - $queue[] = $object; |
|
329 | + foreach ( $wp_objects->queue as $object ) { |
|
330 | + if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
331 | + $queue[ ] = $object; |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | $wp_objects->queue = $queue; |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | |
338 | 338 | //unregistering scripts |
339 | 339 | $registered = array(); |
340 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
341 | - if( in_array( $handle, $required_objects ) ){ |
|
340 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
341 | + if ( in_array( $handle, $required_objects ) ) { |
|
342 | 342 | $registered[ $handle ] = $script_registration; |
343 | 343 | } |
344 | 344 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * @param [type] $registered [description] |
352 | 352 | * @param [type] $scripts [description] |
353 | 353 | */ |
354 | - private function add_script_dependencies($registered, $scripts) { |
|
354 | + private function add_script_dependencies( $registered, $scripts ) { |
|
355 | 355 | |
356 | 356 | //gets all dependent scripts linked to the $scripts array passed |
357 | 357 | do { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
361 | 361 | foreach ( $deps as $dep ) { |
362 | 362 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
363 | - $dependents[] = $dep; |
|
363 | + $dependents[ ] = $dep; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
@@ -424,29 +424,29 @@ discard block |
||
424 | 424 | static function is_admin_page( $hook = '', $page = NULL ) { |
425 | 425 | global $current_screen, $plugin_page, $pagenow, $post; |
426 | 426 | |
427 | - if( ! is_admin() ) { return false; } |
|
427 | + if ( ! is_admin() ) { return false; } |
|
428 | 428 | |
429 | 429 | $is_page = false; |
430 | 430 | |
431 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
431 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
432 | 432 | |
433 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
433 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
434 | 434 | |
435 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
435 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
436 | 436 | |
437 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
438 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
439 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
437 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
438 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
439 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
440 | 440 | } else { |
441 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
441 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
442 | 442 | } |
443 | 443 | |
444 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
444 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
445 | 445 | |
446 | 446 | // $_GET `post_type` variable |
447 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
447 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
448 | 448 | $is_page = 'single'; |
449 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
449 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
450 | 450 | $is_page = 'settings'; |
451 | 451 | } else { |
452 | 452 | $is_page = 'views'; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
462 | 462 | |
463 | 463 | // If the current page is the same as the compared page |
464 | - if( !empty( $page ) ) { |
|
464 | + if ( ! empty( $page ) ) { |
|
465 | 465 | return $is_page === $page; |
466 | 466 | } |
467 | 467 | |
@@ -482,6 +482,6 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
484 | 484 | */ |
485 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
485 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
486 | 486 | return GravityView_Admin::is_admin_page( $hook, $page ); |
487 | 487 | } |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | function __construct() { |
16 | 16 | |
17 | 17 | // Only run on Admin |
18 | - if ( !is_admin() ) { |
|
18 | + if ( ! is_admin() ) { |
|
19 | 19 | return; |
20 | 20 | } |
21 | 21 | |
22 | 22 | // If the Duplicate Post plugin is active, don't run. |
23 | - if( defined('DUPLICATE_POST_CURRENT_VERSION') ) { |
|
23 | + if ( defined( 'DUPLICATE_POST_CURRENT_VERSION' ) ) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | global $post; |
61 | 61 | |
62 | 62 | // We only want to add Clone links to the Edit View metabox |
63 | - if( !$this->is_all_views_page() ) { |
|
63 | + if ( ! $this->is_all_views_page() ) { |
|
64 | 64 | |
65 | - if( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) { |
|
66 | - $links[] = '<span>' . $duplicate_links['edit_as_new_draft'] . '</span>'; |
|
65 | + if ( $duplicate_links = $this->make_duplicate_link_row( array(), $post ) ) { |
|
66 | + $links[ ] = '<span>' . $duplicate_links[ 'edit_as_new_draft' ] . '</span>'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param string|null If string, the status to set for the new View. If empty, use existing View status. |
120 | 120 | * @param WP_Post $post View being cloned |
121 | 121 | */ |
122 | - $new_view_status = apply_filters('gravityview/duplicate-view/status', $status, $post ); |
|
122 | + $new_view_status = apply_filters( 'gravityview/duplicate-view/status', $status, $post ); |
|
123 | 123 | |
124 | 124 | $new_view = array( |
125 | 125 | 'menu_order' => $post->menu_order, |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | * @param boolean $copy_date Whether the copy the date from the existing View. Default: `false` |
143 | 143 | * @param WP_Post $post View being cloned |
144 | 144 | */ |
145 | - $copy_date = apply_filters('gravityview/duplicate-view/copy-date', false, $post ); |
|
145 | + $copy_date = apply_filters( 'gravityview/duplicate-view/copy-date', false, $post ); |
|
146 | 146 | |
147 | 147 | if ( $copy_date ) { |
148 | - $new_view['post_date'] = $new_post_date = $post->post_date; |
|
149 | - $new_view['post_date_gmt'] = get_gmt_from_date( $new_post_date ); |
|
148 | + $new_view[ 'post_date' ] = $new_post_date = $post->post_date; |
|
149 | + $new_view[ 'post_date_gmt' ] = get_gmt_from_date( $new_post_date ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param array $new_view Array of settings to be passed to wp_insert_post() |
156 | 156 | * @param WP_Post $post View being cloned |
157 | 157 | */ |
158 | - $new_view = apply_filters('gravityview/duplicate-view/new-view', $new_view, $post ); |
|
158 | + $new_view = apply_filters( 'gravityview/duplicate-view/new-view', $new_view, $post ); |
|
159 | 159 | |
160 | 160 | // Magic happens here. |
161 | 161 | $new_view_id = wp_insert_post( $new_view ); |
@@ -237,13 +237,13 @@ discard block |
||
237 | 237 | $clone_text = __( 'Clone', 'gravityview' ); |
238 | 238 | $clone_title = __( 'Clone this View', 'gravityview' ); |
239 | 239 | |
240 | - $actions['clone'] = gravityview_get_link( $clone_link, $clone_text, 'title='.$clone_title ); |
|
240 | + $actions[ 'clone' ] = gravityview_get_link( $clone_link, $clone_text, 'title=' . $clone_title ); |
|
241 | 241 | |
242 | 242 | $clone_draft_link = $this->get_clone_view_link( $post->ID ); |
243 | 243 | $clone_draft_text = $this->is_all_views_page() ? __( 'New Draft', 'gravityview' ) : __( 'Clone View', 'gravityview' ); |
244 | 244 | $clone_draft_title = __( 'Copy as a new draft View', 'gravityview' ); |
245 | 245 | |
246 | - $actions['edit_as_new_draft'] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title='.$clone_draft_title ); |
|
246 | + $actions[ 'edit_as_new_draft' ] = gravityview_get_link( $clone_draft_link, esc_html( $clone_draft_text ), 'title=' . $clone_draft_title ); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | return $actions; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | // Verify the View exists |
270 | - if ( !$view = get_post( $id ) ) { |
|
270 | + if ( ! $view = get_post( $id ) ) { |
|
271 | 271 | return ''; |
272 | 272 | } |
273 | 273 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $post_type_object = get_post_type_object( $view->post_type ); |
283 | 283 | |
284 | 284 | /** If there's no gravityview post type for some reason, abort! */ |
285 | - if ( !$post_type_object ) { |
|
285 | + if ( ! $post_type_object ) { |
|
286 | 286 | do_action( 'gravityview_log_error', __METHOD__ . ' No gravityview post type exists when trying to clone the View.', $view ); |
287 | 287 | return ''; |
288 | 288 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param int $view_id View ID |
295 | 295 | * @param string $context How to display the link. If "display", the URL is run through esc_html(). Default: `display` |
296 | 296 | */ |
297 | - $clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php". $action ), $view->ID, $context ); |
|
297 | + $clone_view_link = apply_filters( 'gravityview/duplicate-view/get_clone_view_link', admin_url( "admin.php" . $action ), $view->ID, $context ); |
|
298 | 298 | |
299 | 299 | return $clone_view_link; |
300 | 300 | } |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function save_as_new_view( $status = '' ) { |
323 | 323 | |
324 | - if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) ) ) { |
|
324 | + if ( ! ( isset( $_GET[ 'post' ] ) || isset( $_POST[ 'post' ] ) ) ) { |
|
325 | 325 | wp_die( __( 'No post to duplicate has been supplied!', 'gravityview' ) ); |
326 | 326 | } |
327 | 327 | |
328 | 328 | // Get the original post |
329 | - $id = ( isset( $_GET['post'] ) ? $_GET['post'] : $_POST['post'] ); |
|
329 | + $id = ( isset( $_GET[ 'post' ] ) ? $_GET[ 'post' ] : $_POST[ 'post' ] ); |
|
330 | 330 | |
331 | - if( ! $this->current_user_can_copy( $id ) ) { |
|
331 | + if ( ! $this->current_user_can_copy( $id ) ) { |
|
332 | 332 | wp_die( __( 'You don\'t have permission to copy this View.', 'gravityview' ) ); |
333 | 333 | } |
334 | 334 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param bool $esc_html Pass return value through `esc_html()` |
42 | 42 | * @return string Text with variables maybe replaced |
43 | 43 | */ |
44 | - public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
44 | + public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @internal Reported to GF Support on 12/3 |
66 | 66 | */ |
67 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
68 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
69 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
67 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
68 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
69 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
70 | 70 | |
71 | 71 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html ); |
72 | 72 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
89 | + public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * This prevents the gform_replace_merge_tags filter from being called twice, as defined in: |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @see GFCommon::replace_variables_prepopulate() |
95 | 95 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
96 | 96 | */ |
97 | - if( false === $form ) { |
|
97 | + if ( false === $form ) { |
|
98 | 98 | return $text; |
99 | 99 | } |
100 | 100 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
127 | 127 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
128 | 128 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
129 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
129 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
130 | 130 | ); |
131 | 131 | |
132 | 132 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
190 | 190 | |
191 | 191 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
192 | - if( empty( $matches ) ) { |
|
192 | + if ( empty( $matches ) ) { |
|
193 | 193 | return $text; |
194 | 194 | } |
195 | 195 | |
196 | 196 | foreach ( $matches as $match ) { |
197 | 197 | |
198 | - $full_tag = $match[0]; |
|
199 | - $property = $match[1]; |
|
198 | + $full_tag = $match[ 0 ]; |
|
199 | + $property = $match[ 1 ]; |
|
200 | 200 | |
201 | 201 | $value = stripslashes_deep( rgget( $property ) ); |
202 | 202 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @since 1.15 |
221 | 221 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
222 | 222 | */ |
223 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
223 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
224 | 224 | |
225 | 225 | $value = $esc_html ? esc_html( $value ) : $value; |
226 | 226 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @param[in] array $form Gravity Forms form array |
232 | 232 | * @param[in] array $entry Entry array |
233 | 233 | */ |
234 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
234 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
235 | 235 | |
236 | 236 | $text = str_replace( $full_tag, $value, $text ); |
237 | 237 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | * @since 1.0 |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
37 | + add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 ); |
|
38 | 38 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
39 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
40 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
39 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
40 | + add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | // Add help page to GravityView menu |
54 | 54 | add_submenu_page( |
55 | 55 | 'edit.php?post_type=gravityview', |
56 | - __('GravityView: Getting Started', 'gravityview'), |
|
57 | - __('Getting Started', 'gravityview'), |
|
56 | + __( 'GravityView: Getting Started', 'gravityview' ), |
|
57 | + __( 'Getting Started', 'gravityview' ), |
|
58 | 58 | $this->minimum_capability, |
59 | 59 | 'gv-getting-started', |
60 | 60 | array( $this, 'getting_started_screen' ) |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return boolean $is_page True: yep; false: nope |
89 | 89 | */ |
90 | - public function is_dashboard_page($is_page = false, $hook = NULL) { |
|
90 | + public function is_dashboard_page( $is_page = false, $hook = NULL ) { |
|
91 | 91 | global $plugin_page; |
92 | 92 | |
93 | - if($is_page) { return $is_page; } |
|
93 | + if ( $is_page ) { return $is_page; } |
|
94 | 94 | |
95 | 95 | return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
109 | 109 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
110 | 110 | |
111 | - if( !$this->is_dashboard_page() ) { return; } |
|
111 | + if ( ! $this->is_dashboard_page() ) { return; } |
|
112 | 112 | |
113 | 113 | ?> |
114 | 114 | <style type="text/css" media="screen"> |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | // Don't fetch -beta, etc. |
142 | 142 | list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
143 | 143 | |
144 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
144 | + $selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
145 | 145 | ?> |
146 | 146 | |
147 | 147 | <h1><img class="alignleft" src="<?php echo plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ); ?>" width="100" height="132" /><?php printf( esc_html__( 'Welcome to GravityView %s', 'gravityview' ), $display_version ); ?></h1> |
148 | 148 | <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
149 | 149 | |
150 | 150 | <h2 class="nav-tab-wrapper clear"> |
151 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
151 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
152 | 152 | <?php _e( "Getting Started", 'gravityview' ); ?> |
153 | 153 | </a> |
154 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
154 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
155 | 155 | <?php _e( "List of Changes", 'gravityview' ); ?> |
156 | 156 | </a> |
157 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
157 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
158 | 158 | <?php _e( 'Credits', 'gravityview' ); ?> |
159 | 159 | </a> |
160 | 160 | </h2> |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | <h2>Create a View</h2> |
191 | 191 | |
192 | 192 | <ol class="ol-decimal"> |
193 | - <li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views > New View</a></li> |
|
193 | + <li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views > New View</a></li> |
|
194 | 194 | <li>If you want to <strong>create a new form</strong>, click the "Start Fresh" button</li> |
195 | 195 | <li>If you want to <strong>use an existing form’s entries</strong>, select from the dropdown.</li> |
196 | 196 | <li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>. |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | </ul> |
526 | 526 | |
527 | 527 | <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
528 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
528 | + <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
529 | 529 | </div> |
530 | 530 | </div> |
531 | 531 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | global $plugin_page; |
566 | 566 | |
567 | 567 | // Bail if we're just editing the plugin |
568 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
568 | + if ( $plugin_page === 'plugin-editor.php' ) { return; } |
|
569 | 569 | |
570 | 570 | // Bail if no activation redirect |
571 | 571 | if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | $upgrade = get_option( 'gv_version_upgraded_from' ); |
577 | 577 | |
578 | 578 | // Don't do anything if they've already seen the new version info |
579 | - if( $upgrade === GravityView_Plugin::version ) { |
|
579 | + if ( $upgrade === GravityView_Plugin::version ) { |
|
580 | 580 | return; |
581 | 581 | } |
582 | 582 | |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
585 | 585 | |
586 | 586 | // Bail if activating from network, or bulk |
587 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
587 | + if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; } |
|
588 | 588 | |
589 | 589 | // First time install |
590 | - if( ! $upgrade ) { |
|
590 | + if ( ! $upgrade ) { |
|
591 | 591 | wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
592 | 592 | } |
593 | 593 | // Update |
@@ -28,30 +28,30 @@ discard block |
||
28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
29 | 29 | |
30 | 30 | // Tooltips |
31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
32 | 32 | |
33 | 33 | // adding styles and scripts |
34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
39 | - |
|
40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
39 | + |
|
40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
51 | 51 | |
52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
53 | 53 | |
54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
55 | 55 | |
56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
67 | 67 | global $pagenow; |
68 | 68 | |
69 | - if ( !is_admin() ) { |
|
69 | + if ( ! is_admin() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | function add_view_dropdown() { |
88 | 88 | $current_screen = get_current_screen(); |
89 | 89 | |
90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $forms = gravityview_get_forms(); |
95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
96 | 96 | // If there are no forms to select, show no forms. |
97 | - if( !empty( $forms ) ) { ?> |
|
97 | + if ( ! empty( $forms ) ) { ?> |
|
98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
100 | - <?php foreach( $forms as $form ) { ?> |
|
101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
100 | + <?php foreach ( $forms as $form ) { ?> |
|
101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
102 | 102 | <?php } ?> |
103 | 103 | </select> |
104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -134,37 +134,37 @@ discard block |
||
134 | 134 | |
135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
136 | 136 | |
137 | - if( empty( $connected_views ) ) { |
|
137 | + if ( empty( $connected_views ) ) { |
|
138 | 138 | return $menu_items; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $sub_menu_items = array(); |
142 | 142 | foreach ( (array)$connected_views as $view ) { |
143 | 143 | |
144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
144 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
148 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
149 | 149 | |
150 | - $sub_menu_items[] = array( |
|
150 | + $sub_menu_items[ ] = array( |
|
151 | 151 | 'label' => esc_attr( $label ), |
152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
152 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | // If there were no items added, then let's create the parent menu |
157 | - if( $sub_menu_items ) { |
|
157 | + if ( $sub_menu_items ) { |
|
158 | 158 | |
159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
160 | - $sub_menu_items[] = array( |
|
160 | + $sub_menu_items[ ] = array( |
|
161 | 161 | 'url' => '#', |
162 | 162 | 'label' => '', |
163 | 163 | 'menu_class' => 'hidden', |
164 | 164 | 'capabilities' => '', |
165 | 165 | ); |
166 | 166 | |
167 | - $menu_items['gravityview'] = array( |
|
167 | + $menu_items[ 'gravityview' ] = array( |
|
168 | 168 | 'label' => __( 'Connected Views', 'gravityview' ), |
169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
170 | 170 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $add = array( 'captcha', 'page' ); |
195 | 195 | |
196 | 196 | // Don't allowing editing the following values: |
197 | - if( $context === 'edit' ) { |
|
198 | - $add[] = 'post_id'; |
|
197 | + if ( $context === 'edit' ) { |
|
198 | + $add[ ] = 'post_id'; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $return = array_merge( $array, $add ); |
@@ -218,32 +218,32 @@ discard block |
||
218 | 218 | foreach ( $default_args as $key => $arg ) { |
219 | 219 | |
220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
221 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
222 | 222 | |
223 | 223 | // By default, use `tooltip` if defined. |
224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
224 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
225 | 225 | |
226 | 226 | // Otherwise, use the description as a tooltip. |
227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
228 | - $tooltip = $arg['desc']; |
|
227 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
228 | + $tooltip = $arg[ 'desc' ]; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // If there's no tooltip set, continue |
232 | - if( empty( $tooltip ) ) { |
|
232 | + if ( empty( $tooltip ) ) { |
|
233 | 233 | continue; |
234 | 234 | } |
235 | 235 | |
236 | 236 | // Add the tooltip |
237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
238 | - 'title' => $arg['label'], |
|
237 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
238 | + 'title' => $arg[ 'label' ], |
|
239 | 239 | 'value' => $tooltip, |
240 | 240 | ); |
241 | 241 | |
242 | 242 | } |
243 | 243 | |
244 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
245 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
244 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
245 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
246 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
247 | 247 | ); |
248 | 248 | |
249 | 249 | /** |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | |
255 | 255 | foreach ( $gv_tooltips as $key => $tooltip ) { |
256 | 256 | |
257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
257 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
258 | 258 | |
259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
259 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | return $tooltips; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @return void |
272 | 272 | */ |
273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
274 | 274 | |
275 | 275 | $output = ''; |
276 | 276 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
293 | 293 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
294 | 294 | |
295 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
295 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
296 | 296 | |
297 | 297 | break; |
298 | 298 | |
@@ -333,44 +333,44 @@ discard block |
||
333 | 333 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
334 | 334 | |
335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
336 | - if( empty( $form ) ) { |
|
336 | + if ( empty( $form ) ) { |
|
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // The $form is passed as the form ID |
341 | - if( !is_array( $form ) ) { |
|
341 | + if ( ! is_array( $form ) ) { |
|
342 | 342 | $form = gravityview_get_form( $form ); |
343 | 343 | } |
344 | 344 | |
345 | - $form_id = $form['id']; |
|
345 | + $form_id = $form[ 'id' ]; |
|
346 | 346 | $links = array(); |
347 | 347 | |
348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
348 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
349 | 349 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
350 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
351 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
352 | 352 | } else { |
353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
353 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
354 | 354 | } |
355 | 355 | |
356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
356 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
357 | 357 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
358 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
359 | 359 | } |
360 | 360 | |
361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
361 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
362 | 362 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
363 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
364 | 364 | } |
365 | 365 | |
366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
366 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
367 | 367 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
368 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $output = ''; |
372 | 372 | |
373 | - if( !empty( $include_form_link ) ) { |
|
373 | + if ( ! empty( $include_form_link ) ) { |
|
374 | 374 | $output .= $form_link; |
375 | 375 | } |
376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
384 | 384 | |
385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
385 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
386 | 386 | |
387 | 387 | return $output; |
388 | 388 | } |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | // Get the date column and save it for later to add back in. |
397 | 397 | // This adds it after the Data Source column. |
398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
399 | - $date = $columns['date']; |
|
400 | - unset( $columns['date'] ); |
|
399 | + $date = $columns[ 'date' ]; |
|
400 | + unset( $columns[ 'date' ] ); |
|
401 | 401 | |
402 | 402 | $data_source_required_caps = array( |
403 | 403 | 'gravityforms_edit_forms', |
@@ -408,14 +408,14 @@ discard block |
||
408 | 408 | 'gravityforms_preview_forms', |
409 | 409 | ); |
410 | 410 | |
411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
411 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
412 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
413 | 413 | } |
414 | 414 | |
415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
415 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
416 | 416 | |
417 | 417 | // Add the date back in. |
418 | - $columns['date'] = $date; |
|
418 | + $columns[ 'date' ] = $date; |
|
419 | 419 | |
420 | 420 | return $columns; |
421 | 421 | } |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function save_postdata( $post_id ) { |
431 | 431 | |
432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
432 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
433 | 433 | return; |
434 | 434 | } |
435 | 435 | |
436 | 436 | // validate post_type |
437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
437 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
438 | 438 | return; |
439 | 439 | } |
440 | 440 | |
@@ -449,90 +449,90 @@ discard block |
||
449 | 449 | $statii = array(); |
450 | 450 | |
451 | 451 | // check if this is a start fresh View |
452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
452 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
453 | 453 | |
454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
454 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
455 | 455 | // save form id |
456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
456 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
457 | 457 | |
458 | 458 | } |
459 | 459 | |
460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
460 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
461 | 461 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
462 | 462 | return; |
463 | 463 | } |
464 | 464 | |
465 | 465 | // Was this a start fresh? |
466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
466 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
467 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
468 | 468 | } else { |
469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
469 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | // Check if we have a template id |
473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
473 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
474 | 474 | |
475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
475 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
476 | 476 | |
477 | 477 | // now save template id |
478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
478 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | // save View Configuration metabox |
483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
483 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
484 | 484 | |
485 | 485 | // template settings |
486 | - if( empty( $_POST['template_settings'] ) ) { |
|
487 | - $_POST['template_settings'] = array(); |
|
486 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
487 | + $_POST[ 'template_settings' ] = array(); |
|
488 | 488 | } |
489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
489 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
490 | 490 | |
491 | 491 | $fields = array(); |
492 | 492 | |
493 | 493 | // Directory&single Visible Fields |
494 | - if( !empty( $preset_fields ) ) { |
|
494 | + if ( ! empty( $preset_fields ) ) { |
|
495 | 495 | |
496 | 496 | $fields = $preset_fields; |
497 | 497 | |
498 | - } elseif( !empty( $_POST['fields'] ) ) { |
|
498 | + } elseif ( ! empty( $_POST[ 'fields' ] ) ) { |
|
499 | 499 | |
500 | - if( !is_array( $_POST['fields'] ) ) { |
|
500 | + if ( ! is_array( $_POST[ 'fields' ] ) ) { |
|
501 | 501 | |
502 | 502 | // Fields are passed as a jQuery-serialized array, created in admin-views.js in the serializeForm method |
503 | 503 | // Not using parse_str due to max_input_vars limitation |
504 | 504 | $fields_holder = array(); |
505 | - GVCommon::gv_parse_str( $_POST['fields'], $fields_holder ); |
|
505 | + GVCommon::gv_parse_str( $_POST[ 'fields' ], $fields_holder ); |
|
506 | 506 | |
507 | - if( isset( $fields_holder['fields'] ) ) { |
|
507 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
508 | 508 | |
509 | 509 | // When parsed, there's a m |
510 | - $fields = $fields_holder['fields']; |
|
510 | + $fields = $fields_holder[ 'fields' ]; |
|
511 | 511 | |
512 | 512 | } else { |
513 | 513 | |
514 | - do_action('gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
|
514 | + do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
|
515 | 515 | |
516 | 516 | } |
517 | 517 | |
518 | 518 | } else { |
519 | 519 | |
520 | - $fields = $_POST['fields']; |
|
520 | + $fields = $_POST[ 'fields' ]; |
|
521 | 521 | |
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
525 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
526 | 526 | |
527 | 527 | // Directory Visible Widgets |
528 | - if( empty( $_POST['widgets'] ) ) { |
|
529 | - $_POST['widgets'] = array(); |
|
528 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
529 | + $_POST[ 'widgets' ] = array(); |
|
530 | 530 | } |
531 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
531 | + $statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] ); |
|
532 | 532 | |
533 | 533 | } // end save view configuration |
534 | 534 | |
535 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
535 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | /** |
@@ -564,20 +564,20 @@ discard block |
||
564 | 564 | |
565 | 565 | $output = ''; |
566 | 566 | |
567 | - if( !empty( $fields ) ) { |
|
567 | + if ( ! empty( $fields ) ) { |
|
568 | 568 | |
569 | - foreach( $fields as $id => $details ) { |
|
569 | + foreach ( $fields as $id => $details ) { |
|
570 | 570 | |
571 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
571 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
572 | 572 | continue; |
573 | 573 | } |
574 | 574 | |
575 | 575 | // Edit mode only allows editing the parent fields, not single inputs. |
576 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
576 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
577 | 577 | continue; |
578 | 578 | } |
579 | 579 | |
580 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
580 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
581 | 581 | |
582 | 582 | } // End foreach |
583 | 583 | } |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | echo $output; |
586 | 586 | |
587 | 587 | // For the EDIT view we only want to allow the form fields. |
588 | - if( $context === 'edit' ) { |
|
588 | + if ( $context === 'edit' ) { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | |
@@ -609,16 +609,16 @@ discard block |
||
609 | 609 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
610 | 610 | array( |
611 | 611 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
612 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
612 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
613 | 613 | 'field_id' => 'all-fields', |
614 | 614 | 'label_type' => 'field', |
615 | 615 | 'input_type' => NULL, |
616 | 616 | 'field_options' => NULL, |
617 | 617 | 'settings_html' => NULL, |
618 | 618 | ) |
619 | - )); |
|
619 | + ) ); |
|
620 | 620 | |
621 | - if( !empty( $additional_fields )) { |
|
621 | + if ( ! empty( $additional_fields ) ) { |
|
622 | 622 | foreach ( (array)$additional_fields as $item ) { |
623 | 623 | |
624 | 624 | // Prevent items from not having index set |
@@ -629,16 +629,16 @@ discard block |
||
629 | 629 | 'input_type' => NULL, |
630 | 630 | 'field_options' => NULL, |
631 | 631 | 'settings_html' => NULL, |
632 | - )); |
|
632 | + ) ); |
|
633 | 633 | |
634 | 634 | // Backward compat. |
635 | - if( !empty( $item['field_options'] ) ) { |
|
635 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
636 | 636 | // Use settings_html from now on. |
637 | - $item['settings_html'] = $item['field_options']; |
|
637 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | // Render a label for each of them |
641 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
641 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
642 | 642 | |
643 | 643 | } |
644 | 644 | } |
@@ -651,64 +651,64 @@ discard block |
||
651 | 651 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
652 | 652 | * @return array |
653 | 653 | */ |
654 | - function get_entry_default_fields($form, $zone) { |
|
654 | + function get_entry_default_fields( $form, $zone ) { |
|
655 | 655 | |
656 | 656 | $entry_default_fields = array(); |
657 | 657 | |
658 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
658 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
659 | 659 | |
660 | 660 | $entry_default_fields = array( |
661 | 661 | 'id' => array( |
662 | - 'label' => __('Entry ID', 'gravityview'), |
|
662 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
663 | 663 | 'type' => 'id', |
664 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
664 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
665 | 665 | ), |
666 | 666 | 'date_created' => array( |
667 | - 'label' => __('Entry Date', 'gravityview'), |
|
668 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
667 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
668 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
669 | 669 | 'type' => 'date_created', |
670 | 670 | ), |
671 | 671 | 'source_url' => array( |
672 | - 'label' => __('Source URL', 'gravityview'), |
|
672 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
673 | 673 | 'type' => 'source_url', |
674 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
674 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
675 | 675 | ), |
676 | 676 | 'ip' => array( |
677 | - 'label' => __('User IP', 'gravityview'), |
|
677 | + 'label' => __( 'User IP', 'gravityview' ), |
|
678 | 678 | 'type' => 'ip', |
679 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
679 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
680 | 680 | ), |
681 | 681 | 'created_by' => array( |
682 | - 'label' => __('User', 'gravityview'), |
|
682 | + 'label' => __( 'User', 'gravityview' ), |
|
683 | 683 | 'type' => 'created_by', |
684 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
684 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
685 | 685 | ), |
686 | 686 | |
687 | 687 | /** |
688 | 688 | * @since 1.2 |
689 | 689 | */ |
690 | 690 | 'custom' => array( |
691 | - 'label' => __('Custom Content', 'gravityview'), |
|
691 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
692 | 692 | 'type' => 'custom', |
693 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
693 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
694 | 694 | ), |
695 | 695 | |
696 | 696 | /** |
697 | 697 | * @since 1.7.2 |
698 | 698 | */ |
699 | 699 | 'other_entries' => array( |
700 | - 'label' => __('Other Entries', 'gravityview'), |
|
700 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
701 | 701 | 'type' => 'other_entries', |
702 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
702 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
703 | 703 | ), |
704 | 704 | ); |
705 | 705 | |
706 | 706 | |
707 | - if( 'single' !== $zone) { |
|
707 | + if ( 'single' !== $zone ) { |
|
708 | 708 | |
709 | - $entry_default_fields['entry_link'] = array( |
|
710 | - 'label' => __('Link to Entry', 'gravityview'), |
|
711 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
709 | + $entry_default_fields[ 'entry_link' ] = array( |
|
710 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
711 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
712 | 712 | 'type' => 'entry_link', |
713 | 713 | ); |
714 | 714 | } |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @param string|array $form form_ID or form object |
723 | 723 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
724 | 724 | */ |
725 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
725 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | */ |
734 | 734 | function get_available_fields( $form = '', $zone = NULL ) { |
735 | 735 | |
736 | - if( empty( $form ) ) { |
|
736 | + if ( empty( $form ) ) { |
|
737 | 737 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
738 | 738 | return array(); |
739 | 739 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | $fields = gravityview_get_form_fields( $form, true ); |
743 | 743 | |
744 | 744 | // get meta fields ( only if form was already created ) |
745 | - if( !is_array( $form ) ) { |
|
745 | + if ( ! is_array( $form ) ) { |
|
746 | 746 | $meta_fields = gravityview_get_entry_meta( $form ); |
747 | 747 | } else { |
748 | 748 | $meta_fields = array(); |
@@ -766,11 +766,11 @@ discard block |
||
766 | 766 | |
767 | 767 | $widgets = $this->get_registered_widgets(); |
768 | 768 | |
769 | - if( !empty( $widgets ) ) { |
|
769 | + if ( ! empty( $widgets ) ) { |
|
770 | 770 | |
771 | - foreach( $widgets as $id => $details ) { |
|
771 | + foreach ( $widgets as $id => $details ) { |
|
772 | 772 | |
773 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
773 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
774 | 774 | |
775 | 775 | } |
776 | 776 | } |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
805 | 805 | global $post; |
806 | 806 | |
807 | - if( $type === 'widget' ) { |
|
807 | + if ( $type === 'widget' ) { |
|
808 | 808 | $button_label = __( 'Add Widget', 'gravityview' ); |
809 | 809 | } else { |
810 | 810 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -813,15 +813,15 @@ discard block |
||
813 | 813 | $available_items = array(); |
814 | 814 | |
815 | 815 | // if saved values, get available fields to label everyone |
816 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
816 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
817 | 817 | |
818 | - if( !empty( $_POST['template_id'] ) ) { |
|
819 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
818 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
819 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
820 | 820 | } else { |
821 | 821 | $form = gravityview_get_form_id( $post->ID ); |
822 | 822 | } |
823 | 823 | |
824 | - if( 'field' === $type ) { |
|
824 | + if ( 'field' === $type ) { |
|
825 | 825 | $available_items = $this->get_available_fields( $form, $zone ); |
826 | 826 | } else { |
827 | 827 | $available_items = $this->get_registered_widgets(); |
@@ -829,39 +829,39 @@ discard block |
||
829 | 829 | |
830 | 830 | } |
831 | 831 | |
832 | - foreach( $rows as $row ) : |
|
833 | - foreach( $row as $col => $areas ) : |
|
834 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
832 | + foreach ( $rows as $row ) : |
|
833 | + foreach ( $row as $col => $areas ) : |
|
834 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
835 | 835 | |
836 | 836 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
837 | 837 | |
838 | - <?php foreach( $areas as $area ) : ?> |
|
838 | + <?php foreach ( $areas as $area ) : ?> |
|
839 | 839 | |
840 | 840 | <div class="gv-droppable-area"> |
841 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
841 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
842 | 842 | |
843 | 843 | <?php // render saved fields |
844 | 844 | |
845 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
845 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
846 | 846 | |
847 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
847 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
848 | 848 | |
849 | 849 | $input_type = NULL; |
850 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
850 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
851 | 851 | |
852 | - if( !$original_item ) { |
|
852 | + if ( ! $original_item ) { |
|
853 | 853 | |
854 | - do_action('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('available_items' => $available_items, 'field' => $field )); |
|
854 | + do_action( '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( 'available_items' => $available_items, 'field' => $field ) ); |
|
855 | 855 | |
856 | 856 | $original_item = $field; |
857 | 857 | } else { |
858 | 858 | |
859 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
859 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
860 | 860 | |
861 | 861 | } |
862 | 862 | |
863 | 863 | // Field options dialog box |
864 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
864 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
865 | 865 | |
866 | 866 | $item = array( |
867 | 867 | 'input_type' => $input_type, |
@@ -870,16 +870,16 @@ discard block |
||
870 | 870 | ); |
871 | 871 | |
872 | 872 | // Merge the values with the current item to pass things like widget descriptions and original field names |
873 | - if( $original_item ) { |
|
873 | + if ( $original_item ) { |
|
874 | 874 | $item = wp_parse_args( $item, $original_item ); |
875 | 875 | } |
876 | 876 | |
877 | - switch( $type ) { |
|
877 | + switch ( $type ) { |
|
878 | 878 | case 'widget': |
879 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
879 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
880 | 880 | break; |
881 | 881 | default: |
882 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
882 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | |
@@ -889,11 +889,11 @@ discard block |
||
889 | 889 | |
890 | 890 | } // End if zone is not empty ?> |
891 | 891 | |
892 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
892 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
893 | 893 | </div> |
894 | 894 | <div class="gv-droppable-area-action"> |
895 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
896 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
895 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
896 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
897 | 897 | </div> |
898 | 898 | </div> |
899 | 899 | |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
916 | 916 | |
917 | 917 | $widgets = array(); |
918 | - if( !empty( $post_id ) ) { |
|
918 | + if ( ! empty( $post_id ) ) { |
|
919 | 919 | $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
920 | 920 | |
921 | 921 | } |
@@ -946,19 +946,19 @@ discard block |
||
946 | 946 | */ |
947 | 947 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
948 | 948 | |
949 | - if( empty( $template_id ) ) { |
|
949 | + if ( empty( $template_id ) ) { |
|
950 | 950 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
951 | 951 | return; |
952 | 952 | } |
953 | 953 | |
954 | 954 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
955 | 955 | |
956 | - if( empty( $template_areas ) ) { |
|
956 | + if ( empty( $template_areas ) ) { |
|
957 | 957 | |
958 | 958 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
959 | 959 | $output = '<div>'; |
960 | - $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.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
961 | - $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.', 'gravityview').'</p>'; |
|
960 | + $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.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
961 | + $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.', 'gravityview' ) . '</p>'; |
|
962 | 962 | $output .= '</div>'; |
963 | 963 | } else { |
964 | 964 | |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | |
974 | 974 | } |
975 | 975 | |
976 | - if( $echo ) { |
|
976 | + if ( $echo ) { |
|
977 | 977 | echo $output; |
978 | 978 | } |
979 | 979 | |
@@ -993,25 +993,25 @@ discard block |
||
993 | 993 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
994 | 994 | |
995 | 995 | // Add the GV font (with the Astronaut) |
996 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
996 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
997 | 997 | |
998 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
998 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
999 | 999 | |
1000 | 1000 | // Don't process any scripts below here if it's not a GravityView page. |
1001 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
1001 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
1002 | 1002 | |
1003 | 1003 | // Only enqueue the following on single pages |
1004 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
1004 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
1005 | 1005 | |
1006 | 1006 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1007 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1007 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
1008 | 1008 | |
1009 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1009 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1010 | 1010 | |
1011 | 1011 | //enqueue scripts |
1012 | 1012 | 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' ), GravityView_Plugin::version ); |
1013 | 1013 | |
1014 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1014 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1015 | 1015 | 'cookiepath' => COOKIEPATH, |
1016 | 1016 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1017 | 1017 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
@@ -1024,9 +1024,9 @@ discard block |
||
1024 | 1024 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1025 | 1025 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1026 | 1026 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
1027 | - )); |
|
1027 | + ) ); |
|
1028 | 1028 | |
1029 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1029 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1030 | 1030 | |
1031 | 1031 | self::enqueue_gravity_forms_scripts(); |
1032 | 1032 | |
@@ -1045,10 +1045,10 @@ discard block |
||
1045 | 1045 | ); |
1046 | 1046 | |
1047 | 1047 | if ( wp_is_mobile() ) { |
1048 | - $scripts[] = 'jquery-touch-punch'; |
|
1048 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | - foreach ($scripts as $script) { |
|
1051 | + foreach ( $scripts as $script ) { |
|
1052 | 1052 | wp_enqueue_script( $script ); |
1053 | 1053 | } |
1054 | 1054 | } |
@@ -1057,11 +1057,11 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | $filter = current_filter(); |
1059 | 1059 | |
1060 | - if( preg_match('/script/ism', $filter ) ) { |
|
1060 | + if ( preg_match( '/script/ism', $filter ) ) { |
|
1061 | 1061 | $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
1062 | 1062 | 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
1063 | 1063 | $registered = array_merge( $registered, $allow_scripts ); |
1064 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
1064 | + } elseif ( preg_match( '/style/ism', $filter ) ) { |
|
1065 | 1065 | $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
1066 | 1066 | $registered = array_merge( $registered, $allow_styles ); |
1067 | 1067 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * @see RGFormsModel::update_lead_property() Trigger when any entry property changes |
81 | 81 | */ |
82 | - foreach( $this->lead_db_columns as $column ) { |
|
82 | + foreach ( $this->lead_db_columns as $column ) { |
|
83 | 83 | add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 ); |
84 | 84 | } |
85 | 85 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
115 | - do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
115 | + do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) ); |
|
116 | 116 | |
117 | - $this->blacklist_add( $entry['form_id'] ); |
|
117 | + $this->blacklist_add( $entry[ 'form_id' ] ); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function entry_updated( $form, $lead_id ) { |
129 | 129 | |
130 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
130 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' ); |
|
131 | 131 | |
132 | - $this->blacklist_add( $form['id'] ); |
|
132 | + $this->blacklist_add( $form[ 'id' ] ); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function entry_created( $entry, $form ) { |
146 | 146 | |
147 | - do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' ); |
|
147 | + do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' ); |
|
148 | 148 | |
149 | - $this->blacklist_add( $form['id'] ); |
|
149 | + $this->blacklist_add( $form[ 'id' ] ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // Normally just one form, but supports multiple forms |
166 | 166 | // |
167 | 167 | // Array of IDs 12, 5, 14 would result in `f-12f-5f-14` |
168 | - $forms = 'f:' . implode( '&f:', (array) $form_ids ); |
|
168 | + $forms = 'f:' . implode( '&f:', (array)$form_ids ); |
|
169 | 169 | |
170 | 170 | // Prefix for transient keys |
171 | 171 | // Now the prefix would be: `gv-cache-f-12f-5f-14` |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() ); |
244 | 244 | |
245 | - $updated_list = array_diff( $blacklist, (array) $form_ids ); |
|
245 | + $updated_list = array_diff( $blacklist, (array)$form_ids ); |
|
246 | 246 | |
247 | 247 | do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array( |
248 | 248 | '$form_ids' => $form_ids, |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | |
278 | - foreach ( (array) $form_ids as $form_id ) { |
|
278 | + foreach ( (array)$form_ids as $form_id ) { |
|
279 | 279 | |
280 | 280 | if ( in_array( $form_id, $blacklist ) ) { |
281 | 281 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache |
348 | 348 | * @param int $time_in_seconds Default: `DAY_IN_SECONDS` |
349 | 349 | */ |
350 | - $cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
350 | + $cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS ); |
|
351 | 351 | |
352 | 352 | do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' ); |
353 | 353 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | return; |
384 | 384 | } |
385 | 385 | |
386 | - foreach ( (array) $form_ids as $form_id ) { |
|
386 | + foreach ( (array)$form_ids as $form_id ) { |
|
387 | 387 | |
388 | 388 | $key = $this->get_cache_key_prefix( $form_id ); |
389 | 389 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | |
498 | 498 | if ( GVCommon::has_cap( 'edit_gravityviews' ) ) { |
499 | 499 | |
500 | - if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) { |
|
500 | + if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) { |
|
501 | 501 | |
502 | 502 | do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' ); |
503 | 503 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | */ |
527 | 527 | $use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this ); |
528 | 528 | |
529 | - return (boolean) $use_cache; |
|
529 | + return (boolean)$use_cache; |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | } |