@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function add_network_menu() { |
136 | 136 | |
137 | - if ( ! gravityview()->plugin->is_network_activated() ) { |
|
137 | + if ( ! gravityview()->plugin->is_network_activated() ) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
141 | + add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
145 | - * Uninstall all traces of GravityView |
|
146 | - * |
|
147 | - * Note: method is public because parent method is public |
|
148 | - * |
|
145 | + * Uninstall all traces of GravityView |
|
146 | + * |
|
147 | + * Note: method is public because parent method is public |
|
148 | + * |
|
149 | 149 | * @return bool |
150 | 150 | */ |
151 | 151 | public function uninstall() { |
152 | 152 | gravityview()->plugin->uninstall(); |
153 | 153 | |
154 | 154 | /** |
155 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | - * @see GFAddOn::uninstall_addon |
|
157 | - * @uses deactivate_plugins() |
|
158 | - */ |
|
155 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
156 | + * @see GFAddOn::uninstall_addon |
|
157 | + * @uses deactivate_plugins() |
|
158 | + */ |
|
159 | 159 | $this->_path = GRAVITYVIEW_FILE; |
160 | 160 | |
161 | 161 | return true; |
@@ -185,42 +185,42 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
188 | - * Get an array of reasons why the plugin might be uninstalled |
|
189 | - * |
|
190 | - * @since 1.17.5 |
|
191 | - * |
|
188 | + * Get an array of reasons why the plugin might be uninstalled |
|
189 | + * |
|
190 | + * @since 1.17.5 |
|
191 | + * |
|
192 | 192 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
193 | 193 | */ |
194 | 194 | private function get_uninstall_reasons() { |
195 | 195 | $reasons = array( |
196 | 196 | 'will-continue' => array( |
197 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | - ), |
|
197 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
198 | + ), |
|
199 | 199 | 'no-longer-need' => array( |
200 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | - ), |
|
200 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
201 | + ), |
|
202 | 202 | 'doesnt-work' => array( |
203 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | - ), |
|
203 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
204 | + ), |
|
205 | 205 | 'found-other' => array( |
206 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | - 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | - ), |
|
206 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
207 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
208 | + ), |
|
209 | 209 | 'other' => array( |
210 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | - ), |
|
210 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
211 | + ), |
|
212 | 212 | ); |
213 | 213 | |
214 | 214 | shuffle( $reasons ); |
215 | 215 | |
216 | 216 | return $reasons; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | /** |
220 | - * Display a feedback form when the plugin is uninstalled |
|
221 | - * |
|
222 | - * @since 1.17.5 |
|
223 | - * |
|
220 | + * Display a feedback form when the plugin is uninstalled |
|
221 | + * |
|
222 | + * @since 1.17.5 |
|
223 | + * |
|
224 | 224 | * @return string HTML of the uninstallation form |
225 | 225 | */ |
226 | 226 | public function uninstall_form() { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
301 | 301 | <ul> |
302 | 302 | <?php |
303 | - $reasons = $this->get_uninstall_reasons(); |
|
303 | + $reasons = $this->get_uninstall_reasons(); |
|
304 | 304 | foreach ( $reasons as $reason ) { |
305 | 305 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) ); |
306 | 306 | } |
@@ -394,12 +394,12 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | public function app_settings_tab() { |
397 | - parent::app_settings_tab(); |
|
397 | + parent::app_settings_tab(); |
|
398 | 398 | |
399 | 399 | if ( $this->maybe_uninstall() ) { |
400 | - echo $this->uninstall_form(); |
|
400 | + echo $this->uninstall_form(); |
|
401 | 401 | } |
402 | - } |
|
402 | + } |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * The Settings title |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | * @return array The settings. |
485 | 485 | */ |
486 | 486 | public function all() { |
487 | - return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() ); |
|
487 | + return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() ); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | /** |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | type="' . $field['type'] . '" |
554 | 554 | name="' . esc_attr( $name ) . '" |
555 | 555 | value="' . $value . '" ' . |
556 | - implode( ' ', $attributes ) . |
|
557 | - ' />'; |
|
556 | + implode( ' ', $attributes ) . |
|
557 | + ' />'; |
|
558 | 558 | |
559 | 559 | if ( $echo ) { |
560 | 560 | echo $html; |
@@ -572,12 +572,12 @@ discard block |
||
572 | 572 | } |
573 | 573 | |
574 | 574 | /** |
575 | - * Check whether GravityView is being saved |
|
576 | - * |
|
577 | - * The generic is_save_postback() is true for all addons |
|
578 | - * |
|
579 | - * @since 2.0.8 |
|
580 | - * |
|
575 | + * Check whether GravityView is being saved |
|
576 | + * |
|
577 | + * The generic is_save_postback() is true for all addons |
|
578 | + * |
|
579 | + * @since 2.0.8 |
|
580 | + * |
|
581 | 581 | * @return bool |
582 | 582 | */ |
583 | 583 | public function is_save_postback() { |
@@ -591,16 +591,16 @@ discard block |
||
591 | 591 | */ |
592 | 592 | public function license_key_notice() { |
593 | 593 | |
594 | - if( $this->is_save_postback() ) { |
|
595 | - $settings = $this->get_posted_settings(); |
|
596 | - $license_key = \GV\Utils::get( $settings, 'license_key' ); |
|
597 | - $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
598 | - } else { |
|
599 | - $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
600 | - $license_key = $this->get( 'license_key' ); |
|
601 | - } |
|
594 | + if( $this->is_save_postback() ) { |
|
595 | + $settings = $this->get_posted_settings(); |
|
596 | + $license_key = \GV\Utils::get( $settings, 'license_key' ); |
|
597 | + $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
|
598 | + } else { |
|
599 | + $license_status = $this->get( 'license_key_status', 'inactive' ); |
|
600 | + $license_key = $this->get( 'license_key' ); |
|
601 | + } |
|
602 | 602 | |
603 | - $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
603 | + $license_id = empty( $license_key ) ? 'license' : $license_key; |
|
604 | 604 | |
605 | 605 | $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' ); |
606 | 606 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $update_below = false; |
618 | 618 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
619 | 619 | |
620 | - switch ( $license_status ) { |
|
620 | + switch ( $license_status ) { |
|
621 | 621 | /** @since 1.17 */ |
622 | 622 | case 'expired': |
623 | 623 | $title = __( 'Expired License', 'gravityview' ); |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | return; |
656 | 656 | } |
657 | 657 | |
658 | - \GravityView_Admin_Notices::add_notice( array( |
|
659 | - 'message' => $message, |
|
660 | - 'class' => 'notice notice-warning', |
|
661 | - 'title' => $title, |
|
662 | - 'cap' => 'gravityview_edit_settings', |
|
663 | - 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
664 | - ) ); |
|
658 | + \GravityView_Admin_Notices::add_notice( array( |
|
659 | + 'message' => $message, |
|
660 | + 'class' => 'notice notice-warning', |
|
661 | + 'title' => $title, |
|
662 | + 'cap' => 'gravityview_edit_settings', |
|
663 | + 'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default) |
|
664 | + ) ); |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | /** |
@@ -675,12 +675,12 @@ discard block |
||
675 | 675 | } |
676 | 676 | |
677 | 677 | /** |
678 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
679 | - * |
|
680 | - * @since 1.21.5 |
|
681 | - * |
|
682 | - * @see GFAddOn::scripts() |
|
683 | - * |
|
678 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
679 | + * |
|
680 | + * @since 1.21.5 |
|
681 | + * |
|
682 | + * @see GFAddOn::scripts() |
|
683 | + * |
|
684 | 684 | * @return array Array of scripts |
685 | 685 | */ |
686 | 686 | public function scripts() { |
@@ -689,10 +689,10 @@ discard block |
||
689 | 689 | $scripts[] = array( |
690 | 690 | 'handle' => 'gform_tooltip_init', |
691 | 691 | 'enqueue' => array( |
692 | - array( |
|
693 | - 'admin_page' => array( 'app_settings' ) |
|
694 | - ) |
|
695 | - ) |
|
692 | + array( |
|
693 | + 'admin_page' => array( 'app_settings' ) |
|
694 | + ) |
|
695 | + ) |
|
696 | 696 | ); |
697 | 697 | |
698 | 698 | return $scripts; |
@@ -710,10 +710,10 @@ discard block |
||
710 | 710 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
711 | 711 | 'version' => Plugin::$version, |
712 | 712 | 'deps' => array( |
713 | - 'gform_admin', |
|
713 | + 'gform_admin', |
|
714 | 714 | 'gaddon_form_settings_css', |
715 | - 'gform_tooltip', |
|
716 | - 'gform_font_awesome', |
|
715 | + 'gform_tooltip', |
|
716 | + 'gform_font_awesome', |
|
717 | 717 | ), |
718 | 718 | 'enqueue' => array( |
719 | 719 | array( 'admin_page' => array( |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | array( |
882 | 882 | 'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ), |
883 | 883 | 'value' => '1', |
884 | - 'name' => 'beta', |
|
884 | + 'name' => 'beta', |
|
885 | 885 | ), |
886 | 886 | ), |
887 | 887 | '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' ), |
@@ -919,38 +919,38 @@ discard block |
||
919 | 919 | |
920 | 920 | if ( empty( $field['disabled'] ) ) { |
921 | 921 | unset( $field['disabled'] ); |
922 | - } |
|
922 | + } |
|
923 | 923 | } |
924 | 924 | |
925 | - $sections = array( |
|
926 | - array( |
|
927 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
928 | - 'fields' => $fields, |
|
929 | - ) |
|
930 | - ); |
|
925 | + $sections = array( |
|
926 | + array( |
|
927 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ), |
|
928 | + 'fields' => $fields, |
|
929 | + ) |
|
930 | + ); |
|
931 | 931 | |
932 | - // custom 'update settings' button |
|
933 | - $button = array( |
|
934 | - 'class' => 'button button-primary button-hero', |
|
935 | - 'type' => 'save', |
|
936 | - ); |
|
932 | + // custom 'update settings' button |
|
933 | + $button = array( |
|
934 | + 'class' => 'button button-primary button-hero', |
|
935 | + 'type' => 'save', |
|
936 | + ); |
|
937 | 937 | |
938 | 938 | if ( $disabled_attribute ) { |
939 | 939 | $button['disabled'] = $disabled_attribute; |
940 | 940 | } |
941 | 941 | |
942 | - /** |
|
943 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
944 | - * Extensions can tap in here to insert their own section and settings. |
|
945 | - * <code> |
|
946 | - * $sections[] = array( |
|
947 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
948 | - * 'fields' => $settings, |
|
949 | - * ); |
|
950 | - * </code> |
|
951 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
952 | - */ |
|
953 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
942 | + /** |
|
943 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
944 | + * Extensions can tap in here to insert their own section and settings. |
|
945 | + * <code> |
|
946 | + * $sections[] = array( |
|
947 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
948 | + * 'fields' => $settings, |
|
949 | + * ); |
|
950 | + * </code> |
|
951 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
952 | + */ |
|
953 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
954 | 954 | |
955 | 955 | // If there are extensions, add a section for them |
956 | 956 | if ( ! empty( $extension_sections ) ) { |
@@ -963,13 +963,13 @@ discard block |
||
963 | 963 | } |
964 | 964 | } |
965 | 965 | |
966 | - $k = count( $extension_sections ) - 1 ; |
|
967 | - $extension_sections[ $k ]['fields'][] = $button; |
|
966 | + $k = count( $extension_sections ) - 1 ; |
|
967 | + $extension_sections[ $k ]['fields'][] = $button; |
|
968 | 968 | $sections = array_merge( $sections, $extension_sections ); |
969 | 969 | } else { |
970 | - // add the 'update settings' button to the general section |
|
971 | - $sections[0]['fields'][] = $button; |
|
972 | - } |
|
970 | + // add the 'update settings' button to the general section |
|
971 | + $sections[0]['fields'][] = $button; |
|
972 | + } |
|
973 | 973 | |
974 | 974 | return $sections; |
975 | 975 | } |
@@ -1023,9 +1023,9 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | protected function settings_edd_license( $field, $echo = true ) { |
1025 | 1025 | |
1026 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1027 | - $field['input_type'] = 'password'; |
|
1028 | - } |
|
1026 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
1027 | + $field['input_type'] = 'password'; |
|
1028 | + } |
|
1029 | 1029 | |
1030 | 1030 | $text = $this->settings_text( $field, false ); |
1031 | 1031 | |
@@ -1042,9 +1042,9 @@ discard block |
||
1042 | 1042 | |
1043 | 1043 | /** |
1044 | 1044 | * Allow pure HTML settings row |
1045 | - * |
|
1046 | - * @since 2.0.6 |
|
1047 | - * |
|
1045 | + * |
|
1046 | + * @since 2.0.6 |
|
1047 | + * |
|
1048 | 1048 | * @param array $field |
1049 | 1049 | * @param bool $echo Whether to echo the |
1050 | 1050 | * |
@@ -1110,19 +1110,19 @@ discard block |
||
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | /** |
1113 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1114 | - * |
|
1115 | - * Converts `$field['description']` to `$field['gv_description']` |
|
1116 | - * Converts `$field['subtitle']` to `$field['description']` |
|
1117 | - * |
|
1118 | - * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1119 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1120 | - * |
|
1121 | - * @since 1.21.5.2 |
|
1122 | - * |
|
1113 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
1114 | + * |
|
1115 | + * Converts `$field['description']` to `$field['gv_description']` |
|
1116 | + * Converts `$field['subtitle']` to `$field['description']` |
|
1117 | + * |
|
1118 | + * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description` |
|
1119 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
1120 | + * |
|
1121 | + * @since 1.21.5.2 |
|
1122 | + * |
|
1123 | 1123 | * @param array $field |
1124 | - * |
|
1125 | - * @return void |
|
1124 | + * |
|
1125 | + * @return void |
|
1126 | 1126 | */ |
1127 | 1127 | public function single_setting_row( $field ) { |
1128 | 1128 | $field['gv_description'] = Utils::get( $field, 'description' ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function add_admin_menu() { |
97 | 97 | |
98 | - $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
98 | + $menu_text = _x( 'Extensions', 'Extensions are WordPress plugins that add functionality to GravityView and Gravity Forms', 'gravityview' ); |
|
99 | 99 | |
100 | 100 | $menu_text = sprintf( '<span title="%s">%s</span>', esc_attr__( 'Plugins that extend GravityView and Gravity Forms functionality.', 'gravityview' ), $menu_text ); |
101 | 101 | |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | - * When on the Installer page, show a different notice than on the Settings page |
|
114 | - * |
|
113 | + * When on the Installer page, show a different notice than on the Settings page |
|
114 | + * |
|
115 | 115 | * @param array $notice |
116 | 116 | * |
117 | 117 | * @return string License notice |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | public function maybe_modify_license_notice( $notice = '' ) { |
120 | 120 | |
121 | 121 | if ( ! gravityview()->request->is_admin( '', 'downloads' ) ) { |
122 | - return $notice; |
|
123 | - } |
|
122 | + return $notice; |
|
123 | + } |
|
124 | 124 | |
125 | - return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
125 | + return esc_html__( 'Your license %s. Do you want access to these plugins? %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -160,43 +160,43 @@ discard block |
||
160 | 160 | * Get downloads data from transient or from API; save transient after getting data from API |
161 | 161 | * |
162 | 162 | * @return WP_Error|array If error, returns WP_Error. If not valid JSON, empty array. Otherwise, this structure: { |
163 | - * @type array $info { |
|
164 | - * @type string $id int 17 |
|
165 | - * @type string $slug Extension slug |
|
166 | - * @type string $title Extension title |
|
167 | - * @type string $create_date in '2018-07-19 20:03:10' format |
|
168 | - * @type string $modified_date |
|
169 | - * @type string $status |
|
170 | - * @type string $link URL to public plugin page |
|
171 | - * @type string $content |
|
172 | - * @type string $excerpt |
|
173 | - * @type string $thumbnail URL to thumbnail |
|
174 | - * @type array $category Taxonomy details for the plugin's category { |
|
175 | - * @type int $term_id => int 30 |
|
176 | - * @type string $name => string 'Plugins' (length=7) |
|
177 | - * @type string $slug => string 'plugins' (length=7) |
|
178 | - * @type int $term_group => int 0 |
|
179 | - * @type int $term_taxonomy_id => int 30 |
|
180 | - * @type string $taxonomy => string 'download_category' (length=17) |
|
181 | - * @type string $description => string '' (length=0) |
|
182 | - * @type int $parent => int 0 |
|
183 | - * @type int $count => int 4 |
|
184 | - * @type string $filter => string 'raw' (length=3) |
|
185 | - * } |
|
186 | - * @type array $tags {see $category above} |
|
187 | - * @type string $textdomain string 'gravityview' (length=11) |
|
188 | - * } |
|
189 | - * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
190 | - * @type array $licensing { |
|
191 | - * @type bool $enabled Is licensing enabled for the extension |
|
192 | - * @type string $version Version number |
|
193 | - * @type string $exp_unit Expiration unit ('years') |
|
194 | - * @type string $exp_length Expiration length ('1') |
|
195 | - * } |
|
196 | - * @type array $files Array of files. Empty if user has no access to the file. { |
|
197 | - * @type string $file string URL of the file download |
|
198 | - * } |
|
199 | - * } |
|
163 | + * @type array $info { |
|
164 | + * @type string $id int 17 |
|
165 | + * @type string $slug Extension slug |
|
166 | + * @type string $title Extension title |
|
167 | + * @type string $create_date in '2018-07-19 20:03:10' format |
|
168 | + * @type string $modified_date |
|
169 | + * @type string $status |
|
170 | + * @type string $link URL to public plugin page |
|
171 | + * @type string $content |
|
172 | + * @type string $excerpt |
|
173 | + * @type string $thumbnail URL to thumbnail |
|
174 | + * @type array $category Taxonomy details for the plugin's category { |
|
175 | + * @type int $term_id => int 30 |
|
176 | + * @type string $name => string 'Plugins' (length=7) |
|
177 | + * @type string $slug => string 'plugins' (length=7) |
|
178 | + * @type int $term_group => int 0 |
|
179 | + * @type int $term_taxonomy_id => int 30 |
|
180 | + * @type string $taxonomy => string 'download_category' (length=17) |
|
181 | + * @type string $description => string '' (length=0) |
|
182 | + * @type int $parent => int 0 |
|
183 | + * @type int $count => int 4 |
|
184 | + * @type string $filter => string 'raw' (length=3) |
|
185 | + * } |
|
186 | + * @type array $tags {see $category above} |
|
187 | + * @type string $textdomain string 'gravityview' (length=11) |
|
188 | + * } |
|
189 | + * @type array $pricing array of `price_name_slugs` => '00.00' values, if price options exist |
|
190 | + * @type array $licensing { |
|
191 | + * @type bool $enabled Is licensing enabled for the extension |
|
192 | + * @type string $version Version number |
|
193 | + * @type string $exp_unit Expiration unit ('years') |
|
194 | + * @type string $exp_length Expiration length ('1') |
|
195 | + * } |
|
196 | + * @type array $files Array of files. Empty if user has no access to the file. { |
|
197 | + * @type string $file string URL of the file download |
|
198 | + * } |
|
199 | + * } |
|
200 | 200 | */ |
201 | 201 | public function get_downloads_data() { |
202 | 202 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | ) ); |
225 | 225 | |
226 | 226 | if ( is_wp_error( $response ) ) { |
227 | - gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
227 | + gravityview()->log->error( "Extension data response is an error", array( 'data' => $response ) ); |
|
228 | 228 | return $response; |
229 | 229 | } |
230 | 230 | |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | <div class="gv-admin-installer-notice notice inline error"> |
278 | 278 | <h3><?php esc_html_e( 'Extensions and plugins data cannot be loaded at the moment. Please try again later.', 'gravityview' ); ?></h3> |
279 | 279 | <?php |
280 | - if ( is_wp_error( $downloads_data ) ) { |
|
281 | - echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
282 | - } |
|
283 | - ?> |
|
280 | + if ( is_wp_error( $downloads_data ) ) { |
|
281 | + echo wpautop( '<pre>' . esc_html( $downloads_data->get_error_message() ) . '</pre>' ); |
|
282 | + } |
|
283 | + ?> |
|
284 | 284 | </div> |
285 | 285 | </div> |
286 | 286 | <?php |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | protected function render_download( $download, $wp_plugins ) { |
337 | 337 | |
338 | 338 | |
339 | - $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
339 | + $details = $this->get_download_display_details( $download, $wp_plugins ); |
|
340 | 340 | |
341 | - $download_info = $details['download_info']; |
|
341 | + $download_info = $details['download_info']; |
|
342 | 342 | |
343 | 343 | ?> |
344 | 344 | <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
@@ -367,25 +367,25 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
370 | - * Generates details array for the download to keep the render_download() method a bit tidier |
|
371 | - * |
|
370 | + * Generates details array for the download to keep the render_download() method a bit tidier |
|
371 | + * |
|
372 | 372 | * @param array $download Single download, as returned by {@see get_downloads_data} |
373 | 373 | * @param array $wp_plugins All active plugins, as returned by {@see get_plugins()} |
374 | 374 | * |
375 | 375 | * @return array { |
376 | - * @type array $download_info |
|
377 | - * @type string $plugin_path |
|
378 | - * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
379 | - * @type string $status_label |
|
380 | - * @type string $button_title Title attribute to show when hovering over the download's button |
|
381 | - * @type string $button_class CSS class to use for the button |
|
382 | - * @type string $button_label Text to use for the download's anchor link |
|
383 | - * @type string $href URL for the download's button |
|
384 | - * @type bool $spinner Whether to show the spinner icon |
|
385 | - * @type string $item_class CSS class for the download container |
|
386 | - * @type string $required_license The name of the required license for the download ("Galactic" or "Interstellar") |
|
387 | - * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
388 | - * } |
|
376 | + * @type array $download_info |
|
377 | + * @type string $plugin_path |
|
378 | + * @type string $status License status returned by Easy Digital Downloads ("active", "inactive", "expired", "revoked", etc) |
|
379 | + * @type string $status_label |
|
380 | + * @type string $button_title Title attribute to show when hovering over the download's button |
|
381 | + * @type string $button_class CSS class to use for the button |
|
382 | + * @type string $button_label Text to use for the download's anchor link |
|
383 | + * @type string $href URL for the download's button |
|
384 | + * @type bool $spinner Whether to show the spinner icon |
|
385 | + * @type string $item_class CSS class for the download container |
|
386 | + * @type string $required_license The name of the required license for the download ("Galactic" or "Interstellar") |
|
387 | + * @type bool $is_active Is the current GravityView license (as entered in Settings) active? |
|
388 | + * } |
|
389 | 389 | */ |
390 | 390 | private function get_download_display_details( $download, $wp_plugins ) { |
391 | 391 | |
@@ -474,18 +474,18 @@ discard block |
||
474 | 474 | } |
475 | 475 | |
476 | 476 | return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
477 | - } |
|
477 | + } |
|
478 | 478 | |
479 | 479 | /** |
480 | - * Returns the base price for an extension |
|
481 | - * |
|
480 | + * Returns the base price for an extension |
|
481 | + * |
|
482 | 482 | * @param array $download |
483 | 483 | * |
484 | 484 | * @return float Base price for an extension. If not for sale separately, returns 0 |
485 | 485 | */ |
486 | 486 | private function get_download_base_price( $download ) { |
487 | 487 | |
488 | - $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
488 | + $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
|
489 | 489 | $base_price = \GFCommon::to_number( $base_price ); |
490 | 490 | |
491 | 491 | unset( $download['pricing']['amount'] ); |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | return floatval( $base_price ); |
499 | - } |
|
499 | + } |
|
500 | 500 | |
501 | 501 | /** |
502 | 502 | * Handle AJAX request to activate extension |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | |
515 | 515 | if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
516 | 516 | wp_send_json_error( array( |
517 | - 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
|
518 | - ) ); |
|
517 | + 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
|
518 | + ) ); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | wp_send_json_success(); |
@@ -536,10 +536,10 @@ discard block |
||
536 | 536 | deactivate_plugins( $data['path'] ); |
537 | 537 | |
538 | 538 | if( is_plugin_active( $data['path'] ) ) { |
539 | - wp_send_json_error( array( |
|
540 | - 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
|
541 | - ) ); |
|
542 | - } |
|
539 | + wp_send_json_error( array( |
|
540 | + 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
|
541 | + ) ); |
|
542 | + } |
|
543 | 543 | |
544 | 544 | wp_send_json_success(); |
545 | 545 | } |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | |
95 | 95 | /** |
96 | 96 | * ID of the current post. May also be ID of the current View. |
97 | - * |
|
98 | - * @since 2.0.13 |
|
99 | - * |
|
100 | - * @var int |
|
97 | + * |
|
98 | + * @since 2.0.13 |
|
99 | + * |
|
100 | + * @var int |
|
101 | 101 | */ |
102 | 102 | public $post_id; |
103 | 103 | |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | public function prevent_maybe_process_form() { |
170 | 170 | |
171 | 171 | if( ! empty( $_POST ) ) { |
172 | - gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) ); |
|
172 | + gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) ); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | if( $this->is_edit_entry_submission() ) { |
176 | 176 | remove_action( 'wp', array( 'RGForms', 'maybe_process_form'), 9 ); |
177 | - remove_action( 'wp', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
177 | + remove_action( 'wp', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | * When Edit entry view is requested setup the vars |
203 | 203 | */ |
204 | 204 | private function setup_vars() { |
205 | - global $post; |
|
205 | + global $post; |
|
206 | 206 | |
207 | 207 | $gravityview_view = GravityView_View::getInstance(); |
208 | 208 | |
209 | 209 | |
210 | 210 | $entries = $gravityview_view->getEntries(); |
211 | - self::$original_entry = $entries[0]; |
|
212 | - $this->entry = $entries[0]; |
|
211 | + self::$original_entry = $entries[0]; |
|
212 | + $this->entry = $entries[0]; |
|
213 | 213 | |
214 | 214 | self::$original_form = $gravityview_view->getForm(); |
215 | 215 | $this->form = $gravityview_view->getForm(); |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | |
334 | 334 | GFFormsModel::save_lead( $form, $this->entry ); |
335 | 335 | |
336 | - // Delete the values for hidden inputs |
|
337 | - $this->unset_hidden_field_values(); |
|
336 | + // Delete the values for hidden inputs |
|
337 | + $this->unset_hidden_field_values(); |
|
338 | 338 | |
339 | 339 | $this->entry['date_created'] = $date_created; |
340 | 340 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | // Perform actions normally performed after updating a lead |
345 | 345 | $this->after_update(); |
346 | 346 | |
347 | - /** |
|
347 | + /** |
|
348 | 348 | * Must be AFTER after_update()! |
349 | 349 | * @see https://github.com/gravityview/GravityView/issues/764 |
350 | 350 | */ |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | /** |
354 | 354 | * @action `gravityview/edit_entry/after_update` Perform an action after the entry has been updated using Edit Entry |
355 | - * @since 2.1 Added $gv_data parameter |
|
355 | + * @since 2.1 Added $gv_data parameter |
|
356 | 356 | * @param array $form Gravity Forms form array |
357 | 357 | * @param string $entry_id Numeric ID of the entry that was updated |
358 | 358 | * @param GravityView_Edit_Entry_Render $this This object |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | * @return void |
377 | 377 | */ |
378 | 378 | private function unset_hidden_field_values() { |
379 | - global $wpdb; |
|
379 | + global $wpdb; |
|
380 | 380 | |
381 | 381 | /** |
382 | 382 | * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic |
@@ -398,27 +398,27 @@ discard block |
||
398 | 398 | $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) ); |
399 | 399 | } |
400 | 400 | |
401 | - foreach ( $this->entry as $input_id => $field_value ) { |
|
401 | + foreach ( $this->entry as $input_id => $field_value ) { |
|
402 | 402 | |
403 | - $field = RGFormsModel::get_field( $this->form, $input_id ); |
|
403 | + $field = RGFormsModel::get_field( $this->form, $input_id ); |
|
404 | 404 | |
405 | - // Reset fields that are hidden |
|
406 | - // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic |
|
407 | - if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) { |
|
405 | + // Reset fields that are hidden |
|
406 | + // Don't pass $entry as fourth parameter; force using $_POST values to calculate conditional logic |
|
407 | + if ( GFFormsModel::is_field_hidden( $this->form, $field, array(), NULL ) ) { |
|
408 | 408 | |
409 | - // List fields are stored as empty arrays when empty |
|
410 | - $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : ''; |
|
409 | + // List fields are stored as empty arrays when empty |
|
410 | + $empty_value = $this->is_field_json_encoded( $field ) ? '[]' : ''; |
|
411 | 411 | |
412 | - $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id ); |
|
412 | + $lead_detail_id = GFFormsModel::get_lead_detail_id( $current_fields, $input_id ); |
|
413 | 413 | |
414 | - GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value ); |
|
414 | + GFFormsModel::update_lead_field_value( $this->form, $this->entry, $field, $lead_detail_id, $input_id, $empty_value ); |
|
415 | 415 | |
416 | - // Prevent the $_POST values of hidden fields from being used as default values when rendering the form |
|
416 | + // Prevent the $_POST values of hidden fields from being used as default values when rendering the form |
|
417 | 417 | // after submission |
418 | - $post_input_id = 'input_' . str_replace( '.', '_', $input_id ); |
|
419 | - $_POST[ $post_input_id ] = ''; |
|
420 | - } |
|
421 | - } |
|
418 | + $post_input_id = 'input_' . str_replace( '.', '_', $input_id ); |
|
419 | + $_POST[ $post_input_id ] = ''; |
|
420 | + } |
|
421 | + } |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | /** |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | $form = $this->form; |
514 | 514 | |
515 | - /** @var GF_Field $field */ |
|
515 | + /** @var GF_Field $field */ |
|
516 | 516 | foreach( $form['fields'] as $k => &$field ) { |
517 | 517 | |
518 | 518 | /** |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | |
529 | 529 | if( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
530 | 530 | foreach( $field->inputs as $key => $input ) { |
531 | - $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
531 | + $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | } |
@@ -549,13 +549,13 @@ discard block |
||
549 | 549 | foreach ( $this->fields_with_calculation as $calc_field ) { |
550 | 550 | $inputs = $calc_field->get_entry_inputs(); |
551 | 551 | if ( is_array( $inputs ) ) { |
552 | - foreach ( $inputs as $input ) { |
|
553 | - $input_name = 'input_' . str_replace( '.', '_', $input['id'] ); |
|
554 | - $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry ); |
|
555 | - } |
|
552 | + foreach ( $inputs as $input ) { |
|
553 | + $input_name = 'input_' . str_replace( '.', '_', $input['id'] ); |
|
554 | + $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry ); |
|
555 | + } |
|
556 | 556 | } else { |
557 | - $input_name = 'input_' . str_replace( '.', '_', $calc_field->id); |
|
558 | - $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry ); |
|
557 | + $input_name = 'input_' . str_replace( '.', '_', $calc_field->id); |
|
558 | + $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry ); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] ); |
604 | 604 | |
605 | 605 | $ary = ! empty( $value ) ? explode( '|:|', $value ) : array(); |
606 | - $ary = stripslashes_deep( $ary ); |
|
606 | + $ary = stripslashes_deep( $ary ); |
|
607 | 607 | $img_url = \GV\Utils::get( $ary, 0 ); |
608 | 608 | |
609 | 609 | $img_title = count( $ary ) > 1 ? $ary[1] : ''; |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | private function maybe_update_post_fields( $form ) { |
677 | 677 | |
678 | 678 | if( empty( $this->entry['post_id'] ) ) { |
679 | - gravityview()->log->debug( 'This entry has no post fields. Continuing...' ); |
|
679 | + gravityview()->log->debug( 'This entry has no post fields. Continuing...' ); |
|
680 | 680 | return; |
681 | 681 | } |
682 | 682 | |
@@ -711,51 +711,51 @@ discard block |
||
711 | 711 | |
712 | 712 | switch( $field->type ) { |
713 | 713 | |
714 | - case 'post_title': |
|
715 | - $post_title = $value; |
|
716 | - if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) { |
|
717 | - $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
718 | - } |
|
719 | - $updated_post->post_title = $post_title; |
|
720 | - $updated_post->post_name = $post_title; |
|
721 | - unset( $post_title ); |
|
722 | - break; |
|
723 | - |
|
724 | - case 'post_content': |
|
725 | - $post_content = $value; |
|
726 | - if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) { |
|
727 | - $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
728 | - } |
|
729 | - $updated_post->post_content = $post_content; |
|
730 | - unset( $post_content ); |
|
731 | - break; |
|
732 | - case 'post_excerpt': |
|
733 | - $updated_post->post_excerpt = $value; |
|
734 | - break; |
|
735 | - case 'post_tags': |
|
736 | - wp_set_post_tags( $post_id, $value, false ); |
|
737 | - break; |
|
738 | - case 'post_category': |
|
739 | - break; |
|
740 | - case 'post_custom_field': |
|
714 | + case 'post_title': |
|
715 | + $post_title = $value; |
|
716 | + if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) { |
|
717 | + $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
718 | + } |
|
719 | + $updated_post->post_title = $post_title; |
|
720 | + $updated_post->post_name = $post_title; |
|
721 | + unset( $post_title ); |
|
722 | + break; |
|
723 | + |
|
724 | + case 'post_content': |
|
725 | + $post_content = $value; |
|
726 | + if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) { |
|
727 | + $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
728 | + } |
|
729 | + $updated_post->post_content = $post_content; |
|
730 | + unset( $post_content ); |
|
731 | + break; |
|
732 | + case 'post_excerpt': |
|
733 | + $updated_post->post_excerpt = $value; |
|
734 | + break; |
|
735 | + case 'post_tags': |
|
736 | + wp_set_post_tags( $post_id, $value, false ); |
|
737 | + break; |
|
738 | + case 'post_category': |
|
739 | + break; |
|
740 | + case 'post_custom_field': |
|
741 | 741 | if ( is_array( $value ) && ( floatval( $field_id ) !== floatval( $field->id ) ) ) { |
742 | 742 | $value = $value[ $field_id ]; |
743 | 743 | } |
744 | 744 | |
745 | - if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
746 | - $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
|
747 | - } |
|
745 | + if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
746 | + $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
|
747 | + } |
|
748 | 748 | |
749 | - if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) { |
|
750 | - $value = wp_json_encode( $value ); |
|
751 | - } |
|
749 | + if ( $this->is_field_json_encoded( $field ) && ! is_string( $value ) ) { |
|
750 | + $value = wp_json_encode( $value ); |
|
751 | + } |
|
752 | 752 | |
753 | - update_post_meta( $post_id, $field->postCustomFieldName, $value ); |
|
754 | - break; |
|
753 | + update_post_meta( $post_id, $field->postCustomFieldName, $value ); |
|
754 | + break; |
|
755 | 755 | |
756 | - case 'post_image': |
|
757 | - $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id ); |
|
758 | - break; |
|
756 | + case 'post_image': |
|
757 | + $value = $this->update_post_image( $form, $field, $field_id, $value, $this->entry, $post_id ); |
|
758 | + break; |
|
759 | 759 | |
760 | 760 | } |
761 | 761 | |
@@ -800,20 +800,20 @@ discard block |
||
800 | 800 | */ |
801 | 801 | private function is_field_json_encoded( $field ) { |
802 | 802 | |
803 | - $json_encoded = false; |
|
803 | + $json_encoded = false; |
|
804 | 804 | |
805 | 805 | $input_type = RGFormsModel::get_input_type( $field ); |
806 | 806 | |
807 | - // Only certain custom field types are supported |
|
808 | - switch( $input_type ) { |
|
809 | - case 'fileupload': |
|
810 | - case 'list': |
|
811 | - case 'multiselect': |
|
812 | - $json_encoded = true; |
|
813 | - break; |
|
814 | - } |
|
807 | + // Only certain custom field types are supported |
|
808 | + switch( $input_type ) { |
|
809 | + case 'fileupload': |
|
810 | + case 'list': |
|
811 | + case 'multiselect': |
|
812 | + $json_encoded = true; |
|
813 | + break; |
|
814 | + } |
|
815 | 815 | |
816 | - return $json_encoded; |
|
816 | + return $json_encoded; |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | /** |
@@ -903,14 +903,14 @@ discard block |
||
903 | 903 | ?><h2 class="gv-edit-entry-title"> |
904 | 904 | <span><?php |
905 | 905 | |
906 | - /** |
|
907 | - * @filter `gravityview_edit_entry_title` Modify the edit entry title |
|
908 | - * @param string $edit_entry_title Modify the "Edit Entry" title |
|
909 | - * @param GravityView_Edit_Entry_Render $this This object |
|
910 | - */ |
|
911 | - $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this ); |
|
906 | + /** |
|
907 | + * @filter `gravityview_edit_entry_title` Modify the edit entry title |
|
908 | + * @param string $edit_entry_title Modify the "Edit Entry" title |
|
909 | + * @param GravityView_Edit_Entry_Render $this This object |
|
910 | + */ |
|
911 | + $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this ); |
|
912 | 912 | |
913 | - echo esc_attr( $edit_entry_title ); |
|
913 | + echo esc_attr( $edit_entry_title ); |
|
914 | 914 | ?></span> |
915 | 915 | </h2> |
916 | 916 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | |
1020 | 1020 | ob_get_clean(); |
1021 | 1021 | |
1022 | - remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 ); |
|
1022 | + remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 ); |
|
1023 | 1023 | remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) ); |
1024 | 1024 | remove_filter( 'gform_disable_view_counter', '__return_true' ); |
1025 | 1025 | remove_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5 ); |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | |
1074 | 1074 | // for now we don't support Save and Continue feature. |
1075 | 1075 | if( ! self::$supports_save_and_continue ) { |
1076 | - unset( $form['save'] ); |
|
1076 | + unset( $form['save'] ); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | return $form; |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | || ! empty( $field_content ) |
1149 | 1149 | || in_array( $field->type, array( 'honeypot' ) ) |
1150 | 1150 | ) { |
1151 | - return $field_content; |
|
1151 | + return $field_content; |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | // SET SOME FIELD DEFAULTS TO PREVENT ISSUES |
@@ -1156,24 +1156,24 @@ discard block |
||
1156 | 1156 | |
1157 | 1157 | $field_value = $this->get_field_value( $field ); |
1158 | 1158 | |
1159 | - // Prevent any PHP warnings, like undefined index |
|
1160 | - ob_start(); |
|
1159 | + // Prevent any PHP warnings, like undefined index |
|
1160 | + ob_start(); |
|
1161 | 1161 | |
1162 | - $return = null; |
|
1162 | + $return = null; |
|
1163 | 1163 | |
1164 | 1164 | /** @var GravityView_Field $gv_field */ |
1165 | 1165 | if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
1166 | 1166 | $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field ); |
1167 | 1167 | } else { |
1168 | - $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
|
1169 | - } |
|
1168 | + $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
|
1169 | + } |
|
1170 | 1170 | |
1171 | - // If there was output, it's an error |
|
1172 | - $warnings = ob_get_clean(); |
|
1171 | + // If there was output, it's an error |
|
1172 | + $warnings = ob_get_clean(); |
|
1173 | 1173 | |
1174 | - if( !empty( $warnings ) ) { |
|
1175 | - gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) ); |
|
1176 | - } |
|
1174 | + if( !empty( $warnings ) ) { |
|
1175 | + gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) ); |
|
1176 | + } |
|
1177 | 1177 | |
1178 | 1178 | return $return; |
1179 | 1179 | } |
@@ -1208,8 +1208,8 @@ discard block |
||
1208 | 1208 | $input_id = strval( $input['id'] ); |
1209 | 1209 | |
1210 | 1210 | if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) { |
1211 | - $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
1212 | - $allow_pre_populated = false; |
|
1211 | + $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
1212 | + $allow_pre_populated = false; |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | } |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) { |
1234 | 1234 | $categories = array(); |
1235 | 1235 | foreach ( explode( ',', $field_value ) as $cat_string ) { |
1236 | - $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
1236 | + $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
1237 | 1237 | } |
1238 | 1238 | $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories ); |
1239 | 1239 | } |
@@ -1243,25 +1243,25 @@ discard block |
||
1243 | 1243 | // if value is empty get the default value if defined |
1244 | 1244 | $field_value = $field->get_value_default_if_empty( $field_value ); |
1245 | 1245 | |
1246 | - /** |
|
1247 | - * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed |
|
1248 | - * @since 1.11 |
|
1249 | - * @since 1.20 Added third param |
|
1250 | - * @param mixed $field_value field value used to populate the input |
|
1251 | - * @param object $field Gravity Forms field object ( Class GF_Field ) |
|
1252 | - * @param GravityView_Edit_Entry_Render $this Current object |
|
1253 | - */ |
|
1254 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this ); |
|
1255 | - |
|
1256 | - /** |
|
1257 | - * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type |
|
1258 | - * @since 1.17 |
|
1259 | - * @since 1.20 Added third param |
|
1260 | - * @param mixed $field_value field value used to populate the input |
|
1261 | - * @param GF_Field $field Gravity Forms field object |
|
1262 | - * @param GravityView_Edit_Entry_Render $this Current object |
|
1263 | - */ |
|
1264 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
1246 | + /** |
|
1247 | + * @filter `gravityview/edit_entry/field_value` Change the value of an Edit Entry field, if needed |
|
1248 | + * @since 1.11 |
|
1249 | + * @since 1.20 Added third param |
|
1250 | + * @param mixed $field_value field value used to populate the input |
|
1251 | + * @param object $field Gravity Forms field object ( Class GF_Field ) |
|
1252 | + * @param GravityView_Edit_Entry_Render $this Current object |
|
1253 | + */ |
|
1254 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value', $field_value, $field, $this ); |
|
1255 | + |
|
1256 | + /** |
|
1257 | + * @filter `gravityview/edit_entry/field_value_{field_type}` Change the value of an Edit Entry field for a specific field type |
|
1258 | + * @since 1.17 |
|
1259 | + * @since 1.20 Added third param |
|
1260 | + * @param mixed $field_value field value used to populate the input |
|
1261 | + * @param GF_Field $field Gravity Forms field object |
|
1262 | + * @param GravityView_Edit_Entry_Render $this Current object |
|
1263 | + */ |
|
1264 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
1265 | 1265 | |
1266 | 1266 | return $field_value; |
1267 | 1267 | } |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | // This is because we're doing admin form pretending to be front-end, so Gravity Forms |
1289 | 1289 | // expects certain field array items to be set. |
1290 | 1290 | foreach ( array( 'noDuplicates', 'adminOnly', 'inputType', 'isRequired', 'enablePrice', 'inputs', 'allowedExtensions' ) as $key ) { |
1291 | - $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL; |
|
1291 | + $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL; |
|
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | switch( RGFormsModel::get_input_type( $field ) ) { |
@@ -1302,61 +1302,61 @@ discard block |
||
1302 | 1302 | */ |
1303 | 1303 | case 'fileupload': |
1304 | 1304 | |
1305 | - // Set the previous value |
|
1306 | - $entry = $this->get_entry(); |
|
1305 | + // Set the previous value |
|
1306 | + $entry = $this->get_entry(); |
|
1307 | 1307 | |
1308 | - $input_name = 'input_'.$field->id; |
|
1309 | - $form_id = $form['id']; |
|
1308 | + $input_name = 'input_'.$field->id; |
|
1309 | + $form_id = $form['id']; |
|
1310 | 1310 | |
1311 | - $value = NULL; |
|
1311 | + $value = NULL; |
|
1312 | 1312 | |
1313 | - // Use the previous entry value as the default. |
|
1314 | - if( isset( $entry[ $field->id ] ) ) { |
|
1315 | - $value = $entry[ $field->id ]; |
|
1316 | - } |
|
1313 | + // Use the previous entry value as the default. |
|
1314 | + if( isset( $entry[ $field->id ] ) ) { |
|
1315 | + $value = $entry[ $field->id ]; |
|
1316 | + } |
|
1317 | 1317 | |
1318 | - // If this is a single upload file |
|
1319 | - if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
1320 | - $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
1321 | - $value = $file_path['url']; |
|
1318 | + // If this is a single upload file |
|
1319 | + if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
1320 | + $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
1321 | + $value = $file_path['url']; |
|
1322 | 1322 | |
1323 | - } else { |
|
1323 | + } else { |
|
1324 | 1324 | |
1325 | - // Fix PHP warning on line 1498 of form_display.php for post_image fields |
|
1326 | - // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
|
1327 | - $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
1325 | + // Fix PHP warning on line 1498 of form_display.php for post_image fields |
|
1326 | + // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
|
1327 | + $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
1328 | 1328 | |
1329 | - } |
|
1329 | + } |
|
1330 | 1330 | |
1331 | - if ( \GV\Utils::get( $field, "multipleFiles" ) ) { |
|
1331 | + if ( \GV\Utils::get( $field, "multipleFiles" ) ) { |
|
1332 | 1332 | |
1333 | - // If there are fresh uploads, process and merge them. |
|
1334 | - // Otherwise, use the passed values, which should be json-encoded array of URLs |
|
1335 | - if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) { |
|
1336 | - $value = empty( $value ) ? '[]' : $value; |
|
1337 | - $value = stripslashes_deep( $value ); |
|
1338 | - $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array()); |
|
1339 | - } |
|
1333 | + // If there are fresh uploads, process and merge them. |
|
1334 | + // Otherwise, use the passed values, which should be json-encoded array of URLs |
|
1335 | + if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) { |
|
1336 | + $value = empty( $value ) ? '[]' : $value; |
|
1337 | + $value = stripslashes_deep( $value ); |
|
1338 | + $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array()); |
|
1339 | + } |
|
1340 | 1340 | |
1341 | - } else { |
|
1341 | + } else { |
|
1342 | 1342 | |
1343 | - // A file already exists when editing an entry |
|
1344 | - // We set this to solve issue when file upload fields are required. |
|
1345 | - GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value; |
|
1343 | + // A file already exists when editing an entry |
|
1344 | + // We set this to solve issue when file upload fields are required. |
|
1345 | + GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $value; |
|
1346 | 1346 | |
1347 | - } |
|
1347 | + } |
|
1348 | 1348 | |
1349 | - $this->entry[ $input_name ] = $value; |
|
1350 | - $_POST[ $input_name ] = $value; |
|
1349 | + $this->entry[ $input_name ] = $value; |
|
1350 | + $_POST[ $input_name ] = $value; |
|
1351 | 1351 | |
1352 | - break; |
|
1352 | + break; |
|
1353 | 1353 | |
1354 | 1354 | case 'number': |
1355 | - // Fix "undefined index" issue at line 1286 in form_display.php |
|
1356 | - if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
1357 | - $_POST['input_'.$field->id ] = NULL; |
|
1358 | - } |
|
1359 | - break; |
|
1355 | + // Fix "undefined index" issue at line 1286 in form_display.php |
|
1356 | + if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
1357 | + $_POST['input_'.$field->id ] = NULL; |
|
1358 | + } |
|
1359 | + break; |
|
1360 | 1360 | } |
1361 | 1361 | |
1362 | 1362 | } |
@@ -1441,42 +1441,42 @@ discard block |
||
1441 | 1441 | case 'fileupload' : |
1442 | 1442 | case 'post_image': |
1443 | 1443 | |
1444 | - // in case nothing is uploaded but there are already files saved |
|
1445 | - if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) { |
|
1446 | - $field->failed_validation = false; |
|
1447 | - unset( $field->validation_message ); |
|
1448 | - } |
|
1444 | + // in case nothing is uploaded but there are already files saved |
|
1445 | + if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) { |
|
1446 | + $field->failed_validation = false; |
|
1447 | + unset( $field->validation_message ); |
|
1448 | + } |
|
1449 | 1449 | |
1450 | - // validate if multi file upload reached max number of files [maxFiles] => 2 |
|
1451 | - if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) { |
|
1450 | + // validate if multi file upload reached max number of files [maxFiles] => 2 |
|
1451 | + if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) { |
|
1452 | 1452 | |
1453 | - $input_name = 'input_' . $field->id; |
|
1454 | - //uploaded |
|
1455 | - $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array(); |
|
1453 | + $input_name = 'input_' . $field->id; |
|
1454 | + //uploaded |
|
1455 | + $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array(); |
|
1456 | 1456 | |
1457 | - //existent |
|
1458 | - $entry = $this->get_entry(); |
|
1459 | - $value = NULL; |
|
1460 | - if( isset( $entry[ $field->id ] ) ) { |
|
1461 | - $value = json_decode( $entry[ $field->id ], true ); |
|
1462 | - } |
|
1457 | + //existent |
|
1458 | + $entry = $this->get_entry(); |
|
1459 | + $value = NULL; |
|
1460 | + if( isset( $entry[ $field->id ] ) ) { |
|
1461 | + $value = json_decode( $entry[ $field->id ], true ); |
|
1462 | + } |
|
1463 | 1463 | |
1464 | - // count uploaded files and existent entry files |
|
1465 | - $count_files = count( $file_names ) + count( $value ); |
|
1464 | + // count uploaded files and existent entry files |
|
1465 | + $count_files = count( $file_names ) + count( $value ); |
|
1466 | 1466 | |
1467 | - if( $count_files > $field->maxFiles ) { |
|
1468 | - $field->validation_message = __( 'Maximum number of files reached', 'gravityview' ); |
|
1469 | - $field->failed_validation = 1; |
|
1470 | - $gv_valid = false; |
|
1467 | + if( $count_files > $field->maxFiles ) { |
|
1468 | + $field->validation_message = __( 'Maximum number of files reached', 'gravityview' ); |
|
1469 | + $field->failed_validation = 1; |
|
1470 | + $gv_valid = false; |
|
1471 | 1471 | |
1472 | - // in case of error make sure the newest upload files are removed from the upload input |
|
1473 | - GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null; |
|
1474 | - } |
|
1472 | + // in case of error make sure the newest upload files are removed from the upload input |
|
1473 | + GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null; |
|
1474 | + } |
|
1475 | 1475 | |
1476 | - } |
|
1476 | + } |
|
1477 | 1477 | |
1478 | 1478 | |
1479 | - break; |
|
1479 | + break; |
|
1480 | 1480 | |
1481 | 1481 | } |
1482 | 1482 | |
@@ -1487,47 +1487,47 @@ discard block |
||
1487 | 1487 | |
1488 | 1488 | switch ( $field_type ) { |
1489 | 1489 | |
1490 | - // Captchas don't need to be re-entered. |
|
1491 | - case 'captcha': |
|
1490 | + // Captchas don't need to be re-entered. |
|
1491 | + case 'captcha': |
|
1492 | 1492 | |
1493 | - // Post Image fields aren't editable, so we un-fail them. |
|
1494 | - case 'post_image': |
|
1495 | - $field->failed_validation = false; |
|
1496 | - unset( $field->validation_message ); |
|
1497 | - break; |
|
1493 | + // Post Image fields aren't editable, so we un-fail them. |
|
1494 | + case 'post_image': |
|
1495 | + $field->failed_validation = false; |
|
1496 | + unset( $field->validation_message ); |
|
1497 | + break; |
|
1498 | 1498 | |
1499 | 1499 | } |
1500 | 1500 | |
1501 | 1501 | // You can't continue inside a switch, so we do it after. |
1502 | 1502 | if( empty( $field->failed_validation ) ) { |
1503 | - continue; |
|
1503 | + continue; |
|
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | // checks if the No Duplicates option is not validating entry against itself, since |
1507 | 1507 | // we're editing a stored entry, it would also assume it's a duplicate. |
1508 | 1508 | if( !empty( $field->noDuplicates ) ) { |
1509 | 1509 | |
1510 | - $entry = $this->get_entry(); |
|
1510 | + $entry = $this->get_entry(); |
|
1511 | 1511 | |
1512 | - // If the value of the entry is the same as the stored value |
|
1513 | - // Then we can assume it's not a duplicate, it's the same. |
|
1514 | - if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
1515 | - //if value submitted was not changed, then don't validate |
|
1516 | - $field->failed_validation = false; |
|
1512 | + // If the value of the entry is the same as the stored value |
|
1513 | + // Then we can assume it's not a duplicate, it's the same. |
|
1514 | + if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
1515 | + //if value submitted was not changed, then don't validate |
|
1516 | + $field->failed_validation = false; |
|
1517 | 1517 | |
1518 | - unset( $field->validation_message ); |
|
1518 | + unset( $field->validation_message ); |
|
1519 | 1519 | |
1520 | - gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) ); |
|
1520 | + gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', array( 'data' => $entry ) ); |
|
1521 | 1521 | |
1522 | - continue; |
|
1523 | - } |
|
1522 | + continue; |
|
1523 | + } |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | // if here then probably we are facing the validation 'At least one field must be filled out' |
1527 | 1527 | if( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
1528 | - unset( $field->validation_message ); |
|
1529 | - $field->validation_message = false; |
|
1530 | - continue; |
|
1528 | + unset( $field->validation_message ); |
|
1529 | + $field->validation_message = false; |
|
1530 | + continue; |
|
1531 | 1531 | } |
1532 | 1532 | |
1533 | 1533 | $gv_valid = false; |
@@ -1591,8 +1591,8 @@ discard block |
||
1591 | 1591 | // Hide fields depending on admin settings |
1592 | 1592 | $fields = $this->filter_fields( $form['fields'], $edit_fields ); |
1593 | 1593 | |
1594 | - // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't. |
|
1595 | - $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
|
1594 | + // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't. |
|
1595 | + $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
|
1596 | 1596 | |
1597 | 1597 | /** |
1598 | 1598 | * @filter `gravityview/edit_entry/form_fields` Modify the fields displayed in Edit Entry form |
@@ -1652,11 +1652,11 @@ discard block |
||
1652 | 1652 | // The edit tab has been configured, so we loop through to configured settings |
1653 | 1653 | foreach ( $configured_fields as $configured_field ) { |
1654 | 1654 | |
1655 | - /** @var GF_Field $field */ |
|
1656 | - foreach ( $fields as $field ) { |
|
1655 | + /** @var GF_Field $field */ |
|
1656 | + foreach ( $fields as $field ) { |
|
1657 | 1657 | if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
1658 | - $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
1659 | - break; |
|
1658 | + $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
1659 | + break; |
|
1660 | 1660 | } |
1661 | 1661 | |
1662 | 1662 | } |
@@ -1712,28 +1712,28 @@ discard block |
||
1712 | 1712 | */ |
1713 | 1713 | private function filter_admin_only_fields( $fields = array(), $edit_fields = null, $form = array(), $view_id = 0 ) { |
1714 | 1714 | |
1715 | - /** |
|
1715 | + /** |
|
1716 | 1716 | * @filter `gravityview/edit_entry/use_gf_admin_only_setting` When Edit tab isn't configured, should the Gravity Forms "Admin Only" field settings be used to control field display to non-admins? Default: true |
1717 | - * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators. |
|
1718 | - * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions |
|
1719 | - * @since 1.9.1 |
|
1720 | - * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions. |
|
1721 | - * @param array $form GF Form array |
|
1722 | - * @param int $view_id View ID |
|
1723 | - */ |
|
1724 | - $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id ); |
|
1725 | - |
|
1726 | - if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
1717 | + * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators. |
|
1718 | + * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions |
|
1719 | + * @since 1.9.1 |
|
1720 | + * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions. |
|
1721 | + * @param array $form GF Form array |
|
1722 | + * @param int $view_id View ID |
|
1723 | + */ |
|
1724 | + $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id ); |
|
1725 | + |
|
1726 | + if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
1727 | 1727 | foreach( $fields as $k => $field ) { |
1728 | 1728 | if( $field->adminOnly ) { |
1729 | - unset( $fields[ $k ] ); |
|
1729 | + unset( $fields[ $k ] ); |
|
1730 | 1730 | } |
1731 | 1731 | } |
1732 | 1732 | return $fields; |
1733 | 1733 | } |
1734 | 1734 | |
1735 | - foreach( $fields as &$field ) { |
|
1736 | - $field->adminOnly = false; |
|
1735 | + foreach( $fields as &$field ) { |
|
1736 | + $field->adminOnly = false; |
|
1737 | 1737 | } |
1738 | 1738 | |
1739 | 1739 | return $fields; |
@@ -1766,36 +1766,36 @@ discard block |
||
1766 | 1766 | |
1767 | 1767 | if( 'checkbox' === $field->type ) { |
1768 | 1768 | foreach ( $field->get_entry_inputs() as $key => $input ) { |
1769 | - $input_id = $input['id']; |
|
1770 | - $choice = $field->choices[ $key ]; |
|
1771 | - $value = \GV\Utils::get( $this->entry, $input_id ); |
|
1772 | - $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
|
1773 | - if( $match ) { |
|
1774 | - $field->choices[ $key ]['isSelected'] = true; |
|
1775 | - } |
|
1769 | + $input_id = $input['id']; |
|
1770 | + $choice = $field->choices[ $key ]; |
|
1771 | + $value = \GV\Utils::get( $this->entry, $input_id ); |
|
1772 | + $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
|
1773 | + if( $match ) { |
|
1774 | + $field->choices[ $key ]['isSelected'] = true; |
|
1775 | + } |
|
1776 | 1776 | } |
1777 | 1777 | } else { |
1778 | 1778 | |
1779 | 1779 | // We need to run through each field to set the default values |
1780 | 1780 | foreach ( $this->entry as $field_id => $field_value ) { |
1781 | 1781 | |
1782 | - if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
1782 | + if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
1783 | 1783 | |
1784 | - if( 'list' === $field->type ) { |
|
1785 | - $list_rows = maybe_unserialize( $field_value ); |
|
1784 | + if( 'list' === $field->type ) { |
|
1785 | + $list_rows = maybe_unserialize( $field_value ); |
|
1786 | 1786 | |
1787 | - $list_field_value = array(); |
|
1788 | - foreach ( (array) $list_rows as $row ) { |
|
1789 | - foreach ( (array) $row as $column ) { |
|
1790 | - $list_field_value[] = $column; |
|
1791 | - } |
|
1792 | - } |
|
1787 | + $list_field_value = array(); |
|
1788 | + foreach ( (array) $list_rows as $row ) { |
|
1789 | + foreach ( (array) $row as $column ) { |
|
1790 | + $list_field_value[] = $column; |
|
1791 | + } |
|
1792 | + } |
|
1793 | 1793 | |
1794 | - $field->defaultValue = serialize( $list_field_value ); |
|
1795 | - } else { |
|
1796 | - $field->defaultValue = $field_value; |
|
1797 | - } |
|
1798 | - } |
|
1794 | + $field->defaultValue = serialize( $list_field_value ); |
|
1795 | + } else { |
|
1796 | + $field->defaultValue = $field_value; |
|
1797 | + } |
|
1798 | + } |
|
1799 | 1799 | } |
1800 | 1800 | } |
1801 | 1801 | } |
@@ -1852,7 +1852,7 @@ discard block |
||
1852 | 1852 | return $has_conditional_logic; |
1853 | 1853 | } |
1854 | 1854 | |
1855 | - /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */ |
|
1855 | + /** @see GravityView_Edit_Entry_Render::filter_conditional_logic for filter documentation */ |
|
1856 | 1856 | return apply_filters( 'gravityview/edit_entry/conditional_logic', $has_conditional_logic, $form ); |
1857 | 1857 | } |
1858 | 1858 | |
@@ -1919,14 +1919,14 @@ discard block |
||
1919 | 1919 | |
1920 | 1920 | if( $echo && $error !== true ) { |
1921 | 1921 | |
1922 | - $error = esc_html( $error ); |
|
1922 | + $error = esc_html( $error ); |
|
1923 | 1923 | |
1924 | - /** |
|
1925 | - * @since 1.9 |
|
1926 | - */ |
|
1927 | - if ( ! empty( $this->entry ) ) { |
|
1928 | - $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
1929 | - } |
|
1924 | + /** |
|
1925 | + * @since 1.9 |
|
1926 | + */ |
|
1927 | + if ( ! empty( $this->entry ) ) { |
|
1928 | + $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
1929 | + } |
|
1930 | 1930 | |
1931 | 1931 | echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error'); |
1932 | 1932 | } |