Completed
Push — develop ( 38ca32...639841 )
by Zack
20:02
created
future/includes/class-gv-settings-addon.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @return array
102 102
 	 */
103 103
 	public function modify_app_settings_menu_title( $setting_tabs ) {
104
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
104
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
105 105
 		return $setting_tabs;
106 106
 	}
107 107
 
@@ -304,15 +304,15 @@  discard block
 block discarded – undo
304 304
             </ul>
305 305
             <div class="gv-followup widefat">
306 306
                 <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p>
307
-                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea>
307
+                <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea>
308 308
             </div>
309 309
             <div class="scale-description">
310 310
                 <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p>
311 311
                 <ul class="inline">
312 312
 					<?php
313 313
 					$i = 0;
314
-					while( $i < 11 ) {
315
-						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>';
314
+					while ( $i < 11 ) {
315
+						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
316 316
 						$i++;
317 317
 					}
318 318
 					?>
@@ -529,15 +529,15 @@  discard block
 block discarded – undo
529 529
 	 * @return string The HTML
530 530
 	 */
531 531
 	public function as_html( $field, $echo = true ) {
532
-		$field['type']  = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit';
532
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
533 533
 
534 534
 		$attributes    = $this->get_field_attributes( $field );
535 535
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
536
-		$value         = $this->get( $field['name'], $default_value );
536
+		$value         = $this->get( $field[ 'name' ], $default_value );
537 537
 
538 538
 
539
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton';
540
-		$name    = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
539
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton';
540
+		$name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
541 541
 
542 542
 		if ( empty( $value ) ) {
543 543
 			$value = __( 'Update Settings', 'gravityview' );
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 		$attributes = $this->get_field_attributes( $field );
547 547
 
548 548
 		$html = '<input
549
-                    type="' . $field['type'] . '"
549
+                    type="' . $field[ 'type' ] . '"
550 550
                     name="' . esc_attr( $name ) . '"
551 551
                     value="' . $value . '" ' .
552 552
 		        implode( ' ', $attributes ) .
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	public function license_key_notice() {
576 576
 		$license_status = $this->get( 'license_key_status' );
577 577
 		$license_key = $this->get( 'license_key' );
578
-		if( '' === $license_key ) {
578
+		if ( '' === $license_key ) {
579 579
 			$license_status = 'inactive';
580 580
         }
581 581
 		$license_id = empty( $license_key ) ? 'license' : $license_key;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		 * but didn't want to mess up the translation strings for the translators.
588 588
 		 */
589 589
 		$message = mb_substr( $message, 0, mb_strlen( $message ) - 1 );
590
-		$title = __ ( 'Inactive License', 'gravityview');
590
+		$title = __( 'Inactive License', 'gravityview' );
591 591
 		$status = '';
592 592
 		$update_below = false;
593 593
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 				$update_below = __( 'Activate your license key below.', 'gravityview' );
618 618
 				break;
619 619
 		}
620
-		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice';
620
+		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice';
621 621
 
622 622
 		// Show a different notice on settings page for inactive licenses (hide the buttons)
623 623
 		if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) {
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	public function scripts() {
660 660
 		$scripts = parent::scripts();
661 661
 
662
-		$scripts[] = array(
662
+		$scripts[ ] = array(
663 663
 			'handle'  => 'gform_tooltip_init',
664 664
 			'enqueue' => array(
665 665
                 array(
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	public function styles() {
679 679
 		$styles = parent::styles();
680 680
 
681
-		$styles[] = array(
681
+		$styles[ ] = array(
682 682
 			'handle'  => 'gravityview_settings',
683 683
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
684 684
 			'version' => Plugin::$version,
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 		 * If multisite and not network admin, we don't want the settings to show.
710 710
 		 * @since 1.7.6
711 711
 		 */
712
-		$show_submenu = ( ! is_multisite() ) ||  is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
712
+		$show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() );
713 713
 
714 714
 		/**
715 715
 		 * Override whether to show the Settings menu on a per-blog basis.
@@ -757,26 +757,26 @@  discard block
 block discarded – undo
757 757
 				'label' => __( 'License Key', 'gravityview' ),
758 758
 				'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ),
759 759
 				'type' => 'edd_license',
760
-				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' )  && GRAVITYVIEW_LICENSE_KEY ),
760
+				'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ),
761 761
 				'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
762
-				'default_value' => $default_settings['license_key'],
762
+				'default_value' => $default_settings[ 'license_key' ],
763 763
 				'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
764 764
 			),
765 765
 			array(
766 766
 				'name' => 'license_key_response',
767
-				'default_value' => $default_settings['license_key_response'],
767
+				'default_value' => $default_settings[ 'license_key_response' ],
768 768
 				'type' => 'hidden',
769 769
 			),
770 770
 			array(
771 771
 				'name' => 'license_key_status',
772
-				'default_value' => $default_settings['license_key_status'],
772
+				'default_value' => $default_settings[ 'license_key_status' ],
773 773
 				'type' => 'hidden',
774 774
 			),
775 775
 			array(
776 776
 				'name' => 'support-email',
777 777
 				'type' => 'text',
778 778
 				'validate' => 'email',
779
-				'default_value' => $default_settings['support-email'],
779
+				'default_value' => $default_settings[ 'support-email' ],
780 780
 				'label' => __( 'Support Email', 'gravityview' ),
781 781
 				'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
782 782
 				'class' => 'code regular-text',
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 				'name' => 'support_port',
789 789
 				'type' => 'radio',
790 790
 				'label' => __( 'Show Support Port?', 'gravityview' ),
791
-				'default_value' => $default_settings['support_port'],
791
+				'default_value' => $default_settings[ 'support_port' ],
792 792
 				'horizontal' => 1,
793 793
 				'choices' => array(
794 794
 					array(
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 				'name' => 'no-conflict-mode',
808 808
 				'type' => 'radio',
809 809
 				'label' => __( 'No-Conflict Mode', 'gravityview' ),
810
-				'default_value' => $default_settings['no-conflict-mode'],
810
+				'default_value' => $default_settings[ 'no-conflict-mode' ],
811 811
 				'horizontal' => 1,
812 812
 				'choices' => array(
813 813
 					array(
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 					'name' => 'rest_api',
830 830
 					'type' => 'radio',
831 831
 					'label' => __( 'REST API', 'gravityview' ),
832
-					'default_value' => $default_settings['rest_api'],
832
+					'default_value' => $default_settings[ 'rest_api' ],
833 833
 					'horizontal' => 1,
834 834
 					'choices' => array(
835 835
 						array(
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 				'name' => 'beta',
849 849
 				'type' => 'checkbox',
850 850
 				'label' => __( 'Become a Beta Tester', 'gravityview' ),
851
-				'default_value' => $default_settings['beta'],
851
+				'default_value' => $default_settings[ 'beta' ],
852 852
 				'horizontal' => 1,
853 853
 				'choices' => array(
854 854
 					array(
@@ -881,17 +881,17 @@  discard block
 block discarded – undo
881 881
 		 * @since 1.7.4
882 882
 		 */
883 883
 		foreach ( $fields as &$field ) {
884
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
885
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
886
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
887
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
884
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
885
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
886
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
887
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
888 888
 
889 889
 			if ( $disabled_attribute ) {
890
-				$field['disabled']  = $disabled_attribute;
890
+				$field[ 'disabled' ] = $disabled_attribute;
891 891
 			}
892 892
 
893
-			if ( empty( $field['disabled'] ) ) {
894
-				unset( $field['disabled'] );
893
+			if ( empty( $field[ 'disabled' ] ) ) {
894
+				unset( $field[ 'disabled' ] );
895 895
             }
896 896
 		}
897 897
 
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
         );
910 910
 
911 911
 		if ( $disabled_attribute ) {
912
-			$button['disabled'] = $disabled_attribute;
912
+			$button[ 'disabled' ] = $disabled_attribute;
913 913
 		}
914 914
 
915 915
         /**
@@ -928,20 +928,20 @@  discard block
 block discarded – undo
928 928
 		// If there are extensions, add a section for them
929 929
 		if ( ! empty( $extension_sections ) ) {
930 930
 
931
-			if( $disabled_attribute ) {
931
+			if ( $disabled_attribute ) {
932 932
 				foreach ( $extension_sections as &$section ) {
933
-					foreach ( $section['fields'] as &$field ) {
934
-						$field['disabled'] = $disabled_attribute;
933
+					foreach ( $section[ 'fields' ] as &$field ) {
934
+						$field[ 'disabled' ] = $disabled_attribute;
935 935
 					}
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 943
             // add the 'update settings' button to the general section
944
-            $sections[0]['fields'][] = $button;
944
+            $sections[ 0 ][ 'fields' ][ ] = $button;
945 945
         }
946 946
 
947 947
 		return $sections;
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 	protected function settings_edd_license( $field, $echo = true ) {
998 998
 
999 999
 	    if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1000
-		    $field['input_type'] = 'password';
1000
+		    $field[ 'input_type' ] = 'password';
1001 1001
         }
1002 1002
 
1003 1003
 		$text = $this->settings_text( $field, false );
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 	public function single_setting_row_html( $field ) {
1047 1047
 		?>
1048 1048
 
1049
-        <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1049
+        <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1050 1050
             <td colspan="2">
1051 1051
 				<?php $this->single_setting( $field ); ?>
1052 1052
             </td>
@@ -1064,10 +1064,10 @@  discard block
 block discarded – undo
1064 1064
 	 * @return string
1065 1065
 	 */
1066 1066
 	public function settings_save( $field, $echo = true ) {
1067
-		$field['type']  = 'submit';
1068
-		$field['name']  = 'gform-settings-save';
1069
-		$field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton';
1070
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1067
+		$field[ 'type' ]  = 'submit';
1068
+		$field[ 'name' ]  = 'gform-settings-save';
1069
+		$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton';
1070
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
1071 1071
 
1072 1072
 		$output = $this->settings_submit( $field, false );
1073 1073
 
@@ -1098,8 +1098,8 @@  discard block
 block discarded – undo
1098 1098
      * @return void
1099 1099
 	 */
1100 1100
 	public function single_setting_row( $field ) {
1101
-		$field['gv_description'] = Utils::get( $field, 'description' );
1102
-		$field['description']    = Utils::get( $field, 'subtitle' );
1101
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1102
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1103 1103
 		parent::single_setting_row( $field );
1104 1104
 	}
1105 1105
 
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 	public function single_setting_label( $field ) {
1112 1112
 		parent::single_setting_label( $field );
1113 1113
 		if ( $description = Utils::get( $field, 'gv_description' ) ) {
1114
-			echo '<span class="description">'. $description .'</span>';
1114
+			echo '<span class="description">' . $description . '</span>';
1115 1115
 		}
1116 1116
 	}
1117 1117
 
@@ -1148,9 +1148,9 @@  discard block
 block discarded – undo
1148 1148
 		// If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response),
1149 1149
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1150 1150
 		if ( $local_key !== $response_key ) {
1151
-			unset( $posted_settings['license_key_response'] );
1152
-			unset( $posted_settings['license_key_status'] );
1153
-			\GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1151
+			unset( $posted_settings[ 'license_key_response' ] );
1152
+			unset( $posted_settings[ 'license_key_status' ] );
1153
+			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1154 1154
 		}
1155 1155
 		return $posted_settings;
1156 1156
 	}
Please login to merge, or discard this patch.