@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | function __construct() { |
| 19 | 19 | |
| 20 | - $this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' ); |
|
| 20 | + $this->widget_description = __( 'Insert custom text or HTML as a widget', 'gravityview' ); |
|
| 21 | 21 | |
| 22 | 22 | $default_values = array( |
| 23 | 23 | 'header' => 1, |
@@ -42,39 +42,39 @@ discard block |
||
| 42 | 42 | ), |
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | - parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings ); |
|
| 45 | + parent::__construct( __( 'Custom Content', 'gravityview' ), 'custom_content', $default_values, $settings ); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 48 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 49 | 49 | |
| 50 | - if( !$this->pre_render_frontend() ) { |
|
| 50 | + if ( ! $this->pre_render_frontend() ) { |
|
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if( !empty( $widget_args['title'] ) ) { |
|
| 55 | - echo $widget_args['title']; |
|
| 54 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
| 55 | + echo $widget_args[ 'title' ]; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | // Make sure the class is loaded in DataTables |
| 60 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
| 60 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
| 61 | 61 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $widget_args['content'] = trim( rtrim( $widget_args['content'] ) ); |
|
| 64 | + $widget_args[ 'content' ] = trim( rtrim( $widget_args[ 'content' ] ) ); |
|
| 65 | 65 | |
| 66 | 66 | // No custom content |
| 67 | - if( empty( $widget_args['content'] ) ) { |
|
| 68 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class($this)) ); |
|
| 67 | + if ( empty( $widget_args[ 'content' ] ) ) { |
|
| 68 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class( $this ) ) ); |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Add paragraphs? |
| 73 | - if( !empty( $widget_args['wpautop'] ) ) { |
|
| 74 | - $widget_args['content'] = wpautop( $widget_args['content'] ); |
|
| 73 | + if ( ! empty( $widget_args[ 'wpautop' ] ) ) { |
|
| 74 | + $widget_args[ 'content' ] = wpautop( $widget_args[ 'content' ] ); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $content = $widget_args['content']; |
|
| 77 | + $content = $widget_args[ 'content' ]; |
|
| 78 | 78 | |
| 79 | 79 | $content = GravityView_Merge_Tags::replace_variables( $content ); |
| 80 | 80 | |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | // Add custom class |
| 87 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 87 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 88 | 88 | $class = gravityview_sanitize_html_class( $class ); |
| 89 | 89 | |
| 90 | - echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>'; |
|
| 90 | + echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>'; |
|
| 91 | 91 | |
| 92 | 92 | } |
| 93 | 93 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | function __construct() { |
| 18 | 18 | |
| 19 | - $this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
| 19 | + $this->widget_description = __( 'Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
| 20 | 20 | |
| 21 | 21 | $default_values = array( |
| 22 | 22 | 'header' => 1, |
@@ -25,18 +25,18 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $settings = array(); |
| 27 | 27 | |
| 28 | - parent::__construct( __( 'Show Pagination Info', 'gravityview' ) , 'page_info', $default_values, $settings ); |
|
| 28 | + parent::__construct( __( 'Show Pagination Info', 'gravityview' ), 'page_info', $default_values, $settings ); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 31 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 32 | 32 | $gravityview_view = GravityView_View::getInstance(); |
| 33 | 33 | |
| 34 | - if( !$this->pre_render_frontend() ) { |
|
| 34 | + if ( ! $this->pre_render_frontend() ) { |
|
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if( !empty( $widget_args['title'] ) ) { |
|
| 39 | - echo $widget_args['title']; |
|
| 38 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
| 39 | + echo $widget_args[ 'title' ]; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $pagination_counts = $gravityview_view->getPaginationCounts(); |
@@ -45,16 +45,16 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $output = ''; |
| 47 | 47 | |
| 48 | - if( ! empty( $pagination_counts ) ) { |
|
| 48 | + if ( ! empty( $pagination_counts ) ) { |
|
| 49 | 49 | |
| 50 | - $first = $pagination_counts['first']; |
|
| 51 | - $last = $pagination_counts['last']; |
|
| 52 | - $total = $pagination_counts['total']; |
|
| 50 | + $first = $pagination_counts[ 'first' ]; |
|
| 51 | + $last = $pagination_counts[ 'last' ]; |
|
| 52 | + $total = $pagination_counts[ 'total' ]; |
|
| 53 | 53 | |
| 54 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 54 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 55 | 55 | $class = gravityview_sanitize_html_class( $class ); |
| 56 | 56 | |
| 57 | - $output = '<div class="gv-widget-pagination '.$class.'"><p>'. sprintf(__( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
| 57 | + $output = '<div class="gv-widget-pagination ' . $class . '"><p>' . sprintf( __( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -301,6 +301,7 @@ |
||
| 301 | 301 | * Make protected public |
| 302 | 302 | * @inheritDoc |
| 303 | 303 | * @access public |
| 304 | + * @param string $setting_name |
|
| 304 | 305 | */ |
| 305 | 306 | public function get_app_setting( $setting_name ) { |
| 306 | 307 | |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | - * Uninstall all traces of GravityView |
|
| 126 | - * |
|
| 127 | - * Note: method is public because parent method is public |
|
| 128 | - * |
|
| 125 | + * Uninstall all traces of GravityView |
|
| 126 | + * |
|
| 127 | + * Note: method is public because parent method is public |
|
| 128 | + * |
|
| 129 | 129 | * @return bool |
| 130 | 130 | */ |
| 131 | 131 | public function uninstall() { |
@@ -137,53 +137,53 @@ discard block |
||
| 137 | 137 | $uninstaller->fire_everything(); |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
| 141 | - * @see GFAddOn::uninstall_addon |
|
| 142 | - * @uses deactivate_plugins() |
|
| 143 | - */ |
|
| 140 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
| 141 | + * @see GFAddOn::uninstall_addon |
|
| 142 | + * @uses deactivate_plugins() |
|
| 143 | + */ |
|
| 144 | 144 | $this->_path = GRAVITYVIEW_FILE; |
| 145 | 145 | |
| 146 | 146 | return true; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * Get an array of reasons why the plugin might be uninstalled |
|
| 151 | - * |
|
| 152 | - * @since 1.17.5 |
|
| 153 | - * |
|
| 150 | + * Get an array of reasons why the plugin might be uninstalled |
|
| 151 | + * |
|
| 152 | + * @since 1.17.5 |
|
| 153 | + * |
|
| 154 | 154 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
| 155 | 155 | */ |
| 156 | 156 | private function get_uninstall_reasons() { |
| 157 | 157 | |
| 158 | 158 | $reasons = array( |
| 159 | 159 | 'will-continue' => array( |
| 160 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
| 161 | - ), |
|
| 160 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
| 161 | + ), |
|
| 162 | 162 | 'no-longer-need' => array( |
| 163 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
| 164 | - ), |
|
| 163 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
| 164 | + ), |
|
| 165 | 165 | 'doesnt-work' => array( |
| 166 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
| 167 | - ), |
|
| 166 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
| 167 | + ), |
|
| 168 | 168 | 'found-other' => array( |
| 169 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
| 170 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 171 | - ), |
|
| 169 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
| 170 | + 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 171 | + ), |
|
| 172 | 172 | 'other' => array( |
| 173 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
| 174 | - ), |
|
| 173 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
| 174 | + ), |
|
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | 177 | shuffle( $reasons ); |
| 178 | 178 | |
| 179 | 179 | return $reasons; |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * Display a feedback form when the plugin is uninstalled |
|
| 184 | - * |
|
| 185 | - * @since 1.17.5 |
|
| 186 | - * |
|
| 183 | + * Display a feedback form when the plugin is uninstalled |
|
| 184 | + * |
|
| 185 | + * @since 1.17.5 |
|
| 186 | + * |
|
| 187 | 187 | * @return string HTML of the uninstallation form |
| 188 | 188 | */ |
| 189 | 189 | public function uninstall_form() { |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
| 264 | 264 | <ul> |
| 265 | 265 | <?php |
| 266 | - $reasons = $this->get_uninstall_reasons(); |
|
| 266 | + $reasons = $this->get_uninstall_reasons(); |
|
| 267 | 267 | foreach ( $reasons as $reason ) { |
| 268 | 268 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', rgar( $reason, 'followup' ), rgar( $reason, 'label' ) ); |
| 269 | 269 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $license_key = self::getSetting('license_key'); |
| 427 | 427 | if( '' === $license_key ) { |
| 428 | 428 | $license_status = 'inactive'; |
| 429 | - } |
|
| 429 | + } |
|
| 430 | 430 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
| 431 | 431 | |
| 432 | 432 | $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $update_below = false; |
| 442 | 442 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
| 443 | 443 | |
| 444 | - switch ( $license_status ) { |
|
| 444 | + switch ( $license_status ) { |
|
| 445 | 445 | /** @since 1.17 */ |
| 446 | 446 | case 'expired': |
| 447 | 447 | $title = __('Expired License', 'gravityview'); |
@@ -487,12 +487,12 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /** |
| 490 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
| 491 | - * |
|
| 492 | - * @since 1.21.5 |
|
| 493 | - * |
|
| 494 | - * @see GFAddOn::scripts() |
|
| 495 | - * |
|
| 490 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
| 491 | + * |
|
| 492 | + * @since 1.21.5 |
|
| 493 | + * |
|
| 494 | + * @see GFAddOn::scripts() |
|
| 495 | + * |
|
| 496 | 496 | * @return array Array of scripts |
| 497 | 497 | */ |
| 498 | 498 | public function scripts() { |
@@ -501,10 +501,10 @@ discard block |
||
| 501 | 501 | $scripts[] = array( |
| 502 | 502 | 'handle' => 'gform_tooltip_init', |
| 503 | 503 | 'enqueue' => array( |
| 504 | - array( |
|
| 505 | - 'admin_page' => array( 'app_settings' ) |
|
| 506 | - ) |
|
| 507 | - ) |
|
| 504 | + array( |
|
| 505 | + 'admin_page' => array( 'app_settings' ) |
|
| 506 | + ) |
|
| 507 | + ) |
|
| 508 | 508 | ); |
| 509 | 509 | |
| 510 | 510 | return $scripts; |
@@ -523,10 +523,10 @@ discard block |
||
| 523 | 523 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 524 | 524 | 'version' => GravityView_Plugin::version, |
| 525 | 525 | "deps" => array( |
| 526 | - 'gform_admin', |
|
| 526 | + 'gform_admin', |
|
| 527 | 527 | 'gaddon_form_settings_css', |
| 528 | - 'gform_tooltip', |
|
| 529 | - 'gform_font_awesome', |
|
| 528 | + 'gform_tooltip', |
|
| 529 | + 'gform_font_awesome', |
|
| 530 | 530 | ), |
| 531 | 531 | 'enqueue' => array( |
| 532 | 532 | array( 'admin_page' => array( |
@@ -592,12 +592,12 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | public function app_settings_tab() { |
| 595 | - parent::app_settings_tab(); |
|
| 595 | + parent::app_settings_tab(); |
|
| 596 | 596 | |
| 597 | 597 | if ( $this->maybe_uninstall() ) { |
| 598 | - echo $this->uninstall_form(); |
|
| 598 | + echo $this->uninstall_form(); |
|
| 599 | 599 | } |
| 600 | - } |
|
| 600 | + } |
|
| 601 | 601 | |
| 602 | 602 | /** |
| 603 | 603 | * Make protected public |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | */ |
| 634 | 634 | public function get_app_settings() { |
| 635 | 635 | |
| 636 | - $settings = get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', $this->get_default_settings() ); |
|
| 636 | + $settings = get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', $this->get_default_settings() ); |
|
| 637 | 637 | |
| 638 | 638 | if( defined( 'GRAVITYVIEW_LICENSE_KEY' ) ) { |
| 639 | 639 | $settings['license_key'] = GRAVITYVIEW_LICENSE_KEY; |
@@ -674,9 +674,9 @@ discard block |
||
| 674 | 674 | */ |
| 675 | 675 | protected function settings_edd_license( $field, $echo = true ) { |
| 676 | 676 | |
| 677 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
| 678 | - $field['input_type'] = 'password'; |
|
| 679 | - } |
|
| 677 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
| 678 | + $field['input_type'] = 'password'; |
|
| 679 | + } |
|
| 680 | 680 | |
| 681 | 681 | $text = $this->settings_text( $field, false ); |
| 682 | 682 | |
@@ -731,8 +731,8 @@ discard block |
||
| 731 | 731 | type="' . $field['type'] . '" |
| 732 | 732 | name="' . esc_attr( $name ) . '" |
| 733 | 733 | value="' . $value . '" ' . |
| 734 | - implode( ' ', $attributes ) . |
|
| 735 | - ' />'; |
|
| 734 | + implode( ' ', $attributes ) . |
|
| 735 | + ' />'; |
|
| 736 | 736 | |
| 737 | 737 | if ( $echo ) { |
| 738 | 738 | echo $html; |
@@ -773,19 +773,19 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | |
| 775 | 775 | /** |
| 776 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
| 777 | - * |
|
| 778 | - * Converts `$field['description']` to `$field['gv_description']` |
|
| 779 | - * Converts `$field['subtitle']` to `$field['description']` |
|
| 780 | - * |
|
| 781 | - * @see GravityView_Settings::single_setting_label Converts `gv_description` back to `description` |
|
| 782 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
| 783 | - * |
|
| 784 | - * @since 1.21.5.2 |
|
| 785 | - * |
|
| 776 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
| 777 | + * |
|
| 778 | + * Converts `$field['description']` to `$field['gv_description']` |
|
| 779 | + * Converts `$field['subtitle']` to `$field['description']` |
|
| 780 | + * |
|
| 781 | + * @see GravityView_Settings::single_setting_label Converts `gv_description` back to `description` |
|
| 782 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
| 783 | + * |
|
| 784 | + * @since 1.21.5.2 |
|
| 785 | + * |
|
| 786 | 786 | * @param array $field |
| 787 | - * |
|
| 788 | - * @return void |
|
| 787 | + * |
|
| 788 | + * @return void |
|
| 789 | 789 | */ |
| 790 | 790 | public function single_setting_row( $field ) { |
| 791 | 791 | |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | array( |
| 981 | 981 | 'label' => _x('Show me beta versions if they are available.', 'gravityview'), |
| 982 | 982 | 'value' => '1', |
| 983 | - 'name' => 'beta', |
|
| 983 | + 'name' => 'beta', |
|
| 984 | 984 | ), |
| 985 | 985 | ), |
| 986 | 986 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview'), |
@@ -1005,39 +1005,39 @@ discard block |
||
| 1005 | 1005 | |
| 1006 | 1006 | if( empty( $field['disabled'] ) ) { |
| 1007 | 1007 | unset( $field['disabled'] ); |
| 1008 | - } |
|
| 1008 | + } |
|
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | - $sections = array( |
|
| 1012 | - array( |
|
| 1013 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 1014 | - 'fields' => $fields, |
|
| 1015 | - ) |
|
| 1016 | - ); |
|
| 1011 | + $sections = array( |
|
| 1012 | + array( |
|
| 1013 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 1014 | + 'fields' => $fields, |
|
| 1015 | + ) |
|
| 1016 | + ); |
|
| 1017 | 1017 | |
| 1018 | - // custom 'update settings' button |
|
| 1019 | - $button = array( |
|
| 1020 | - 'class' => 'button button-primary button-hero', |
|
| 1021 | - 'type' => 'save', |
|
| 1022 | - ); |
|
| 1018 | + // custom 'update settings' button |
|
| 1019 | + $button = array( |
|
| 1020 | + 'class' => 'button button-primary button-hero', |
|
| 1021 | + 'type' => 'save', |
|
| 1022 | + ); |
|
| 1023 | 1023 | |
| 1024 | 1024 | if( $disabled_attribute ) { |
| 1025 | 1025 | $button['disabled'] = $disabled_attribute; |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | |
| 1029 | - /** |
|
| 1030 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
| 1031 | - * Extensions can tap in here to insert their own section and settings. |
|
| 1032 | - * <code> |
|
| 1033 | - * $sections[] = array( |
|
| 1034 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
| 1035 | - * 'fields' => $settings, |
|
| 1036 | - * ); |
|
| 1037 | - * </code> |
|
| 1038 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
| 1039 | - */ |
|
| 1040 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
| 1029 | + /** |
|
| 1030 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
| 1031 | + * Extensions can tap in here to insert their own section and settings. |
|
| 1032 | + * <code> |
|
| 1033 | + * $sections[] = array( |
|
| 1034 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
| 1035 | + * 'fields' => $settings, |
|
| 1036 | + * ); |
|
| 1037 | + * </code> |
|
| 1038 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
| 1039 | + */ |
|
| 1040 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
| 1041 | 1041 | |
| 1042 | 1042 | // If there are extensions, add a section for them |
| 1043 | 1043 | if ( ! empty( $extension_sections ) ) { |
@@ -1050,13 +1050,13 @@ discard block |
||
| 1050 | 1050 | } |
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | - $k = count( $extension_sections ) - 1 ; |
|
| 1054 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 1053 | + $k = count( $extension_sections ) - 1 ; |
|
| 1054 | + $extension_sections[ $k ]['fields'][] = $button; |
|
| 1055 | 1055 | $sections = array_merge( $sections, $extension_sections ); |
| 1056 | 1056 | } else { |
| 1057 | - // add the 'update settings' button to the general section |
|
| 1058 | - $sections[0]['fields'][] = $button; |
|
| 1059 | - } |
|
| 1057 | + // add the 'update settings' button to the general section |
|
| 1058 | + $sections[0]['fields'][] = $button; |
|
| 1059 | + } |
|
| 1060 | 1060 | |
| 1061 | 1061 | return $sections; |
| 1062 | 1062 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if( ! class_exists('GFAddOn') ) { |
|
| 3 | +if ( ! class_exists( 'GFAddOn' ) ) { |
|
| 4 | 4 | return; |
| 5 | 5 | } |
| 6 | 6 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function __construct( $prevent_multiple_instances = '' ) { |
| 77 | 77 | |
| 78 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
| 78 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
| 79 | 79 | return parent::__construct(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public static function get_instance() { |
| 89 | 89 | |
| 90 | - if( empty( self::$instance ) ) { |
|
| 90 | + if ( empty( self::$instance ) ) { |
|
| 91 | 91 | self::$instance = new self( 'get_instance' ); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function current_user_can_any( $caps ) { |
| 108 | 108 | |
| 109 | - if( empty( $caps ) ) { |
|
| 109 | + if ( empty( $caps ) ) { |
|
| 110 | 110 | $caps = array( 'gravityview_full_access' ); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | ), |
| 168 | 168 | 'found-other' => array( |
| 169 | 169 | 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
| 170 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 170 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
| 171 | 171 | ), |
| 172 | 172 | 'other' => array( |
| 173 | 173 | 'label' => esc_html__( 'Other', 'gravityview' ), |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | }); |
| 255 | 255 | |
| 256 | 256 | function gv_feedback_append_error_message() { |
| 257 | - $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __('There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
| 257 | + $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __( 'There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
| 258 | 258 | } |
| 259 | 259 | }); |
| 260 | 260 | </script> |
@@ -271,15 +271,15 @@ discard block |
||
| 271 | 271 | </ul> |
| 272 | 272 | <div class="gv-followup widefat"> |
| 273 | 273 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
| 274 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
| 274 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
| 275 | 275 | </div> |
| 276 | 276 | <div class="scale-description"> |
| 277 | - <p><strong><?php esc_html_e('How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
| 277 | + <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
| 278 | 278 | <ul class="inline"> |
| 279 | 279 | <?php |
| 280 | 280 | $i = 0; |
| 281 | - while( $i < 11 ) { |
|
| 282 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
| 281 | + while ( $i < 11 ) { |
|
| 282 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
| 283 | 283 | $i++; |
| 284 | 284 | } |
| 285 | 285 | ?> |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | </div> |
| 289 | 289 | |
| 290 | 290 | <div class="gv-form-field-wrapper"> |
| 291 | - <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e('Please follow up with me about my feedback', 'gravityview'); ?></label> |
|
| 291 | + <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e( 'Please follow up with me about my feedback', 'gravityview' ); ?></label> |
|
| 292 | 292 | </div> |
| 293 | 293 | |
| 294 | 294 | <div class="submit"> |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | <div id="gv-uninstall-thanks" class="notice notice-large notice-updated below-h2" style="display:none;"> |
| 303 | 303 | <h3 class="notice-title"><?php esc_html_e( 'Thank you for using GravityView!', 'gravityview' ); ?></h3> |
| 304 | 304 | <p><?php echo gravityview_get_floaty(); ?> |
| 305 | - <?php echo make_clickable( esc_html__('Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
| 305 | + <?php echo make_clickable( esc_html__( 'Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
| 306 | 306 | </p> |
| 307 | 307 | <div class="wp-clearfix"></div> |
| 308 | 308 | </div> |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
| 377 | 377 | |
| 378 | 378 | /** @since 1.7.6 */ |
| 379 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
| 379 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
| 380 | 380 | |
| 381 | 381 | parent::init_admin(); |
| 382 | 382 | } |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | public function modify_app_settings_menu_title( $setting_tabs ) { |
| 392 | 392 | |
| 393 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
| 393 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
| 394 | 394 | |
| 395 | 395 | return $setting_tabs; |
| 396 | 396 | } |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | private function _load_license_handler() { |
| 409 | 409 | |
| 410 | - if( !empty( $this->License_Handler ) ) { |
|
| 410 | + if ( ! empty( $this->License_Handler ) ) { |
|
| 411 | 411 | return; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
| 414 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
| 415 | 415 | |
| 416 | 416 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
| 417 | 417 | } |
@@ -422,21 +422,21 @@ discard block |
||
| 422 | 422 | */ |
| 423 | 423 | function license_key_notice() { |
| 424 | 424 | |
| 425 | - $license_status = self::getSetting('license_key_status'); |
|
| 426 | - $license_key = self::getSetting('license_key'); |
|
| 427 | - if( '' === $license_key ) { |
|
| 425 | + $license_status = self::getSetting( 'license_key_status' ); |
|
| 426 | + $license_key = self::getSetting( 'license_key' ); |
|
| 427 | + if ( '' === $license_key ) { |
|
| 428 | 428 | $license_status = 'inactive'; |
| 429 | 429 | } |
| 430 | 430 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
| 431 | 431 | |
| 432 | - $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
|
| 432 | + $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
| 433 | 433 | |
| 434 | 434 | /** |
| 435 | 435 | * I wanted to remove the period from after the buttons in the string, |
| 436 | 436 | * but didn't want to mess up the translation strings for the translators. |
| 437 | 437 | */ |
| 438 | 438 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
| 439 | - $title = __('Inactive License', 'gravityview'); |
|
| 439 | + $title = __( 'Inactive License', 'gravityview' ); |
|
| 440 | 440 | $status = ''; |
| 441 | 441 | $update_below = false; |
| 442 | 442 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
@@ -444,17 +444,17 @@ discard block |
||
| 444 | 444 | switch ( $license_status ) { |
| 445 | 445 | /** @since 1.17 */ |
| 446 | 446 | case 'expired': |
| 447 | - $title = __('Expired License', 'gravityview'); |
|
| 447 | + $title = __( 'Expired License', 'gravityview' ); |
|
| 448 | 448 | $status = 'expired'; |
| 449 | - $message = $this->get_license_handler()->strings( 'expired', self::getSetting('license_key_response') ); |
|
| 449 | + $message = $this->get_license_handler()->strings( 'expired', self::getSetting( 'license_key_response' ) ); |
|
| 450 | 450 | break; |
| 451 | 451 | case 'invalid': |
| 452 | - $title = __('Invalid License', 'gravityview'); |
|
| 453 | - $status = __('is invalid', 'gravityview'); |
|
| 452 | + $title = __( 'Invalid License', 'gravityview' ); |
|
| 453 | + $status = __( 'is invalid', 'gravityview' ); |
|
| 454 | 454 | break; |
| 455 | 455 | case 'deactivated': |
| 456 | - $status = __('is inactive', 'gravityview'); |
|
| 457 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
| 456 | + $status = __( 'is inactive', 'gravityview' ); |
|
| 457 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
| 458 | 458 | break; |
| 459 | 459 | /** @noinspection PhpMissingBreakStatementInspection */ |
| 460 | 460 | case '': |
@@ -462,20 +462,20 @@ discard block |
||
| 462 | 462 | // break intentionally left blank |
| 463 | 463 | case 'inactive': |
| 464 | 464 | case 'site_inactive': |
| 465 | - $status = __('has not been activated', 'gravityview'); |
|
| 466 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
| 465 | + $status = __( 'has not been activated', 'gravityview' ); |
|
| 466 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
| 467 | 467 | break; |
| 468 | 468 | } |
| 469 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
| 469 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
| 470 | 470 | |
| 471 | 471 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
| 472 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
| 472 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
| 473 | 473 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
| 474 | 474 | } else { |
| 475 | 475 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . esc_url( $primary_button_link ) . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - if( !empty( $status ) ) { |
|
| 478 | + if ( ! empty( $status ) ) { |
|
| 479 | 479 | GravityView_Admin_Notices::add_notice( array( |
| 480 | 480 | 'message' => $message, |
| 481 | 481 | 'class' => 'updated', |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | public function scripts() { |
| 499 | 499 | $scripts = parent::scripts(); |
| 500 | 500 | |
| 501 | - $scripts[] = array( |
|
| 501 | + $scripts[ ] = array( |
|
| 502 | 502 | 'handle' => 'gform_tooltip_init', |
| 503 | 503 | 'enqueue' => array( |
| 504 | 504 | array( |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | $styles = parent::styles(); |
| 520 | 520 | |
| 521 | - $styles[] = array( |
|
| 521 | + $styles[ ] = array( |
|
| 522 | 522 | 'handle' => 'gravityview_settings', |
| 523 | 523 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 524 | 524 | 'version' => GravityView_Plugin::version, |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | * @return void |
| 545 | 545 | */ |
| 546 | 546 | public function add_network_menu() { |
| 547 | - if( GravityView_Plugin::is_network_activated() ) { |
|
| 547 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
| 548 | 548 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
| 549 | 549 | } |
| 550 | 550 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | * If multisite and not network admin, we don't want the settings to show. |
| 562 | 562 | * @since 1.7.6 |
| 563 | 563 | */ |
| 564 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
| 564 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
| 565 | 565 | |
| 566 | 566 | /** |
| 567 | 567 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | */ |
| 571 | 571 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
| 572 | 572 | |
| 573 | - if( $show_submenu ) { |
|
| 573 | + if ( $show_submenu ) { |
|
| 574 | 574 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
| 575 | 575 | } |
| 576 | 576 | } |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | /** |
| 610 | 610 | * Backward compatibility with Redux |
| 611 | 611 | */ |
| 612 | - if( $setting_name === 'license' ) { |
|
| 612 | + if ( $setting_name === 'license' ) { |
|
| 613 | 613 | return array( |
| 614 | 614 | 'license' => parent::get_app_setting( 'license_key' ), |
| 615 | 615 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -635,8 +635,8 @@ discard block |
||
| 635 | 635 | |
| 636 | 636 | $settings = get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', $this->get_default_settings() ); |
| 637 | 637 | |
| 638 | - if( defined( 'GRAVITYVIEW_LICENSE_KEY' ) ) { |
|
| 639 | - $settings['license_key'] = GRAVITYVIEW_LICENSE_KEY; |
|
| 638 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) ) { |
|
| 639 | + $settings[ 'license_key' ] = GRAVITYVIEW_LICENSE_KEY; |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | return $settings; |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | protected function settings_edd_license( $field, $echo = true ) { |
| 676 | 676 | |
| 677 | 677 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
| 678 | - $field['input_type'] = 'password'; |
|
| 678 | + $field[ 'input_type' ] = 'password'; |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | $text = $this->settings_text( $field, false ); |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | |
| 685 | 685 | $return = $text . $activation; |
| 686 | 686 | |
| 687 | - if( $echo ) { |
|
| 687 | + if ( $echo ) { |
|
| 688 | 688 | echo $return; |
| 689 | 689 | } |
| 690 | 690 | |
@@ -711,15 +711,15 @@ discard block |
||
| 711 | 711 | */ |
| 712 | 712 | public function settings_submit( $field, $echo = true ) { |
| 713 | 713 | |
| 714 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
| 714 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
| 715 | 715 | |
| 716 | 716 | $attributes = $this->get_field_attributes( $field ); |
| 717 | 717 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
| 718 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
| 718 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
| 719 | 719 | |
| 720 | 720 | |
| 721 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
| 722 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
| 721 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
| 722 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
| 723 | 723 | |
| 724 | 724 | if ( empty( $value ) ) { |
| 725 | 725 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | $attributes = $this->get_field_attributes( $field ); |
| 729 | 729 | |
| 730 | 730 | $html = '<input |
| 731 | - type="' . $field['type'] . '" |
|
| 731 | + type="' . $field[ 'type' ] . '" |
|
| 732 | 732 | name="' . esc_attr( $name ) . '" |
| 733 | 733 | value="' . $value . '" ' . |
| 734 | 734 | implode( ' ', $attributes ) . |
@@ -750,12 +750,12 @@ discard block |
||
| 750 | 750 | * @return string |
| 751 | 751 | */ |
| 752 | 752 | public function settings_save( $field, $echo = true ) { |
| 753 | - $field['type'] = 'submit'; |
|
| 754 | - $field['name'] = 'gform-settings-save'; |
|
| 755 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
| 753 | + $field[ 'type' ] = 'submit'; |
|
| 754 | + $field[ 'name' ] = 'gform-settings-save'; |
|
| 755 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
| 756 | 756 | |
| 757 | 757 | if ( ! rgar( $field, 'value' ) ) { |
| 758 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
| 758 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | $output = $this->settings_submit( $field, false ); |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | $this->app_settings_uninstall_tab(); |
| 765 | 765 | $output .= ob_get_clean(); |
| 766 | 766 | |
| 767 | - if( $echo ) { |
|
| 767 | + if ( $echo ) { |
|
| 768 | 768 | echo $output; |
| 769 | 769 | } |
| 770 | 770 | |
@@ -789,8 +789,8 @@ discard block |
||
| 789 | 789 | */ |
| 790 | 790 | public function single_setting_row( $field ) { |
| 791 | 791 | |
| 792 | - $field['gv_description'] = rgar( $field, 'description' ); |
|
| 793 | - $field['description'] = rgar( $field, 'subtitle' ); |
|
| 792 | + $field[ 'gv_description' ] = rgar( $field, 'description' ); |
|
| 793 | + $field[ 'description' ] = rgar( $field, 'subtitle' ); |
|
| 794 | 794 | |
| 795 | 795 | parent::single_setting_row( $field ); |
| 796 | 796 | } |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | parent::single_setting_label( $field ); |
| 806 | 806 | |
| 807 | 807 | if ( $description = rgar( $field, 'gv_description' ) ) { |
| 808 | - echo '<span class="description">'. $description .'</span>'; |
|
| 808 | + echo '<span class="description">' . $description . '</span>'; |
|
| 809 | 809 | } |
| 810 | 810 | } |
| 811 | 811 | |
@@ -867,11 +867,11 @@ discard block |
||
| 867 | 867 | |
| 868 | 868 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
| 869 | 869 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
| 870 | - if( $local_key !== $response_key ) { |
|
| 870 | + if ( $local_key !== $response_key ) { |
|
| 871 | 871 | |
| 872 | - unset( $posted_settings['license_key_response'] ); |
|
| 873 | - unset( $posted_settings['license_key_status'] ); |
|
| 874 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 872 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
| 873 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
| 874 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | return $posted_settings; |
@@ -906,26 +906,26 @@ discard block |
||
| 906 | 906 | 'label' => __( 'License Key', 'gravityview' ), |
| 907 | 907 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
| 908 | 908 | 'type' => 'edd_license', |
| 909 | - 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
| 910 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
| 911 | - 'default_value' => $default_settings['license_key'], |
|
| 909 | + 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
| 910 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
| 911 | + 'default_value' => $default_settings[ 'license_key' ], |
|
| 912 | 912 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
| 913 | 913 | ), |
| 914 | 914 | array( |
| 915 | 915 | 'name' => 'license_key_response', |
| 916 | - 'default_value' => $default_settings['license_key_response'], |
|
| 916 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
| 917 | 917 | 'type' => 'hidden', |
| 918 | 918 | ), |
| 919 | 919 | array( |
| 920 | 920 | 'name' => 'license_key_status', |
| 921 | - 'default_value' => $default_settings['license_key_status'], |
|
| 921 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
| 922 | 922 | 'type' => 'hidden', |
| 923 | 923 | ), |
| 924 | 924 | array( |
| 925 | 925 | 'name' => 'support-email', |
| 926 | 926 | 'type' => 'text', |
| 927 | 927 | 'validate' => 'email', |
| 928 | - 'default_value' => $default_settings['support-email'], |
|
| 928 | + 'default_value' => $default_settings[ 'support-email' ], |
|
| 929 | 929 | 'label' => __( 'Support Email', 'gravityview' ), |
| 930 | 930 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
| 931 | 931 | 'class' => 'code regular-text', |
@@ -937,53 +937,53 @@ discard block |
||
| 937 | 937 | 'name' => 'support_port', |
| 938 | 938 | 'type' => 'radio', |
| 939 | 939 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
| 940 | - 'default_value' => $default_settings['support_port'], |
|
| 940 | + 'default_value' => $default_settings[ 'support_port' ], |
|
| 941 | 941 | 'horizontal' => 1, |
| 942 | 942 | 'choices' => array( |
| 943 | 943 | array( |
| 944 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
| 944 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
| 945 | 945 | 'value' => '1', |
| 946 | 946 | ), |
| 947 | 947 | array( |
| 948 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
| 948 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
| 949 | 949 | 'value' => '0', |
| 950 | 950 | ), |
| 951 | 951 | ), |
| 952 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
| 952 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
| 953 | 953 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
| 954 | 954 | ), |
| 955 | 955 | array( |
| 956 | 956 | 'name' => 'no-conflict-mode', |
| 957 | 957 | 'type' => 'radio', |
| 958 | 958 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
| 959 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
| 959 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
| 960 | 960 | 'horizontal' => 1, |
| 961 | 961 | 'choices' => array( |
| 962 | 962 | array( |
| 963 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
| 963 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
| 964 | 964 | 'value' => '1', |
| 965 | 965 | ), |
| 966 | 966 | array( |
| 967 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
| 967 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
| 968 | 968 | 'value' => '0', |
| 969 | 969 | ), |
| 970 | 970 | ), |
| 971 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
| 971 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
| 972 | 972 | ), |
| 973 | 973 | array( |
| 974 | 974 | 'name' => 'beta', |
| 975 | 975 | 'type' => 'checkbox', |
| 976 | 976 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
| 977 | - 'default_value' => $default_settings['beta'], |
|
| 977 | + 'default_value' => $default_settings[ 'beta' ], |
|
| 978 | 978 | 'horizontal' => 1, |
| 979 | 979 | 'choices' => array( |
| 980 | 980 | array( |
| 981 | - 'label' => _x('Show me beta versions if they are available.', 'gravityview'), |
|
| 981 | + 'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ), |
|
| 982 | 982 | 'value' => '1', |
| 983 | 983 | 'name' => 'beta', |
| 984 | 984 | ), |
| 985 | 985 | ), |
| 986 | - 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview'), |
|
| 986 | + 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview' ), |
|
| 987 | 987 | ), |
| 988 | 988 | ) ); |
| 989 | 989 | |
@@ -994,23 +994,23 @@ discard block |
||
| 994 | 994 | * @since 1.7.4 |
| 995 | 995 | */ |
| 996 | 996 | foreach ( $fields as &$field ) { |
| 997 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
| 998 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
| 999 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
| 1000 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
| 997 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
| 998 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
| 999 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
| 1000 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
| 1001 | 1001 | |
| 1002 | - if( $disabled_attribute ) { |
|
| 1003 | - $field['disabled'] = $disabled_attribute; |
|
| 1002 | + if ( $disabled_attribute ) { |
|
| 1003 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | - if( empty( $field['disabled'] ) ) { |
|
| 1007 | - unset( $field['disabled'] ); |
|
| 1006 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
| 1007 | + unset( $field[ 'disabled' ] ); |
|
| 1008 | 1008 | } |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | $sections = array( |
| 1012 | 1012 | array( |
| 1013 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 1013 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
| 1014 | 1014 | 'fields' => $fields, |
| 1015 | 1015 | ) |
| 1016 | 1016 | ); |
@@ -1021,8 +1021,8 @@ discard block |
||
| 1021 | 1021 | 'type' => 'save', |
| 1022 | 1022 | ); |
| 1023 | 1023 | |
| 1024 | - if( $disabled_attribute ) { |
|
| 1025 | - $button['disabled'] = $disabled_attribute; |
|
| 1024 | + if ( $disabled_attribute ) { |
|
| 1025 | + $button[ 'disabled' ] = $disabled_attribute; |
|
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | |
@@ -1042,20 +1042,20 @@ discard block |
||
| 1042 | 1042 | // If there are extensions, add a section for them |
| 1043 | 1043 | if ( ! empty( $extension_sections ) ) { |
| 1044 | 1044 | |
| 1045 | - if( $disabled_attribute ) { |
|
| 1045 | + if ( $disabled_attribute ) { |
|
| 1046 | 1046 | foreach ( $extension_sections as &$section ) { |
| 1047 | - foreach ( $section['fields'] as &$field ) { |
|
| 1048 | - $field['disabled'] = $disabled_attribute; |
|
| 1047 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
| 1048 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 1049 | 1049 | } |
| 1050 | 1050 | } |
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | - $k = count( $extension_sections ) - 1 ; |
|
| 1054 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 1053 | + $k = count( $extension_sections ) - 1; |
|
| 1054 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
| 1055 | 1055 | $sections = array_merge( $sections, $extension_sections ); |
| 1056 | 1056 | } else { |
| 1057 | 1057 | // add the 'update settings' button to the general section |
| 1058 | - $sections[0]['fields'][] = $button; |
|
| 1058 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | return $sections; |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 24 | 24 | |
| 25 | - unset( $field_options['show_as_link'] ); |
|
| 25 | + unset( $field_options[ 'show_as_link' ] ); |
|
| 26 | 26 | |
| 27 | - if( 'edit' === $context ) { |
|
| 27 | + if ( 'edit' === $context ) { |
|
| 28 | 28 | return $field_options; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 31 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 32 | 32 | |
| 33 | 33 | return $field_options; |
| 34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field ) { |
| 46 | 46 | |
| 47 | - $id = (int) $field->id; |
|
| 47 | + $id = (int)$field->id; |
|
| 48 | 48 | $input_name = "input_{$id}"; |
| 49 | 49 | $class = esc_attr( $field->size ); |
| 50 | 50 | $tabindex = $field->get_tabindex(); |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @return GravityView_Field | bool |
| 43 | 43 | */ |
| 44 | 44 | public static function create( $properties ) { |
| 45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
| 46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
| 45 | + $type = isset( $properties[ 'type' ] ) ? $properties[ 'type' ] : ''; |
|
| 46 | + $type = empty( $properties[ 'inputType' ] ) ? $type : $properties[ 'inputType' ]; |
|
| 47 | 47 | if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
| 48 | 48 | return new GravityView_Field( $properties ); |
| 49 | 49 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return bool True: yes, it exists; False: nope |
| 63 | 63 | */ |
| 64 | 64 | public static function exists( $field_name ) { |
| 65 | - return isset( self::$_fields["{$field_name}"] ); |
|
| 65 | + return isset( self::$_fields[ "{$field_name}" ] ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $field_type = is_a( $gf_field, 'GF_Field' ) ? get_class( $gf_field ) : $gf_field; |
| 98 | 98 | |
| 99 | - foreach( self::$_fields as $field ) { |
|
| 100 | - if( $field_type === $field->_gf_field_class_name ) { |
|
| 99 | + foreach ( self::$_fields as $field ) { |
|
| 100 | + if ( $field_type === $field->_gf_field_class_name ) { |
|
| 101 | 101 | return $field; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public static function get_all( $group = '' ) { |
| 118 | 118 | |
| 119 | - if( '' !== $group ) { |
|
| 119 | + if ( '' !== $group ) { |
|
| 120 | 120 | $return_fields = self::$_fields; |
| 121 | 121 | foreach ( $return_fields as $key => $field ) { |
| 122 | - if( $group !== $field->group ) { |
|
| 122 | + if ( $group !== $field->group ) { |
|
| 123 | 123 | unset( $return_fields[ $key ] ); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | /** |
| 78 | 78 | * Alias for get_instance() |
| 79 | 79 | * |
| 80 | - * @param $field_name |
|
| 80 | + * @param string $field_name |
|
| 81 | 81 | * |
| 82 | 82 | * @return GravityView_Field|false |
| 83 | 83 | */ |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 25 | 25 | |
| 26 | - if( 'edit' === $context ) { |
|
| 26 | + if ( 'edit' === $context ) { |
|
| 27 | 27 | return $field_options; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $this->add_field_support('date_display', $field_options ); |
|
| 30 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 31 | 31 | |
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $field_input_id = gravityview_get_input_id_from_id( $field_id ); |
| 52 | 52 | |
| 53 | 53 | $date_field_output = ''; |
| 54 | - switch( $field_input_id ) { |
|
| 54 | + switch ( $field_input_id ) { |
|
| 55 | 55 | case 1: |
| 56 | 56 | $date_field_output = rgar( $parsed_date, 'day' ); |
| 57 | 57 | break; |
@@ -40,7 +40,6 @@ |
||
| 40 | 40 | * Get the default date format for a field based on the field ID and the time format setting |
| 41 | 41 | * |
| 42 | 42 | * @since 1.16.4 |
| 43 | - |
|
| 44 | 43 | * @param string $date_format The Gravity Forms date format for the field. Default: "mdy" |
| 45 | 44 | * @param int $field_id The ID of the field. Used to figure out full date/day/month/year |
| 46 | 45 | * |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 20 | 20 | |
| 21 | - if( 'edit' === $context ) { |
|
| 21 | + if ( 'edit' === $context ) { |
|
| 22 | 22 | return $field_options; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'quiz_show_explanation' => array( |
| 27 | 27 | 'type' => 'checkbox', |
| 28 | 28 | 'label' => __( 'Show Answer Explanation?', 'gravityview' ), |
| 29 | - 'desc' => __('If the field has an answer explanation, show it?', 'gravityview'), |
|
| 29 | + 'desc' => __( 'If the field has an answer explanation, show it?', 'gravityview' ), |
|
| 30 | 30 | 'value' => false, |
| 31 | 31 | 'merge_tags' => false, |
| 32 | 32 | ), |
@@ -40,11 +40,11 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $field_options['link_phone'] = array( |
| 43 | - 'type' => 'checkbox', |
|
| 44 | - 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
| 45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 46 | - 'value' => true, |
|
| 47 | - ); |
|
| 43 | + 'type' => 'checkbox', |
|
| 44 | + 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
| 45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 46 | + 'value' => true, |
|
| 47 | + ); |
|
| 48 | 48 | |
| 49 | 49 | return $field_options; |
| 50 | 50 | } |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 37 | 37 | |
| 38 | - if( 'edit' === $context ) { |
|
| 38 | + if ( 'edit' === $context ) { |
|
| 39 | 39 | return $field_options; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $field_options['link_phone'] = array( |
|
| 42 | + $field_options[ 'link_phone' ] = array( |
|
| 43 | 43 | 'type' => 'checkbox', |
| 44 | 44 | 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
| 45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview' ), |
|
| 46 | 46 | 'value' => true, |
| 47 | 47 | ); |
| 48 | 48 | |
@@ -220,6 +220,9 @@ |
||
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | + /** |
|
| 224 | + * @param string $key |
|
| 225 | + */ |
|
| 223 | 226 | public function getCurrentFieldSetting( $key ) { |
| 224 | 227 | $settings = $this->getCurrentField('field_settings'); |
| 225 | 228 | |
@@ -329,34 +329,34 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | - * Get the fields for a specific context |
|
| 333 | - * |
|
| 334 | - * @since 1.19.2 |
|
| 335 | - * |
|
| 332 | + * Get the fields for a specific context |
|
| 333 | + * |
|
| 334 | + * @since 1.19.2 |
|
| 335 | + * |
|
| 336 | 336 | * @param string $context [Optional] "directory", "single", or "edit" |
| 337 | 337 | * |
| 338 | 338 | * @return array Array of GravityView field layout configurations |
| 339 | 339 | */ |
| 340 | 340 | public function getContextFields( $context = '' ) { |
| 341 | 341 | |
| 342 | - if( '' === $context ) { |
|
| 343 | - $context = $this->getContext(); |
|
| 344 | - } |
|
| 342 | + if( '' === $context ) { |
|
| 343 | + $context = $this->getContext(); |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | 346 | $fields = $this->getFields(); |
| 347 | 347 | |
| 348 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 348 | + foreach ( (array) $fields as $key => $context_fields ) { |
|
| 349 | 349 | |
| 350 | - // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 351 | - $matches = explode( '_', $key ); |
|
| 350 | + // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 351 | + $matches = explode( '_', $key ); |
|
| 352 | 352 | |
| 353 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 354 | - return $context_fields; |
|
| 355 | - } |
|
| 356 | - } |
|
| 353 | + if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 354 | + return $context_fields; |
|
| 355 | + } |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | 358 | return array(); |
| 359 | - } |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | 361 | /** |
| 362 | 362 | * @param array $fields |
@@ -449,10 +449,10 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | public function getPaging() { |
| 451 | 451 | |
| 452 | - $default_params = array( |
|
| 453 | - 'offset' => 0, |
|
| 454 | - 'page_size' => 20, |
|
| 455 | - ); |
|
| 452 | + $default_params = array( |
|
| 453 | + 'offset' => 0, |
|
| 454 | + 'page_size' => 20, |
|
| 455 | + ); |
|
| 456 | 456 | |
| 457 | 457 | return wp_parse_args( $this->paging, $default_params ); |
| 458 | 458 | } |
@@ -509,10 +509,10 @@ discard block |
||
| 509 | 509 | public function getSorting() { |
| 510 | 510 | |
| 511 | 511 | $defaults_params = array( |
| 512 | - 'sort_field' => 'date_created', |
|
| 513 | - 'sort_direction' => 'ASC', |
|
| 514 | - 'is_numeric' => false, |
|
| 515 | - ); |
|
| 512 | + 'sort_field' => 'date_created', |
|
| 513 | + 'sort_direction' => 'ASC', |
|
| 514 | + 'is_numeric' => false, |
|
| 515 | + ); |
|
| 516 | 516 | |
| 517 | 517 | return wp_parse_args( $this->sorting, $defaults_params ); |
| 518 | 518 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | die; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
| 19 | +if ( ! class_exists( 'Gamajo_Template_Loader' ) ) { |
|
| 20 | 20 | require( GRAVITYVIEW_DIR . 'includes/lib/class-gamajo-template-loader.php' ); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | 'atts' => NULL, |
| 158 | 158 | ) ); |
| 159 | 159 | |
| 160 | - foreach ($atts as $key => $value) { |
|
| 161 | - if( is_null( $value ) ) { |
|
| 160 | + foreach ( $atts as $key => $value ) { |
|
| 161 | + if ( is_null( $value ) ) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | $this->{$key} = $value; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | static function getInstance( $passed_post = NULL ) { |
| 191 | 191 | |
| 192 | - if( empty( self::$instance ) ) { |
|
| 192 | + if ( empty( self::$instance ) ) { |
|
| 193 | 193 | self::$instance = new self( $passed_post ); |
| 194 | 194 | } |
| 195 | 195 | |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function getCurrentField( $key = NULL ) { |
| 204 | 204 | |
| 205 | - if( !empty( $key ) ) { |
|
| 206 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
| 205 | + if ( ! empty( $key ) ) { |
|
| 206 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
| 207 | 207 | return $this->_current_field[ $key ]; |
| 208 | 208 | } |
| 209 | 209 | return NULL; |
@@ -214,16 +214,16 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | public function setCurrentFieldSetting( $key, $value ) { |
| 216 | 216 | |
| 217 | - if( !empty( $this->_current_field ) ) { |
|
| 218 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
| 217 | + if ( ! empty( $this->_current_field ) ) { |
|
| 218 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function getCurrentFieldSetting( $key ) { |
| 224 | - $settings = $this->getCurrentField('field_settings'); |
|
| 224 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
| 225 | 225 | |
| 226 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
| 226 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
| 227 | 227 | return $settings[ $key ]; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -254,8 +254,8 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function getAtts( $key = NULL ) { |
| 256 | 256 | |
| 257 | - if( !empty( $key ) ) { |
|
| 258 | - if( isset( $this->atts[ $key ] ) ) { |
|
| 257 | + if ( ! empty( $key ) ) { |
|
| 258 | + if ( isset( $this->atts[ $key ] ) ) { |
|
| 259 | 259 | return $this->atts[ $key ]; |
| 260 | 260 | } |
| 261 | 261 | return NULL; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
| 323 | 323 | |
| 324 | - if( $fields && !empty( $key ) ) { |
|
| 324 | + if ( $fields && ! empty( $key ) ) { |
|
| 325 | 325 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
| 326 | 326 | } |
| 327 | 327 | |
@@ -339,18 +339,18 @@ discard block |
||
| 339 | 339 | */ |
| 340 | 340 | public function getContextFields( $context = '' ) { |
| 341 | 341 | |
| 342 | - if( '' === $context ) { |
|
| 342 | + if ( '' === $context ) { |
|
| 343 | 343 | $context = $this->getContext(); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | $fields = $this->getFields(); |
| 347 | 347 | |
| 348 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 348 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
| 349 | 349 | |
| 350 | 350 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
| 351 | 351 | $matches = explode( '_', $key ); |
| 352 | 352 | |
| 353 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 353 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
| 354 | 354 | return $context_fields; |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | public function getField( $key ) { |
| 373 | 373 | |
| 374 | - if( !empty( $key ) ) { |
|
| 375 | - if( isset( $this->fields[ $key ] ) ) { |
|
| 374 | + if ( ! empty( $key ) ) { |
|
| 375 | + if ( isset( $this->fields[ $key ] ) ) { |
|
| 376 | 376 | return $this->fields[ $key ]; |
| 377 | 377 | } |
| 378 | 378 | } |
@@ -478,8 +478,8 @@ discard block |
||
| 478 | 478 | public function getPaginationCounts() { |
| 479 | 479 | |
| 480 | 480 | $paging = $this->getPaging(); |
| 481 | - $offset = $paging['offset']; |
|
| 482 | - $page_size = $paging['page_size']; |
|
| 481 | + $offset = $paging[ 'offset' ]; |
|
| 482 | + $page_size = $paging[ 'page_size' ]; |
|
| 483 | 483 | $total = $this->getTotalEntries(); |
| 484 | 484 | |
| 485 | 485 | if ( empty( $total ) ) { |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | */ |
| 501 | 501 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
| 502 | 502 | |
| 503 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
| 503 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | /** |
@@ -591,16 +591,16 @@ discard block |
||
| 591 | 591 | */ |
| 592 | 592 | public function getCurrentEntry() { |
| 593 | 593 | |
| 594 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
| 594 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
| 595 | 595 | $entries = $this->getEntries(); |
| 596 | - $entry = $entries[0]; |
|
| 596 | + $entry = $entries[ 0 ]; |
|
| 597 | 597 | } else { |
| 598 | 598 | $entry = $this->_current_entry; |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /** @since 1.16 Fixes DataTables empty entry issue */ |
| 602 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
| 603 | - $entry = $this->_current_field['entry']; |
|
| 602 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
| 603 | + $entry = $this->_current_field[ 'entry' ]; |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | return $entry; |
@@ -637,8 +637,8 @@ discard block |
||
| 637 | 637 | */ |
| 638 | 638 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
| 639 | 639 | |
| 640 | - if( empty( $zone ) ) { |
|
| 641 | - do_action('gravityview_log_error', 'GravityView_View[renderZone] No zone defined.'); |
|
| 640 | + if ( empty( $zone ) ) { |
|
| 641 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] No zone defined.' ); |
|
| 642 | 642 | return NULL; |
| 643 | 643 | } |
| 644 | 644 | |
@@ -647,37 +647,37 @@ discard block |
||
| 647 | 647 | 'context' => $this->getContext(), |
| 648 | 648 | 'entry' => $this->getCurrentEntry(), |
| 649 | 649 | 'form' => $this->getForm(), |
| 650 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
| 650 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
| 651 | 651 | ); |
| 652 | 652 | |
| 653 | 653 | $final_atts = wp_parse_args( $atts, $defaults ); |
| 654 | 654 | |
| 655 | 655 | $output = ''; |
| 656 | 656 | |
| 657 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
| 657 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
| 658 | 658 | |
| 659 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
| 659 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
| 660 | 660 | |
| 661 | 661 | // Backward compatibility |
| 662 | - if( 'table' === $this->getTemplatePartSlug() ) { |
|
| 662 | + if ( 'table' === $this->getTemplatePartSlug() ) { |
|
| 663 | 663 | /** |
| 664 | 664 | * @filter `gravityview_table_cells` Modify the fields displayed in a table |
| 665 | 665 | * @param array $fields |
| 666 | 666 | * @param GravityView_View $this |
| 667 | 667 | */ |
| 668 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
| 668 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - if( empty( $fields ) ) { |
|
| 671 | + if ( empty( $fields ) ) { |
|
| 672 | 672 | |
| 673 | - do_action('gravityview_log_error', 'GravityView_View[renderZone] Empty View configuration for this context.', $fields ); |
|
| 673 | + do_action( 'gravityview_log_error', 'GravityView_View[renderZone] Empty View configuration for this context.', $fields ); |
|
| 674 | 674 | |
| 675 | 675 | return NULL; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | $field_output = ''; |
| 679 | 679 | foreach ( $fields as $field ) { |
| 680 | - $final_atts['field'] = $field; |
|
| 680 | + $final_atts[ 'field' ] = $field; |
|
| 681 | 681 | |
| 682 | 682 | $field_output .= gravityview_field_output( $final_atts ); |
| 683 | 683 | } |
@@ -688,21 +688,21 @@ discard block |
||
| 688 | 688 | * @since 1.7.6 |
| 689 | 689 | * @param boolean $hide_empty_zone Default: false |
| 690 | 690 | */ |
| 691 | - if( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
| 691 | + if ( empty( $field_output ) && apply_filters( 'gravityview/render/hide-empty-zone', false ) ) { |
|
| 692 | 692 | return NULL; |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 696 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
| 695 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 696 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | $output .= $field_output; |
| 700 | 700 | |
| 701 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 701 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 702 | 702 | $output .= '</div>'; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - if( $echo ) { |
|
| 705 | + if ( $echo ) { |
|
| 706 | 706 | echo $output; |
| 707 | 707 | } |
| 708 | 708 | |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | */ |
| 721 | 721 | function locate_template( $template_names, $load = false, $require_once = true ) { |
| 722 | 722 | |
| 723 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 723 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 724 | 724 | |
| 725 | 725 | $located = $this->located_templates[ $template_names ]; |
| 726 | 726 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | // Set $load to always false so we handle it here. |
| 730 | 730 | $located = parent::locate_template( $template_names, false, $require_once ); |
| 731 | 731 | |
| 732 | - if( is_string( $template_names ) ) { |
|
| 732 | + if ( is_string( $template_names ) ) { |
|
| 733 | 733 | $this->located_templates[ $template_names ] = $located; |
| 734 | 734 | } |
| 735 | 735 | } |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | * @return mixed|null The stored data. |
| 748 | 748 | */ |
| 749 | 749 | public function __get( $name ) { |
| 750 | - if( isset( $this->{$name} ) ) { |
|
| 750 | + if ( isset( $this->{$name} ) ) { |
|
| 751 | 751 | return $this->{$name}; |
| 752 | 752 | } else { |
| 753 | 753 | return NULL; |
@@ -776,15 +776,15 @@ discard block |
||
| 776 | 776 | $additional = array(); |
| 777 | 777 | |
| 778 | 778 | // form-19-table-body.php |
| 779 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 779 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 780 | 780 | |
| 781 | 781 | // view-3-table-body.php |
| 782 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
| 782 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->getViewId(), $slug, $name ); |
|
| 783 | 783 | |
| 784 | - if( $this->getPostId() ) { |
|
| 784 | + if ( $this->getPostId() ) { |
|
| 785 | 785 | |
| 786 | 786 | // page-19-table-body.php |
| 787 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 787 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | // Combine with existing table-body.php and table.php |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | |
| 807 | 807 | do_action( 'gravityview_log_debug', '[render] Rendering Template File', $template_file ); |
| 808 | 808 | |
| 809 | - if( !empty( $template_file) ) { |
|
| 809 | + if ( ! empty( $template_file ) ) { |
|
| 810 | 810 | |
| 811 | 811 | if ( $require_once ) { |
| 812 | 812 | require_once( $template_file ); |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | */ |
| 824 | 824 | public function render_widget_hooks( $view_id ) { |
| 825 | 825 | |
| 826 | - if( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
| 826 | + if ( empty( $view_id ) || 'single' == gravityview_get_context() ) { |
|
| 827 | 827 | do_action( 'gravityview_log_debug', __METHOD__ . ' - Not rendering widgets; single entry' ); |
| 828 | 828 | return; |
| 829 | 829 | } |
@@ -831,9 +831,9 @@ discard block |
||
| 831 | 831 | $view_data = gravityview_get_current_view_data( $view_id ); |
| 832 | 832 | |
| 833 | 833 | // get View widget configuration |
| 834 | - $widgets = (array)$view_data['widgets']; |
|
| 834 | + $widgets = (array)$view_data[ 'widgets' ]; |
|
| 835 | 835 | |
| 836 | - switch( current_filter() ) { |
|
| 836 | + switch ( current_filter() ) { |
|
| 837 | 837 | default: |
| 838 | 838 | case 'gravityview_before': |
| 839 | 839 | $zone = 'header'; |
@@ -847,9 +847,9 @@ discard block |
||
| 847 | 847 | * Filter widgets not in the current zone |
| 848 | 848 | * @since 1.16 |
| 849 | 849 | */ |
| 850 | - foreach( $widgets as $key => $widget ) { |
|
| 850 | + foreach ( $widgets as $key => $widget ) { |
|
| 851 | 851 | // The widget isn't in the current zone |
| 852 | - if( false === strpos( $key, $zone ) ) { |
|
| 852 | + if ( false === strpos( $key, $zone ) ) { |
|
| 853 | 853 | unset( $widgets[ $key ] ); |
| 854 | 854 | } |
| 855 | 855 | } |
@@ -864,8 +864,8 @@ discard block |
||
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | // Prevent being called twice |
| 867 | - if( did_action( $zone.'_'.$view_id.'_widgets' ) ) { |
|
| 868 | - do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__ , $zone.'_'.$view_id.'_widgets' ) ); |
|
| 867 | + if ( did_action( $zone . '_' . $view_id . '_widgets' ) ) { |
|
| 868 | + do_action( 'gravityview_log_debug', sprintf( '%s - Not rendering %s; already rendered', __METHOD__, $zone . '_' . $view_id . '_widgets' ) ); |
|
| 869 | 869 | return; |
| 870 | 870 | } |
| 871 | 871 | |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | |
| 877 | 877 | $default_css_class = 'gv-grid gv-widgets-' . $zone; |
| 878 | 878 | |
| 879 | - if( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 879 | + if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) { |
|
| 880 | 880 | $default_css_class .= ' gv-widgets-no-results'; |
| 881 | 881 | } |
| 882 | 882 | |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | * @param string $zone Current widget zone, either `header` or `footer` |
| 888 | 888 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
| 889 | 889 | */ |
| 890 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
| 890 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets ); |
|
| 891 | 891 | |
| 892 | 892 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 893 | 893 | |
@@ -895,17 +895,17 @@ discard block |
||
| 895 | 895 | ?> |
| 896 | 896 | <div class="<?php echo $css_class; ?>"> |
| 897 | 897 | <?php |
| 898 | - foreach( $rows as $row ) { |
|
| 899 | - foreach( $row as $col => $areas ) { |
|
| 900 | - $column = ($col == '2-2') ? '1-2 gv-right' : $col.' gv-left'; |
|
| 898 | + foreach ( $rows as $row ) { |
|
| 899 | + foreach ( $row as $col => $areas ) { |
|
| 900 | + $column = ( $col == '2-2' ) ? '1-2 gv-right' : $col . ' gv-left'; |
|
| 901 | 901 | ?> |
| 902 | 902 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 903 | 903 | <?php |
| 904 | - if( !empty( $areas ) ) { |
|
| 905 | - foreach( $areas as $area ) { |
|
| 906 | - if( !empty( $widgets[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 907 | - foreach( $widgets[ $zone .'_'. $area['areaid'] ] as $widget ) { |
|
| 908 | - do_action( "gravityview_render_widget_{$widget['id']}", $widget ); |
|
| 904 | + if ( ! empty( $areas ) ) { |
|
| 905 | + foreach ( $areas as $area ) { |
|
| 906 | + if ( ! empty( $widgets[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 907 | + foreach ( $widgets[ $zone . '_' . $area[ 'areaid' ] ] as $widget ) { |
|
| 908 | + do_action( "gravityview_render_widget_{$widget[ 'id' ]}", $widget ); |
|
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | } |
@@ -921,8 +921,8 @@ discard block |
||
| 921 | 921 | * Prevent widgets from being called twice. |
| 922 | 922 | * Checking for loop_start prevents themes and plugins that pre-process shortcodes from triggering the action before displaying. Like, ahem, the Divi theme and WordPress SEO plugin |
| 923 | 923 | */ |
| 924 | - if( did_action( 'wp_head' ) ) { |
|
| 925 | - do_action( $zone.'_'.$view_id.'_widgets' ); |
|
| 924 | + if ( did_action( 'wp_head' ) ) { |
|
| 925 | + do_action( $zone . '_' . $view_id . '_widgets' ); |
|
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | |