@@ -255,7 +255,6 @@ |
||
255 | 255 | * Get the default date format for a field based on the field ID and the time format setting |
256 | 256 | * |
257 | 257 | * @since 1.14 |
258 | - |
|
259 | 258 | * @param string $time_format The time format ("12" or "24"). Default: "12" {@since 1.14} |
260 | 259 | * @param int $field_id The ID of the field. Used to figure out full time/hours/minutes/am/pm {@since 1.14} |
261 | 260 | * |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
64 | 64 | |
65 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
65 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -103,31 +103,31 @@ discard block |
||
103 | 103 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
104 | 104 | |
105 | 105 | // If the search is being sorted |
106 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
106 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
107 | 107 | |
108 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
108 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
112 | 112 | * @see modify_sort_id() |
113 | 113 | */ |
114 | - if( ! empty( $pieces[1] ) ) { |
|
114 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
115 | 115 | |
116 | 116 | // Pass these to the _modify_query_sort_by_time_hack() method |
117 | - $this->_time_format = $pieces[1]; |
|
118 | - $this->_date_format = $pieces[2]; |
|
117 | + $this->_time_format = $pieces[ 1 ]; |
|
118 | + $this->_date_format = $pieces[ 2 ]; |
|
119 | 119 | |
120 | 120 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
121 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
121 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
125 | 125 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
126 | 126 | */ |
127 | - $criteria['sorting']['is_numeric'] = true; |
|
127 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
128 | 128 | |
129 | 129 | // Modify the Gravity Forms WP Query |
130 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
130 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * then we want to modify the query. |
151 | 151 | * @see GFFormsModel::sort_by_field_query() |
152 | 152 | */ |
153 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
153 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
154 | 154 | |
155 | - if( $this->_time_format === '24' ) { |
|
155 | + if ( $this->_time_format === '24' ) { |
|
156 | 156 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
157 | 157 | } else { |
158 | 158 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -198,18 +198,18 @@ discard block |
||
198 | 198 | // Set variables |
199 | 199 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ); |
200 | 200 | |
201 | - if( 'edit' === $context ) { |
|
201 | + if ( 'edit' === $context ) { |
|
202 | 202 | return $field_options; |
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Set default date format based on field ID and Form ID |
207 | 207 | */ |
208 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
208 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
209 | 209 | |
210 | - $this->add_field_support('date_display', $field_options ); |
|
210 | + $this->add_field_support( 'date_display', $field_options ); |
|
211 | 211 | |
212 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
212 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
213 | 213 | |
214 | 214 | return $field_options; |
215 | 215 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | private function _get_time_format() { |
225 | 225 | global $post; |
226 | 226 | |
227 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
227 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
228 | 228 | |
229 | 229 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
230 | 230 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | // GF defaults to 12, so should we. |
244 | 244 | $time_format = '12'; |
245 | 245 | |
246 | - if( $form_id ) { |
|
246 | + if ( $form_id ) { |
|
247 | 247 | $form = GFAPI::get_form( $form_id ); |
248 | 248 | |
249 | 249 | if ( $form ) { |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $default = 'h:i A'; |
291 | 291 | |
292 | 292 | // This doesn't take into account 24-hour |
293 | - switch( $field_input_id ) { |
|
293 | + switch ( $field_input_id ) { |
|
294 | 294 | // Hours |
295 | 295 | case 1: |
296 | 296 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | function init() { |
22 | 22 | |
23 | 23 | $icon = is_admin() ? '<i class="icon gv-icon-astronaut-head"></i> ' : NULL; |
24 | - $this->title( $icon . __('GravityView', 'gravityview') ); |
|
24 | + $this->title( $icon . __( 'GravityView', 'gravityview' ) ); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | function get_warnings() { |
28 | 28 | |
29 | - if( is_null( $this->warnings ) ) { |
|
29 | + if ( is_null( $this->warnings ) ) { |
|
30 | 30 | $this->warnings = GravityView_Logging::get_errors(); |
31 | 31 | } |
32 | 32 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | function get_notices() { |
37 | 37 | |
38 | - if( is_null( $this->notices ) ) { |
|
38 | + if ( is_null( $this->notices ) ) { |
|
39 | 39 | $this->notices = GravityView_Logging::get_notices(); |
40 | 40 | } |
41 | 41 | |
@@ -84,27 +84,27 @@ discard block |
||
84 | 84 | </style> |
85 | 85 | <div id='debug-bar-gravityview'>"; |
86 | 86 | |
87 | - $output .= '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="alignright" alt="" width="100" height="132" />'; |
|
87 | + $output .= '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="alignright" alt="" width="100" height="132" />'; |
|
88 | 88 | |
89 | 89 | |
90 | 90 | $warnings = $this->get_warnings(); |
91 | 91 | $notices = $this->get_notices(); |
92 | 92 | |
93 | - if(count($warnings)) { |
|
94 | - $output .= '<h3><span>'.__('Warnings', 'gravityview').'</span></h3>'; |
|
93 | + if ( count( $warnings ) ) { |
|
94 | + $output .= '<h3><span>' . __( 'Warnings', 'gravityview' ) . '</span></h3>'; |
|
95 | 95 | $output .= '<ol>'; |
96 | - foreach ( $warnings as $key => $notice) { |
|
97 | - if(empty($notice['message'])) { continue; } |
|
98 | - $output .= '<li><a href="#'.sanitize_html_class( 'gv-warning-' . $key ).'">'.strip_tags($notice['message']).'</a></li>'; |
|
96 | + foreach ( $warnings as $key => $notice ) { |
|
97 | + if ( empty( $notice[ 'message' ] ) ) { continue; } |
|
98 | + $output .= '<li><a href="#' . sanitize_html_class( 'gv-warning-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>'; |
|
99 | 99 | } |
100 | 100 | $output .= '</ol><hr />'; |
101 | 101 | } |
102 | - if(count($notices)) { |
|
103 | - $output .= '<h3><span>'.__('Logs', 'gravityview').'</span></h3>'; |
|
102 | + if ( count( $notices ) ) { |
|
103 | + $output .= '<h3><span>' . __( 'Logs', 'gravityview' ) . '</span></h3>'; |
|
104 | 104 | $output .= '<ol>'; |
105 | - foreach ( $notices as $key => $notice) { |
|
106 | - if(empty($notice['message'])) { continue; } |
|
107 | - $output .= '<li><a href="#'.sanitize_html_class( 'gv-notice-' . $key ).'">'.strip_tags($notice['message']).'</a></li>'; |
|
105 | + foreach ( $notices as $key => $notice ) { |
|
106 | + if ( empty( $notice[ 'message' ] ) ) { continue; } |
|
107 | + $output .= '<li><a href="#' . sanitize_html_class( 'gv-notice-' . $key ) . '">' . strip_tags( $notice[ 'message' ] ) . '</a></li>'; |
|
108 | 108 | } |
109 | 109 | $output .= '</ol><hr />'; |
110 | 110 | } |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | if ( count( $warnings ) ) { |
113 | 113 | $output .= '<h3>Warnings</h3>'; |
114 | 114 | $output .= '<ol class="debug-bar-php-list">'; |
115 | - foreach ( $warnings as $key => $notice) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); } |
|
115 | + foreach ( $warnings as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-warning-' . $key ); } |
|
116 | 116 | $output .= '</ol>'; |
117 | 117 | } |
118 | 118 | |
119 | 119 | if ( count( $notices ) ) { |
120 | 120 | $output .= '<h3>Notices</h3>'; |
121 | 121 | $output .= '<ol class="debug-bar-php-list">'; |
122 | - foreach ( $notices as $key => $notice) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); } |
|
122 | + foreach ( $notices as $key => $notice ) { $output .= $this->render_item( $notice, 'gv-notice-' . $key ); } |
|
123 | 123 | $output .= '</ol>'; |
124 | 124 | } |
125 | 125 | |
@@ -133,17 +133,17 @@ discard block |
||
133 | 133 | * @param string|array $item Unescaped |
134 | 134 | * @return string Escaped HTML |
135 | 135 | */ |
136 | - function esc_html_recursive($item) { |
|
137 | - if(is_object($item)) { |
|
138 | - foreach($item as $key => $value) { |
|
139 | - $item->{$key} = $this->esc_html_recursive($value); |
|
136 | + function esc_html_recursive( $item ) { |
|
137 | + if ( is_object( $item ) ) { |
|
138 | + foreach ( $item as $key => $value ) { |
|
139 | + $item->{$key} = $this->esc_html_recursive( $value ); |
|
140 | 140 | } |
141 | - } else if(is_array($item)) { |
|
142 | - foreach($item as $key => $value) { |
|
143 | - $item[$key] = $this->esc_html_recursive($value); |
|
141 | + } else if ( is_array( $item ) ) { |
|
142 | + foreach ( $item as $key => $value ) { |
|
143 | + $item[ $key ] = $this->esc_html_recursive( $value ); |
|
144 | 144 | } |
145 | 145 | } else { |
146 | - $item = esc_html($item); |
|
146 | + $item = esc_html( $item ); |
|
147 | 147 | } |
148 | 148 | return $item; |
149 | 149 | } |
@@ -159,26 +159,26 @@ discard block |
||
159 | 159 | |
160 | 160 | $output = ''; |
161 | 161 | |
162 | - if(!empty($notice['message'])) { |
|
163 | - $output .= '<a id="'.sanitize_html_class( $anchor ).'"></a>'; |
|
162 | + if ( ! empty( $notice[ 'message' ] ) ) { |
|
163 | + $output .= '<a id="' . sanitize_html_class( $anchor ) . '"></a>'; |
|
164 | 164 | $output .= "<li class='debug-bar-php-notice'>"; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $output .= '<div class="clear"></div>'; |
168 | 168 | |
169 | 169 | // Title |
170 | - $output .= '<div class="gravityview-debug-bar-title">'.esc_attr( $notice['message'] ).'</div>'; |
|
170 | + $output .= '<div class="gravityview-debug-bar-title">' . esc_attr( $notice[ 'message' ] ) . '</div>'; |
|
171 | 171 | |
172 | 172 | // Debugging Output |
173 | - if( empty( $notice['data'] ) ) { |
|
174 | - if( !is_null( $notice['data'] ) ) { |
|
175 | - $output .= '<em>'._x('Empty', 'Debugging output data is empty.', 'gravityview' ).'</em>'; |
|
173 | + if ( empty( $notice[ 'data' ] ) ) { |
|
174 | + if ( ! is_null( $notice[ 'data' ] ) ) { |
|
175 | + $output .= '<em>' . _x( 'Empty', 'Debugging output data is empty.', 'gravityview' ) . '</em>'; |
|
176 | 176 | } |
177 | 177 | } else { |
178 | - $output .= sprintf( '<pre>%s</pre>', print_r($this->esc_html_recursive( $notice['data'] ), true) ); |
|
178 | + $output .= sprintf( '<pre>%s</pre>', print_r( $this->esc_html_recursive( $notice[ 'data' ] ), true ) ); |
|
179 | 179 | } |
180 | 180 | |
181 | - if(!empty($notice['message'])) { |
|
181 | + if ( ! empty( $notice[ 'message' ] ) ) { |
|
182 | 182 | $output .= '</li>'; |
183 | 183 | } |
184 | 184 |
@@ -5,4 +5,4 @@ |
||
5 | 5 | * @deprecated 1.7.5 |
6 | 6 | */ |
7 | 7 | |
8 | -include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
8 | +include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | 25 | $this->label = esc_html__( 'Payment Status', 'gravityview' ); |
26 | - $this->description = esc_html__('The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview' ); |
|
26 | + $this->description = esc_html__( 'The current payment status of the entry (ie "Processing", "Failed", "Cancelled", "Approved").', 'gravityview' ); |
|
27 | 27 | parent::__construct(); |
28 | 28 | } |
29 | 29 | } |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function blacklist_field_types( $field_types = array(), $context = '' ) { |
38 | 38 | |
39 | 39 | // Allow Calculation field in Edit Entry |
40 | - if( 'edit' !== $context ) { |
|
41 | - $field_types[] = $this->name; |
|
40 | + if ( 'edit' !== $context ) { |
|
41 | + $field_types[ ] = $this->name; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return $field_types; |
@@ -22,27 +22,27 @@ |
||
22 | 22 | |
23 | 23 | <?php // list all the available templates (type= fresh or custom ) ?> |
24 | 24 | <div class="gv-grid"> |
25 | - <?php foreach( $templates as $id => $template ) { |
|
25 | + <?php foreach ( $templates as $id => $template ) { |
|
26 | 26 | $selected = ( $id == $current_template ) ? ' gv-selected' : ''; ?> |
27 | 27 | |
28 | 28 | <div class="gv-grid-col-1-3"> |
29 | - <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>"> |
|
29 | + <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>"> |
|
30 | 30 | <div class="gv-view-types-hover"> |
31 | 31 | <div> |
32 | - <?php if( !empty( $template['buy_source'] ) ) { ?> |
|
33 | - <p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p> |
|
32 | + <?php if ( ! empty( $template[ 'buy_source' ] ) ) { ?> |
|
33 | + <p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p> |
|
34 | 34 | <?php } else { ?> |
35 | - <p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p> |
|
36 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
37 | - <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a> |
|
35 | + <p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p> |
|
36 | + <?php if ( ! empty( $template[ 'preview' ] ) ) { ?> |
|
37 | + <a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a> |
|
38 | 38 | <?php } ?> |
39 | 39 | <?php } ?> |
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | <div class="gv-view-types-normal"> |
43 | - <img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>"> |
|
44 | - <h5><?php echo esc_attr( $template['label'] ); ?></h5> |
|
45 | - <p class="description"><?php echo esc_attr( $template['description'] ); ?></p> |
|
43 | + <img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>"> |
|
44 | + <h5><?php echo esc_attr( $template[ 'label' ] ); ?></h5> |
|
45 | + <p class="description"><?php echo esc_attr( $template[ 'description' ] ); ?></p> |
|
46 | 46 | </div> |
47 | 47 | </div> |
48 | 48 | </div> |
@@ -14,8 +14,8 @@ |
||
14 | 14 | <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> |
15 | 15 | <?php |
16 | 16 | |
17 | - foreach( $metaboxes as $metabox ) { |
|
18 | - $class = !isset( $class ) ? 'nav-tab-active' : ''; |
|
17 | + foreach ( $metaboxes as $metabox ) { |
|
18 | + $class = ! isset( $class ) ? 'nav-tab-active' : ''; |
|
19 | 19 | ?> |
20 | 20 | <li class="ui-state-default"> |
21 | 21 | <a class="nav-tab ui-tabs-anchor <?php echo $class; ?>" href="#<?php echo esc_attr( $metabox->id ); ?>"> |
@@ -19,9 +19,9 @@ |
||
19 | 19 | * Loop through the array of registered metaboxes |
20 | 20 | * @var GravityView_Metabox_Tab $metabox |
21 | 21 | */ |
22 | - foreach( $metaboxes as $metabox ) { |
|
22 | + foreach ( $metaboxes as $metabox ) { |
|
23 | 23 | |
24 | - echo '<div id="'.esc_attr( $metabox->id ).'">'; |
|
24 | + echo '<div id="' . esc_attr( $metabox->id ) . '">'; |
|
25 | 25 | |
26 | 26 | $metabox->render( $post ); |
27 | 27 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | function render_setting( $override_input = NULL ) { |
17 | 17 | |
18 | - if( $this->get_field_left_label() ) { ?> |
|
18 | + if ( $this->get_field_left_label() ) { ?> |
|
19 | 19 | |
20 | 20 | <td scope="row"> |
21 | 21 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | function render_input( $override_input = NULL ) { |
45 | - if( isset( $override_input ) ) { |
|
45 | + if ( isset( $override_input ) ) { |
|
46 | 46 | echo $override_input; |
47 | 47 | return; |
48 | 48 | } |