@@ -11,10 +11,10 @@ |
||
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div class="gv-search-box"> |
14 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
15 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
14 | + <?php if (!gv_empty($search_field['label'], false)) { ?> |
|
15 | + <label for=search-box-<?php echo esc_attr($search_field['name']); ?>><?php echo esc_html($search_field['label']); ?></label> |
|
16 | 16 | <?php } ?> |
17 | 17 | <p> |
18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
18 | + <input type="text" name="<?php echo esc_attr($search_field['name']); ?>" id="search-box-<?php echo esc_attr($search_field['name']); ?>" value="<?php echo esc_attr($search_field['value']); ?>"> |
|
19 | 19 | </p> |
20 | 20 | </div> |
21 | 21 | \ No newline at end of file |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | $base_url = GravityView_Widget_Search::get_search_form_action(); |
14 | 14 | |
15 | 15 | // Make sure that there are choices to display |
16 | -if ( empty( $search_field['choices'] ) ) { |
|
17 | - do_action( 'gravityview_log_debug', 'search-field-link.php - No choices for field' ); |
|
16 | +if (empty($search_field['choices'])) { |
|
17 | + do_action('gravityview_log_debug', 'search-field-link.php - No choices for field'); |
|
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
@@ -22,41 +22,41 @@ discard block |
||
22 | 22 | * @filter `gravityview/extension/search/links_sep` Change the label for the "Link" search bar input type |
23 | 23 | * @param string $links_label Default: `Show only:` |
24 | 24 | */ |
25 | -$links_label = apply_filters( 'gravityview/extension/search/links_label', __( 'Show only:', 'gravityview' ) ); |
|
25 | +$links_label = apply_filters('gravityview/extension/search/links_label', __('Show only:', 'gravityview')); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @filter `gravityview/extension/search/links_sep` Change what separates search bar "Link" input type links |
29 | 29 | * @param string $links_sep Default: ` | ` Used to connect multiple links |
30 | 30 | */ |
31 | -$links_sep = apply_filters( 'gravityview/extension/search/links_sep', ' | ' ); |
|
31 | +$links_sep = apply_filters('gravityview/extension/search/links_sep', ' | '); |
|
32 | 32 | |
33 | 33 | ?> |
34 | 34 | |
35 | 35 | <div class="gv-search-box"> |
36 | 36 | |
37 | 37 | <p class="gv-search-box-links"> |
38 | - <?php echo esc_html( $links_label ); ?> |
|
38 | + <?php echo esc_html($links_label); ?> |
|
39 | 39 | |
40 | 40 | <?php |
41 | 41 | |
42 | - $search_value = rgget( $search_field['name'] ); |
|
42 | + $search_value = rgget($search_field['name']); |
|
43 | 43 | |
44 | - foreach ( $search_field['choices'] as $k => $choice ) { |
|
44 | + foreach ($search_field['choices'] as $k => $choice) { |
|
45 | 45 | |
46 | - if ( 0 != $k ) { |
|
47 | - echo esc_html( $links_sep ); |
|
46 | + if (0 != $k) { |
|
47 | + echo esc_html($links_sep); |
|
48 | 48 | } |
49 | 49 | |
50 | - $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
50 | + $active = ('' !== $search_value && in_array($search_value, array($choice['text'], $choice['value']))) ? ' class="active"' : false; |
|
51 | 51 | |
52 | - if ( $active ) { |
|
53 | - $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
52 | + if ($active) { |
|
53 | + $link = remove_query_arg(array('pagenum', $search_field['name']), $base_url); |
|
54 | 54 | } else { |
55 | - $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
55 | + $link = add_query_arg(array($search_field['name'] => urlencode($choice['value'])), remove_query_arg(array('pagenum'), $base_url)); |
|
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | |
59 | - <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a> |
|
59 | + <a href="<?php echo esc_url_raw($link); ?>" <?php echo $active; ?>><?php echo esc_html($choice['text']); ?></a> |
|
60 | 60 | |
61 | 61 | <?php } ?> |
62 | 62 | </p> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-multiselect.php - No choices for field' ); |
|
13 | +if (empty($search_field['choices'])) { |
|
14 | + do_action('gravityview_log_debug', 'search-field-multiselect.php - No choices for field'); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if (!gv_empty($search_field['label'], false)) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr($search_field['name']); ?>><?php echo esc_html($search_field['label']); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" multiple> |
|
25 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>>—</option> |
|
24 | + <select name="<?php echo esc_attr($search_field['name']); ?>[]" id="search-box-<?php echo esc_attr($search_field['name']); ?>" multiple> |
|
25 | + <option value="" <?php gv_selected('', $search_field['value'], true); ?>>—</option> |
|
26 | 26 | <?php |
27 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
28 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
27 | + foreach ($search_field['choices'] as $choice) : ?> |
|
28 | + <option value="<?php echo esc_attr($choice['value']); ?>" <?php gv_selected($choice['value'], $search_field['value'], true); ?>><?php echo esc_html($choice['text']); ?></option> |
|
29 | 29 | <?php endforeach; ?> |
30 | 30 | </select> |
31 | 31 | </p> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-radio.php - No choices for field' ); |
|
13 | +if (empty($search_field['choices'])) { |
|
14 | + do_action('gravityview_log_debug', 'search-field-radio.php - No choices for field'); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if (!gv_empty($search_field['label'], false)) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr($search_field['name']); ?>><?php echo esc_html($search_field['label']); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
24 | + <?php foreach ($search_field['choices'] as $choice) { ?> |
|
25 | 25 | |
26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
27 | - <input type="radio" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php checked( $choice['value'], $search_field['value'], true ); ?>> |
|
28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
26 | + <label for="search-box-<?php echo sanitize_html_class($search_field['name'].$choice['value'].$choice['text']); ?>" class="gv-check-radio"> |
|
27 | + <input type="radio" name="<?php echo esc_attr($search_field['name']); ?>" value="<?php echo esc_attr($choice['value']); ?>" id="search-box-<?php echo sanitize_html_class($search_field['name'].$choice['value'].$choice['text']); ?>" <?php checked($choice['value'], $search_field['value'], true); ?>> |
|
28 | + <?php echo esc_html($choice['text']); ?> |
|
29 | 29 | </label> |
30 | 30 | |
31 | 31 | <?php } ?> |
@@ -14,8 +14,8 @@ |
||
14 | 14 | |
15 | 15 | <div class="gv-search-box"> |
16 | 16 | <div class="gv-search"> |
17 | - <?php if( ! gv_empty( $label, false ) ) { ?> |
|
18 | - <label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
|
17 | + <?php if (!gv_empty($label, false)) { ?> |
|
18 | + <label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html($label); ?></label> |
|
19 | 19 | <?php } ?> |
20 | 20 | <p><input type="text" name="gv_search" id="gv_search_<?php echo $view_id; ?>" value="<?php echo $value; ?>" /></p> |
21 | 21 | </div> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-select.php - No choices for field' ); |
|
13 | +if (empty($search_field['choices'])) { |
|
14 | + do_action('gravityview_log_debug', 'search-field-select.php - No choices for field'); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if (!gv_empty($search_field['label'], false)) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr($search_field['name']); ?>><?php echo esc_html($search_field['label']); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"> |
|
25 | - <option value="" <?php selected( '', $search_field['value'], true ); ?>>—</option> |
|
24 | + <select name="<?php echo esc_attr($search_field['name']); ?>" id="search-box-<?php echo esc_attr($search_field['name']); ?>"> |
|
25 | + <option value="" <?php selected('', $search_field['value'], true); ?>>—</option> |
|
26 | 26 | <?php |
27 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
28 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
27 | + foreach ($search_field['choices'] as $choice) : ?> |
|
28 | + <option value="<?php echo esc_attr($choice['value']); ?>" <?php selected($choice['value'], $search_field['value'], true); ?>><?php echo esc_html($choice['text']); ?></option> |
|
29 | 29 | <?php endforeach; ?> |
30 | 30 | </select> |
31 | 31 | </p> |
@@ -12,8 +12,8 @@ |
||
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class="gv-search-box"> |
15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio"> |
|
16 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>> |
|
17 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { echo esc_html( $search_field['label'] ); } ?> |
|
15 | + <label for="search-box-<?php echo esc_attr($search_field['name']); ?>" class="gv-check-radio"> |
|
16 | + <input type="checkbox" name="<?php echo esc_attr($search_field['name']); ?>" value="1" id="search-box-<?php echo esc_attr($search_field['name']); ?>" <?php checked('1', $search_field['value'], true); ?>> |
|
17 | + <?php if (!gv_empty($search_field['label'], false)) { echo esc_html($search_field['label']); } ?> |
|
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | ?> |
15 | 15 | |
16 | -<form class="gv-widget-search <?php echo GravityView_Widget_Search::get_search_class(); ?>" method="get" action="<?php echo esc_url( GravityView_Widget_Search::get_search_form_action() ); ?>"> |
|
16 | +<form class="gv-widget-search <?php echo GravityView_Widget_Search::get_search_class(); ?>" method="get" action="<?php echo esc_url(GravityView_Widget_Search::get_search_form_action()); ?>"> |
|
17 | 17 | |
18 | 18 | <?php |
19 | 19 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | * @action `gravityview_search_widget_fields_before` Inside the `<form>` tag of the GravityView search form, before inputs are rendered |
22 | 22 | * @param GravityView_Widget_Search $this GravityView Widget instance |
23 | 23 | */ |
24 | - do_action( 'gravityview_search_widget_fields_before', $this ); |
|
24 | + do_action('gravityview_search_widget_fields_before', $this); |
|
25 | 25 | |
26 | - foreach( $this->search_fields as $search_field ) { |
|
26 | + foreach ($this->search_fields as $search_field) { |
|
27 | 27 | $gravityview_view->search_field = $search_field; |
28 | - $this->render( 'search-field', $search_field['input'], false ); |
|
28 | + $this->render('search-field', $search_field['input'], false); |
|
29 | 29 | |
30 | 30 | // show/hide the search button if there are input type fields |
31 | - if( !$has_inputs && $search_field['input'] != 'link' ) { |
|
31 | + if (!$has_inputs && $search_field['input'] != 'link') { |
|
32 | 32 | $has_inputs = true; |
33 | 33 | } |
34 | 34 | } |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | * @action `gravityview_search_widget_fields_after` Inside the `<form>` tag of the GravityView search form, after inputs are rendered |
38 | 38 | * @param GravityView_Widget_Search $this GravityView Widget instance |
39 | 39 | */ |
40 | - do_action( 'gravityview_search_widget_fields_after', $this ); |
|
40 | + do_action('gravityview_search_widget_fields_after', $this); |
|
41 | 41 | |
42 | - if( $has_inputs ) { ?> |
|
42 | + if ($has_inputs) { ?> |
|
43 | 43 | <div class="gv-search-box gv-search-box-submit"> |
44 | 44 | <?php |
45 | 45 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | GravityView_Widget_Search::the_clear_search_button(); |
48 | 48 | |
49 | 49 | ?> |
50 | - <input type="hidden" name="mode" value="<?php echo esc_attr( $gravityview_view->search_mode ); ?>" /> |
|
51 | - <input type="submit" class="button gv-search-button" id="gv_search_button_<?php echo $view_id; ?>" value="<?php esc_attr_e( 'Search', 'gravityview' ); ?>" /> |
|
50 | + <input type="hidden" name="mode" value="<?php echo esc_attr($gravityview_view->search_mode); ?>" /> |
|
51 | + <input type="submit" class="button gv-search-button" id="gv_search_button_<?php echo $view_id; ?>" value="<?php esc_attr_e('Search', 'gravityview'); ?>" /> |
|
52 | 52 | </div> |
53 | 53 | <?php } ?> |
54 | 54 | </form> |
@@ -15,19 +15,19 @@ discard block |
||
15 | 15 | $name = __('GravityView Recent Entries', 'gravityview'); |
16 | 16 | |
17 | 17 | $widget_options = array( |
18 | - 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
|
18 | + 'description' => __('Display the most recent entries for a View', 'gravityview'), |
|
19 | 19 | ); |
20 | 20 | |
21 | - parent::__construct( 'gv_recent_entries', $name, $widget_options ); |
|
21 | + parent::__construct('gv_recent_entries', $name, $widget_options); |
|
22 | 22 | |
23 | 23 | $this->initialize(); |
24 | 24 | } |
25 | 25 | |
26 | 26 | private function initialize() { |
27 | 27 | |
28 | - add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') ); |
|
28 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
29 | 29 | |
30 | - add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
|
30 | + add_action('wp_ajax_gv_get_view_merge_tag_data', array($this, 'ajax_get_view_merge_tag_data')); |
|
31 | 31 | |
32 | 32 | } |
33 | 33 | |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function ajax_get_view_merge_tag_data() { |
40 | 40 | |
41 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) { |
|
42 | - exit( false ); |
|
41 | + if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'gravityview_ajax_widget')) { |
|
42 | + exit(false); |
|
43 | 43 | } |
44 | 44 | |
45 | - $form_id = gravityview_get_form_id( $_POST['view_id'] ); |
|
45 | + $form_id = gravityview_get_form_id($_POST['view_id']); |
|
46 | 46 | |
47 | - $form = RGFormsModel::get_form_meta( $form_id ); |
|
47 | + $form = RGFormsModel::get_form_meta($form_id); |
|
48 | 48 | |
49 | 49 | $output = array( |
50 | 50 | 'form' => array( |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | 'title' => $form['title'], |
53 | 53 | 'fields' => $form['fields'], |
54 | 54 | ), |
55 | - 'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ), |
|
55 | + 'mergeTags' => GFCommon::get_merge_tags($form['fields'], '', false), |
|
56 | 56 | ); |
57 | 57 | |
58 | - echo json_encode( $output ); |
|
58 | + echo json_encode($output); |
|
59 | 59 | |
60 | 60 | exit; |
61 | 61 | } |
@@ -68,19 +68,19 @@ discard block |
||
68 | 68 | function admin_enqueue_scripts() { |
69 | 69 | global $pagenow; |
70 | 70 | |
71 | - if( $pagenow === 'widgets.php' ) { |
|
71 | + if ($pagenow === 'widgets.php') { |
|
72 | 72 | |
73 | 73 | $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
74 | 74 | |
75 | 75 | GravityView_Admin_Views::enqueue_gravity_forms_scripts(); |
76 | 76 | |
77 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
77 | + wp_enqueue_script('gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array('jquery', 'gform_gravityforms'), GravityView_Plugin::version); |
|
78 | 78 | |
79 | - wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
|
80 | - 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
|
79 | + wp_localize_script('gravityview_widgets', 'GVWidgets', array( |
|
80 | + 'nonce' => wp_create_nonce('gravityview_ajax_widget') |
|
81 | 81 | )); |
82 | 82 | |
83 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
83 | + wp_enqueue_style('gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons'), GravityView_Plugin::version); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | } |
@@ -92,22 +92,22 @@ discard block |
||
92 | 92 | * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. |
93 | 93 | * @param array $instance The settings for the particular instance of the widget. |
94 | 94 | */ |
95 | - function widget( $args, $instance ) { |
|
95 | + function widget($args, $instance) { |
|
96 | 96 | |
97 | 97 | // Don't have the Customizer render too soon. |
98 | - if( empty( $instance['view_id'] ) ) { |
|
98 | + if (empty($instance['view_id'])) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
103 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
102 | + $args['id'] = (isset($args['id'])) ? $args['id'] : 'gv_recent_entries'; |
|
103 | + $instance['title'] = (isset($instance['title'])) ? $instance['title'] : ''; |
|
104 | 104 | |
105 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
105 | + $title = apply_filters('widget_title', $instance['title'], $instance, $args['id']); |
|
106 | 106 | |
107 | 107 | echo $args['before_widget']; |
108 | 108 | |
109 | - if ( !empty( $title ) ) { |
|
110 | - echo $args['before_title'] . $title . $args['after_title']; |
|
109 | + if (!empty($title)) { |
|
110 | + echo $args['before_title'].$title.$args['after_title']; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -115,17 +115,17 @@ discard block |
||
115 | 115 | * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. |
116 | 116 | * @param array $instance The settings for the particular instance of the widget. |
117 | 117 | */ |
118 | - do_action( 'gravityview/widget/recent-entries/before_widget', $args, $instance ); |
|
118 | + do_action('gravityview/widget/recent-entries/before_widget', $args, $instance); |
|
119 | 119 | |
120 | 120 | // Print the entry list |
121 | - echo $this->get_output( $instance ); |
|
121 | + echo $this->get_output($instance); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * @action `gravityview/widget/recent-entries/after_widget` After recent entries are displayed in the WordPress widget |
125 | 125 | * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. |
126 | 126 | * @param array $instance The settings for the particular instance of the widget. |
127 | 127 | */ |
128 | - do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
|
128 | + do_action('gravityview/widget/recent-entries/after_widget', $args, $instance); |
|
129 | 129 | |
130 | 130 | echo $args['after_widget']; |
131 | 131 | } |
@@ -139,25 +139,25 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - private function get_output( $instance ) { |
|
142 | + private function get_output($instance) { |
|
143 | 143 | |
144 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
144 | + $form_id = gravityview_get_form_id($instance['view_id']); |
|
145 | 145 | |
146 | - $form = gravityview_get_form( $form_id ); |
|
146 | + $form = gravityview_get_form($form_id); |
|
147 | 147 | |
148 | - $entries = $this->get_entries( $instance, $form_id ); |
|
148 | + $entries = $this->get_entries($instance, $form_id); |
|
149 | 149 | |
150 | 150 | /** |
151 | 151 | * @since 1.6.1 |
152 | 152 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
153 | 153 | */ |
154 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
154 | + $entry_link_post_id = (empty($instance['error_post_id']) && !empty($instance['post_id'])) ? $instance['post_id'] : $instance['view_id']; |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Generate list output |
158 | 158 | * @since 1.7.2 |
159 | 159 | */ |
160 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' ); |
|
160 | + $List = new GravityView_Entry_List($entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget'); |
|
161 | 161 | |
162 | 162 | $output = $List->get_output(); |
163 | 163 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @param string $output HTML to be displayed |
167 | 167 | * @param array $instance Widget settings |
168 | 168 | */ |
169 | - $output = apply_filters( 'gravityview/widget/recent-entries/output', $output, $instance ); |
|
169 | + $output = apply_filters('gravityview/widget/recent-entries/output', $output, $instance); |
|
170 | 170 | |
171 | 171 | return $output; |
172 | 172 | } |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return array $entries Multidimensional array of Gravity Forms entries |
181 | 181 | */ |
182 | - private function get_entries( $instance, $form_id ) { |
|
182 | + private function get_entries($instance, $form_id) { |
|
183 | 183 | |
184 | 184 | // Get the settings for the View ID |
185 | - $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
|
185 | + $view_settings = gravityview_get_template_settings($instance['view_id']); |
|
186 | 186 | |
187 | 187 | // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
188 | 188 | $criteria['context_view_id'] = $instance['view_id']; |
189 | 189 | |
190 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
190 | + $instance['limit'] = isset($instance['limit']) ? $instance['limit'] : 10; |
|
191 | 191 | $view_settings['id'] = $instance['view_id']; |
192 | 192 | $view_settings['page_size'] = $instance['limit']; |
193 | 193 | |
@@ -198,16 +198,16 @@ discard block |
||
198 | 198 | ); |
199 | 199 | |
200 | 200 | // Prepare Search Criteria |
201 | - $criteria['search_criteria'] = array( 'field_filters' => array() ); |
|
202 | - $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']); |
|
203 | - $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
201 | + $criteria['search_criteria'] = array('field_filters' => array()); |
|
202 | + $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved($view_settings, $criteria['search_criteria']); |
|
203 | + $criteria['search_criteria']['status'] = apply_filters('gravityview_status', 'active', $view_settings); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Modify the search parameters before the entries are fetched |
207 | 207 | */ |
208 | - $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
208 | + $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id); |
|
209 | 209 | |
210 | - $results = GVCommon::get_entries( $form_id, $criteria ); |
|
210 | + $results = GVCommon::get_entries($form_id, $criteria); |
|
211 | 211 | |
212 | 212 | return $results; |
213 | 213 | } |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return array Calculated widget settings after processing |
223 | 223 | */ |
224 | - public function update( $new_instance, $old_instance ) { |
|
224 | + public function update($new_instance, $old_instance) { |
|
225 | 225 | |
226 | 226 | $instance = $new_instance; |
227 | 227 | |
228 | 228 | // Force positive number |
229 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
229 | + $instance['limit'] = empty($instance['limit']) ? 10 : absint($instance['limit']); |
|
230 | 230 | |
231 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
231 | + $instance['view_id'] = intval($instance['view_id']); |
|
232 | 232 | |
233 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
233 | + $instance['link_format'] = trim(rtrim($instance['link_format'])); |
|
234 | 234 | |
235 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
235 | + $instance['link_format'] = empty($instance['link_format']) ? $old_instance['link_format'] : $instance['link_format']; |
|
236 | 236 | |
237 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
237 | + $instance['post_id'] = empty($instance['post_id']) ? '' : intval($instance['post_id']); |
|
238 | 238 | |
239 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] ); |
|
239 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id($instance['post_id'], $instance['view_id']); |
|
240 | 240 | |
241 | 241 | //check if post_id is a valid post with embedded View |
242 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
242 | + $instance['error_post_id'] = is_wp_error($is_valid_embed_id) ? $is_valid_embed_id->get_error_message() : NULL; |
|
243 | 243 | |
244 | 244 | // Share that the widget isn't brand new |
245 | - $instance['updated'] = 1; |
|
245 | + $instance['updated'] = 1; |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @param array $new_instance Widget form settings after update |
252 | 252 | * @param array $old_instance Widget form settings before update |
253 | 253 | */ |
254 | - $instance = apply_filters( 'gravityview/widget/update', $instance, $new_instance, $old_instance ); |
|
254 | + $instance = apply_filters('gravityview/widget/update', $instance, $new_instance, $old_instance); |
|
255 | 255 | |
256 | 256 | return $instance; |
257 | 257 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @since 1.6 |
261 | 261 | * @see WP_Widget::form() |
262 | 262 | */ |
263 | - public function form( $instance ) { |
|
263 | + public function form($instance) { |
|
264 | 264 | |
265 | 265 | // Set up some default widget settings. |
266 | 266 | $defaults = array( |
@@ -272,14 +272,14 @@ discard block |
||
272 | 272 | 'after_link' => '' |
273 | 273 | ); |
274 | 274 | |
275 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
275 | + $instance = wp_parse_args((array)$instance, $defaults); |
|
276 | 276 | |
277 | 277 | ?> |
278 | 278 | |
279 | 279 | <!-- Title --> |
280 | 280 | <p> |
281 | - <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
|
282 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
281 | + <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title:', 'gravityview') ?></label> |
|
282 | + <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" /> |
|
283 | 283 | </p> |
284 | 284 | |
285 | 285 | <!-- Download --> |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | 'posts_per_page' => -1, |
290 | 290 | 'post_status' => 'publish', |
291 | 291 | ); |
292 | - $views = get_posts( $args ); |
|
292 | + $views = get_posts($args); |
|
293 | 293 | |
294 | 294 | // If there are no views set up yet, we get outta here. |
295 | - if( empty( $views ) ) { |
|
296 | - echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>'; |
|
295 | + if (empty($views)) { |
|
296 | + echo '<div id="select_gravityview_view"><div class="wrap">'.GravityView_Post_Types::no_views_text().'</div></div>'; |
|
297 | 297 | return; |
298 | 298 | } |
299 | 299 | |
@@ -304,25 +304,25 @@ discard block |
||
304 | 304 | * Display errors generated for invalid embed IDs |
305 | 305 | * @see GravityView_View_Data::is_valid_embed_id |
306 | 306 | */ |
307 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
307 | + if (isset($instance['updated']) && empty($instance['view_id'])) { |
|
308 | 308 | ?> |
309 | 309 | <div class="error inline hide-on-view-change"> |
310 | 310 | <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
311 | 311 | </div> |
312 | 312 | <?php |
313 | - unset ( $error ); |
|
313 | + unset ($error); |
|
314 | 314 | } |
315 | 315 | ?> |
316 | 316 | |
317 | 317 | <p> |
318 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
319 | - <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"> |
|
320 | - <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
|
318 | + <label for="<?php echo esc_attr($this->get_field_id('view_id')); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
319 | + <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr($this->get_field_name('view_id')); ?>" id="<?php echo esc_attr($this->get_field_id('view_id')); ?>"> |
|
320 | + <option value=""><?php esc_html_e('— Select a View as Entries Source —', 'gravityview'); ?></option> |
|
321 | 321 | <?php |
322 | 322 | |
323 | - foreach( $views as $view ) { |
|
324 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
325 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
323 | + foreach ($views as $view) { |
|
324 | + $title = empty($view->post_title) ? __('(no title)', 'gravityview') : $view->post_title; |
|
325 | + echo '<option value="'.$view->ID.'"'.selected(absint($instance['view_id']), $view->ID).'>'.esc_html(sprintf('%s #%d', $title, $view->ID)).'</option>'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | ?> |
@@ -334,44 +334,44 @@ discard block |
||
334 | 334 | * Display errors generated for invalid embed IDs |
335 | 335 | * @see GravityView_View_Data::is_valid_embed_id |
336 | 336 | */ |
337 | - if( !empty( $instance['error_post_id'] ) ) { |
|
337 | + if (!empty($instance['error_post_id'])) { |
|
338 | 338 | ?> |
339 | 339 | <div class="error inline"> |
340 | 340 | <p><?php echo $instance['error_post_id']; ?></p> |
341 | 341 | </div> |
342 | 342 | <?php |
343 | - unset ( $error ); |
|
343 | + unset ($error); |
|
344 | 344 | } |
345 | 345 | ?> |
346 | 346 | |
347 | 347 | <p> |
348 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" /> |
|
348 | + <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e('If Embedded, Page ID:', 'gravityview'); ?></label> |
|
349 | + <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr($instance['post_id']); ?>" /> |
|
350 | 350 | <span class="howto"><?php |
351 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
351 | + esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview'); |
|
352 | + echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview'), 'target=_blank'); |
|
353 | 353 | ?></span> |
354 | 354 | </p> |
355 | 355 | |
356 | 356 | <p> |
357 | - <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
|
358 | - <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
|
357 | + <label for="<?php echo $this->get_field_id('limit'); ?>"> |
|
358 | + <span><?php _e('Number of entries to show:', 'gravityview'); ?></span> |
|
359 | 359 | </label> |
360 | - <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" /> |
|
360 | + <input class="code" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="number" value="<?php echo intval($instance['limit']); ?>" size="3" /> |
|
361 | 361 | </p> |
362 | 362 | |
363 | 363 | <p> |
364 | - <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
|
365 | - <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
|
364 | + <label for="<?php echo $this->get_field_id('link_format'); ?>"> |
|
365 | + <span><?php _e('Entry link text (required)', 'gravityview'); ?></span> |
|
366 | 366 | </label> |
367 | - <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
367 | + <input id="<?php echo $this->get_field_id('link_format'); ?>" name="<?php echo $this->get_field_name('link_format'); ?>" type="text" value="<?php echo esc_attr($instance['link_format']); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
368 | 368 | </p> |
369 | 369 | |
370 | 370 | <p> |
371 | - <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
|
372 | - <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
|
371 | + <label for="<?php echo $this->get_field_id('after_link'); ?>"> |
|
372 | + <span><?php _e('Text or HTML to display after the link (optional)', 'gravityview'); ?></span> |
|
373 | 373 | </label> |
374 | - <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea> |
|
374 | + <textarea id="<?php echo $this->get_field_id('after_link'); ?>" name="<?php echo $this->get_field_name('after_link'); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea($instance['after_link']); ?></textarea> |
|
375 | 375 | </p> |
376 | 376 | |
377 | 377 | <?php |
@@ -381,14 +381,14 @@ discard block |
||
381 | 381 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
382 | 382 | * @param array $instance Current widget instance |
383 | 383 | */ |
384 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
384 | + do_action('gravityview_recent_entries_widget_form', $this, $instance); |
|
385 | 385 | |
386 | 386 | ?> |
387 | 387 | |
388 | 388 | <script> |
389 | 389 | // When the widget is saved or added, refresh the Merge Tags (here for backward compatibility) |
390 | 390 | // WordPress 3.9 added widget-added and widget-updated actions |
391 | - jQuery('#<?php echo $this->get_field_id( 'view_id' ); ?>').trigger( 'change' ); |
|
391 | + jQuery('#<?php echo $this->get_field_id('view_id'); ?>').trigger( 'change' ); |
|
392 | 392 | </script> |
393 | 393 | <?php } |
394 | 394 |