@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | - $class .= ' merge-tag-support mt-position-right '; |
|
| 31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 32 | + $class .= ' merge-tag-support mt-position-right '; |
|
| 33 | 33 | |
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 35 | - $class .= ' mt-hide_all_fields '; |
|
| 36 | - } |
|
| 37 | - } |
|
| 34 | + if( empty( $this->field['show_all_fields'] ) ) { |
|
| 35 | + $class .= ' mt-hide_all_fields '; |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | $class .= rgar( $this->field, 'class' ); |
| 40 | 40 | $placeholder = rgar( $this->field, 'placeholder' ); |
@@ -55,20 +55,20 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | function codemirror( $field_id = '' ) { |
| 57 | 57 | |
| 58 | - // Enqueue code editor and settings for manipulating HTML. |
|
| 59 | - $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
|
| 58 | + // Enqueue code editor and settings for manipulating HTML. |
|
| 59 | + $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
|
| 60 | 60 | |
| 61 | - // Bail if user disabled CodeMirror. |
|
| 62 | - if ( false === $settings ) { |
|
| 63 | - return; |
|
| 64 | - } |
|
| 61 | + // Bail if user disabled CodeMirror. |
|
| 62 | + if ( false === $settings ) { |
|
| 63 | + return; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - ?> |
|
| 66 | + ?> |
|
| 67 | 67 | |
| 68 | 68 | <script> |
| 69 | 69 | wp.codeEditor.initialize( "<?php echo $field_id;?>", {}); |
| 70 | 70 | </script> |
| 71 | 71 | <?php |
| 72 | - } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | ?> |
| 10 | 10 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 11 | 11 | |
| 12 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 12 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 14 | 14 | ?><div> |
| 15 | 15 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | function render_input( $override_input = null ) { |
| 22 | - if( isset( $override_input ) ) { |
|
| 22 | + if ( isset( $override_input ) ) { |
|
| 23 | 23 | echo $override_input; |
| 24 | 24 | return; |
| 25 | 25 | } |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
| 32 | 32 | $class .= ' merge-tag-support mt-position-right '; |
| 33 | 33 | |
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 34 | + if ( empty( $this->field[ 'show_all_fields' ] ) ) { |
|
| 35 | 35 | $class .= ' mt-hide_all_fields '; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | # $this->codemirror( $this->get_field_id() ); |
| 50 | 50 | |
| 51 | 51 | ?> |
| 52 | - <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 52 | + <textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 53 | 53 | <?php |
| 54 | 54 | } |
| 55 | 55 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | ?> |
| 67 | 67 | |
| 68 | 68 | <script> |
| 69 | - wp.codeEditor.initialize( "<?php echo $field_id;?>", {}); |
|
| 69 | + wp.codeEditor.initialize( "<?php echo $field_id; ?>", {}); |
|
| 70 | 70 | </script> |
| 71 | 71 | <?php |
| 72 | 72 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | // Enqueue code editor and settings for manipulating HTML. |
| 47 | 47 | add_action('admin_enqueue_scripts', function() { |
| 48 | 48 | |
| 49 | - $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
|
| 49 | + $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
|
| 50 | 50 | }); |
| 51 | 51 | |
| 52 | 52 | // @todo check if this hook is needed.. |
@@ -68,28 +68,28 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | - * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 72 | - * |
|
| 71 | + * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 72 | + * |
|
| 73 | 73 | * @param array $localization_data Data to be passed to the Support Port JS |
| 74 | 74 | * |
| 75 | 75 | * @return array |
| 76 | 76 | */ |
| 77 | 77 | function suggest_support_articles( $localization_data = array() ) { |
| 78 | 78 | |
| 79 | - if( ! gravityview()->request->is_view() ) { |
|
| 80 | - return $localization_data; |
|
| 81 | - } |
|
| 79 | + if( ! gravityview()->request->is_view() ) { |
|
| 80 | + return $localization_data; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | $localization_data['suggest'] = array( |
| 84 | - '57ef23539033602e61d4a560', |
|
| 85 | - '54c67bb9e4b0512429885513', |
|
| 86 | - '54c67bb9e4b0512429885512', |
|
| 87 | - '54c67bbbe4b07997ea3f3f6b', |
|
| 88 | - '54d1a33ae4b086c0c0964ce9', |
|
| 89 | - '57ef253c9033602e61d4a563', |
|
| 90 | - '552355bfe4b0221aadf2572b', |
|
| 91 | - '54c67bcde4b051242988553e', |
|
| 92 | - ); |
|
| 84 | + '57ef23539033602e61d4a560', |
|
| 85 | + '54c67bb9e4b0512429885513', |
|
| 86 | + '54c67bb9e4b0512429885512', |
|
| 87 | + '54c67bbbe4b07997ea3f3f6b', |
|
| 88 | + '54d1a33ae4b086c0c0964ce9', |
|
| 89 | + '57ef253c9033602e61d4a563', |
|
| 90 | + '552355bfe4b0221aadf2572b', |
|
| 91 | + '54c67bcde4b051242988553e', |
|
| 92 | + ); |
|
| 93 | 93 | |
| 94 | 94 | return $localization_data; |
| 95 | 95 | } |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | if( 'form_list' === GFForms::get_page() ) { |
| 182 | 182 | $priority = 790; |
| 183 | - } |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | if( empty( $connected_views ) ) { |
| 186 | 186 | |
| 187 | - $menu_items['gravityview'] = array( |
|
| 187 | + $menu_items['gravityview'] = array( |
|
| 188 | 188 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 189 | 189 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 190 | 190 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -215,14 +215,14 @@ discard block |
||
| 215 | 215 | // If there were no items added, then let's create the parent menu |
| 216 | 216 | if( $sub_menu_items ) { |
| 217 | 217 | |
| 218 | - $sub_menu_items[] = array( |
|
| 219 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 220 | - 'link_class' => 'gv-create-view', |
|
| 221 | - 'icon' => '<i> + </i>', |
|
| 222 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 223 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 224 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
| 225 | - ); |
|
| 218 | + $sub_menu_items[] = array( |
|
| 219 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 220 | + 'link_class' => 'gv-create-view', |
|
| 221 | + 'icon' => '<i> + </i>', |
|
| 222 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 223 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 224 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
| 225 | + ); |
|
| 226 | 226 | |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -625,16 +625,16 @@ discard block |
||
| 625 | 625 | /** |
| 626 | 626 | * Render html for displaying available fields based on a Form ID |
| 627 | 627 | * |
| 628 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 628 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 629 | 629 | * |
| 630 | 630 | * @param int $form Gravity Forms Form ID (default: '') |
| 631 | 631 | * @param string $context (default: 'single') |
| 632 | - * |
|
| 632 | + * |
|
| 633 | 633 | * @return void |
| 634 | 634 | */ |
| 635 | 635 | function render_available_fields( $form = 0, $context = 'single' ) { |
| 636 | 636 | |
| 637 | - // Determine if form is a preset and convert it to an array with fields |
|
| 637 | + // Determine if form is a preset and convert it to an array with fields |
|
| 638 | 638 | $form = ( is_string( $form ) && preg_match( '/^preset_/', $form ) ) ? GravityView_Ajax::pre_get_form_fields( $form ) : $form; |
| 639 | 639 | |
| 640 | 640 | /** |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | |
| 647 | 647 | if ( ! is_array( $blacklist_field_types ) ) { |
| 648 | 648 | |
| 649 | - gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
| 649 | + gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
| 650 | 650 | |
| 651 | 651 | $blacklist_field_types = array(); |
| 652 | 652 | } |
@@ -784,12 +784,12 @@ discard block |
||
| 784 | 784 | /** |
| 785 | 785 | * @since 1.7.2 |
| 786 | 786 | */ |
| 787 | - 'other_entries' => array( |
|
| 788 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 789 | - 'type' => 'other_entries', |
|
| 790 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 791 | - ), |
|
| 792 | - ); |
|
| 787 | + 'other_entries' => array( |
|
| 788 | + 'label' => __('Other Entries', 'gravityview'), |
|
| 789 | + 'type' => 'other_entries', |
|
| 790 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 791 | + ), |
|
| 792 | + ); |
|
| 793 | 793 | |
| 794 | 794 | if( 'single' !== $zone) { |
| 795 | 795 | |
@@ -961,9 +961,9 @@ discard block |
||
| 961 | 961 | |
| 962 | 962 | $joined_forms = gravityview_get_joined_forms( $post->ID ); |
| 963 | 963 | |
| 964 | - foreach ( $joined_forms as $form ) { |
|
| 965 | - $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 966 | - } |
|
| 964 | + foreach ( $joined_forms as $form ) { |
|
| 965 | + $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 966 | + } |
|
| 967 | 967 | } else { |
| 968 | 968 | $available_items[ $form ] = \GV\Widget::registered(); |
| 969 | 969 | } |
@@ -991,9 +991,9 @@ discard block |
||
| 991 | 991 | |
| 992 | 992 | if ( $form_id ) { |
| 993 | 993 | $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
| 994 | - } else { |
|
| 994 | + } else { |
|
| 995 | 995 | $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
| 996 | - } |
|
| 996 | + } |
|
| 997 | 997 | |
| 998 | 998 | if ( !$original_item ) { |
| 999 | 999 | 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 ) ) ); |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | |
| 1046 | 1046 | /** |
| 1047 | 1047 | * Render the widget active areas |
| 1048 | - * @param string $template_id The current slug of the selected View template |
|
| 1048 | + * @param string $template_id The current slug of the selected View template |
|
| 1049 | 1049 | * @param string $zone Either 'header' or 'footer' |
| 1050 | 1050 | * @param string $post_id Current Post ID (view) |
| 1051 | 1051 | * @return string html |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | // Add the GV font (with the Astronaut) |
| 1239 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1239 | + wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1240 | 1240 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1241 | 1241 | |
| 1242 | 1242 | wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
@@ -1244,64 +1244,64 @@ discard block |
||
| 1244 | 1244 | if( GFForms::get_page() === 'form_list' ) { |
| 1245 | 1245 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1246 | 1246 | return; |
| 1247 | - } |
|
| 1247 | + } |
|
| 1248 | 1248 | |
| 1249 | 1249 | // Don't process any scripts below here if it's not a GravityView page. |
| 1250 | 1250 | if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
| 1251 | - return; |
|
| 1251 | + return; |
|
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1255 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1256 | - |
|
| 1257 | - // Enqueue scripts |
|
| 1258 | - wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
|
| 1259 | - |
|
| 1260 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1261 | - 'cookiepath' => COOKIEPATH, |
|
| 1262 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1263 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1264 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1265 | - 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
|
| 1266 | - 'label_add_search_field' => __( 'Add Search Field', 'gravityview' ), |
|
| 1267 | - 'label_remove_search_field' => __( 'Remove Search Field', 'gravityview' ), |
|
| 1268 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1269 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1270 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1271 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1272 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1273 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1274 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1275 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1276 | - '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' ), |
|
| 1277 | - )); |
|
| 1254 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1255 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1256 | + |
|
| 1257 | + // Enqueue scripts |
|
| 1258 | + wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
|
| 1259 | + |
|
| 1260 | + wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1261 | + 'cookiepath' => COOKIEPATH, |
|
| 1262 | + 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1263 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1264 | + 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1265 | + 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
|
| 1266 | + 'label_add_search_field' => __( 'Add Search Field', 'gravityview' ), |
|
| 1267 | + 'label_remove_search_field' => __( 'Remove Search Field', 'gravityview' ), |
|
| 1268 | + 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1269 | + 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1270 | + 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1271 | + 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1272 | + 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1273 | + 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1274 | + 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1275 | + 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1276 | + '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' ), |
|
| 1277 | + )); |
|
| 1278 | 1278 | |
| 1279 | 1279 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1280 | 1280 | |
| 1281 | - // Enqueue scripts needed for merge tags |
|
| 1282 | - self::enqueue_gravity_forms_scripts(); |
|
| 1281 | + // Enqueue scripts needed for merge tags |
|
| 1282 | + self::enqueue_gravity_forms_scripts(); |
|
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | 1285 | /** |
| 1286 | 1286 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
| 1287 | - * |
|
| 1288 | - * @since 1.0.5-beta |
|
| 1289 | - * |
|
| 1290 | - * @return void |
|
| 1287 | + * |
|
| 1288 | + * @since 1.0.5-beta |
|
| 1289 | + * |
|
| 1290 | + * @return void |
|
| 1291 | 1291 | */ |
| 1292 | 1292 | static function enqueue_gravity_forms_scripts() { |
| 1293 | 1293 | GFForms::register_scripts(); |
| 1294 | 1294 | |
| 1295 | 1295 | $scripts = array( |
| 1296 | - 'sack', |
|
| 1297 | - 'gform_gravityforms', |
|
| 1298 | - 'gform_forms', |
|
| 1299 | - 'gform_form_admin', |
|
| 1300 | - 'jquery-ui-autocomplete' |
|
| 1296 | + 'sack', |
|
| 1297 | + 'gform_gravityforms', |
|
| 1298 | + 'gform_forms', |
|
| 1299 | + 'gform_form_admin', |
|
| 1300 | + 'jquery-ui-autocomplete' |
|
| 1301 | 1301 | ); |
| 1302 | 1302 | |
| 1303 | 1303 | if ( wp_is_mobile() ) { |
| 1304 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1304 | + $scripts[] = 'jquery-touch-punch'; |
|
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | wp_enqueue_script( $scripts ); |
@@ -27,24 +27,24 @@ discard block |
||
| 27 | 27 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 28 | 28 | |
| 29 | 29 | // Tooltips |
| 30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 31 | 31 | |
| 32 | 32 | // adding styles and scripts |
| 33 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 34 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 35 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 38 | - |
|
| 39 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 40 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 41 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 ); |
|
| 42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 33 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 34 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 35 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + |
|
| 39 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 40 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 41 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 ); |
|
| 42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 45 | 45 | |
| 46 | 46 | // Enqueue code editor and settings for manipulating HTML. |
| 47 | - add_action('admin_enqueue_scripts', function() { |
|
| 47 | + add_action( 'admin_enqueue_scripts', function() { |
|
| 48 | 48 | |
| 49 | 49 | $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
| 50 | 50 | }); |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 54 | 54 | |
| 55 | 55 | // Add Connected Form column |
| 56 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 56 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 57 | 57 | |
| 58 | 58 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 59 | 59 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 60 | 60 | |
| 61 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 61 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 62 | 62 | |
| 63 | 63 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 64 | 64 | |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | function suggest_support_articles( $localization_data = array() ) { |
| 78 | 78 | |
| 79 | - if( ! gravityview()->request->is_view() ) { |
|
| 79 | + if ( ! gravityview()->request->is_view() ) { |
|
| 80 | 80 | return $localization_data; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $localization_data['suggest'] = array( |
|
| 83 | + $localization_data[ 'suggest' ] = array( |
|
| 84 | 84 | '57ef23539033602e61d4a560', |
| 85 | 85 | '54c67bb9e4b0512429885513', |
| 86 | 86 | '54c67bb9e4b0512429885512', |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 102 | 102 | global $pagenow; |
| 103 | 103 | |
| 104 | - if ( !is_admin() ) { |
|
| 104 | + if ( ! is_admin() ) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false; |
|
| 108 | + $form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false; |
|
| 109 | 109 | |
| 110 | - if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 110 | + if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -124,18 +124,18 @@ discard block |
||
| 124 | 124 | function add_view_dropdown() { |
| 125 | 125 | $current_screen = get_current_screen(); |
| 126 | 126 | |
| 127 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 127 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 128 | 128 | return; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $forms = gravityview_get_forms(); |
| 132 | 132 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
| 133 | 133 | // If there are no forms to select, show no forms. |
| 134 | - if( !empty( $forms ) ) { ?> |
|
| 134 | + if ( ! empty( $forms ) ) { ?> |
|
| 135 | 135 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 136 | 136 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 137 | - <?php foreach( $forms as $form ) { ?> |
|
| 138 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 137 | + <?php foreach ( $forms as $form ) { ?> |
|
| 138 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 139 | 139 | <?php } ?> |
| 140 | 140 | </select> |
| 141 | 141 | <?php } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 150 | 150 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 151 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 151 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | public static function gform_toolbar_menu( $menu_items = array(), $id = NULL ) { |
| 171 | 171 | |
| 172 | 172 | // Don't show on Trashed forms |
| 173 | - if( 'trash' === rgget( 'filter') ) { |
|
| 173 | + if ( 'trash' === rgget( 'filter' ) ) { |
|
| 174 | 174 | return $menu_items; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -178,13 +178,13 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $priority = 0; |
| 180 | 180 | |
| 181 | - if( 'form_list' === GFForms::get_page() ) { |
|
| 181 | + if ( 'form_list' === GFForms::get_page() ) { |
|
| 182 | 182 | $priority = 790; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if( empty( $connected_views ) ) { |
|
| 185 | + if ( empty( $connected_views ) ) { |
|
| 186 | 186 | |
| 187 | - $menu_items['gravityview'] = array( |
|
| 187 | + $menu_items[ 'gravityview' ] = array( |
|
| 188 | 188 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 189 | 189 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 190 | 190 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -200,22 +200,22 @@ discard block |
||
| 200 | 200 | $sub_menu_items = array(); |
| 201 | 201 | foreach ( (array)$connected_views as $view ) { |
| 202 | 202 | |
| 203 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 203 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 204 | 204 | continue; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 207 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 208 | 208 | |
| 209 | - $sub_menu_items[] = array( |
|
| 209 | + $sub_menu_items[ ] = array( |
|
| 210 | 210 | 'label' => esc_attr( $label ), |
| 211 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 211 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 212 | 212 | ); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | // If there were no items added, then let's create the parent menu |
| 216 | - if( $sub_menu_items ) { |
|
| 216 | + if ( $sub_menu_items ) { |
|
| 217 | 217 | |
| 218 | - $sub_menu_items[] = array( |
|
| 218 | + $sub_menu_items[ ] = array( |
|
| 219 | 219 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 220 | 220 | 'link_class' => 'gv-create-view', |
| 221 | 221 | 'icon' => '<i> + </i>', |
@@ -231,14 +231,14 @@ discard block |
||
| 231 | 231 | if ( ! ( 'gf_edit_forms' === rgget( 'page' ) && '' === rgget( 'view' ) ) || version_compare( '2.5-beta', GFForms::$version, '>' ) ) { |
| 232 | 232 | |
| 233 | 233 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 234 | - $sub_menu_items[] = array( |
|
| 234 | + $sub_menu_items[ ] = array( |
|
| 235 | 235 | 'url' => '#', |
| 236 | 236 | 'label' => '', |
| 237 | 237 | 'menu_class' => 'hidden', |
| 238 | 238 | 'capabilities' => '', |
| 239 | 239 | ); |
| 240 | 240 | |
| 241 | - $menu_items['gravityview'] = array( |
|
| 241 | + $menu_items[ 'gravityview' ] = array( |
|
| 242 | 242 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 243 | 243 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 244 | 244 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | } else { |
| 254 | 254 | |
| 255 | - $menu_items[ 'gravityview'] = array( |
|
| 255 | + $menu_items[ 'gravityview' ] = array( |
|
| 256 | 256 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 257 | 257 | 'url' => '#gravityview-group-heading', |
| 258 | 258 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | $add = array( 'captcha', 'page' ); |
| 289 | 289 | |
| 290 | 290 | // Don't allowing editing the following values: |
| 291 | - if( $context === 'edit' ) { |
|
| 292 | - $add[] = 'post_id'; |
|
| 291 | + if ( $context === 'edit' ) { |
|
| 292 | + $add[ ] = 'post_id'; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | $return = array_merge( $array, $add ); |
@@ -312,27 +312,27 @@ discard block |
||
| 312 | 312 | foreach ( $default_args as $key => $arg ) { |
| 313 | 313 | |
| 314 | 314 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 315 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 315 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 316 | 316 | |
| 317 | 317 | // By default, use `tooltip` if defined. |
| 318 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 318 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 319 | 319 | |
| 320 | 320 | // If there's no tooltip set, continue |
| 321 | - if( empty( $tooltip ) ) { |
|
| 321 | + if ( empty( $tooltip ) ) { |
|
| 322 | 322 | continue; |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // Add the tooltip |
| 326 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 327 | - 'title' => $arg['label'], |
|
| 326 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 327 | + 'title' => $arg[ 'label' ], |
|
| 328 | 328 | 'value' => $tooltip, |
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 334 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 335 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 333 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 334 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 335 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 336 | 336 | ); |
| 337 | 337 | |
| 338 | 338 | /** |
@@ -350,9 +350,9 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 352 | 352 | |
| 353 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 353 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 354 | 354 | |
| 355 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 355 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | return $tooltips; |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | * |
| 367 | 367 | * @return void |
| 368 | 368 | */ |
| 369 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 369 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 370 | 370 | |
| 371 | 371 | $output = ''; |
| 372 | 372 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 389 | 389 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 390 | 390 | |
| 391 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 391 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 392 | 392 | |
| 393 | 393 | break; |
| 394 | 394 | |
@@ -429,44 +429,44 @@ discard block |
||
| 429 | 429 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 430 | 430 | |
| 431 | 431 | // Either the form is empty or the form ID is 0, not yet set. |
| 432 | - if( empty( $form ) ) { |
|
| 432 | + if ( empty( $form ) ) { |
|
| 433 | 433 | return ''; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | // The $form is passed as the form ID |
| 437 | - if( !is_array( $form ) ) { |
|
| 437 | + if ( ! is_array( $form ) ) { |
|
| 438 | 438 | $form = gravityview_get_form( $form ); |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | - $form_id = $form['id']; |
|
| 441 | + $form_id = $form[ 'id' ]; |
|
| 442 | 442 | $links = array(); |
| 443 | 443 | |
| 444 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 444 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 445 | 445 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 446 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 447 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 446 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 447 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 448 | 448 | } else { |
| 449 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 449 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 452 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 453 | 453 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 454 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 454 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 457 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 458 | 458 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 459 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 459 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 462 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 463 | 463 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 464 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 464 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | $output = ''; |
| 468 | 468 | |
| 469 | - if( !empty( $include_form_link ) ) { |
|
| 469 | + if ( ! empty( $include_form_link ) ) { |
|
| 470 | 470 | $output .= $form_link; |
| 471 | 471 | } |
| 472 | 472 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 480 | 480 | |
| 481 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 481 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 482 | 482 | |
| 483 | 483 | return $output; |
| 484 | 484 | } |
@@ -492,8 +492,8 @@ discard block |
||
| 492 | 492 | // Get the date column and save it for later to add back in. |
| 493 | 493 | // This adds it after the Data Source column. |
| 494 | 494 | // This way, we don't need to do array_slice, array_merge, etc. |
| 495 | - $date = $columns['date']; |
|
| 496 | - unset( $columns['date'] ); |
|
| 495 | + $date = $columns[ 'date' ]; |
|
| 496 | + unset( $columns[ 'date' ] ); |
|
| 497 | 497 | |
| 498 | 498 | $data_source_required_caps = array( |
| 499 | 499 | 'gravityforms_edit_forms', |
@@ -504,14 +504,14 @@ discard block |
||
| 504 | 504 | 'gravityforms_preview_forms', |
| 505 | 505 | ); |
| 506 | 506 | |
| 507 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 508 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 507 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 508 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 511 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 512 | 512 | |
| 513 | 513 | // Add the date back in. |
| 514 | - $columns['date'] = $date; |
|
| 514 | + $columns[ 'date' ] = $date; |
|
| 515 | 515 | |
| 516 | 516 | return $columns; |
| 517 | 517 | } |
@@ -524,12 +524,12 @@ discard block |
||
| 524 | 524 | */ |
| 525 | 525 | function save_postdata( $post_id ) { |
| 526 | 526 | |
| 527 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 527 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 528 | 528 | return; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | // validate post_type |
| 532 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 532 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 533 | 533 | return; |
| 534 | 534 | } |
| 535 | 535 | |
@@ -544,63 +544,63 @@ discard block |
||
| 544 | 544 | $statii = array(); |
| 545 | 545 | |
| 546 | 546 | // check if this is a start fresh View |
| 547 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 547 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 548 | 548 | |
| 549 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 549 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 550 | 550 | // save form id |
| 551 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 551 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 555 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 556 | 556 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
| 557 | 557 | return; |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | // Was this a start fresh? |
| 561 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 562 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 561 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 562 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 563 | 563 | } else { |
| 564 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 564 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | // Check if we have a template id |
| 568 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 568 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 569 | 569 | |
| 570 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 570 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 571 | 571 | |
| 572 | 572 | // now save template id |
| 573 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 573 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | |
| 577 | 577 | // save View Configuration metabox |
| 578 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 578 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 579 | 579 | |
| 580 | 580 | // template settings |
| 581 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 582 | - $_POST['template_settings'] = array(); |
|
| 581 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 582 | + $_POST[ 'template_settings' ] = array(); |
|
| 583 | 583 | } |
| 584 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 584 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 585 | 585 | |
| 586 | 586 | // guard against unloaded View configuration page |
| 587 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
| 587 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
| 588 | 588 | $fields = array(); |
| 589 | 589 | |
| 590 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
| 590 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 591 | 591 | $fields = _gravityview_process_posted_fields(); |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | $fields = wp_slash( $fields ); |
| 595 | 595 | |
| 596 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 596 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | // Directory Visible Widgets |
| 600 | - if( empty( $_POST['widgets'] ) ) { |
|
| 601 | - $_POST['widgets'] = array(); |
|
| 600 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 601 | + $_POST[ 'widgets' ] = array(); |
|
| 602 | 602 | } |
| 603 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
| 603 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
| 604 | 604 | |
| 605 | 605 | } // end save view configuration |
| 606 | 606 | |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | * @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. |
| 611 | 611 | * @since 1.17.2 |
| 612 | 612 | */ |
| 613 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 613 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 614 | 614 | |
| 615 | 615 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
| 616 | 616 | } |
@@ -655,20 +655,20 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | $output = ''; |
| 657 | 657 | |
| 658 | - if( !empty( $fields ) ) { |
|
| 658 | + if ( ! empty( $fields ) ) { |
|
| 659 | 659 | |
| 660 | - foreach( $fields as $id => $details ) { |
|
| 660 | + foreach ( $fields as $id => $details ) { |
|
| 661 | 661 | |
| 662 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
| 662 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
| 663 | 663 | continue; |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | // Edit mode only allows editing the parent fields, not single inputs. |
| 667 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
| 667 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 668 | 668 | continue; |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form ); |
|
| 671 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form ); |
|
| 672 | 672 | |
| 673 | 673 | } // End foreach |
| 674 | 674 | } |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | echo $output; |
| 677 | 677 | |
| 678 | 678 | // For the EDIT view we only want to allow the form fields. |
| 679 | - if( $context === 'edit' ) { |
|
| 679 | + if ( $context === 'edit' ) { |
|
| 680 | 680 | return; |
| 681 | 681 | } |
| 682 | 682 | |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | $additional_fields = array( |
| 696 | 696 | array( |
| 697 | 697 | 'label_text' => '+ ' . __( 'Add All Form Fields', 'gravityview' ), |
| 698 | - 'desc' => __('Insert all the form fields at once.', 'gravityview'), |
|
| 698 | + 'desc' => __( 'Insert all the form fields at once.', 'gravityview' ), |
|
| 699 | 699 | 'field_id' => 'all-fields', |
| 700 | 700 | 'label_type' => 'field', |
| 701 | 701 | 'input_type' => null, |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | */ |
| 712 | 712 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
| 713 | 713 | |
| 714 | - foreach ( (array) $additional_fields as $item ) { |
|
| 714 | + foreach ( (array)$additional_fields as $item ) { |
|
| 715 | 715 | |
| 716 | 716 | // Prevent items from not having index set |
| 717 | 717 | $item = wp_parse_args( $item, array( |
@@ -722,16 +722,16 @@ discard block |
||
| 722 | 722 | 'field_options' => null, |
| 723 | 723 | 'settings_html' => null, |
| 724 | 724 | 'icon' => null, |
| 725 | - )); |
|
| 725 | + ) ); |
|
| 726 | 726 | |
| 727 | 727 | // Backward compat. |
| 728 | - if( !empty( $item['field_options'] ) ) { |
|
| 728 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 729 | 729 | // Use settings_html from now on. |
| 730 | - $item['settings_html'] = $item['field_options']; |
|
| 730 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | // Render a label for each of them |
| 734 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
| 734 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
| 735 | 735 | |
| 736 | 736 | } |
| 737 | 737 | |
@@ -743,59 +743,59 @@ discard block |
||
| 743 | 743 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 744 | 744 | * @return array |
| 745 | 745 | */ |
| 746 | - function get_entry_default_fields($form, $zone) { |
|
| 746 | + function get_entry_default_fields( $form, $zone ) { |
|
| 747 | 747 | |
| 748 | 748 | $entry_default_fields = array(); |
| 749 | 749 | |
| 750 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 750 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 751 | 751 | |
| 752 | 752 | $entry_default_fields = array( |
| 753 | 753 | 'id' => array( |
| 754 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 754 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 755 | 755 | 'type' => 'id', |
| 756 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 756 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 757 | 757 | ), |
| 758 | 758 | 'date_created' => array( |
| 759 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 760 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 759 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 760 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 761 | 761 | 'type' => 'date_created', |
| 762 | 762 | ), |
| 763 | 763 | 'date_updated' => array( |
| 764 | - 'label' => __( 'Date Updated', 'gravityview'), |
|
| 765 | - 'desc' => __('The date the entry was last updated.', 'gravityview'), |
|
| 764 | + 'label' => __( 'Date Updated', 'gravityview' ), |
|
| 765 | + 'desc' => __( 'The date the entry was last updated.', 'gravityview' ), |
|
| 766 | 766 | 'type' => 'date_updated', |
| 767 | 767 | ), |
| 768 | 768 | 'source_url' => array( |
| 769 | - 'label' => __('Source URL', 'gravityview'), |
|
| 769 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 770 | 770 | 'type' => 'source_url', |
| 771 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 771 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 772 | 772 | ), |
| 773 | 773 | 'ip' => array( |
| 774 | - 'label' => __('User IP', 'gravityview'), |
|
| 774 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 775 | 775 | 'type' => 'ip', |
| 776 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 776 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 777 | 777 | ), |
| 778 | 778 | 'created_by' => array( |
| 779 | - 'label' => __('User', 'gravityview'), |
|
| 779 | + 'label' => __( 'User', 'gravityview' ), |
|
| 780 | 780 | 'type' => 'created_by', |
| 781 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 781 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 782 | 782 | ), |
| 783 | 783 | |
| 784 | 784 | /** |
| 785 | 785 | * @since 1.7.2 |
| 786 | 786 | */ |
| 787 | 787 | 'other_entries' => array( |
| 788 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 788 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 789 | 789 | 'type' => 'other_entries', |
| 790 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 790 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 791 | 791 | ), |
| 792 | 792 | ); |
| 793 | 793 | |
| 794 | - if( 'single' !== $zone) { |
|
| 794 | + if ( 'single' !== $zone ) { |
|
| 795 | 795 | |
| 796 | - $entry_default_fields['entry_link'] = array( |
|
| 797 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 798 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 796 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 797 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 798 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 799 | 799 | 'type' => 'entry_link', |
| 800 | 800 | ); |
| 801 | 801 | } |
@@ -805,19 +805,19 @@ discard block |
||
| 805 | 805 | /** |
| 806 | 806 | * @since 1.2 |
| 807 | 807 | */ |
| 808 | - $entry_default_fields['custom'] = array( |
|
| 809 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 808 | + $entry_default_fields[ 'custom' ] = array( |
|
| 809 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 810 | 810 | 'type' => 'custom', |
| 811 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 811 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 812 | 812 | ); |
| 813 | 813 | |
| 814 | 814 | /** |
| 815 | 815 | * @since develop |
| 816 | 816 | */ |
| 817 | - $entry_default_fields['sequence'] = array( |
|
| 818 | - 'label' => __('Result Number', 'gravityview'), |
|
| 817 | + $entry_default_fields[ 'sequence' ] = array( |
|
| 818 | + 'label' => __( 'Result Number', 'gravityview' ), |
|
| 819 | 819 | 'type' => 'sequence', |
| 820 | - 'desc' => __('Display a sequential result number for each entry.', 'gravityview'), |
|
| 820 | + 'desc' => __( 'Display a sequential result number for each entry.', 'gravityview' ), |
|
| 821 | 821 | ); |
| 822 | 822 | |
| 823 | 823 | /** |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | * @param string|array $form form_ID or form object |
| 827 | 827 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 828 | 828 | */ |
| 829 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 829 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | /** |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | */ |
| 838 | 838 | function get_available_fields( $form = '', $zone = NULL ) { |
| 839 | 839 | |
| 840 | - if( empty( $form ) ) { |
|
| 840 | + if ( empty( $form ) ) { |
|
| 841 | 841 | gravityview()->log->error( '$form is empty' ); |
| 842 | 842 | return array(); |
| 843 | 843 | } |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | $fields = gravityview_get_form_fields( $form, true ); |
| 847 | 847 | |
| 848 | 848 | // get meta fields ( only if form was already created ) |
| 849 | - if( !is_array( $form ) ) { |
|
| 849 | + if ( ! is_array( $form ) ) { |
|
| 850 | 850 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 851 | 851 | } else { |
| 852 | 852 | $meta_fields = array(); |
@@ -859,14 +859,14 @@ discard block |
||
| 859 | 859 | $fields = $fields + $meta_fields + $default_fields; |
| 860 | 860 | |
| 861 | 861 | // Move Custom Content to top |
| 862 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
| 862 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
| 863 | 863 | |
| 864 | 864 | $gv_fields = GravityView_Fields::get_all(); |
| 865 | 865 | |
| 866 | 866 | foreach ( $fields as &$field ) { |
| 867 | 867 | foreach ( $gv_fields as $gv_field ) { |
| 868 | - if ( $field['type'] === $gv_field->name ) { |
|
| 869 | - $field['icon'] = $gv_field->icon; |
|
| 868 | + if ( $field[ 'type' ] === $gv_field->name ) { |
|
| 869 | + $field[ 'icon' ] = $gv_field->icon; |
|
| 870 | 870 | } |
| 871 | 871 | } |
| 872 | 872 | } |
@@ -889,11 +889,11 @@ discard block |
||
| 889 | 889 | |
| 890 | 890 | $widgets = $this->get_registered_widgets(); |
| 891 | 891 | |
| 892 | - if( !empty( $widgets ) ) { |
|
| 892 | + if ( ! empty( $widgets ) ) { |
|
| 893 | 893 | |
| 894 | - foreach( $widgets as $id => $details ) { |
|
| 894 | + foreach ( $widgets as $id => $details ) { |
|
| 895 | 895 | |
| 896 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 896 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 897 | 897 | |
| 898 | 898 | } |
| 899 | 899 | } |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 923 | 923 | global $post; |
| 924 | 924 | |
| 925 | - if( $type === 'widget' ) { |
|
| 925 | + if ( $type === 'widget' ) { |
|
| 926 | 926 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 927 | 927 | } else { |
| 928 | 928 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -948,10 +948,10 @@ discard block |
||
| 948 | 948 | $form_id = null; |
| 949 | 949 | |
| 950 | 950 | // if saved values, get available fields to label everyone |
| 951 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 951 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 952 | 952 | |
| 953 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 954 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 953 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 954 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 955 | 955 | } else { |
| 956 | 956 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
| 957 | 957 | } |
@@ -969,42 +969,42 @@ discard block |
||
| 969 | 969 | } |
| 970 | 970 | } |
| 971 | 971 | |
| 972 | - foreach( $rows as $row ) : |
|
| 973 | - foreach( $row as $col => $areas ) : |
|
| 974 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 972 | + foreach ( $rows as $row ) : |
|
| 973 | + foreach ( $row as $col => $areas ) : |
|
| 974 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 975 | 975 | |
| 976 | 976 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 977 | 977 | |
| 978 | - <?php foreach( $areas as $area ) : ?> |
|
| 978 | + <?php foreach ( $areas as $area ) : ?> |
|
| 979 | 979 | |
| 980 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 981 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 980 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 981 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 982 | 982 | <?php // render saved fields |
| 983 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 983 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 984 | 984 | |
| 985 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 985 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 986 | 986 | |
| 987 | 987 | // Maybe has a form ID |
| 988 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
| 988 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
| 989 | 989 | |
| 990 | 990 | $input_type = NULL; |
| 991 | 991 | |
| 992 | 992 | if ( $form_id ) { |
| 993 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
| 993 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
| 994 | 994 | } else { |
| 995 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 995 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 996 | 996 | } |
| 997 | 997 | |
| 998 | - if ( !$original_item ) { |
|
| 999 | - 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 ) ) ); |
|
| 998 | + if ( ! $original_item ) { |
|
| 999 | + 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 ) ) ); |
|
| 1000 | 1000 | |
| 1001 | 1001 | $original_item = $field; |
| 1002 | 1002 | } else { |
| 1003 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 1003 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | // Field options dialog box |
| 1007 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 1007 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 1008 | 1008 | |
| 1009 | 1009 | $item = array( |
| 1010 | 1010 | 'input_type' => $input_type, |
@@ -1017,22 +1017,22 @@ discard block |
||
| 1017 | 1017 | $item = wp_parse_args( $item, $original_item ); |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | - switch( $type ) { |
|
| 1020 | + switch ( $type ) { |
|
| 1021 | 1021 | case 'widget': |
| 1022 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 1022 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 1023 | 1023 | break; |
| 1024 | 1024 | default: |
| 1025 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
| 1025 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
| 1026 | 1026 | } |
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | } // End if zone is not empty ?> |
| 1030 | 1030 | |
| 1031 | - <span class="drop-message"><?php echo sprintf( esc_html__('"+ %s" or drag existing %ss here.', 'gravityview'), esc_html( $button_label ), esc_html( $type ) ); ?></span> |
|
| 1031 | + <span class="drop-message"><?php echo sprintf( esc_html__( '"+ %s" or drag existing %ss here.', 'gravityview' ), esc_html( $button_label ), esc_html( $type ) ); ?></span> |
|
| 1032 | 1032 | </div> |
| 1033 | 1033 | <div class="gv-droppable-area-action"> |
| 1034 | - <button 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 ); ?></button> |
|
| 1035 | - <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> |
|
| 1034 | + <button 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 ); ?></button> |
|
| 1035 | + <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> |
|
| 1036 | 1036 | </div> |
| 1037 | 1037 | </div> |
| 1038 | 1038 | |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | // This is a new View, prefill the widgets |
| 1061 | 1061 | $widgets = array( |
| 1062 | 1062 | 'header_top' => array( |
| 1063 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
| 1063 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
| 1064 | 1064 | 'id' => 'search_bar', |
| 1065 | 1065 | 'label' => __( 'Search Bar', 'gravityview' ), |
| 1066 | 1066 | 'search_layout' => 'horizontal', |
@@ -1135,12 +1135,12 @@ discard block |
||
| 1135 | 1135 | if ( $post ) { |
| 1136 | 1136 | $source_form_id = gravityview_get_form_id( $post->ID ); |
| 1137 | 1137 | if ( $source_form_id ) { |
| 1138 | - $form_ids[] = $source_form_id; |
|
| 1138 | + $form_ids[ ] = $source_form_id; |
|
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
| 1142 | 1142 | foreach ( $joined_forms as $joined_form ) { |
| 1143 | - $form_ids[] = $joined_form->ID; |
|
| 1143 | + $form_ids[ ] = $joined_form->ID; |
|
| 1144 | 1144 | } |
| 1145 | 1145 | } |
| 1146 | 1146 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | * @return string HTML of the active areas |
| 1175 | 1175 | */ |
| 1176 | 1176 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 1177 | - if( empty( $template_id ) ) { |
|
| 1177 | + if ( empty( $template_id ) ) { |
|
| 1178 | 1178 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
| 1179 | 1179 | return ''; |
| 1180 | 1180 | } |
@@ -1188,12 +1188,12 @@ discard block |
||
| 1188 | 1188 | */ |
| 1189 | 1189 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 1190 | 1190 | |
| 1191 | - if( empty( $template_areas ) ) { |
|
| 1191 | + if ( empty( $template_areas ) ) { |
|
| 1192 | 1192 | |
| 1193 | 1193 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
| 1194 | 1194 | $output = '<div>'; |
| 1195 | - $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>'; |
|
| 1196 | - $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>'; |
|
| 1195 | + $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>'; |
|
| 1196 | + $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>'; |
|
| 1197 | 1197 | $output .= '</div>'; |
| 1198 | 1198 | } else { |
| 1199 | 1199 | |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | |
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | - if( $echo ) { |
|
| 1211 | + if ( $echo ) { |
|
| 1212 | 1212 | echo $output; |
| 1213 | 1213 | } |
| 1214 | 1214 | |
@@ -1236,30 +1236,30 @@ discard block |
||
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | // Add the GV font (with the Astronaut) |
| 1239 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1239 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
| 1240 | 1240 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1241 | 1241 | |
| 1242 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1242 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1243 | 1243 | |
| 1244 | - if( GFForms::get_page() === 'form_list' ) { |
|
| 1244 | + if ( GFForms::get_page() === 'form_list' ) { |
|
| 1245 | 1245 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1246 | 1246 | return; |
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | // Don't process any scripts below here if it's not a GravityView page. |
| 1250 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1250 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1251 | 1251 | return; |
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | 1254 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 1255 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1255 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
| 1256 | 1256 | |
| 1257 | 1257 | // Enqueue scripts |
| 1258 | 1258 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
| 1259 | 1259 | |
| 1260 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1260 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1261 | 1261 | 'cookiepath' => COOKIEPATH, |
| 1262 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1262 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
| 1263 | 1263 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1264 | 1264 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
| 1265 | 1265 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
@@ -1274,7 +1274,7 @@ discard block |
||
| 1274 | 1274 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1275 | 1275 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1276 | 1276 | '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' ), |
| 1277 | - )); |
|
| 1277 | + ) ); |
|
| 1278 | 1278 | |
| 1279 | 1279 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1280 | 1280 | |
@@ -1301,7 +1301,7 @@ discard block |
||
| 1301 | 1301 | ); |
| 1302 | 1302 | |
| 1303 | 1303 | if ( wp_is_mobile() ) { |
| 1304 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1304 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | wp_enqueue_script( $scripts ); |