@@ -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 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | var $name = 'radio'; |
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_Radio'; |
15 | 15 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | var $name = 'radio'; |
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_Radio'; |
15 | 15 |
@@ -301,6 +301,7 @@ |
||
301 | 301 | * Make protected public |
302 | 302 | * @inheritDoc |
303 | 303 | * @access public |
304 | + * @param string $setting_name |
|
304 | 305 | */ |
305 | 306 | public function get_app_setting( $setting_name ) { |
306 | 307 |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | type="' . $field['type'] . '" |
419 | 419 | name="' . esc_attr( $name ) . '" |
420 | 420 | value="' . $value . '" ' . |
421 | - implode( ' ', $attributes ) . |
|
422 | - ' />'; |
|
421 | + implode( ' ', $attributes ) . |
|
422 | + ' />'; |
|
423 | 423 | |
424 | 424 | if ( $echo ) { |
425 | 425 | echo $html; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | array( |
649 | 649 | 'label' => _x( 'Permanently Delete', 'Setting: what to do when uninstalling plugin', 'gravityview' ), |
650 | 650 | 'value' => 'delete', |
651 | - 'tooltip' => sprintf( '<h6>%s</h6><p><span class="howto">%s</span></p><p>%s</p>', __( 'Delete all GravityView content and settings', 'gravityview' ), __( 'If you delete then re-install GravityView, it will be like installing GravityView for the first time.', 'gravityview' ), __( 'When GravityView is uninstalled and deleted, delete all Views, GravityView entry approvals, GravityView-generated entry notes (including approval and entry creator changes), and GravityView plugin settings. No Gravity Forms data will be touched.', 'gravityview' ) ), |
|
651 | + 'tooltip' => sprintf( '<h6>%s</h6><p><span class="howto">%s</span></p><p>%s</p>', __( 'Delete all GravityView content and settings', 'gravityview' ), __( 'If you delete then re-install GravityView, it will be like installing GravityView for the first time.', 'gravityview' ), __( 'When GravityView is uninstalled and deleted, delete all Views, GravityView entry approvals, GravityView-generated entry notes (including approval and entry creator changes), and GravityView plugin settings. No Gravity Forms data will be touched.', 'gravityview' ) ), |
|
652 | 652 | ), |
653 | 653 | ), |
654 | 654 | 'description' => sprintf( __( 'Should GravityView content and entry approval status be removed from the site when the GravityView plugin is deleted?', 'gravityview' ), __( 'Permanently Delete', 'gravityview' ) ), |
@@ -674,36 +674,36 @@ discard block |
||
674 | 674 | } |
675 | 675 | |
676 | 676 | |
677 | - $sections = array( |
|
678 | - array( |
|
679 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
680 | - 'fields' => $fields, |
|
681 | - ) |
|
682 | - ); |
|
677 | + $sections = array( |
|
678 | + array( |
|
679 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
680 | + 'fields' => $fields, |
|
681 | + ) |
|
682 | + ); |
|
683 | 683 | |
684 | - // custom 'update settings' button |
|
685 | - $button = array( |
|
686 | - 'class' => 'button button-primary button-hero', |
|
687 | - 'type' => 'save', |
|
688 | - ); |
|
684 | + // custom 'update settings' button |
|
685 | + $button = array( |
|
686 | + 'class' => 'button button-primary button-hero', |
|
687 | + 'type' => 'save', |
|
688 | + ); |
|
689 | 689 | |
690 | 690 | if( $disabled_attribute ) { |
691 | 691 | $button['disabled'] = $disabled_attribute; |
692 | 692 | } |
693 | 693 | |
694 | 694 | |
695 | - /** |
|
696 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
697 | - * Extensions can tap in here to insert their own section and settings. |
|
698 | - * <code> |
|
699 | - * $sections[] = array( |
|
700 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
701 | - * 'fields' => $settings, |
|
702 | - * ); |
|
703 | - * </code> |
|
704 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
705 | - */ |
|
706 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
695 | + /** |
|
696 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
697 | + * Extensions can tap in here to insert their own section and settings. |
|
698 | + * <code> |
|
699 | + * $sections[] = array( |
|
700 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
701 | + * 'fields' => $settings, |
|
702 | + * ); |
|
703 | + * </code> |
|
704 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
705 | + */ |
|
706 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
707 | 707 | |
708 | 708 | // If there are extensions, add a section for them |
709 | 709 | if ( ! empty( $extension_sections ) ) { |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | } |
717 | 717 | } |
718 | 718 | |
719 | - $k = count( $extension_sections ) - 1 ; |
|
720 | - $extension_sections[ $k ]['fields'][] = $button; |
|
719 | + $k = count( $extension_sections ) - 1 ; |
|
720 | + $extension_sections[ $k ]['fields'][] = $button; |
|
721 | 721 | $sections = array_merge( $sections, $extension_sections ); |
722 | 722 | } else { |
723 | - // add the 'update settings' button to the general section |
|
724 | - $sections[0]['fields'][] = $button; |
|
725 | - } |
|
723 | + // add the 'update settings' button to the general section |
|
724 | + $sections[0]['fields'][] = $button; |
|
725 | + } |
|
726 | 726 | |
727 | 727 | return $sections; |
728 | 728 | } |
@@ -441,8 +441,9 @@ |
||
441 | 441 | $field['name'] = 'gform-settings-save'; |
442 | 442 | $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
443 | 443 | |
444 | - if ( ! rgar( $field, 'value' ) ) |
|
445 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
444 | + if ( ! rgar( $field, 'value' ) ) { |
|
445 | + $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
446 | + } |
|
446 | 447 | |
447 | 448 | $output = $this->settings_submit( $field, false ); |
448 | 449 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function __construct( $prevent_multiple_instances = '' ) { |
73 | 73 | |
74 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
74 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
75 | 75 | return parent::__construct(); |
76 | 76 | } |
77 | 77 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function get_instance() { |
85 | 85 | |
86 | - if( empty( self::$instance ) ) { |
|
86 | + if ( empty( self::$instance ) ) { |
|
87 | 87 | self::$instance = new self( 'get_instance' ); |
88 | 88 | } |
89 | 89 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | * Prevent Gravity Forms from showing the uninstall tab on the settings page |
107 | 107 | * @hack |
108 | 108 | */ |
109 | - if( $caps === $this->_capabilities_uninstall ) { |
|
109 | + if ( $caps === $this->_capabilities_uninstall ) { |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 | |
113 | - if( empty( $caps ) ) { |
|
113 | + if ( empty( $caps ) ) { |
|
114 | 114 | $caps = array( 'gravityview_full_access' ); |
115 | 115 | } |
116 | 116 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
134 | 134 | |
135 | 135 | /** @since 1.7.6 */ |
136 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
136 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
137 | 137 | |
138 | 138 | parent::init_admin(); |
139 | 139 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function modify_app_settings_menu_title( $setting_tabs ) { |
149 | 149 | |
150 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
150 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
151 | 151 | |
152 | 152 | return $setting_tabs; |
153 | 153 | } |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function _load_license_handler() { |
166 | 166 | |
167 | - if( !empty( $this->License_Handler ) ) { |
|
167 | + if ( ! empty( $this->License_Handler ) ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
171 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
172 | 172 | |
173 | 173 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
174 | 174 | } |
@@ -180,60 +180,60 @@ discard block |
||
180 | 180 | function license_key_notice() { |
181 | 181 | |
182 | 182 | // Only show on GravityView pages |
183 | - if( ! gravityview_is_admin_page() ) { |
|
183 | + if ( ! gravityview_is_admin_page() ) { |
|
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
187 | - $license_status = self::getSetting('license_key_status'); |
|
188 | - $license_id = self::getSetting('license_key'); |
|
187 | + $license_status = self::getSetting( 'license_key_status' ); |
|
188 | + $license_id = self::getSetting( 'license_key' ); |
|
189 | 189 | $license_id = empty( $license_id ) ? 'license' : $license_id; |
190 | 190 | |
191 | - $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
|
191 | + $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * I wanted to remove the period from after the buttons in the string, |
195 | 195 | * but didn't want to mess up the translation strings for the translators. |
196 | 196 | */ |
197 | 197 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
198 | - $title = __('Inactive License', 'gravityview'); |
|
198 | + $title = __( 'Inactive License', 'gravityview' ); |
|
199 | 199 | $status = ''; |
200 | 200 | $update_below = false; |
201 | 201 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
202 | 202 | switch ( $license_status ) { |
203 | 203 | case 'invalid': |
204 | - $title = __('Invalid License', 'gravityview'); |
|
205 | - $status = __('is invalid', 'gravityview'); |
|
204 | + $title = __( 'Invalid License', 'gravityview' ); |
|
205 | + $status = __( 'is invalid', 'gravityview' ); |
|
206 | 206 | break; |
207 | 207 | case 'deactivated': |
208 | - $status = __('is inactive', 'gravityview'); |
|
209 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
208 | + $status = __( 'is inactive', 'gravityview' ); |
|
209 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
210 | 210 | break; |
211 | 211 | /** @noinspection PhpMissingBreakStatementInspection */ |
212 | 212 | case '': |
213 | 213 | $license_status = 'site_inactive'; |
214 | 214 | // break intentionally left blank |
215 | 215 | case 'site_inactive': |
216 | - $status = __('has not been activated', 'gravityview'); |
|
217 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
216 | + $status = __( 'has not been activated', 'gravityview' ); |
|
217 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
218 | 218 | break; |
219 | 219 | } |
220 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
220 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
221 | 221 | |
222 | 222 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
223 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
223 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
224 | 224 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
225 | 225 | } else { |
226 | 226 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . $primary_button_link . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
227 | 227 | } |
228 | 228 | |
229 | - if( !empty( $status ) ) { |
|
229 | + if ( ! empty( $status ) ) { |
|
230 | 230 | GravityView_Admin_Notices::add_notice( array( |
231 | 231 | 'message' => $message, |
232 | 232 | 'class' => 'updated', |
233 | 233 | 'title' => $title, |
234 | 234 | 'cap' => 'gravityview_edit_settings', |
235 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
236 | - )); |
|
235 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
236 | + ) ); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | $styles = parent::styles(); |
247 | 247 | |
248 | - $styles[] = array( |
|
248 | + $styles[ ] = array( |
|
249 | 249 | 'handle' => 'gravityview_settings', |
250 | 250 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
251 | 251 | 'version' => GravityView_Plugin::version, |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @return void |
269 | 269 | */ |
270 | 270 | public function add_network_menu() { |
271 | - if( GravityView_Plugin::is_network_activated() ) { |
|
271 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
272 | 272 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
273 | 273 | } |
274 | 274 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * If multisite and not network admin, we don't want the settings to show. |
286 | 286 | * @since 1.7.6 |
287 | 287 | */ |
288 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
288 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
296 | 296 | |
297 | - if( $show_submenu ) { |
|
297 | + if ( $show_submenu ) { |
|
298 | 298 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
299 | 299 | } |
300 | 300 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | /** |
326 | 326 | * Backward compatibility with Redux |
327 | 327 | */ |
328 | - if( $setting_name === 'license' ) { |
|
328 | + if ( $setting_name === 'license' ) { |
|
329 | 329 | return array( |
330 | 330 | 'license' => parent::get_app_setting( 'license_key' ), |
331 | 331 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | $return = $text . $activation; |
391 | 391 | |
392 | - if( $echo ) { |
|
392 | + if ( $echo ) { |
|
393 | 393 | echo $return; |
394 | 394 | } |
395 | 395 | |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | */ |
417 | 417 | public function settings_submit( $field, $echo = true ) { |
418 | 418 | |
419 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
419 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
420 | 420 | |
421 | 421 | $attributes = $this->get_field_attributes( $field ); |
422 | 422 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
423 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
423 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
424 | 424 | |
425 | 425 | |
426 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
427 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
426 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
427 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
428 | 428 | |
429 | 429 | if ( empty( $value ) ) { |
430 | 430 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $attributes = $this->get_field_attributes( $field ); |
434 | 434 | |
435 | 435 | $html = '<input |
436 | - type="' . $field['type'] . '" |
|
436 | + type="' . $field[ 'type' ] . '" |
|
437 | 437 | name="' . esc_attr( $name ) . '" |
438 | 438 | value="' . $value . '" ' . |
439 | 439 | implode( ' ', $attributes ) . |
@@ -455,16 +455,16 @@ discard block |
||
455 | 455 | * @return string |
456 | 456 | */ |
457 | 457 | public function settings_save( $field, $echo = true ) { |
458 | - $field['type'] = 'submit'; |
|
459 | - $field['name'] = 'gform-settings-save'; |
|
460 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
458 | + $field[ 'type' ] = 'submit'; |
|
459 | + $field[ 'name' ] = 'gform-settings-save'; |
|
460 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
461 | 461 | |
462 | 462 | if ( ! rgar( $field, 'value' ) ) |
463 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
463 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
464 | 464 | |
465 | 465 | $output = $this->settings_submit( $field, false ); |
466 | 466 | |
467 | - if( $echo ) { |
|
467 | + if ( $echo ) { |
|
468 | 468 | echo $output; |
469 | 469 | } |
470 | 470 | |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | parent::single_setting_label( $field ); |
482 | 482 | |
483 | 483 | // Added by GravityView |
484 | - if ( isset( $field['description'] ) ) { |
|
485 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
484 | + if ( isset( $field[ 'description' ] ) ) { |
|
485 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | } |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | |
545 | 545 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
546 | 546 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
547 | - if( $local_key !== $response_key ) { |
|
547 | + if ( $local_key !== $response_key ) { |
|
548 | 548 | |
549 | - unset( $posted_settings['license_key_response'] ); |
|
550 | - unset( $posted_settings['license_key_status'] ); |
|
551 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
549 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
550 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
551 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | return $posted_settings; |
@@ -583,25 +583,25 @@ discard block |
||
583 | 583 | 'label' => __( 'License Key', 'gravityview' ), |
584 | 584 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
585 | 585 | 'type' => 'edd_license', |
586 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
587 | - 'default_value' => $default_settings['license_key'], |
|
586 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
587 | + 'default_value' => $default_settings[ 'license_key' ], |
|
588 | 588 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
589 | 589 | ), |
590 | 590 | array( |
591 | 591 | 'name' => 'license_key_response', |
592 | - 'default_value' => $default_settings['license_key_response'], |
|
592 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
593 | 593 | 'type' => 'hidden', |
594 | 594 | ), |
595 | 595 | array( |
596 | 596 | 'name' => 'license_key_status', |
597 | - 'default_value' => $default_settings['license_key_status'], |
|
597 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
598 | 598 | 'type' => 'hidden', |
599 | 599 | ), |
600 | 600 | array( |
601 | 601 | 'name' => 'support-email', |
602 | 602 | 'type' => 'text', |
603 | 603 | 'validate' => 'email', |
604 | - 'default_value' => $default_settings['support-email'], |
|
604 | + 'default_value' => $default_settings[ 'support-email' ], |
|
605 | 605 | 'label' => __( 'Support Email', 'gravityview' ), |
606 | 606 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
607 | 607 | 'class' => 'code regular-text', |
@@ -613,44 +613,44 @@ discard block |
||
613 | 613 | 'name' => 'support_port', |
614 | 614 | 'type' => 'radio', |
615 | 615 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
616 | - 'default_value' => $default_settings['support_port'], |
|
616 | + 'default_value' => $default_settings[ 'support_port' ], |
|
617 | 617 | 'horizontal' => 1, |
618 | 618 | 'choices' => array( |
619 | 619 | array( |
620 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
620 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
621 | 621 | 'value' => '1', |
622 | 622 | ), |
623 | 623 | array( |
624 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
624 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
625 | 625 | 'value' => '0', |
626 | 626 | ), |
627 | 627 | ), |
628 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
628 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
629 | 629 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
630 | 630 | ), |
631 | 631 | array( |
632 | 632 | 'name' => 'no-conflict-mode', |
633 | 633 | 'type' => 'radio', |
634 | 634 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
635 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
635 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
636 | 636 | 'horizontal' => 1, |
637 | 637 | 'choices' => array( |
638 | 638 | array( |
639 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
639 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
640 | 640 | 'value' => '1', |
641 | 641 | ), |
642 | 642 | array( |
643 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
643 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
644 | 644 | 'value' => '0', |
645 | 645 | ), |
646 | 646 | ), |
647 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
647 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
648 | 648 | ), |
649 | 649 | array( |
650 | 650 | 'name' => 'delete-on-uninstall', |
651 | 651 | 'type' => 'radio', |
652 | 652 | 'label' => __( 'Remove Data on Delete?', 'gravityview' ), |
653 | - 'default_value' => $default_settings['delete-on-uninstall'], |
|
653 | + 'default_value' => $default_settings[ 'delete-on-uninstall' ], |
|
654 | 654 | 'horizontal' => 1, |
655 | 655 | 'choices' => array( |
656 | 656 | array( |
@@ -676,20 +676,20 @@ discard block |
||
676 | 676 | * @since 1.7.4 |
677 | 677 | */ |
678 | 678 | foreach ( $fields as &$field ) { |
679 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
680 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
681 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
682 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
679 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
680 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
681 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
682 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
683 | 683 | |
684 | - if( $disabled_attribute ) { |
|
685 | - $field['disabled'] = $disabled_attribute; |
|
684 | + if ( $disabled_attribute ) { |
|
685 | + $field[ 'disabled' ] = $disabled_attribute; |
|
686 | 686 | } |
687 | 687 | } |
688 | 688 | |
689 | 689 | |
690 | 690 | $sections = array( |
691 | 691 | array( |
692 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
692 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
693 | 693 | 'fields' => $fields, |
694 | 694 | ) |
695 | 695 | ); |
@@ -700,8 +700,8 @@ discard block |
||
700 | 700 | 'type' => 'save', |
701 | 701 | ); |
702 | 702 | |
703 | - if( $disabled_attribute ) { |
|
704 | - $button['disabled'] = $disabled_attribute; |
|
703 | + if ( $disabled_attribute ) { |
|
704 | + $button[ 'disabled' ] = $disabled_attribute; |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | |
@@ -721,20 +721,20 @@ discard block |
||
721 | 721 | // If there are extensions, add a section for them |
722 | 722 | if ( ! empty( $extension_sections ) ) { |
723 | 723 | |
724 | - if( $disabled_attribute ) { |
|
724 | + if ( $disabled_attribute ) { |
|
725 | 725 | foreach ( $extension_sections as &$section ) { |
726 | - foreach ( $section['fields'] as &$field ) { |
|
727 | - $field['disabled'] = $disabled_attribute; |
|
726 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
727 | + $field[ 'disabled' ] = $disabled_attribute; |
|
728 | 728 | } |
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
732 | - $k = count( $extension_sections ) - 1 ; |
|
733 | - $extension_sections[ $k ]['fields'][] = $button; |
|
732 | + $k = count( $extension_sections ) - 1; |
|
733 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
734 | 734 | $sections = array_merge( $sections, $extension_sections ); |
735 | 735 | } else { |
736 | 736 | // add the 'update settings' button to the general section |
737 | - $sections[0]['fields'][] = $button; |
|
737 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | return $sections; |