Completed
Push — develop ( 38ca32...639841 )
by Zack
20:02
created
future/includes/class-gv-settings-addon.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -138,20 +138,20 @@  discard block
 block discarded – undo
138 138
 	}
139 139
 
140 140
 	/**
141
-     * Uninstall all traces of GravityView
142
-     *
143
-     * Note: method is public because parent method is public
144
-     *
141
+	 * Uninstall all traces of GravityView
142
+	 *
143
+	 * Note: method is public because parent method is public
144
+	 *
145 145
 	 * @return bool
146 146
 	 */
147 147
 	public function uninstall() {
148 148
 		gravityview()->plugin->uninstall();
149 149
 
150 150
 		/**
151
-         * Set the path so that Gravity Forms can de-activate GravityView
152
-         * @see GFAddOn::uninstall_addon
153
-         * @uses deactivate_plugins()
154
-         */
151
+		 * Set the path so that Gravity Forms can de-activate GravityView
152
+		 * @see GFAddOn::uninstall_addon
153
+		 * @uses deactivate_plugins()
154
+		 */
155 155
 		$this->_path = GRAVITYVIEW_FILE;
156 156
 
157 157
 		return true;
@@ -181,42 +181,42 @@  discard block
 block discarded – undo
181 181
 	}
182 182
 
183 183
 	/**
184
-     * Get an array of reasons why the plugin might be uninstalled
185
-     *
186
-     * @since 1.17.5
187
-     *
184
+	 * Get an array of reasons why the plugin might be uninstalled
185
+	 *
186
+	 * @since 1.17.5
187
+	 *
188 188
 	 * @return array Array of reasons with the label and followup questions for each uninstall reason
189 189
 	 */
190 190
 	private function get_uninstall_reasons() {
191 191
 		$reasons = array(
192 192
 			'will-continue' => array(
193
-                'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
194
-            ),
193
+				'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ),
194
+			),
195 195
 			'no-longer-need' => array(
196
-                'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
197
-            ),
196
+				'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ),
197
+			),
198 198
 			'doesnt-work' => array(
199
-                'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
200
-            ),
199
+				'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ),
200
+			),
201 201
 			'found-other' => array(
202
-                'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
203
-                'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
204
-            ),
202
+				'label' => esc_html__( 'I found a better plugin', 'gravityview' ),
203
+				'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ),
204
+			),
205 205
 			'other' => array(
206
-                'label' => esc_html__( 'Other', 'gravityview' ),
207
-            ),
206
+				'label' => esc_html__( 'Other', 'gravityview' ),
207
+			),
208 208
 		);
209 209
 
210 210
 		shuffle( $reasons );
211 211
 
212 212
 		return $reasons;
213
-    }
213
+	}
214 214
 
215 215
 	/**
216
-     * Display a feedback form when the plugin is uninstalled
217
-     *
218
-     * @since 1.17.5
219
-     *
216
+	 * Display a feedback form when the plugin is uninstalled
217
+	 *
218
+	 * @since 1.17.5
219
+	 *
220 220
 	 * @return string HTML of the uninstallation form
221 221
 	 */
222 222
 	public function uninstall_form() {
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2>
297 297
             <ul>
298 298
 				<?php
299
-                $reasons = $this->get_uninstall_reasons();
299
+				$reasons = $this->get_uninstall_reasons();
300 300
 				foreach ( $reasons as $reason ) {
301 301
 					printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', Utils::get( $reason, 'followup' ), Utils::get( $reason, 'label' ) );
302 302
 				}
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
 	}
391 391
 
392 392
 	public function app_settings_tab() {
393
-	    parent::app_settings_tab();
393
+		parent::app_settings_tab();
394 394
 
395 395
 		if ( $this->maybe_uninstall() ) {
396
-            echo $this->uninstall_form();
396
+			echo $this->uninstall_form();
397 397
 		}
398
-    }
398
+	}
399 399
 
400 400
 	/**
401 401
 	 * The Settings title
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	 * @return array The settings.
481 481
 	 */
482 482
 	public function all() {
483
-	    return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() );
483
+		return wp_parse_args( get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', array() ), $this->defaults() );
484 484
 	}
485 485
 
486 486
 	/**
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
                     type="' . $field['type'] . '"
550 550
                     name="' . esc_attr( $name ) . '"
551 551
                     value="' . $value . '" ' .
552
-		        implode( ' ', $attributes ) .
553
-		        ' />';
552
+				implode( ' ', $attributes ) .
553
+				' />';
554 554
 
555 555
 		if ( $echo ) {
556 556
 			echo $html;
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 		$license_key = $this->get( 'license_key' );
578 578
 		if( '' === $license_key ) {
579 579
 			$license_status = 'inactive';
580
-        }
580
+		}
581 581
 		$license_id = empty( $license_key ) ? 'license' : $license_key;
582 582
 
583 583
 		$message = esc_html__( 'Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' );
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		$update_below = false;
593 593
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
594 594
 
595
-        switch ( $license_status ) {
595
+		switch ( $license_status ) {
596 596
 			/** @since 1.17 */
597 597
 			case 'expired':
598 598
 				$title = __( 'Expired License', 'gravityview' );
@@ -648,12 +648,12 @@  discard block
 block discarded – undo
648 648
 	}
649 649
 
650 650
 	/**
651
-     * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
652
-     *
653
-     * @since 1.21.5
654
-     *
655
-     * @see GFAddOn::scripts()
656
-     *
651
+	 * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
652
+	 *
653
+	 * @since 1.21.5
654
+	 *
655
+	 * @see GFAddOn::scripts()
656
+	 *
657 657
 	 * @return array Array of scripts
658 658
 	 */
659 659
 	public function scripts() {
@@ -662,10 +662,10 @@  discard block
 block discarded – undo
662 662
 		$scripts[] = array(
663 663
 			'handle'  => 'gform_tooltip_init',
664 664
 			'enqueue' => array(
665
-                array(
666
-			        'admin_page' => array( 'app_settings' )
667
-                )
668
-            )
665
+				array(
666
+					'admin_page' => array( 'app_settings' )
667
+				)
668
+			)
669 669
 		);
670 670
 
671 671
 		return $scripts;
@@ -683,10 +683,10 @@  discard block
 block discarded – undo
683 683
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
684 684
 			'version' => Plugin::$version,
685 685
 			'deps' => array(
686
-                'gform_admin',
686
+				'gform_admin',
687 687
 				'gaddon_form_settings_css',
688
-                'gform_tooltip',
689
-                'gform_font_awesome',
688
+				'gform_tooltip',
689
+				'gform_font_awesome',
690 690
 			),
691 691
 			'enqueue' => array(
692 692
 				array( 'admin_page' => array(
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 					array(
855 855
 						'label' => _x( 'Show me beta versions if they are available.', 'gravityview' ),
856 856
 						'value' => '1',
857
-                        'name'  => 'beta',
857
+						'name'  => 'beta',
858 858
 					),
859 859
 				),
860 860
 				'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' ),
@@ -892,38 +892,38 @@  discard block
 block discarded – undo
892 892
 
893 893
 			if ( empty( $field['disabled'] ) ) {
894 894
 				unset( $field['disabled'] );
895
-            }
895
+			}
896 896
 		}
897 897
 
898
-        $sections = array(
899
-            array(
900
-                'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
901
-                'fields'      => $fields,
902
-            )
903
-        );
898
+		$sections = array(
899
+			array(
900
+				'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
901
+				'fields'      => $fields,
902
+			)
903
+		);
904 904
 
905
-        // custom 'update settings' button
906
-        $button = array(
907
-            'class' => 'button button-primary button-hero',
908
-            'type' => 'save',
909
-        );
905
+		// custom 'update settings' button
906
+		$button = array(
907
+			'class' => 'button button-primary button-hero',
908
+			'type' => 'save',
909
+		);
910 910
 
911 911
 		if ( $disabled_attribute ) {
912 912
 			$button['disabled'] = $disabled_attribute;
913 913
 		}
914 914
 
915
-        /**
916
-         * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
917
-         * Extensions can tap in here to insert their own section and settings.
918
-         * <code>
919
-         *   $sections[] = array(
920
-         *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
921
-         *      'fields' => $settings,
922
-         *   );
923
-         * </code>
924
-         * @param array $extension_settings Empty array, ready for extension settings!
925
-         */
926
-        $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
915
+		/**
916
+		 * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
917
+		 * Extensions can tap in here to insert their own section and settings.
918
+		 * <code>
919
+		 *   $sections[] = array(
920
+		 *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
921
+		 *      'fields' => $settings,
922
+		 *   );
923
+		 * </code>
924
+		 * @param array $extension_settings Empty array, ready for extension settings!
925
+		 */
926
+		$extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
927 927
 
928 928
 		// If there are extensions, add a section for them
929 929
 		if ( ! empty( $extension_sections ) ) {
@@ -936,13 +936,13 @@  discard block
 block discarded – undo
936 936
 				}
937 937
 			}
938 938
 
939
-            $k = count( $extension_sections ) - 1 ;
940
-            $extension_sections[ $k ]['fields'][] = $button;
939
+			$k = count( $extension_sections ) - 1 ;
940
+			$extension_sections[ $k ]['fields'][] = $button;
941 941
 			$sections = array_merge( $sections, $extension_sections );
942 942
 		} else {
943
-            // add the 'update settings' button to the general section
944
-            $sections[0]['fields'][] = $button;
945
-        }
943
+			// add the 'update settings' button to the general section
944
+			$sections[0]['fields'][] = $button;
945
+		}
946 946
 
947 947
 		return $sections;
948 948
 	}
@@ -996,9 +996,9 @@  discard block
 block discarded – undo
996 996
 	 */
997 997
 	protected function settings_edd_license( $field, $echo = true ) {
998 998
 
999
-	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1000
-		    $field['input_type'] = 'password';
1001
-        }
999
+		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1000
+			$field['input_type'] = 'password';
1001
+		}
1002 1002
 
1003 1003
 		$text = $this->settings_text( $field, false );
1004 1004
 
@@ -1015,9 +1015,9 @@  discard block
 block discarded – undo
1015 1015
 
1016 1016
 	/**
1017 1017
 	 * Allow pure HTML settings row
1018
-     *
1019
-     * @since 2.0.6
1020
-     *
1018
+	 *
1019
+	 * @since 2.0.6
1020
+	 *
1021 1021
 	 * @param array $field
1022 1022
 	 * @param bool $echo Whether to echo the
1023 1023
 	 *
@@ -1083,19 +1083,19 @@  discard block
 block discarded – undo
1083 1083
 	}
1084 1084
 
1085 1085
 	/**
1086
-     * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1087
-     *
1088
-     * Converts `$field['description']` to `$field['gv_description']`
1089
-     * Converts `$field['subtitle']` to `$field['description']`
1090
-     *
1091
-     * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1092
-     * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1093
-     *
1094
-     * @since 1.21.5.2
1095
-     *
1086
+	 * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1087
+	 *
1088
+	 * Converts `$field['description']` to `$field['gv_description']`
1089
+	 * Converts `$field['subtitle']` to `$field['description']`
1090
+	 *
1091
+	 * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1092
+	 * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1093
+	 *
1094
+	 * @since 1.21.5.2
1095
+	 *
1096 1096
 	 * @param array $field
1097
-     *
1098
-     * @return void
1097
+	 *
1098
+	 * @return void
1099 1099
 	 */
1100 1100
 	public function single_setting_row( $field ) {
1101 1101
 		$field['gv_description'] = Utils::get( $field, 'description' );
Please login to merge, or discard this patch.