@@ -266,7 +266,7 @@ discard block |
||
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 ) ) { |
|
269 | + if( !empty( $wp_styles->registered ) ) { |
|
270 | 270 | foreach ($wp_styles->registered as $key => $style) { |
271 | 271 | if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
272 | 272 | wp_dequeue_style( $key ); |
@@ -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 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
183 | 183 | 8 => __( 'View submitted.', 'gravityview' ), |
184 | 184 | 9 => sprintf( |
185 | - /* translators: Date and time the View is scheduled to be published */ |
|
185 | + /* translators: Date and time the View is scheduled to be published */ |
|
186 | 186 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
187 | 187 | // translators: Publish box date format, see http://php.net/date |
188 | 188 | date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
@@ -222,39 +222,39 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | $wp_allowed_scripts = array( |
225 | - 'common', |
|
226 | - 'admin-bar', |
|
227 | - 'autosave', |
|
228 | - 'post', |
|
225 | + 'common', |
|
226 | + 'admin-bar', |
|
227 | + 'autosave', |
|
228 | + 'post', |
|
229 | 229 | 'inline-edit-post', |
230 | - 'utils', |
|
231 | - 'svg-painter', |
|
232 | - 'wp-auth-check', |
|
233 | - 'heartbeat', |
|
230 | + 'utils', |
|
231 | + 'svg-painter', |
|
232 | + 'wp-auth-check', |
|
233 | + 'heartbeat', |
|
234 | 234 | 'media-editor', |
235 | 235 | 'media-upload', |
236 | - 'thickbox', |
|
236 | + 'thickbox', |
|
237 | 237 | 'wp-color-picker', |
238 | 238 | |
239 | - // Settings |
|
239 | + // Settings |
|
240 | 240 | 'gv-admin-edd-license', |
241 | 241 | |
242 | - // Common |
|
243 | - 'select2-js', |
|
244 | - 'qtip-js', |
|
242 | + // Common |
|
243 | + 'select2-js', |
|
244 | + 'qtip-js', |
|
245 | 245 | |
246 | - // jQuery |
|
246 | + // jQuery |
|
247 | 247 | 'jquery', |
248 | - 'jquery-ui-core', |
|
249 | - 'jquery-ui-sortable', |
|
250 | - 'jquery-ui-datepicker', |
|
251 | - 'jquery-ui-dialog', |
|
252 | - 'jquery-ui-slider', |
|
248 | + 'jquery-ui-core', |
|
249 | + 'jquery-ui-sortable', |
|
250 | + 'jquery-ui-datepicker', |
|
251 | + 'jquery-ui-dialog', |
|
252 | + 'jquery-ui-slider', |
|
253 | 253 | 'jquery-ui-dialog', |
254 | 254 | 'jquery-ui-tabs', |
255 | 255 | 'jquery-ui-draggable', |
256 | 256 | 'jquery-ui-droppable', |
257 | - 'jquery-ui-accordion', |
|
257 | + 'jquery-ui-accordion', |
|
258 | 258 | ); |
259 | 259 | |
260 | 260 | $this->remove_conflicts( $wp_scripts, $wp_allowed_scripts, 'scripts' ); |
@@ -288,23 +288,23 @@ discard block |
||
288 | 288 | return; |
289 | 289 | } |
290 | 290 | |
291 | - $wp_allowed_styles = array( |
|
292 | - 'admin-bar', |
|
293 | - 'colors', |
|
294 | - 'ie', |
|
295 | - 'wp-auth-check', |
|
296 | - 'media-views', |
|
291 | + $wp_allowed_styles = array( |
|
292 | + 'admin-bar', |
|
293 | + 'colors', |
|
294 | + 'ie', |
|
295 | + 'wp-auth-check', |
|
296 | + 'media-views', |
|
297 | 297 | 'thickbox', |
298 | 298 | 'dashicons', |
299 | - 'wp-jquery-ui-dialog', |
|
300 | - 'jquery-ui-sortable', |
|
299 | + 'wp-jquery-ui-dialog', |
|
300 | + 'jquery-ui-sortable', |
|
301 | 301 | |
302 | - // Settings |
|
303 | - 'gravityview_settings', |
|
302 | + // Settings |
|
303 | + 'gravityview_settings', |
|
304 | 304 | |
305 | - // @todo qTip styles not loading for some reason! |
|
306 | - 'jquery-qtip.js', |
|
307 | - ); |
|
305 | + // @todo qTip styles not loading for some reason! |
|
306 | + 'jquery-qtip.js', |
|
307 | + ); |
|
308 | 308 | |
309 | 309 | $this->remove_conflicts( $wp_styles, $wp_allowed_styles, 'styles' ); |
310 | 310 | |
@@ -324,32 +324,32 @@ discard block |
||
324 | 324 | */ |
325 | 325 | private function remove_conflicts( &$wp_objects, $required_objects, $type = 'scripts' ) { |
326 | 326 | |
327 | - /** |
|
328 | - * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n |
|
329 | - * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles` |
|
330 | - * @param array $required_objects |
|
331 | - */ |
|
332 | - $required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects ); |
|
333 | - |
|
334 | - //reset queue |
|
335 | - $queue = array(); |
|
336 | - foreach( $wp_objects->queue as $object ) { |
|
337 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
338 | - $queue[] = $object; |
|
339 | - } |
|
340 | - } |
|
341 | - $wp_objects->queue = $queue; |
|
342 | - |
|
343 | - $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects ); |
|
344 | - |
|
345 | - //unregistering scripts |
|
346 | - $registered = array(); |
|
347 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
348 | - if( in_array( $handle, $required_objects ) ){ |
|
349 | - $registered[ $handle ] = $script_registration; |
|
350 | - } |
|
351 | - } |
|
352 | - $wp_objects->registered = $registered; |
|
327 | + /** |
|
328 | + * @filter `gravityview_noconflict_{$type}` Modify the list of no conflict scripts or styles\n |
|
329 | + * Filter is `gravityview_noconflict_scripts` or `gravityview_noconflict_styles` |
|
330 | + * @param array $required_objects |
|
331 | + */ |
|
332 | + $required_objects = apply_filters( "gravityview_noconflict_{$type}", $required_objects ); |
|
333 | + |
|
334 | + //reset queue |
|
335 | + $queue = array(); |
|
336 | + foreach( $wp_objects->queue as $object ) { |
|
337 | + if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
338 | + $queue[] = $object; |
|
339 | + } |
|
340 | + } |
|
341 | + $wp_objects->queue = $queue; |
|
342 | + |
|
343 | + $required_objects = $this->add_script_dependencies( $wp_objects->registered, $required_objects ); |
|
344 | + |
|
345 | + //unregistering scripts |
|
346 | + $registered = array(); |
|
347 | + foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
348 | + if( in_array( $handle, $required_objects ) ){ |
|
349 | + $registered[ $handle ] = $script_registration; |
|
350 | + } |
|
351 | + } |
|
352 | + $wp_objects->registered = $registered; |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
@@ -412,7 +412,6 @@ discard block |
||
412 | 412 | * |
413 | 413 | * @deprecated since 1.12 |
414 | 414 | * @see GravityView_Compatibility::get_plugin_status() |
415 | - |
|
416 | 415 | * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive |
417 | 416 | */ |
418 | 417 | static function get_plugin_status( $location = '' ) { |
@@ -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,60 +145,60 @@ 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 | 170 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
171 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
171 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
172 | 172 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
173 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
173 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
174 | 174 | 3 => __( 'View deleted.', 'gravityview' ), |
175 | 175 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
176 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
176 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
177 | 177 | /* translators: %s: date and time of the revision */ |
178 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
178 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
179 | 179 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
180 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
180 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
181 | 181 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
182 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
182 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
183 | 183 | 8 => __( 'View submitted.', 'gravityview' ), |
184 | 184 | 9 => sprintf( |
185 | 185 | /* translators: Date and time the View is scheduled to be published */ |
186 | 186 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
187 | 187 | // translators: Publish box date format, see http://php.net/date |
188 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
188 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
189 | 189 | ) . $new_form_text, |
190 | 190 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
191 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
191 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * These apply to `bulk_post_updated_messages` |
195 | 195 | * @file wp-admin/edit.php |
196 | 196 | */ |
197 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
198 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
199 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
200 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
201 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
197 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
198 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
199 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
200 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
201 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
202 | 202 | ); |
203 | 203 | |
204 | 204 | return $messages; |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | function no_conflict_scripts() { |
212 | 212 | global $wp_scripts; |
213 | 213 | |
214 | - if( ! gravityview_is_admin_page() ) { |
|
214 | + if ( ! gravityview_is_admin_page() ) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
218 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
219 | 219 | |
220 | - if( empty( $no_conflict_mode ) ) { |
|
220 | + if ( empty( $no_conflict_mode ) ) { |
|
221 | 221 | return; |
222 | 222 | } |
223 | 223 | |
@@ -267,24 +267,24 @@ discard block |
||
267 | 267 | function no_conflict_styles() { |
268 | 268 | global $wp_styles; |
269 | 269 | |
270 | - if( ! gravityview_is_admin_page() ) { |
|
270 | + if ( ! gravityview_is_admin_page() ) { |
|
271 | 271 | return; |
272 | 272 | } |
273 | 273 | |
274 | 274 | // Dequeue other jQuery styles even if no-conflict is off. |
275 | 275 | // Terrible-looking tabs help no one. |
276 | - if( !empty( $wp_styles->registered ) ) { |
|
277 | - foreach ($wp_styles->registered as $key => $style) { |
|
278 | - if( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
276 | + if ( ! empty( $wp_styles->registered ) ) { |
|
277 | + foreach ( $wp_styles->registered as $key => $style ) { |
|
278 | + if ( preg_match( '/^(?:wp\-)?jquery/ism', $key ) ) { |
|
279 | 279 | wp_dequeue_style( $key ); |
280 | 280 | } |
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
284 | - $no_conflict_mode = GravityView_Settings::getSetting('no-conflict-mode'); |
|
284 | + $no_conflict_mode = GravityView_Settings::getSetting( 'no-conflict-mode' ); |
|
285 | 285 | |
286 | 286 | // If no conflict is off, jQuery will suffice. |
287 | - if( empty( $no_conflict_mode ) ) { |
|
287 | + if ( empty( $no_conflict_mode ) ) { |
|
288 | 288 | return; |
289 | 289 | } |
290 | 290 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | /** |
312 | 312 | * @action `gravityview_remove_conflicts_after` Runs after no-conflict styles are removed. You can re-add styles here. |
313 | 313 | */ |
314 | - do_action('gravityview_remove_conflicts_after'); |
|
314 | + do_action( 'gravityview_remove_conflicts_after' ); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | |
334 | 334 | //reset queue |
335 | 335 | $queue = array(); |
336 | - foreach( $wp_objects->queue as $object ) { |
|
337 | - if( in_array( $object, $required_objects ) || preg_match('/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
338 | - $queue[] = $object; |
|
336 | + foreach ( $wp_objects->queue as $object ) { |
|
337 | + if ( in_array( $object, $required_objects ) || preg_match( '/gravityview|gf_|gravityforms/ism', $object ) ) { |
|
338 | + $queue[ ] = $object; |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | $wp_objects->queue = $queue; |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | |
345 | 345 | //unregistering scripts |
346 | 346 | $registered = array(); |
347 | - foreach( $wp_objects->registered as $handle => $script_registration ){ |
|
348 | - if( in_array( $handle, $required_objects ) ){ |
|
347 | + foreach ( $wp_objects->registered as $handle => $script_registration ) { |
|
348 | + if ( in_array( $handle, $required_objects ) ) { |
|
349 | 349 | $registered[ $handle ] = $script_registration; |
350 | 350 | } |
351 | 351 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @param [type] $registered [description] |
359 | 359 | * @param [type] $scripts [description] |
360 | 360 | */ |
361 | - private function add_script_dependencies($registered, $scripts) { |
|
361 | + private function add_script_dependencies( $registered, $scripts ) { |
|
362 | 362 | |
363 | 363 | //gets all dependent scripts linked to the $scripts array passed |
364 | 364 | do { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $deps = isset( $registered[ $script ] ) && is_array( $registered[ $script ]->deps ) ? $registered[ $script ]->deps : array(); |
368 | 368 | foreach ( $deps as $dep ) { |
369 | 369 | if ( ! in_array( $dep, $scripts ) && ! in_array( $dep, $dependents ) ) { |
370 | - $dependents[] = $dep; |
|
370 | + $dependents[ ] = $dep; |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | } |
@@ -431,29 +431,29 @@ discard block |
||
431 | 431 | static function is_admin_page( $hook = '', $page = NULL ) { |
432 | 432 | global $current_screen, $plugin_page, $pagenow, $post; |
433 | 433 | |
434 | - if( ! is_admin() ) { return false; } |
|
434 | + if ( ! is_admin() ) { return false; } |
|
435 | 435 | |
436 | 436 | $is_page = false; |
437 | 437 | |
438 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
438 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
439 | 439 | |
440 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
440 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
441 | 441 | |
442 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
442 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
443 | 443 | |
444 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
445 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
446 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
444 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
445 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
446 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
447 | 447 | } else { |
448 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
448 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
449 | 449 | } |
450 | 450 | |
451 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
451 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
452 | 452 | |
453 | 453 | // $_GET `post_type` variable |
454 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
454 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
455 | 455 | $is_page = 'single'; |
456 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
456 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
457 | 457 | $is_page = 'settings'; |
458 | 458 | } else { |
459 | 459 | $is_page = 'views'; |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
469 | 469 | |
470 | 470 | // If the current page is the same as the compared page |
471 | - if( !empty( $page ) ) { |
|
471 | + if ( ! empty( $page ) ) { |
|
472 | 472 | return $is_page === $page; |
473 | 473 | } |
474 | 474 | |
@@ -489,6 +489,6 @@ discard block |
||
489 | 489 | * |
490 | 490 | * @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`) |
491 | 491 | */ |
492 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
492 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
493 | 493 | return GravityView_Admin::is_admin_page( $hook, $page ); |
494 | 494 | } |
@@ -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 | } |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | */ |
18 | 18 | private function __construct( $passed_post = NULL ) { |
19 | 19 | |
20 | - if( !empty( $passed_post ) ) { |
|
20 | + if ( ! empty( $passed_post ) ) { |
|
21 | 21 | |
22 | 22 | $id_or_id_array = $this->maybe_get_view_id( $passed_post ); |
23 | 23 | |
24 | - if( !empty( $id_or_id_array ) ) { |
|
24 | + if ( ! empty( $id_or_id_array ) ) { |
|
25 | 25 | $this->add_view( $id_or_id_array ); |
26 | 26 | } |
27 | 27 | } |
@@ -56,33 +56,33 @@ discard block |
||
56 | 56 | |
57 | 57 | $ids = array(); |
58 | 58 | |
59 | - if( ! empty( $passed_post ) ) { |
|
59 | + if ( ! empty( $passed_post ) ) { |
|
60 | 60 | |
61 | - if( is_numeric( $passed_post ) ) { |
|
61 | + if ( is_numeric( $passed_post ) ) { |
|
62 | 62 | $passed_post = get_post( $passed_post ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | // Convert WP_Posts into WP_Posts[] array |
66 | - if( $passed_post instanceof WP_Post ) { |
|
66 | + if ( $passed_post instanceof WP_Post ) { |
|
67 | 67 | $passed_post = array( $passed_post ); |
68 | 68 | } |
69 | 69 | |
70 | - if( is_array( $passed_post ) ) { |
|
70 | + if ( is_array( $passed_post ) ) { |
|
71 | 71 | |
72 | - foreach ( $passed_post as &$post) { |
|
73 | - if( ( get_post_type( $post ) === 'gravityview' ) ) { |
|
74 | - $ids[] = $post->ID; |
|
75 | - } else{ |
|
72 | + foreach ( $passed_post as &$post ) { |
|
73 | + if ( ( get_post_type( $post ) === 'gravityview' ) ) { |
|
74 | + $ids[ ] = $post->ID; |
|
75 | + } else { |
|
76 | 76 | // Parse the Post Content |
77 | 77 | $id = $this->parse_post_content( $post->post_content ); |
78 | - if( $id ) { |
|
79 | - $ids = array_merge( $ids, (array) $id ); |
|
78 | + if ( $id ) { |
|
79 | + $ids = array_merge( $ids, (array)$id ); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // Parse the Post Meta |
83 | 83 | $id = $this->parse_post_meta( $post->ID ); |
84 | - if( $id ) { |
|
85 | - $ids = array_merge( $ids, (array) $id ); |
|
84 | + if ( $id ) { |
|
85 | + $ids = array_merge( $ids, (array)$id ); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -93,24 +93,24 @@ discard block |
||
93 | 93 | if ( is_string( $passed_post ) ) { |
94 | 94 | |
95 | 95 | $id = $this->parse_post_content( $passed_post ); |
96 | - if( $id ) { |
|
97 | - $ids = array_merge( $ids, (array) $id ); |
|
96 | + if ( $id ) { |
|
97 | + $ids = array_merge( $ids, (array)$id ); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | } else { |
101 | 101 | $id = $this->get_id_from_atts( $passed_post ); |
102 | - $ids[] = intval( $id ); |
|
102 | + $ids[ ] = intval( $id ); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - if( empty($ids) ) { |
|
107 | + if ( empty( $ids ) ) { |
|
108 | 108 | return NULL; |
109 | 109 | } |
110 | 110 | |
111 | 111 | // If it's just one ID, return that. |
112 | 112 | // Otherwise, return array of IDs |
113 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
113 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public static function getInstance( $passed_post = NULL ) { |
120 | 120 | |
121 | - if( empty( self::$instance ) ) { |
|
121 | + if ( empty( self::$instance ) ) { |
|
122 | 122 | self::$instance = new GravityView_View_Data( $passed_post ); |
123 | 123 | } |
124 | 124 | |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | |
132 | 132 | function get_view( $view_id, $atts = NULL ) { |
133 | 133 | |
134 | - if( ! is_numeric( $view_id) ) { |
|
135 | - do_action('gravityview_log_error', sprintf('GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id) ); |
|
134 | + if ( ! is_numeric( $view_id ) ) { |
|
135 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[get_view] $view_id passed is not numeric.', $view_id ) ); |
|
136 | 136 | return false; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Backup: the view hasn't been fetched yet. Doing it now. |
140 | 140 | if ( ! isset( $this->views[ $view_id ] ) ) { |
141 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] View #%s not set yet.', $view_id) ); |
|
141 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] View #%s not set yet.', $view_id ) ); |
|
142 | 142 | return $this->add_view( $view_id, $atts ); |
143 | 143 | } |
144 | 144 | |
145 | 145 | if ( empty( $this->views[ $view_id ] ) ) { |
146 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id) ); |
|
146 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[get_view] Returning; View #%s was empty.', $view_id ) ); |
|
147 | 147 | return false; |
148 | 148 | } |
149 | 149 | |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | function add_view( $view_id, $atts = NULL ) { |
175 | 175 | |
176 | 176 | // Handle array of IDs |
177 | - if( is_array( $view_id ) ) { |
|
178 | - foreach( $view_id as $id ) { |
|
177 | + if ( is_array( $view_id ) ) { |
|
178 | + foreach ( $view_id as $id ) { |
|
179 | 179 | |
180 | 180 | $this->add_view( $id, $atts ); |
181 | 181 | } |
@@ -184,21 +184,21 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | // The view has been set already; returning stored view. |
187 | - if ( !empty( $this->views[ $view_id ] ) ) { |
|
188 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id) ); |
|
187 | + if ( ! empty( $this->views[ $view_id ] ) ) { |
|
188 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s already exists.', $view_id ) ); |
|
189 | 189 | return $this->views[ $view_id ]; |
190 | 190 | } |
191 | 191 | |
192 | - if( ! $this->view_exists( $view_id ) ) { |
|
193 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id) ); |
|
192 | + if ( ! $this->view_exists( $view_id ) ) { |
|
193 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; View #%s does not exist.', $view_id ) ); |
|
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
197 | 197 | $form_id = gravityview_get_form_id( $view_id ); |
198 | 198 | |
199 | - if( empty( $form_id ) ) { |
|
199 | + if ( empty( $form_id ) ) { |
|
200 | 200 | |
201 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id) ); |
|
201 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Returning; Post ID #%s does not have a connected form.', $view_id ) ); |
|
202 | 202 | |
203 | 203 | return false; |
204 | 204 | } |
@@ -206,21 +206,21 @@ discard block |
||
206 | 206 | // Get the settings for the View ID |
207 | 207 | $view_settings = gravityview_get_template_settings( $view_id ); |
208 | 208 | |
209 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id), $view_settings ); |
|
209 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] Settings pulled in from View #%s', $view_id ), $view_settings ); |
|
210 | 210 | |
211 | 211 | // Merge the view settings with the defaults |
212 | 212 | $view_defaults = wp_parse_args( $view_settings, self::get_default_args() ); |
213 | 213 | |
214 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults ); |
|
214 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] View Defaults after merging View Settings with the default args.', $view_defaults ); |
|
215 | 215 | |
216 | - if( ! empty( $atts ) && is_array( $atts ) ) { |
|
216 | + if ( ! empty( $atts ) && is_array( $atts ) ) { |
|
217 | 217 | |
218 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging with the $view_defaults', $atts ); |
|
218 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts before merging with the $view_defaults', $atts ); |
|
219 | 219 | |
220 | 220 | // Get the settings from the shortcode and merge them with defaults. |
221 | 221 | $atts = shortcode_atts( $view_defaults, $atts ); |
222 | 222 | |
223 | - do_action('gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging with the $view_defaults', $atts ); |
|
223 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[add_view] $atts after merging with the $view_defaults', $atts ); |
|
224 | 224 | |
225 | 225 | } else { |
226 | 226 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | } |
231 | 231 | |
232 | - unset( $atts['id'], $view_defaults, $view_settings ); |
|
232 | + unset( $atts[ 'id' ], $view_defaults, $view_settings ); |
|
233 | 233 | |
234 | 234 | $data = array( |
235 | 235 | 'id' => $view_id, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | 'form' => gravityview_get_form( $form_id ), |
243 | 243 | ); |
244 | 244 | |
245 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[add_view] View #%s being added.', $view_id), $data ); |
|
245 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[add_view] View #%s being added.', $view_id ), $data ); |
|
246 | 246 | |
247 | 247 | $this->views[ $view_id ] = $data; |
248 | 248 | |
@@ -277,15 +277,15 @@ discard block |
||
277 | 277 | */ |
278 | 278 | private function filter_fields( $dir_fields ) { |
279 | 279 | |
280 | - if( empty( $dir_fields ) || !is_array( $dir_fields ) ) { |
|
280 | + if ( empty( $dir_fields ) || ! is_array( $dir_fields ) ) { |
|
281 | 281 | return $dir_fields; |
282 | 282 | } |
283 | 283 | |
284 | - foreach( $dir_fields as $area => $fields ) { |
|
284 | + foreach ( $dir_fields as $area => $fields ) { |
|
285 | 285 | |
286 | - foreach( (array)$fields as $uniqid => $properties ) { |
|
286 | + foreach ( (array)$fields as $uniqid => $properties ) { |
|
287 | 287 | |
288 | - if( $this->hide_field_check_conditions( $properties ) ) { |
|
288 | + if ( $this->hide_field_check_conditions( $properties ) ) { |
|
289 | 289 | unset( $dir_fields[ $area ][ $uniqid ] ); |
290 | 290 | } |
291 | 291 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | private function hide_field_check_conditions( $properties ) { |
308 | 308 | |
309 | 309 | // logged-in visibility |
310 | - if( ! empty( $properties['only_loggedin'] ) && ! GVCommon::has_cap( $properties['only_loggedin_cap'] ) ) { |
|
310 | + if ( ! empty( $properties[ 'only_loggedin' ] ) && ! GVCommon::has_cap( $properties[ 'only_loggedin_cap' ] ) ) { |
|
311 | 311 | return true; |
312 | 312 | } |
313 | 313 | |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | // Get the settings from the shortcode and merge them with defaults. |
322 | 322 | $atts = wp_parse_args( $atts, self::get_default_args() ); |
323 | 323 | |
324 | - $view_id = ! empty( $atts['view_id'] ) ? (int)$atts['view_id'] : NULL; |
|
324 | + $view_id = ! empty( $atts[ 'view_id' ] ) ? (int)$atts[ 'view_id' ] : NULL; |
|
325 | 325 | |
326 | - if( empty( $view_id ) && !empty( $atts['id'] ) ) { |
|
327 | - $view_id = (int)$atts['id']; |
|
326 | + if ( empty( $view_id ) && ! empty( $atts[ 'id' ] ) ) { |
|
327 | + $view_id = (int)$atts[ 'id' ]; |
|
328 | 328 | } |
329 | 329 | |
330 | - if( empty( $view_id ) ) { |
|
331 | - do_action('gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts ); |
|
330 | + if ( empty( $view_id ) ) { |
|
331 | + do_action( 'gravityview_log_error', 'GravityView_View_Data[get_id_from_atts] Returning; no ID defined (Atts)', $atts ); |
|
332 | 332 | return; |
333 | 333 | } |
334 | 334 | |
@@ -350,44 +350,44 @@ discard block |
||
350 | 350 | * @hack This is so that the shortcode is registered for the oEmbed preview in the Admin |
351 | 351 | * @since 1.6 |
352 | 352 | */ |
353 | - if( ! shortcode_exists('gravityview') && class_exists( 'GravityView_Shortcode' ) ) { |
|
353 | + if ( ! shortcode_exists( 'gravityview' ) && class_exists( 'GravityView_Shortcode' ) ) { |
|
354 | 354 | new GravityView_Shortcode; |
355 | 355 | } |
356 | 356 | |
357 | 357 | $shortcodes = gravityview_has_shortcode_r( $content, 'gravityview' ); |
358 | 358 | |
359 | - if( empty( $shortcodes ) ) { |
|
359 | + if ( empty( $shortcodes ) ) { |
|
360 | 360 | return NULL; |
361 | 361 | } |
362 | 362 | |
363 | - do_action('gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes ); |
|
363 | + do_action( 'gravityview_log_debug', 'GravityView_View_Data[parse_post_content] Parsing content, found shortcodes:', $shortcodes ); |
|
364 | 364 | |
365 | 365 | $ids = array(); |
366 | 366 | |
367 | - foreach ($shortcodes as $key => $shortcode) { |
|
367 | + foreach ( $shortcodes as $key => $shortcode ) { |
|
368 | 368 | |
369 | - $args = shortcode_parse_atts( $shortcode[3] ); |
|
369 | + $args = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
370 | 370 | |
371 | - if( empty( $args['id'] ) ) { |
|
372 | - do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode ); |
|
371 | + if ( empty( $args[ 'id' ] ) ) { |
|
372 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_content] Returning; no ID defined in shortcode atts for Post #%s (Atts)', $post->ID ), $shortcode ); |
|
373 | 373 | continue; |
374 | 374 | } |
375 | 375 | |
376 | - do_action('gravityview_log_debug', sprintf('GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args['id']), $args ); |
|
376 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_View_Data[parse_post_content] Adding view #%s with shortcode args', $args[ 'id' ] ), $args ); |
|
377 | 377 | |
378 | 378 | // Store the View to the object for later fetching. |
379 | - $this->add_view( $args['id'], $args ); |
|
379 | + $this->add_view( $args[ 'id' ], $args ); |
|
380 | 380 | |
381 | - $ids[] = $args['id']; |
|
381 | + $ids[ ] = $args[ 'id' ]; |
|
382 | 382 | } |
383 | 383 | |
384 | - if( empty($ids) ) { |
|
384 | + if ( empty( $ids ) ) { |
|
385 | 385 | return NULL; |
386 | 386 | } |
387 | 387 | |
388 | 388 | // If it's just one ID, return that. |
389 | 389 | // Otherwise, return array of IDs |
390 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
390 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | */ |
409 | 409 | $meta_keys = (array)apply_filters( 'gravityview/data/parse/meta_keys', array(), $post_id ); |
410 | 410 | |
411 | - if( empty( $meta_keys ) ) { |
|
411 | + if ( empty( $meta_keys ) ) { |
|
412 | 412 | return NULL; |
413 | 413 | } |
414 | 414 | |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | |
417 | 417 | $meta_content = ''; |
418 | 418 | |
419 | - foreach( $meta_keys as $key ) { |
|
420 | - $meta = get_post_meta( $post_id, $key , true ); |
|
421 | - if( ! is_string( $meta ) ) { |
|
419 | + foreach ( $meta_keys as $key ) { |
|
420 | + $meta = get_post_meta( $post_id, $key, true ); |
|
421 | + if ( ! is_string( $meta ) ) { |
|
422 | 422 | continue; |
423 | 423 | } |
424 | 424 | $meta_content .= $meta . ' '; |
425 | 425 | } |
426 | 426 | |
427 | - if( empty( $meta_content ) ) { |
|
428 | - do_action('gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys ); |
|
427 | + if ( empty( $meta_content ) ) { |
|
428 | + do_action( 'gravityview_log_error', sprintf( 'GravityView_View_Data[parse_post_meta] Returning; Empty custom fields for Post #%s (Custom fields keys:)', $post_id ), $meta_keys ); |
|
429 | 429 | return NULL; |
430 | 430 | } |
431 | 431 | |
@@ -452,16 +452,16 @@ discard block |
||
452 | 452 | $message = NULL; |
453 | 453 | |
454 | 454 | // Not invalid if not set! |
455 | - if( empty( $post_id ) || empty( $view_id ) ) { |
|
455 | + if ( empty( $post_id ) || empty( $view_id ) ) { |
|
456 | 456 | |
457 | - if( $empty_is_valid ) { |
|
457 | + if ( $empty_is_valid ) { |
|
458 | 458 | return true; |
459 | 459 | } |
460 | 460 | |
461 | 461 | $message = esc_html__( 'The ID is required.', 'gravityview' ); |
462 | 462 | } |
463 | 463 | |
464 | - if( ! $message ) { |
|
464 | + if ( ! $message ) { |
|
465 | 465 | $status = get_post_status( $post_id ); |
466 | 466 | |
467 | 467 | // Nothing exists with that post ID. |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
476 | - if( ! $message ) { |
|
476 | + if ( ! $message ) { |
|
477 | 477 | |
478 | 478 | // Nothing exists with that post ID. |
479 | 479 | if ( empty( $status ) || in_array( $status, array( 'revision', 'attachment' ) ) ) { |
@@ -482,25 +482,25 @@ discard block |
||
482 | 482 | |
483 | 483 | } |
484 | 484 | |
485 | - if( ! $message ) { |
|
485 | + if ( ! $message ) { |
|
486 | 486 | $view_ids_in_post = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id ); |
487 | 487 | |
488 | 488 | // The post or page specified does not contain the shortcode. |
489 | - if ( false === in_array( $view_id, (array) $view_ids_in_post ) ) { |
|
489 | + if ( false === in_array( $view_id, (array)$view_ids_in_post ) ) { |
|
490 | 490 | $message = sprintf( esc_html__( 'The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview' ), '<br /><code>[gravityview id="' . intval( $view_id ) . '"]</code>' ); |
491 | 491 | } |
492 | 492 | } |
493 | 493 | |
494 | - if( ! $message ) { |
|
494 | + if ( ! $message ) { |
|
495 | 495 | |
496 | 496 | // It's a View |
497 | - if( 'gravityview' === get_post_type( $post_id ) ) { |
|
498 | - $message = esc_html__( 'The ID is already a View.', 'gravityview' );; |
|
497 | + if ( 'gravityview' === get_post_type( $post_id ) ) { |
|
498 | + $message = esc_html__( 'The ID is already a View.', 'gravityview' ); ; |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | } |
502 | 502 | |
503 | - if( $message ) { |
|
503 | + if ( $message ) { |
|
504 | 504 | return new WP_Error( 'invalid_embed_id', $message ); |
505 | 505 | } |
506 | 506 | |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | |
518 | 518 | $args = self::get_default_args( $with_details ); |
519 | 519 | |
520 | - if( !isset( $args[ $key ] ) ) { return NULL; } |
|
520 | + if ( ! isset( $args[ $key ] ) ) { return NULL; } |
|
521 | 521 | |
522 | 522 | return $args[ $key ]; |
523 | 523 | } |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | */ |
547 | 547 | $default_settings = apply_filters( 'gravityview_default_args', array( |
548 | 548 | 'id' => array( |
549 | - 'label' => __('View ID', 'gravityview'), |
|
549 | + 'label' => __( 'View ID', 'gravityview' ), |
|
550 | 550 | 'type' => 'number', |
551 | 551 | 'group' => 'default', |
552 | 552 | 'value' => NULL, |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | 'show_in_shortcode' => false, |
555 | 555 | ), |
556 | 556 | 'page_size' => array( |
557 | - 'label' => __('Number of entries per page', 'gravityview'), |
|
557 | + 'label' => __( 'Number of entries per page', 'gravityview' ), |
|
558 | 558 | 'type' => 'number', |
559 | 559 | 'class' => 'small-text', |
560 | 560 | 'group' => 'default', |
@@ -594,40 +594,40 @@ discard block |
||
594 | 594 | 'user_edit' => array( |
595 | 595 | 'label' => __( 'Allow User Edit', 'gravityview' ), |
596 | 596 | 'group' => 'default', |
597 | - 'desc' => __('Allow logged-in users to edit entries they created.', 'gravityview'), |
|
597 | + 'desc' => __( 'Allow logged-in users to edit entries they created.', 'gravityview' ), |
|
598 | 598 | 'value' => 0, |
599 | - 'tooltip' => __('Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview'), |
|
599 | + 'tooltip' => __( 'Display "Edit Entry" fields to non-administrator users if they created the entry. Edit Entry fields will always be displayed to site administrators.', 'gravityview' ), |
|
600 | 600 | 'type' => 'checkbox', |
601 | 601 | 'show_in_shortcode' => true, |
602 | 602 | ), |
603 | 603 | 'user_delete' => array( |
604 | 604 | 'label' => __( 'Allow User Delete', 'gravityview' ), |
605 | 605 | 'group' => 'default', |
606 | - 'desc' => __('Allow logged-in users to delete entries they created.', 'gravityview'), |
|
606 | + 'desc' => __( 'Allow logged-in users to delete entries they created.', 'gravityview' ), |
|
607 | 607 | 'value' => 0, |
608 | - 'tooltip' => __('Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview'), |
|
608 | + 'tooltip' => __( 'Display "Delete Entry" fields to non-administrator users if they created the entry. Delete Entry fields will always be displayed to site administrators.', 'gravityview' ), |
|
609 | 609 | 'type' => 'checkbox', |
610 | 610 | 'show_in_shortcode' => true, |
611 | 611 | ), |
612 | 612 | 'sort_field' => array( |
613 | - 'label' => __('Sort by field', 'gravityview'), |
|
613 | + 'label' => __( 'Sort by field', 'gravityview' ), |
|
614 | 614 | 'type' => 'select', |
615 | 615 | 'value' => '', |
616 | 616 | 'group' => 'sort', |
617 | 617 | 'options' => array( |
618 | - '' => __( 'Default', 'gravityview'), |
|
619 | - 'date_created' => __( 'Date Created', 'gravityview'), |
|
618 | + '' => __( 'Default', 'gravityview' ), |
|
619 | + 'date_created' => __( 'Date Created', 'gravityview' ), |
|
620 | 620 | ), |
621 | 621 | 'show_in_shortcode' => true, |
622 | 622 | ), |
623 | 623 | 'sort_direction' => array( |
624 | - 'label' => __('Sort direction', 'gravityview'), |
|
624 | + 'label' => __( 'Sort direction', 'gravityview' ), |
|
625 | 625 | 'type' => 'select', |
626 | 626 | 'value' => 'ASC', |
627 | 627 | 'group' => 'sort', |
628 | 628 | 'options' => array( |
629 | - 'ASC' => __('ASC', 'gravityview'), |
|
630 | - 'DESC' => __('DESC', 'gravityview'), |
|
629 | + 'ASC' => __( 'ASC', 'gravityview' ), |
|
630 | + 'DESC' => __( 'DESC', 'gravityview' ), |
|
631 | 631 | //'RAND' => __('Random', 'gravityview'), |
632 | 632 | ), |
633 | 633 | 'show_in_shortcode' => true, |
@@ -643,83 +643,83 @@ discard block |
||
643 | 643 | 'show_in_template' => array( 'default_table' ), |
644 | 644 | ), |
645 | 645 | 'start_date' => array( |
646 | - 'label' => __('Filter by Start Date', 'gravityview'), |
|
646 | + 'label' => __( 'Filter by Start Date', 'gravityview' ), |
|
647 | 647 | 'class' => 'gv-datepicker', |
648 | - 'desc' => __('Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ), |
|
648 | + 'desc' => __( 'Show entries submitted after this date. Supports relative dates, such as "-1 week" or "-1 month".', 'gravityview' ), |
|
649 | 649 | 'type' => 'text', |
650 | 650 | 'value' => '', |
651 | 651 | 'group' => 'filter', |
652 | 652 | 'show_in_shortcode' => true, |
653 | 653 | ), |
654 | 654 | 'end_date' => array( |
655 | - 'label' => __('Filter by End Date', 'gravityview'), |
|
655 | + 'label' => __( 'Filter by End Date', 'gravityview' ), |
|
656 | 656 | 'class' => 'gv-datepicker', |
657 | - 'desc' => __('Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ), |
|
657 | + 'desc' => __( 'Show entries submitted before this date. Supports relative dates, such as "now" or "-3 days".', 'gravityview' ), |
|
658 | 658 | 'type' => 'text', |
659 | 659 | 'value' => '', |
660 | 660 | 'group' => 'filter', |
661 | 661 | 'show_in_shortcode' => true, |
662 | 662 | ), |
663 | 663 | 'class' => array( |
664 | - 'label' => __('CSS Class', 'gravityview'), |
|
665 | - 'desc' => __('CSS class to add to the wrapping HTML container.', 'gravityview'), |
|
664 | + 'label' => __( 'CSS Class', 'gravityview' ), |
|
665 | + 'desc' => __( 'CSS class to add to the wrapping HTML container.', 'gravityview' ), |
|
666 | 666 | 'group' => 'default', |
667 | 667 | 'type' => 'text', |
668 | 668 | 'value' => '', |
669 | 669 | 'show_in_shortcode' => false, |
670 | 670 | ), |
671 | 671 | 'search_value' => array( |
672 | - 'label' => __('Search Value', 'gravityview'), |
|
673 | - 'desc' => __('Define a default search value for the View', 'gravityview'), |
|
672 | + 'label' => __( 'Search Value', 'gravityview' ), |
|
673 | + 'desc' => __( 'Define a default search value for the View', 'gravityview' ), |
|
674 | 674 | 'type' => 'text', |
675 | 675 | 'value' => '', |
676 | 676 | 'group' => 'filter', |
677 | 677 | 'show_in_shortcode' => false, |
678 | 678 | ), |
679 | 679 | 'search_field' => array( |
680 | - 'label' => __('Search Field', 'gravityview'), |
|
681 | - 'desc' => __('If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview'), |
|
680 | + 'label' => __( 'Search Field', 'gravityview' ), |
|
681 | + 'desc' => __( 'If Search Value is set, you can define a specific field to search in. Otherwise, all fields will be searched.', 'gravityview' ), |
|
682 | 682 | 'type' => 'number', |
683 | 683 | 'value' => '', |
684 | 684 | 'group' => 'filter', |
685 | 685 | 'show_in_shortcode' => false, |
686 | 686 | ), |
687 | 687 | 'single_title' => array( |
688 | - 'label' => __('Single Entry Title', 'gravityview'), |
|
688 | + 'label' => __( 'Single Entry Title', 'gravityview' ), |
|
689 | 689 | 'type' => 'text', |
690 | - 'desc' => __('When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview'), |
|
690 | + 'desc' => __( 'When viewing a single entry, change the title of the page to this setting. Otherwise, the title will not change between the Multiple Entries and Single Entry views.', 'gravityview' ), |
|
691 | 691 | 'group' => 'default', |
692 | 692 | 'value' => '', |
693 | 693 | 'show_in_shortcode' => false, |
694 | 694 | 'full_width' => true, |
695 | 695 | ), |
696 | 696 | 'back_link_label' => array( |
697 | - 'label' => __('Back Link Label', 'gravityview'), |
|
697 | + 'label' => __( 'Back Link Label', 'gravityview' ), |
|
698 | 698 | 'group' => 'default', |
699 | - 'desc' => __('The text of the link that returns to the multiple entries view.', 'gravityview'), |
|
699 | + 'desc' => __( 'The text of the link that returns to the multiple entries view.', 'gravityview' ), |
|
700 | 700 | 'type' => 'text', |
701 | 701 | 'value' => '', |
702 | 702 | 'show_in_shortcode' => false, |
703 | 703 | 'full_width' => true, |
704 | 704 | ), |
705 | 705 | 'embed_only' => array( |
706 | - 'label' => __('Prevent Direct Access', 'gravityview'), |
|
706 | + 'label' => __( 'Prevent Direct Access', 'gravityview' ), |
|
707 | 707 | 'group' => 'default', |
708 | - 'desc' => __('Only allow access to this View when embedded using the shortcode.', 'gravityview'), |
|
708 | + 'desc' => __( 'Only allow access to this View when embedded using the shortcode.', 'gravityview' ), |
|
709 | 709 | 'type' => 'checkbox', |
710 | 710 | 'value' => '', |
711 | 711 | 'show_in_shortcode' => false, |
712 | 712 | 'full_width' => true, |
713 | 713 | ), |
714 | - )); |
|
714 | + ) ); |
|
715 | 715 | |
716 | 716 | // By default, we only want the key => value pairing, not the whole array. |
717 | - if( empty( $with_details ) ) { |
|
717 | + if ( empty( $with_details ) ) { |
|
718 | 718 | |
719 | 719 | $defaults = array(); |
720 | 720 | |
721 | - foreach( $default_settings as $key => $value ) { |
|
722 | - $defaults[ $key ] = $value['value']; |
|
721 | + foreach ( $default_settings as $key => $value ) { |
|
722 | + $defaults[ $key ] = $value[ 'value' ]; |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | return $defaults; |
@@ -728,12 +728,12 @@ discard block |
||
728 | 728 | // But sometimes, we want all the details. |
729 | 729 | else { |
730 | 730 | |
731 | - foreach ($default_settings as $key => $value) { |
|
731 | + foreach ( $default_settings as $key => $value ) { |
|
732 | 732 | |
733 | 733 | // If the $group argument is set for the method, |
734 | 734 | // ignore any settings that aren't in that group. |
735 | - if( !empty( $group ) && is_string( $group ) ) { |
|
736 | - if( empty( $value['group'] ) || $value['group'] !== $group ) { |
|
735 | + if ( ! empty( $group ) && is_string( $group ) ) { |
|
736 | + if ( empty( $value[ 'group' ] ) || $value[ 'group' ] !== $group ) { |
|
737 | 737 | unset( $default_settings[ $key ] ); |
738 | 738 | } |
739 | 739 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | foreach ( $passed_post as &$post) { |
73 | 73 | if( ( get_post_type( $post ) === 'gravityview' ) ) { |
74 | 74 | $ids[] = $post->ID; |
75 | - } else{ |
|
75 | + } else { |
|
76 | 76 | // Parse the Post Content |
77 | 77 | $id = $this->parse_post_content( $post->post_content ); |
78 | 78 | if( $id ) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | // Make sure the keys are all set |
53 | 53 | $note = wp_parse_args( $note, $default_note ); |
54 | 54 | |
55 | - GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) ); |
|
55 | + GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function delete_notes( $note_ids = array() ) { |
74 | 74 | |
75 | - if( !is_array( $note_ids ) ) { |
|
75 | + if ( ! is_array( $note_ids ) ) { |
|
76 | 76 | do_action( 'gravityview_log_error', __METHOD__ . ' - Note IDs not an array', $note_ids ); |
77 | 77 | } |
78 | 78 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public static function filter_avatar( $avatar = '', $note ) { |
113 | 113 | |
114 | - if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
115 | - $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
114 | + if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
115 | + $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | return $avatar; |
@@ -20,15 +20,15 @@ |
||
20 | 20 | */ |
21 | 21 | function gravityview_register_gravityview_widgets() { |
22 | 22 | |
23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
24 | 24 | |
25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
28 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
27 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
28 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
29 | 29 | |
30 | - if( class_exists('GFPolls') ) { |
|
31 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
30 | + if ( class_exists( 'GFPolls' ) ) { |
|
31 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | } |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function __construct() { |
23 | 23 | |
24 | - $this->widget_description = __('Displays the results of Poll Fields that exist in the form.', 'gravityview' ); |
|
24 | + $this->widget_description = __( 'Displays the results of Poll Fields that exist in the form.', 'gravityview' ); |
|
25 | 25 | |
26 | - $this->widget_subtitle = sprintf( _x('Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' ); |
|
26 | + $this->widget_subtitle = sprintf( _x( 'Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' ); |
|
27 | 27 | |
28 | 28 | $default_values = array( |
29 | 29 | 'header' => 1, |
@@ -32,32 +32,32 @@ discard block |
||
32 | 32 | |
33 | 33 | $settings = array( |
34 | 34 | 'percentages' => array( |
35 | - 'label' => __('Display Percentages', 'gravityview'), |
|
35 | + 'label' => __( 'Display Percentages', 'gravityview' ), |
|
36 | 36 | 'type' => 'checkbox', |
37 | 37 | 'value' => true, |
38 | 38 | 'tooltip' => __( 'Display results percentages as part of results? Supported values are: true, false. Defaults to "true".', 'gravityview' ), |
39 | 39 | ), |
40 | 40 | 'counts' => array( |
41 | - 'label' => __('Display Counts', 'gravityview'), |
|
41 | + 'label' => __( 'Display Counts', 'gravityview' ), |
|
42 | 42 | 'type' => 'checkbox', |
43 | 43 | 'value' => true, |
44 | 44 | 'tooltip' => __( 'Display number of times each choice has been selected when displaying results? Supported values are: true, false. Defaults to "true".', 'gravityview' ), |
45 | 45 | ), |
46 | 46 | 'style' => array( |
47 | 47 | 'type' => 'select', |
48 | - 'label' => __('Style', 'gravityview'), |
|
48 | + 'label' => __( 'Style', 'gravityview' ), |
|
49 | 49 | 'tooltip' => __( 'The Polls Add-On currently supports 4 built in styles: red, green, orange, blue. Defaults to "green".', 'gravityview' ), |
50 | 50 | 'value' => 'green', |
51 | 51 | 'choices' => array( |
52 | - 'green' => __('Green', 'gravityview'), |
|
53 | - 'blue' => __('Blue', 'gravityview'), |
|
54 | - 'red' => __('Red', 'gravityview'), |
|
55 | - 'orange' => __('Orange', 'gravityview'), |
|
52 | + 'green' => __( 'Green', 'gravityview' ), |
|
53 | + 'blue' => __( 'Blue', 'gravityview' ), |
|
54 | + 'red' => __( 'Red', 'gravityview' ), |
|
55 | + 'orange' => __( 'Orange', 'gravityview' ), |
|
56 | 56 | ) |
57 | 57 | ) |
58 | 58 | ); |
59 | 59 | |
60 | - parent::__construct( __( 'Poll Results', 'gravityview' ) , 'poll', $default_values, $settings ); |
|
60 | + parent::__construct( __( 'Poll Results', 'gravityview' ), 'poll', $default_values, $settings ); |
|
61 | 61 | |
62 | 62 | // frontend - add template path |
63 | 63 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | $GFPolls = GFPolls::get_instance(); |
90 | 90 | |
91 | - wp_enqueue_script('gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array('jquery'), $GFPolls->_version); |
|
91 | + wp_enqueue_script( 'gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array( 'jquery' ), $GFPolls->_version ); |
|
92 | 92 | |
93 | 93 | $GFPolls->localize_scripts(); |
94 | 94 | |
95 | - wp_enqueue_style('gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version); |
|
95 | + wp_enqueue_style( 'gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function pre_render_frontend() { |
104 | 104 | |
105 | - if( !class_exists('GFPolls') ) { |
|
105 | + if ( ! class_exists( 'GFPolls' ) ) { |
|
106 | 106 | |
107 | 107 | $return = false; |
108 | 108 | |
@@ -158,14 +158,14 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @since 1.8 |
160 | 160 | */ |
161 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
161 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
162 | 162 | |
163 | - if( !$this->pre_render_frontend() ) { |
|
163 | + if ( ! $this->pre_render_frontend() ) { |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Make sure the class is loaded in DataTables |
168 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
168 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
169 | 169 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
170 | 170 | } |
171 | 171 | |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | |
174 | 174 | $settings = $this->get_frontend_settings( $widget_args ); |
175 | 175 | |
176 | - $percentages = empty( $settings['percentages'] ) ? 'false' : 'true'; |
|
176 | + $percentages = empty( $settings[ 'percentages' ] ) ? 'false' : 'true'; |
|
177 | 177 | |
178 | - $counts = empty( $settings['counts'] ) ? 'false' : 'true'; |
|
178 | + $counts = empty( $settings[ 'counts' ] ) ? 'false' : 'true'; |
|
179 | 179 | |
180 | - if( !empty( $settings['field'] ) ) { |
|
181 | - $merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings['field'], $settings['style'], $percentages, $counts ); |
|
180 | + if ( ! empty( $settings[ 'field' ] ) ) { |
|
181 | + $merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings[ 'field' ], $settings[ 'style' ], $percentages, $counts ); |
|
182 | 182 | } else { |
183 | - $merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings['style'], $percentages, $counts ); |
|
183 | + $merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings[ 'style' ], $percentages, $counts ); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | $gravityview_view = GravityView_View::getInstance(); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $gravityview_view->poll_settings = $settings; |
191 | 191 | |
192 | - $gravityview_view->render('widget', 'poll', false ); |
|
192 | + $gravityview_view->render( 'widget', 'poll', false ); |
|
193 | 193 | |
194 | 194 | } |
195 | 195 |
@@ -11,10 +11,10 @@ |
||
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div class="gv-search-box"> |
14 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
15 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
15 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
16 | 16 | <?php } ?> |
17 | 17 | <p> |
18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
19 | 19 | </p> |
20 | 20 | </div> |
21 | 21 | \ No newline at end of file |
@@ -7,4 +7,4 @@ |
||
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $search_field = $gravityview_view->search_field; |
10 | -?><div><input type="hidden" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"></div> |
|
11 | 10 | \ No newline at end of file |
11 | +?><div><input type="hidden" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"></div> |
|
12 | 12 | \ No newline at end of file |
@@ -7,14 +7,14 @@ |
||
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $view_id = $gravityview_view->getViewId(); |
10 | -$value = $gravityview_view->search_field['value']; |
|
11 | -$label = $gravityview_view->search_field['label']; |
|
10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
12 | 12 | |
13 | 13 | ?> |
14 | 14 | |
15 | 15 | <div class="gv-search-box"> |
16 | 16 | <div class="gv-search"> |
17 | - <?php if( ! gv_empty( $label, false ) ) { ?> |
|
17 | + <?php if ( ! gv_empty( $label, false ) ) { ?> |
|
18 | 18 | <label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
19 | 19 | <?php } ?> |
20 | 20 | <p><input type="text" name="gv_search" id="gv_search_<?php echo $view_id; ?>" value="<?php echo $value; ?>" /></p> |