@@ -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 |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 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 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 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 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | function __construct() { |
19 | 19 | |
20 | - $this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' ); |
|
20 | + $this->widget_description = __( 'Insert custom text or HTML as a widget', 'gravityview' ); |
|
21 | 21 | |
22 | 22 | $default_values = array( |
23 | 23 | 'header' => 1, |
@@ -42,39 +42,39 @@ discard block |
||
42 | 42 | ), |
43 | 43 | ); |
44 | 44 | |
45 | - parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings ); |
|
45 | + parent::__construct( __( 'Custom Content', 'gravityview' ), 'custom_content', $default_values, $settings ); |
|
46 | 46 | } |
47 | 47 | |
48 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
48 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
49 | 49 | |
50 | - if( !$this->pre_render_frontend() ) { |
|
50 | + if ( ! $this->pre_render_frontend() ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | - if( !empty( $widget_args['title'] ) ) { |
|
55 | - echo $widget_args['title']; |
|
54 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
55 | + echo $widget_args[ 'title' ]; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | 59 | // Make sure the class is loaded in DataTables |
60 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
60 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
61 | 61 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
62 | 62 | } |
63 | 63 | |
64 | - $widget_args['content'] = trim( rtrim( $widget_args['content'] ) ); |
|
64 | + $widget_args[ 'content' ] = trim( rtrim( $widget_args[ 'content' ] ) ); |
|
65 | 65 | |
66 | 66 | // No custom content |
67 | - if( empty( $widget_args['content'] ) ) { |
|
68 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class($this)) ); |
|
67 | + if ( empty( $widget_args[ 'content' ] ) ) { |
|
68 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class( $this ) ) ); |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Add paragraphs? |
73 | - if( !empty( $widget_args['wpautop'] ) ) { |
|
74 | - $widget_args['content'] = wpautop( $widget_args['content'] ); |
|
73 | + if ( ! empty( $widget_args[ 'wpautop' ] ) ) { |
|
74 | + $widget_args[ 'content' ] = wpautop( $widget_args[ 'content' ] ); |
|
75 | 75 | } |
76 | 76 | |
77 | - $content = $widget_args['content']; |
|
77 | + $content = $widget_args[ 'content' ]; |
|
78 | 78 | |
79 | 79 | $content = GravityView_Merge_Tags::replace_variables( $content ); |
80 | 80 | |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | |
85 | 85 | |
86 | 86 | // Add custom class |
87 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
87 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
88 | 88 | $class = gravityview_sanitize_html_class( $class ); |
89 | 89 | |
90 | - echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>'; |
|
90 | + echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>'; |
|
91 | 91 | |
92 | 92 | } |
93 | 93 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | function __construct() { |
18 | 18 | |
19 | - $this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
19 | + $this->widget_description = __( 'Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
20 | 20 | |
21 | 21 | $default_values = array( |
22 | 22 | 'header' => 1, |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | |
26 | 26 | $settings = array(); |
27 | 27 | |
28 | - parent::__construct( __( 'Show Pagination Info', 'gravityview' ) , 'page_info', $default_values, $settings ); |
|
28 | + parent::__construct( __( 'Show Pagination Info', 'gravityview' ), 'page_info', $default_values, $settings ); |
|
29 | 29 | } |
30 | 30 | |
31 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
31 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
32 | 32 | $gravityview_view = GravityView_View::getInstance(); |
33 | 33 | |
34 | - if( !$this->pre_render_frontend() ) { |
|
34 | + if ( ! $this->pre_render_frontend() ) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | - if( !empty( $widget_args['title'] ) ) { |
|
39 | - echo $widget_args['title']; |
|
38 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
39 | + echo $widget_args[ 'title' ]; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $pagination_counts = $gravityview_view->getPaginationCounts(); |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | |
46 | 46 | $output = ''; |
47 | 47 | |
48 | - if( ! empty( $pagination_counts ) ) { |
|
48 | + if ( ! empty( $pagination_counts ) ) { |
|
49 | 49 | |
50 | - $first = $pagination_counts['first']; |
|
51 | - $last = $pagination_counts['last']; |
|
52 | - $total = $pagination_counts['total']; |
|
50 | + $first = $pagination_counts[ 'first' ]; |
|
51 | + $last = $pagination_counts[ 'last' ]; |
|
52 | + $total = $pagination_counts[ 'total' ]; |
|
53 | 53 | |
54 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
54 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
55 | 55 | $class = gravityview_sanitize_html_class( $class ); |
56 | 56 | |
57 | - $output = '<div class="gv-widget-pagination '.$class.'"><p>'. sprintf(__( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
57 | + $output = '<div class="gv-widget-pagination ' . $class . '"><p>' . sprintf( __( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -11,38 +11,38 @@ discard block |
||
11 | 11 | |
12 | 12 | function __construct() { |
13 | 13 | |
14 | - $this->widget_description = __('Links to multiple pages of results.', 'gravityview' ); |
|
14 | + $this->widget_description = __( 'Links to multiple pages of results.', 'gravityview' ); |
|
15 | 15 | |
16 | 16 | $default_values = array( 'header' => 1, 'footer' => 1 ); |
17 | 17 | $settings = array( 'show_all' => array( |
18 | 18 | 'type' => 'checkbox', |
19 | 19 | 'label' => __( 'Show each page number', 'gravityview' ), |
20 | - 'desc' => __('Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview'), |
|
20 | + 'desc' => __( 'Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview' ), |
|
21 | 21 | 'value' => false |
22 | - )); |
|
23 | - parent::__construct( __( 'Page Links', 'gravityview' ) , 'page_links', $default_values, $settings ); |
|
22 | + ) ); |
|
23 | + parent::__construct( __( 'Page Links', 'gravityview' ), 'page_links', $default_values, $settings ); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
27 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
28 | 28 | $gravityview_view = GravityView_View::getInstance(); |
29 | 29 | |
30 | - if( !$this->pre_render_frontend() ) { |
|
30 | + if ( ! $this->pre_render_frontend() ) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 | |
34 | - $page_size = $gravityview_view->paging['page_size']; |
|
34 | + $page_size = $gravityview_view->paging[ 'page_size' ]; |
|
35 | 35 | $total = $gravityview_view->total_entries; |
36 | 36 | |
37 | 37 | $atts = shortcode_atts( array( |
38 | - 'show_all' => !empty( $this->settings['show_all']['default'] ), |
|
38 | + 'show_all' => ! empty( $this->settings[ 'show_all' ][ 'default' ] ), |
|
39 | 39 | ), $widget_args, 'gravityview_widget_page_links' ); |
40 | 40 | |
41 | 41 | // displaying info |
42 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
42 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
43 | 43 | |
44 | 44 | $page_link_args = array( |
45 | - 'base' => add_query_arg('pagenum','%#%', gv_directory_link() ), |
|
45 | + 'base' => add_query_arg( 'pagenum', '%#%', gv_directory_link() ), |
|
46 | 46 | 'format' => '&pagenum=%#%', |
47 | 47 | 'add_args' => array(), // |
48 | 48 | 'prev_text' => '«', |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | 'mid_size' => 2, |
53 | 53 | 'total' => empty( $page_size ) ? 0 : ceil( $total / $page_size ), |
54 | 54 | 'current' => $curr_page, |
55 | - 'show_all' => !empty( $atts['show_all'] ), // to be available at backoffice |
|
55 | + 'show_all' => ! empty( $atts[ 'show_all' ] ), // to be available at backoffice |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | /** |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | * @since 1.1.4 |
61 | 61 | * @param array $page_link_args Array of arguments for the `paginate_links()` function. [Read more about `paginate_links()`](http://developer.wordpress.org/reference/functions/paginate_links/) |
62 | 62 | */ |
63 | - $page_link_args = apply_filters('gravityview_page_links_args', $page_link_args ); |
|
63 | + $page_link_args = apply_filters( 'gravityview_page_links_args', $page_link_args ); |
|
64 | 64 | |
65 | 65 | $page_links = paginate_links( $page_link_args ); |
66 | 66 | |
67 | - if( !empty( $page_links )) { |
|
68 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
67 | + if ( ! empty( $page_links ) ) { |
|
68 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
69 | 69 | $class = gravityview_sanitize_html_class( $class ); |
70 | - echo '<div class="gv-widget-page-links '.$class.'">'. $page_links .'</div>'; |
|
70 | + echo '<div class="gv-widget-page-links ' . $class . '">' . $page_links . '</div>'; |
|
71 | 71 | } else { |
72 | 72 | do_action( 'gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.' ); |
73 | 73 | } |
@@ -170,25 +170,25 @@ discard block |
||
170 | 170 | public function get_output() { |
171 | 171 | |
172 | 172 | // No Entries |
173 | - if( empty( $this->entries ) ) { |
|
174 | - return '<div class="gv-no-results">'.$this->empty_message.'</div>'; |
|
173 | + if ( empty( $this->entries ) ) { |
|
174 | + return '<div class="gv-no-results">' . $this->empty_message . '</div>'; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $output = ''; |
178 | 178 | $current_entry = GravityView_View::getInstance()->getCurrentEntry(); |
179 | 179 | |
180 | - $output .= '<'. $this->wrapper_tag .'>'; |
|
180 | + $output .= '<' . $this->wrapper_tag . '>'; |
|
181 | 181 | |
182 | - foreach( $this->entries as $entry ) { |
|
182 | + foreach ( $this->entries as $entry ) { |
|
183 | 183 | |
184 | - if( $this->skip_entry( $entry, $current_entry ) ) { |
|
184 | + if ( $this->skip_entry( $entry, $current_entry ) ) { |
|
185 | 185 | continue; |
186 | 186 | } |
187 | 187 | |
188 | 188 | $output .= $this->get_item_output( $entry ); |
189 | 189 | } |
190 | 190 | |
191 | - $output .= '</'. $this->wrapper_tag .'>'; |
|
191 | + $output .= '</' . $this->wrapper_tag . '>'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output |
@@ -211,15 +211,15 @@ discard block |
||
211 | 211 | private function skip_entry( $entry, $current_entry ) { |
212 | 212 | |
213 | 213 | // If skip entry is off, or there's no current entry, return false |
214 | - if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
214 | + if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | 218 | // If in Single or Edit mode, $current_entry will be an array. |
219 | - $current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry; |
|
219 | + $current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry; |
|
220 | 220 | |
221 | 221 | // If the entry ID matches the current entry, yes: skip |
222 | - if( $entry['id'] === $current_entry_id ) { |
|
222 | + if ( $entry[ 'id' ] === $current_entry_id ) { |
|
223 | 223 | return true; |
224 | 224 | } |
225 | 225 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | $item_output = gravityview_get_link( $link, $this->link_format ); |
248 | 248 | |
249 | - if( !empty( $this->after_link ) ) { |
|
249 | + if ( ! empty( $this->after_link ) ) { |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | * @param array $entry Gravity Forms entry array |
256 | 256 | * @param GravityView_Entry_List $this The current class instance |
257 | 257 | */ |
258 | - $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this ); |
|
258 | + $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this ); |
|
259 | 259 | |
260 | 260 | $item_output .= $after_link; |
261 | 261 | } |
262 | 262 | |
263 | 263 | $item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry ); |
264 | 264 | |
265 | - $item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>'; |
|
265 | + $item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>'; |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * @filter `gravityview/entry-list/item` Modify each item's output in an entry list |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts ); |
50 | 50 | |
51 | 51 | // Get details about the current View |
52 | - if( !empty( $passed_atts['detail'] ) ) { |
|
53 | - return $this->get_view_detail( $passed_atts['detail'] ); |
|
52 | + if ( ! empty( $passed_atts[ 'detail' ] ) ) { |
|
53 | + return $this->get_view_detail( $passed_atts[ 'detail' ] ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $atts = $this->parse_and_sanitize_atts( $passed_atts ); |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | |
91 | 91 | $atts = array(); |
92 | 92 | |
93 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
93 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
94 | 94 | |
95 | 95 | // Allow using {get} merge tags in shortcode attributes |
96 | 96 | $passed_value = GravityView_Merge_Tags::replace_get_variables( $passed_value ); |
97 | 97 | |
98 | - switch( $defaults[ $key ]['type'] ) { |
|
98 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Make sure number fields are numeric. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
104 | 104 | */ |
105 | 105 | case 'number': |
106 | - if( is_numeric( $passed_value ) ) { |
|
106 | + if ( is_numeric( $passed_value ) ) { |
|
107 | 107 | $atts[ $key ] = ( $passed_value + 0 ); |
108 | 108 | } |
109 | 109 | break; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | case 'select': |
120 | 120 | case 'radio': |
121 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
122 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
121 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
122 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
123 | 123 | $atts[ $key ] = $passed_value; |
124 | 124 | } |
125 | 125 | break; |
@@ -148,21 +148,21 @@ discard block |
||
148 | 148 | $gravityview_view = GravityView_View::getInstance(); |
149 | 149 | $return = ''; |
150 | 150 | |
151 | - switch( $detail ) { |
|
151 | + switch ( $detail ) { |
|
152 | 152 | case 'total_entries': |
153 | 153 | $return = number_format_i18n( $gravityview_view->getTotalEntries() ); |
154 | 154 | break; |
155 | 155 | case 'first_entry': |
156 | 156 | $paging = $gravityview_view->getPaginationCounts(); |
157 | - $return = empty( $paging ) ? '' : number_format_i18n( $paging['first'] ); |
|
157 | + $return = empty( $paging ) ? '' : number_format_i18n( $paging[ 'first' ] ); |
|
158 | 158 | break; |
159 | 159 | case 'last_entry': |
160 | 160 | $paging = $gravityview_view->getPaginationCounts(); |
161 | - $return = empty( $paging ) ? '' : number_format_i18n( $paging['last'] ); |
|
161 | + $return = empty( $paging ) ? '' : number_format_i18n( $paging[ 'last' ] ); |
|
162 | 162 | break; |
163 | 163 | case 'page_size': |
164 | 164 | $paging = $gravityview_view->getPaging(); |
165 | - $return = number_format_i18n( $paging['page_size'] ); |
|
165 | + $return = number_format_i18n( $paging[ 'page_size' ] ); |
|
166 | 166 | break; |
167 | 167 | } |
168 | 168 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $widget_ops = array( |
13 | 13 | 'classname' => 'widget_gravityview_search', |
14 | - 'description' => __( 'A search form for a specific GravityView.', 'gravityview') |
|
14 | + 'description' => __( 'A search form for a specific GravityView.', 'gravityview' ) |
|
15 | 15 | ); |
16 | 16 | |
17 | 17 | $widget_display = array( |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | private function load_required_files() { |
37 | - if( !class_exists( 'GravityView_Widget_Search' ) ) { |
|
37 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
38 | 38 | gravityview_register_gravityview_widgets(); |
39 | 39 | } |
40 | 40 | } |
@@ -42,30 +42,30 @@ discard block |
||
42 | 42 | public function widget( $args, $instance ) { |
43 | 43 | |
44 | 44 | // Don't show unless a View ID has been set. |
45 | - if( empty( $instance['view_id'] ) ) { |
|
45 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
46 | 46 | |
47 | - do_action('gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class($this)), $instance ); |
|
47 | + do_action( 'gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class( $this ) ), $instance ); |
|
48 | 48 | |
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | 52 | /** This filter is documented in wp-includes/default-widgets.php */ |
53 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
|
53 | + $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base ); |
|
54 | 54 | |
55 | - echo $args['before_widget']; |
|
55 | + echo $args[ 'before_widget' ]; |
|
56 | 56 | |
57 | 57 | if ( $title ) { |
58 | - echo $args['before_title'] . $title . $args['after_title']; |
|
58 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // @todo Add to the widget configuration form |
62 | - $instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
62 | + $instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
63 | 63 | |
64 | - $instance['context'] = 'wp_widget'; |
|
64 | + $instance[ 'context' ] = 'wp_widget'; |
|
65 | 65 | |
66 | 66 | // form |
67 | - $instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] ); |
|
68 | - $instance['form'] = GVCommon::get_form( $instance['form_id'] ); |
|
67 | + $instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] ); |
|
68 | + $instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] ); |
|
69 | 69 | |
70 | 70 | // We don't want to overwrite existing context, etc. |
71 | 71 | $previous_view = GravityView_View::getInstance(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | new GravityView_View( $previous_view ); |
83 | 83 | |
84 | - echo $args['after_widget']; |
|
84 | + echo $args[ 'after_widget' ]; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $instance = $old_instance; |
93 | 93 | |
94 | - if( $this->is_preview() ) { |
|
94 | + if ( $this->is_preview() ) { |
|
95 | 95 | //Oh! Sorry but still not fully compatible with customizer |
96 | 96 | return $instance; |
97 | 97 | } |
@@ -104,21 +104,21 @@ discard block |
||
104 | 104 | 'search_clear' => 0 |
105 | 105 | ); |
106 | 106 | |
107 | - $new_instance = wp_parse_args( (array) $new_instance, $defaults ); |
|
107 | + $new_instance = wp_parse_args( (array)$new_instance, $defaults ); |
|
108 | 108 | |
109 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
110 | - $instance['view_id'] = absint( $new_instance['view_id'] ); |
|
111 | - $instance['search_fields'] = $new_instance['search_fields']; |
|
112 | - $instance['post_id'] = $new_instance['post_id']; |
|
113 | - $instance['search_clear'] = $new_instance['search_clear']; |
|
109 | + $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] ); |
|
110 | + $instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] ); |
|
111 | + $instance[ 'search_fields' ] = $new_instance[ 'search_fields' ]; |
|
112 | + $instance[ 'post_id' ] = $new_instance[ 'post_id' ]; |
|
113 | + $instance[ 'search_clear' ] = $new_instance[ 'search_clear' ]; |
|
114 | 114 | |
115 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance['post_id'], $instance['view_id'] ); |
|
115 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
116 | 116 | |
117 | 117 | //check if post_id is a valid post with embedded View |
118 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
118 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
119 | 119 | |
120 | 120 | // Share that the widget isn't brand new |
121 | - $instance['updated'] = 1; |
|
121 | + $instance[ 'updated' ] = 1; |
|
122 | 122 | |
123 | 123 | return $instance; |
124 | 124 | } |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | public function form( $instance ) { |
130 | 130 | |
131 | 131 | // @todo Make compatible with Customizer |
132 | - if( $this->is_preview() ) { |
|
132 | + if ( $this->is_preview() ) { |
|
133 | 133 | |
134 | - $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' ); |
|
134 | + $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' ); |
|
135 | 135 | |
136 | 136 | echo wpautop( GravityView_Admin::get_floaty() . $warning ); |
137 | 137 | |
@@ -146,18 +146,18 @@ discard block |
||
146 | 146 | 'search_clear' => 0 |
147 | 147 | ); |
148 | 148 | |
149 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
149 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
150 | 150 | |
151 | - $title = $instance['title']; |
|
152 | - $view_id = $instance['view_id']; |
|
153 | - $post_id = $instance['post_id']; |
|
154 | - $search_fields = $instance['search_fields']; |
|
155 | - $search_clear = $instance['search_clear']; |
|
151 | + $title = $instance[ 'title' ]; |
|
152 | + $view_id = $instance[ 'view_id' ]; |
|
153 | + $post_id = $instance[ 'post_id' ]; |
|
154 | + $search_fields = $instance[ 'search_fields' ]; |
|
155 | + $search_clear = $instance[ 'search_clear' ]; |
|
156 | 156 | |
157 | 157 | $views = GVCommon::get_all_views(); |
158 | 158 | |
159 | 159 | // If there are no views set up yet, we get outta here. |
160 | - if( empty( $views ) ) { ?> |
|
160 | + if ( empty( $views ) ) { ?> |
|
161 | 161 | <div id="select_gravityview_view"> |
162 | 162 | <div class="wrap"><?php echo GravityView_Post_Types::no_views_text(); ?></div> |
163 | 163 | </div> |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | } |
166 | 166 | ?> |
167 | 167 | |
168 | - <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
168 | + <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
169 | 169 | |
170 | 170 | <?php |
171 | 171 | /** |
172 | 172 | * Display errors generated for invalid embed IDs |
173 | 173 | * @see GravityView_View_Data::is_valid_embed_id |
174 | 174 | */ |
175 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
175 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
176 | 176 | ?> |
177 | 177 | <div class="error inline hide-on-view-change"> |
178 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
178 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
179 | 179 | </div> |
180 | 180 | <?php |
181 | 181 | unset ( $error ); |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | |
185 | 185 | <p> |
186 | 186 | <label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label> |
187 | - <select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat"> |
|
187 | + <select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat"> |
|
188 | 188 | <option value=""><?php esc_html_e( '— Select a View —', 'gravityview' ); ?></option> |
189 | 189 | <?php |
190 | - foreach( $views as $view_option ) { |
|
191 | - $title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
192 | - echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>'; |
|
190 | + foreach ( $views as $view_option ) { |
|
191 | + $title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title; |
|
192 | + echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>'; |
|
193 | 193 | } |
194 | 194 | ?> |
195 | 195 | </select> |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | * Display errors generated for invalid embed IDs |
202 | 202 | * @see GravityView_View_Data::is_valid_embed_id |
203 | 203 | */ |
204 | - if( !empty( $instance['error_post_id'] ) ) { |
|
204 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
205 | 205 | ?> |
206 | 206 | <div class="error inline"> |
207 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
207 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
208 | 208 | </div> |
209 | 209 | <?php |
210 | 210 | unset ( $error ); |
@@ -212,27 +212,27 @@ discard block |
||
212 | 212 | ?> |
213 | 213 | |
214 | 214 | <p> |
215 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
216 | - <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( $post_id ); ?>" /> |
|
215 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
216 | + <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( $post_id ); ?>" /> |
|
217 | 217 | <span class="howto"><?php |
218 | - 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' ); |
|
219 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
218 | + 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' ); |
|
219 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
220 | 220 | ?></span> |
221 | 221 | </p> |
222 | 222 | |
223 | 223 | <p> |
224 | - <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
225 | - <input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0"> |
|
226 | - <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
224 | + <label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
225 | + <input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0"> |
|
226 | + <input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
227 | 227 | </p> |
228 | 228 | |
229 | 229 | <hr /> |
230 | 230 | |
231 | 231 | <?php // @todo: move style to CSS ?> |
232 | 232 | <div style="margin-bottom: 1em;"> |
233 | - <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
234 | - <div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>"> |
|
235 | - <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
233 | + <label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
234 | + <div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>"> |
|
235 | + <input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
236 | 236 | </div> |
237 | 237 | |
238 | 238 | </div> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'post_category'; |
11 | 11 | |
12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
13 | 13 | |
14 | 14 | var $_gf_field_class_name = 'GF_Field_Post_Category'; |
15 | 15 | |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | |
23 | 23 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
24 | 24 | |
25 | - if( 'edit' === $context ) { |
|
25 | + if ( 'edit' === $context ) { |
|
26 | 26 | return $field_options; |
27 | 27 | } |
28 | 28 | |
29 | - $this->add_field_support('dynamic_data', $field_options ); |
|
30 | - $this->add_field_support('link_to_term', $field_options ); |
|
29 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
30 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
31 | 31 | |
32 | 32 | return $field_options; |
33 | 33 | } |