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