@@ -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 |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | function __construct() { |
9 | 9 | |
10 | - add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 ); |
|
10 | + add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 ); |
|
11 | 11 | |
12 | - add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
|
12 | + add_action( 'gravityview_log_debug', array( $this, 'log_debug' ), 10, 2 ); |
|
13 | 13 | |
14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
15 | 15 | add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' ); |
35 | 35 | } |
36 | 36 | |
37 | - $panels[] = new GravityView_Debug_Bar; |
|
37 | + $panels[ ] = new GravityView_Debug_Bar; |
|
38 | 38 | |
39 | 39 | return $panels; |
40 | 40 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array $supported_plugins List of plugins |
45 | 45 | */ |
46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
47 | + $supported_plugins[ 'gravityview' ] = 'GravityView'; |
|
48 | 48 | return $supported_plugins; |
49 | 49 | } |
50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return string "print_r" or "var_export" |
73 | 73 | */ |
74 | 74 | static function get_print_function() { |
75 | - if( ob_get_level() > 0 ) { |
|
75 | + if ( ob_get_level() > 0 ) { |
|
76 | 76 | $function = 'var_export'; |
77 | 77 | } else { |
78 | 78 | $function = 'print_r'; |
@@ -88,36 +88,36 @@ discard block |
||
88 | 88 | $notice = array( |
89 | 89 | 'message' => $function( $message, true ), |
90 | 90 | 'data' => $data, |
91 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
91 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
92 | 92 | ); |
93 | 93 | |
94 | - if( !in_array( $notice, self::$notices ) ) { |
|
95 | - self::$notices[] = $notice; |
|
94 | + if ( ! in_array( $notice, self::$notices ) ) { |
|
95 | + self::$notices[ ] = $notice; |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( class_exists("GFLogging") ) { |
|
98 | + if ( class_exists( "GFLogging" ) ) { |
|
99 | 99 | GFLogging::include_logger(); |
100 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
100 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG ); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - static function log_error( $message = '', $data = null ) { |
|
104 | + static function log_error( $message = '', $data = null ) { |
|
105 | 105 | |
106 | 106 | $function = self::get_print_function(); |
107 | 107 | |
108 | 108 | $error = array( |
109 | 109 | 'message' => $message, |
110 | 110 | 'data' => $data, |
111 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
111 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
112 | 112 | ); |
113 | 113 | |
114 | - if( !in_array( $error, self::$errors ) ) { |
|
115 | - self::$errors[] = $error; |
|
114 | + if ( ! in_array( $error, self::$errors ) ) { |
|
115 | + self::$errors[ ] = $error; |
|
116 | 116 | } |
117 | 117 | |
118 | - if ( class_exists("GFLogging") ) { |
|
118 | + if ( class_exists( "GFLogging" ) ) { |
|
119 | 119 | GFLogging::include_logger(); |
120 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
120 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::ERROR ); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | $atts = wp_parse_args( $atts, $defaults ); |
67 | 67 | |
68 | - foreach( $atts as $key => $val ) { |
|
68 | + foreach ( $atts as $key => $val ) { |
|
69 | 69 | $this->{$key} = $val; |
70 | 70 | } |
71 | 71 | |
72 | - $this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
72 | + $this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
73 | 73 | |
74 | 74 | $this->set_image_size(); |
75 | 75 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function validate_image_src() { |
87 | 87 | |
88 | - if ( !$this->validate_src ) { return true; } |
|
88 | + if ( ! $this->validate_src ) { return true; } |
|
89 | 89 | |
90 | 90 | $info = pathinfo( $this->src ); |
91 | 91 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | * @filter `gravityview_image_extensions` Extensions that GravityView recognizes as valid images to be shown in an `img` tag |
94 | 94 | * @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico']` |
95 | 95 | */ |
96 | - $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' )); |
|
96 | + $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ) ); |
|
97 | 97 | |
98 | - return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts); |
|
98 | + return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | |
112 | 112 | // And there is no string size passed |
113 | 113 | // And we want to get the image size using PHP |
114 | - if ( empty( $string ) && !empty( $this->getimagesize ) ) { |
|
114 | + if ( empty( $string ) && ! empty( $this->getimagesize ) ) { |
|
115 | 115 | |
116 | 116 | $image_size = getimagesize( $this->src ); |
117 | 117 | |
118 | - if ( !empty( $image_size ) ) { |
|
118 | + if ( ! empty( $image_size ) ) { |
|
119 | 119 | list( $width, $height ) = $image_size; |
120 | 120 | } |
121 | 121 | |
@@ -128,33 +128,33 @@ discard block |
||
128 | 128 | * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels |
129 | 129 | */ |
130 | 130 | $image_sizes = apply_filters( 'gravityview_image_sizes', array( |
131 | - 'tiny' => array('width' => 40, 'height' => 30), |
|
132 | - 'small' => array('width' => 100, 'height' => 75), |
|
133 | - 'medium' => array('width' => 250, 'height' => 188), |
|
134 | - 'large' => array('width' => 448, 'height' => 336), |
|
131 | + 'tiny' => array( 'width' => 40, 'height' => 30 ), |
|
132 | + 'small' => array( 'width' => 100, 'height' => 75 ), |
|
133 | + 'medium' => array( 'width' => 250, 'height' => 188 ), |
|
134 | + 'large' => array( 'width' => 448, 'height' => 336 ), |
|
135 | 135 | ) ); |
136 | 136 | |
137 | - switch( $this->size ) { |
|
137 | + switch ( $this->size ) { |
|
138 | 138 | case 'tiny': |
139 | - extract($image_sizes['tiny']); |
|
139 | + extract( $image_sizes[ 'tiny' ] ); |
|
140 | 140 | break; |
141 | 141 | case 'small': |
142 | 142 | case 's': |
143 | 143 | case 'thumb': |
144 | - extract($image_sizes['small']); |
|
144 | + extract( $image_sizes[ 'small' ] ); |
|
145 | 145 | break; |
146 | 146 | case 'm': |
147 | 147 | case 'medium': |
148 | - extract($image_sizes['medium']); |
|
148 | + extract( $image_sizes[ 'medium' ] ); |
|
149 | 149 | break; |
150 | 150 | case 'large': |
151 | 151 | case 'l': |
152 | - extract($image_sizes['large']); |
|
152 | + extract( $image_sizes[ 'large' ] ); |
|
153 | 153 | break; |
154 | 154 | default: |
155 | 155 | // Verify that the passed sizes are integers. |
156 | - $width = !empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
157 | - $height = !empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
156 | + $width = ! empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
157 | + $height = ! empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | |
72 | 72 | add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
73 | 73 | |
74 | - add_action( 'admin_init', array( $this, 'settings') ); |
|
74 | + add_action( 'admin_init', array( $this, 'settings' ) ); |
|
75 | 75 | |
76 | 76 | add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 ); |
77 | 77 | |
78 | 78 | add_action( 'gravityview/metaboxes/before_render', array( $this, 'add_metabox_tab' ) ); |
79 | 79 | |
80 | - if( false === $this->is_extension_supported() ) { |
|
80 | + if ( false === $this->is_extension_supported() ) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $tab_settings = $this->tab_settings(); |
117 | 117 | |
118 | 118 | // Don't add a tab if it's empty. |
119 | - if( empty( $tab_settings ) ) { |
|
119 | + if ( empty( $tab_settings ) ) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
135 | 135 | |
136 | 136 | // Force the screen to be GravityView |
137 | - $tab['screen'] = 'gravityview'; |
|
137 | + $tab[ 'screen' ] = 'gravityview'; |
|
138 | 138 | |
139 | - if( class_exists('GravityView_Metabox_Tab') ) { |
|
139 | + if ( class_exists( 'GravityView_Metabox_Tab' ) ) { |
|
140 | 140 | |
141 | - $metabox = new GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] ); |
|
141 | + $metabox = new GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] ); |
|
142 | 142 | |
143 | 143 | GravityView_Metabox_Tabs::add( $metabox ); |
144 | 144 | |
145 | 145 | } else { |
146 | 146 | |
147 | - add_meta_box( 'gravityview_'.$tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] ); |
|
147 | + add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] ); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function load_plugin_textdomain() { |
162 | 162 | |
163 | - if( empty( $this->_text_domain ) ) { |
|
163 | + if ( empty( $this->_text_domain ) ) { |
|
164 | 164 | do_action( 'gravityview_log_debug', __METHOD__ . ': Extension translation cannot be loaded; the `_text_domain` variable is not defined', $this ); |
165 | 165 | return; |
166 | 166 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $lang_dir = dirname( plugin_basename( $path ) ) . '/languages/'; |
173 | 173 | |
174 | 174 | // Traditional WordPress plugin locale filter |
175 | - $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
175 | + $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
176 | 176 | |
177 | 177 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
178 | 178 | |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function get_license() { |
204 | 204 | |
205 | - if( !class_exists( 'GravityView_Settings' ) ) { |
|
205 | + if ( ! class_exists( 'GravityView_Settings' ) ) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | |
209 | - $license = GravityView_Settings::getSetting('license'); |
|
209 | + $license = GravityView_Settings::getSetting( 'license' ); |
|
210 | 210 | |
211 | 211 | return $license; |
212 | 212 | } |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | public function settings() { |
220 | 220 | |
221 | 221 | // If doing ajax, get outta here |
222 | - if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
222 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
226 | + if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
227 | 227 | |
228 | 228 | $file_path = plugin_dir_path( __FILE__ ) . 'lib/EDD_SL_Plugin_Updater.php'; |
229 | 229 | |
230 | 230 | // This file may be in the lib/ directory already |
231 | - if( ! file_exists( $file_path ) ) { |
|
231 | + if ( ! file_exists( $file_path ) ) { |
|
232 | 232 | $file_path = plugin_dir_path( __FILE__ ) . '/EDD_SL_Plugin_Updater.php'; |
233 | 233 | } |
234 | 234 | |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | $license = $this->get_license(); |
239 | 239 | |
240 | 240 | // Don't update if invalid license. |
241 | - if( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) { return; } |
|
241 | + if ( false === $license || empty( $license[ 'status' ] ) || strtolower( $license[ 'status' ] ) !== 'valid' ) { return; } |
|
242 | 242 | |
243 | 243 | new EDD_SL_Plugin_Updater( |
244 | 244 | $this->_remote_update_url, |
245 | 245 | $this->_path, |
246 | 246 | array( |
247 | 247 | 'version' => $this->_version, // current version number |
248 | - 'license' => $license['license'], |
|
248 | + 'license' => $license[ 'license' ], |
|
249 | 249 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
250 | - 'item_name' => $this->_title, // name of this plugin |
|
250 | + 'item_name' => $this->_title, // name of this plugin |
|
251 | 251 | 'author' => strip_tags( $this->_author ) // author of this plugin |
252 | 252 | ) |
253 | 253 | ); |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function admin_notice() { |
262 | 262 | |
263 | - if( empty( self::$admin_notices ) ) { |
|
263 | + if ( empty( self::$admin_notices ) ) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | - foreach( self::$admin_notices as $key => $notice ) { |
|
267 | + foreach ( self::$admin_notices as $key => $notice ) { |
|
268 | 268 | |
269 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
270 | - echo wpautop( $notice['message'] ); |
|
269 | + echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">'; |
|
270 | + echo wpautop( $notice[ 'message' ] ); |
|
271 | 271 | echo '<div class="clear"></div>'; |
272 | 272 | echo '</div>'; |
273 | 273 | } |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public static function add_notice( $notice = array() ) { |
284 | 284 | |
285 | - if( is_array( $notice ) && !isset( $notice['message'] ) ) { |
|
286 | - do_action( 'gravityview_log_error', __CLASS__.'[add_notice] Notice not set', $notice ); |
|
285 | + if ( is_array( $notice ) && ! isset( $notice[ 'message' ] ) ) { |
|
286 | + do_action( 'gravityview_log_error', __CLASS__ . '[add_notice] Notice not set', $notice ); |
|
287 | 287 | return; |
288 | - } else if( is_string( $notice ) ) { |
|
288 | + } else if ( is_string( $notice ) ) { |
|
289 | 289 | $notice = array( 'message' => $notice ); |
290 | 290 | } |
291 | 291 | |
292 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
292 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
293 | 293 | |
294 | - self::$admin_notices[] = $notice; |
|
294 | + self::$admin_notices[ ] = $notice; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -346,17 +346,17 @@ discard block |
||
346 | 346 | |
347 | 347 | $message = ''; |
348 | 348 | |
349 | - if( !class_exists( 'GravityView_Plugin' ) ) { |
|
349 | + if ( ! class_exists( 'GravityView_Plugin' ) ) { |
|
350 | 350 | |
351 | - $message = sprintf( __('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title ); |
|
351 | + $message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), $this->_title ); |
|
352 | 352 | |
353 | - } else if( false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version , ">=") ) { |
|
353 | + } else if ( false === version_compare( GravityView_Plugin::version, $this->_min_gravityview_version, ">=" ) ) { |
|
354 | 354 | |
355 | - $message = sprintf( __('The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_gravityview_version.'</tt>' ); |
|
355 | + $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>' . $this->_min_gravityview_version . '</tt>' ); |
|
356 | 356 | |
357 | - } else if( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=") ) { |
|
357 | + } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) { |
|
358 | 358 | |
359 | - $message = sprintf( __('The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_php_version.'</tt>' ); |
|
359 | + $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>' . $this->_min_php_version . '</tt>' ); |
|
360 | 360 | |
361 | 361 | } else { |
362 | 362 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | self::add_notice( $message ); |
370 | 370 | |
371 | - do_action( 'gravityview_log_error', __METHOD__. ' ' . $message ); |
|
371 | + do_action( 'gravityview_log_error', __METHOD__ . ' ' . $message ); |
|
372 | 372 | |
373 | 373 | self::$is_compatible = false; |
374 | 374 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | function __construct( ) { |
14 | 14 | |
15 | - $name = __('GravityView Recent Entries', 'gravityview'); |
|
15 | + $name = __( 'GravityView Recent Entries', 'gravityview' ); |
|
16 | 16 | |
17 | 17 | $widget_options = array( |
18 | 18 | 'description' => __( 'Display the most recent entries for a View', 'gravityview' ), |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | private function initialize() { |
27 | 27 | |
28 | - add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') ); |
|
28 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
29 | 29 | |
30 | 30 | add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) ); |
31 | 31 | |
@@ -38,21 +38,21 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function ajax_get_view_merge_tag_data() { |
40 | 40 | |
41 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) { |
|
41 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) { |
|
42 | 42 | exit( false ); |
43 | 43 | } |
44 | 44 | |
45 | - $form_id = gravityview_get_form_id( $_POST['view_id'] ); |
|
45 | + $form_id = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
46 | 46 | |
47 | 47 | $form = RGFormsModel::get_form_meta( $form_id ); |
48 | 48 | |
49 | 49 | $output = array( |
50 | 50 | 'form' => array( |
51 | - 'id' => $form['id'], |
|
52 | - 'title' => $form['title'], |
|
53 | - 'fields' => $form['fields'], |
|
51 | + 'id' => $form[ 'id' ], |
|
52 | + 'title' => $form[ 'title' ], |
|
53 | + 'fields' => $form[ 'fields' ], |
|
54 | 54 | ), |
55 | - 'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ), |
|
55 | + 'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ), |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | echo json_encode( $output ); |
@@ -68,19 +68,19 @@ discard block |
||
68 | 68 | function admin_enqueue_scripts() { |
69 | 69 | global $pagenow; |
70 | 70 | |
71 | - if( $pagenow === 'widgets.php' ) { |
|
71 | + if ( $pagenow === 'widgets.php' ) { |
|
72 | 72 | |
73 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
73 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
74 | 74 | |
75 | 75 | GravityView_Admin_Views::enqueue_gravity_forms_scripts(); |
76 | 76 | |
77 | - wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
77 | + wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version ); |
|
78 | 78 | |
79 | 79 | wp_localize_script( 'gravityview_widgets', 'GVWidgets', array( |
80 | 80 | 'nonce' => wp_create_nonce( 'gravityview_ajax_widget' ) |
81 | - )); |
|
81 | + ) ); |
|
82 | 82 | |
83 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version ); |
|
83 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | } |
@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | function widget( $args, $instance ) { |
96 | 96 | |
97 | 97 | // Don't have the Customizer render too soon. |
98 | - if( empty( $instance['view_id'] ) ) { |
|
98 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | - $args['id'] = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries'; |
|
103 | - $instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : ''; |
|
102 | + $args[ 'id' ] = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries'; |
|
103 | + $instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : ''; |
|
104 | 104 | |
105 | - $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] ); |
|
105 | + $title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] ); |
|
106 | 106 | |
107 | - echo $args['before_widget']; |
|
107 | + echo $args[ 'before_widget' ]; |
|
108 | 108 | |
109 | - if ( !empty( $title ) ) { |
|
110 | - echo $args['before_title'] . $title . $args['after_title']; |
|
109 | + if ( ! empty( $title ) ) { |
|
110 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance ); |
129 | 129 | |
130 | - echo $args['after_widget']; |
|
130 | + echo $args[ 'after_widget' ]; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | private function get_output( $instance ) { |
143 | 143 | |
144 | - $form_id = gravityview_get_form_id( $instance['view_id'] ); |
|
144 | + $form_id = gravityview_get_form_id( $instance[ 'view_id' ] ); |
|
145 | 145 | |
146 | 146 | $form = gravityview_get_form( $form_id ); |
147 | 147 | |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | * @since 1.6.1 |
152 | 152 | * @var int $entry_link_post_id The ID to use as the parent post for the entry |
153 | 153 | */ |
154 | - $entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id']; |
|
154 | + $entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ]; |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Generate list output |
158 | 158 | * @since 1.7.2 |
159 | 159 | */ |
160 | - $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' ); |
|
160 | + $List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget' ); |
|
161 | 161 | |
162 | 162 | $output = $List->get_output(); |
163 | 163 | |
@@ -182,30 +182,30 @@ discard block |
||
182 | 182 | private function get_entries( $instance, $form_id ) { |
183 | 183 | |
184 | 184 | // Get the settings for the View ID |
185 | - $view_settings = gravityview_get_template_settings( $instance['view_id'] ); |
|
185 | + $view_settings = gravityview_get_template_settings( $instance[ 'view_id' ] ); |
|
186 | 186 | |
187 | 187 | // Set the context view ID to avoid conflicts with the Advanced Filter extension. |
188 | - $criteria['context_view_id'] = $instance['view_id']; |
|
188 | + $criteria[ 'context_view_id' ] = $instance[ 'view_id' ]; |
|
189 | 189 | |
190 | - $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10; |
|
191 | - $view_settings['id'] = $instance['view_id']; |
|
192 | - $view_settings['page_size'] = $instance['limit']; |
|
190 | + $instance[ 'limit' ] = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10; |
|
191 | + $view_settings[ 'id' ] = $instance[ 'view_id' ]; |
|
192 | + $view_settings[ 'page_size' ] = $instance[ 'limit' ]; |
|
193 | 193 | |
194 | 194 | // Prepare paging criteria |
195 | - $criteria['paging'] = array( |
|
195 | + $criteria[ 'paging' ] = array( |
|
196 | 196 | 'offset' => 0, |
197 | - 'page_size' => $instance['limit'] |
|
197 | + 'page_size' => $instance[ 'limit' ] |
|
198 | 198 | ); |
199 | 199 | |
200 | 200 | // Prepare Search Criteria |
201 | - $criteria['search_criteria'] = array( 'field_filters' => array() ); |
|
202 | - $criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']); |
|
203 | - $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
201 | + $criteria[ 'search_criteria' ] = array( 'field_filters' => array() ); |
|
202 | + $criteria[ 'search_criteria' ] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria[ 'search_criteria' ] ); |
|
203 | + $criteria[ 'search_criteria' ][ 'status' ] = apply_filters( 'gravityview_status', 'active', $view_settings ); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Modify the search parameters before the entries are fetched |
207 | 207 | */ |
208 | - $criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
208 | + $criteria = apply_filters( 'gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id ); |
|
209 | 209 | |
210 | 210 | $results = GVCommon::get_entries( $form_id, $criteria ); |
211 | 211 | |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | $instance = $new_instance; |
227 | 227 | |
228 | 228 | // Force positive number |
229 | - $instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] ); |
|
229 | + $instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] ); |
|
230 | 230 | |
231 | - $instance['view_id'] = intval( $instance['view_id'] ); |
|
231 | + $instance[ 'view_id' ] = intval( $instance[ 'view_id' ] ); |
|
232 | 232 | |
233 | - $instance['link_format'] = trim( rtrim( $instance['link_format'] ) ); |
|
233 | + $instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) ); |
|
234 | 234 | |
235 | - $instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format']; |
|
235 | + $instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ]; |
|
236 | 236 | |
237 | - $instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] ); |
|
237 | + $instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] ); |
|
238 | 238 | |
239 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] ); |
|
239 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
240 | 240 | |
241 | 241 | //check if post_id is a valid post with embedded View |
242 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
242 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
243 | 243 | |
244 | 244 | // Share that the widget isn't brand new |
245 | - $instance['updated'] = 1; |
|
245 | + $instance[ 'updated' ] = 1; |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Modify the updated instance. This will allow for validating any added instance settings externally. |
@@ -264,22 +264,22 @@ discard block |
||
264 | 264 | |
265 | 265 | // Set up some default widget settings. |
266 | 266 | $defaults = array( |
267 | - 'title' => __('Recent Entries', 'gravityview'), |
|
267 | + 'title' => __( 'Recent Entries', 'gravityview' ), |
|
268 | 268 | 'view_id' => NULL, |
269 | 269 | 'post_id' => NULL, |
270 | 270 | 'limit' => 10, |
271 | - 'link_format' => __('Entry #{entry_id}', 'gravityview'), |
|
271 | + 'link_format' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
272 | 272 | 'after_link' => '' |
273 | 273 | ); |
274 | 274 | |
275 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
275 | + $instance = wp_parse_args( (array)$instance, $defaults ); |
|
276 | 276 | |
277 | 277 | ?> |
278 | 278 | |
279 | 279 | <!-- Title --> |
280 | 280 | <p> |
281 | 281 | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label> |
282 | - <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
|
282 | + <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" /> |
|
283 | 283 | </p> |
284 | 284 | |
285 | 285 | <!-- Download --> |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | $views = get_posts( $args ); |
293 | 293 | |
294 | 294 | // If there are no views set up yet, we get outta here. |
295 | - if( empty( $views ) ) { |
|
296 | - echo '<div id="select_gravityview_view"><div class="wrap">'. GravityView_Post_Types::no_views_text() .'</div></div>'; |
|
295 | + if ( empty( $views ) ) { |
|
296 | + echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Post_Types::no_views_text() . '</div></div>'; |
|
297 | 297 | return; |
298 | 298 | } |
299 | 299 | |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | * Display errors generated for invalid embed IDs |
305 | 305 | * @see GravityView_View_Data::is_valid_embed_id |
306 | 306 | */ |
307 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
307 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
308 | 308 | ?> |
309 | 309 | <div class="error inline hide-on-view-change"> |
310 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
310 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
311 | 311 | </div> |
312 | 312 | <?php |
313 | 313 | unset ( $error ); |
@@ -315,14 +315,14 @@ discard block |
||
315 | 315 | ?> |
316 | 316 | |
317 | 317 | <p> |
318 | - <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label> |
|
318 | + <label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label> |
|
319 | 319 | <select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"> |
320 | 320 | <option value=""><?php esc_html_e( '— Select a View as Entries Source —', 'gravityview' ); ?></option> |
321 | 321 | <?php |
322 | 322 | |
323 | - foreach( $views as $view ) { |
|
324 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
325 | - echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
323 | + foreach ( $views as $view ) { |
|
324 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
325 | + echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | ?> |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | * Display errors generated for invalid embed IDs |
335 | 335 | * @see GravityView_View_Data::is_valid_embed_id |
336 | 336 | */ |
337 | - if( !empty( $instance['error_post_id'] ) ) { |
|
337 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
338 | 338 | ?> |
339 | 339 | <div class="error inline"> |
340 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
340 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
341 | 341 | </div> |
342 | 342 | <?php |
343 | 343 | unset ( $error ); |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | ?> |
346 | 346 | |
347 | 347 | <p> |
348 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" /> |
|
348 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
349 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" /> |
|
350 | 350 | <span class="howto"><?php |
351 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
351 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
352 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
353 | 353 | ?></span> |
354 | 354 | </p> |
355 | 355 | |
@@ -357,21 +357,21 @@ discard block |
||
357 | 357 | <label for="<?php echo $this->get_field_id( 'limit' ); ?>"> |
358 | 358 | <span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span> |
359 | 359 | </label> |
360 | - <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" /> |
|
360 | + <input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" /> |
|
361 | 361 | </p> |
362 | 362 | |
363 | 363 | <p> |
364 | 364 | <label for="<?php echo $this->get_field_id( 'link_format' ); ?>"> |
365 | 365 | <span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span> |
366 | 366 | </label> |
367 | - <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
367 | + <input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" /> |
|
368 | 368 | </p> |
369 | 369 | |
370 | 370 | <p> |
371 | 371 | <label for="<?php echo $this->get_field_id( 'after_link' ); ?>"> |
372 | 372 | <span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span> |
373 | 373 | </label> |
374 | - <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea> |
|
374 | + <textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea> |
|
375 | 375 | </p> |
376 | 376 | |
377 | 377 | <?php |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @param GravityView_Recent_Entries_Widget $this WP_Widget object |
382 | 382 | * @param array $instance Current widget instance |
383 | 383 | */ |
384 | - do_action( 'gravityview_recent_entries_widget_form' , $this, $instance ); |
|
384 | + do_action( 'gravityview_recent_entries_widget_form', $this, $instance ); |
|
385 | 385 | |
386 | 386 | ?> |
387 | 387 |
@@ -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> |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @since 1.5.1 |
12 | 12 | */ |
13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
13 | + add_action( 'gform_user_registered', array( $this, 'assign_new_user_to_lead' ), 10, 4 ); |
|
14 | 14 | |
15 | 15 | // ONLY ADMIN FROM HERE ON. |
16 | - if( !is_admin() ) { return; } |
|
16 | + if ( ! is_admin() ) { return; } |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
20 | 20 | * @since 1.7.4 |
21 | 21 | * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
22 | 22 | */ |
23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
23 | + if ( apply_filters( 'gravityview_disable_change_entry_creator', false ) ) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * Use `init` to fix bbPress warning |
29 | 29 | * @see https://bbpress.trac.wordpress.org/ticket/2309 |
30 | 30 | */ |
31 | - add_action('init', array( $this, 'load'), 100 ); |
|
31 | + add_action( 'init', array( $this, 'load' ), 100 ); |
|
32 | 32 | |
33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
33 | + add_action( 'plugins_loaded', array( $this, 'prevent_conflicts' ) ); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
@@ -56,24 +56,24 @@ discard block |
||
56 | 56 | $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
57 | 57 | |
58 | 58 | // If filter returns false, do not process |
59 | - if( empty( $assign_to_lead ) ) { |
|
59 | + if ( empty( $assign_to_lead ) ) { |
|
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
64 | - $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
64 | + $result = RGFormsModel::update_lead_property( $entry[ 'id' ], 'created_by', $user_id, false, true ); |
|
65 | 65 | |
66 | - if( empty( $result ) ) { |
|
67 | - $status = __('Error', 'gravityview'); |
|
66 | + if ( empty( $result ) ) { |
|
67 | + $status = __( 'Error', 'gravityview' ); |
|
68 | 68 | } else { |
69 | - $status = __('Success', 'gravityview'); |
|
69 | + $status = __( 'Success', 'gravityview' ); |
|
70 | 70 | } |
71 | 71 | |
72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
72 | + $note = sprintf( _x( '%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview' ), $status, $user_id ); |
|
73 | 73 | |
74 | - do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
74 | + do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - ' . $note ); |
|
75 | 75 | |
76 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
76 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' ); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | |
86 | 86 | // Plugin that was provided here: |
87 | 87 | // @link https://gravityview.co/support/documentation/201991205/ |
88 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2); |
|
89 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2); |
|
88 | + remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10, 2 ); |
|
89 | + remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2 ); |
|
90 | 90 | |
91 | 91 | // Disable for Gravity Forms Add-ons 3.6.2 and lower |
92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
92 | + if ( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
93 | 93 | |
94 | 94 | $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
95 | 95 | |
96 | 96 | // Now, no validation is required in the methods; let's hook in. |
97 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
97 | + remove_action( 'admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
98 | 98 | |
99 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2); |
|
99 | + remove_action( "gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2 ); |
|
100 | 100 | |
101 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2); |
|
101 | + remove_action( "gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2 ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | } |
@@ -110,26 +110,26 @@ discard block |
||
110 | 110 | function load() { |
111 | 111 | |
112 | 112 | // Does GF exist? |
113 | - if( !class_exists('GFCommon') ) { |
|
113 | + if ( ! class_exists( 'GFCommon' ) ) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Can the user edit entries? |
118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
118 | + if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | 122 | // If screen mode isn't set, then we're in the wrong place. |
123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
123 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
124 | 124 | return; |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Now, no validation is required in the methods; let's hook in. |
128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
128 | + add_action( 'admin_init', array( &$this, 'set_screen_mode' ) ); |
|
129 | 129 | |
130 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
130 | + add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 ); |
|
131 | 131 | |
132 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
132 | + add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 ); |
|
133 | 133 | |
134 | 134 | } |
135 | 135 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | function set_screen_mode() { |
141 | 141 | |
142 | 142 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
143 | - if( rgget('screen_mode') === 'edit' ) { |
|
144 | - $_POST["screen_mode"] = 'edit'; |
|
143 | + if ( rgget( 'screen_mode' ) === 'edit' ) { |
|
144 | + $_POST[ "screen_mode" ] = 'edit'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
@@ -152,42 +152,42 @@ discard block |
||
152 | 152 | * @param int $entry_id Entry ID |
153 | 153 | * @return void |
154 | 154 | */ |
155 | - function update_entry_creator($form, $entry_id) { |
|
155 | + function update_entry_creator( $form, $entry_id ) { |
|
156 | 156 | global $current_user; |
157 | 157 | |
158 | 158 | // Update the entry |
159 | - $created_by = absint( rgpost('created_by') ); |
|
159 | + $created_by = absint( rgpost( 'created_by' ) ); |
|
160 | 160 | |
161 | 161 | RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
162 | 162 | |
163 | 163 | // If the creator has changed, let's add a note about who it used to be. |
164 | - $originally_created_by = rgpost('originally_created_by'); |
|
164 | + $originally_created_by = rgpost( 'originally_created_by' ); |
|
165 | 165 | |
166 | 166 | // If there's no owner and there didn't used to be, keep going |
167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
167 | + if ( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | 171 | // If the values have changed |
172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
172 | + if ( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
173 | 173 | |
174 | - $user_data = get_userdata($current_user->ID); |
|
174 | + $user_data = get_userdata( $current_user->ID ); |
|
175 | 175 | |
176 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
176 | + $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' ); |
|
177 | 177 | |
178 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
178 | + $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview' ); |
|
179 | 179 | |
180 | - if( !empty( $originally_created_by ) ) { |
|
181 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
180 | + if ( ! empty( $originally_created_by ) ) { |
|
181 | + $originally_created_by_user_data = get_userdata( $originally_created_by ); |
|
182 | 182 | $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
183 | 183 | } |
184 | 184 | |
185 | - if( !empty( $created_by ) ) { |
|
186 | - $created_by_user_data = get_userdata($created_by); |
|
185 | + if ( ! empty( $created_by ) ) { |
|
186 | + $created_by_user_data = get_userdata( $created_by ); |
|
187 | 187 | $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
188 | 188 | } |
189 | 189 | |
190 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
190 | + GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __( 'Changed entry creator from %s to %s', 'gravityview' ), $original_name, $created_by_name ), 'note' ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | } |
@@ -198,24 +198,24 @@ discard block |
||
198 | 198 | * @param array $entry GF entry array |
199 | 199 | * @return void |
200 | 200 | */ |
201 | - function add_select($form_id, $entry ) { |
|
201 | + function add_select( $form_id, $entry ) { |
|
202 | 202 | |
203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
203 | + if ( rgpost( 'screen_mode' ) !== 'edit' ) { |
|
204 | 204 | return; |
205 | 205 | } |
206 | 206 | |
207 | 207 | $users = GVCommon::get_users( 'change_entry_creator' ); |
208 | 208 | |
209 | 209 | $output = '<label for="change_created_by">'; |
210 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
210 | + $output .= esc_html__( 'Change Entry Creator:', 'gravityview' ); |
|
211 | 211 | $output .= '</label> |
212 | 212 | <select name="created_by" id="change_created_by" class="widefat">'; |
213 | - $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
214 | - foreach($users as $user) { |
|
215 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
213 | + $output .= '<option value=""> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
|
214 | + foreach ( $users as $user ) { |
|
215 | + $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>'; |
|
216 | 216 | } |
217 | 217 | $output .= '</select>'; |
218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
218 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
219 | 219 | echo $output; |
220 | 220 | |
221 | 221 | } |