| @@ -27,8 +27,8 @@ discard block | ||
| 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 | ||
| 36 | 36 | 'tags_to_post' => [ 'global', 'custom', 'post' ], | 
| 37 | 37 | 'global_tags' => '', | 
| 38 | 38 | 'aspects' => [ 'public' ], | 
| 39 | - 'services' => [], | |
| 39 | + 'services' => [ ], | |
| 40 | 40 | 'auth_key_hash' => '', | 
| 41 | 41 | 'version' => WP2D_VERSION, | 
| 42 | 42 | ]; | 
| @@ -106,7 +106,7 @@ discard block | ||
| 106 | 106 | * @return string Return the currently selected tab. | 
| 107 | 107 | */ | 
| 108 | 108 |  	private function _current_tab( $default = 'defaults' ) { | 
| 109 | - $tab = ( isset ( $_GET['tab'] ) ? $_GET['tab'] : $default ); | |
| 109 | + $tab = ( isset ( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : $default ); | |
| 110 | 110 | |
| 111 | 111 | // If the pod settings aren't configured yet, open the 'Setup' tab. | 
| 112 | 112 |  		if ( ! $this->is_pod_set_up() ) { | 
| @@ -125,13 +125,13 @@ discard block | ||
| 125 | 125 | */ | 
| 126 | 126 |  	private function _options_page_tabs( $return = false ) { | 
| 127 | 127 | // The array defining all options sections to be shown as tabs. | 
| 128 | - $tabs = []; | |
| 128 | + $tabs = [ ]; | |
| 129 | 129 |  		if ( $this->is_pod_set_up() ) { | 
| 130 | - $tabs['defaults'] = __( 'Defaults', 'wp-to-diaspora' ); | |
| 130 | + $tabs[ 'defaults' ] = __( 'Defaults', 'wp-to-diaspora' ); | |
| 131 | 131 | } | 
| 132 | 132 | |
| 133 | 133 | // Add the 'Setup' tab to the end of the list. | 
| 134 | - $tabs['setup'] = __( 'Setup', 'wp-to-diaspora' ) . '<span id="pod-connection-status" class="dashicons-before hidden"></span><span class="spinner"></span>'; | |
| 134 | + $tabs[ 'setup' ] = __( 'Setup', 'wp-to-diaspora' ) . '<span id="pod-connection-status" class="dashicons-before hidden"></span><span class="spinner"></span>'; | |
| 135 | 135 | |
| 136 | 136 | // Container for all options tabs. | 
| 137 | 137 | $out = '<h2 id="options-tabs" class="nav-tab-wrapper">'; | 
| @@ -149,7 +149,7 @@ discard block | ||
| 149 | 149 | return $tabs; | 
| 150 | 150 | } | 
| 151 | 151 | |
| 152 | - return []; | |
| 152 | + return [ ]; | |
| 153 | 153 | } | 
| 154 | 154 | |
| 155 | 155 | |
| @@ -225,7 +225,7 @@ discard block | ||
| 225 | 225 | do_settings_sections( 'wp_to_diaspora_settings' ); | 
| 226 | 226 | |
| 227 | 227 | // Get the name of the current tab, if set, else take the first one from the list. | 
| 228 | - $tab = $this->_current_tab( $page_tabs[0] ); | |
| 228 | + $tab = $this->_current_tab( $page_tabs[ 0 ] ); | |
| 229 | 229 | |
| 230 | 230 | // Add Save and Reset buttons. | 
| 231 | 231 | 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' ) . '" /> '; | 
| @@ -773,14 +773,14 @@ discard block | ||
| 773 | 773 | esc_url( 'https://' . $this->get_option( 'pod' ) . '/services' ), | 
| 774 | 774 | esc_html__( 'Show available services on my pod.', 'wp-to-diaspora' ) | 
| 775 | 775 | ); | 
| 776 | - $empty_label = esc_html__( 'No services connected yet.', 'wp-to-diaspora' ); | |
| 776 | + $empty_label = esc_html__( 'No services connected yet.', 'wp-to-diaspora' ); | |
| 777 | 777 | break; | 
| 778 | 778 | |
| 779 | 779 | default: | 
| 780 | 780 | return; | 
| 781 | 781 | } | 
| 782 | 782 | |
| 783 | - $items = array_filter( (array) $items ) ?: []; | |
| 783 | + $items = array_filter( (array) $items ) ? : [ ]; | |
| 784 | 784 | |
| 785 | 785 | // Special case for this field if it's displayed on the settings page. | 
| 786 | 786 | $on_settings_page = ( 'settings_page_wp_to_diaspora' === get_current_screen()->id ); | 
| @@ -930,19 +930,19 @@ discard block | ||
| 930 | 930 | /* Validate all settings before saving to the database. */ | 
| 931 | 931 | |
| 932 | 932 | // Saving the pod setup details. | 
| 933 | -		if ( isset( $input['submit_setup'] ) ) { | |
| 934 | - $input['pod'] = trim( sanitize_text_field( $input['pod'] ), ' /' ); | |
| 935 | - $input['username'] = sanitize_text_field( $input['username'] ); | |
| 936 | - $input['password'] = sanitize_text_field( $input['password'] ); | |
| 933 | +		if ( isset( $input[ 'submit_setup' ] ) ) { | |
| 934 | + $input[ 'pod' ] = trim( sanitize_text_field( $input[ 'pod' ] ), ' /' ); | |
| 935 | + $input[ 'username' ] = sanitize_text_field( $input[ 'username' ] ); | |
| 936 | + $input[ 'password' ] = sanitize_text_field( $input[ 'password' ] ); | |
| 937 | 937 | |
| 938 | 938 | // If password is blank, it hasn't been changed. | 
| 939 | 939 |  			// 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. | 
| 940 | -			if ( '' === $input['password'] || $this->get_option( 'password' ) === $input['password'] ) { | |
| 940 | +			if ( '' === $input[ 'password' ] || $this->get_option( 'password' ) === $input[ 'password' ] ) { | |
| 941 | 941 | // Attempt a password upgrade if applicable. | 
| 942 | 942 | $this->attempt_password_upgrade( true ); | 
| 943 | - $input['password'] = $this->get_option( 'password' ); | |
| 943 | + $input[ 'password' ] = $this->get_option( 'password' ); | |
| 944 | 944 |  			} else { | 
| 945 | - $input['password'] = WP2D_Helpers::encrypt( $input['password'] ); | |
| 945 | + $input[ 'password' ] = WP2D_Helpers::encrypt( $input[ 'password' ] ); | |
| 946 | 946 | } | 
| 947 | 947 | |
| 948 | 948 | // Keep a note of the current AUTH_KEY. | 
| @@ -950,15 +950,15 @@ discard block | ||
| 950 | 950 | |
| 951 | 951 | // This is for when JS in not enabled, to make sure that the aspects and services | 
| 952 | 952 | // are re-fetched when displaying the options page after saving. | 
| 953 | -			if ( isset( $input['no_js'] ) ) { | |
| 953 | +			if ( isset( $input[ 'no_js' ] ) ) { | |
| 954 | 954 | set_transient( 'wp2d_no_js_force_refetch', true ); | 
| 955 | 955 | } | 
| 956 | 956 | } | 
| 957 | 957 | |
| 958 | 958 | // Saving the default options. | 
| 959 | -		if ( isset( $input['submit_defaults'] ) ) { | |
| 960 | -			if ( ! isset( $input['enabled_post_types'] ) ) { | |
| 961 | - $input['enabled_post_types'] = []; | |
| 959 | +		if ( isset( $input[ 'submit_defaults' ] ) ) { | |
| 960 | +			if ( ! isset( $input[ 'enabled_post_types' ] ) ) { | |
| 961 | + $input[ 'enabled_post_types' ] = [ ]; | |
| 962 | 962 | } | 
| 963 | 963 | |
| 964 | 964 | // Checkboxes. | 
| @@ -971,26 +971,26 @@ discard block | ||
| 971 | 971 | $this->validate_multi_selects( 'tags_to_post', $input ); | 
| 972 | 972 | |
| 973 | 973 | // Get unique, non-empty, trimmed tags and clean them up. | 
| 974 | - $this->validate_tags( $input['global_tags'] ); | |
| 974 | + $this->validate_tags( $input[ 'global_tags' ] ); | |
| 975 | 975 | |
| 976 | 976 | // Clean up the list of aspects. If the list is empty, only use the 'Public' aspect. | 
| 977 | - $this->validate_aspects_services( $input['aspects'], [ 'public' ] ); | |
| 977 | + $this->validate_aspects_services( $input[ 'aspects' ], [ 'public' ] ); | |
| 978 | 978 | |
| 979 | 979 | // Clean up the list of services. | 
| 980 | - $this->validate_aspects_services( $input['services'] ); | |
| 980 | + $this->validate_aspects_services( $input[ 'services' ] ); | |
| 981 | 981 | } | 
| 982 | 982 | |
| 983 | 983 | // Reset to defaults. | 
| 984 | -		if ( isset( $input['reset_defaults'] ) ) { | |
| 984 | +		if ( isset( $input[ 'reset_defaults' ] ) ) { | |
| 985 | 985 | // Set the input to the default options. | 
| 986 | 986 | $input = self::$_default_options; | 
| 987 | 987 | |
| 988 | 988 | // Don't reset the fetched lists of aspects and services. | 
| 989 | - unset( $input['pod_list'], $input['aspects_list'], $input['services_list'] ); | |
| 989 | + unset( $input[ 'pod_list' ], $input[ 'aspects_list' ], $input[ 'services_list' ] ); | |
| 990 | 990 | } | 
| 991 | 991 | |
| 992 | 992 | // Unset all unused input fields. | 
| 993 | - unset( $input['submit_defaults'], $input['reset_defaults'], $input['submit_setup'] ); | |
| 993 | + unset( $input[ 'submit_defaults' ], $input[ 'reset_defaults' ], $input[ 'submit_setup' ] ); | |
| 994 | 994 | |
| 995 | 995 | // Parse inputs with default options and return. | 
| 996 | 996 | return wp_parse_args( $input, array_merge( self::$_default_options, self::$_options ) ); | 
| @@ -1048,7 +1048,7 @@ discard block | ||
| 1048 | 1048 | } | 
| 1049 | 1049 | } | 
| 1050 | 1050 |  			} else { | 
| 1051 | - $options[ $select ] = []; | |
| 1051 | + $options[ $select ] = [ ]; | |
| 1052 | 1052 | } | 
| 1053 | 1053 | } | 
| 1054 | 1054 | |
| @@ -1097,7 +1097,7 @@ discard block | ||
| 1097 | 1097 | * | 
| 1098 | 1098 | * @return array The validated list of aspects or services. | 
| 1099 | 1099 | */ | 
| 1100 | -	public function validate_aspects_services( &$aspects_services, array $default = [] ) { | |
| 1100 | +	public function validate_aspects_services( &$aspects_services, array $default = [ ] ) { | |
| 1101 | 1101 |  		if ( empty( $aspects_services ) || ! is_array( $aspects_services ) ) { | 
| 1102 | 1102 | $aspects_services = $default; | 
| 1103 | 1103 |  		} else { |