@@ -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 ) ) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $format = '(?:\.(?P<format>html|json))?'; |
| 134 | 134 | |
| 135 | - register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array( |
|
| 135 | + register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array( |
|
| 136 | 136 | array( |
| 137 | 137 | 'methods' => \WP_REST_Server::READABLE, |
| 138 | 138 | 'callback' => array( $this, 'get_sub_item' ), |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * @return \WP_REST_Response |
| 384 | 384 | */ |
| 385 | 385 | protected function not_implemented( ) { |
| 386 | - $error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) ); |
|
| 386 | + $error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) ); |
|
| 387 | 387 | return new \WP_REST_Response( $error, 501 ); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | gravityview()->log->debug( '$passed_atts: ', array( 'data' => $passed_atts ) ); |
| 49 | 49 | |
| 50 | 50 | // Get details about the current View |
| 51 | - if( !empty( $passed_atts['detail'] ) ) { |
|
| 52 | - return $this->get_view_detail( $passed_atts['detail'] ); |
|
| 51 | + if ( ! empty( $passed_atts[ 'detail' ] ) ) { |
|
| 52 | + return $this->get_view_detail( $passed_atts[ 'detail' ] ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $atts = $this->parse_and_sanitize_atts( $passed_atts ); |
@@ -85,16 +85,16 @@ discard block |
||
| 85 | 85 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
| 86 | 86 | |
| 87 | 87 | // Only keep the passed attributes after making sure that they're valid pairs |
| 88 | - $filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts ); |
|
| 88 | + $filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts ); |
|
| 89 | 89 | |
| 90 | 90 | $atts = array(); |
| 91 | 91 | |
| 92 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
| 92 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
| 93 | 93 | |
| 94 | 94 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
| 95 | 95 | $passed_value = GravityView_Merge_Tags::replace_variables( $passed_value ); |
| 96 | 96 | |
| 97 | - switch( $defaults[ $key ]['type'] ) { |
|
| 97 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Make sure number fields are numeric. |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
| 103 | 103 | */ |
| 104 | 104 | case 'number': |
| 105 | - if( is_numeric( $passed_value ) ) { |
|
| 105 | + if ( is_numeric( $passed_value ) ) { |
|
| 106 | 106 | $atts[ $key ] = ( $passed_value + 0 ); |
| 107 | 107 | } |
| 108 | 108 | break; |
| 109 | 109 | |
| 110 | 110 | /** @since 2.1 */ |
| 111 | 111 | case 'operator': |
| 112 | - if( GFFormsModel::is_valid_operator( $passed_value ) ) { |
|
| 112 | + if ( GFFormsModel::is_valid_operator( $passed_value ) ) { |
|
| 113 | 113 | $atts[ $key ] = $passed_value; |
| 114 | 114 | } |
| 115 | 115 | break; |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | case 'select': |
| 126 | 126 | case 'radio': |
| 127 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
| 128 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 127 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
| 128 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 129 | 129 | $atts[ $key ] = $passed_value; |
| 130 | 130 | } |
| 131 | 131 | break; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $gravityview_view = GravityView_View::getInstance(); |
| 155 | 155 | $return = ''; |
| 156 | 156 | |
| 157 | - switch( $detail ) { |
|
| 157 | + switch ( $detail ) { |
|
| 158 | 158 | case 'total_entries': |
| 159 | 159 | $return = number_format_i18n( $gravityview_view->getTotalEntries() ); |
| 160 | 160 | break; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | abstract class GravityView_Extension extends \GV\Extension { |
| 16 | 16 | public function __construct() { |
| 17 | - if( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) { |
|
| 17 | + if ( ! in_array( $this->_author, array( 'GravityView', 'Katz Web Services, Inc.', true ) ) ) { |
|
| 18 | 18 | gravityview()->log->warning( '\GravityView_Extension is deprecated. Inherit from \GV\Extension instead', array( 'data' => $this ) ); |
| 19 | 19 | } |
| 20 | 20 | parent::__construct(); |
@@ -20,16 +20,16 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | function gravityview_register_gravityview_widgets() { |
| 22 | 22 | |
| 23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 24 | 24 | |
| 25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
| 26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
| 27 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
| 28 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
| 29 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
| 25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
| 26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
| 27 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
| 28 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
| 29 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
| 30 | 30 | |
| 31 | - if( class_exists('GFPolls') ) { |
|
| 32 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
| 31 | + if ( class_exists( 'GFPolls' ) ) { |
|
| 32 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $default_size = 25; |
| 46 | 46 | |
| 47 | 47 | if ( $context instanceof \GV\Template_Context ) { |
| 48 | - $default_size = (int) $context->view->settings->get( 'page_size' ); |
|
| 48 | + $default_size = (int)$context->view->settings->get( 'page_size' ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $sizes = array( 10, 25, $default_size, 50, 100 ); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $page_sizes = array(); |
| 58 | 58 | foreach ( $sizes as $size ) { |
| 59 | - $page_sizes [] = array( |
|
| 59 | + $page_sizes [ ] = array( |
|
| 60 | 60 | 'value' => $size, |
| 61 | 61 | 'text' => $size |
| 62 | 62 | ); |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function render_frontend( $widget_args, $content = '', $context = null ) { |
| 83 | 83 | |
| 84 | - if( ! $this->pre_render_frontend() ) { |
|
| 84 | + if ( ! $this->pre_render_frontend() ) { |
|
| 85 | 85 | return; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $page_size = (int) \GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) ); |
|
| 88 | + $page_size = (int)\GV\Utils::_GET( 'page_size', $context->view->settings->get( 'page_size' ) ); |
|
| 89 | 89 | |
| 90 | 90 | $settings = shortcode_atts( array( |
| 91 | 91 | 'label' => __( 'Page Size', 'gravityview' ), |
@@ -104,20 +104,20 @@ discard block |
||
| 104 | 104 | <div class="gv-widget-page-size"> |
| 105 | 105 | <form method="get" action="<?php echo esc_url( add_query_arg( array() ) ); ?>" onchange="this.submit();"> |
| 106 | 106 | <div> |
| 107 | - <?php if( ! empty( $settings['label'] ) ) { ?> |
|
| 108 | - <label for="gv-page_size"><?php echo esc_html( $settings['label'] ); ?></label> |
|
| 107 | + <?php if ( ! empty( $settings[ 'label' ] ) ) { ?> |
|
| 108 | + <label for="gv-page_size"><?php echo esc_html( $settings[ 'label' ] ); ?></label> |
|
| 109 | 109 | <?php } ?> |
| 110 | 110 | <select name="page_size" id="gv-page_size"> |
| 111 | - <option value=""><?php echo esc_html( $settings['default_choice_text'] ); ?></option> |
|
| 111 | + <option value=""><?php echo esc_html( $settings[ 'default_choice_text' ] ); ?></option> |
|
| 112 | 112 | <?php |
| 113 | - foreach ( $settings['choices'] as $choice ) { ?> |
|
| 114 | - <option value='<?php echo esc_attr( $choice['value'] ); ?>'<?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
| 113 | + foreach ( $settings[ 'choices' ] as $choice ) { ?> |
|
| 114 | + <option value='<?php echo esc_attr( $choice[ 'value' ] ); ?>'<?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $page_size ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
| 115 | 115 | <?php } ?> |
| 116 | 116 | </select> |
| 117 | 117 | <input type="submit" value="Submit" style="visibility: hidden; position: absolute;" /><?php |
| 118 | - if( ! empty( $_GET ) ) { |
|
| 118 | + if ( ! empty( $_GET ) ) { |
|
| 119 | 119 | $get = $_GET; |
| 120 | - unset( $get['page_size'] ); |
|
| 120 | + unset( $get[ 'page_size' ] ); |
|
| 121 | 121 | foreach ( $get as $key => $value ) { |
| 122 | 122 | printf( '<input type="hidden" name="%s" value="%s" />', esc_attr( $key ), esc_attr( $value ) ); |
| 123 | 123 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // Already overridden |
| 153 | - if ( (int) $page_size === (int) $view->settings->get( 'page_size' ) ) { |
|
| 153 | + if ( (int)$page_size === (int)$view->settings->get( 'page_size' ) ) { |
|
| 154 | 154 | return; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | 'view' => $view, |
| 159 | 159 | ) ); |
| 160 | 160 | |
| 161 | - if ( ! in_array( (int) $page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) { |
|
| 161 | + if ( ! in_array( (int)$page_size, wp_list_pluck( self::get_page_sizes( $context ), 'value' ), true ) ) { |
|
| 162 | 162 | gravityview()->log->warning( 'The passed page size is not allowed: {page_size}. Not modifying result.', array( 'page_size' => $page_size ) ); |
| 163 | 163 | return; |
| 164 | 164 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $gv_page = gravityview()->request->is_admin( '', 'single' ); |
| 79 | 79 | |
| 80 | 80 | // New View or Edit View page |
| 81 | - if( $gv_page && $pagenow === 'post-new.php' ) { |
|
| 81 | + if ( $gv_page && $pagenow === 'post-new.php' ) { |
|
| 82 | 82 | remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' ); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | parent::add_hooks(); |
| 69 | 69 | |
| 70 | - if( gravityview()->request->is_admin( '', null ) ) { |
|
| 70 | + if ( gravityview()->request->is_admin( '', null ) ) { |
|
| 71 | 71 | |
| 72 | 72 | // Make Yoast metabox go down to the bottom please. |
| 73 | 73 | add_filter( 'wpseo_metabox_prio', array( $this, 'return_low' ) ); |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function disable_content_analysis( $options ) { |
| 94 | 94 | |
| 95 | - $options['keyword_analysis_active'] = false; |
|
| 96 | - $options['content_analysis_active'] = false; |
|
| 95 | + $options[ 'keyword_analysis_active' ] = false; |
|
| 96 | + $options[ 'content_analysis_active' ] = false; |
|
| 97 | 97 | |
| 98 | 98 | return $options; |
| 99 | 99 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | global $pagenow; |
| 113 | 113 | |
| 114 | 114 | // New View page |
| 115 | - if( $pagenow === 'post-new.php' ) { |
|
| 116 | - $options['hideeditbox-gravityview'] = true; |
|
| 115 | + if ( $pagenow === 'post-new.php' ) { |
|
| 116 | + $options[ 'hideeditbox-gravityview' ] = true; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | return $options; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function __construct() { |
| 19 | 19 | |
| 20 | - if( !GravityView_Compatibility::is_valid() ) { return; } |
|
| 20 | + if ( ! GravityView_Compatibility::is_valid() ) { return; } |
|
| 21 | 21 | |
| 22 | 22 | self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
| 23 | 23 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function initialize() { |
| 37 | 37 | |
| 38 | - add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' )); |
|
| 38 | + add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' ) ); |
|
| 39 | 39 | |
| 40 | - add_action( 'add_meta_boxes_gravityview' , array( $this, 'update_priority' ) ); |
|
| 40 | + add_action( 'add_meta_boxes_gravityview', array( $this, 'update_priority' ) ); |
|
| 41 | 41 | |
| 42 | 42 | // information box |
| 43 | 43 | add_action( 'post_submitbox_misc_actions', array( $this, 'render_shortcode_hint' ) ); |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | function update_priority() { |
| 52 | 52 | global $wp_meta_boxes; |
| 53 | 53 | |
| 54 | - if( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
| 55 | - foreach( array( 'high', 'core', 'low' ) as $position ) { |
|
| 56 | - if( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
| 57 | - foreach( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
| 58 | - if( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 59 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
| 60 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
| 54 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
| 55 | + foreach ( array( 'high', 'core', 'low' ) as $position ) { |
|
| 56 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
| 57 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
| 58 | + if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 59 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
| 60 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | global $post; |
| 70 | 70 | |
| 71 | 71 | // On Comment Edit, for example, $post isn't set. |
| 72 | - if( empty( $post ) || !is_object( $post ) || !isset( $post->ID ) ) { |
|
| 72 | + if ( empty( $post ) || ! is_object( $post ) || ! isset( $post->ID ) ) { |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | $metaboxes = apply_filters( 'gravityview/metaboxes/default', $metaboxes ); |
| 154 | 154 | |
| 155 | - foreach( $metaboxes as $m ) { |
|
| 155 | + foreach ( $metaboxes as $m ) { |
|
| 156 | 156 | |
| 157 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
| 157 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
| 158 | 158 | |
| 159 | 159 | GravityView_Metabox_Tabs::add( $tab ); |
| 160 | 160 | |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $links = GravityView_Admin_Views::get_connected_form_links( $current_form, false ); |
| 182 | 182 | |
| 183 | - if( !empty( $links ) ) { |
|
| 184 | - $links = '<span class="alignright gv-form-links">'. $links .'</span>'; |
|
| 183 | + if ( ! empty( $links ) ) { |
|
| 184 | + $links = '<span class="alignright gv-form-links">' . $links . '</span>'; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | return __( 'Data Source', 'gravityview' ) . $links; |
@@ -220,28 +220,28 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public static function render_merge_tags_scripts( $curr_form ) { |
| 222 | 222 | |
| 223 | - if( empty( $curr_form )) { |
|
| 223 | + if ( empty( $curr_form ) ) { |
|
| 224 | 224 | return NULL; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $form = gravityview_get_form( $curr_form ); |
| 228 | 228 | |
| 229 | - $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
|
| 229 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : NULL; |
|
| 230 | 230 | |
| 231 | - if( isset( $form['id'] ) ) { |
|
| 232 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 231 | + if ( isset( $form[ 'id' ] ) ) { |
|
| 232 | + $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
|
| 233 | 233 | |
| 234 | 234 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
| 235 | - $_GET['id'] = $form['id']; |
|
| 235 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
| 236 | 236 | |
| 237 | 237 | } else { |
| 238 | 238 | $form_script = 'var form = new Form();'; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
|
| 241 | + $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
|
| 242 | 242 | |
| 243 | 243 | // Restore previous $_GET setting |
| 244 | - $_GET['id'] = $get_id_backup; |
|
| 244 | + $_GET[ 'id' ] = $get_id_backup; |
|
| 245 | 245 | |
| 246 | 246 | return $output; |
| 247 | 247 | } |
@@ -299,12 +299,12 @@ discard block |
||
| 299 | 299 | global $post; |
| 300 | 300 | |
| 301 | 301 | // Only show this on GravityView post types. |
| 302 | - if( false === gravityview()->request->is_admin( '', null ) ) { |
|
| 302 | + if ( false === gravityview()->request->is_admin( '', null ) ) { |
|
| 303 | 303 | return; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | // If the View hasn't been configured yet, don't show embed shortcode |
| 307 | - if( ! gravityview_get_directory_fields( $post->ID ) && ! gravityview_get_directory_widgets( $post->ID ) ) { |
|
| 307 | + if ( ! gravityview_get_directory_fields( $post->ID ) && ! gravityview_get_directory_widgets( $post->ID ) ) { |
|
| 308 | 308 | return; |
| 309 | 309 | } |
| 310 | 310 | |