@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct() { |
| 25 | 25 | $this->label = esc_html__( 'Payment Status', 'gravityview' ); |
| 26 | - $this->description = esc_html__('The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview' ); |
|
| 26 | + $this->description = esc_html__( 'The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview' ); |
|
| 27 | 27 | parent::__construct(); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> |
| 15 | 15 | <?php |
| 16 | 16 | |
| 17 | - foreach( $metaboxes as $metabox ) { |
|
| 18 | - $class = !isset( $class ) ? 'nav-tab-active' : ''; |
|
| 17 | + foreach ( $metaboxes as $metabox ) { |
|
| 18 | + $class = ! isset( $class ) ? 'nav-tab-active' : ''; |
|
| 19 | 19 | ?> |
| 20 | 20 | <li class="ui-state-default"> |
| 21 | 21 | <a class="nav-tab ui-tabs-anchor <?php echo $class; ?>" href="#<?php echo esc_attr( $metabox->id ); ?>"> |
@@ -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> |
@@ -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 | |
@@ -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 | |
@@ -62,28 +62,28 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 66 | - * |
|
| 65 | + * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 66 | + * |
|
| 67 | 67 | * @param array $localization_data Data to be passed to the Support Port JS |
| 68 | 68 | * |
| 69 | 69 | * @return array |
| 70 | 70 | */ |
| 71 | 71 | function suggest_support_articles( $localization_data = array() ) { |
| 72 | 72 | |
| 73 | - if( ! gravityview()->request->is_view() ) { |
|
| 74 | - return $localization_data; |
|
| 75 | - } |
|
| 73 | + if( ! gravityview()->request->is_view() ) { |
|
| 74 | + return $localization_data; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | $localization_data['suggest'] = array( |
| 78 | - '57ef23539033602e61d4a560', |
|
| 79 | - '54c67bb9e4b0512429885513', |
|
| 80 | - '54c67bb9e4b0512429885512', |
|
| 81 | - '54c67bbbe4b07997ea3f3f6b', |
|
| 82 | - '54d1a33ae4b086c0c0964ce9', |
|
| 83 | - '57ef253c9033602e61d4a563', |
|
| 84 | - '552355bfe4b0221aadf2572b', |
|
| 85 | - '54c67bcde4b051242988553e', |
|
| 86 | - ); |
|
| 78 | + '57ef23539033602e61d4a560', |
|
| 79 | + '54c67bb9e4b0512429885513', |
|
| 80 | + '54c67bb9e4b0512429885512', |
|
| 81 | + '54c67bbbe4b07997ea3f3f6b', |
|
| 82 | + '54d1a33ae4b086c0c0964ce9', |
|
| 83 | + '57ef253c9033602e61d4a563', |
|
| 84 | + '552355bfe4b0221aadf2572b', |
|
| 85 | + '54c67bcde4b051242988553e', |
|
| 86 | + ); |
|
| 87 | 87 | |
| 88 | 88 | return $localization_data; |
| 89 | 89 | } |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | if( 'form_list' === GFForms::get_page() ) { |
| 231 | 231 | $priority = 790; |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | 234 | if( empty( $connected_views ) ) { |
| 235 | 235 | |
| 236 | - $menu_items['gravityview'] = array( |
|
| 236 | + $menu_items['gravityview'] = array( |
|
| 237 | 237 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 238 | 238 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5 |
| 239 | 239 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | // If there were no items added, then let's create the parent menu |
| 266 | 266 | if( $sub_menu_items ) { |
| 267 | 267 | |
| 268 | - $sub_menu_items[] = array( |
|
| 269 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 270 | - 'icon' => '<span class="dashicons dashicons-plus"></span>', |
|
| 271 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 272 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 273 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
| 274 | - ); |
|
| 268 | + $sub_menu_items[] = array( |
|
| 269 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 270 | + 'icon' => '<span class="dashicons dashicons-plus"></span>', |
|
| 271 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 272 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 273 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
| 274 | + ); |
|
| 275 | 275 | |
| 276 | 276 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 277 | 277 | $sub_menu_items[] = array( |
@@ -668,16 +668,16 @@ discard block |
||
| 668 | 668 | /** |
| 669 | 669 | * Render html for displaying available fields based on a Form ID |
| 670 | 670 | * |
| 671 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 671 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 672 | 672 | * |
| 673 | 673 | * @param int $form Gravity Forms Form ID (default: '') |
| 674 | 674 | * @param string $context (default: 'single') |
| 675 | - * |
|
| 675 | + * |
|
| 676 | 676 | * @return void |
| 677 | 677 | */ |
| 678 | 678 | function render_available_fields( $form = 0, $context = 'single' ) { |
| 679 | 679 | |
| 680 | - // Determine if form is a preset and convert it to an array with fields |
|
| 680 | + // Determine if form is a preset and convert it to an array with fields |
|
| 681 | 681 | $form = ( is_string( $form ) && preg_match( '/^preset_/', $form ) ) ? GravityView_Ajax::pre_get_form_fields( $form ) : $form; |
| 682 | 682 | |
| 683 | 683 | /** |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | |
| 696 | 696 | if ( ! is_array( $blocklist_field_types ) ) { |
| 697 | 697 | |
| 698 | - gravityview()->log->error( '$blocklist_field_types is not an array', array( 'data' => print_r( $blocklist_field_types, true ) ) ); |
|
| 698 | + gravityview()->log->error( '$blocklist_field_types is not an array', array( 'data' => print_r( $blocklist_field_types, true ) ) ); |
|
| 699 | 699 | |
| 700 | 700 | $blocklist_field_types = array(); |
| 701 | 701 | } |
@@ -953,9 +953,9 @@ discard block |
||
| 953 | 953 | |
| 954 | 954 | $joined_forms = gravityview_get_joined_forms( $post->ID ); |
| 955 | 955 | |
| 956 | - foreach ( $joined_forms as $form ) { |
|
| 957 | - $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 958 | - } |
|
| 956 | + foreach ( $joined_forms as $form ) { |
|
| 957 | + $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 958 | + } |
|
| 959 | 959 | } else { |
| 960 | 960 | $available_items[ $form ] = \GV\Widget::registered(); |
| 961 | 961 | } |
@@ -994,9 +994,9 @@ discard block |
||
| 994 | 994 | |
| 995 | 995 | if ( $form_id ) { |
| 996 | 996 | $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
| 997 | - } else { |
|
| 997 | + } else { |
|
| 998 | 998 | $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
| 999 | - } |
|
| 999 | + } |
|
| 1000 | 1000 | |
| 1001 | 1001 | if ( !$original_item ) { |
| 1002 | 1002 | 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 ) ) ); |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | 1248 | // Add the GV font (with the Astronaut) |
| 1249 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1249 | + wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1250 | 1250 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1251 | 1251 | |
| 1252 | 1252 | wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
@@ -1254,46 +1254,46 @@ discard block |
||
| 1254 | 1254 | if( GFForms::get_page() === 'form_list' ) { |
| 1255 | 1255 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1256 | 1256 | return; |
| 1257 | - } |
|
| 1257 | + } |
|
| 1258 | 1258 | |
| 1259 | 1259 | // Don't process any scripts below here if it's not a GravityView page. |
| 1260 | 1260 | if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
| 1261 | - return; |
|
| 1261 | + return; |
|
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
| 1265 | 1265 | |
| 1266 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1267 | - |
|
| 1268 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1269 | - |
|
| 1270 | - // Enqueue scripts |
|
| 1271 | - 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 ); |
|
| 1272 | - |
|
| 1273 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1274 | - 'cookiepath' => COOKIEPATH, |
|
| 1275 | - 'admin_cookiepath' => ADMIN_COOKIE_PATH, |
|
| 1276 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1277 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1278 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1279 | - 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
|
| 1280 | - 'label_add_search_field' => __( 'Add Search Field', 'gravityview' ), |
|
| 1281 | - 'label_remove_search_field' => __( 'Remove Search Field', 'gravityview' ), |
|
| 1282 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1283 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1284 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1285 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1286 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1287 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1288 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1289 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1290 | - 'remove_all_fields' => __( 'Would you like to remove all fields in this zone?', 'gravityview' ), |
|
| 1291 | - )); |
|
| 1266 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1267 | + |
|
| 1268 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1269 | + |
|
| 1270 | + // Enqueue scripts |
|
| 1271 | + 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 ); |
|
| 1272 | + |
|
| 1273 | + wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1274 | + 'cookiepath' => COOKIEPATH, |
|
| 1275 | + 'admin_cookiepath' => ADMIN_COOKIE_PATH, |
|
| 1276 | + 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1277 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1278 | + 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1279 | + 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
|
| 1280 | + 'label_add_search_field' => __( 'Add Search Field', 'gravityview' ), |
|
| 1281 | + 'label_remove_search_field' => __( 'Remove Search Field', 'gravityview' ), |
|
| 1282 | + 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1283 | + 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1284 | + 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1285 | + 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1286 | + 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1287 | + 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1288 | + 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1289 | + 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1290 | + 'remove_all_fields' => __( 'Would you like to remove all fields in this zone?', 'gravityview' ), |
|
| 1291 | + )); |
|
| 1292 | 1292 | |
| 1293 | 1293 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1294 | 1294 | |
| 1295 | - // Enqueue scripts needed for merge tags |
|
| 1296 | - self::enqueue_gravity_forms_scripts(); |
|
| 1295 | + // Enqueue scripts needed for merge tags |
|
| 1296 | + self::enqueue_gravity_forms_scripts(); |
|
| 1297 | 1297 | |
| 1298 | 1298 | // 2.5 changed how Merge Tags are enqueued |
| 1299 | 1299 | if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
@@ -1303,24 +1303,24 @@ discard block |
||
| 1303 | 1303 | |
| 1304 | 1304 | /** |
| 1305 | 1305 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
| 1306 | - * |
|
| 1307 | - * @since 1.0.5-beta |
|
| 1308 | - * |
|
| 1309 | - * @return void |
|
| 1306 | + * |
|
| 1307 | + * @since 1.0.5-beta |
|
| 1308 | + * |
|
| 1309 | + * @return void |
|
| 1310 | 1310 | */ |
| 1311 | 1311 | static function enqueue_gravity_forms_scripts() { |
| 1312 | 1312 | GFForms::register_scripts(); |
| 1313 | 1313 | |
| 1314 | 1314 | $scripts = array( |
| 1315 | - 'sack', |
|
| 1316 | - 'gform_gravityforms', |
|
| 1317 | - 'gform_forms', |
|
| 1318 | - 'gform_form_admin', |
|
| 1319 | - 'jquery-ui-autocomplete' |
|
| 1315 | + 'sack', |
|
| 1316 | + 'gform_gravityforms', |
|
| 1317 | + 'gform_forms', |
|
| 1318 | + 'gform_form_admin', |
|
| 1319 | + 'jquery-ui-autocomplete' |
|
| 1320 | 1320 | ); |
| 1321 | 1321 | |
| 1322 | 1322 | if ( wp_is_mobile() ) { |
| 1323 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1323 | + $scripts[] = 'jquery-touch-punch'; |
|
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | 1326 | wp_enqueue_script( $scripts ); |
@@ -27,34 +27,34 @@ discard block |
||
| 27 | 27 | add_filter( 'gravityview_blocklist_field_types', array( $this, 'default_field_blocklist' ), 10, 2 ); |
| 28 | 28 | |
| 29 | 29 | // Tooltips |
| 30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 31 | 31 | |
| 32 | 32 | add_filter( 'admin_body_class', array( $this, 'add_gf_version_css_class' ) ); |
| 33 | 33 | |
| 34 | 34 | // adding styles and scripts |
| 35 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 36 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 38 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 39 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 40 | - |
|
| 41 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 42 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 43 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 ); |
|
| 44 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 45 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 46 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 35 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 36 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 39 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 40 | + |
|
| 41 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 42 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 43 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 ); |
|
| 44 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 45 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 46 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 47 | 47 | |
| 48 | 48 | // @todo check if this hook is needed.. |
| 49 | 49 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 50 | 50 | |
| 51 | 51 | // Add Connected Form column |
| 52 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 52 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 53 | 53 | |
| 54 | 54 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 55 | 55 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 56 | 56 | |
| 57 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 57 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 58 | 58 | |
| 59 | 59 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 60 | 60 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $major_version = explode( '.', GFForms::$version ); |
| 87 | 87 | |
| 88 | 88 | if ( 2 <= sizeof( $major_version ) ) { |
| 89 | - $class .= ' gf-minor-version-' . esc_attr( $major_version[0] . '-' . $major_version[1] ); |
|
| 89 | + $class .= ' gf-minor-version-' . esc_attr( $major_version[ 0 ] . '-' . $major_version[ 1 ] ); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $class; |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | function suggest_support_articles( $localization_data = array() ) { |
| 103 | 103 | |
| 104 | - if( ! gravityview()->request->is_view() ) { |
|
| 104 | + if ( ! gravityview()->request->is_view() ) { |
|
| 105 | 105 | return $localization_data; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $localization_data['suggest'] = array( |
|
| 108 | + $localization_data[ 'suggest' ] = array( |
|
| 109 | 109 | '57ef23539033602e61d4a560', |
| 110 | 110 | '54c67bb9e4b0512429885513', |
| 111 | 111 | '54c67bb9e4b0512429885512', |
@@ -134,20 +134,20 @@ discard block |
||
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if ( ! isset( $query->query_vars['post_type'] ) ) { |
|
| 137 | + if ( ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 138 | 138 | return; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if ( 'gravityview' !== $query->query_vars['post_type'] ) { |
|
| 141 | + if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) { |
|
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' ); |
|
| 145 | + $form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' ); |
|
| 146 | 146 | |
| 147 | 147 | $meta_query = array(); |
| 148 | 148 | |
| 149 | 149 | if ( $form_id ) { |
| 150 | - $meta_query[] = array( |
|
| 150 | + $meta_query[ ] = array( |
|
| 151 | 151 | 'key' => '_gravityview_form_id', |
| 152 | 152 | 'value' => $form_id, |
| 153 | 153 | ); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $layout_id = \GV\Utils::_GET( 'gravityview_layout' ); |
| 157 | 157 | |
| 158 | 158 | if ( $layout_id ) { |
| 159 | - $meta_query[] = array( |
|
| 159 | + $meta_query[ ] = array( |
|
| 160 | 160 | 'key' => '_gravityview_directory_template', |
| 161 | 161 | 'value' => esc_attr( $layout_id ), |
| 162 | 162 | ); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | public function add_view_dropdown() { |
| 174 | 174 | $current_screen = get_current_screen(); |
| 175 | 175 | |
| 176 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 176 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 177 | 177 | return; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
| 182 | 182 | |
| 183 | 183 | // If there are no forms to select, show no forms. |
| 184 | - if( ! empty( $forms ) ) { ?> |
|
| 184 | + if ( ! empty( $forms ) ) { ?> |
|
| 185 | 185 | <label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gravityview' ); ?></label> |
| 186 | 186 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 187 | 187 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 188 | - <?php foreach( $forms as $form ) { ?> |
|
| 189 | - <option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 188 | + <?php foreach ( $forms as $form ) { ?> |
|
| 189 | + <option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 190 | 190 | <?php } ?> |
| 191 | 191 | </select> |
| 192 | 192 | <?php } |
@@ -195,26 +195,26 @@ discard block |
||
| 195 | 195 | $current_layout = \GV\Utils::_GET( 'gravityview_layout' ); |
| 196 | 196 | |
| 197 | 197 | // If there are no forms to select, show no forms. |
| 198 | - if( ! empty( $layouts ) ) { ?> |
|
| 198 | + if ( ! empty( $layouts ) ) { ?> |
|
| 199 | 199 | <label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gravityview' ); ?></label> |
| 200 | 200 | <select name="gravityview_layout" id="gravityview_layout_name"> |
| 201 | 201 | <option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gravityview' ); ?></option> |
| 202 | 202 | <optgroup label="<?php esc_html_e( 'Layouts', 'gravityview' ); ?>"> |
| 203 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
| 204 | - if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) { |
|
| 203 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
| 204 | + if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) { |
|
| 205 | 205 | continue; |
| 206 | 206 | } |
| 207 | 207 | ?> |
| 208 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
| 208 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
| 209 | 209 | <?php } ?> |
| 210 | 210 | </optgroup> |
| 211 | 211 | <optgroup label="<?php esc_html_e( 'Form Presets', 'gravityview' ); ?>"> |
| 212 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
| 213 | - if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) { |
|
| 212 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
| 213 | + if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) { |
|
| 214 | 214 | continue; |
| 215 | 215 | } |
| 216 | 216 | ?> |
| 217 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
| 217 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
| 218 | 218 | <?php } ?> |
| 219 | 219 | </optgroup> |
| 220 | 220 | </select> |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 230 | 230 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 231 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 231 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -258,13 +258,13 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | $priority = 0; |
| 260 | 260 | |
| 261 | - if( 'form_list' === GFForms::get_page() ) { |
|
| 261 | + if ( 'form_list' === GFForms::get_page() ) { |
|
| 262 | 262 | $priority = 790; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if( empty( $connected_views ) ) { |
|
| 265 | + if ( empty( $connected_views ) ) { |
|
| 266 | 266 | |
| 267 | - $menu_items['gravityview'] = array( |
|
| 267 | + $menu_items[ 'gravityview' ] = array( |
|
| 268 | 268 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 269 | 269 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5 |
| 270 | 270 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -280,23 +280,23 @@ discard block |
||
| 280 | 280 | $sub_menu_items = array(); |
| 281 | 281 | foreach ( (array)$connected_views as $view ) { |
| 282 | 282 | |
| 283 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 283 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 284 | 284 | continue; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 287 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 288 | 288 | |
| 289 | - $sub_menu_items[] = array( |
|
| 289 | + $sub_menu_items[ ] = array( |
|
| 290 | 290 | 'label' => esc_attr( $label ), |
| 291 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 291 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 292 | 292 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 293 | 293 | ); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | // If there were no items added, then let's create the parent menu |
| 297 | - if( $sub_menu_items ) { |
|
| 297 | + if ( $sub_menu_items ) { |
|
| 298 | 298 | |
| 299 | - $sub_menu_items[] = array( |
|
| 299 | + $sub_menu_items[ ] = array( |
|
| 300 | 300 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 301 | 301 | 'icon' => '<span class="dashicons dashicons-plus"></span>', |
| 302 | 302 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | ); |
| 306 | 306 | |
| 307 | 307 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 308 | - $sub_menu_items[] = array( |
|
| 308 | + $sub_menu_items[ ] = array( |
|
| 309 | 309 | 'url' => '#', |
| 310 | 310 | 'label' => '', |
| 311 | 311 | 'menu_class' => 'hidden', |
| 312 | 312 | 'capabilities' => '', |
| 313 | 313 | ); |
| 314 | 314 | |
| 315 | - $menu_items['gravityview'] = array( |
|
| 315 | + $menu_items[ 'gravityview' ] = array( |
|
| 316 | 316 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 317 | 317 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 318 | 318 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -343,8 +343,8 @@ discard block |
||
| 343 | 343 | $add = array( 'captcha', 'page' ); |
| 344 | 344 | |
| 345 | 345 | // Don't allowing editing the following values: |
| 346 | - if( $context === 'edit' ) { |
|
| 347 | - $add[] = 'post_id'; |
|
| 346 | + if ( $context === 'edit' ) { |
|
| 347 | + $add[ ] = 'post_id'; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | $return = array_merge( $array, $add ); |
@@ -375,27 +375,27 @@ discard block |
||
| 375 | 375 | foreach ( $default_args as $key => $arg ) { |
| 376 | 376 | |
| 377 | 377 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 378 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 378 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 379 | 379 | |
| 380 | 380 | // By default, use `tooltip` if defined. |
| 381 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 381 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 382 | 382 | |
| 383 | 383 | // If there's no tooltip set, continue |
| 384 | - if( empty( $tooltip ) ) { |
|
| 384 | + if ( empty( $tooltip ) ) { |
|
| 385 | 385 | continue; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | // Add the tooltip |
| 389 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 390 | - 'title' => $arg['label'], |
|
| 389 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 390 | + 'title' => $arg[ 'label' ], |
|
| 391 | 391 | 'value' => $tooltip, |
| 392 | 392 | ); |
| 393 | 393 | |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 397 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 398 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 396 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 397 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 398 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 399 | 399 | ); |
| 400 | 400 | |
| 401 | 401 | /** |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 415 | 415 | |
| 416 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 416 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 417 | 417 | |
| 418 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 418 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | return $tooltips; |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * |
| 430 | 430 | * @return void |
| 431 | 431 | */ |
| 432 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 432 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 433 | 433 | |
| 434 | 434 | $output = ''; |
| 435 | 435 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 452 | 452 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 453 | 453 | |
| 454 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 454 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 455 | 455 | |
| 456 | 456 | break; |
| 457 | 457 | |
@@ -492,12 +492,12 @@ discard block |
||
| 492 | 492 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 493 | 493 | |
| 494 | 494 | // Either the form is empty or the form ID is 0, not yet set. |
| 495 | - if( empty( $form ) ) { |
|
| 495 | + if ( empty( $form ) ) { |
|
| 496 | 496 | return ''; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | // The $form is passed as the form ID |
| 500 | - if( !is_array( $form ) ) { |
|
| 500 | + if ( ! is_array( $form ) ) { |
|
| 501 | 501 | $form = gravityview_get_form( $form ); |
| 502 | 502 | } |
| 503 | 503 | |
@@ -505,35 +505,35 @@ discard block |
||
| 505 | 505 | return ''; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - $form_id = $form['id']; |
|
| 508 | + $form_id = $form[ 'id' ]; |
|
| 509 | 509 | $links = array(); |
| 510 | 510 | |
| 511 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 511 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 512 | 512 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 513 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 514 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 513 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 514 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 515 | 515 | } else { |
| 516 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 516 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 519 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 520 | 520 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 521 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 521 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 524 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 525 | 525 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 526 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 526 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 529 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 530 | 530 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 531 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 531 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | $output = ''; |
| 535 | 535 | |
| 536 | - if( !empty( $include_form_link ) ) { |
|
| 536 | + if ( ! empty( $include_form_link ) ) { |
|
| 537 | 537 | $output .= $form_link; |
| 538 | 538 | } |
| 539 | 539 | |
@@ -548,11 +548,11 @@ discard block |
||
| 548 | 548 | $css_class = 'row-actions'; |
| 549 | 549 | |
| 550 | 550 | // Is Screen Options > View mode set to "Extended view"? If so, keep actions visible. |
| 551 | - if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
| 551 | + if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
| 552 | 552 | $css_class = 'row-actions visible'; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - $output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>'; |
|
| 555 | + $output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>'; |
|
| 556 | 556 | |
| 557 | 557 | return $output; |
| 558 | 558 | } |
@@ -566,8 +566,8 @@ discard block |
||
| 566 | 566 | // Get the date column and save it for later to add back in. |
| 567 | 567 | // This adds it after the Data Source column. |
| 568 | 568 | // This way, we don't need to do array_slice, array_merge, etc. |
| 569 | - $date = $columns['date']; |
|
| 570 | - unset( $columns['date'] ); |
|
| 569 | + $date = $columns[ 'date' ]; |
|
| 570 | + unset( $columns[ 'date' ] ); |
|
| 571 | 571 | |
| 572 | 572 | $data_source_required_caps = array( |
| 573 | 573 | 'gravityforms_edit_forms', |
@@ -578,14 +578,14 @@ discard block |
||
| 578 | 578 | 'gravityforms_preview_forms', |
| 579 | 579 | ); |
| 580 | 580 | |
| 581 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 582 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 581 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 582 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 585 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 586 | 586 | |
| 587 | 587 | // Add the date back in. |
| 588 | - $columns['date'] = $date; |
|
| 588 | + $columns[ 'date' ] = $date; |
|
| 589 | 589 | |
| 590 | 590 | return $columns; |
| 591 | 591 | } |
@@ -598,12 +598,12 @@ discard block |
||
| 598 | 598 | */ |
| 599 | 599 | function save_postdata( $post_id ) { |
| 600 | 600 | |
| 601 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 601 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 602 | 602 | return; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | // validate post_type |
| 606 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 606 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 607 | 607 | return; |
| 608 | 608 | } |
| 609 | 609 | |
@@ -618,63 +618,63 @@ discard block |
||
| 618 | 618 | $statii = array(); |
| 619 | 619 | |
| 620 | 620 | // check if this is a start fresh View |
| 621 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 621 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 622 | 622 | |
| 623 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 623 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 624 | 624 | // save form id |
| 625 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 625 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 626 | 626 | |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 629 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 630 | 630 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
| 631 | 631 | return; |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | // Was this a start fresh? |
| 635 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 636 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 635 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 636 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 637 | 637 | } else { |
| 638 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 638 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | // Check if we have a template id |
| 642 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 642 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 643 | 643 | |
| 644 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 644 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 645 | 645 | |
| 646 | 646 | // now save template id |
| 647 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 647 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | |
| 651 | 651 | // save View Configuration metabox |
| 652 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 652 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 653 | 653 | |
| 654 | 654 | // template settings |
| 655 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 656 | - $_POST['template_settings'] = array(); |
|
| 655 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 656 | + $_POST[ 'template_settings' ] = array(); |
|
| 657 | 657 | } |
| 658 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 658 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 659 | 659 | |
| 660 | 660 | // guard against unloaded View configuration page |
| 661 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
| 661 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
| 662 | 662 | $fields = array(); |
| 663 | 663 | |
| 664 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
| 664 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 665 | 665 | $fields = _gravityview_process_posted_fields(); |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | $fields = wp_slash( $fields ); |
| 669 | 669 | |
| 670 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 670 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | // Directory Visible Widgets |
| 674 | - if( empty( $_POST['widgets'] ) ) { |
|
| 675 | - $_POST['widgets'] = array(); |
|
| 674 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 675 | + $_POST[ 'widgets' ] = array(); |
|
| 676 | 676 | } |
| 677 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
| 677 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
| 678 | 678 | |
| 679 | 679 | } // end save view configuration |
| 680 | 680 | |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | * @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. |
| 685 | 685 | * @since 1.17.2 |
| 686 | 686 | */ |
| 687 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 687 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 688 | 688 | |
| 689 | 689 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
| 690 | 690 | } |
@@ -735,20 +735,20 @@ discard block |
||
| 735 | 735 | |
| 736 | 736 | $output = ''; |
| 737 | 737 | |
| 738 | - if( !empty( $fields ) ) { |
|
| 738 | + if ( ! empty( $fields ) ) { |
|
| 739 | 739 | |
| 740 | - foreach( $fields as $id => $details ) { |
|
| 740 | + foreach ( $fields as $id => $details ) { |
|
| 741 | 741 | |
| 742 | - if( in_array( $details['type'], (array) $blocklist_field_types ) ) { |
|
| 742 | + if ( in_array( $details[ 'type' ], (array)$blocklist_field_types ) ) { |
|
| 743 | 743 | continue; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | // Edit mode only allows editing the parent fields, not single inputs. |
| 747 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
| 747 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 748 | 748 | continue; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form ); |
|
| 751 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form ); |
|
| 752 | 752 | |
| 753 | 753 | } // End foreach |
| 754 | 754 | } |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | echo $output; |
| 757 | 757 | |
| 758 | 758 | // For the EDIT view we only want to allow the form fields. |
| 759 | - if( $context === 'edit' ) { |
|
| 759 | + if ( $context === 'edit' ) { |
|
| 760 | 760 | return; |
| 761 | 761 | } |
| 762 | 762 | |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | $additional_fields = array( |
| 776 | 776 | array( |
| 777 | 777 | 'label_text' => __( 'Add All Form Fields', 'gravityview' ), |
| 778 | - 'desc' => __('Insert all the form fields at once.', 'gravityview'), |
|
| 778 | + 'desc' => __( 'Insert all the form fields at once.', 'gravityview' ), |
|
| 779 | 779 | 'field_id' => 'all-fields', |
| 780 | 780 | 'label_type' => 'field', |
| 781 | 781 | 'input_type' => null, |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | */ |
| 792 | 792 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
| 793 | 793 | |
| 794 | - foreach ( (array) $additional_fields as $item ) { |
|
| 794 | + foreach ( (array)$additional_fields as $item ) { |
|
| 795 | 795 | |
| 796 | 796 | // Prevent items from not having index set |
| 797 | 797 | $item = wp_parse_args( $item, array( |
@@ -802,16 +802,16 @@ discard block |
||
| 802 | 802 | 'field_options' => null, |
| 803 | 803 | 'settings_html' => null, |
| 804 | 804 | 'icon' => null, |
| 805 | - )); |
|
| 805 | + ) ); |
|
| 806 | 806 | |
| 807 | 807 | // Backward compat. |
| 808 | - if( !empty( $item['field_options'] ) ) { |
|
| 808 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 809 | 809 | // Use settings_html from now on. |
| 810 | - $item['settings_html'] = $item['field_options']; |
|
| 810 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 811 | 811 | } |
| 812 | 812 | |
| 813 | 813 | // Render a label for each of them |
| 814 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
| 814 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
| 815 | 815 | |
| 816 | 816 | } |
| 817 | 817 | |
@@ -823,12 +823,12 @@ discard block |
||
| 823 | 823 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 824 | 824 | * @return array |
| 825 | 825 | */ |
| 826 | - function get_entry_default_fields($form, $zone) { |
|
| 826 | + function get_entry_default_fields( $form, $zone ) { |
|
| 827 | 827 | |
| 828 | 828 | $entry_default_fields = array(); |
| 829 | 829 | |
| 830 | 830 | // if in zone directory or single |
| 831 | - if( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
| 831 | + if ( in_array( $zone, array( 'directory', 'single' ), true ) ) { |
|
| 832 | 832 | |
| 833 | 833 | $meta_fields = GravityView_Fields::get_all( array( 'meta', 'gravityview', 'add-ons' ) ); |
| 834 | 834 | |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | * @param string|array $form form_ID or form object |
| 846 | 846 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 847 | 847 | */ |
| 848 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 848 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | /** |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | */ |
| 857 | 857 | function get_available_fields( $form = '', $zone = NULL ) { |
| 858 | 858 | |
| 859 | - if( empty( $form ) ) { |
|
| 859 | + if ( empty( $form ) ) { |
|
| 860 | 860 | gravityview()->log->error( '$form is empty' ); |
| 861 | 861 | return array(); |
| 862 | 862 | } |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | $fields = gravityview_get_form_fields( $form, true ); |
| 866 | 866 | |
| 867 | 867 | // get meta fields ( only if form was already created ) |
| 868 | - if( !is_array( $form ) ) { |
|
| 868 | + if ( ! is_array( $form ) ) { |
|
| 869 | 869 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 870 | 870 | } else { |
| 871 | 871 | $meta_fields = array(); |
@@ -878,8 +878,8 @@ discard block |
||
| 878 | 878 | $fields = $fields + $meta_fields + $default_fields; |
| 879 | 879 | |
| 880 | 880 | // Move Custom Content to top |
| 881 | - if ( isset( $fields['custom'] ) ) { |
|
| 882 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
| 881 | + if ( isset( $fields[ 'custom' ] ) ) { |
|
| 882 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | $gv_fields = GravityView_Fields::get_all(); |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | foreach ( $fields as &$field ) { |
| 888 | 888 | foreach ( $gv_fields as $gv_field ) { |
| 889 | 889 | if ( \GV\Utils::get( $field, 'type' ) === $gv_field->name ) { |
| 890 | - $field['icon'] = \GV\Utils::get( $gv_field, 'icon' ); |
|
| 890 | + $field[ 'icon' ] = \GV\Utils::get( $gv_field, 'icon' ); |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | } |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | foreach ( $widgets as $id => $details ) { |
| 918 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 918 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | } |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 946 | 946 | global $post; |
| 947 | 947 | |
| 948 | - if( $type === 'widget' ) { |
|
| 948 | + if ( $type === 'widget' ) { |
|
| 949 | 949 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 950 | 950 | } else { |
| 951 | 951 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -971,10 +971,10 @@ discard block |
||
| 971 | 971 | $form_id = null; |
| 972 | 972 | |
| 973 | 973 | // if saved values, get available fields to label everyone |
| 974 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 974 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 975 | 975 | |
| 976 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 977 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 976 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 977 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 978 | 978 | } else { |
| 979 | 979 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
| 980 | 980 | } |
@@ -992,53 +992,53 @@ discard block |
||
| 992 | 992 | } |
| 993 | 993 | } |
| 994 | 994 | |
| 995 | - foreach( $rows as $row ) : |
|
| 996 | - foreach( $row as $col => $areas ) : |
|
| 997 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 995 | + foreach ( $rows as $row ) : |
|
| 996 | + foreach ( $row as $col => $areas ) : |
|
| 997 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 998 | 998 | |
| 999 | 999 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 1000 | 1000 | |
| 1001 | - <?php foreach( $areas as $area ) : ?> |
|
| 1001 | + <?php foreach ( $areas as $area ) : ?> |
|
| 1002 | 1002 | |
| 1003 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 1004 | - <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area['subtitle'] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
| 1005 | - <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area['title'] ); ?></strong> |
|
| 1003 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 1004 | + <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area[ 'subtitle' ] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>> |
|
| 1005 | + <strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area[ 'title' ] ); ?></strong> |
|
| 1006 | 1006 | |
| 1007 | 1007 | <?php if ( 'widget' !== $type ) { ?> |
| 1008 | - <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php esc_html_e( 'Clear all fields', 'gravityview' ); ?></a> |
|
| 1008 | + <a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php esc_html_e( 'Clear all fields', 'gravityview' ); ?></a> |
|
| 1009 | 1009 | <?php } ?> |
| 1010 | 1010 | |
| 1011 | - <?php if ( ! empty( $area['subtitle'] ) ) { ?> |
|
| 1012 | - <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area['subtitle'] ); ?>"></span></span> |
|
| 1011 | + <?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?> |
|
| 1012 | + <span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area[ 'subtitle' ] ); ?>"></span></span> |
|
| 1013 | 1013 | <?php } ?> |
| 1014 | 1014 | </p> |
| 1015 | 1015 | <div class="active-drop-container active-drop-container-<?php echo esc_attr( $type ); ?>"> |
| 1016 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php // render saved fields |
|
| 1017 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 1016 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php // render saved fields |
|
| 1017 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 1018 | 1018 | |
| 1019 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 1019 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 1020 | 1020 | |
| 1021 | 1021 | // Maybe has a form ID |
| 1022 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
| 1022 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
| 1023 | 1023 | |
| 1024 | 1024 | $input_type = NULL; |
| 1025 | 1025 | |
| 1026 | 1026 | if ( $form_id ) { |
| 1027 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
| 1027 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
| 1028 | 1028 | } else { |
| 1029 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 1029 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | - if ( !$original_item ) { |
|
| 1033 | - 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 ) ) ); |
|
| 1032 | + if ( ! $original_item ) { |
|
| 1033 | + 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 ) ) ); |
|
| 1034 | 1034 | |
| 1035 | 1035 | $original_item = $field; |
| 1036 | 1036 | } else { |
| 1037 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 1037 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | // Field options dialog box |
| 1041 | - $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 ); |
|
| 1041 | + $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 ); |
|
| 1042 | 1042 | |
| 1043 | 1043 | $item = array( |
| 1044 | 1044 | 'input_type' => $input_type, |
@@ -1051,12 +1051,12 @@ discard block |
||
| 1051 | 1051 | $item = wp_parse_args( $item, $original_item ); |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | - switch( $type ) { |
|
| 1054 | + switch ( $type ) { |
|
| 1055 | 1055 | case 'widget': |
| 1056 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 1056 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 1057 | 1057 | break; |
| 1058 | 1058 | default: |
| 1059 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
| 1059 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
| 1060 | 1060 | } |
| 1061 | 1061 | } |
| 1062 | 1062 | |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | <div class="gv-droppable-area-action"> |
| 1065 | 1065 | <a href="#" class="gv-add-field button button-link button-hero" title="" |
| 1066 | 1066 | data-objecttype="<?php echo esc_attr( $type ); ?>" |
| 1067 | - data-areaid="<?php echo esc_attr( $zone . '_' . $area['areaid'] ); ?>" |
|
| 1067 | + data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" |
|
| 1068 | 1068 | data-context="<?php echo esc_attr( $zone ); ?>" |
| 1069 | 1069 | data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '<span class="dashicons dashicons-plus-alt"></span>' . esc_html( $button_label ); ?></a> |
| 1070 | 1070 | </div> |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | // This is a new View, prefill the widgets |
| 1098 | 1098 | $widgets = array( |
| 1099 | 1099 | 'header_top' => array( |
| 1100 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
| 1100 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
| 1101 | 1101 | 'id' => 'search_bar', |
| 1102 | 1102 | 'label' => __( 'Search Bar', 'gravityview' ), |
| 1103 | 1103 | 'search_layout' => 'horizontal', |
@@ -1172,12 +1172,12 @@ discard block |
||
| 1172 | 1172 | if ( $post ) { |
| 1173 | 1173 | $source_form_id = gravityview_get_form_id( $post->ID ); |
| 1174 | 1174 | if ( $source_form_id ) { |
| 1175 | - $form_ids[] = $source_form_id; |
|
| 1175 | + $form_ids[ ] = $source_form_id; |
|
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | 1178 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
| 1179 | 1179 | foreach ( $joined_forms as $joined_form ) { |
| 1180 | - $form_ids[] = $joined_form->ID; |
|
| 1180 | + $form_ids[ ] = $joined_form->ID; |
|
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | 1183 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | * @return string HTML of the active areas |
| 1216 | 1216 | */ |
| 1217 | 1217 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 1218 | - if( empty( $template_id ) ) { |
|
| 1218 | + if ( empty( $template_id ) ) { |
|
| 1219 | 1219 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
| 1220 | 1220 | return ''; |
| 1221 | 1221 | } |
@@ -1229,12 +1229,12 @@ discard block |
||
| 1229 | 1229 | */ |
| 1230 | 1230 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 1231 | 1231 | |
| 1232 | - if( empty( $template_areas ) ) { |
|
| 1232 | + if ( empty( $template_areas ) ) { |
|
| 1233 | 1233 | |
| 1234 | 1234 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
| 1235 | 1235 | $output = '<div>'; |
| 1236 | - $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>'; |
|
| 1237 | - $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>'; |
|
| 1236 | + $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>'; |
|
| 1237 | + $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>'; |
|
| 1238 | 1238 | $output .= '</div>'; |
| 1239 | 1239 | } else { |
| 1240 | 1240 | |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | - if( $echo ) { |
|
| 1252 | + if ( $echo ) { |
|
| 1253 | 1253 | echo $output; |
| 1254 | 1254 | } |
| 1255 | 1255 | |
@@ -1277,18 +1277,18 @@ discard block |
||
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | 1279 | // Add the GV font (with the Astronaut) |
| 1280 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1280 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
| 1281 | 1281 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1282 | 1282 | |
| 1283 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1283 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1284 | 1284 | |
| 1285 | - if( GFForms::get_page() === 'form_list' ) { |
|
| 1285 | + if ( GFForms::get_page() === 'form_list' ) { |
|
| 1286 | 1286 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1287 | 1287 | return; |
| 1288 | 1288 | } |
| 1289 | 1289 | |
| 1290 | 1290 | // Don't process any scripts below here if it's not a GravityView page. |
| 1291 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1291 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1292 | 1292 | return; |
| 1293 | 1293 | } |
| 1294 | 1294 | |
@@ -1296,15 +1296,15 @@ discard block |
||
| 1296 | 1296 | |
| 1297 | 1297 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 1298 | 1298 | |
| 1299 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1299 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
| 1300 | 1300 | |
| 1301 | 1301 | // Enqueue scripts |
| 1302 | 1302 | 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 ); |
| 1303 | 1303 | |
| 1304 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1304 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1305 | 1305 | 'cookiepath' => COOKIEPATH, |
| 1306 | 1306 | 'admin_cookiepath' => ADMIN_COOKIE_PATH, |
| 1307 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1307 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
| 1308 | 1308 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1309 | 1309 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
| 1310 | 1310 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1320 | 1320 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1321 | 1321 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone?', 'gravityview' ), |
| 1322 | - )); |
|
| 1322 | + ) ); |
|
| 1323 | 1323 | |
| 1324 | 1324 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1325 | 1325 | |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | self::enqueue_gravity_forms_scripts(); |
| 1328 | 1328 | |
| 1329 | 1329 | // 2.5 changed how Merge Tags are enqueued |
| 1330 | - if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
|
| 1330 | + if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) { |
|
| 1331 | 1331 | GFCommon::output_hooks_javascript(); |
| 1332 | 1332 | } |
| 1333 | 1333 | } |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | ); |
| 1352 | 1352 | |
| 1353 | 1353 | if ( wp_is_mobile() ) { |
| 1354 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1354 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | wp_enqueue_script( $scripts ); |
@@ -7,4 +7,4 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $search_field = $gravityview_view->search_field; |
| 10 | -?><div><input type="hidden" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"></div> |
|
| 11 | 10 | \ No newline at end of file |
| 11 | +?><div><input type="hidden" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"></div> |
|
| 12 | 12 | \ No newline at end of file |