@@ -21,7 +21,7 @@ |
||
21 | 21 | require_once gravityview()->plugin->dir( 'future/includes/rest/class-gv-rest-route.php' ); |
22 | 22 | require_once gravityview()->plugin->dir( 'future/includes/rest/class-gv-rest-views-route.php' ); |
23 | 23 | |
24 | - self::$routes['views'] = $views = new Views_Route(); |
|
24 | + self::$routes[ 'views' ] = $views = new Views_Route(); |
|
25 | 25 | $views->register_routes(); |
26 | 26 | } |
27 | 27 |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | */ |
44 | 44 | $atts = apply_filters( 'gravityview/shortcodes/gvfield/atts', $atts ); |
45 | 45 | |
46 | - if ( ! $view = \GV\View::by_id( $atts['view_id'] ) ) { |
|
47 | - gravityview()->log->error( 'View #{view_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
46 | + if ( ! $view = \GV\View::by_id( $atts[ 'view_id' ] ) ) { |
|
47 | + gravityview()->log->error( 'View #{view_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
48 | 48 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, null, null, $atts ); |
49 | 49 | } |
50 | 50 | |
51 | - switch( $atts['entry_id'] ): |
|
51 | + switch ( $atts[ 'entry_id' ] ): |
|
52 | 52 | case 'last': |
53 | 53 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
54 | 54 | /** |
@@ -57,17 +57,17 @@ discard block |
||
57 | 57 | * Since we're using \GF_Query shorthand initialization we have to reverse the order parameters here. |
58 | 58 | */ |
59 | 59 | add_filter( 'gravityview_get_entries', $filter = function( $parameters, $args, $form_id ) { |
60 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
60 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
61 | 61 | /** |
62 | 62 | * Reverse existing sorts. |
63 | 63 | */ |
64 | - $sort = &$parameters['sorting']; |
|
65 | - $sort['direction'] = $sort['direction'] == 'RAND' ? : ( $sort['direction'] == 'ASC' ? 'DESC' : 'ASC' ); |
|
64 | + $sort = &$parameters[ 'sorting' ]; |
|
65 | + $sort[ 'direction' ] = $sort[ 'direction' ] == 'RAND' ?: ( $sort[ 'direction' ] == 'ASC' ? 'DESC' : 'ASC' ); |
|
66 | 66 | } else { |
67 | 67 | /** |
68 | 68 | * Otherwise, sort by date_created. |
69 | 69 | */ |
70 | - $parameters['sorting'] = array( |
|
70 | + $parameters[ 'sorting' ] = array( |
|
71 | 71 | 'key' => 'id', |
72 | 72 | 'direction' => 'ASC', |
73 | 73 | 'is_numeric' => true |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | /** If a sort already exists, reverse it. */ |
84 | 84 | if ( $sort = end( $entries->sorts ) ) { |
85 | - $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ? : ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
85 | + $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ?: ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
86 | 86 | } else { |
87 | 87 | /** Otherwise, sort by date_created */ |
88 | 88 | $entries = $entries->sort( new \GV\Entry_Sort( \GV\Internal_Field::by_id( 'id' ), \GV\Entry_Sort::ASC ), \GV\Entry_Sort::NUMERIC ); |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | } |
100 | 100 | break; |
101 | 101 | default: |
102 | - if ( ! $entry = \GV\GF_Entry::by_id( $atts['entry_id'] ) ) { |
|
103 | - gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
102 | + if ( ! $entry = \GV\GF_Entry::by_id( $atts[ 'entry_id' ] ) ) { |
|
103 | + gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
104 | 104 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, null, $atts ); |
105 | 105 | } |
106 | 106 | endswitch; |
107 | 107 | |
108 | - $field = is_numeric( $atts['field_id'] ) ? \GV\GF_Field::by_id( $view->form, $atts['field_id'] ) : \GV\Internal_Field::by_id( $atts['field_id'] ); |
|
108 | + $field = is_numeric( $atts[ 'field_id' ] ) ? \GV\GF_Field::by_id( $view->form, $atts[ 'field_id' ] ) : \GV\Internal_Field::by_id( $atts[ 'field_id' ] ); |
|
109 | 109 | |
110 | 110 | if ( ! $field ) { |
111 | - gravityview()->log->error( 'Field #{field_id} not found', array( 'view_id' => $atts['field_id'] ) ); |
|
111 | + gravityview()->log->error( 'Field #{field_id} not found', array( 'view_id' => $atts[ 'field_id' ] ) ); |
|
112 | 112 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $field, $atts ); |
113 | 113 | } |
114 | 114 | |
115 | - if ( $view->form->ID != $entry['form_id'] ) { |
|
115 | + if ( $view->form->ID != $entry[ 'form_id' ] ) { |
|
116 | 116 | gravityview()->log->error( 'Entry does not belong to view (form mismatch)' ); |
117 | 117 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
118 | 118 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | return apply_filters( 'gravityview/shortcodes/gvfield/output', get_the_password_form( $view->ID ), $view, $entry, $atts ); |
123 | 123 | } |
124 | 124 | |
125 | - if ( ! $view->form ) { |
|
125 | + if ( ! $view->form ) { |
|
126 | 126 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
127 | 127 | |
128 | 128 | /** |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** Unapproved entries. */ |
148 | - if ( $entry['status'] != 'active' ) { |
|
148 | + if ( $entry[ 'status' ] != 'active' ) { |
|
149 | 149 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
150 | 150 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
151 | 151 | } |
152 | 152 | |
153 | 153 | if ( $view->settings->get( 'show_only_approved' ) ) { |
154 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
154 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
155 | 155 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
156 | 156 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
157 | 157 | } |
@@ -108,13 +108,13 @@ |
||
108 | 108 | global $post; |
109 | 109 | |
110 | 110 | if ( ! $this->request->is_view() && $post ) { |
111 | - $specifics []= sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
112 | - $specifics []= sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
111 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
112 | + $specifics [ ] = sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | - $specifics []= sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
117 | - $specifics []= sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
116 | + $specifics [ ] = sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
117 | + $specifics [ ] = sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
118 | 118 | |
119 | 119 | return array_merge( $specifics, $templates ); |
120 | 120 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'author' => self::author, |
97 | 97 | 'language' => get_locale(), |
98 | 98 | 'url' => home_url(), |
99 | - 'beta' => $this->settings->get( 'beta' ), |
|
99 | + 'beta' => $this->settings->get( 'beta' ), |
|
100 | 100 | ); |
101 | 101 | |
102 | 102 | if ( ! empty( $action ) ) { |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | private function license_call_update_settings( $license_data, $data ) { |
464 | 464 | $settings = array(); |
465 | 465 | |
466 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
466 | + $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
467 | 467 | $settings['license_key_status'] = $license_data->license; |
468 | 468 | $settings['license_key_response'] = (array)$license_data; |
469 | 469 | |
@@ -597,14 +597,14 @@ discard block |
||
597 | 597 | // Call the custom API. |
598 | 598 | $response = wp_remote_post( self::url, array( |
599 | 599 | 'timeout' => 15, |
600 | - 'sslverify' => false, |
|
601 | - 'body' => array( |
|
602 | - 'edd_action' => 'check_license', |
|
603 | - 'license' => trim( $this->settings->get( 'license_key' ) ), |
|
604 | - 'item_name' => self::name, |
|
605 | - 'url' => home_url(), |
|
606 | - 'site_data' => $this->get_site_data(), |
|
607 | - ), |
|
600 | + 'sslverify' => false, |
|
601 | + 'body' => array( |
|
602 | + 'edd_action' => 'check_license', |
|
603 | + 'license' => trim( $this->settings->get( 'license_key' ) ), |
|
604 | + 'item_name' => self::name, |
|
605 | + 'url' => home_url(), |
|
606 | + 'site_data' => $this->get_site_data(), |
|
607 | + ), |
|
608 | 608 | )); |
609 | 609 | |
610 | 610 | // make sure the response came back okay |
@@ -174,7 +174,8 @@ discard block |
||
174 | 174 | if ( empty( $license_data ) ) { |
175 | 175 | if ( $is_ajax ) { |
176 | 176 | exit( json_encode( array() ) ); |
177 | - } else { // Non-ajax call |
|
177 | + } else { |
|
178 | +// Non-ajax call |
|
178 | 179 | return json_encode( array() ); |
179 | 180 | } |
180 | 181 | } |
@@ -207,7 +208,8 @@ discard block |
||
207 | 208 | |
208 | 209 | if ( $is_ajax ) { |
209 | 210 | exit( $json ); |
210 | - } else { // Non-ajax call |
|
211 | + } else { |
|
212 | +// Non-ajax call |
|
211 | 213 | return ( Utils::_GET( 'format', Utils::get( $data, 'format' ) ) === 'object' ) ? $license_data : $json; |
212 | 214 | } |
213 | 215 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * Generate the status message box HTML based on the current status |
351 | 351 | * |
352 | 352 | * @since 1.7.4 |
353 | - * @param $message |
|
353 | + * @param string $message |
|
354 | 354 | * @param string $class |
355 | 355 | * |
356 | 356 | * @return string |
@@ -470,6 +470,9 @@ discard block |
||
470 | 470 | $this->settings->set( $settings ); |
471 | 471 | } |
472 | 472 | |
473 | + /** |
|
474 | + * @param boolean $echo |
|
475 | + */ |
|
473 | 476 | public function settings_edd_license_activation( $field, $echo ) { |
474 | 477 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
475 | 478 | |
@@ -569,7 +572,6 @@ discard block |
||
569 | 572 | * Check the GravityView license information |
570 | 573 | * |
571 | 574 | * @since 1.19.3 |
572 | - * @param bool $force Whether to force checking license, even if AJAX |
|
573 | 575 | * |
574 | 576 | * @return void |
575 | 577 | */ |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ); |
101 | 101 | |
102 | 102 | if ( ! empty( $action ) ) { |
103 | - $settings['edd_action'] = esc_attr( $action ); |
|
103 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return array_map( 'urlencode', $settings ); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | 'format' => 'json', |
157 | 157 | ) ); |
158 | 158 | |
159 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
159 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
160 | 160 | die( -1 ); |
161 | 161 | } |
162 | 162 | |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | |
185 | 185 | $json = json_encode( $license_data ); |
186 | 186 | |
187 | - $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action'); |
|
187 | + $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' ); |
|
188 | 188 | |
189 | 189 | $is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
190 | 190 | |
191 | 191 | if ( 'deactivate_license' === Utils::get( $data, 'edd_action' ) ) { |
192 | - do_action('gravityview/admin_installer/delete_downloads_data', true ); |
|
192 | + do_action( 'gravityview/admin_installer/delete_downloads_data', true ); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | if ( $is_check_action_button ) { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | // most likely a mistake. |
202 | 202 | } else if ( $license_data->license !== 'failed' && $update_license ) { |
203 | 203 | |
204 | - if ( ! empty( $data['field_id'] ) ) { |
|
204 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
205 | 205 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
206 | 206 | } |
207 | 207 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | if ( empty( $license_data ) ) { |
229 | 229 | $message = ''; |
230 | 230 | } else { |
231 | - if( ! empty( $license_data->error ) ) { |
|
231 | + if ( ! empty( $license_data->error ) ) { |
|
232 | 232 | $class = 'error'; |
233 | 233 | $string_key = $license_data->error; |
234 | 234 | } else { $class = $license_data->license; |
@@ -254,17 +254,17 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function license_details( $response = array() ) { |
256 | 256 | |
257 | - $response = (array) $response; |
|
257 | + $response = (array)$response; |
|
258 | 258 | |
259 | 259 | $return = ''; |
260 | 260 | $wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>'; |
261 | 261 | |
262 | - if ( ! empty( $response['license_key'] ) ) { |
|
262 | + if ( ! empty( $response[ 'license_key' ] ) ) { |
|
263 | 263 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
264 | 264 | |
265 | 265 | if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
266 | - $return .= $this->strings( $response['license'], $response ); |
|
267 | - } elseif ( ! empty( $response['license_name'] ) ) { |
|
266 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
267 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
268 | 268 | $response_keys = array( |
269 | 269 | 'license_name' => '', |
270 | 270 | 'license_limit' => '', |
@@ -278,19 +278,19 @@ discard block |
||
278 | 278 | // Make sure all the keys are set |
279 | 279 | $response = wp_parse_args( $response, $response_keys ); |
280 | 280 | |
281 | - $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
282 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
281 | + $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
282 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
283 | 283 | $details = array( |
284 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
285 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link, |
|
286 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
287 | - 'expires' => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
288 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
284 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
285 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link, |
|
286 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
287 | + 'expires' => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
288 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
289 | 289 | ); |
290 | 290 | |
291 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
292 | - unset( $details['upgrade'] ); |
|
293 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
291 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
292 | + unset( $details[ 'upgrade' ] ); |
|
293 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -316,20 +316,20 @@ discard block |
||
316 | 316 | if ( ! empty( $upgrades ) ) { |
317 | 317 | |
318 | 318 | $locale_parts = explode( '_', get_locale() ); |
319 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
319 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
320 | 320 | |
321 | 321 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
322 | 322 | $output .= '<ul class="ul-disc">'; |
323 | 323 | |
324 | 324 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
325 | - $upgrade = (object) $upgrade; |
|
325 | + $upgrade = (object)$upgrade; |
|
326 | 326 | |
327 | 327 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
328 | 328 | |
329 | 329 | if ( $is_english && isset( $upgrade->description ) ) { |
330 | 330 | $message = esc_html( $upgrade->description ); |
331 | 331 | } else { |
332 | - switch( $upgrade->price_id ) { |
|
332 | + switch ( $upgrade->price_id ) { |
|
333 | 333 | // Interstellar |
334 | 334 | case 1: |
335 | 335 | default: |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
389 | 389 | 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
390 | 390 | 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
391 | - 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
391 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
392 | 392 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
393 | 393 | |
394 | 394 | 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | |
418 | 418 | if ( ! empty( $license_data->renewal_url ) ) { |
419 | 419 | $renew_license_url = $license_data->renewal_url; |
420 | - } elseif( ! empty( $license_data->license_key ) ) { |
|
420 | + } elseif ( ! empty( $license_data->license_key ) ) { |
|
421 | 421 | $renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key ); |
422 | 422 | } else { |
423 | 423 | $renew_license_url = 'https://gravityview.co/account/'; |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * @return array|\WP_Error |
435 | 435 | */ |
436 | 436 | private function _license_get_remote_response( $data, $license = '' ) { |
437 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
437 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
438 | 438 | |
439 | 439 | $url = add_query_arg( $api_params, self::url ); |
440 | 440 | |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | private function license_call_update_settings( $license_data, $data ) { |
475 | 475 | $settings = array(); |
476 | 476 | |
477 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
478 | - $settings['license_key_status'] = $license_data->license; |
|
479 | - $settings['license_key_response'] = (array)$license_data; |
|
477 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
478 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
479 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
480 | 480 | |
481 | 481 | $this->settings->set( $settings ); |
482 | 482 | } |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | |
492 | 492 | if ( ! empty( $key ) ) { |
493 | 493 | $response = $this->settings->get( 'license_key_response' ); |
494 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
494 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
495 | 495 | } else { |
496 | 496 | $response = array(); |
497 | 497 | } |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | |
534 | 534 | $submit = '<div class="gv-edd-button-wrapper">'; |
535 | 535 | foreach ( $fields as $field ) { |
536 | - $field['type'] = 'button'; |
|
537 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
538 | - $field['style'] = 'margin-left: 10px;'; |
|
539 | - if( $disabled_attribute ) { |
|
540 | - $field['disabled'] = $disabled_attribute; |
|
536 | + $field[ 'type' ] = 'button'; |
|
537 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
538 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
539 | + if ( $disabled_attribute ) { |
|
540 | + $field[ 'disabled' ] = $disabled_attribute; |
|
541 | 541 | } |
542 | 542 | $submit .= $this->settings->as_html( $field, $echo ); |
543 | 543 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | 'url' => home_url(), |
617 | 617 | 'site_data' => $this->get_site_data(), |
618 | 618 | ), |
619 | - )); |
|
619 | + ) ); |
|
620 | 620 | |
621 | 621 | // make sure the response came back okay |
622 | 622 | if ( is_wp_error( $response ) ) { |
@@ -647,45 +647,45 @@ discard block |
||
647 | 647 | $theme_data = wp_get_theme(); |
648 | 648 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
649 | 649 | |
650 | - $data['gv_version'] = Plugin::$version; |
|
651 | - $data['php_version'] = phpversion(); |
|
652 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
653 | - $data['gf_version'] = \GFForms::$version; |
|
654 | - $data['server'] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
655 | - $data['multisite'] = is_multisite(); |
|
656 | - $data['theme'] = $theme; |
|
657 | - $data['url'] = home_url(); |
|
658 | - $data['license_key'] = $this->settings->get( 'license_key' ); |
|
659 | - $data['beta'] = $this->settings->get( 'beta' ); |
|
650 | + $data[ 'gv_version' ] = Plugin::$version; |
|
651 | + $data[ 'php_version' ] = phpversion(); |
|
652 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
653 | + $data[ 'gf_version' ] = \GFForms::$version; |
|
654 | + $data[ 'server' ] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
655 | + $data[ 'multisite' ] = is_multisite(); |
|
656 | + $data[ 'theme' ] = $theme; |
|
657 | + $data[ 'url' ] = home_url(); |
|
658 | + $data[ 'license_key' ] = $this->settings->get( 'license_key' ); |
|
659 | + $data[ 'beta' ] = $this->settings->get( 'beta' ); |
|
660 | 660 | |
661 | 661 | // View Data |
662 | 662 | $gravityview_posts = wp_count_posts( 'gravityview', 'readable' ); |
663 | 663 | |
664 | - $data['view_count'] = null; |
|
665 | - $data['view_first'] = null; |
|
666 | - $data['view_latest'] = null; |
|
664 | + $data[ 'view_count' ] = null; |
|
665 | + $data[ 'view_first' ] = null; |
|
666 | + $data[ 'view_latest' ] = null; |
|
667 | 667 | |
668 | 668 | if ( $gravityview_posts->publish ) { |
669 | - $data['view_count'] = $gravityview_posts->publish; |
|
669 | + $data[ 'view_count' ] = $gravityview_posts->publish; |
|
670 | 670 | |
671 | 671 | $first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' ); |
672 | 672 | $latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' ); |
673 | 673 | |
674 | 674 | if ( $first = array_shift( $first ) ) { |
675 | - $data['view_first'] = $first->post_date; |
|
675 | + $data[ 'view_first' ] = $first->post_date; |
|
676 | 676 | } |
677 | 677 | if ( $latest = array_pop( $latest ) ) { |
678 | - $data['view_latest'] = $latest->post_date; |
|
678 | + $data[ 'view_latest' ] = $latest->post_date; |
|
679 | 679 | } |
680 | 680 | } |
681 | 681 | |
682 | 682 | // Form counts |
683 | 683 | if ( class_exists( 'GFFormsModel' ) ) { |
684 | 684 | $form_data = \GFFormsModel::get_form_count(); |
685 | - $data['forms_total'] = Utils::get( $form_data, 'total', 0 ); |
|
686 | - $data['forms_active'] = Utils::get( $form_data, 'active', 0 ); |
|
687 | - $data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 ); |
|
688 | - $data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 ); |
|
685 | + $data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 ); |
|
686 | + $data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 ); |
|
687 | + $data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
688 | + $data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | // Retrieve current plugin information |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
694 | 694 | } |
695 | 695 | |
696 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
697 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
698 | - $data['inactive_plugins'] = array(); |
|
699 | - $data['locale'] = get_locale(); |
|
696 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
697 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
698 | + $data[ 'inactive_plugins' ] = array(); |
|
699 | + $data[ 'locale' ] = get_locale(); |
|
700 | 700 | |
701 | 701 | // Validate request on the GV server |
702 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
702 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
703 | 703 | |
704 | 704 | return $data; |
705 | 705 | } |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | $plugin_data = get_plugin_data( $active_plugin ); |
731 | 731 | |
732 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
732 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | if ( ! empty( $extensions ) ) { |
@@ -91,7 +91,7 @@ |
||
91 | 91 | * Try subkeys after split. |
92 | 92 | */ |
93 | 93 | if ( count( $parts = explode( '/', $key, 2 ) ) > 1 ) { |
94 | - return self::get( self::get( $array, $parts[0] ), $parts[1], $default ); |
|
94 | + return self::get( self::get( $array, $parts[ 0 ] ), $parts[ 1 ], $default ); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return $default; |
@@ -86,8 +86,8 @@ |
||
86 | 86 | */ |
87 | 87 | $context->view = Utils::get( $template, 'view' ); |
88 | 88 | $context->source = Utils::get( $template, 'source' ); |
89 | - $context->field = Utils::get( $template, 'field' ) ? : Utils::get( $data, 'field' ); |
|
90 | - $context->entry = Utils::get( $template, 'entry' ) ? : Utils::get( $data, 'entry' ); |
|
89 | + $context->field = Utils::get( $template, 'field' ) ?: Utils::get( $data, 'field' ); |
|
90 | + $context->entry = Utils::get( $template, 'entry' ) ?: Utils::get( $data, 'entry' ); |
|
91 | 91 | $context->request = Utils::get( $template, 'request' ); |
92 | 92 | |
93 | 93 | $context->entries = Utils::get( $template, 'entries' ) ? $template->entries : null; |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | */ |
28 | 28 | protected function log( $level, $message, $context ) { |
29 | 29 | |
30 | - $php_version = ( ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ) ? |
|
31 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
30 | + $php_version = ( ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ) ? |
|
31 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
32 | 32 | |
33 | 33 | if ( version_compare( $php_version, '5.4', '>=' ) ) { |
34 | 34 | $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 3 ); |
35 | - $location = $this->interpolate( "{class}{type}{function}", $backtrace[2] ); |
|
35 | + $location = $this->interpolate( "{class}{type}{function}", $backtrace[ 2 ] ); |
|
36 | 36 | $message = $this->interpolate( "[$level, $location] $message", $context ); |
37 | 37 | } else { |
38 | 38 | $message = "[$level] $message"; |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | do_action( |
59 | 59 | sprintf( 'gravityview_log_%s_test', $action ), |
60 | 60 | $this->interpolate( $message, $context ), |
61 | - empty( $context['data'] ) ? array() : $context['data'] |
|
61 | + empty( $context[ 'data' ] ) ? array() : $context[ 'data' ] |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | do_action( |
66 | 66 | sprintf( 'gravityview_log_%s', $action ), |
67 | 67 | $this->interpolate( $message, $context ), |
68 | - empty( $context['data'] ) ? array() : $context['data'] |
|
68 | + empty( $context[ 'data' ] ) ? array() : $context[ 'data' ] |
|
69 | 69 | ); |
70 | 70 | } |
71 | 71 | } |
@@ -237,26 +237,26 @@ |
||
237 | 237 | |
238 | 238 | /** DEBUG */ |
239 | 239 | |
240 | - /** |
|
241 | - * Logs messages using Gravity Forms logging add-on |
|
242 | - * @param string $message log message |
|
243 | - * @param mixed $data Additional data to display |
|
240 | + /** |
|
241 | + * Logs messages using Gravity Forms logging add-on |
|
242 | + * @param string $message log message |
|
243 | + * @param mixed $data Additional data to display |
|
244 | 244 | * @deprecated use gravityview()->log |
245 | - * @return void |
|
246 | - */ |
|
247 | - public static function log_debug( $message, $data = null ){ |
|
245 | + * @return void |
|
246 | + */ |
|
247 | + public static function log_debug( $message, $data = null ){ |
|
248 | 248 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
249 | 249 | gravityview()->log->debug( $message, $data ); |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | - /** |
|
253 | - * Logs messages using Gravity Forms logging add-on |
|
254 | - * @param string $message log message |
|
252 | + /** |
|
253 | + * Logs messages using Gravity Forms logging add-on |
|
254 | + * @param string $message log message |
|
255 | 255 | * @deprecated use gravityview()->log |
256 | - * @return void |
|
257 | - */ |
|
258 | - public static function log_error( $message, $data = null ){ |
|
256 | + * @return void |
|
257 | + */ |
|
258 | + public static function log_error( $message, $data = null ){ |
|
259 | 259 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
260 | 260 | gravityview()->log->error( $message, $data ); |
261 | - } |
|
261 | + } |
|
262 | 262 | } // end class GravityView_Plugin |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @deprecated use gravityview()->log |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - public static function log_debug( $message, $data = null ){ |
|
247 | + public static function log_debug( $message, $data = null ) { |
|
248 | 248 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
249 | 249 | gravityview()->log->debug( $message, $data ); |
250 | 250 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @deprecated use gravityview()->log |
256 | 256 | * @return void |
257 | 257 | */ |
258 | - public static function log_error( $message, $data = null ){ |
|
258 | + public static function log_error( $message, $data = null ) { |
|
259 | 259 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
260 | 260 | gravityview()->log->error( $message, $data ); |
261 | 261 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @deprecated use gravityview()->log |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - public static function log_debug( $message, $data = null ){ |
|
247 | + public static function log_debug( $message, $data = null ) { |
|
248 | 248 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
249 | 249 | gravityview()->log->debug( $message, $data ); |
250 | 250 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @deprecated use gravityview()->log |
256 | 256 | * @return void |
257 | 257 | */ |
258 | - public static function log_error( $message, $data = null ){ |
|
258 | + public static function log_error( $message, $data = null ) { |
|
259 | 259 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
260 | 260 | gravityview()->log->error( $message, $data ); |
261 | 261 | } |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | |
162 | 162 | if( !empty( $field['custom_class'] ) ) { |
163 | 163 | |
164 | - $custom_class = $field['custom_class']; |
|
164 | + $custom_class = $field['custom_class']; |
|
165 | 165 | |
166 | - if( !empty( $entry ) ) { |
|
166 | + if( !empty( $entry ) ) { |
|
167 | 167 | |
168 | - // We want the merge tag to be formatted as a class. The merge tag may be |
|
169 | - // replaced by a multiple-word value that should be output as a single class. |
|
170 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
171 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
168 | + // We want the merge tag to be formatted as a class. The merge tag may be |
|
169 | + // replaced by a multiple-word value that should be output as a single class. |
|
170 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
171 | + add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
172 | 172 | |
173 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
173 | + $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
174 | 174 | |
175 | - // And then we want life to return to normal |
|
176 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
177 | - } |
|
175 | + // And then we want life to return to normal |
|
176 | + remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
177 | + } |
|
178 | 178 | |
179 | 179 | // And now we want the spaces to be handled nicely. |
180 | 180 | $classes[] = gravityview_sanitize_html_class( $custom_class ); |
@@ -531,32 +531,32 @@ discard block |
||
531 | 531 | return sanitize_title( $slug ); |
532 | 532 | } |
533 | 533 | |
534 | - /** |
|
535 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
536 | - * |
|
537 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
538 | - * |
|
539 | - * @param $entry array Gravity Forms entry object |
|
540 | - * @param $form array Gravity Forms form object |
|
541 | - */ |
|
542 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
543 | - /** |
|
544 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
545 | - * @param boolean $custom Should we process the custom entry slug? |
|
546 | - */ |
|
547 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
548 | - if( $custom ) { |
|
549 | - // create the gravityview_unique_id and save it |
|
534 | + /** |
|
535 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
536 | + * |
|
537 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
538 | + * |
|
539 | + * @param $entry array Gravity Forms entry object |
|
540 | + * @param $form array Gravity Forms form object |
|
541 | + */ |
|
542 | + public static function entry_create_custom_slug( $entry, $form ) { |
|
543 | + /** |
|
544 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
545 | + * @param boolean $custom Should we process the custom entry slug? |
|
546 | + */ |
|
547 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
548 | + if( $custom ) { |
|
549 | + // create the gravityview_unique_id and save it |
|
550 | 550 | |
551 | - // Get the entry hash |
|
552 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
551 | + // Get the entry hash |
|
552 | + $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
553 | 553 | |
554 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
554 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
555 | 555 | |
556 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
556 | + gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
557 | 557 | |
558 | - } |
|
559 | - } |
|
558 | + } |
|
559 | + } |
|
560 | 560 | |
561 | 561 | |
562 | 562 | |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | |
900 | 900 | // If there was an error, continue to the next term. |
901 | 901 | if ( is_wp_error( $term_link ) ) { |
902 | - continue; |
|
902 | + continue; |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | $placeholders['label_value'] = gv_label( $field, $entry ); |
1325 | 1325 | } |
1326 | 1326 | |
1327 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
1327 | + if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ) { |
|
1328 | 1328 | $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
1329 | 1329 | } |
1330 | 1330 | |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | foreach ( $placeholders as $tag => $value ) { |
1364 | 1364 | |
1365 | 1365 | // If the tag doesn't exist just skip it |
1366 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1366 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1367 | 1367 | continue; |
1368 | 1368 | } |
1369 | 1369 |
@@ -236,7 +236,6 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @access public |
238 | 238 | * @param array $entry |
239 | - * @param array $field |
|
240 | 239 | * @return null|string |
241 | 240 | */ |
242 | 241 | public static function field_value( $entry, $field_settings, $format = 'html' ) { |
@@ -741,6 +740,9 @@ discard block |
||
741 | 740 | return $value; |
742 | 741 | } |
743 | 742 | |
743 | +/** |
|
744 | + * @param GV\Template_Context $context |
|
745 | + */ |
|
744 | 746 | function gv_directory_link( $post = NULL, $add_pagination = true, $context = null ) { |
745 | 747 | return GravityView_API::directory_link( $post, $add_pagination, $context ); |
746 | 748 | } |
@@ -1216,6 +1218,7 @@ discard block |
||
1216 | 1218 | * @param array $passed_args Associative array with field data. `field` and `form` are required. |
1217 | 1219 | * @since 2.0 |
1218 | 1220 | * @param \GV\Template_Context The template context. |
1221 | + * @param GV\Template_Context $context |
|
1219 | 1222 | * @return string Field output. If empty value and hide empty is true, return empty. |
1220 | 1223 | */ |
1221 | 1224 | function gravityview_field_output( $passed_args, $context = null ) { |
@@ -526,7 +526,7 @@ |
||
526 | 526 | $column = 'lead_id'; |
527 | 527 | } |
528 | 528 | |
529 | - $results = $wpdb->get_results( $wpdb->prepare( "SELECT $column, meta_value FROM $table WHERE form_id = (SELECT form_id FROM $table WHERE $column = %d LIMIT 1) AND meta_key = 'gravityview_unique_id'", $id_or_string ) ); |
|
529 | + $results = $wpdb->get_results( $wpdb->prepare( "select $column, meta_value FROM $table WHERE form_id = (SELECT form_id FROM $table WHERE $column = %d LIMIT 1) AND meta_key = 'gravityview_unique_id'", $id_or_string ) ); |
|
530 | 530 | |
531 | 531 | if ( $results ) { |
532 | 532 | $cache = array_replace( $cache, array_combine( wp_list_pluck( $results, $column ), wp_list_pluck( $results, 'meta_value' ) ) ); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | $form = $gravityview_view->getForm(); |
33 | 33 | |
34 | - if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) { |
|
34 | + if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) { |
|
35 | 35 | /** Allow to fall through for back compatibility testing purposes. */ |
36 | 36 | } else { |
37 | 37 | return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label ); |
@@ -39,29 +39,29 @@ discard block |
||
39 | 39 | |
40 | 40 | $label = ''; |
41 | 41 | |
42 | - if( !empty( $field['show_label'] ) || $force_show_label ) { |
|
42 | + if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) { |
|
43 | 43 | |
44 | - $label = $field['label']; |
|
44 | + $label = $field[ 'label' ]; |
|
45 | 45 | |
46 | 46 | // Support Gravity Forms 1.9+ |
47 | - if( class_exists( 'GF_Field' ) ) { |
|
47 | + if ( class_exists( 'GF_Field' ) ) { |
|
48 | 48 | |
49 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
49 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
50 | 50 | |
51 | - if( $field_object ) { |
|
51 | + if ( $field_object ) { |
|
52 | 52 | |
53 | - $input = GFFormsModel::get_input( $field_object, $field['id'] ); |
|
53 | + $input = GFFormsModel::get_input( $field_object, $field[ 'id' ] ); |
|
54 | 54 | |
55 | 55 | // This is a complex field, with labels on a per-input basis |
56 | - if( $input ) { |
|
56 | + if ( $input ) { |
|
57 | 57 | |
58 | 58 | // Does the input have a custom label on a per-input basis? Otherwise, default label. |
59 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
59 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
63 | 63 | // This is a field with one label |
64 | - $label = $field_object->get_field_label( true, $field['label'] ); |
|
64 | + $label = $field_object->get_field_label( true, $field[ 'label' ] ); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
73 | - if ( !empty( $field['custom_label'] ) ) { |
|
73 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
74 | 74 | |
75 | - $label = self::replace_variables( $field['custom_label'], $form, $entry ); |
|
75 | + $label = self::replace_variables( $field[ 'custom_label' ], $form, $entry ); |
|
76 | 76 | |
77 | 77 | } |
78 | 78 | |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | |
135 | 135 | $width = NULL; |
136 | 136 | |
137 | - if( !empty( $field['width'] ) ) { |
|
138 | - $width = absint( $field['width'] ); |
|
137 | + if ( ! empty( $field[ 'width' ] ) ) { |
|
138 | + $width = absint( $field[ 'width' ] ); |
|
139 | 139 | |
140 | 140 | // If using percentages, limit to 100% |
141 | - if( '%d%%' === $format && $width > 100 ) { |
|
141 | + if ( '%d%%' === $format && $width > 100 ) { |
|
142 | 142 | $width = 100; |
143 | 143 | } |
144 | 144 | |
@@ -159,42 +159,42 @@ discard block |
||
159 | 159 | public static function field_class( $field, $form = NULL, $entry = NULL ) { |
160 | 160 | $classes = array(); |
161 | 161 | |
162 | - if( !empty( $field['custom_class'] ) ) { |
|
162 | + if ( ! empty( $field[ 'custom_class' ] ) ) { |
|
163 | 163 | |
164 | - $custom_class = $field['custom_class']; |
|
164 | + $custom_class = $field[ 'custom_class' ]; |
|
165 | 165 | |
166 | - if( !empty( $entry ) ) { |
|
166 | + if ( ! empty( $entry ) ) { |
|
167 | 167 | |
168 | 168 | // We want the merge tag to be formatted as a class. The merge tag may be |
169 | 169 | // replaced by a multiple-word value that should be output as a single class. |
170 | 170 | // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
171 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
171 | + add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
172 | 172 | |
173 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
173 | + $custom_class = self::replace_variables( $custom_class, $form, $entry ); |
|
174 | 174 | |
175 | 175 | // And then we want life to return to normal |
176 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
176 | + remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' ); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | // And now we want the spaces to be handled nicely. |
180 | - $classes[] = gravityview_sanitize_html_class( $custom_class ); |
|
180 | + $classes[ ] = gravityview_sanitize_html_class( $custom_class ); |
|
181 | 181 | |
182 | 182 | } |
183 | 183 | |
184 | - if(!empty($field['id'])) { |
|
185 | - if( !empty( $form ) && !empty( $form['id'] ) ) { |
|
186 | - $form_id = '-'.$form['id']; |
|
184 | + if ( ! empty( $field[ 'id' ] ) ) { |
|
185 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
186 | + $form_id = '-' . $form[ 'id' ]; |
|
187 | 187 | } else { |
188 | 188 | // @deprecated path. Form should always be given. |
189 | 189 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
190 | 190 | $gravityview_view = GravityView_View::getInstance(); |
191 | - $form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : ''; |
|
191 | + $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
|
192 | 192 | } |
193 | 193 | |
194 | - $classes[] = 'gv-field'.$form_id.'-'.$field['id']; |
|
194 | + $classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
195 | 195 | } |
196 | 196 | |
197 | - return esc_attr(implode(' ', $classes)); |
|
197 | + return esc_attr( implode( ' ', $classes ) ); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | * @return string Sanitized unique HTML `id` attribute for the field |
211 | 211 | */ |
212 | 212 | public static function field_html_attr_id( $field, $form = array(), $entry = array() ) { |
213 | - $id = $field['id']; |
|
213 | + $id = $field[ 'id' ]; |
|
214 | 214 | |
215 | 215 | if ( ! empty( $id ) ) { |
216 | - if ( ! empty( $form ) && ! empty( $form['id'] ) ) { |
|
217 | - $form_id = '-' . $form['id']; |
|
216 | + if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) { |
|
217 | + $form_id = '-' . $form[ 'id' ]; |
|
218 | 218 | } else { |
219 | 219 | // @deprecated path. Form should always be given. |
220 | 220 | gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' ); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : ''; |
223 | 223 | } |
224 | 224 | |
225 | - $id = 'gv-field' . $form_id . '-' . $field['id']; |
|
225 | + $id = 'gv-field' . $form_id . '-' . $field[ 'id' ]; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | return esc_attr( $id ); |
@@ -262,14 +262,14 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) { |
264 | 264 | |
265 | - if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) { |
|
265 | + if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) { |
|
266 | 266 | gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) ); |
267 | 267 | return NULL; |
268 | 268 | } |
269 | 269 | |
270 | 270 | $href = self::entry_link( $entry, $base_id ); |
271 | 271 | |
272 | - if( '' === $href ) { |
|
272 | + if ( '' === $href ) { |
|
273 | 273 | return NULL; |
274 | 274 | } |
275 | 275 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | } else { |
307 | 307 | $gravityview_view = GravityView_View::getInstance(); |
308 | 308 | |
309 | - if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
309 | + if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) { |
|
310 | 310 | $is_search = true; |
311 | 311 | } |
312 | 312 | } |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | |
403 | 403 | // If we've saved the permalink in memory, use it |
404 | 404 | // @since 1.3 |
405 | - $link = wp_cache_get( 'gv_directory_link_'.$post_id ); |
|
405 | + $link = wp_cache_get( 'gv_directory_link_' . $post_id ); |
|
406 | 406 | |
407 | - if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) { |
|
407 | + if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) { |
|
408 | 408 | $link = home_url(); |
409 | 409 | } |
410 | 410 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | // If not yet saved, cache the permalink. |
415 | 415 | // @since 1.3 |
416 | - wp_cache_set( 'gv_directory_link_'.$post_id, $link ); |
|
416 | + wp_cache_set( 'gv_directory_link_' . $post_id, $link ); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | // Deal with returning to proper pagination for embedded views |
@@ -421,13 +421,13 @@ discard block |
||
421 | 421 | |
422 | 422 | $args = array(); |
423 | 423 | |
424 | - if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
425 | - $args['pagenum'] = intval( $pagenum ); |
|
424 | + if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) { |
|
425 | + $args[ 'pagenum' ] = intval( $pagenum ); |
|
426 | 426 | } |
427 | 427 | |
428 | - if( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
429 | - $args['sort'] = $sort; |
|
430 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
428 | + if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
|
429 | + $args[ 'sort' ] = $sort; |
|
430 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | $link = add_query_arg( $args, $link ); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | private static function get_custom_entry_slug( $id, $entry = array() ) { |
465 | 465 | |
466 | 466 | // Generate an unique hash to use as the default value |
467 | - $slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 ); |
|
467 | + $slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 ); |
|
468 | 468 | |
469 | 469 | /** |
470 | 470 | * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}` |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry ); |
476 | 476 | |
477 | 477 | // Make sure we have something - use the original ID as backup. |
478 | - if( empty( $slug ) ) { |
|
478 | + if ( empty( $slug ) ) { |
|
479 | 479 | $slug = $id; |
480 | 480 | } |
481 | 481 | |
@@ -569,15 +569,15 @@ discard block |
||
569 | 569 | * @param boolean $custom Should we process the custom entry slug? |
570 | 570 | */ |
571 | 571 | $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
572 | - if( $custom ) { |
|
572 | + if ( $custom ) { |
|
573 | 573 | // create the gravityview_unique_id and save it |
574 | 574 | |
575 | 575 | // Get the entry hash |
576 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
576 | + $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry ); |
|
577 | 577 | |
578 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
578 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) ); |
|
579 | 579 | |
580 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
580 | + gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
581 | 581 | |
582 | 582 | } |
583 | 583 | } |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | |
597 | 597 | if ( ! empty( $entry ) && ! is_array( $entry ) ) { |
598 | 598 | $entry = GVCommon::get_entry( $entry ); |
599 | - } else if( empty( $entry ) ) { |
|
599 | + } else if ( empty( $entry ) ) { |
|
600 | 600 | // @deprecated path |
601 | 601 | $entry = GravityView_frontend::getInstance()->getEntry(); |
602 | 602 | } |
@@ -616,9 +616,9 @@ discard block |
||
616 | 616 | |
617 | 617 | $query_arg_name = \GV\Entry::get_endpoint_name(); |
618 | 618 | |
619 | - $entry_slug = self::get_entry_slug( $entry['id'], $entry ); |
|
619 | + $entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry ); |
|
620 | 620 | |
621 | - if ( get_option('permalink_structure') && !is_preview() ) { |
|
621 | + if ( get_option( 'permalink_structure' ) && ! is_preview() ) { |
|
622 | 622 | |
623 | 623 | $args = array(); |
624 | 624 | |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | */ |
629 | 629 | $link_parts = explode( '?', $directory_link ); |
630 | 630 | |
631 | - $query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : ''; |
|
631 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
632 | 632 | |
633 | - $directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query; |
|
633 | + $directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query; |
|
634 | 634 | |
635 | 635 | } else { |
636 | 636 | |
@@ -642,22 +642,22 @@ discard block |
||
642 | 642 | */ |
643 | 643 | if ( $add_directory_args ) { |
644 | 644 | |
645 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
646 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
645 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
646 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | /** |
650 | 650 | * @since 1.7 |
651 | 651 | */ |
652 | 652 | if ( $sort = \GV\Utils::_GET( 'sort' ) ) { |
653 | - $args['sort'] = $sort; |
|
654 | - $args['dir'] = \GV\Utils::_GET( 'dir' ); |
|
653 | + $args[ 'sort' ] = $sort; |
|
654 | + $args[ 'dir' ] = \GV\Utils::_GET( 'dir' ); |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | } |
658 | 658 | |
659 | 659 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
660 | - $args['gvid'] = gravityview_get_view_id(); |
|
660 | + $args[ 'gvid' ] = gravityview_get_view_id(); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | return add_query_arg( $args, $directory_link ); |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | } |
679 | 679 | |
680 | 680 | function gv_class( $field, $form = NULL, $entry = array() ) { |
681 | - return GravityView_API::field_class( $field, $form, $entry ); |
|
681 | + return GravityView_API::field_class( $field, $form, $entry ); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | /** |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | $view_id = 0; |
702 | 702 | if ( $context->view ) { |
703 | 703 | $view_id = $context->view->ID; |
704 | - if( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
704 | + if ( $context->view->settings->get( 'hide_until_searched' ) ) { |
|
705 | 705 | $hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() ); |
706 | 706 | } |
707 | 707 | } |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | $default_css_class .= ' gv-container-no-results'; |
730 | 730 | } |
731 | 731 | |
732 | - $css_class = trim( $passed_css_class . ' '. $default_css_class ); |
|
732 | + $css_class = trim( $passed_css_class . ' ' . $default_css_class ); |
|
733 | 733 | |
734 | 734 | /** |
735 | 735 | * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | $value = GravityView_API::field_value( $entry, $field ); |
758 | 758 | |
759 | - if( $value === '' ) { |
|
759 | + if ( $value === '' ) { |
|
760 | 760 | /** |
761 | 761 | * @filter `gravityview_empty_value` What to display when a field is empty |
762 | 762 | * @param string $value (empty string) |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | */ |
870 | 870 | function gravityview_get_field_value( $entry, $field_id, $display_value ) { |
871 | 871 | |
872 | - if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
872 | + if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) { |
|
873 | 873 | |
874 | 874 | // For the complete field value as generated by Gravity Forms |
875 | 875 | return $display_value; |
@@ -903,16 +903,16 @@ discard block |
||
903 | 903 | $terms = explode( ', ', $value ); |
904 | 904 | } |
905 | 905 | |
906 | - foreach ($terms as $term_name ) { |
|
906 | + foreach ( $terms as $term_name ) { |
|
907 | 907 | |
908 | 908 | // If we're processing a category, |
909 | - if( $taxonomy === 'category' ) { |
|
909 | + if ( $taxonomy === 'category' ) { |
|
910 | 910 | |
911 | 911 | // Use rgexplode to prevent errors if : doesn't exist |
912 | 912 | list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 ); |
913 | 913 | |
914 | 914 | // The explode was succesful; we have the category ID |
915 | - if( !empty( $term_id )) { |
|
915 | + if ( ! empty( $term_id ) ) { |
|
916 | 916 | $term = get_term_by( 'id', $term_id, $taxonomy ); |
917 | 917 | } else { |
918 | 918 | // We have to fall back to the name |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | } |
926 | 926 | |
927 | 927 | // There's still a tag/category here. |
928 | - if( $term ) { |
|
928 | + if ( $term ) { |
|
929 | 929 | |
930 | 930 | $term_link = get_term_link( $term, $taxonomy ); |
931 | 931 | |
@@ -934,11 +934,11 @@ discard block |
||
934 | 934 | continue; |
935 | 935 | } |
936 | 936 | |
937 | - $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
937 | + $output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |
|
938 | 938 | } |
939 | 939 | } |
940 | 940 | |
941 | - return implode(', ', $output ); |
|
941 | + return implode( ', ', $output ); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | /** |
@@ -952,8 +952,8 @@ discard block |
||
952 | 952 | |
953 | 953 | $output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' ); |
954 | 954 | |
955 | - if( empty( $link ) ) { |
|
956 | - return strip_tags( $output); |
|
955 | + if ( empty( $link ) ) { |
|
956 | + return strip_tags( $output ); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | return $output; |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | $fe = GravityView_frontend::getInstance(); |
973 | 973 | |
974 | 974 | // Solve problem when loading content via admin-ajax.php |
975 | - if( ! $fe->getGvOutputData() ) { |
|
975 | + if ( ! $fe->getGvOutputData() ) { |
|
976 | 976 | |
977 | 977 | gravityview()->log->debug( 'gv_output_data not defined; parsing content.' ); |
978 | 978 | |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | } |
981 | 981 | |
982 | 982 | // Make 100% sure that we're dealing with a properly called situation |
983 | - if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
983 | + if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) { |
|
984 | 984 | |
985 | 985 | gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) ); |
986 | 986 | |
@@ -1202,12 +1202,12 @@ discard block |
||
1202 | 1202 | function gravityview_get_files_array( $value, $gv_class = '', $context = null ) { |
1203 | 1203 | /** @define "GRAVITYVIEW_DIR" "../" */ |
1204 | 1204 | |
1205 | - if( !class_exists( 'GravityView_Field' ) ) { |
|
1206 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' ); |
|
1205 | + if ( ! class_exists( 'GravityView_Field' ) ) { |
|
1206 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' ); |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | - if( !class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1210 | - include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' ); |
|
1209 | + if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) { |
|
1210 | + include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' ); |
|
1211 | 1211 | } |
1212 | 1212 | |
1213 | 1213 | return GravityView_Field_FileUpload::get_files_array( $value, $gv_class, $context ); |
@@ -1306,21 +1306,21 @@ discard block |
||
1306 | 1306 | } else { |
1307 | 1307 | // @deprecated path |
1308 | 1308 | // Required fields. |
1309 | - if ( empty( $args['field'] ) || empty( $args['form'] ) ) { |
|
1309 | + if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) { |
|
1310 | 1310 | gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) ); |
1311 | 1311 | return ''; |
1312 | 1312 | } |
1313 | 1313 | } |
1314 | 1314 | |
1315 | 1315 | if ( $context instanceof \GV\Template_Context ) { |
1316 | - $entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() ); |
|
1317 | - $field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() ); |
|
1318 | - $form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() ); |
|
1316 | + $entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() ); |
|
1317 | + $field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() ); |
|
1318 | + $form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() ); |
|
1319 | 1319 | } else { |
1320 | 1320 | // @deprecated path |
1321 | - $entry = empty( $args['entry'] ) ? array() : $args['entry']; |
|
1322 | - $field = $args['field']; |
|
1323 | - $form = $args['form']; |
|
1321 | + $entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ]; |
|
1322 | + $field = $args[ 'field' ]; |
|
1323 | + $form = $args[ 'form' ]; |
|
1324 | 1324 | } |
1325 | 1325 | |
1326 | 1326 | /** |
@@ -1338,40 +1338,40 @@ discard block |
||
1338 | 1338 | ); |
1339 | 1339 | |
1340 | 1340 | if ( $context instanceof \GV\Template_Context ) { |
1341 | - $placeholders['value'] = \GV\Utils::get( $args, 'value', '' ); |
|
1341 | + $placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' ); |
|
1342 | 1342 | } else { |
1343 | 1343 | // @deprecated path |
1344 | - $placeholders['value'] = gv_value( $entry, $field ); |
|
1344 | + $placeholders[ 'value' ] = gv_value( $entry, $field ); |
|
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | // If the value is empty and we're hiding empty, return empty. |
1348 | - if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) { |
|
1348 | + if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) { |
|
1349 | 1349 | return ''; |
1350 | 1350 | } |
1351 | 1351 | |
1352 | - if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) { |
|
1353 | - $placeholders['value'] = wpautop( $placeholders['value'] ); |
|
1352 | + if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) { |
|
1353 | + $placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] ); |
|
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 | // Get width setting, if exists |
1357 | - $placeholders['width'] = GravityView_API::field_width( $field ); |
|
1357 | + $placeholders[ 'width' ] = GravityView_API::field_width( $field ); |
|
1358 | 1358 | |
1359 | 1359 | // If replacing with CSS inline formatting, let's do it. |
1360 | - $placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' ); |
|
1360 | + $placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' ); |
|
1361 | 1361 | |
1362 | 1362 | // Grab the Class using `gv_class` |
1363 | - $placeholders['class'] = gv_class( $field, $form, $entry ); |
|
1364 | - $placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
1363 | + $placeholders[ 'class' ] = gv_class( $field, $form, $entry ); |
|
1364 | + $placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry ); |
|
1365 | 1365 | |
1366 | 1366 | if ( $context instanceof \GV\Template_Context ) { |
1367 | - $placeholders['label_value'] = \GV\Utils::get( $args, 'label' ); |
|
1367 | + $placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' ); |
|
1368 | 1368 | } else { |
1369 | 1369 | // Default Label value |
1370 | - $placeholders['label_value'] = gv_label( $field, $entry ); |
|
1370 | + $placeholders[ 'label_value' ] = gv_label( $field, $entry ); |
|
1371 | 1371 | } |
1372 | 1372 | |
1373 | - if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){ |
|
1374 | - $placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1373 | + if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) { |
|
1374 | + $placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>'; |
|
1375 | 1375 | } |
1376 | 1376 | |
1377 | 1377 | /** |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | * @since 2.0 |
1383 | 1383 | * @param \GV\Template_Context $context The context. |
1384 | 1384 | */ |
1385 | - $html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context ); |
|
1385 | + $html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context ); |
|
1386 | 1386 | |
1387 | 1387 | /** |
1388 | 1388 | * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | foreach ( $placeholders as $tag => $value ) { |
1410 | 1410 | |
1411 | 1411 | // If the tag doesn't exist just skip it |
1412 | - if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){ |
|
1412 | + if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) { |
|
1413 | 1413 | continue; |
1414 | 1414 | } |
1415 | 1415 |