Completed
Push — update_code ( 1c6085...fdf31b )
by Armando
02:16
created
lib/class-options.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	 * @var array
28 28
 	 */
29 29
 	private static $_default_options = [
30
-		'aspects_list'       => [],
31
-		'services_list'      => [],
30
+		'aspects_list'       => [ ],
31
+		'services_list'      => [ ],
32 32
 		'post_to_diaspora'   => true,
33 33
 		'enabled_post_types' => [ 'post' ],
34 34
 		'fullentrylink'      => true,
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		'tags_to_post'       => [ 'global', 'custom', 'post' ],
37 37
 		'global_tags'        => '',
38 38
 		'aspects'            => [ 'public' ],
39
-		'services'           => [],
39
+		'services'           => [ ],
40 40
 		'version'            => WP2D_VERSION,
41 41
 	];
42 42
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @return string Return the currently selected tab.
106 106
 	 */
107 107
 	private function _current_tab( $default = 'defaults' ) {
108
-		$tab = ( isset ( $_GET['tab'] ) ? $_GET['tab'] : $default );
108
+		$tab = ( isset ( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : $default );
109 109
 
110 110
 		// If the pod settings aren't configured yet, open the 'Setup' tab.
111 111
 		if ( ! $this->is_pod_set_up() ) {
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	private function _options_page_tabs( $return = false ) {
126 126
 		// The array defining all options sections to be shown as tabs.
127
-		$tabs = [];
127
+		$tabs = [ ];
128 128
 		if ( $this->is_pod_set_up() ) {
129
-			$tabs['defaults'] = __( 'Defaults', 'wp-to-diaspora' );
129
+			$tabs[ 'defaults' ] = __( 'Defaults', 'wp-to-diaspora' );
130 130
 		}
131 131
 
132 132
 		// Add the 'Setup' tab to the end of the list.
133
-		$tabs['setup'] = __( 'Setup', 'wp-to-diaspora' ) . '<span id="pod-connection-status" class="dashicons-before hidden"></span><span class="spinner"></span>';
133
+		$tabs[ 'setup' ] = __( 'Setup', 'wp-to-diaspora' ) . '<span id="pod-connection-status" class="dashicons-before hidden"></span><span class="spinner"></span>';
134 134
 
135 135
 		// Container for all options tabs.
136 136
 		$out = '<h2 id="options-tabs" class="nav-tab-wrapper">';
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			return $tabs;
149 149
 		}
150 150
 
151
-		return [];
151
+		return [ ];
152 152
 	}
153 153
 
154 154
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				do_settings_sections( 'wp_to_diaspora_settings' );
225 225
 
226 226
 				// Get the name of the current tab, if set, else take the first one from the list.
227
-				$tab = $this->_current_tab( $page_tabs[0] );
227
+				$tab = $this->_current_tab( $page_tabs[ 0 ] );
228 228
 
229 229
 				// Add Save and Reset buttons.
230 230
 				echo '<input id="submit-' . esc_attr( $tab ) . '" name="wp_to_diaspora_settings[submit_' . esc_attr( $tab ) . ']" type="submit" class="button-primary" value="' . esc_attr__( 'Save Changes' ) . '" />&nbsp;';
@@ -665,14 +665,14 @@  discard block
 block discarded – undo
665 665
 					esc_url( 'https://' . $this->get_option( 'pod' ) . '/services' ),
666 666
 					esc_html__( 'Show available services on my pod.', 'wp-to-diaspora' )
667 667
 				);
668
-				$empty_label    = esc_html__( 'No services connected yet.', 'wp-to-diaspora' );
668
+				$empty_label = esc_html__( 'No services connected yet.', 'wp-to-diaspora' );
669 669
 				break;
670 670
 
671 671
 			default:
672 672
 				return;
673 673
 		}
674 674
 
675
-		$items = array_filter( (array) $items ) ?: [];
675
+		$items = array_filter( (array) $items ) ? : [ ];
676 676
 
677 677
 		// Special case for this field if it's displayed on the settings page.
678 678
 		$on_settings_page = ( 'settings_page_wp_to_diaspora' === get_current_screen()->id );
@@ -805,30 +805,30 @@  discard block
 block discarded – undo
805 805
 		/* Validate all settings before saving to the database. */
806 806
 
807 807
 		// Saving the pod setup details.
808
-		if ( isset( $input['submit_setup'] ) ) {
809
-			$input['pod']      = trim( sanitize_text_field( $input['pod'] ), ' /' );
810
-			$input['username'] = sanitize_text_field( $input['username'] );
811
-			$input['password'] = sanitize_text_field( $input['password'] );
808
+		if ( isset( $input[ 'submit_setup' ] ) ) {
809
+			$input[ 'pod' ]      = trim( sanitize_text_field( $input[ 'pod' ] ), ' /' );
810
+			$input[ 'username' ] = sanitize_text_field( $input[ 'username' ] );
811
+			$input[ 'password' ] = sanitize_text_field( $input[ 'password' ] );
812 812
 
813 813
 			// If password is blank, it hasn't been changed.
814 814
 			// If new password is equal to the encrypted password already saved, it was just passed again. It happens everytime update_option('wp_to_diaspora_settings') is called.
815
-			if ( '' === $input['password'] || $this->get_option( 'password' ) === $input['password'] ) {
816
-				$input['password'] = $this->get_option( 'password' );
815
+			if ( '' === $input[ 'password' ] || $this->get_option( 'password' ) === $input[ 'password' ] ) {
816
+				$input[ 'password' ] = $this->get_option( 'password' );
817 817
 			} else {
818
-				$input['password'] = WP2D_Helpers::encrypt( $input['password'] );
818
+				$input[ 'password' ] = WP2D_Helpers::encrypt( $input[ 'password' ] );
819 819
 			}
820 820
 
821 821
 			// This is for when JS in not enabled, to make sure that the aspects and services
822 822
 			// are refetched when displaying the options page after saving.
823
-			if ( isset( $input['no_js'] ) ) {
823
+			if ( isset( $input[ 'no_js' ] ) ) {
824 824
 				set_transient( 'wp2d_no_js_force_refetch', true );
825 825
 			}
826 826
 		}
827 827
 
828 828
 		// Saving the default options.
829
-		if ( isset( $input['submit_defaults'] ) ) {
830
-			if ( ! isset( $input['enabled_post_types'] ) ) {
831
-				$input['enabled_post_types'] = [];
829
+		if ( isset( $input[ 'submit_defaults' ] ) ) {
830
+			if ( ! isset( $input[ 'enabled_post_types' ] ) ) {
831
+				$input[ 'enabled_post_types' ] = [ ];
832 832
 			}
833 833
 
834 834
 			// Checkboxes.
@@ -841,26 +841,26 @@  discard block
 block discarded – undo
841 841
 			$this->validate_multi_selects( 'tags_to_post', $input );
842 842
 
843 843
 			// Get unique, non-empty, trimmed tags and clean them up.
844
-			$this->validate_tags( $input['global_tags'] );
844
+			$this->validate_tags( $input[ 'global_tags' ] );
845 845
 
846 846
 			// Clean up the list of aspects. If the list is empty, only use the 'Public' aspect.
847
-			$this->validate_aspects_services( $input['aspects'], [ 'public' ] );
847
+			$this->validate_aspects_services( $input[ 'aspects' ], [ 'public' ] );
848 848
 
849 849
 			// Clean up the list of services.
850
-			$this->validate_aspects_services( $input['services'] );
850
+			$this->validate_aspects_services( $input[ 'services' ] );
851 851
 		}
852 852
 
853 853
 		// Reset to defaults.
854
-		if ( isset( $input['reset_defaults'] ) ) {
854
+		if ( isset( $input[ 'reset_defaults' ] ) ) {
855 855
 			// Set the input to the default options.
856 856
 			$input = self::$_default_options;
857 857
 
858 858
 			// Don't reset the fetched lists of aspects and services.
859
-			unset( $input['pod_list'], $input['aspects_list'], $input['services_list'] );
859
+			unset( $input[ 'pod_list' ], $input[ 'aspects_list' ], $input[ 'services_list' ] );
860 860
 		}
861 861
 
862 862
 		// Unset all unused input fields.
863
-		unset( $input['submit_defaults'], $input['reset_defaults'], $input['submit_setup'] );
863
+		unset( $input[ 'submit_defaults' ], $input[ 'reset_defaults' ], $input[ 'submit_setup' ] );
864 864
 
865 865
 		// Parse inputs with default options and return.
866 866
 		return wp_parse_args( $input, array_merge( self::$_default_options, self::$_options ) );
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 					}
919 919
 				}
920 920
 			} else {
921
-				$options[ $select ] = [];
921
+				$options[ $select ] = [ ];
922 922
 			}
923 923
 		}
924 924
 
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 	 *
968 968
 	 * @return array The validated list of aspects or services.
969 969
 	 */
970
-	public function validate_aspects_services( &$aspects_services, array $default = [] ) {
970
+	public function validate_aspects_services( &$aspects_services, array $default = [ ] ) {
971 971
 		if ( empty( $aspects_services ) || ! is_array( $aspects_services ) ) {
972 972
 			$aspects_services = $default;
973 973
 		} else {
Please login to merge, or discard this patch.
lib/class-contextual-help.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -255,7 +255,7 @@
 block discarded – undo
255 255
 	public static function get_help_tab_quick_link( $error ) {
256 256
 		$help_tab = '';
257 257
 		if ( is_wp_error( $error ) && ( $error_data = $error->get_error_data() ) && array_key_exists( 'help_tab', $error_data ) ) {
258
-			$help_tab = $error_data['help_tab'];
258
+			$help_tab = $error_data[ 'help_tab' ];
259 259
 		} elseif ( is_string( $error ) ) {
260 260
 			$help_tab = $error;
261 261
 		}
Please login to merge, or discard this patch.