Completed
Push — use-the-federation.info-api-fo... ( c1d68a )
by Armando
01:35
created
lib/class-options.php 3 patches
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -435,8 +435,11 @@  discard block
 block discarded – undo
435 435
 		if ( 'settings_page_wp_to_diaspora' === get_current_screen()->id ) : ?>
436 436
 			<label><?php echo $checkbox; ?><?php esc_html_e( 'Yes' ); ?></label>
437 437
 			<p class="description"><?php echo esc_html( $description ); ?></p>
438
-		<?php else : ?>
439
-			<label title="<?php echo esc_attr( $description ); ?>"><?php echo $checkbox; ?><?php esc_html_e( 'Show "Posted at" link?', 'wp-to-diaspora' ); ?></label>
438
+		<?php else {
439
+	: ?>
440
+			<label title="<?php echo esc_attr( $description );
441
+}
442
+?>"><?php echo $checkbox; ?><?php esc_html_e( 'Show "Posted at" link?', 'wp-to-diaspora' ); ?></label>
440 443
 		<?php endif;
441 444
 	}
442 445
 
@@ -474,9 +477,11 @@  discard block
 block discarded – undo
474 477
 
475 478
 		<?php if ( $on_settings_page ) : ?>
476 479
 			<p class="description"><?php echo esc_html( $description ); ?></p>
477
-		<?php else : ?>
480
+		<?php else {
481
+	: ?>
478 482
 			</label>
479 483
 		<?php endif;
484
+}
480 485
 	}
481 486
 
482 487
 	/**
@@ -558,8 +563,11 @@  discard block
 block discarded – undo
558 563
 				<?php foreach ( $list as $id => $name ) : ?>
559 564
 					<label><input type="checkbox" name="wp_to_diaspora_settings[<?php echo esc_attr( $type ); ?>][]" value="<?php echo esc_attr( $id ); ?>" <?php checked( in_array( $id, $items ) ); ?>><?php echo esc_html( $name ); ?></label>
560 565
 				<?php endforeach; ?>
561
-			<?php else : ?>
562
-				<label><?php echo $empty_label; ?></label>
566
+			<?php else {
567
+	: ?>
568
+				<label><?php echo $empty_label;
569
+}
570
+?></label>
563 571
 			<?php endif; ?>
564 572
 		</div>
565 573
 		<p class="description">
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 	/**
870 870
 	 * Validate checkboxes, make them either true or false.
871 871
 	 *
872
-	 * @param string|array $checkboxes Checkboxes to validate.
872
+	 * @param string[] $checkboxes Checkboxes to validate.
873 873
 	 * @param array        $options    Options values themselves.
874 874
 	 *
875 875
 	 * @return array The validated options.
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 	/**
886 886
 	 * Validate single-select fields and make sure their selected value are valid.
887 887
 	 *
888
-	 * @param string|array $selects Name(s) of the select fields.
888
+	 * @param string $selects Name(s) of the select fields.
889 889
 	 * @param array        $options Options values themselves.
890 890
 	 *
891 891
 	 * @return array The validated options.
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	/**
904 904
 	 * Validate multi-select fields and make sure their selected values are valid.
905 905
 	 *
906
-	 * @param string|array $selects Name(s) of the select fields.
906
+	 * @param string $selects Name(s) of the select fields.
907 907
 	 * @param array        $options Options values themselves.
908 908
 	 *
909 909
 	 * @return array The validated options.
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	 * Validate the passed aspects or services.
964 964
 	 *
965 965
 	 * @param array $aspects_services List of aspects or services that need to be validated.
966
-	 * @param array $default          Default value if not valid.
966
+	 * @param string[] $default          Default value if not valid.
967 967
 	 *
968 968
 	 * @return array The validated list of aspects or services.
969 969
 	 */
Please login to merge, or discard this 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-api.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -315,9 +315,9 @@
 block discarded – undo
315 315
 
316 316
 		// If we are already logged in and not forcing a relogin, return.
317 317
 		if ( ! $force &&
318
-		     $username === $this->_username &&
319
-		     $password === $this->_password &&
320
-		     $this->is_logged_in()
318
+				 $username === $this->_username &&
319
+				 $password === $this->_password &&
320
+				 $this->is_logged_in()
321 321
 		) {
322 322
 			return true;
323 323
 		}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @var array
104 104
 	 */
105
-	private $_aspects = [];
105
+	private $_aspects = [ ];
106 106
 
107 107
 	/**
108 108
 	 * The list of user's connected services, which get set after ever http request.
109 109
 	 *
110 110
 	 * @var array
111 111
 	 */
112
-	private $_services = [];
112
+	private $_services = [ ];
113 113
 
114 114
 	/**
115 115
 	 * List of regex expressions used to filter out details from http request responses.
@@ -372,8 +372,8 @@  discard block
 block discarded – undo
372 372
 		$this->_is_logged_in = false;
373 373
 		$this->_username     = null;
374 374
 		$this->_password     = null;
375
-		$this->_aspects      = [];
376
-		$this->_services     = [];
375
+		$this->_aspects      = [ ];
376
+		$this->_services     = [ ];
377 377
 	}
378 378
 
379 379
 	/**
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 		$this->logout();
386 386
 		$this->_last_error   = null;
387 387
 		$this->_token        = null;
388
-		$this->_cookies      = [];
388
+		$this->_cookies      = [ ];
389 389
 		$this->_last_request = null;
390 390
 	}
391 391
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	 *
399 399
 	 * @return bool|object Return the response data of the new diaspora* post if successfully posted, else false.
400 400
 	 */
401
-	public function post( $text, $aspects = 'public', array $extra_data = [] ) {
401
+	public function post( $text, $aspects = 'public', array $extra_data = [ ] ) {
402 402
 		// Are we logged in?
403 403
 		if ( ! $this->_check_login() ) {
404 404
 			return false;
@@ -594,11 +594,11 @@  discard block
 block discarded – undo
594 594
 				/** @var array $raw_list */
595 595
 
596 596
 				// In case this fetch is forced, empty the list.
597
-				$list = [];
597
+				$list = [ ];
598 598
 
599 599
 				if ( 'aspects' === $type ) {
600 600
 					// Add the 'public' aspect, as it's global and not user specific.
601
-					$list['public'] = __( 'Public', 'wp-to-diaspora' );
601
+					$list[ 'public' ] = __( 'Public', 'wp-to-diaspora' );
602 602
 
603 603
 					// Add all user specific aspects.
604 604
 					foreach ( $raw_list as $aspect ) {
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 	 *
626 626
 	 * @return object An object containing details about this request.
627 627
 	 */
628
-	private function _request( $url, array $args = [] ) {
628
+	private function _request( $url, array $args = [ ] ) {
629 629
 		// Prefix the full pod URL if necessary.
630 630
 		if ( 0 === strpos( $url, '/' ) ) {
631 631
 			$url = $this->get_pod_url( $url );
@@ -642,12 +642,12 @@  discard block
 block discarded – undo
642 642
 		// If the certificate bundle has been downloaded manually, use that instead.
643 643
 		// NOTE: This should actually never be necessary, it's a fallback!
644 644
 		if ( file_exists( WP2D_DIR . '/cacert.pem' ) ) {
645
-			$defaults['sslcertificates'] = WP2D_DIR . '/cacert.pem';
645
+			$defaults[ 'sslcertificates' ] = WP2D_DIR . '/cacert.pem';
646 646
 		}
647 647
 
648 648
 		// Set the correct cookie.
649 649
 		if ( ! empty( $this->_cookies ) ) {
650
-			$defaults['cookies'] = $this->_cookies;
650
+			$defaults[ 'cookies' ] = $this->_cookies;
651 651
 		}
652 652
 
653 653
 		$args = wp_parse_args( $args, $defaults );
@@ -679,8 +679,8 @@  discard block
 block discarded – undo
679 679
 		}
680 680
 
681 681
 		// Save the latest cookies.
682
-		if ( isset( $response['cookies'] ) ) {
683
-			$this->_cookies = $response['cookies'];
682
+		if ( isset( $response[ 'cookies' ] ) ) {
683
+			$this->_cookies = $response[ 'cookies' ];
684 684
 		}
685 685
 
686 686
 		// Return the last request details.
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	 * @param string $url  The URL to request.
624 624
 	 * @param array  $args Arguments to be posted with the request.
625 625
 	 *
626
-	 * @return object An object containing details about this request.
626
+	 * @return string An object containing details about this request.
627 627
 	 */
628 628
 	private function _request( $url, array $args = [] ) {
629 629
 		// Prefix the full pod URL if necessary.
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	 * @see   WP_Error::__construct()
694 694
 	 * @since 1.6.0
695 695
 	 *
696
-	 * @param  string|int $code    Error code.
696
+	 * @param  string $code    Error code.
697 697
 	 * @param  string     $message Error message.
698 698
 	 * @param  mixed      $data    Error data.
699 699
 	 */
Please login to merge, or discard this patch.
lib/class-contextual-help.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
 			'content' => '<p><strong>' . esc_html__( 'Enter your diaspora* login details to connect your account.', 'wp-to-diaspora' ) . '</strong></p>
124 124
 				<ul>
125 125
 					<li><strong>' . esc_html__( 'diaspora* Pod', 'wp-to-diaspora' ) . '</strong>: ' .
126
-			             esc_html__( 'This is the domain name of the pod you are on (e.g. joindiaspora.com)', 'wp-to-diaspora' ) . '
126
+									 esc_html__( 'This is the domain name of the pod you are on (e.g. joindiaspora.com)', 'wp-to-diaspora' ) . '
127 127
 					<li><strong>' . esc_html__( 'Username', 'wp-to-diaspora' ) . '</strong>: ' .
128
-			             esc_html__( 'Your diaspora* username (without the pod domain).', 'wp-to-diaspora' ) . '
128
+									 esc_html__( 'Your diaspora* username (without the pod domain).', 'wp-to-diaspora' ) . '
129 129
 					<li><strong>' . esc_html__( 'Password', 'wp-to-diaspora' ) . '</strong>: ' .
130
-			             esc_html__( 'Your diaspora* password.', 'wp-to-diaspora' ) . '
130
+									 esc_html__( 'Your diaspora* password.', 'wp-to-diaspora' ) . '
131 131
 				</ul>',
132 132
 		] );
133 133
 
@@ -138,27 +138,27 @@  discard block
 block discarded – undo
138 138
 			'content' => '<p><strong>' . esc_html__( 'Define the default posting behaviour.', 'wp-to-diaspora' ) . '</strong></p>
139 139
 				<ul>
140 140
 					<li><strong>' . esc_html__( 'Post types', 'wp-to-diaspora' ) . '</strong>: ' .
141
-			             esc_html__( 'Choose the post types that are allowed to be shared to diaspora*.', 'wp-to-diaspora' ) . '
141
+									 esc_html__( 'Choose the post types that are allowed to be shared to diaspora*.', 'wp-to-diaspora' ) . '
142 142
 					<li><strong>' . esc_html__( 'Post to diaspora*', 'wp-to-diaspora' ) . '</strong>: ' .
143
-			             esc_html__( 'Automatically share new posts to diaspora* when publishing them.', 'wp-to-diaspora' ) . '
143
+									 esc_html__( 'Automatically share new posts to diaspora* when publishing them.', 'wp-to-diaspora' ) . '
144 144
 					<li><strong>' . esc_html__( 'Show "Posted at" link?', 'wp-to-diaspora' ) . '</strong>: ' .
145
-			             esc_html__( 'Add a link back to your original post, at the bottom of the diaspora* post.', 'wp-to-diaspora' ) . '
145
+									 esc_html__( 'Add a link back to your original post, at the bottom of the diaspora* post.', 'wp-to-diaspora' ) . '
146 146
 					<li><strong>' . esc_html__( 'Display', 'wp-to-diaspora' ) . '</strong>: ' .
147
-			             esc_html__( 'Choose whether you would like to post the whole post or just the excerpt.', 'wp-to-diaspora' ) . '
147
+									 esc_html__( 'Choose whether you would like to post the whole post or just the excerpt.', 'wp-to-diaspora' ) . '
148 148
 					<li><strong>' . esc_html__( 'Tags to post', 'wp-to-diaspora' ) . '</strong>: ' .
149
-			             esc_html__( 'You can add tags to your post to make it easier to find on diaspora*.' ) . '<br>
149
+									 esc_html__( 'You can add tags to your post to make it easier to find on diaspora*.' ) . '<br>
150 150
 						<ul>
151 151
 							<li><strong>' . esc_html__( 'Global tags', 'wp-to-diaspora' ) . '</strong>: ' . esc_html__( 'Tags that apply to all posts.', 'wp-to-diaspora' ) . '
152 152
 							<li><strong>' . esc_html__( 'Custom tags', 'wp-to-diaspora' ) . '</strong>: ' . esc_html__( 'Tags that apply to individual posts (can be set on each post).', 'wp-to-diaspora' ) . '
153 153
 							<li><strong>' . esc_html__( 'Post tags', 'wp-to-diaspora' ) . '</strong>: ' . esc_html__( 'Default WordPress Tags of individual posts.', 'wp-to-diaspora' ) . '
154 154
 						</ul>
155 155
 					<li><strong>' . esc_html__( 'Global tags', 'wp-to-diaspora' ) . '</strong>: ' .
156
-			             esc_html__( 'A list of tags that gets added to every post.', 'wp-to-diaspora' ) . '
156
+									 esc_html__( 'A list of tags that gets added to every post.', 'wp-to-diaspora' ) . '
157 157
 					<li><strong>' . esc_html__( 'Aspects', 'wp-to-diaspora' ) . '</strong>: ' .
158
-			             esc_html__( 'Decide which of your diaspora* aspects can see your posts.', 'wp-to-diaspora' ) . '<br>
158
+									 esc_html__( 'Decide which of your diaspora* aspects can see your posts.', 'wp-to-diaspora' ) . '<br>
159 159
 							<em>' . sprintf( esc_html__( 'Use the "%s" button to load your aspects from diaspora*.', 'wp-to-diaspora' ), esc_html__( 'Refresh Aspects', 'wp-to-diaspora' ) ) . '</em>
160 160
 					<li><strong>' . esc_html__( 'Services', 'wp-to-diaspora' ) . '</strong>: ' .
161
-			             esc_html__( 'Choose the services your new diaspora* post gets shared to.', 'wp-to-diaspora' ) . '<br>
161
+									 esc_html__( 'Choose the services your new diaspora* post gets shared to.', 'wp-to-diaspora' ) . '<br>
162 162
 							<em>' . sprintf( esc_html__( 'Use the "%s" button to fetch the list of your connected services from diaspora*.', 'wp-to-diaspora' ), esc_html__( 'Refresh Services', 'wp-to-diaspora' ) ) . '</em>
163 163
 				</ul>',
164 164
 		] );
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
 				<p>' . esc_html__( 'There are a few important differences to the settings page:', 'wp-to-diaspora' ) . '</p>
183 183
 				<ul>
184 184
 					<li><strong>' . esc_html__( 'Already posted to diaspora*', 'wp-to-diaspora' ) . '</strong>: ' .
185
-			             esc_html__( 'If the post has already been posted to diaspora* a link to the diaspora* post will appear at the top.', 'wp-to-diaspora' ) . '
185
+									 esc_html__( 'If the post has already been posted to diaspora* a link to the diaspora* post will appear at the top.', 'wp-to-diaspora' ) . '
186 186
 					<li><strong>' . esc_html__( 'Custom tags', 'wp-to-diaspora' ) . '</strong>: ' .
187
-			             esc_html__( 'A list of tags that gets added to this post. Note that they are seperate from the WordPress post tags!', 'wp-to-diaspora' ) . '
187
+									 esc_html__( 'A list of tags that gets added to this post. Note that they are seperate from the WordPress post tags!', 'wp-to-diaspora' ) . '
188 188
 				</ul>
189 189
 				<p class="dashicons-before dashicons-info">' . esc_html__( 'If you don\'t see the meta box, make sure the post type you\'re on has been added to the "Post types" list on the settings page. Also make sure it has been selected from the "Screen Options" at the top of the screen.', 'wp-to-diaspora' ) . '</p>',
190 190
 		] );
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
 				<p>' . esc_html__( 'Here are a few common errors and their possible solutions:', 'wp-to-diaspora' ) . '</p>
198 198
 				<ul>
199 199
 					<li><strong>' . esc_html( sprintf( __( 'Failed to initialise connection to pod "%s"', 'wp-to-diaspora' ), 'xyz' ) ) . '</strong>: ' .
200
-			             esc_html__( 'This could have multiple reasons.' ) . '
200
+									 esc_html__( 'This could have multiple reasons.' ) . '
201 201
 						<ul>
202 202
 							<li>' . esc_html__( 'Make sure that your pod domain is entered correctly.', 'wp-to-diaspora' ) . '
203 203
 							<li>' .
204
-			             esc_html__( 'It might be an SSL problem.', 'wp-to-diaspora' ) .
205
-			             sprintf( ' <a href="https://github.com/DiasPHPora/wp-to-diaspora/wiki/SSL-and-TLS-Issues" class="open-help-tab" data-help-tab="ssl">%s</a>', esc_html__( 'Learn more', 'wp-to-diaspora' ) ) . '
204
+									 esc_html__( 'It might be an SSL problem.', 'wp-to-diaspora' ) .
205
+									 sprintf( ' <a href="https://github.com/DiasPHPora/wp-to-diaspora/wiki/SSL-and-TLS-Issues" class="open-help-tab" data-help-tab="ssl">%s</a>', esc_html__( 'Learn more', 'wp-to-diaspora' ) ) . '
206 206
 							<li>' . esc_html__( 'The pod might be offline at the moment.', 'wp-to-diaspora' ) . '
207 207
 						</ul>
208 208
 					<li><strong>' . esc_html__( 'Login failed. Check your login details.', 'wp-to-diaspora' ) . '</strong>: ' .
209
-			             esc_html__( 'Make sure that your username and password are entered correctly.', 'wp-to-diaspora' ) . '
209
+									 esc_html__( 'Make sure that your username and password are entered correctly.', 'wp-to-diaspora' ) . '
210 210
 				</ul>',
211 211
 		] );
212 212
 
Please login to merge, or discard this 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.
wp-to-diaspora.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	private function _constants() {
101 101
 		// Are we in debugging mode?
102
-		if ( isset( $_GET['debugging'] ) ) {
102
+		if ( isset( $_GET[ 'debugging' ] ) ) {
103 103
 			define( 'WP2D_DEBUGGING', true );
104 104
 		}
105 105
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	private function _version_check() {
119 119
 		// Check for version requirements.
120
-		if ( version_compare( PHP_VERSION, $this->_min_php, '<' ) || version_compare( $GLOBALS['wp_version'], $this->_min_wp, '<' ) ) {
120
+		if ( version_compare( PHP_VERSION, $this->_min_php, '<' ) || version_compare( $GLOBALS[ 'wp_version' ], $this->_min_wp, '<' ) ) {
121 121
 			add_action( 'admin_notices', [ $this, 'deactivate' ] );
122 122
 
123 123
 			return false;
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 		deactivate_plugins( plugin_basename( __FILE__ ) );
137 137
 
138 138
 		// Get rid of the "Plugin activated" message.
139
-		unset( $_GET['activate'] );
139
+		unset( $_GET[ 'activate' ] );
140 140
 
141 141
 		// Then display the admin notice.
142 142
 		?>
143 143
 		<div class="error">
144
-			<p><?php echo esc_html( sprintf( 'WP to diaspora* requires at least WordPress %1$s (you have %2$s) and PHP %3$s (you have %4$s)!', $this->_min_wp, $GLOBALS['wp_version'], $this->_min_php, PHP_VERSION ) ); ?></p>
144
+			<p><?php echo esc_html( sprintf( 'WP to diaspora* requires at least WordPress %1$s (you have %2$s) and PHP %3$s (you have %4$s)!', $this->_min_wp, $GLOBALS[ 'wp_version' ], $this->_min_php, PHP_VERSION ) ); ?></p>
145 145
 		</div>
146 146
 		<?php
147 147
 	}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function admin_load_scripts() {
262 262
 		// Get the enabled post types to load the script for.
263
-		$enabled_post_types = WP2D_Options::instance()->get_option( 'enabled_post_types', [] );
263
+		$enabled_post_types = WP2D_Options::instance()->get_option( 'enabled_post_types', [ ] );
264 264
 
265 265
 		// Get the screen to find out where we are.
266 266
 		$screen = get_current_screen();
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @return array Links to display for plugin on plugins page.
293 293
 	 */
294 294
 	public function settings_link( $links ) {
295
-		$links[] = '<a href="' . admin_url( 'options-general.php?page=wp_to_diaspora' ) . '">' . __( 'Settings' ) . '</a>';
295
+		$links[ ] = '<a href="' . admin_url( 'options-general.php?page=wp_to_diaspora' ) . '">' . __( 'Settings' ) . '</a>';
296 296
 
297 297
 		return $links;
298 298
 	}
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	 * @todo esc_html
385 385
 	 */
386 386
 	public function check_pod_connection_status_callback() {
387
-		if ( ! defined( 'WP2D_DEBUGGING' ) && isset( $_REQUEST['debugging'] ) ) {
387
+		if ( ! defined( 'WP2D_DEBUGGING' ) && isset( $_REQUEST[ 'debugging' ] ) ) {
388 388
 			define( 'WP2D_DEBUGGING', true );
389 389
 		}
390 390
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 		if ( true === $status ) {
399 399
 			wp_send_json_success( $data );
400 400
 		} elseif ( false === $status && $this->_load_api()->has_last_error() ) {
401
-			$data['message'] = $this->_load_api()->get_last_error() . ' ' . WP2D_Contextual_Help::get_help_tab_quick_link( $this->_load_api()->get_last_error_object() );
401
+			$data[ 'message' ] = $this->_load_api()->get_last_error() . ' ' . WP2D_Contextual_Help::get_help_tab_quick_link( $this->_load_api()->get_last_error_object() );
402 402
 			wp_send_json_error( $data );
403 403
 		}
404 404
 		// If $status === null, do nothing.
Please login to merge, or discard this patch.
lib/class-post.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
 		// Unset post_to_diaspora meta field to prevent mistakenly republishing to diaspora*.
260 260
 		$meta                     = get_post_meta( $post_id, '_wp_to_diaspora', true );
261
-		$meta['post_to_diaspora'] = false;
261
+		$meta[ 'post_to_diaspora' ] = false;
262 262
 		update_post_meta( $post_id, '_wp_to_diaspora', $meta );
263 263
 
264 264
 		return true;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	private function _get_full_content() {
298 298
 		// Only allow certain shortcodes.
299 299
 		global $shortcode_tags;
300
-		$shortcode_tags_bkp = [];
300
+		$shortcode_tags_bkp = [ ];
301 301
 
302 302
 		foreach ( $shortcode_tags as $shortcode_tag => $shortcode_function ) {
303 303
 			if ( ! in_array( $shortcode_tag, apply_filters( 'wp2d_shortcodes_filter', [ 'wp_caption', 'caption', 'gallery' ] ), true ) ) {
@@ -385,12 +385,12 @@  discard block
 block discarded – undo
385 385
 		$options       = WP2D_Options::instance();
386 386
 		$tags_to_post  = $this->tags_to_post;
387 387
 		$tags_to_add   = '';
388
-		$diaspora_tags = [];
388
+		$diaspora_tags = [ ];
389 389
 
390 390
 		// Add any diaspora* tags?
391 391
 		if ( ! empty( $tags_to_post ) ) {
392 392
 			// The diaspora* tags to add to the post.
393
-			$diaspora_tags_tmp = [];
393
+			$diaspora_tags_tmp = [ ];
394 394
 
395 395
 			// Add global tags?
396 396
 			$global_tags = $options->get_option( 'global_tags' );
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 
417 417
 			// Get all the tags and list them all nicely in a row.
418 418
 			foreach ( $diaspora_tags_tmp as $tag ) {
419
-				$diaspora_tags[] = '#' . $tag;
419
+				$diaspora_tags[ ] = '#' . $tag;
420 420
 			}
421 421
 
422 422
 			// Add all the found tags.
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 	private function _save_to_history( $response ) {
477 477
 		// Make sure the post history is an array.
478 478
 		if ( empty( $this->post_history ) ) {
479
-			$this->post_history = [];
479
+			$this->post_history = [ ];
480 480
 		}
481 481
 
482 482
 		// Add a new entry to the history.
483
-		$this->post_history[] = [
483
+		$this->post_history[ ] = [
484 484
 			'id'         => $response->id,
485 485
 			'guid'       => $response->guid,
486 486
 			'created_at' => $this->post->post_modified,
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
 		$content = do_shortcode( $content );
565 565
 
566 566
 		// If a caption attribute is defined, we'll add it after the image.
567
-		if ( isset( $attr['caption'] ) && '' !== $attr['caption'] ) {
568
-			$content .= "\n" . $this->get_img_caption( $attr['caption'] );
567
+		if ( isset( $attr[ 'caption' ] ) && '' !== $attr[ 'caption' ] ) {
568
+			$content .= "\n" . $this->get_img_caption( $attr[ 'caption' ] );
569 569
 		}
570 570
 
571 571
 		return $content;
@@ -585,8 +585,8 @@  discard block
 block discarded – undo
585 585
 		$captiontag = current_theme_supports( 'html5', 'gallery' ) ? 'figcaption' : 'dd';
586 586
 
587 587
 		// User value.
588
-		if ( isset( $attr['captiontag'] ) ) {
589
-			$captiontag = $attr['captiontag'];
588
+		if ( isset( $attr[ 'captiontag' ] ) ) {
589
+			$captiontag = $attr[ 'captiontag' ];
590 590
 		}
591 591
 
592 592
 		// Let WordPress create the regular gallery.
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 	 * @return string Prettified gallery image caption.
611 611
 	 */
612 612
 	public function custom_gallery_regex_callback( $m ) {
613
-		return $this->get_img_caption( $m[2] );
613
+		return $this->get_img_caption( $m[ 2 ] );
614 614
 	}
615 615
 
616 616
 	/*
@@ -653,18 +653,18 @@  discard block
 block discarded – undo
653 653
 		$options = WP2D_Options::instance();
654 654
 
655 655
 		// Make sure we have some value for post meta fields.
656
-		$this->custom_tags = $this->custom_tags ?: [];
656
+		$this->custom_tags = $this->custom_tags ? : [ ];
657 657
 
658 658
 		// If this post is already published, don't post again to diaspora* by default.
659 659
 		$this->post_to_diaspora = ( $this->post_to_diaspora && 'publish' !== get_post_status( $this->ID ) );
660
-		$this->aspects          = $this->aspects ?: [];
661
-		$this->services         = $this->services ?: [];
660
+		$this->aspects          = $this->aspects ? : [ ];
661
+		$this->services         = $this->services ? : [ ];
662 662
 
663 663
 		// Have we already posted on diaspora*?
664 664
 		if ( is_array( $this->post_history ) ) {
665 665
 			$latest_post = end( $this->post_history );
666 666
 			?>
667
-			<p><a href="<?php echo esc_attr( $latest_post['post_url'] ); ?>" target="_blank"><?php esc_html_e( 'Already posted to diaspora*.', 'wp-to-diaspora' ); ?></a></p>
667
+			<p><a href="<?php echo esc_attr( $latest_post[ 'post_url' ] ); ?>" target="_blank"><?php esc_html_e( 'Already posted to diaspora*.', 'wp-to-diaspora' ); ?></a></p>
668 668
 			<?php
669 669
 		}
670 670
 		?>
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 		/* OK, it's safe for us to save the data now. */
700 700
 
701 701
 		// Meta data to save.
702
-		$meta_to_save = $_POST['wp_to_diaspora_settings'];
702
+		$meta_to_save = $_POST[ 'wp_to_diaspora_settings' ];
703 703
 		$options      = WP2D_Options::instance();
704 704
 
705 705
 		// Checkboxes.
@@ -712,13 +712,13 @@  discard block
 block discarded – undo
712 712
 		$options->validate_multi_selects( 'tags_to_post', $meta_to_save );
713 713
 
714 714
 		// Save custom tags as array.
715
-		$options->validate_tags( $meta_to_save['custom_tags'] );
715
+		$options->validate_tags( $meta_to_save[ 'custom_tags' ] );
716 716
 
717 717
 		// Clean up the list of aspects. If the list is empty, only use the 'Public' aspect.
718
-		$options->validate_aspects_services( $meta_to_save['aspects'], [ 'public' ] );
718
+		$options->validate_aspects_services( $meta_to_save[ 'aspects' ], [ 'public' ] );
719 719
 
720 720
 		// Clean up the list of services.
721
-		$options->validate_aspects_services( $meta_to_save['services'] );
721
+		$options->validate_aspects_services( $meta_to_save[ 'services' ] );
722 722
 
723 723
 		// Update the meta data for this post.
724 724
 		update_post_meta( $post_id, '_wp_to_diaspora', $meta_to_save );
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 	 */
734 734
 	private function _is_safe_to_save() {
735 735
 		// Verify that our nonce is set and  valid.
736
-		if ( ! ( isset( $_POST['wp_to_diaspora_meta_box_nonce'] ) && wp_verify_nonce( $_POST['wp_to_diaspora_meta_box_nonce'], 'wp_to_diaspora_meta_box' ) ) ) {
736
+		if ( ! ( isset( $_POST[ 'wp_to_diaspora_meta_box_nonce' ] ) && wp_verify_nonce( $_POST[ 'wp_to_diaspora_meta_box_nonce' ], 'wp_to_diaspora_meta_box' ) ) ) {
737 737
 			return false;
738 738
 		}
739 739
 
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
 		}
744 744
 
745 745
 		// Check the user's permissions.
746
-		$permission = ( isset( $_POST['post_type'] ) && 'page' === $_POST['post_type'] ) ? 'edit_pages' : 'edit_posts';
746
+		$permission = ( isset( $_POST[ 'post_type' ] ) && 'page' === $_POST[ 'post_type' ] ) ? 'edit_pages' : 'edit_posts';
747 747
 		if ( ! current_user_can( $permission, $this->ID ) ) {
748 748
 			return false;
749 749
 		}
750 750
 
751 751
 		// Make real sure that we have some meta data to save.
752
-		if ( ! isset( $_POST['wp_to_diaspora_settings'] ) ) {
752
+		if ( ! isset( $_POST[ 'wp_to_diaspora_settings' ] ) ) {
753 753
 			return false;
754 754
 		}
755 755
 
@@ -786,10 +786,10 @@  discard block
 block discarded – undo
786 786
 			$latest_post = end( $diaspora_post_history );
787 787
 
788 788
 			// Only show if this post is showing a message and the post is a fresh share.
789
-			if ( isset( $_GET['message'] ) && $post->post_modified === $latest_post['created_at'] ) {
789
+			if ( isset( $_GET[ 'message' ] ) && $post->post_modified === $latest_post[ 'created_at' ] ) {
790 790
 				printf( '<div class="updated notice is-dismissible"><p>%1$s <a href="%2$s" target="_blank">%3$s</a></p></div>',
791 791
 					esc_html__( 'Successfully posted to diaspora*.', 'wp-to-diaspora' ),
792
-					esc_url( $latest_post['post_url'] ),
792
+					esc_url( $latest_post[ 'post_url' ] ),
793 793
 					esc_html__( 'View Post' )
794 794
 				);
795 795
 			}
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 	 */
804 804
 	public function ignore_post_error() {
805 805
 		// If "Ignore" link has been clicked, delete the post error meta data.
806
-		if ( isset( $_GET['wp2d_ignore_post_error'], $_GET['post'] ) ) {
807
-			delete_post_meta( $_GET['post'], '_wp_to_diaspora_post_error' );
806
+		if ( isset( $_GET[ 'wp2d_ignore_post_error' ], $_GET[ 'post' ] ) ) {
807
+			delete_post_meta( $_GET[ 'post' ], '_wp_to_diaspora_post_error' );
808 808
 		}
809 809
 	}
810 810
 }
Please login to merge, or discard this patch.