@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | * @param string $url The URL to request. |
| 630 | 630 | * @param array $args Arguments to be posted with the request. |
| 631 | 631 | * |
| 632 | - * @return object An object containing details about this request. |
|
| 632 | + * @return string An object containing details about this request. |
|
| 633 | 633 | */ |
| 634 | 634 | private function request( $url, array $args = [] ) { |
| 635 | 635 | // Prefix the full pod URL if necessary. |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | * |
| 701 | 701 | * @see WP_Error::__construct() |
| 702 | 702 | * |
| 703 | - * @param string|int $code Error code. |
|
| 703 | + * @param string $code Error code. |
|
| 704 | 704 | * @param string $message Error message. |
| 705 | 705 | * @param mixed $data Error data. |
| 706 | 706 | */ |
@@ -102,14 +102,14 @@ discard block |
||
| 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. |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | $this->is_logged_in = false; |
| 383 | 383 | $this->username = null; |
| 384 | 384 | $this->password = null; |
| 385 | - $this->aspects = []; |
|
| 386 | - $this->services = []; |
|
| 385 | + $this->aspects = [ ]; |
|
| 386 | + $this->services = [ ]; |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /** |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | $this->logout(); |
| 396 | 396 | $this->last_error = null; |
| 397 | 397 | $this->token = null; |
| 398 | - $this->cookies = []; |
|
| 398 | + $this->cookies = [ ]; |
|
| 399 | 399 | $this->last_request = null; |
| 400 | 400 | } |
| 401 | 401 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | * |
| 409 | 409 | * @return bool|object Return the response data of the new diaspora* post if successfully posted, else false. |
| 410 | 410 | */ |
| 411 | - public function post( $text, $aspects = 'public', array $extra_data = [] ) { |
|
| 411 | + public function post( $text, $aspects = 'public', array $extra_data = [ ] ) { |
|
| 412 | 412 | // Are we logged in? |
| 413 | 413 | if ( ! $this->check_login() ) { |
| 414 | 414 | return false; |
@@ -600,11 +600,11 @@ discard block |
||
| 600 | 600 | $raw_list = json_decode( $this->parse_regex( $type, $response->body ) ); |
| 601 | 601 | if ( is_array( $raw_list ) ) { |
| 602 | 602 | // In case this fetch is forced, empty the list. |
| 603 | - $list = []; |
|
| 603 | + $list = [ ]; |
|
| 604 | 604 | |
| 605 | 605 | if ( 'aspects' === $type ) { |
| 606 | 606 | // Add the 'public' aspect, as it's global and not user specific. |
| 607 | - $list['public'] = __( 'Public', 'wp-to-diaspora' ); |
|
| 607 | + $list[ 'public' ] = __( 'Public', 'wp-to-diaspora' ); |
|
| 608 | 608 | |
| 609 | 609 | // Add all user specific aspects. |
| 610 | 610 | foreach ( $raw_list as $aspect ) { |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | * |
| 632 | 632 | * @return object An object containing details about this request. |
| 633 | 633 | */ |
| 634 | - private function request( $url, array $args = [] ) { |
|
| 634 | + private function request( $url, array $args = [ ] ) { |
|
| 635 | 635 | // Prefix the full pod URL if necessary. |
| 636 | 636 | if ( 0 === strpos( $url, '/' ) ) { |
| 637 | 637 | $url = $this->get_pod_url( $url ); |
@@ -648,12 +648,12 @@ discard block |
||
| 648 | 648 | // If the certificate bundle has been downloaded manually, use that instead. |
| 649 | 649 | // NOTE: This should actually never be necessary, it's a fallback! |
| 650 | 650 | if ( file_exists( WP2D_DIR . '/cacert.pem' ) ) { |
| 651 | - $defaults['sslcertificates'] = WP2D_DIR . '/cacert.pem'; |
|
| 651 | + $defaults[ 'sslcertificates' ] = WP2D_DIR . '/cacert.pem'; |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | // Set the correct cookie. |
| 655 | 655 | if ( ! empty( $this->cookies ) ) { |
| 656 | - $defaults['cookies'] = $this->cookies; |
|
| 656 | + $defaults[ 'cookies' ] = $this->cookies; |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | $args = wp_parse_args( $args, $defaults ); |
@@ -685,8 +685,8 @@ discard block |
||
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | // Save the latest cookies. |
| 688 | - if ( isset( $response['cookies'] ) ) { |
|
| 689 | - $this->cookies = $response['cookies']; |
|
| 688 | + if ( isset( $response[ 'cookies' ] ) ) { |
|
| 689 | + $this->cookies = $response[ 'cookies' ]; |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | // Return the last request details. |
@@ -869,7 +869,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | */ |
@@ -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 = sanitize_key( $_GET['tab'] ?? $default ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 109 | + $tab = sanitize_key( $_GET[ 'tab' ] ?? $default ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 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', 'wp-to-diaspora' ) . '" /> '; |
@@ -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 { |
@@ -599,8 +599,11 @@ discard block |
||
| 599 | 599 | if ( 'settings_page_wp_to_diaspora' === get_current_screen()->id ) : ?> |
| 600 | 600 | <label><?php echo $checkbox; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?><?php esc_html_e( 'Yes', 'wp-to-diaspora' ); ?></label> |
| 601 | 601 | <p class="description"><?php echo esc_html( $description ); ?></p> |
| 602 | - <?php else : ?> |
|
| 603 | - <label title="<?php echo esc_attr( $description ); ?>"><?php echo $checkbox; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?><?php esc_html_e( 'Show "Posted at" link?', 'wp-to-diaspora' ); ?></label> |
|
| 602 | + <?php else { |
|
| 603 | + : ?> |
|
| 604 | + <label title="<?php echo esc_attr( $description ); |
|
| 605 | +} |
|
| 606 | +?>"><?php echo $checkbox; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?><?php esc_html_e( 'Show "Posted at" link?', 'wp-to-diaspora' ); ?></label> |
|
| 604 | 607 | <?php endif; |
| 605 | 608 | } |
| 606 | 609 | |
@@ -639,9 +642,11 @@ discard block |
||
| 639 | 642 | |
| 640 | 643 | <?php if ( $on_settings_page ) : ?> |
| 641 | 644 | <p class="description"><?php echo esc_html( $description ); ?></p> |
| 642 | - <?php else : ?> |
|
| 645 | + <?php else { |
|
| 646 | + : ?> |
|
| 643 | 647 | </label> |
| 644 | 648 | <?php endif; |
| 649 | +} |
|
| 645 | 650 | } |
| 646 | 651 | |
| 647 | 652 | /** |
@@ -720,8 +725,11 @@ discard block |
||
| 720 | 725 | <?php foreach ( $list as $id => $name ) : ?> |
| 721 | 726 | <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, false ) ); // phpcs:ignore WordPress.PHP.StrictInArray.FoundNonStrictFalse ?>><?php echo esc_html( $name ); ?></label> |
| 722 | 727 | <?php endforeach; ?> |
| 723 | - <?php else : ?> |
|
| 724 | - <label><?php echo $empty_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></label> |
|
| 728 | + <?php else { |
|
| 729 | + : ?> |
|
| 730 | + <label><?php echo $empty_label; |
|
| 731 | +} |
|
| 732 | +// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></label> |
|
| 725 | 733 | <?php endif; ?> |
| 726 | 734 | </div> |
| 727 | 735 | <p class="description"> |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @param array $links Links to display for plugin on plugins page. |
| 278 | 278 | * |
| 279 | - * @return array Links to display for plugin on plugins page. |
|
| 279 | + * @return string[] Links to display for plugin on plugins page. |
|
| 280 | 280 | */ |
| 281 | 281 | public function settings_link( $links ) { |
| 282 | 282 | $links[] = '<a href="' . esc_url( admin_url( 'options-general.php?page=wp_to_diaspora' ) ) . '">' . __( 'Settings', 'wp-to-diaspora' ) . '</a>'; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | /** |
| 354 | 354 | * Check the pod connection status. |
| 355 | 355 | * |
| 356 | - * @return bool The status of the connection. |
|
| 356 | + * @return boolean|null The status of the connection. |
|
| 357 | 357 | */ |
| 358 | 358 | private function check_pod_connection_status() { |
| 359 | 359 | $options = WP2D_Options::instance(); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | private function constants() { |
| 73 | 73 | // Are we in debugging mode? |
| 74 | - if ( isset( $_GET['debugging'] ) ) { // phpcs:ignore |
|
| 74 | + if ( isset( $_GET[ 'debugging' ] ) ) { // phpcs:ignore |
|
| 75 | 75 | define( 'WP2D_DEBUGGING', true ); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | private function version_check() { |
| 93 | 93 | // Check for version requirements. |
| 94 | - if ( version_compare( PHP_VERSION, $this->min_php, '<' ) || version_compare( $GLOBALS['wp_version'], $this->min_wp, '<' ) ) { |
|
| 94 | + if ( version_compare( PHP_VERSION, $this->min_php, '<' ) || version_compare( $GLOBALS[ 'wp_version' ], $this->min_wp, '<' ) ) { |
|
| 95 | 95 | add_action( 'admin_notices', [ $this, 'deactivate' ] ); |
| 96 | 96 | |
| 97 | 97 | return false; |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | deactivate_plugins( WP2D_BASENAME ); |
| 111 | 111 | |
| 112 | 112 | // Get rid of the "Plugin activated" message. |
| 113 | - unset( $_GET['activate'] ); // phpcs:ignore |
|
| 113 | + unset( $_GET[ 'activate' ] ); // phpcs:ignore |
|
| 114 | 114 | |
| 115 | 115 | // Then display the admin notice. |
| 116 | 116 | ?> |
| 117 | 117 | <div class="error"> |
| 118 | - <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> |
|
| 118 | + <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> |
|
| 119 | 119 | </div> |
| 120 | 120 | <?php |
| 121 | 121 | } |
@@ -221,16 +221,16 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | public function admin_load_scripts() { |
| 223 | 223 | // Get the enabled post types to load the script for. |
| 224 | - $enabled_post_types = WP2D_Options::instance()->get_option( 'enabled_post_types', [] ); |
|
| 224 | + $enabled_post_types = WP2D_Options::instance()->get_option( 'enabled_post_types', [ ] ); |
|
| 225 | 225 | |
| 226 | 226 | // Get the screen to find out where we are. |
| 227 | 227 | $screen = get_current_screen(); |
| 228 | 228 | |
| 229 | 229 | // Only load the styles and scripts on the settings page and the allowed post types. |
| 230 | 230 | if ( 'settings_page_wp_to_diaspora' === $screen->id || ( in_array( $screen->post_type, $enabled_post_types, true ) && 'post' === $screen->base ) ) { |
| 231 | - wp_enqueue_style( 'tag-it', plugins_url( '/css/tag-it.min.css', WP2D_BASENAME ), [], WP2D_VERSION ); |
|
| 232 | - wp_enqueue_style( 'chosen', plugins_url( '/css/chosen.min.css', WP2D_BASENAME ), [], WP2D_VERSION ); |
|
| 233 | - wp_enqueue_style( 'wp-to-diaspora-admin', plugins_url( '/css/wp-to-diaspora.css', WP2D_BASENAME ), [], WP2D_VERSION ); |
|
| 231 | + wp_enqueue_style( 'tag-it', plugins_url( '/css/tag-it.min.css', WP2D_BASENAME ), [ ], WP2D_VERSION ); |
|
| 232 | + wp_enqueue_style( 'chosen', plugins_url( '/css/chosen.min.css', WP2D_BASENAME ), [ ], WP2D_VERSION ); |
|
| 233 | + wp_enqueue_style( 'wp-to-diaspora-admin', plugins_url( '/css/wp-to-diaspora.css', WP2D_BASENAME ), [ ], WP2D_VERSION ); |
|
| 234 | 234 | wp_enqueue_script( 'chosen', plugins_url( '/js/chosen.jquery.min.js', WP2D_BASENAME ), [ 'jquery' ], WP2D_VERSION, true ); |
| 235 | 235 | wp_enqueue_script( 'tag-it', plugins_url( '/js/tag-it.jquery.min.js', WP2D_BASENAME ), [ 'jquery', 'jquery-ui-autocomplete' ], WP2D_VERSION, true ); |
| 236 | 236 | wp_enqueue_script( 'wp-to-diaspora-admin', plugins_url( '/js/wp-to-diaspora.js', WP2D_BASENAME ), [ 'jquery' ], WP2D_VERSION, true ); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @return array Links to display for plugin on plugins page. |
| 280 | 280 | */ |
| 281 | 281 | public function settings_link( $links ) { |
| 282 | - $links[] = '<a href="' . esc_url( admin_url( 'options-general.php?page=wp_to_diaspora' ) ) . '">' . __( 'Settings', 'wp-to-diaspora' ) . '</a>'; |
|
| 282 | + $links[ ] = '<a href="' . esc_url( admin_url( 'options-general.php?page=wp_to_diaspora' ) ) . '">' . __( 'Settings', 'wp-to-diaspora' ) . '</a>'; |
|
| 283 | 283 | |
| 284 | 284 | return $links; |
| 285 | 285 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | * @todo esc_html |
| 374 | 374 | */ |
| 375 | 375 | public function check_pod_connection_status_callback() { |
| 376 | - if ( ! defined( 'WP2D_DEBUGGING' ) && isset( $_REQUEST['debugging'] ) ) { // phpcs:ignore |
|
| 376 | + if ( ! defined( 'WP2D_DEBUGGING' ) && isset( $_REQUEST[ 'debugging' ] ) ) { // phpcs:ignore |
|
| 377 | 377 | define( 'WP2D_DEBUGGING', true ); |
| 378 | 378 | } |
| 379 | 379 | |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | if ( true === $status ) { |
| 392 | 392 | wp_send_json_success( $data ); |
| 393 | 393 | } elseif ( false === $status && $this->load_api()->has_last_error() ) { |
| 394 | - $data['message'] = $this->load_api()->get_last_error() . ' ' . WP2D_Contextual_Help::get_help_tab_quick_link( $this->load_api()->get_last_error_object() ); |
|
| 394 | + $data[ 'message' ] = $this->load_api()->get_last_error() . ' ' . WP2D_Contextual_Help::get_help_tab_quick_link( $this->load_api()->get_last_error_object() ); |
|
| 395 | 395 | wp_send_json_error( $data ); |
| 396 | 396 | } |
| 397 | 397 | // If $status === null, do nothing. |
@@ -71,7 +71,8 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | private function constants() { |
| 73 | 73 | // Are we in debugging mode? |
| 74 | - if ( isset( $_GET['debugging'] ) ) { // phpcs:ignore |
|
| 74 | + if ( isset( $_GET['debugging'] ) ) { |
|
| 75 | +// phpcs:ignore |
|
| 75 | 76 | define( 'WP2D_DEBUGGING', true ); |
| 76 | 77 | } |
| 77 | 78 | |
@@ -373,7 +374,8 @@ discard block |
||
| 373 | 374 | * @todo esc_html |
| 374 | 375 | */ |
| 375 | 376 | public function check_pod_connection_status_callback() { |
| 376 | - if ( ! defined( 'WP2D_DEBUGGING' ) && isset( $_REQUEST['debugging'] ) ) { // phpcs:ignore |
|
| 377 | + if ( ! defined( 'WP2D_DEBUGGING' ) && isset( $_REQUEST['debugging'] ) ) { |
|
| 378 | +// phpcs:ignore |
|
| 377 | 379 | define( 'WP2D_DEBUGGING', true ); |
| 378 | 380 | } |
| 379 | 381 | |
@@ -32,7 +32,8 @@ |
||
| 32 | 32 | // Make sure we're in debug mode. |
| 33 | 33 | if ( defined( 'WP2D_DEBUGGING' ) && true === WP2D_DEBUGGING ) { |
| 34 | 34 | $d = ''; |
| 35 | - foreach ( debug_backtrace() as $dbt ) { // phpcs:ignore |
|
| 35 | + foreach ( debug_backtrace() as $dbt ) { |
|
| 36 | +// phpcs:ignore |
|
| 36 | 37 | extract( $dbt ); // phpcs:ignore |
| 37 | 38 | // Only trace back as far as the plugin goes. |
| 38 | 39 | if ( strstr( $file, plugin_dir_path( __DIR__ ) ) ) { |
@@ -806,7 +806,8 @@ discard block |
||
| 806 | 806 | $latest_post = end( $diaspora_post_history ); |
| 807 | 807 | |
| 808 | 808 | // Only show if this post is showing a message and the post is a fresh share. |
| 809 | - if ( isset( $_GET['message'] ) && $post->post_modified === $latest_post['created_at'] ) { // phpcs:ignore |
|
| 809 | + if ( isset( $_GET['message'] ) && $post->post_modified === $latest_post['created_at'] ) { |
|
| 810 | +// phpcs:ignore |
|
| 810 | 811 | printf( |
| 811 | 812 | '<div class="updated notice is-dismissible"><p>%1$s <a href="%2$s" target="_blank">%3$s</a></p></div>', |
| 812 | 813 | esc_html__( 'Successfully posted to diaspora*.', 'wp-to-diaspora' ), |
@@ -824,7 +825,8 @@ discard block |
||
| 824 | 825 | */ |
| 825 | 826 | public function ignore_post_error() { |
| 826 | 827 | // If "Ignore" link has been clicked, delete the post error meta data. |
| 827 | - if ( isset( $_GET['wp2d_ignore_post_error'], $_GET['post'] ) ) { // phpcs:ignore |
|
| 828 | + if ( isset( $_GET['wp2d_ignore_post_error'], $_GET['post'] ) ) { |
|
| 829 | +// phpcs:ignore |
|
| 828 | 830 | delete_post_meta( absint( $_GET['post'] ), '_wp_to_diaspora_post_error' ); // phpcs:ignore |
| 829 | 831 | } |
| 830 | 832 | } |
@@ -858,7 +860,8 @@ discard block |
||
| 858 | 860 | $latest_post = end( $diaspora_post_history ); |
| 859 | 861 | |
| 860 | 862 | // Only show if this post is a fresh share. |
| 861 | - if ( get_post( $post_id )->post_modified === $latest_post['created_at'] ) { // phpcs:ignore |
|
| 863 | + if ( get_post( $post_id )->post_modified === $latest_post['created_at'] ) { |
|
| 864 | +// phpcs:ignore |
|
| 862 | 865 | wp_send_json_success( [ |
| 863 | 866 | 'message' => esc_html__( 'Successfully posted to diaspora*.', 'wp-to-diaspora' ), |
| 864 | 867 | 'action' => [ |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | // Unset post_to_diaspora meta field to prevent mistakenly republishing to diaspora*. |
| 279 | 279 | $meta = get_post_meta( $post_id, '_wp_to_diaspora', true ); |
| 280 | - $meta['post_to_diaspora'] = false; |
|
| 280 | + $meta[ 'post_to_diaspora' ] = false; |
|
| 281 | 281 | update_post_meta( $post_id, '_wp_to_diaspora', $meta ); |
| 282 | 282 | |
| 283 | 283 | // Prevent any duplicate hook firing. |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | private function get_full_content() { |
| 320 | 320 | // Only allow certain shortcodes. |
| 321 | 321 | global $shortcode_tags; |
| 322 | - $shortcode_tags_bkp = []; |
|
| 322 | + $shortcode_tags_bkp = [ ]; |
|
| 323 | 323 | |
| 324 | 324 | foreach ( $shortcode_tags as $shortcode_tag => $shortcode_function ) { |
| 325 | 325 | if ( ! in_array( $shortcode_tag, apply_filters( 'wp2d_shortcodes_filter', [ 'wp_caption', 'caption', 'gallery' ] ), true ) ) { |
@@ -407,12 +407,12 @@ discard block |
||
| 407 | 407 | $options = WP2D_Options::instance(); |
| 408 | 408 | $tags_to_post = $this->tags_to_post; |
| 409 | 409 | $tags_to_add = ''; |
| 410 | - $diaspora_tags = []; |
|
| 410 | + $diaspora_tags = [ ]; |
|
| 411 | 411 | |
| 412 | 412 | // Add any diaspora* tags? |
| 413 | 413 | if ( ! empty( $tags_to_post ) ) { |
| 414 | 414 | // The diaspora* tags to add to the post. |
| 415 | - $diaspora_tags_tmp = []; |
|
| 415 | + $diaspora_tags_tmp = [ ]; |
|
| 416 | 416 | |
| 417 | 417 | // Add global tags? |
| 418 | 418 | $global_tags = $options->get_option( 'global_tags' ); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | // Get all the tags and list them all nicely in a row. |
| 440 | 440 | foreach ( $diaspora_tags_tmp as $tag ) { |
| 441 | - $diaspora_tags[] = '#' . $tag; |
|
| 441 | + $diaspora_tags[ ] = '#' . $tag; |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | // Add all the found tags. |
@@ -498,11 +498,11 @@ discard block |
||
| 498 | 498 | private function save_to_history( $response ) { |
| 499 | 499 | // Make sure the post history is an array. |
| 500 | 500 | if ( empty( $this->post_history ) ) { |
| 501 | - $this->post_history = []; |
|
| 501 | + $this->post_history = [ ]; |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | // Add a new entry to the history. |
| 505 | - $this->post_history[] = [ |
|
| 505 | + $this->post_history[ ] = [ |
|
| 506 | 506 | 'id' => $response->id, |
| 507 | 507 | 'guid' => $response->guid, |
| 508 | 508 | 'created_at' => $this->post->post_modified, |
@@ -588,8 +588,8 @@ discard block |
||
| 588 | 588 | $content = do_shortcode( $content ); |
| 589 | 589 | |
| 590 | 590 | // If a caption attribute is defined, we'll add it after the image. |
| 591 | - if ( isset( $attr['caption'] ) && '' !== $attr['caption'] ) { |
|
| 592 | - $content .= "\n" . $this->get_img_caption( $attr['caption'] ); |
|
| 591 | + if ( isset( $attr[ 'caption' ] ) && '' !== $attr[ 'caption' ] ) { |
|
| 592 | + $content .= "\n" . $this->get_img_caption( $attr[ 'caption' ] ); |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | return $content; |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | */ |
| 607 | 607 | public function custom_gallery_shortcode( $attr ) { |
| 608 | 608 | // Try user value and fall back to default value in WordPress. |
| 609 | - $captiontag = $attr['captiontag'] ?? ( current_theme_supports( 'html5', 'gallery' ) ? 'figcaption' : 'dd' ); |
|
| 609 | + $captiontag = $attr[ 'captiontag' ] ?? ( current_theme_supports( 'html5', 'gallery' ) ? 'figcaption' : 'dd' ); |
|
| 610 | 610 | |
| 611 | 611 | // Let WordPress create the regular gallery. |
| 612 | 612 | $gallery = gallery_shortcode( $attr ); |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | * @return string Prettified gallery image caption. |
| 630 | 630 | */ |
| 631 | 631 | public function custom_gallery_regex_callback( $m ) { |
| 632 | - return $this->get_img_caption( $m[2] ); |
|
| 632 | + return $this->get_img_caption( $m[ 2 ] ); |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | /* |
@@ -672,18 +672,18 @@ discard block |
||
| 672 | 672 | $options = WP2D_Options::instance(); |
| 673 | 673 | |
| 674 | 674 | // Make sure we have some value for post meta fields. |
| 675 | - $this->custom_tags = $this->custom_tags ?: []; |
|
| 675 | + $this->custom_tags = $this->custom_tags ? : [ ]; |
|
| 676 | 676 | |
| 677 | 677 | // If this post is already published, don't post again to diaspora* by default. |
| 678 | 678 | $this->post_to_diaspora = ( $this->post_to_diaspora && 'publish' !== get_post_status( $this->ID ) ); |
| 679 | - $this->aspects = $this->aspects ?: []; |
|
| 680 | - $this->services = $this->services ?: []; |
|
| 679 | + $this->aspects = $this->aspects ? : [ ]; |
|
| 680 | + $this->services = $this->services ? : [ ]; |
|
| 681 | 681 | |
| 682 | 682 | // Have we already posted on diaspora*? |
| 683 | 683 | $diaspora_post_url = '#'; |
| 684 | 684 | if ( is_array( $this->post_history ) ) { |
| 685 | 685 | $latest_post = end( $this->post_history ); |
| 686 | - $diaspora_post_url = $latest_post['post_url']; |
|
| 686 | + $diaspora_post_url = $latest_post[ 'post_url' ]; |
|
| 687 | 687 | } |
| 688 | 688 | ?> |
| 689 | 689 | <p<?php echo '#' === $diaspora_post_url ? ' style="display: none;"' : ''; ?>><a id="diaspora-post-url" href="<?php echo esc_attr( $diaspora_post_url ); ?>" target="_blank"><?php esc_html_e( 'Already posted to diaspora*.', 'wp-to-diaspora' ); ?></a></p> |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | /* OK, it's safe for us to save the data now. */ |
| 719 | 719 | |
| 720 | 720 | // Meta data to save. |
| 721 | - $meta_to_save = $_POST['wp_to_diaspora_settings']; // phpcs:ignore |
|
| 721 | + $meta_to_save = $_POST[ 'wp_to_diaspora_settings' ]; // phpcs:ignore |
|
| 722 | 722 | $options = WP2D_Options::instance(); |
| 723 | 723 | |
| 724 | 724 | // Checkboxes. |
@@ -731,13 +731,13 @@ discard block |
||
| 731 | 731 | $options->validate_multi_selects( 'tags_to_post', $meta_to_save ); |
| 732 | 732 | |
| 733 | 733 | // Save custom tags as array. |
| 734 | - $options->validate_tags( $meta_to_save['custom_tags'] ); |
|
| 734 | + $options->validate_tags( $meta_to_save[ 'custom_tags' ] ); |
|
| 735 | 735 | |
| 736 | 736 | // Clean up the list of aspects. If the list is empty, only use the 'Public' aspect. |
| 737 | - $options->validate_aspects_services( $meta_to_save['aspects'], [ 'public' ] ); |
|
| 737 | + $options->validate_aspects_services( $meta_to_save[ 'aspects' ], [ 'public' ] ); |
|
| 738 | 738 | |
| 739 | 739 | // Clean up the list of services. |
| 740 | - $options->validate_aspects_services( $meta_to_save['services'] ); |
|
| 740 | + $options->validate_aspects_services( $meta_to_save[ 'services' ] ); |
|
| 741 | 741 | |
| 742 | 742 | // Update the meta data for this post. |
| 743 | 743 | update_post_meta( $post_id, '_wp_to_diaspora', $meta_to_save ); |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | */ |
| 753 | 753 | private function is_safe_to_save() { |
| 754 | 754 | // Verify that our nonce is set and valid. |
| 755 | - if ( ! ( isset( $_POST['wp_to_diaspora_meta_box_nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['wp_to_diaspora_meta_box_nonce'] ), 'wp_to_diaspora_meta_box' ) ) ) { |
|
| 755 | + if ( ! ( isset( $_POST[ 'wp_to_diaspora_meta_box_nonce' ] ) && wp_verify_nonce( sanitize_key( $_POST[ 'wp_to_diaspora_meta_box_nonce' ] ), 'wp_to_diaspora_meta_box' ) ) ) { |
|
| 756 | 756 | return false; |
| 757 | 757 | } |
| 758 | 758 | |
@@ -762,13 +762,13 @@ discard block |
||
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | // Check the user's permissions. |
| 765 | - $permission = ( isset( $_POST['post_type'] ) && 'page' === $_POST['post_type'] ) ? 'edit_pages' : 'edit_posts'; |
|
| 765 | + $permission = ( isset( $_POST[ 'post_type' ] ) && 'page' === $_POST[ 'post_type' ] ) ? 'edit_pages' : 'edit_posts'; |
|
| 766 | 766 | if ( ! current_user_can( $permission, $this->ID ) ) { |
| 767 | 767 | return false; |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | // Make real sure that we have some meta data to save. |
| 771 | - if ( ! isset( $_POST['wp_to_diaspora_settings'] ) ) { |
|
| 771 | + if ( ! isset( $_POST[ 'wp_to_diaspora_settings' ] ) ) { |
|
| 772 | 772 | return false; |
| 773 | 773 | } |
| 774 | 774 | |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | '<div class="error notice is-dismissible"><p>%1$s %2$s %3$s <a href="%4$s">%5$s</a></p></div>', |
| 798 | 798 | esc_html__( 'Failed to post to diaspora*.', 'wp-to-diaspora' ), |
| 799 | 799 | esc_html( $error->get_error_message() ), |
| 800 | - $help_link, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 800 | + $help_link, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 801 | 801 | esc_url( add_query_arg( 'wp2d_ignore_post_error', '' ) ), |
| 802 | 802 | esc_html__( 'Ignore', 'wp-to-diaspora' ) |
| 803 | 803 | ); |
@@ -806,11 +806,11 @@ discard block |
||
| 806 | 806 | $latest_post = end( $diaspora_post_history ); |
| 807 | 807 | |
| 808 | 808 | // Only show if this post is showing a message and the post is a fresh share. |
| 809 | - if ( isset( $_GET['message'] ) && $post->post_modified === $latest_post['created_at'] ) { // phpcs:ignore |
|
| 809 | + if ( isset( $_GET[ 'message' ] ) && $post->post_modified === $latest_post[ 'created_at' ] ) { // phpcs:ignore |
|
| 810 | 810 | printf( |
| 811 | 811 | '<div class="updated notice is-dismissible"><p>%1$s <a href="%2$s" target="_blank">%3$s</a></p></div>', |
| 812 | 812 | esc_html__( 'Successfully posted to diaspora*.', 'wp-to-diaspora' ), |
| 813 | - esc_url( $latest_post['post_url'] ), |
|
| 813 | + esc_url( $latest_post[ 'post_url' ] ), |
|
| 814 | 814 | esc_html__( 'View Post', 'wp-to-diaspora' ) |
| 815 | 815 | ); |
| 816 | 816 | } |
@@ -824,8 +824,8 @@ discard block |
||
| 824 | 824 | */ |
| 825 | 825 | public function ignore_post_error() { |
| 826 | 826 | // If "Ignore" link has been clicked, delete the post error meta data. |
| 827 | - if ( isset( $_GET['wp2d_ignore_post_error'], $_GET['post'] ) ) { // phpcs:ignore |
|
| 828 | - delete_post_meta( absint( $_GET['post'] ), '_wp_to_diaspora_post_error' ); // phpcs:ignore |
|
| 827 | + if ( isset( $_GET[ 'wp2d_ignore_post_error' ], $_GET[ 'post' ] ) ) { // phpcs:ignore |
|
| 828 | + delete_post_meta( absint( $_GET[ 'post' ] ), '_wp_to_diaspora_post_error' ); // phpcs:ignore |
|
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | ] ); |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | - $post_id = sanitize_key( $_REQUEST['post_id'] ?? '' ); |
|
| 844 | + $post_id = sanitize_key( $_REQUEST[ 'post_id' ] ?? '' ); |
|
| 845 | 845 | if ( ! is_numeric( $post_id ) ) { |
| 846 | 846 | return; |
| 847 | 847 | } |
@@ -858,12 +858,12 @@ discard block |
||
| 858 | 858 | $latest_post = end( $diaspora_post_history ); |
| 859 | 859 | |
| 860 | 860 | // Only show if this post is a fresh share. |
| 861 | - if ( get_post( $post_id )->post_modified === $latest_post['created_at'] ) { // phpcs:ignore |
|
| 861 | + if ( get_post( $post_id )->post_modified === $latest_post[ 'created_at' ] ) { // phpcs:ignore |
|
| 862 | 862 | wp_send_json_success( [ |
| 863 | 863 | 'message' => esc_html__( 'Successfully posted to diaspora*.', 'wp-to-diaspora' ), |
| 864 | 864 | 'action' => [ |
| 865 | 865 | 'label' => esc_html__( 'View Post', 'wp-to-diaspora' ), |
| 866 | - 'url' => esc_url( $latest_post['post_url'] ), |
|
| 866 | + 'url' => esc_url( $latest_post[ 'post_url' ] ), |
|
| 867 | 867 | ], |
| 868 | 868 | ] ); |
| 869 | 869 | } |
@@ -255,7 +255,7 @@ |
||
| 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 | } |