Completed
Push — develop ( 65380d...805254 )
by Zack
17:56
created
future/includes/class-gv-settings-addon.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
                     type="' . $field['type'] . '"
559 559
                     name="' . esc_attr( $name ) . '"
560 560
                     value="' . $value . '" ' .
561
-		        implode( ' ', $attributes ) .
562
-		        ' />';
561
+				implode( ' ', $attributes ) .
562
+				' />';
563 563
 
564 564
 		if ( $echo ) {
565 565
 			echo $html;
@@ -577,12 +577,12 @@  discard block
 block discarded – undo
577 577
 	}
578 578
 
579 579
 	/**
580
-     * Check whether GravityView is being saved
581
-     *
582
-     * The generic is_save_postback() is true for all addons
583
-     *
584
-     * @since 2.0.8
585
-     *
580
+	 * Check whether GravityView is being saved
581
+	 *
582
+	 * The generic is_save_postback() is true for all addons
583
+	 *
584
+	 * @since 2.0.8
585
+	 *
586 586
 	 * @return bool
587 587
 	 */
588 588
 	public function is_save_postback() {
@@ -596,16 +596,16 @@  discard block
 block discarded – undo
596 596
 	 */
597 597
 	public function license_key_notice() {
598 598
 
599
-	    if( $this->is_save_postback() ) {
600
-		    $settings = $this->get_posted_settings();
601
-		    $license_key = \GV\Utils::get( $settings, 'license_key' );
602
-		    $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
603
-        } else {
604
-		    $license_status = $this->get( 'license_key_status', 'inactive' );
605
-		    $license_key    = $this->get( 'license_key' );
606
-	    }
599
+		if( $this->is_save_postback() ) {
600
+			$settings = $this->get_posted_settings();
601
+			$license_key = \GV\Utils::get( $settings, 'license_key' );
602
+			$license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' );
603
+		} else {
604
+			$license_status = $this->get( 'license_key_status', 'inactive' );
605
+			$license_key    = $this->get( 'license_key' );
606
+		}
607 607
 
608
-	    $license_id = empty( $license_key ) ? 'license' : $license_key;
608
+		$license_id = empty( $license_key ) ? 'license' : $license_key;
609 609
 
610 610
 		$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' );
611 611
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 		$update_below = false;
623 623
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
624 624
 
625
-        switch ( $license_status ) {
625
+		switch ( $license_status ) {
626 626
 			/** @since 1.17 */
627 627
 			case 'expired':
628 628
 				$title = __( 'Expired License', 'gravityview' );
@@ -660,13 +660,13 @@  discard block
 block discarded – undo
660 660
 			return;
661 661
 		}
662 662
 
663
-        \GravityView_Admin_Notices::add_notice( array(
664
-            'message' => $message,
665
-            'class'   => 'notice notice-warning',
666
-            'title'   => $title,
667
-            'cap'     => 'gravityview_edit_settings',
668
-            'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
669
-        ) );
663
+		\GravityView_Admin_Notices::add_notice( array(
664
+			'message' => $message,
665
+			'class'   => 'notice notice-warning',
666
+			'title'   => $title,
667
+			'cap'     => 'gravityview_edit_settings',
668
+			'dismiss' => sha1( $license_status . '_' . $license_id . '_' . date( 'z' ) ), // Show every day, instead of every 8 weeks (which is the default)
669
+		) );
670 670
 	}
671 671
 
672 672
 	/**
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 	}
681 681
 
682 682
 	/**
683
-     * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
684
-     *
685
-     * @since 1.21.5
686
-     *
687
-     * @see GFAddOn::scripts()
688
-     *
683
+	 * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason.
684
+	 *
685
+	 * @since 1.21.5
686
+	 *
687
+	 * @see GFAddOn::scripts()
688
+	 *
689 689
 	 * @return array Array of scripts
690 690
 	 */
691 691
 	public function scripts() {
@@ -694,10 +694,10 @@  discard block
 block discarded – undo
694 694
 		$scripts[] = array(
695 695
 			'handle'  => 'gform_tooltip_init',
696 696
 			'enqueue' => array(
697
-                array(
698
-			        'admin_page' => array( 'app_settings' )
699
-                )
700
-            )
697
+				array(
698
+					'admin_page' => array( 'app_settings' )
699
+				)
700
+			)
701 701
 		);
702 702
 
703 703
 		return $scripts;
@@ -715,10 +715,10 @@  discard block
 block discarded – undo
715 715
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
716 716
 			'version' => Plugin::$version,
717 717
 			'deps' => array(
718
-                'gform_admin',
718
+				'gform_admin',
719 719
 				'gaddon_form_settings_css',
720
-                'gform_tooltip',
721
-                'gform_font_awesome',
720
+				'gform_tooltip',
721
+				'gform_font_awesome',
722 722
 			),
723 723
 			'enqueue' => array(
724 724
 				array( 'admin_page' => array(
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 					array(
887 887
 						'label' => esc_html__( 'Show me beta versions if they are available.', 'gravityview' ),
888 888
 						'value' => '1',
889
-                        'name'  => 'beta',
889
+						'name'  => 'beta',
890 890
 					),
891 891
 				),
892 892
 				'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' ),
@@ -924,38 +924,38 @@  discard block
 block discarded – undo
924 924
 
925 925
 			if ( empty( $field['disabled'] ) ) {
926 926
 				unset( $field['disabled'] );
927
-            }
927
+			}
928 928
 		}
929 929
 
930
-        $sections = array(
931
-            array(
932
-                'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
933
-                'fields'      => $fields,
934
-            )
935
-        );
930
+		$sections = array(
931
+			array(
932
+				'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), Plugin::$version ) ),
933
+				'fields'      => $fields,
934
+			)
935
+		);
936 936
 
937
-        // custom 'update settings' button
938
-        $button = array(
939
-            'class' => 'button button-primary button-hero',
940
-            'type' => 'save',
941
-        );
937
+		// custom 'update settings' button
938
+		$button = array(
939
+			'class' => 'button button-primary button-hero',
940
+			'type' => 'save',
941
+		);
942 942
 
943 943
 		if ( $disabled_attribute ) {
944 944
 			$button['disabled'] = $disabled_attribute;
945 945
 		}
946 946
 
947
-        /**
948
-         * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
949
-         * Extensions can tap in here to insert their own section and settings.
950
-         * <code>
951
-         *   $sections[] = array(
952
-         *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
953
-         *      'fields' => $settings,
954
-         *   );
955
-         * </code>
956
-         * @param array $extension_settings Empty array, ready for extension settings!
957
-         */
958
-        $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
947
+		/**
948
+		 * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page
949
+		 * Extensions can tap in here to insert their own section and settings.
950
+		 * <code>
951
+		 *   $sections[] = array(
952
+		 *      'title' => __( 'GravityView My Extension Settings', 'gravityview' ),
953
+		 *      'fields' => $settings,
954
+		 *   );
955
+		 * </code>
956
+		 * @param array $extension_settings Empty array, ready for extension settings!
957
+		 */
958
+		$extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() );
959 959
 
960 960
 		// If there are extensions, add a section for them
961 961
 		if ( ! empty( $extension_sections ) ) {
@@ -968,13 +968,13 @@  discard block
 block discarded – undo
968 968
 				}
969 969
 			}
970 970
 
971
-            $k = count( $extension_sections ) - 1 ;
972
-            $extension_sections[ $k ]['fields'][] = $button;
971
+			$k = count( $extension_sections ) - 1 ;
972
+			$extension_sections[ $k ]['fields'][] = $button;
973 973
 			$sections = array_merge( $sections, $extension_sections );
974 974
 		} else {
975
-            // add the 'update settings' button to the general section
976
-            $sections[0]['fields'][] = $button;
977
-        }
975
+			// add the 'update settings' button to the general section
976
+			$sections[0]['fields'][] = $button;
977
+		}
978 978
 
979 979
 		return $sections;
980 980
 	}
@@ -1028,9 +1028,9 @@  discard block
 block discarded – undo
1028 1028
 	 */
1029 1029
 	protected function settings_edd_license( $field, $echo = true ) {
1030 1030
 
1031
-	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1032
-		    $field['input_type'] = 'password';
1033
-        }
1031
+		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1032
+			$field['input_type'] = 'password';
1033
+		}
1034 1034
 
1035 1035
 		$text = $this->settings_text( $field, false );
1036 1036
 
@@ -1047,9 +1047,9 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 	/**
1049 1049
 	 * Allow pure HTML settings row
1050
-     *
1051
-     * @since 2.0.6
1052
-     *
1050
+	 *
1051
+	 * @since 2.0.6
1052
+	 *
1053 1053
 	 * @param array $field
1054 1054
 	 * @param bool $echo Whether to echo the
1055 1055
 	 *
@@ -1115,19 +1115,19 @@  discard block
 block discarded – undo
1115 1115
 	}
1116 1116
 
1117 1117
 	/**
1118
-     * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1119
-     *
1120
-     * Converts `$field['description']` to `$field['gv_description']`
1121
-     * Converts `$field['subtitle']` to `$field['description']`
1122
-     *
1123
-     * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1124
-     * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1125
-     *
1126
-     * @since 1.21.5.2
1127
-     *
1118
+	 * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it
1119
+	 *
1120
+	 * Converts `$field['description']` to `$field['gv_description']`
1121
+	 * Converts `$field['subtitle']` to `$field['description']`
1122
+	 *
1123
+	 * @see \GV\Addon_Settings::single_setting_label Converts `gv_description` back to `description`
1124
+	 * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description
1125
+	 *
1126
+	 * @since 1.21.5.2
1127
+	 *
1128 1128
 	 * @param array $field
1129
-     *
1130
-     * @return void
1129
+	 *
1130
+	 * @return void
1131 1131
 	 */
1132 1132
 	public function single_setting_row( $field ) {
1133 1133
 		$field['gv_description'] = Utils::get( $field, 'description' );
Please login to merge, or discard this patch.