Skip to content

Commit

Permalink
Fix PHP 7.2 compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zackkatz committed Aug 26, 2024
1 parent 4cf25ab commit 8952774
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions future/_mocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ function ( $e ) {
* @return null|string The value of a field in an entry.
*/
function GravityView_API_field_value( $entry, $field_settings, $format ) {
$original_args = func_get_args();

if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( $original_args ) ) );
return null;
}

Expand Down Expand Up @@ -202,7 +204,7 @@ function GravityView_API_field_value( $entry, $field_settings, $format ) {

/** An unidentified backend. */
default:
gravityview()->log->error( 'Could not determine source for entry', array( 'data' => array( func_get_args() ) ) );
gravityview()->log->error( 'Could not determine source for entry', array( 'data' => array( $original_args ) ) );
return null;
endswitch;

Expand Down Expand Up @@ -235,6 +237,7 @@ function GravityView_API_field_value( $entry, $field_settings, $format ) {
* @return string The label of a field in an entry.
*/
function GravityView_API_field_label( $form, $field_settings, $entry, $force_show_label = false ) {
$original_args = func_get_args();

/** A bail condition. */
$bail = function ( $label, $field_settings, $entry, $force_show_label, $form ) {
Expand Down Expand Up @@ -280,7 +283,7 @@ function GravityView_API_field_label( $form, $field_settings, $entry, $force_sho
}

if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) );
gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( $original_args ) ) );
return $bail( $label, $field_settings, $entry, $force_show_label, $form );
}

Expand Down Expand Up @@ -333,7 +336,7 @@ function GravityView_API_field_label( $form, $field_settings, $entry, $force_sho

/** An unidentified backend. */
default:
gravityview()->log->error( 'Could not determine source for entry. Using empty field.', array( 'data' => array( func_get_args() ) ) );
gravityview()->log->error( 'Could not determine source for entry. Using empty field.', array( 'data' => array( $original_args ) ) );
$field = new \GV\Field();
break;
endswitch;
Expand Down
2 changes: 1 addition & 1 deletion future/includes/class-gv-shortcode-gvlogic.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private function get_output( $match, $atts, $content ) {
break; // No more shortcodes
}

list( $_, $before_shortcode, $shortcode, $_, $after_shortcode ) = $matches;
list( $_, $before_shortcode, $shortcode, $__, $after_shortcode ) = $matches;

if ( ! $found ) { // We're still iffing.
$if .= $before_shortcode;
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/metaboxes/views/placeholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class="gk-gravityview-placeholder-container gk-gravityview-placeholder-container
'<a href="%1$s" %3$s class="gk-gravityview-placeholder-button button button-primary button-hero">%2$s</a>',
esc_url( $button_href ),
esc_html( $button_text ),
implode( ' ', $attributes ),
implode( ' ', $attributes )
);
} else {
printf(
Expand Down

0 comments on commit 8952774

Please sign in to comment.