@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected $form_id; |
| 46 | 46 | |
| 47 | - function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null) { |
|
| 47 | + function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null ) { |
|
| 48 | 48 | |
| 49 | 49 | // Backward compat |
| 50 | - if ( ! empty( $item['type'] ) ) { |
|
| 51 | - $item['input_type'] = $item['type']; |
|
| 52 | - unset( $item['type'] ); |
|
| 50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 52 | + unset( $item[ 'type' ] ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Prevent items from not having index set |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->id = $item_id; |
| 72 | 72 | $this->form_id = $form_id; |
| 73 | 73 | $this->settings = $settings; |
| 74 | - $this->label_type = $item['label_type']; |
|
| 74 | + $this->label_type = $item[ 'label_type' ]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | if ( $html ) { |
| 115 | 115 | |
| 116 | 116 | foreach ( $field_info_items as $item ) { |
| 117 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
| 117 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 118 | 118 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 119 | 119 | $output .= '<span class="' . $class . '">'; |
| 120 | - $output .= esc_html( $item['value'] ); |
|
| 120 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 121 | 121 | $output .= '</span>'; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -145,29 +145,29 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 147 | 147 | // TODO: Un-hack this |
| 148 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 148 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 149 | 149 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
| 150 | 150 | |
| 151 | 151 | // Should we show the icon that the field is being used as a link to single entry? |
| 152 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 152 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 153 | 153 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
| 154 | 154 | |
| 155 | 155 | // When a field label is empty, use the Field ID |
| 156 | 156 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
| 157 | 157 | |
| 158 | 158 | // If there's a custom label, and show label is checked, use that as the field heading |
| 159 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
| 160 | - $label = $this->settings['custom_label']; |
|
| 161 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
| 162 | - $label = $this->item['customLabel']; |
|
| 159 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 160 | + $label = $this->settings[ 'custom_label' ]; |
|
| 161 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 162 | + $label = $this->item[ 'customLabel' ]; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
| 166 | 166 | |
| 167 | 167 | $label = esc_attr( $label ); |
| 168 | 168 | |
| 169 | - if ( ! empty( $this->item['parent'] ) ) { |
|
| 170 | - $label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
| 169 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 170 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // Name of field / widget |
@@ -183,10 +183,10 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $output .= '</h5>'; |
| 185 | 185 | |
| 186 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 187 | - $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 186 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 187 | + $data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 188 | 188 | |
| 189 | - $output = '<div data-fieldtype="' . esc_html($this->label_type) .'" data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
| 189 | + $output = '<div data-fieldtype="' . esc_html( $this->label_type ) . '" data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 190 | 190 | |
| 191 | 191 | return $output; |
| 192 | 192 | } |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | - do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 29 | + do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 30 | 30 | |
| 31 | - do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 31 | + do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 32 | 32 | |
| 33 | - do_action('gravityview_render_field_and_widget_options', 'directory' ); |
|
| 33 | + do_action('gravityview_render_field_and_widget_options', 'directory' ); |
|
| 34 | 34 | |
| 35 | - ?> |
|
| 35 | + ?> |
|
| 36 | 36 | |
| 37 | 37 | <?php // list of available widgets to be shown in the popup ?> |
| 38 | 38 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
@@ -57,16 +57,16 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | <div id="single-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
| 59 | 59 | <?php |
| 60 | - if(!empty( $curr_template ) ) { |
|
| 61 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 62 | - } |
|
| 63 | - ?> |
|
| 60 | + if(!empty( $curr_template ) ) { |
|
| 61 | + do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 62 | + } |
|
| 63 | + ?> |
|
| 64 | 64 | </div> |
| 65 | 65 | <?php |
| 66 | - do_action('gravityview_render_field_pickers', 'single' ); |
|
| 66 | + do_action('gravityview_render_field_pickers', 'single' ); |
|
| 67 | 67 | |
| 68 | - do_action('gravityview_render_field_and_widget_options', 'single' ); |
|
| 69 | - ?> |
|
| 68 | + do_action('gravityview_render_field_and_widget_options', 'single' ); |
|
| 69 | + ?> |
|
| 70 | 70 | </div> |
| 71 | 71 | |
| 72 | 72 | </div> <?php // end single view tab ?> |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | </div> |
| 85 | 85 | |
| 86 | 86 | <?php |
| 87 | - do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 87 | + do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 88 | 88 | |
| 89 | - do_action('gravityview_render_field_and_widget_options', 'edit' ); |
|
| 89 | + do_action('gravityview_render_field_and_widget_options', 'edit' ); |
|
| 90 | 90 | ?> |
| 91 | 91 | |
| 92 | 92 | </div> |
@@ -10,34 +10,34 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | <div id="directory-fields" class="gv-section"> |
| 12 | 12 | |
| 13 | - <h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview'); ?></span></h4> |
|
| 13 | + <h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview' ); ?></span></h4> |
|
| 14 | 14 | |
| 15 | - <?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
| 15 | + <?php do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?> |
|
| 16 | 16 | |
| 17 | - <h4><?php esc_html_e( 'Entries Fields', 'gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview'); ?></span></h4> |
|
| 17 | + <h4><?php esc_html_e( 'Entries Fields', 'gravityview' ); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview' ); ?></span></h4> |
|
| 18 | 18 | |
| 19 | 19 | <div id="directory-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
| 20 | - <?php if(!empty( $curr_template ) ) { |
|
| 21 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
| 20 | + <?php if ( ! empty( $curr_template ) ) { |
|
| 21 | + do_action( 'gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true ); |
|
| 22 | 22 | } ?> |
| 23 | 23 | </div> |
| 24 | 24 | |
| 25 | - <h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview'); ?></span></h4> |
|
| 25 | + <h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview' ); ?></span></h4> |
|
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | 28 | |
| 29 | - do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 29 | + do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID ); |
|
| 30 | 30 | |
| 31 | - do_action('gravityview_render_field_pickers', 'directory' ); |
|
| 31 | + do_action( 'gravityview_render_field_pickers', 'directory' ); |
|
| 32 | 32 | |
| 33 | - do_action('gravityview_render_field_and_widget_options', 'directory' ); |
|
| 33 | + do_action( 'gravityview_render_field_and_widget_options', 'directory' ); |
|
| 34 | 34 | |
| 35 | 35 | ?> |
| 36 | 36 | |
| 37 | 37 | <?php // list of available widgets to be shown in the popup ?> |
| 38 | 38 | <div id="directory-available-widgets" class="hide-if-js gv-tooltip"> |
| 39 | 39 | <span class="close"><i class="dashicons dashicons-dismiss"></i></span> |
| 40 | - <?php do_action('gravityview_render_available_widgets' ); ?> |
|
| 40 | + <?php do_action( 'gravityview_render_available_widgets' ); ?> |
|
| 41 | 41 | </div> |
| 42 | 42 | |
| 43 | 43 | </div> |
@@ -53,19 +53,19 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | <div id="single-fields" class="gv-section"> |
| 55 | 55 | |
| 56 | - <h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview'); ?></h4> |
|
| 56 | + <h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview' ); ?></h4> |
|
| 57 | 57 | |
| 58 | 58 | <div id="single-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
| 59 | 59 | <?php |
| 60 | - if(!empty( $curr_template ) ) { |
|
| 61 | - do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 60 | + if ( ! empty( $curr_template ) ) { |
|
| 61 | + do_action( 'gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true ); |
|
| 62 | 62 | } |
| 63 | 63 | ?> |
| 64 | 64 | </div> |
| 65 | 65 | <?php |
| 66 | - do_action('gravityview_render_field_pickers', 'single' ); |
|
| 66 | + do_action( 'gravityview_render_field_pickers', 'single' ); |
|
| 67 | 67 | |
| 68 | - do_action('gravityview_render_field_and_widget_options', 'single' ); |
|
| 68 | + do_action( 'gravityview_render_field_and_widget_options', 'single' ); |
|
| 69 | 69 | ?> |
| 70 | 70 | </div> |
| 71 | 71 | |
@@ -75,18 +75,18 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | <div id="edit-fields" class="gv-section"> |
| 77 | 77 | |
| 78 | - <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4> |
|
| 78 | + <h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview' ); ?> <span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gravityview' ); ?></span></h4> |
|
| 79 | 79 | |
| 80 | 80 | <div id="edit-active-fields" class="gv-grid gv-grid-pad gv-grid-border"> |
| 81 | 81 | <?php |
| 82 | - do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
| 82 | + do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true ); |
|
| 83 | 83 | ?> |
| 84 | 84 | </div> |
| 85 | 85 | |
| 86 | 86 | <?php |
| 87 | - do_action('gravityview_render_field_pickers', 'edit' ); |
|
| 87 | + do_action( 'gravityview_render_field_pickers', 'edit' ); |
|
| 88 | 88 | |
| 89 | - do_action('gravityview_render_field_and_widget_options', 'edit' ); |
|
| 89 | + do_action( 'gravityview_render_field_and_widget_options', 'edit' ); |
|
| 90 | 90 | ?> |
| 91 | 91 | |
| 92 | 92 | </div> |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | 68 | // Return options to be used with table/DataTables |
| 69 | - $field_options['table'] = array( |
|
| 69 | + $field_options[ 'table' ] = array( |
|
| 70 | 70 | 'width' => array( |
| 71 | 71 | 'type' => 'number', |
| 72 | 72 | 'label' => __( 'Percent Width', 'gravityview' ), |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | 'manage_options' => __( 'Administrator', 'gravityview' ), |
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | - if( is_multisite() ) { |
|
| 142 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
| 141 | + if ( is_multisite() ) { |
|
| 142 | + $select_cap_choices[ 'manage_network' ] = __( 'Multisite Super Admin', 'gravityview' ); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
| 153 | 153 | * @param string $input_type Optional. (textarea, list, select, etc.) |
| 154 | 154 | */ |
| 155 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 155 | + $select_cap_choices = apply_filters( 'gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
| 156 | 156 | |
| 157 | 157 | return $select_cap_choices; |
| 158 | 158 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | $value = isset( $field_data[ $key ] ) ? $field_data[ $key ] : null; |
| 216 | 216 | |
| 217 | - $option['id'] = isset( $option['id'] ) ? $option['id'] : $name_prefix . '[' . $key . ']'; |
|
| 217 | + $option[ 'id' ] = isset( $option[ 'id' ] ) ? $option[ 'id' ] : $name_prefix . '[' . $key . ']'; |
|
| 218 | 218 | |
| 219 | 219 | $field_output = self::render_field_option( $name_prefix . '[' . $key . ']', $option, $value ); |
| 220 | 220 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | continue; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - switch ( $option['type'] ) { |
|
| 226 | + switch ( $option[ 'type' ] ) { |
|
| 227 | 227 | // Hide hidden fields |
| 228 | 228 | case 'hidden': |
| 229 | 229 | $output .= '<div class="gv-setting-container gv-setting-container-' . esc_attr( $key ) . ' screen-reader-text">' . $field_output . '</div>'; |
@@ -278,17 +278,17 @@ discard block |
||
| 278 | 278 | * @deprecated setting index 'default' was replaced by 'value' |
| 279 | 279 | * @see GravityView_FieldType::get_field_defaults |
| 280 | 280 | */ |
| 281 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
| 282 | - $option['value'] = $option['default']; |
|
| 283 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
| 281 | + if ( ! empty( $option[ 'default' ] ) && empty( $option[ 'value' ] ) ) { |
|
| 282 | + $option[ 'value' ] = $option[ 'default' ]; |
|
| 283 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting ' . $name . ' details' ); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // prepare to render option field type |
| 287 | - if( isset( $option['type'] ) ) { |
|
| 287 | + if ( isset( $option[ 'type' ] ) ) { |
|
| 288 | 288 | |
| 289 | 289 | $type_class = self::load_type_class( $option ); |
| 290 | 290 | |
| 291 | - if( class_exists( $type_class ) ) { |
|
| 291 | + if ( class_exists( $type_class ) ) { |
|
| 292 | 292 | |
| 293 | 293 | /** @var GravityView_FieldType $render_type */ |
| 294 | 294 | $render_type = new $type_class( $name, $option, $curr_value ); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | * @param[in,out] string $output field class name |
| 306 | 306 | * @param[in] array $option option field data |
| 307 | 307 | */ |
| 308 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
| 308 | + $output = apply_filters( "gravityview/option/output/{$option[ 'type' ]}", $output, $option ); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | } // isset option[type] |
@@ -340,27 +340,27 @@ discard block |
||
| 340 | 340 | * @deprecated setting index 'name' was replaced by 'label' |
| 341 | 341 | * @see GravityView_FieldType::get_field_defaults |
| 342 | 342 | */ |
| 343 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
| 344 | - $setting['label'] = $setting['name']; |
|
| 345 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
| 343 | + if ( isset( $setting[ 'name' ] ) && empty( $setting[ 'label' ] ) ) { |
|
| 344 | + $setting[ 'label' ] = $setting[ 'name' ]; |
|
| 345 | + _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting ' . $key . ' details' ); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | $name = esc_attr( sprintf( $name, $key ) ); |
| 349 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
| 350 | - $setting['tooltip'] = 'gv_' . $key; |
|
| 349 | + $setting[ 'id' ] = esc_attr( sprintf( $id, $key ) ); |
|
| 350 | + $setting[ 'tooltip' ] = 'gv_' . $key; |
|
| 351 | 351 | |
| 352 | 352 | // Use default if current setting isn't set. |
| 353 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
| 353 | + $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting[ 'value' ]; |
|
| 354 | 354 | |
| 355 | 355 | // default setting type = text |
| 356 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
| 356 | + $setting[ 'type' ] = empty( $setting[ 'type' ] ) ? 'text' : $setting[ 'type' ]; |
|
| 357 | 357 | |
| 358 | 358 | // merge tags |
| 359 | - if( !isset( $setting['merge_tags'] ) ) { |
|
| 360 | - if( $setting['type'] === 'text' ) { |
|
| 361 | - $setting['merge_tags'] = true; |
|
| 359 | + if ( ! isset( $setting[ 'merge_tags' ] ) ) { |
|
| 360 | + if ( $setting[ 'type' ] === 'text' ) { |
|
| 361 | + $setting[ 'merge_tags' ] = true; |
|
| 362 | 362 | } else { |
| 363 | - $setting['merge_tags'] = false; |
|
| 363 | + $setting[ 'merge_tags' ] = false; |
|
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | // render the setting |
| 370 | 370 | $type_class = self::load_type_class( $setting ); |
| 371 | - if( class_exists( $type_class ) ) { |
|
| 371 | + if ( class_exists( $type_class ) ) { |
|
| 372 | 372 | /** @var GravityView_FieldType $render_type */ |
| 373 | 373 | $render_type = new $type_class( $name, $setting, $curr_value ); |
| 374 | 374 | ob_start(); |
@@ -377,21 +377,21 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // Check if setting is specific for a template |
| 380 | - if( !empty( $setting['show_in_template'] ) ) { |
|
| 381 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
| 382 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
| 380 | + if ( ! empty( $setting[ 'show_in_template' ] ) ) { |
|
| 381 | + if ( ! is_array( $setting[ 'show_in_template' ] ) ) { |
|
| 382 | + $setting[ 'show_in_template' ] = array( $setting[ 'show_in_template' ] ); |
|
| 383 | 383 | } |
| 384 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
| 384 | + $show_if = ' data-show-if="' . implode( ' ', $setting[ 'show_in_template' ] ) . '"'; |
|
| 385 | 385 | } else { |
| 386 | 386 | $show_if = ''; |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - if( ! empty( $setting['requires'] ) ) { |
|
| 390 | - $show_if .= sprintf( ' data-requires="%s"', $setting['requires'] ); |
|
| 389 | + if ( ! empty( $setting[ 'requires' ] ) ) { |
|
| 390 | + $show_if .= sprintf( ' data-requires="%s"', $setting[ 'requires' ] ); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | // output |
| 394 | - echo '<tr valign="top" '. $show_if .'>' . $output . '</tr>'; |
|
| 394 | + echo '<tr valign="top" ' . $show_if . '>' . $output . '</tr>'; |
|
| 395 | 395 | |
| 396 | 396 | } |
| 397 | 397 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public static function load_type_class( $field = NULL ) { |
| 405 | 405 | |
| 406 | - if( empty( $field['type'] ) ) { |
|
| 406 | + if ( empty( $field[ 'type' ] ) ) { |
|
| 407 | 407 | return NULL; |
| 408 | 408 | } |
| 409 | 409 | |
@@ -412,19 +412,19 @@ discard block |
||
| 412 | 412 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
| 413 | 413 | * @param array $field field data |
| 414 | 414 | */ |
| 415 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
| 415 | + $type_class = apply_filters( "gravityview/setting/class/{$field[ 'type' ]}", 'GravityView_FieldType_' . $field[ 'type' ], $field ); |
|
| 416 | 416 | |
| 417 | - if( !class_exists( $type_class ) ) { |
|
| 417 | + if ( ! class_exists( $type_class ) ) { |
|
| 418 | 418 | |
| 419 | 419 | /** |
| 420 | 420 | * @filter `gravityview/setting/class_file/{field_type}` |
| 421 | 421 | * @param string $field_type_include_path field class file path |
| 422 | 422 | * @param array $field field data |
| 423 | 423 | */ |
| 424 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
| 424 | + $class_file = apply_filters( "gravityview/setting/class_file/{$field[ 'type' ]}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field[ 'type' ]}.php", $field ); |
|
| 425 | 425 | |
| 426 | - if( $class_file ) { |
|
| 427 | - if( file_exists( $class_file ) ) { |
|
| 426 | + if ( $class_file ) { |
|
| 427 | + if ( file_exists( $class_file ) ) { |
|
| 428 | 428 | require_once( $class_file ); |
| 429 | 429 | } |
| 430 | 430 | } |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_checkbox::render_input' ); |
| 451 | 451 | |
| 452 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
| 453 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
| 452 | + $output = '<input name="' . esc_attr( $name ) . '" type="hidden" value="0">'; |
|
| 453 | + $output .= '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="checkbox" value="1" ' . checked( $current, '1', false ) . ' >'; |
|
| 454 | 454 | |
| 455 | 455 | return $output; |
| 456 | 456 | } |
@@ -470,22 +470,22 @@ discard block |
||
| 470 | 470 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_text::render_input' ); |
| 471 | 471 | |
| 472 | 472 | // Show the merge tags if the field is a list view |
| 473 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 473 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 474 | 474 | |
| 475 | 475 | // Or is a single entry view |
| 476 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 476 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 477 | 477 | $show = ( $is_single || $is_list ); |
| 478 | 478 | |
| 479 | 479 | $class = ''; |
| 480 | 480 | // and $add_merge_tags is not false |
| 481 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 481 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 482 | 482 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
| 486 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
| 485 | + $class .= ! empty( $args[ 'class' ] ) ? $args[ 'class' ] : 'widefat'; |
|
| 486 | + $type = ! empty( $args[ 'type' ] ) ? $args[ 'type' ] : 'text'; |
|
| 487 | 487 | |
| 488 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
| 488 | + return '<input name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" type="' . esc_attr( $type ) . '" value="' . esc_attr( $current ) . '" class="' . esc_attr( $class ) . '">'; |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | /** |
@@ -502,21 +502,21 @@ discard block |
||
| 502 | 502 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_textarea::render_input' ); |
| 503 | 503 | |
| 504 | 504 | // Show the merge tags if the field is a list view |
| 505 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
| 505 | + $is_list = ( preg_match( '/_list-/ism', $name ) ); |
|
| 506 | 506 | |
| 507 | 507 | // Or is a single entry view |
| 508 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
| 508 | + $is_single = ( preg_match( '/single_/ism', $name ) ); |
|
| 509 | 509 | $show = ( $is_single || $is_list ); |
| 510 | 510 | |
| 511 | 511 | $class = ''; |
| 512 | 512 | // and $add_merge_tags is not false |
| 513 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 513 | + if ( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
| 514 | 514 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
| 517 | + $class .= ! empty( $args[ 'class' ] ) ? 'widefat ' . $args[ 'class' ] : 'widefat'; |
|
| 518 | 518 | |
| 519 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
| 519 | + return '<textarea name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '">' . esc_textarea( $current ) . '</textarea>'; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | /** |
@@ -532,9 +532,9 @@ discard block |
||
| 532 | 532 | |
| 533 | 533 | _deprecated_function( __METHOD__, '1.2', 'GravityView_FieldType_select::render_input' ); |
| 534 | 534 | |
| 535 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
| 536 | - foreach( $choices as $value => $label ) { |
|
| 537 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
| 535 | + $output = '<select name="' . $name . '" id="' . $id . '">'; |
|
| 536 | + foreach ( $choices as $value => $label ) { |
|
| 537 | + $output .= '<option value="' . esc_attr( $value ) . '" ' . selected( $value, $current, false ) . '>' . esc_html( $label ) . '</option>'; |
|
| 538 | 538 | } |
| 539 | 539 | $output .= '</select>'; |
| 540 | 540 | |
@@ -61,28 +61,28 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 65 | - * |
|
| 64 | + * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 65 | + * |
|
| 66 | 66 | * @param array $localization_data Data to be passed to the Support Port JS |
| 67 | 67 | * |
| 68 | 68 | * @return array |
| 69 | 69 | */ |
| 70 | 70 | function suggest_support_articles( $localization_data = array() ) { |
| 71 | 71 | |
| 72 | - if( ! gravityview()->request->is_view() ) { |
|
| 73 | - return $localization_data; |
|
| 74 | - } |
|
| 72 | + if( ! gravityview()->request->is_view() ) { |
|
| 73 | + return $localization_data; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | $localization_data['suggest'] = array( |
| 77 | - '57ef23539033602e61d4a560', |
|
| 78 | - '54c67bb9e4b0512429885513', |
|
| 79 | - '54c67bb9e4b0512429885512', |
|
| 80 | - '54c67bbbe4b07997ea3f3f6b', |
|
| 81 | - '54d1a33ae4b086c0c0964ce9', |
|
| 82 | - '57ef253c9033602e61d4a563', |
|
| 83 | - '552355bfe4b0221aadf2572b', |
|
| 84 | - '54c67bcde4b051242988553e', |
|
| 85 | - ); |
|
| 77 | + '57ef23539033602e61d4a560', |
|
| 78 | + '54c67bb9e4b0512429885513', |
|
| 79 | + '54c67bb9e4b0512429885512', |
|
| 80 | + '54c67bbbe4b07997ea3f3f6b', |
|
| 81 | + '54d1a33ae4b086c0c0964ce9', |
|
| 82 | + '57ef253c9033602e61d4a563', |
|
| 83 | + '552355bfe4b0221aadf2572b', |
|
| 84 | + '54c67bcde4b051242988553e', |
|
| 85 | + ); |
|
| 86 | 86 | |
| 87 | 87 | return $localization_data; |
| 88 | 88 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | if( empty( $connected_views ) ) { |
| 168 | 168 | |
| 169 | - $menu_items['gravityview'] = array( |
|
| 169 | + $menu_items['gravityview'] = array( |
|
| 170 | 170 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 171 | 171 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 172 | 172 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | // If there were no items added, then let's create the parent menu |
| 198 | 198 | if( $sub_menu_items ) { |
| 199 | 199 | |
| 200 | - $sub_menu_items[] = array( |
|
| 201 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 202 | - 'link_class' => 'gv-create-view', |
|
| 203 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 204 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 205 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
| 206 | - ); |
|
| 200 | + $sub_menu_items[] = array( |
|
| 201 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 202 | + 'link_class' => 'gv-create-view', |
|
| 203 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 204 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 205 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
| 206 | + ); |
|
| 207 | 207 | |
| 208 | 208 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 209 | 209 | $sub_menu_items[] = array( |
@@ -587,12 +587,12 @@ discard block |
||
| 587 | 587 | * Render html for displaying available fields based on a Form ID |
| 588 | 588 | * $blacklist_field_types - contains the field types which are not proper to be shown in a directory. |
| 589 | 589 | * |
| 590 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 590 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 591 | 591 | * @access public |
| 592 | - * |
|
| 592 | + * |
|
| 593 | 593 | * @param int $form Gravity Forms Form ID (default: '') |
| 594 | 594 | * @param string $context (default: 'single') |
| 595 | - * |
|
| 595 | + * |
|
| 596 | 596 | * @return void |
| 597 | 597 | */ |
| 598 | 598 | function render_available_fields( $form = 0, $context = 'single' ) { |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | |
| 607 | 607 | if ( ! is_array( $blacklist_field_types ) ) { |
| 608 | 608 | |
| 609 | - gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
| 609 | + gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
| 610 | 610 | |
| 611 | 611 | $blacklist_field_types = array(); |
| 612 | 612 | } |
@@ -737,12 +737,12 @@ discard block |
||
| 737 | 737 | /** |
| 738 | 738 | * @since 1.7.2 |
| 739 | 739 | */ |
| 740 | - 'other_entries' => array( |
|
| 741 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 742 | - 'type' => 'other_entries', |
|
| 743 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 744 | - ), |
|
| 745 | - ); |
|
| 740 | + 'other_entries' => array( |
|
| 741 | + 'label' => __('Other Entries', 'gravityview'), |
|
| 742 | + 'type' => 'other_entries', |
|
| 743 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 744 | + ), |
|
| 745 | + ); |
|
| 746 | 746 | |
| 747 | 747 | if( 'single' !== $zone) { |
| 748 | 748 | |
@@ -875,9 +875,9 @@ discard block |
||
| 875 | 875 | |
| 876 | 876 | $joined_forms = gravityview_get_joined_forms( $post->ID ); |
| 877 | 877 | |
| 878 | - foreach ( $joined_forms as $form ) { |
|
| 879 | - $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 880 | - } |
|
| 878 | + foreach ( $joined_forms as $form ) { |
|
| 879 | + $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 880 | + } |
|
| 881 | 881 | } else { |
| 882 | 882 | $available_items[ $form ] = $this->get_registered_widgets(); |
| 883 | 883 | } |
@@ -906,9 +906,9 @@ discard block |
||
| 906 | 906 | |
| 907 | 907 | if ( $form_id ) { |
| 908 | 908 | $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
| 909 | - } else { |
|
| 909 | + } else { |
|
| 910 | 910 | $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
| 911 | - } |
|
| 911 | + } |
|
| 912 | 912 | |
| 913 | 913 | if ( !$original_item ) { |
| 914 | 914 | 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 ) ) ); |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | // Field options dialog box |
| 922 | - $field_identifier = ('widget' === $type) ? $field['id'] : $input_type; |
|
| 922 | + $field_identifier = ('widget' === $type) ? $field['id'] : $input_type; |
|
| 923 | 923 | $field_options = GravityView_Render_Settings::render_field_and_widget_options( $type, $field_identifier, $field); |
| 924 | 924 | |
| 925 | 925 | $item = array( |
@@ -1000,12 +1000,12 @@ discard block |
||
| 1000 | 1000 | |
| 1001 | 1001 | function render_field_and_widget_options() { |
| 1002 | 1002 | |
| 1003 | - // render widgets templates |
|
| 1004 | - $widgets = \GV\Widget::registered(); |
|
| 1003 | + // render widgets templates |
|
| 1004 | + $widgets = \GV\Widget::registered(); |
|
| 1005 | 1005 | |
| 1006 | - foreach ($widgets as $widget_identifier => $data) { |
|
| 1007 | - echo GravityView_Render_Settings::render_field_and_widget_options( 'widget', $widget_identifier); |
|
| 1008 | - } |
|
| 1006 | + foreach ($widgets as $widget_identifier => $data) { |
|
| 1007 | + echo GravityView_Render_Settings::render_field_and_widget_options( 'widget', $widget_identifier); |
|
| 1008 | + } |
|
| 1009 | 1009 | |
| 1010 | 1010 | // render fields templates |
| 1011 | 1011 | $forms = gravityview_get_forms( 'any' ); |
@@ -1023,13 +1023,13 @@ discard block |
||
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | /** |
| 1026 | - * Renders "Add Field" tooltips |
|
| 1027 | - * |
|
| 1028 | - * @since 2.0.11 |
|
| 1029 | - * |
|
| 1026 | + * Renders "Add Field" tooltips |
|
| 1027 | + * |
|
| 1028 | + * @since 2.0.11 |
|
| 1029 | + * |
|
| 1030 | 1030 | * @param string $context "directory", "single", or "edit" |
| 1031 | - * |
|
| 1032 | - * @return void |
|
| 1031 | + * |
|
| 1032 | + * @return void |
|
| 1033 | 1033 | */ |
| 1034 | 1034 | function render_field_pickers( $context = 'directory' ) { |
| 1035 | 1035 | |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | </div> |
| 1057 | 1057 | <?php |
| 1058 | 1058 | } |
| 1059 | - } |
|
| 1059 | + } |
|
| 1060 | 1060 | |
| 1061 | 1061 | /** |
| 1062 | 1062 | * Render the Template Active Areas and configured active fields for a given template id and post id |
@@ -1128,59 +1128,59 @@ discard block |
||
| 1128 | 1128 | |
| 1129 | 1129 | // Don't process any scripts below here if it's not a GravityView page. |
| 1130 | 1130 | if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
| 1131 | - return; |
|
| 1131 | + return; |
|
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1135 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 1136 | - |
|
| 1137 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1138 | - |
|
| 1139 | - //enqueue scripts |
|
| 1140 | - wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
|
| 1141 | - |
|
| 1142 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1143 | - 'cookiepath' => COOKIEPATH, |
|
| 1144 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1145 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1146 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1147 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1148 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1149 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1150 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1151 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1152 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1153 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1154 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1155 | - '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' ), |
|
| 1156 | - )); |
|
| 1157 | - |
|
| 1158 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1159 | - |
|
| 1160 | - // Enqueue scripts needed for merge tags |
|
| 1161 | - self::enqueue_gravity_forms_scripts(); |
|
| 1134 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1135 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 1136 | + |
|
| 1137 | + $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1138 | + |
|
| 1139 | + //enqueue scripts |
|
| 1140 | + wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
|
| 1141 | + |
|
| 1142 | + wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1143 | + 'cookiepath' => COOKIEPATH, |
|
| 1144 | + 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1145 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1146 | + 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1147 | + 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1148 | + 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1149 | + 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1150 | + 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1151 | + 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1152 | + 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1153 | + 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1154 | + 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1155 | + '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' ), |
|
| 1156 | + )); |
|
| 1157 | + |
|
| 1158 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1159 | + |
|
| 1160 | + // Enqueue scripts needed for merge tags |
|
| 1161 | + self::enqueue_gravity_forms_scripts(); |
|
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | 1164 | /** |
| 1165 | 1165 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
| 1166 | - * |
|
| 1167 | - * @since 1.0.5-beta |
|
| 1168 | - * |
|
| 1169 | - * @return void |
|
| 1166 | + * |
|
| 1167 | + * @since 1.0.5-beta |
|
| 1168 | + * |
|
| 1169 | + * @return void |
|
| 1170 | 1170 | */ |
| 1171 | 1171 | static function enqueue_gravity_forms_scripts() { |
| 1172 | 1172 | GFForms::register_scripts(); |
| 1173 | 1173 | |
| 1174 | 1174 | $scripts = array( |
| 1175 | - 'sack', |
|
| 1176 | - 'gform_gravityforms', |
|
| 1177 | - 'gform_forms', |
|
| 1178 | - 'gform_form_admin', |
|
| 1179 | - 'jquery-ui-autocomplete' |
|
| 1175 | + 'sack', |
|
| 1176 | + 'gform_gravityforms', |
|
| 1177 | + 'gform_forms', |
|
| 1178 | + 'gform_form_admin', |
|
| 1179 | + 'jquery-ui-autocomplete' |
|
| 1180 | 1180 | ); |
| 1181 | 1181 | |
| 1182 | 1182 | if ( wp_is_mobile() ) { |
| 1183 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1183 | + $scripts[] = 'jquery-touch-punch'; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | wp_enqueue_script( $scripts ); |
@@ -28,29 +28,29 @@ discard block |
||
| 28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 29 | 29 | |
| 30 | 30 | // Tooltips |
| 31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 32 | 32 | |
| 33 | 33 | // adding styles and scripts |
| 34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 39 | - |
|
| 40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 42 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers') ); |
|
| 43 | - add_action( 'gravityview_render_field_and_widget_options', array( $this, 'render_field_and_widget_options') ); |
|
| 44 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 45 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 46 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 39 | + |
|
| 40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 42 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ) ); |
|
| 43 | + add_action( 'gravityview_render_field_and_widget_options', array( $this, 'render_field_and_widget_options' ) ); |
|
| 44 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 45 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 46 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 47 | 47 | |
| 48 | 48 | // Add Connected Form column |
| 49 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 49 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 50 | 50 | |
| 51 | 51 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 52 | 52 | |
| 53 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 53 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 54 | 54 | |
| 55 | 55 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 56 | 56 | |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | function suggest_support_articles( $localization_data = array() ) { |
| 71 | 71 | |
| 72 | - if( ! gravityview()->request->is_view() ) { |
|
| 72 | + if ( ! gravityview()->request->is_view() ) { |
|
| 73 | 73 | return $localization_data; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $localization_data['suggest'] = array( |
|
| 76 | + $localization_data[ 'suggest' ] = array( |
|
| 77 | 77 | '57ef23539033602e61d4a560', |
| 78 | 78 | '54c67bb9e4b0512429885513', |
| 79 | 79 | '54c67bb9e4b0512429885512', |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 95 | 95 | global $pagenow; |
| 96 | 96 | |
| 97 | - if ( !is_admin() ) { |
|
| 97 | + if ( ! is_admin() ) { |
|
| 98 | 98 | return; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false; |
|
| 101 | + $form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false; |
|
| 102 | 102 | |
| 103 | - if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 103 | + if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -117,18 +117,18 @@ discard block |
||
| 117 | 117 | function add_view_dropdown() { |
| 118 | 118 | $current_screen = get_current_screen(); |
| 119 | 119 | |
| 120 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 120 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $forms = gravityview_get_forms(); |
| 125 | 125 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
| 126 | 126 | // If there are no forms to select, show no forms. |
| 127 | - if( !empty( $forms ) ) { ?> |
|
| 127 | + if ( ! empty( $forms ) ) { ?> |
|
| 128 | 128 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 129 | 129 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 130 | - <?php foreach( $forms as $form ) { ?> |
|
| 131 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 130 | + <?php foreach ( $forms as $form ) { ?> |
|
| 131 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 132 | 132 | <?php } ?> |
| 133 | 133 | </select> |
| 134 | 134 | <?php } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 143 | 143 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 144 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 144 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $connected_views = gravityview_get_connected_views( $id, array( 'post_status' => 'any' ) ); |
| 166 | 166 | |
| 167 | - if( empty( $connected_views ) ) { |
|
| 167 | + if ( empty( $connected_views ) ) { |
|
| 168 | 168 | |
| 169 | - $menu_items['gravityview'] = array( |
|
| 169 | + $menu_items[ 'gravityview' ] = array( |
|
| 170 | 170 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 171 | 171 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 172 | 172 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -182,22 +182,22 @@ discard block |
||
| 182 | 182 | $sub_menu_items = array(); |
| 183 | 183 | foreach ( (array)$connected_views as $view ) { |
| 184 | 184 | |
| 185 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 185 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 186 | 186 | continue; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 189 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 190 | 190 | |
| 191 | - $sub_menu_items[] = array( |
|
| 191 | + $sub_menu_items[ ] = array( |
|
| 192 | 192 | 'label' => esc_attr( $label ), |
| 193 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 193 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 194 | 194 | ); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // If there were no items added, then let's create the parent menu |
| 198 | - if( $sub_menu_items ) { |
|
| 198 | + if ( $sub_menu_items ) { |
|
| 199 | 199 | |
| 200 | - $sub_menu_items[] = array( |
|
| 200 | + $sub_menu_items[ ] = array( |
|
| 201 | 201 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 202 | 202 | 'link_class' => 'gv-create-view', |
| 203 | 203 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | 208 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 209 | - $sub_menu_items[] = array( |
|
| 209 | + $sub_menu_items[ ] = array( |
|
| 210 | 210 | 'url' => '#', |
| 211 | 211 | 'label' => '', |
| 212 | 212 | 'menu_class' => 'hidden', |
| 213 | 213 | 'capabilities' => '', |
| 214 | 214 | ); |
| 215 | 215 | |
| 216 | - $menu_items['gravityview'] = array( |
|
| 216 | + $menu_items[ 'gravityview' ] = array( |
|
| 217 | 217 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 218 | 218 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 219 | 219 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | $add = array( 'captcha', 'page' ); |
| 243 | 243 | |
| 244 | 244 | // Don't allowing editing the following values: |
| 245 | - if( $context === 'edit' ) { |
|
| 246 | - $add[] = 'post_id'; |
|
| 245 | + if ( $context === 'edit' ) { |
|
| 246 | + $add[ ] = 'post_id'; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $return = array_merge( $array, $add ); |
@@ -266,32 +266,32 @@ discard block |
||
| 266 | 266 | foreach ( $default_args as $key => $arg ) { |
| 267 | 267 | |
| 268 | 268 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 269 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 269 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 270 | 270 | |
| 271 | 271 | // By default, use `tooltip` if defined. |
| 272 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 272 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 273 | 273 | |
| 274 | 274 | // Otherwise, use the description as a tooltip. |
| 275 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 276 | - $tooltip = $arg['desc']; |
|
| 275 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 276 | + $tooltip = $arg[ 'desc' ]; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // If there's no tooltip set, continue |
| 280 | - if( empty( $tooltip ) ) { |
|
| 280 | + if ( empty( $tooltip ) ) { |
|
| 281 | 281 | continue; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | // Add the tooltip |
| 285 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 286 | - 'title' => $arg['label'], |
|
| 285 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 286 | + 'title' => $arg[ 'label' ], |
|
| 287 | 287 | 'value' => $tooltip, |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 293 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 294 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 292 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 293 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 294 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 295 | 295 | ); |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -309,9 +309,9 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 311 | 311 | |
| 312 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 312 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 313 | 313 | |
| 314 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 314 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | return $tooltips; |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | * |
| 326 | 326 | * @return void |
| 327 | 327 | */ |
| 328 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 328 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 329 | 329 | |
| 330 | 330 | $output = ''; |
| 331 | 331 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 348 | 348 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 349 | 349 | |
| 350 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 350 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 351 | 351 | |
| 352 | 352 | break; |
| 353 | 353 | |
@@ -388,44 +388,44 @@ discard block |
||
| 388 | 388 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 389 | 389 | |
| 390 | 390 | // Either the form is empty or the form ID is 0, not yet set. |
| 391 | - if( empty( $form ) ) { |
|
| 391 | + if ( empty( $form ) ) { |
|
| 392 | 392 | return ''; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | // The $form is passed as the form ID |
| 396 | - if( !is_array( $form ) ) { |
|
| 396 | + if ( ! is_array( $form ) ) { |
|
| 397 | 397 | $form = gravityview_get_form( $form ); |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - $form_id = $form['id']; |
|
| 400 | + $form_id = $form[ 'id' ]; |
|
| 401 | 401 | $links = array(); |
| 402 | 402 | |
| 403 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 403 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 404 | 404 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 405 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 406 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 405 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 406 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 407 | 407 | } else { |
| 408 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 408 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 411 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 412 | 412 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 413 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 413 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 416 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 417 | 417 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 418 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 418 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 421 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 422 | 422 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 423 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 423 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | $output = ''; |
| 427 | 427 | |
| 428 | - if( !empty( $include_form_link ) ) { |
|
| 428 | + if ( ! empty( $include_form_link ) ) { |
|
| 429 | 429 | $output .= $form_link; |
| 430 | 430 | } |
| 431 | 431 | |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 439 | 439 | |
| 440 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 440 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 441 | 441 | |
| 442 | 442 | return $output; |
| 443 | 443 | } |
@@ -451,8 +451,8 @@ discard block |
||
| 451 | 451 | // Get the date column and save it for later to add back in. |
| 452 | 452 | // This adds it after the Data Source column. |
| 453 | 453 | // This way, we don't need to do array_slice, array_merge, etc. |
| 454 | - $date = $columns['date']; |
|
| 455 | - unset( $columns['date'] ); |
|
| 454 | + $date = $columns[ 'date' ]; |
|
| 455 | + unset( $columns[ 'date' ] ); |
|
| 456 | 456 | |
| 457 | 457 | $data_source_required_caps = array( |
| 458 | 458 | 'gravityforms_edit_forms', |
@@ -463,14 +463,14 @@ discard block |
||
| 463 | 463 | 'gravityforms_preview_forms', |
| 464 | 464 | ); |
| 465 | 465 | |
| 466 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 467 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 466 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 467 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 470 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 471 | 471 | |
| 472 | 472 | // Add the date back in. |
| 473 | - $columns['date'] = $date; |
|
| 473 | + $columns[ 'date' ] = $date; |
|
| 474 | 474 | |
| 475 | 475 | return $columns; |
| 476 | 476 | } |
@@ -484,12 +484,12 @@ discard block |
||
| 484 | 484 | */ |
| 485 | 485 | function save_postdata( $post_id ) { |
| 486 | 486 | |
| 487 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 487 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 488 | 488 | return; |
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | // validate post_type |
| 492 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 492 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 493 | 493 | return; |
| 494 | 494 | } |
| 495 | 495 | |
@@ -504,64 +504,64 @@ discard block |
||
| 504 | 504 | $statii = array(); |
| 505 | 505 | |
| 506 | 506 | // check if this is a start fresh View |
| 507 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 507 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 508 | 508 | |
| 509 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 509 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 510 | 510 | // save form id |
| 511 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 511 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 512 | 512 | |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 515 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 516 | 516 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
| 517 | 517 | return; |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | // Was this a start fresh? |
| 521 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 522 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 521 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 522 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 523 | 523 | } else { |
| 524 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 524 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | // Check if we have a template id |
| 528 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 528 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 529 | 529 | |
| 530 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 530 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 531 | 531 | |
| 532 | 532 | // now save template id |
| 533 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 533 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | |
| 537 | 537 | // save View Configuration metabox |
| 538 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 538 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 539 | 539 | |
| 540 | 540 | // template settings |
| 541 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 542 | - $_POST['template_settings'] = array(); |
|
| 541 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 542 | + $_POST[ 'template_settings' ] = array(); |
|
| 543 | 543 | } |
| 544 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 544 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 545 | 545 | |
| 546 | 546 | $fields = array(); |
| 547 | 547 | |
| 548 | 548 | // Directory&single Visible Fields |
| 549 | - if( !empty( $preset_fields ) ) { |
|
| 549 | + if ( ! empty( $preset_fields ) ) { |
|
| 550 | 550 | |
| 551 | 551 | $fields = $preset_fields; |
| 552 | 552 | |
| 553 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
| 553 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 554 | 554 | $fields = _gravityview_process_posted_fields(); |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | $fields = map_deep( $fields, 'addslashes' ); |
| 558 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 558 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 559 | 559 | |
| 560 | 560 | // Directory Visible Widgets |
| 561 | - if( empty( $_POST['widgets'] ) ) { |
|
| 562 | - $_POST['widgets'] = array(); |
|
| 561 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 562 | + $_POST[ 'widgets' ] = array(); |
|
| 563 | 563 | } |
| 564 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
| 564 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
| 565 | 565 | |
| 566 | 566 | } // end save view configuration |
| 567 | 567 | |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | * @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. |
| 572 | 572 | * @since 1.17.2 |
| 573 | 573 | */ |
| 574 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 574 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 575 | 575 | |
| 576 | 576 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
| 577 | 577 | } |
@@ -614,20 +614,20 @@ discard block |
||
| 614 | 614 | $fields = $this->get_available_fields( $form, $context ); |
| 615 | 615 | |
| 616 | 616 | $output = ''; |
| 617 | - if( !empty( $fields ) ) { |
|
| 617 | + if ( ! empty( $fields ) ) { |
|
| 618 | 618 | |
| 619 | - foreach( $fields as $id => $details ) { |
|
| 619 | + foreach ( $fields as $id => $details ) { |
|
| 620 | 620 | |
| 621 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
| 621 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
| 622 | 622 | continue; |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | // Edit mode only allows editing the parent fields, not single inputs. |
| 626 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
| 626 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 627 | 627 | continue; |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, $settings = array(), $form ); |
|
| 630 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, $settings = array(), $form ); |
|
| 631 | 631 | |
| 632 | 632 | } // End foreach |
| 633 | 633 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | echo $output; |
| 636 | 636 | |
| 637 | 637 | // For the EDIT view we only want to allow the form fields. |
| 638 | - if( $context === 'edit' ) { |
|
| 638 | + if ( $context === 'edit' ) { |
|
| 639 | 639 | return; |
| 640 | 640 | } |
| 641 | 641 | |
@@ -659,16 +659,16 @@ discard block |
||
| 659 | 659 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
| 660 | 660 | array( |
| 661 | 661 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
| 662 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
| 662 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
| 663 | 663 | 'field_id' => 'all-fields', |
| 664 | 664 | 'label_type' => 'field', |
| 665 | 665 | 'input_type' => NULL, |
| 666 | 666 | 'field_options' => NULL, |
| 667 | 667 | 'settings_html' => NULL, |
| 668 | 668 | ) |
| 669 | - )); |
|
| 669 | + ) ); |
|
| 670 | 670 | |
| 671 | - if( !empty( $additional_fields )) { |
|
| 671 | + if ( ! empty( $additional_fields ) ) { |
|
| 672 | 672 | foreach ( (array)$additional_fields as $item ) { |
| 673 | 673 | |
| 674 | 674 | // Prevent items from not having index set |
@@ -679,16 +679,16 @@ discard block |
||
| 679 | 679 | 'input_type' => NULL, |
| 680 | 680 | 'field_options' => NULL, |
| 681 | 681 | 'settings_html' => NULL, |
| 682 | - )); |
|
| 682 | + ) ); |
|
| 683 | 683 | |
| 684 | 684 | // Backward compat. |
| 685 | - if( !empty( $item['field_options'] ) ) { |
|
| 685 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 686 | 686 | // Use settings_html from now on. |
| 687 | - $item['settings_html'] = $item['field_options']; |
|
| 687 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | // Render a label for each of them |
| 691 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
| 691 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
| 692 | 692 | |
| 693 | 693 | } |
| 694 | 694 | } |
@@ -701,54 +701,54 @@ discard block |
||
| 701 | 701 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 702 | 702 | * @return array |
| 703 | 703 | */ |
| 704 | - function get_entry_default_fields($form, $zone) { |
|
| 704 | + function get_entry_default_fields( $form, $zone ) { |
|
| 705 | 705 | |
| 706 | 706 | $entry_default_fields = array(); |
| 707 | 707 | |
| 708 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 708 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 709 | 709 | |
| 710 | 710 | $entry_default_fields = array( |
| 711 | 711 | 'id' => array( |
| 712 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 712 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 713 | 713 | 'type' => 'id', |
| 714 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 714 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 715 | 715 | ), |
| 716 | 716 | 'date_created' => array( |
| 717 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 718 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 717 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 718 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 719 | 719 | 'type' => 'date_created', |
| 720 | 720 | ), |
| 721 | 721 | 'source_url' => array( |
| 722 | - 'label' => __('Source URL', 'gravityview'), |
|
| 722 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 723 | 723 | 'type' => 'source_url', |
| 724 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 724 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 725 | 725 | ), |
| 726 | 726 | 'ip' => array( |
| 727 | - 'label' => __('User IP', 'gravityview'), |
|
| 727 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 728 | 728 | 'type' => 'ip', |
| 729 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 729 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 730 | 730 | ), |
| 731 | 731 | 'created_by' => array( |
| 732 | - 'label' => __('User', 'gravityview'), |
|
| 732 | + 'label' => __( 'User', 'gravityview' ), |
|
| 733 | 733 | 'type' => 'created_by', |
| 734 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 734 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 735 | 735 | ), |
| 736 | 736 | |
| 737 | 737 | /** |
| 738 | 738 | * @since 1.7.2 |
| 739 | 739 | */ |
| 740 | 740 | 'other_entries' => array( |
| 741 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 741 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 742 | 742 | 'type' => 'other_entries', |
| 743 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 743 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 744 | 744 | ), |
| 745 | 745 | ); |
| 746 | 746 | |
| 747 | - if( 'single' !== $zone) { |
|
| 747 | + if ( 'single' !== $zone ) { |
|
| 748 | 748 | |
| 749 | - $entry_default_fields['entry_link'] = array( |
|
| 750 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 751 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 749 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 750 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 751 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 752 | 752 | 'type' => 'entry_link', |
| 753 | 753 | ); |
| 754 | 754 | } |
@@ -758,10 +758,10 @@ discard block |
||
| 758 | 758 | /** |
| 759 | 759 | * @since 1.2 |
| 760 | 760 | */ |
| 761 | - $entry_default_fields['custom'] = array( |
|
| 762 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 761 | + $entry_default_fields[ 'custom' ] = array( |
|
| 762 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 763 | 763 | 'type' => 'custom', |
| 764 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 764 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 765 | 765 | ); |
| 766 | 766 | |
| 767 | 767 | /** |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | * @param string|array $form form_ID or form object |
| 771 | 771 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 772 | 772 | */ |
| 773 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 773 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 774 | 774 | } |
| 775 | 775 | |
| 776 | 776 | /** |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | function get_available_fields( $form = '', $zone = NULL ) { |
| 783 | 783 | |
| 784 | - if( empty( $form ) ) { |
|
| 784 | + if ( empty( $form ) ) { |
|
| 785 | 785 | gravityview()->log->error( '$form is empty' ); |
| 786 | 786 | return array(); |
| 787 | 787 | } |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | $fields = gravityview_get_form_fields( $form, true ); |
| 791 | 791 | |
| 792 | 792 | // get meta fields ( only if form was already created ) |
| 793 | - if( !is_array( $form ) ) { |
|
| 793 | + if ( ! is_array( $form ) ) { |
|
| 794 | 794 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 795 | 795 | } else { |
| 796 | 796 | $meta_fields = array(); |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | $fields = $fields + $meta_fields + $default_fields; |
| 804 | 804 | |
| 805 | 805 | // Move Custom Content to top |
| 806 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
| 806 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
| 807 | 807 | |
| 808 | 808 | return $fields; |
| 809 | 809 | } |
@@ -817,11 +817,11 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | $widgets = $this->get_registered_widgets(); |
| 819 | 819 | |
| 820 | - if( !empty( $widgets ) ) { |
|
| 820 | + if ( ! empty( $widgets ) ) { |
|
| 821 | 821 | |
| 822 | - foreach( $widgets as $id => $details ) { |
|
| 822 | + foreach ( $widgets as $id => $details ) { |
|
| 823 | 823 | |
| 824 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 824 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 825 | 825 | |
| 826 | 826 | } |
| 827 | 827 | } |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 851 | 851 | global $post; |
| 852 | 852 | |
| 853 | - if( $type === 'widget' ) { |
|
| 853 | + if ( $type === 'widget' ) { |
|
| 854 | 854 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 855 | 855 | } else { |
| 856 | 856 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -862,10 +862,10 @@ discard block |
||
| 862 | 862 | $form_id = null; |
| 863 | 863 | |
| 864 | 864 | // if saved values, get available fields to label everyone |
| 865 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 865 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 866 | 866 | |
| 867 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 868 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 867 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 868 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 869 | 869 | } else { |
| 870 | 870 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
| 871 | 871 | } |
@@ -882,45 +882,45 @@ discard block |
||
| 882 | 882 | $available_items[ $form ] = $this->get_registered_widgets(); |
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | - foreach( $rows as $row ) : |
|
| 886 | - foreach( $row as $col => $areas ) : |
|
| 887 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 885 | + foreach ( $rows as $row ) : |
|
| 886 | + foreach ( $row as $col => $areas ) : |
|
| 887 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 888 | 888 | |
| 889 | 889 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 890 | 890 | |
| 891 | - <?php foreach( $areas as $area ) : ?> |
|
| 891 | + <?php foreach ( $areas as $area ) : ?> |
|
| 892 | 892 | |
| 893 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 894 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 893 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 894 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 895 | 895 | |
| 896 | 896 | <?php // render saved fields |
| 897 | 897 | |
| 898 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 898 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 899 | 899 | |
| 900 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 900 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 901 | 901 | |
| 902 | 902 | // Maybe has a form ID |
| 903 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
| 903 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
| 904 | 904 | |
| 905 | 905 | $input_type = NULL; |
| 906 | 906 | |
| 907 | 907 | if ( $form_id ) { |
| 908 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
| 908 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
| 909 | 909 | } else { |
| 910 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 910 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | - if ( !$original_item ) { |
|
| 914 | - 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 ) ) ); |
|
| 913 | + if ( ! $original_item ) { |
|
| 914 | + 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 ) ) ); |
|
| 915 | 915 | |
| 916 | 916 | $original_item = $field; |
| 917 | 917 | } else { |
| 918 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 918 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | // Field options dialog box |
| 922 | - $field_identifier = ('widget' === $type) ? $field['id'] : $input_type; |
|
| 923 | - $field_options = GravityView_Render_Settings::render_field_and_widget_options( $type, $field_identifier, $field); |
|
| 922 | + $field_identifier = ( 'widget' === $type ) ? $field[ 'id' ] : $input_type; |
|
| 923 | + $field_options = GravityView_Render_Settings::render_field_and_widget_options( $type, $field_identifier, $field ); |
|
| 924 | 924 | |
| 925 | 925 | $item = array( |
| 926 | 926 | 'input_type' => $input_type, |
@@ -933,23 +933,23 @@ discard block |
||
| 933 | 933 | $item = wp_parse_args( $item, $original_item ); |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | - switch( $type ) { |
|
| 936 | + switch ( $type ) { |
|
| 937 | 937 | case 'widget': |
| 938 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 938 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 939 | 939 | break; |
| 940 | 940 | default: |
| 941 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
| 941 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | } // End if zone is not empty ?> |
| 946 | 946 | |
| 947 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
| 947 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
| 948 | 948 | </div> |
| 949 | 949 | <div class="gv-droppable-area-action"> |
| 950 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
| 950 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
| 951 | 951 | |
| 952 | - <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> |
|
| 952 | + <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> |
|
| 953 | 953 | </div> |
| 954 | 954 | </div> |
| 955 | 955 | |
@@ -971,7 +971,7 @@ discard block |
||
| 971 | 971 | $default_widget_areas = GravityView_Widget::get_default_widget_areas(); |
| 972 | 972 | |
| 973 | 973 | $widgets = array(); |
| 974 | - if( !empty( $post_id ) ) { |
|
| 974 | + if ( ! empty( $post_id ) ) { |
|
| 975 | 975 | $widgets = gravityview_get_directory_widgets( $post_id ); |
| 976 | 976 | } |
| 977 | 977 | |
@@ -1003,21 +1003,21 @@ discard block |
||
| 1003 | 1003 | // render widgets templates |
| 1004 | 1004 | $widgets = \GV\Widget::registered(); |
| 1005 | 1005 | |
| 1006 | - foreach ($widgets as $widget_identifier => $data) { |
|
| 1007 | - echo GravityView_Render_Settings::render_field_and_widget_options( 'widget', $widget_identifier); |
|
| 1006 | + foreach ( $widgets as $widget_identifier => $data ) { |
|
| 1007 | + echo GravityView_Render_Settings::render_field_and_widget_options( 'widget', $widget_identifier ); |
|
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | 1010 | // render fields templates |
| 1011 | 1011 | $forms = gravityview_get_forms( 'any' ); |
| 1012 | 1012 | |
| 1013 | 1013 | foreach ( $forms as $form ) { |
| 1014 | - foreach ( $form['fields'] as $field ) { |
|
| 1015 | - $fields[] = $field['type']; |
|
| 1014 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 1015 | + $fields[ ] = $field[ 'type' ]; |
|
| 1016 | 1016 | } |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | foreach ( array_unique( $fields ) as $field_identifier ) { |
| 1020 | - echo GravityView_Render_Settings::render_field_and_widget_options( 'field', $field_identifier); |
|
| 1020 | + echo GravityView_Render_Settings::render_field_and_widget_options( 'field', $field_identifier ); |
|
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | } |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | // list of available fields to be shown in the popup |
| 1037 | 1037 | $forms = gravityview_get_forms( 'any' ); |
| 1038 | 1038 | |
| 1039 | - $form_ids = array_map( function ($form) { return $form['id']; }, $forms); |
|
| 1039 | + $form_ids = array_map( function( $form ) { return $form[ 'id' ]; }, $forms ); |
|
| 1040 | 1040 | |
| 1041 | 1041 | foreach ( $form_ids as $form_id ) { |
| 1042 | 1042 | $filter_field_id = sprintf( 'gv-field-filter-%s-%d', $context, $form_id ); |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | </div> |
| 1050 | 1050 | |
| 1051 | 1051 | <div id="available-fields-<?php echo $filter_field_id; ?>" aria-live="polite" role="listbox"> |
| 1052 | - <?php do_action('gravityview_render_available_fields', $form_id, $context ); ?> |
|
| 1052 | + <?php do_action( 'gravityview_render_available_fields', $form_id, $context ); ?> |
|
| 1053 | 1053 | </div> |
| 1054 | 1054 | |
| 1055 | 1055 | <div class="gv-no-results hidden description"><?php esc_html_e( 'No fields were found matching the search.', 'gravityview' ); ?></div> |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | * @return string HTML of the active areas |
| 1069 | 1069 | */ |
| 1070 | 1070 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 1071 | - if( empty( $template_id ) ) { |
|
| 1071 | + if ( empty( $template_id ) ) { |
|
| 1072 | 1072 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
| 1073 | 1073 | return ''; |
| 1074 | 1074 | } |
@@ -1082,12 +1082,12 @@ discard block |
||
| 1082 | 1082 | */ |
| 1083 | 1083 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 1084 | 1084 | |
| 1085 | - if( empty( $template_areas ) ) { |
|
| 1085 | + if ( empty( $template_areas ) ) { |
|
| 1086 | 1086 | |
| 1087 | 1087 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
| 1088 | 1088 | $output = '<div>'; |
| 1089 | - $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>'; |
|
| 1090 | - $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>'; |
|
| 1089 | + $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>'; |
|
| 1090 | + $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>'; |
|
| 1091 | 1091 | $output .= '</div>'; |
| 1092 | 1092 | } else { |
| 1093 | 1093 | |
@@ -1102,7 +1102,7 @@ discard block |
||
| 1102 | 1102 | |
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | - if( $echo ) { |
|
| 1105 | + if ( $echo ) { |
|
| 1106 | 1106 | echo $output; |
| 1107 | 1107 | } |
| 1108 | 1108 | |
@@ -1122,26 +1122,26 @@ discard block |
||
| 1122 | 1122 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 1123 | 1123 | |
| 1124 | 1124 | // Add the GV font (with the Astronaut) |
| 1125 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 1125 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 1126 | 1126 | |
| 1127 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 1127 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 1128 | 1128 | |
| 1129 | 1129 | // Don't process any scripts below here if it's not a GravityView page. |
| 1130 | - if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1130 | + if ( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1131 | 1131 | return; |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 1135 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 1135 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
| 1136 | 1136 | |
| 1137 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1137 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 1138 | 1138 | |
| 1139 | 1139 | //enqueue scripts |
| 1140 | 1140 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
| 1141 | 1141 | |
| 1142 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1142 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1143 | 1143 | 'cookiepath' => COOKIEPATH, |
| 1144 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1144 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
| 1145 | 1145 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1146 | 1146 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
| 1147 | 1147 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1153,9 +1153,9 @@ discard block |
||
| 1153 | 1153 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1154 | 1154 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1155 | 1155 | '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' ), |
| 1156 | - )); |
|
| 1156 | + ) ); |
|
| 1157 | 1157 | |
| 1158 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1158 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1159 | 1159 | |
| 1160 | 1160 | // Enqueue scripts needed for merge tags |
| 1161 | 1161 | self::enqueue_gravity_forms_scripts(); |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | ); |
| 1181 | 1181 | |
| 1182 | 1182 | if ( wp_is_mobile() ) { |
| 1183 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1183 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | wp_enqueue_script( $scripts ); |