@@ -19,9 +19,9 @@ |
||
19 | 19 | * Loop through the array of registered metaboxes |
20 | 20 | * @var GravityView_Metabox_Tab $metabox |
21 | 21 | */ |
22 | - foreach( $metaboxes as $metabox ) { |
|
22 | + foreach ( $metaboxes as $metabox ) { |
|
23 | 23 | |
24 | - echo '<div id="'.esc_attr( $metabox->id ).'">'; |
|
24 | + echo '<div id="' . esc_attr( $metabox->id ) . '">'; |
|
25 | 25 | |
26 | 26 | $metabox->render( $post ); |
27 | 27 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | function render_setting( $override_input = NULL ) { |
17 | 17 | |
18 | - if( $this->get_field_left_label() ) { ?> |
|
18 | + if ( $this->get_field_left_label() ) { ?> |
|
19 | 19 | |
20 | 20 | <td scope="row"> |
21 | 21 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | function render_input( $override_input = NULL ) { |
45 | - if( isset( $override_input ) ) { |
|
45 | + if ( isset( $override_input ) ) { |
|
46 | 46 | echo $override_input; |
47 | 47 | return; |
48 | 48 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | ?> |
9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
10 | 10 | |
11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
12 | 12 | |
13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
14 | 14 | |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | function render_input( $override_input = null ) { |
23 | - if( isset( $override_input ) ) { |
|
23 | + if ( isset( $override_input ) ) { |
|
24 | 24 | echo $override_input; |
25 | 25 | return; |
26 | 26 | } |
27 | 27 | ?> |
28 | 28 | <select name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>"> |
29 | - <?php foreach( $this->field['options'] as $value => $label ) : ?> |
|
29 | + <?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
30 | 30 | <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->value, true ); ?>><?php echo esc_html( $label ); ?></option> |
31 | 31 | <?php endforeach; ?> |
32 | 32 | </select> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_link' ), 10, 5 ); |
12 | 12 | |
13 | 13 | // Add script to enable edit link |
14 | - add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script') ); |
|
14 | + add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script' ) ); |
|
15 | 15 | |
16 | 16 | } |
17 | 17 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function add_edit_script() { |
27 | 27 | |
28 | 28 | // We're on a single entry page, or at least not the Entries page. |
29 | - if( !empty( $_GET['view'] ) && $_GET['view'] !== 'entries' ) { return; } |
|
29 | + if ( ! empty( $_GET[ 'view' ] ) && $_GET[ 'view' ] !== 'entries' ) { return; } |
|
30 | 30 | ?> |
31 | 31 | <script> |
32 | 32 | jQuery( document ).ready( function( $ ) { |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | 'page' => 'gf_entries', |
57 | 57 | 'view' => 'entry', |
58 | 58 | 'id' => (int)$form_id, |
59 | - 'lid' => (int)$lead["id"], |
|
59 | + 'lid' => (int)$lead[ "id" ], |
|
60 | 60 | 'screen_mode' => 'edit', |
61 | 61 | ); |
62 | 62 | ?> |
63 | 63 | |
64 | 64 | <span class="edit edit_entry"> |
65 | 65 | | |
66 | - <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page='.$query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
66 | + <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview' ); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page=' . $query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
67 | 67 | </span> |
68 | 68 | <?php |
69 | 69 | } |
@@ -6,17 +6,17 @@ |
||
6 | 6 | ?><script type="text/javascript"> |
7 | 7 | |
8 | 8 | function DeleteFile(leadId, fieldId, deleteButton){ |
9 | - if(confirm('<?php echo esc_js( __("Would you like to permanently delete this file? 'Cancel' to stop. 'OK' to delete", 'gravityview') ); ?>')){ |
|
9 | + if(confirm('<?php echo esc_js( __( "Would you like to permanently delete this file? 'Cancel' to stop. 'OK' to delete", 'gravityview' ) ); ?>')){ |
|
10 | 10 | var fileIndex = jQuery(deleteButton).parent().index(); |
11 | - var mysack = new sack("<?php echo admin_url("admin-ajax.php")?>"); |
|
11 | + var mysack = new sack("<?php echo admin_url( "admin-ajax.php" )?>"); |
|
12 | 12 | mysack.execute = 1; |
13 | 13 | mysack.method = 'POST'; |
14 | 14 | mysack.setVar( "action", "rg_delete_file" ); |
15 | - mysack.setVar( "rg_delete_file", "<?php echo wp_create_nonce("rg_delete_file") ?>" ); |
|
15 | + mysack.setVar( "rg_delete_file", "<?php echo wp_create_nonce( "rg_delete_file" ) ?>" ); |
|
16 | 16 | mysack.setVar( "lead_id", leadId ); |
17 | 17 | mysack.setVar( "field_id", fieldId ); |
18 | 18 | mysack.setVar( "file_index", fileIndex ); |
19 | - mysack.onError = function() { alert('<?php echo esc_js(__('Ajax error while deleting field.', 'gravityview')) ?>' )}; |
|
19 | + mysack.onError = function() { alert('<?php echo esc_js( __( 'Ajax error while deleting field.', 'gravityview' ) ) ?>' )}; |
|
20 | 20 | mysack.runAJAX(); |
21 | 21 | |
22 | 22 | return true; |
@@ -7,13 +7,13 @@ |
||
7 | 7 | extract( $gravityview_view->getCurrentField() ); |
8 | 8 | |
9 | 9 | // Only show the link to logged-in users. |
10 | -if( !GravityView_Edit_Entry::check_user_cap_edit_entry( $entry ) ) { |
|
10 | +if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $entry ) ) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
14 | -$link_text = empty( $field_settings['edit_link'] ) ? __('Edit Entry', 'gravityview') : $field_settings['edit_link']; |
|
14 | +$link_text = empty( $field_settings[ 'edit_link' ] ) ? __( 'Edit Entry', 'gravityview' ) : $field_settings[ 'edit_link' ]; |
|
15 | 15 | |
16 | -$link_atts = empty( $field_settings['new_window'] ) ? '' : 'target="_blank"'; |
|
16 | +$link_atts = empty( $field_settings[ 'new_window' ] ) ? '' : 'target="_blank"'; |
|
17 | 17 | |
18 | 18 | $output = apply_filters( 'gravityview_entry_link', GravityView_API::replace_variables( $link_text, $form, $entry ) ); |
19 | 19 |
@@ -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 |
@@ -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 | |
@@ -429,7 +429,7 @@ 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 |
@@ -61,28 +61,28 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * When on the Add/Edit View screen, suggest most popular articles related to that |
|
65 | - * |
|
64 | + * When on the Add/Edit View screen, suggest most popular articles related to that |
|
65 | + * |
|
66 | 66 | * @param array $localization_data Data to be passed to the Support Port JS |
67 | 67 | * |
68 | 68 | * @return array |
69 | 69 | */ |
70 | 70 | function suggest_support_articles( $localization_data = array() ) { |
71 | 71 | |
72 | - if( ! gravityview()->request->is_view() ) { |
|
73 | - return $localization_data; |
|
74 | - } |
|
72 | + if( ! gravityview()->request->is_view() ) { |
|
73 | + return $localization_data; |
|
74 | + } |
|
75 | 75 | |
76 | 76 | $localization_data['suggest'] = array( |
77 | - '57ef23539033602e61d4a560', |
|
78 | - '54c67bb9e4b0512429885513', |
|
79 | - '54c67bb9e4b0512429885512', |
|
80 | - '54c67bbbe4b07997ea3f3f6b', |
|
81 | - '54d1a33ae4b086c0c0964ce9', |
|
82 | - '57ef253c9033602e61d4a563', |
|
83 | - '552355bfe4b0221aadf2572b', |
|
84 | - '54c67bcde4b051242988553e', |
|
85 | - ); |
|
77 | + '57ef23539033602e61d4a560', |
|
78 | + '54c67bb9e4b0512429885513', |
|
79 | + '54c67bb9e4b0512429885512', |
|
80 | + '54c67bbbe4b07997ea3f3f6b', |
|
81 | + '54d1a33ae4b086c0c0964ce9', |
|
82 | + '57ef253c9033602e61d4a563', |
|
83 | + '552355bfe4b0221aadf2572b', |
|
84 | + '54c67bcde4b051242988553e', |
|
85 | + ); |
|
86 | 86 | |
87 | 87 | return $localization_data; |
88 | 88 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | if( empty( $connected_views ) ) { |
168 | 168 | |
169 | - $menu_items['gravityview'] = array( |
|
169 | + $menu_items['gravityview'] = array( |
|
170 | 170 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
171 | 171 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
172 | 172 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | // If there were no items added, then let's create the parent menu |
198 | 198 | if( $sub_menu_items ) { |
199 | 199 | |
200 | - $sub_menu_items[] = array( |
|
201 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
202 | - 'link_class' => 'gv-create-view', |
|
203 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
204 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
205 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
206 | - ); |
|
200 | + $sub_menu_items[] = array( |
|
201 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
202 | + 'link_class' => 'gv-create-view', |
|
203 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
204 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
205 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
206 | + ); |
|
207 | 207 | |
208 | 208 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
209 | 209 | $sub_menu_items[] = array( |
@@ -586,12 +586,12 @@ discard block |
||
586 | 586 | * Render html for displaying available fields based on a Form ID |
587 | 587 | * $blacklist_field_types - contains the field types which are not proper to be shown in a directory. |
588 | 588 | * |
589 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
589 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
590 | 590 | * @access public |
591 | - * |
|
591 | + * |
|
592 | 592 | * @param int $form Gravity Forms Form ID (default: '') |
593 | 593 | * @param string $context (default: 'single') |
594 | - * |
|
594 | + * |
|
595 | 595 | * @return void |
596 | 596 | */ |
597 | 597 | function render_available_fields( $form = 0, $context = 'single' ) { |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | |
606 | 606 | if ( ! is_array( $blacklist_field_types ) ) { |
607 | 607 | |
608 | - gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
608 | + gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
609 | 609 | |
610 | 610 | $blacklist_field_types = array(); |
611 | 611 | } |
@@ -736,12 +736,12 @@ discard block |
||
736 | 736 | /** |
737 | 737 | * @since 1.7.2 |
738 | 738 | */ |
739 | - 'other_entries' => array( |
|
740 | - 'label' => __('Other Entries', 'gravityview'), |
|
741 | - 'type' => 'other_entries', |
|
742 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
743 | - ), |
|
744 | - ); |
|
739 | + 'other_entries' => array( |
|
740 | + 'label' => __('Other Entries', 'gravityview'), |
|
741 | + 'type' => 'other_entries', |
|
742 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
743 | + ), |
|
744 | + ); |
|
745 | 745 | |
746 | 746 | if( 'single' !== $zone) { |
747 | 747 | |
@@ -874,9 +874,9 @@ discard block |
||
874 | 874 | |
875 | 875 | $joined_forms = gravityview_get_joined_forms( $post->ID ); |
876 | 876 | |
877 | - foreach ( $joined_forms as $form ) { |
|
878 | - $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
879 | - } |
|
877 | + foreach ( $joined_forms as $form ) { |
|
878 | + $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
879 | + } |
|
880 | 880 | } else { |
881 | 881 | $available_items[ $form ] = $this->get_registered_widgets(); |
882 | 882 | } |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | |
906 | 906 | if ( $form_id ) { |
907 | 907 | $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
908 | - } else { |
|
908 | + } else { |
|
909 | 909 | $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
910 | - } |
|
910 | + } |
|
911 | 911 | |
912 | 912 | if ( !$original_item ) { |
913 | 913 | 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(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
@@ -995,12 +995,12 @@ discard block |
||
995 | 995 | |
996 | 996 | function render_field_and_widget_options() { |
997 | 997 | |
998 | - // render widgets templates |
|
999 | - $widgets = \GV\Widget::registered(); |
|
998 | + // render widgets templates |
|
999 | + $widgets = \GV\Widget::registered(); |
|
1000 | 1000 | |
1001 | - foreach ($widgets as $widget_identifier => $data) { |
|
1002 | - echo GravityView_Render_Settings::render_field_and_widget_options( 'widget', $widget_identifier); |
|
1003 | - } |
|
1001 | + foreach ($widgets as $widget_identifier => $data) { |
|
1002 | + echo GravityView_Render_Settings::render_field_and_widget_options( 'widget', $widget_identifier); |
|
1003 | + } |
|
1004 | 1004 | |
1005 | 1005 | // render fields templates |
1006 | 1006 | $forms = gravityview_get_forms( 'any' ); |
@@ -1018,13 +1018,13 @@ discard block |
||
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | /** |
1021 | - * Renders "Add Field" tooltips |
|
1022 | - * |
|
1023 | - * @since 2.0.11 |
|
1024 | - * |
|
1021 | + * Renders "Add Field" tooltips |
|
1022 | + * |
|
1023 | + * @since 2.0.11 |
|
1024 | + * |
|
1025 | 1025 | * @param string $context "directory", "single", or "edit" |
1026 | - * |
|
1027 | - * @return void |
|
1026 | + * |
|
1027 | + * @return void |
|
1028 | 1028 | */ |
1029 | 1029 | function render_field_pickers( $context = 'directory' ) { |
1030 | 1030 | |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | </div> |
1052 | 1052 | <?php |
1053 | 1053 | } |
1054 | - } |
|
1054 | + } |
|
1055 | 1055 | |
1056 | 1056 | /** |
1057 | 1057 | * Render the Template Active Areas and configured active fields for a given template id and post id |
@@ -1123,59 +1123,59 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | // Don't process any scripts below here if it's not a GravityView page. |
1125 | 1125 | if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
1126 | - return; |
|
1126 | + return; |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1130 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1131 | - |
|
1132 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1133 | - |
|
1134 | - //enqueue scripts |
|
1135 | - 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 ); |
|
1136 | - |
|
1137 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1138 | - 'cookiepath' => COOKIEPATH, |
|
1139 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
1140 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
1141 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
1142 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
1143 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
1144 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
1145 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
1146 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
1147 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
1148 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
1149 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
1150 | - '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' ), |
|
1151 | - )); |
|
1152 | - |
|
1153 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1154 | - |
|
1155 | - // Enqueue scripts needed for merge tags |
|
1156 | - self::enqueue_gravity_forms_scripts(); |
|
1129 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1130 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1131 | + |
|
1132 | + $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1133 | + |
|
1134 | + //enqueue scripts |
|
1135 | + 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 ); |
|
1136 | + |
|
1137 | + wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1138 | + 'cookiepath' => COOKIEPATH, |
|
1139 | + 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
1140 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
1141 | + 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
1142 | + 'label_close' => __( 'Close', 'gravityview' ), |
|
1143 | + 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
1144 | + 'label_continue' => __( 'Continue', 'gravityview' ), |
|
1145 | + 'label_ok' => __( 'Ok', 'gravityview' ), |
|
1146 | + 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
1147 | + 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
1148 | + 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
1149 | + 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
1150 | + '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' ), |
|
1151 | + )); |
|
1152 | + |
|
1153 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1154 | + |
|
1155 | + // Enqueue scripts needed for merge tags |
|
1156 | + self::enqueue_gravity_forms_scripts(); |
|
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | /** |
1160 | 1160 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
1161 | - * |
|
1162 | - * @since 1.0.5-beta |
|
1163 | - * |
|
1164 | - * @return void |
|
1161 | + * |
|
1162 | + * @since 1.0.5-beta |
|
1163 | + * |
|
1164 | + * @return void |
|
1165 | 1165 | */ |
1166 | 1166 | static function enqueue_gravity_forms_scripts() { |
1167 | 1167 | GFForms::register_scripts(); |
1168 | 1168 | |
1169 | 1169 | $scripts = array( |
1170 | - 'sack', |
|
1171 | - 'gform_gravityforms', |
|
1172 | - 'gform_forms', |
|
1173 | - 'gform_form_admin', |
|
1174 | - 'jquery-ui-autocomplete' |
|
1170 | + 'sack', |
|
1171 | + 'gform_gravityforms', |
|
1172 | + 'gform_forms', |
|
1173 | + 'gform_form_admin', |
|
1174 | + 'jquery-ui-autocomplete' |
|
1175 | 1175 | ); |
1176 | 1176 | |
1177 | 1177 | if ( wp_is_mobile() ) { |
1178 | - $scripts[] = 'jquery-touch-punch'; |
|
1178 | + $scripts[] = 'jquery-touch-punch'; |
|
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | wp_enqueue_script( $scripts ); |
@@ -28,29 +28,29 @@ 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_field_pickers', array( $this, 'render_field_pickers') ); |
|
43 | - add_action( 'gravityview_render_field_and_widget_options', array( $this, 'render_field_and_widget_options') ); |
|
44 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
45 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
46 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
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_field_pickers', array( $this, 'render_field_pickers' ) ); |
|
43 | + add_action( 'gravityview_render_field_and_widget_options', array( $this, 'render_field_and_widget_options' ) ); |
|
44 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
45 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
46 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
47 | 47 | |
48 | 48 | // Add Connected Form column |
49 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
49 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
50 | 50 | |
51 | 51 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
52 | 52 | |
53 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
53 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
54 | 54 | |
55 | 55 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
56 | 56 | |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function suggest_support_articles( $localization_data = array() ) { |
71 | 71 | |
72 | - if( ! gravityview()->request->is_view() ) { |
|
72 | + if ( ! gravityview()->request->is_view() ) { |
|
73 | 73 | return $localization_data; |
74 | 74 | } |
75 | 75 | |
76 | - $localization_data['suggest'] = array( |
|
76 | + $localization_data[ 'suggest' ] = array( |
|
77 | 77 | '57ef23539033602e61d4a560', |
78 | 78 | '54c67bb9e4b0512429885513', |
79 | 79 | '54c67bb9e4b0512429885512', |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
95 | 95 | global $pagenow; |
96 | 96 | |
97 | - if ( !is_admin() ) { |
|
97 | + if ( ! is_admin() ) { |
|
98 | 98 | return; |
99 | 99 | } |
100 | 100 | |
101 | - $form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false; |
|
101 | + $form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false; |
|
102 | 102 | |
103 | - if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
103 | + if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
@@ -117,18 +117,18 @@ discard block |
||
117 | 117 | function add_view_dropdown() { |
118 | 118 | $current_screen = get_current_screen(); |
119 | 119 | |
120 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
120 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | |
124 | 124 | $forms = gravityview_get_forms(); |
125 | 125 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
126 | 126 | // If there are no forms to select, show no forms. |
127 | - if( !empty( $forms ) ) { ?> |
|
127 | + if ( ! empty( $forms ) ) { ?> |
|
128 | 128 | <select name="gravityview_form_id" id="gravityview_form_id"> |
129 | 129 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
130 | - <?php foreach( $forms as $form ) { ?> |
|
131 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
130 | + <?php foreach ( $forms as $form ) { ?> |
|
131 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
132 | 132 | <?php } ?> |
133 | 133 | </select> |
134 | 134 | <?php } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
143 | 143 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
144 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
144 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | |
165 | 165 | $connected_views = gravityview_get_connected_views( $id, array( 'post_status' => 'any' ) ); |
166 | 166 | |
167 | - if( empty( $connected_views ) ) { |
|
167 | + if ( empty( $connected_views ) ) { |
|
168 | 168 | |
169 | - $menu_items['gravityview'] = array( |
|
169 | + $menu_items[ 'gravityview' ] = array( |
|
170 | 170 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
171 | 171 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
172 | 172 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -182,22 +182,22 @@ discard block |
||
182 | 182 | $sub_menu_items = array(); |
183 | 183 | foreach ( (array)$connected_views as $view ) { |
184 | 184 | |
185 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
185 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
186 | 186 | continue; |
187 | 187 | } |
188 | 188 | |
189 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
189 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
190 | 190 | |
191 | - $sub_menu_items[] = array( |
|
191 | + $sub_menu_items[ ] = array( |
|
192 | 192 | 'label' => esc_attr( $label ), |
193 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
193 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
194 | 194 | ); |
195 | 195 | } |
196 | 196 | |
197 | 197 | // If there were no items added, then let's create the parent menu |
198 | - if( $sub_menu_items ) { |
|
198 | + if ( $sub_menu_items ) { |
|
199 | 199 | |
200 | - $sub_menu_items[] = array( |
|
200 | + $sub_menu_items[ ] = array( |
|
201 | 201 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
202 | 202 | 'link_class' => 'gv-create-view', |
203 | 203 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | ); |
207 | 207 | |
208 | 208 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
209 | - $sub_menu_items[] = array( |
|
209 | + $sub_menu_items[ ] = array( |
|
210 | 210 | 'url' => '#', |
211 | 211 | 'label' => '', |
212 | 212 | 'menu_class' => 'hidden', |
213 | 213 | 'capabilities' => '', |
214 | 214 | ); |
215 | 215 | |
216 | - $menu_items['gravityview'] = array( |
|
216 | + $menu_items[ 'gravityview' ] = array( |
|
217 | 217 | 'label' => __( 'Connected Views', 'gravityview' ), |
218 | 218 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
219 | 219 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | $add = array( 'captcha', 'page' ); |
243 | 243 | |
244 | 244 | // Don't allowing editing the following values: |
245 | - if( $context === 'edit' ) { |
|
246 | - $add[] = 'post_id'; |
|
245 | + if ( $context === 'edit' ) { |
|
246 | + $add[ ] = 'post_id'; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | $return = array_merge( $array, $add ); |
@@ -266,32 +266,32 @@ discard block |
||
266 | 266 | foreach ( $default_args as $key => $arg ) { |
267 | 267 | |
268 | 268 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
269 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
269 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
270 | 270 | |
271 | 271 | // By default, use `tooltip` if defined. |
272 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
272 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
273 | 273 | |
274 | 274 | // Otherwise, use the description as a tooltip. |
275 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
276 | - $tooltip = $arg['desc']; |
|
275 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
276 | + $tooltip = $arg[ 'desc' ]; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // If there's no tooltip set, continue |
280 | - if( empty( $tooltip ) ) { |
|
280 | + if ( empty( $tooltip ) ) { |
|
281 | 281 | continue; |
282 | 282 | } |
283 | 283 | |
284 | 284 | // Add the tooltip |
285 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
286 | - 'title' => $arg['label'], |
|
285 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
286 | + 'title' => $arg[ 'label' ], |
|
287 | 287 | 'value' => $tooltip, |
288 | 288 | ); |
289 | 289 | |
290 | 290 | } |
291 | 291 | |
292 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
293 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
294 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
292 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
293 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
294 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
295 | 295 | ); |
296 | 296 | |
297 | 297 | /** |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | |
310 | 310 | foreach ( $gv_tooltips as $key => $tooltip ) { |
311 | 311 | |
312 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
312 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
313 | 313 | |
314 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
314 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $tooltips; |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @return void |
327 | 327 | */ |
328 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
328 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
329 | 329 | |
330 | 330 | $output = ''; |
331 | 331 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
348 | 348 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
349 | 349 | |
350 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
350 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
351 | 351 | |
352 | 352 | break; |
353 | 353 | |
@@ -388,44 +388,44 @@ discard block |
||
388 | 388 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
389 | 389 | |
390 | 390 | // Either the form is empty or the form ID is 0, not yet set. |
391 | - if( empty( $form ) ) { |
|
391 | + if ( empty( $form ) ) { |
|
392 | 392 | return ''; |
393 | 393 | } |
394 | 394 | |
395 | 395 | // The $form is passed as the form ID |
396 | - if( !is_array( $form ) ) { |
|
396 | + if ( ! is_array( $form ) ) { |
|
397 | 397 | $form = gravityview_get_form( $form ); |
398 | 398 | } |
399 | 399 | |
400 | - $form_id = $form['id']; |
|
400 | + $form_id = $form[ 'id' ]; |
|
401 | 401 | $links = array(); |
402 | 402 | |
403 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
403 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
404 | 404 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
405 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
406 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
405 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
406 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
407 | 407 | } else { |
408 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
408 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
409 | 409 | } |
410 | 410 | |
411 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
411 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
412 | 412 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
413 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
413 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
414 | 414 | } |
415 | 415 | |
416 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
416 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
417 | 417 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
418 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
418 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
419 | 419 | } |
420 | 420 | |
421 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
421 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
422 | 422 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
423 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
423 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | $output = ''; |
427 | 427 | |
428 | - if( !empty( $include_form_link ) ) { |
|
428 | + if ( ! empty( $include_form_link ) ) { |
|
429 | 429 | $output .= $form_link; |
430 | 430 | } |
431 | 431 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
439 | 439 | |
440 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
440 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
441 | 441 | |
442 | 442 | return $output; |
443 | 443 | } |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | // Get the date column and save it for later to add back in. |
452 | 452 | // This adds it after the Data Source column. |
453 | 453 | // This way, we don't need to do array_slice, array_merge, etc. |
454 | - $date = $columns['date']; |
|
455 | - unset( $columns['date'] ); |
|
454 | + $date = $columns[ 'date' ]; |
|
455 | + unset( $columns[ 'date' ] ); |
|
456 | 456 | |
457 | 457 | $data_source_required_caps = array( |
458 | 458 | 'gravityforms_edit_forms', |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | 'gravityforms_preview_forms', |
464 | 464 | ); |
465 | 465 | |
466 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
467 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
466 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
467 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
468 | 468 | } |
469 | 469 | |
470 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
470 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
471 | 471 | |
472 | 472 | // Add the date back in. |
473 | - $columns['date'] = $date; |
|
473 | + $columns[ 'date' ] = $date; |
|
474 | 474 | |
475 | 475 | return $columns; |
476 | 476 | } |
@@ -484,12 +484,12 @@ discard block |
||
484 | 484 | */ |
485 | 485 | function save_postdata( $post_id ) { |
486 | 486 | |
487 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
487 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
488 | 488 | return; |
489 | 489 | } |
490 | 490 | |
491 | 491 | // validate post_type |
492 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
492 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
493 | 493 | return; |
494 | 494 | } |
495 | 495 | |
@@ -504,63 +504,63 @@ discard block |
||
504 | 504 | $statii = array(); |
505 | 505 | |
506 | 506 | // check if this is a start fresh View |
507 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
507 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
508 | 508 | |
509 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
509 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
510 | 510 | // save form id |
511 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
511 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
512 | 512 | |
513 | 513 | } |
514 | 514 | |
515 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
515 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
516 | 516 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
517 | 517 | return; |
518 | 518 | } |
519 | 519 | |
520 | 520 | // Was this a start fresh? |
521 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
522 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
521 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
522 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
523 | 523 | } else { |
524 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
524 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | // Check if we have a template id |
528 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
528 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
529 | 529 | |
530 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
530 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
531 | 531 | |
532 | 532 | // now save template id |
533 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
533 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
537 | 537 | // save View Configuration metabox |
538 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
538 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
539 | 539 | |
540 | 540 | // template settings |
541 | - if( empty( $_POST['template_settings'] ) ) { |
|
542 | - $_POST['template_settings'] = array(); |
|
541 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
542 | + $_POST[ 'template_settings' ] = array(); |
|
543 | 543 | } |
544 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
544 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
545 | 545 | |
546 | 546 | $fields = array(); |
547 | 547 | |
548 | 548 | // Directory&single Visible Fields |
549 | - if( !empty( $preset_fields ) ) { |
|
549 | + if ( ! empty( $preset_fields ) ) { |
|
550 | 550 | |
551 | 551 | $fields = $preset_fields; |
552 | 552 | |
553 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
553 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
554 | 554 | $fields = _gravityview_process_posted_fields(); |
555 | 555 | } |
556 | 556 | |
557 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
557 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
558 | 558 | |
559 | 559 | // Directory Visible Widgets |
560 | - if( empty( $_POST['widgets'] ) ) { |
|
561 | - $_POST['widgets'] = array(); |
|
560 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
561 | + $_POST[ 'widgets' ] = array(); |
|
562 | 562 | } |
563 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
563 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
564 | 564 | |
565 | 565 | } // end save view configuration |
566 | 566 | |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
571 | 571 | * @since 1.17.2 |
572 | 572 | */ |
573 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
573 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
574 | 574 | |
575 | 575 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
576 | 576 | } |
@@ -613,20 +613,20 @@ discard block |
||
613 | 613 | $fields = $this->get_available_fields( $form, $context ); |
614 | 614 | |
615 | 615 | $output = ''; |
616 | - if( !empty( $fields ) ) { |
|
616 | + if ( ! empty( $fields ) ) { |
|
617 | 617 | |
618 | - foreach( $fields as $id => $details ) { |
|
618 | + foreach ( $fields as $id => $details ) { |
|
619 | 619 | |
620 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
620 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
621 | 621 | continue; |
622 | 622 | } |
623 | 623 | |
624 | 624 | // Edit mode only allows editing the parent fields, not single inputs. |
625 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
625 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
626 | 626 | continue; |
627 | 627 | } |
628 | 628 | |
629 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, $settings = array(), $form ); |
|
629 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, $settings = array(), $form ); |
|
630 | 630 | |
631 | 631 | } // End foreach |
632 | 632 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | echo $output; |
635 | 635 | |
636 | 636 | // For the EDIT view we only want to allow the form fields. |
637 | - if( $context === 'edit' ) { |
|
637 | + if ( $context === 'edit' ) { |
|
638 | 638 | return; |
639 | 639 | } |
640 | 640 | |
@@ -658,16 +658,16 @@ discard block |
||
658 | 658 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
659 | 659 | array( |
660 | 660 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
661 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
661 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
662 | 662 | 'field_id' => 'all-fields', |
663 | 663 | 'label_type' => 'field', |
664 | 664 | 'input_type' => NULL, |
665 | 665 | 'field_options' => NULL, |
666 | 666 | 'settings_html' => NULL, |
667 | 667 | ) |
668 | - )); |
|
668 | + ) ); |
|
669 | 669 | |
670 | - if( !empty( $additional_fields )) { |
|
670 | + if ( ! empty( $additional_fields ) ) { |
|
671 | 671 | foreach ( (array)$additional_fields as $item ) { |
672 | 672 | |
673 | 673 | // Prevent items from not having index set |
@@ -678,16 +678,16 @@ discard block |
||
678 | 678 | 'input_type' => NULL, |
679 | 679 | 'field_options' => NULL, |
680 | 680 | 'settings_html' => NULL, |
681 | - )); |
|
681 | + ) ); |
|
682 | 682 | |
683 | 683 | // Backward compat. |
684 | - if( !empty( $item['field_options'] ) ) { |
|
684 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
685 | 685 | // Use settings_html from now on. |
686 | - $item['settings_html'] = $item['field_options']; |
|
686 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | // Render a label for each of them |
690 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
690 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
691 | 691 | |
692 | 692 | } |
693 | 693 | } |
@@ -700,54 +700,54 @@ discard block |
||
700 | 700 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
701 | 701 | * @return array |
702 | 702 | */ |
703 | - function get_entry_default_fields($form, $zone) { |
|
703 | + function get_entry_default_fields( $form, $zone ) { |
|
704 | 704 | |
705 | 705 | $entry_default_fields = array(); |
706 | 706 | |
707 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
707 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
708 | 708 | |
709 | 709 | $entry_default_fields = array( |
710 | 710 | 'id' => array( |
711 | - 'label' => __('Entry ID', 'gravityview'), |
|
711 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
712 | 712 | 'type' => 'id', |
713 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
713 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
714 | 714 | ), |
715 | 715 | 'date_created' => array( |
716 | - 'label' => __('Entry Date', 'gravityview'), |
|
717 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
716 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
717 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
718 | 718 | 'type' => 'date_created', |
719 | 719 | ), |
720 | 720 | 'source_url' => array( |
721 | - 'label' => __('Source URL', 'gravityview'), |
|
721 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
722 | 722 | 'type' => 'source_url', |
723 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
723 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
724 | 724 | ), |
725 | 725 | 'ip' => array( |
726 | - 'label' => __('User IP', 'gravityview'), |
|
726 | + 'label' => __( 'User IP', 'gravityview' ), |
|
727 | 727 | 'type' => 'ip', |
728 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
728 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
729 | 729 | ), |
730 | 730 | 'created_by' => array( |
731 | - 'label' => __('User', 'gravityview'), |
|
731 | + 'label' => __( 'User', 'gravityview' ), |
|
732 | 732 | 'type' => 'created_by', |
733 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
733 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
734 | 734 | ), |
735 | 735 | |
736 | 736 | /** |
737 | 737 | * @since 1.7.2 |
738 | 738 | */ |
739 | 739 | 'other_entries' => array( |
740 | - 'label' => __('Other Entries', 'gravityview'), |
|
740 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
741 | 741 | 'type' => 'other_entries', |
742 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
742 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
743 | 743 | ), |
744 | 744 | ); |
745 | 745 | |
746 | - if( 'single' !== $zone) { |
|
746 | + if ( 'single' !== $zone ) { |
|
747 | 747 | |
748 | - $entry_default_fields['entry_link'] = array( |
|
749 | - 'label' => __('Link to Entry', 'gravityview'), |
|
750 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
748 | + $entry_default_fields[ 'entry_link' ] = array( |
|
749 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
750 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
751 | 751 | 'type' => 'entry_link', |
752 | 752 | ); |
753 | 753 | } |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | /** |
758 | 758 | * @since 1.2 |
759 | 759 | */ |
760 | - $entry_default_fields['custom'] = array( |
|
761 | - 'label' => __('Custom Content', 'gravityview'), |
|
760 | + $entry_default_fields[ 'custom' ] = array( |
|
761 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
762 | 762 | 'type' => 'custom', |
763 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
763 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
764 | 764 | ); |
765 | 765 | |
766 | 766 | /** |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param string|array $form form_ID or form object |
770 | 770 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
771 | 771 | */ |
772 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
772 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | /** |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | */ |
781 | 781 | function get_available_fields( $form = '', $zone = NULL ) { |
782 | 782 | |
783 | - if( empty( $form ) ) { |
|
783 | + if ( empty( $form ) ) { |
|
784 | 784 | gravityview()->log->error( '$form is empty' ); |
785 | 785 | return array(); |
786 | 786 | } |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $fields = gravityview_get_form_fields( $form, true ); |
790 | 790 | |
791 | 791 | // get meta fields ( only if form was already created ) |
792 | - if( !is_array( $form ) ) { |
|
792 | + if ( ! is_array( $form ) ) { |
|
793 | 793 | $meta_fields = gravityview_get_entry_meta( $form ); |
794 | 794 | } else { |
795 | 795 | $meta_fields = array(); |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | $fields = $fields + $meta_fields + $default_fields; |
803 | 803 | |
804 | 804 | // Move Custom Content to top |
805 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
805 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
806 | 806 | |
807 | 807 | return $fields; |
808 | 808 | } |
@@ -816,11 +816,11 @@ discard block |
||
816 | 816 | |
817 | 817 | $widgets = $this->get_registered_widgets(); |
818 | 818 | |
819 | - if( !empty( $widgets ) ) { |
|
819 | + if ( ! empty( $widgets ) ) { |
|
820 | 820 | |
821 | - foreach( $widgets as $id => $details ) { |
|
821 | + foreach ( $widgets as $id => $details ) { |
|
822 | 822 | |
823 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
823 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
824 | 824 | |
825 | 825 | } |
826 | 826 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
850 | 850 | global $post; |
851 | 851 | |
852 | - if( $type === 'widget' ) { |
|
852 | + if ( $type === 'widget' ) { |
|
853 | 853 | $button_label = __( 'Add Widget', 'gravityview' ); |
854 | 854 | } else { |
855 | 855 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -861,10 +861,10 @@ discard block |
||
861 | 861 | $form_id = null; |
862 | 862 | |
863 | 863 | // if saved values, get available fields to label everyone |
864 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
864 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
865 | 865 | |
866 | - if( !empty( $_POST['template_id'] ) ) { |
|
867 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
866 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
867 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
868 | 868 | } else { |
869 | 869 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
870 | 870 | } |
@@ -881,40 +881,40 @@ discard block |
||
881 | 881 | $available_items[ $form ] = $this->get_registered_widgets(); |
882 | 882 | } |
883 | 883 | } |
884 | - foreach( $rows as $row ) : |
|
885 | - foreach( $row as $col => $areas ) : |
|
886 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
884 | + foreach ( $rows as $row ) : |
|
885 | + foreach ( $row as $col => $areas ) : |
|
886 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
887 | 887 | |
888 | 888 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
889 | 889 | |
890 | - <?php foreach( $areas as $area ) : ?> |
|
890 | + <?php foreach ( $areas as $area ) : ?> |
|
891 | 891 | |
892 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
893 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
892 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
893 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
894 | 894 | |
895 | 895 | <?php // render saved fields |
896 | 896 | |
897 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
897 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
898 | 898 | |
899 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
899 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
900 | 900 | |
901 | 901 | // Maybe has a form ID |
902 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
902 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
903 | 903 | |
904 | 904 | $input_type = NULL; |
905 | 905 | |
906 | 906 | if ( $form_id ) { |
907 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
907 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
908 | 908 | } else { |
909 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
909 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
910 | 910 | } |
911 | 911 | |
912 | - if ( !$original_item ) { |
|
913 | - 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(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
|
912 | + if ( ! $original_item ) { |
|
913 | + 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( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) ); |
|
914 | 914 | |
915 | 915 | $original_item = $field; |
916 | 916 | } else { |
917 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
917 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
918 | 918 | } |
919 | 919 | |
920 | 920 | $item = array( |
@@ -928,23 +928,23 @@ discard block |
||
928 | 928 | $item = wp_parse_args( $item, $original_item ); |
929 | 929 | } |
930 | 930 | |
931 | - switch( $type ) { |
|
931 | + switch ( $type ) { |
|
932 | 932 | case 'widget': |
933 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
933 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
934 | 934 | break; |
935 | 935 | default: |
936 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
936 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | |
940 | 940 | } // End if zone is not empty ?> |
941 | 941 | |
942 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
942 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
943 | 943 | </div> |
944 | 944 | <div class="gv-droppable-area-action"> |
945 | - <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 ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
945 | + <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 ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
946 | 946 | |
947 | - <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> |
|
947 | + <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> |
|
948 | 948 | </div> |
949 | 949 | </div> |
950 | 950 | |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | $default_widget_areas = GravityView_Widget::get_default_widget_areas(); |
967 | 967 | |
968 | 968 | $widgets = array(); |
969 | - if( !empty( $post_id ) ) { |
|
969 | + if ( ! empty( $post_id ) ) { |
|
970 | 970 | $widgets = gravityview_get_directory_widgets( $post_id ); |
971 | 971 | } |
972 | 972 | |
@@ -998,21 +998,21 @@ discard block |
||
998 | 998 | // render widgets templates |
999 | 999 | $widgets = \GV\Widget::registered(); |
1000 | 1000 | |
1001 | - foreach ($widgets as $widget_identifier => $data) { |
|
1002 | - echo GravityView_Render_Settings::render_field_and_widget_options( 'widget', $widget_identifier); |
|
1001 | + foreach ( $widgets as $widget_identifier => $data ) { |
|
1002 | + echo GravityView_Render_Settings::render_field_and_widget_options( 'widget', $widget_identifier ); |
|
1003 | 1003 | } |
1004 | 1004 | |
1005 | 1005 | // render fields templates |
1006 | 1006 | $forms = gravityview_get_forms( 'any' ); |
1007 | 1007 | |
1008 | 1008 | foreach ( $forms as $form ) { |
1009 | - foreach ( $form['fields'] as $field ) { |
|
1010 | - $fields[] = $field['type']; |
|
1009 | + foreach ( $form[ 'fields' ] as $field ) { |
|
1010 | + $fields[ ] = $field[ 'type' ]; |
|
1011 | 1011 | } |
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | foreach ( array_unique( $fields ) as $field_identifier ) { |
1015 | - echo GravityView_Render_Settings::render_field_and_widget_options( 'field', $field_identifier); |
|
1015 | + echo GravityView_Render_Settings::render_field_and_widget_options( 'field', $field_identifier ); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | } |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | // list of available fields to be shown in the popup |
1032 | 1032 | $forms = gravityview_get_forms( 'any' ); |
1033 | 1033 | |
1034 | - $form_ids = array_map( function ($form) { return $form['id']; }, $forms); |
|
1034 | + $form_ids = array_map( function( $form ) { return $form[ 'id' ]; }, $forms ); |
|
1035 | 1035 | |
1036 | 1036 | foreach ( $form_ids as $form_id ) { |
1037 | 1037 | $filter_field_id = sprintf( 'gv-field-filter-%s-%d', $context, $form_id ); |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | </div> |
1045 | 1045 | |
1046 | 1046 | <div id="available-fields-<?php echo $filter_field_id; ?>" aria-live="polite" role="listbox"> |
1047 | - <?php do_action('gravityview_render_available_fields', $form_id, $context ); ?> |
|
1047 | + <?php do_action( 'gravityview_render_available_fields', $form_id, $context ); ?> |
|
1048 | 1048 | </div> |
1049 | 1049 | |
1050 | 1050 | <div class="gv-no-results hidden description"><?php esc_html_e( 'No fields were found matching the search.', 'gravityview' ); ?></div> |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | * @return string HTML of the active areas |
1064 | 1064 | */ |
1065 | 1065 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
1066 | - if( empty( $template_id ) ) { |
|
1066 | + if ( empty( $template_id ) ) { |
|
1067 | 1067 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
1068 | 1068 | return ''; |
1069 | 1069 | } |
@@ -1077,12 +1077,12 @@ discard block |
||
1077 | 1077 | */ |
1078 | 1078 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
1079 | 1079 | |
1080 | - if( empty( $template_areas ) ) { |
|
1080 | + if ( empty( $template_areas ) ) { |
|
1081 | 1081 | |
1082 | 1082 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
1083 | 1083 | $output = '<div>'; |
1084 | - $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>'; |
|
1085 | - $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>'; |
|
1084 | + $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>'; |
|
1085 | + $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>'; |
|
1086 | 1086 | $output .= '</div>'; |
1087 | 1087 | } else { |
1088 | 1088 | |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | } |
1099 | 1099 | |
1100 | - if( $echo ) { |
|
1100 | + if ( $echo ) { |
|
1101 | 1101 | echo $output; |
1102 | 1102 | } |
1103 | 1103 | |
@@ -1117,26 +1117,26 @@ discard block |
||
1117 | 1117 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
1118 | 1118 | |
1119 | 1119 | // Add the GV font (with the Astronaut) |
1120 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
1120 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
1121 | 1121 | |
1122 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1122 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
1123 | 1123 | |
1124 | 1124 | // Don't process any scripts below here if it's not a GravityView page. |
1125 | - if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1125 | + if ( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1126 | 1126 | return; |
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1130 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
1130 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
1131 | 1131 | |
1132 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
1132 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
1133 | 1133 | |
1134 | 1134 | //enqueue scripts |
1135 | 1135 | 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 ); |
1136 | 1136 | |
1137 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1137 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1138 | 1138 | 'cookiepath' => COOKIEPATH, |
1139 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
1139 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
1140 | 1140 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1141 | 1141 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
1142 | 1142 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1148,9 +1148,9 @@ discard block |
||
1148 | 1148 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1149 | 1149 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1150 | 1150 | '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' ), |
1151 | - )); |
|
1151 | + ) ); |
|
1152 | 1152 | |
1153 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1153 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
1154 | 1154 | |
1155 | 1155 | // Enqueue scripts needed for merge tags |
1156 | 1156 | self::enqueue_gravity_forms_scripts(); |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | ); |
1176 | 1176 | |
1177 | 1177 | if ( wp_is_mobile() ) { |
1178 | - $scripts[] = 'jquery-touch-punch'; |
|
1178 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | wp_enqueue_script( $scripts ); |
@@ -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 | } |