@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @return string Return the currently selected tab. |
| 105 | 105 | */ |
| 106 | 106 | private function _current_tab( $default = 'defaults' ) { |
| 107 | - $tab = ( isset ( $_GET['tab'] ) ? $_GET['tab'] : $default ); |
|
| 107 | + $tab = ( isset ( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : $default ); |
|
| 108 | 108 | |
| 109 | 109 | // If the pod settings aren't configured yet, open the 'Setup' tab. |
| 110 | 110 | if ( ! $this->is_pod_set_up() ) { |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | // The array defining all options sections to be shown as tabs. |
| 125 | 125 | $tabs = array(); |
| 126 | 126 | if ( $this->is_pod_set_up() ) { |
| 127 | - $tabs['defaults'] = __( 'Defaults', 'wp-to-diaspora' ); |
|
| 127 | + $tabs[ 'defaults' ] = __( 'Defaults', 'wp-to-diaspora' ); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // Add the 'Setup' tab to the end of the list. |
| 131 | - $tabs['setup'] = __( 'Setup', 'wp-to-diaspora' ) . '<span id="pod-connection-status" class="dashicons-before hidden"></span><span class="spinner"></span>'; |
|
| 131 | + $tabs[ 'setup' ] = __( 'Setup', 'wp-to-diaspora' ) . '<span id="pod-connection-status" class="dashicons-before hidden"></span><span class="spinner"></span>'; |
|
| 132 | 132 | |
| 133 | 133 | // Container for all options tabs. |
| 134 | 134 | $out = '<h2 id="options-tabs" class="nav-tab-wrapper">'; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | do_settings_sections( 'wp_to_diaspora_settings' ); |
| 221 | 221 | |
| 222 | 222 | // Get the name of the current tab, if set, else take the first one from the list. |
| 223 | - $tab = $this->_current_tab( $page_tabs[0] ); |
|
| 223 | + $tab = $this->_current_tab( $page_tabs[ 0 ] ); |
|
| 224 | 224 | |
| 225 | 225 | // Add Save and Reset buttons. |
| 226 | 226 | 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' ) . '" /> '; |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | <select id="tags-to-post" multiple data-placeholder="<?php esc_attr_e( 'No tags', 'wp-to-diaspora' ); ?>" class="chosen" name="wp_to_diaspora_settings[tags_to_post][]"> |
| 599 | 599 | <option value="global" <?php selected( in_array( 'global', $tags_to_post ) ); ?>><?php esc_html_e( 'Global tags', 'wp-to-diaspora' ); ?></option> |
| 600 | 600 | <option value="custom" <?php selected( in_array( 'custom', $tags_to_post ) ); ?>><?php esc_html_e( 'Custom tags', 'wp-to-diaspora' ); ?></option> |
| 601 | - <option value="post" <?php selected( in_array( 'post', $tags_to_post ) ); ?>><?php esc_html_e( 'Post tags', 'wp-to-diaspora' ); ?></option> |
|
| 601 | + <option value="post" <?php selected( in_array( 'post', $tags_to_post ) ); ?>><?php esc_html_e( 'Post tags', 'wp-to-diaspora' ); ?></option> |
|
| 602 | 602 | </select> |
| 603 | 603 | |
| 604 | 604 | <?php if ( $on_settings_page ) : ?> |
@@ -664,14 +664,14 @@ discard block |
||
| 664 | 664 | esc_url( 'https://' . $this->get_option( 'pod' ) . '/services' ), |
| 665 | 665 | esc_html__( 'Show available services on my pod.', 'wp-to-diaspora' ) |
| 666 | 666 | ); |
| 667 | - $empty_label = esc_html__( 'No services connected yet.', 'wp-to-diaspora' ); |
|
| 667 | + $empty_label = esc_html__( 'No services connected yet.', 'wp-to-diaspora' ); |
|
| 668 | 668 | break; |
| 669 | 669 | |
| 670 | 670 | default: |
| 671 | 671 | return; |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - $items = array_filter( (array) $items ) ?: array(); |
|
| 674 | + $items = array_filter( (array) $items ) ? : array(); |
|
| 675 | 675 | |
| 676 | 676 | // Special case for this field if it's displayed on the settings page. |
| 677 | 677 | $on_settings_page = ( 'settings_page_wp_to_diaspora' === get_current_screen()->id ); |
@@ -798,30 +798,30 @@ discard block |
||
| 798 | 798 | /* Validate all settings before saving to the database. */ |
| 799 | 799 | |
| 800 | 800 | // Saving the pod setup details. |
| 801 | - if ( isset( $input['submit_setup'] ) ) { |
|
| 802 | - $input['pod'] = trim( sanitize_text_field( $input['pod'] ), ' /' ); |
|
| 803 | - $input['username'] = sanitize_text_field( $input['username'] ); |
|
| 804 | - $input['password'] = sanitize_text_field( $input['password'] ); |
|
| 801 | + if ( isset( $input[ 'submit_setup' ] ) ) { |
|
| 802 | + $input[ 'pod' ] = trim( sanitize_text_field( $input[ 'pod' ] ), ' /' ); |
|
| 803 | + $input[ 'username' ] = sanitize_text_field( $input[ 'username' ] ); |
|
| 804 | + $input[ 'password' ] = sanitize_text_field( $input[ 'password' ] ); |
|
| 805 | 805 | |
| 806 | 806 | // If password is blank, it hasn't been changed. |
| 807 | 807 | // 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. |
| 808 | - if ( '' === $input['password'] || $this->get_option( 'password' ) === $input['password'] ) { |
|
| 809 | - $input['password'] = $this->get_option( 'password' ); |
|
| 808 | + if ( '' === $input[ 'password' ] || $this->get_option( 'password' ) === $input[ 'password' ] ) { |
|
| 809 | + $input[ 'password' ] = $this->get_option( 'password' ); |
|
| 810 | 810 | } else { |
| 811 | - $input['password'] = WP2D_Helpers::encrypt( $input['password'] ); |
|
| 811 | + $input[ 'password' ] = WP2D_Helpers::encrypt( $input[ 'password' ] ); |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | // This is for when JS in not enabled, to make sure that the aspects and services |
| 815 | 815 | // are refetched when displaying the options page after saving. |
| 816 | - if ( isset( $input['no_js'] ) ) { |
|
| 816 | + if ( isset( $input[ 'no_js' ] ) ) { |
|
| 817 | 817 | set_transient( 'wp2d_no_js_force_refetch', true ); |
| 818 | 818 | } |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | // Saving the default options. |
| 822 | - if ( isset( $input['submit_defaults'] ) ) { |
|
| 823 | - if ( ! isset( $input['enabled_post_types'] ) ) { |
|
| 824 | - $input['enabled_post_types'] = array(); |
|
| 822 | + if ( isset( $input[ 'submit_defaults' ] ) ) { |
|
| 823 | + if ( ! isset( $input[ 'enabled_post_types' ] ) ) { |
|
| 824 | + $input[ 'enabled_post_types' ] = array(); |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | 827 | // Checkboxes. |
@@ -834,29 +834,29 @@ discard block |
||
| 834 | 834 | $this->validate_multi_selects( 'tags_to_post', $input ); |
| 835 | 835 | |
| 836 | 836 | // Get unique, non-empty, trimmed tags and clean them up. |
| 837 | - $this->validate_tags( $input['global_tags'] ); |
|
| 837 | + $this->validate_tags( $input[ 'global_tags' ] ); |
|
| 838 | 838 | |
| 839 | 839 | // Clean up the list of aspects. If the list is empty, only use the 'Public' aspect. |
| 840 | - $this->validate_aspects_services( $input['aspects'], array( 'public' ) ); |
|
| 840 | + $this->validate_aspects_services( $input[ 'aspects' ], array( 'public' ) ); |
|
| 841 | 841 | |
| 842 | 842 | // Clean up the list of services. |
| 843 | - $this->validate_aspects_services( $input['services'] ); |
|
| 843 | + $this->validate_aspects_services( $input[ 'services' ] ); |
|
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | // Reset to defaults. |
| 847 | - if ( isset( $input['reset_defaults'] ) ) { |
|
| 847 | + if ( isset( $input[ 'reset_defaults' ] ) ) { |
|
| 848 | 848 | // Set the input to the default options. |
| 849 | 849 | $input = self::$_default_options; |
| 850 | 850 | |
| 851 | 851 | // Don't reset the fetched lists of aspects and services. |
| 852 | - unset( $input['aspects_list'] ); |
|
| 853 | - unset( $input['services_list'] ); |
|
| 852 | + unset( $input[ 'aspects_list' ] ); |
|
| 853 | + unset( $input[ 'services_list' ] ); |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | // Unset all unused input fields. |
| 857 | - unset( $input['submit_defaults'] ); |
|
| 858 | - unset( $input['reset_defaults'] ); |
|
| 859 | - unset( $input['submit_setup'] ); |
|
| 857 | + unset( $input[ 'submit_defaults' ] ); |
|
| 858 | + unset( $input[ 'reset_defaults' ] ); |
|
| 859 | + unset( $input[ 'submit_setup' ] ); |
|
| 860 | 860 | |
| 861 | 861 | // Parse inputs with default options and return. |
| 862 | 862 | return wp_parse_args( $input, array_merge( self::$_default_options, self::$_options ) ); |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | * @since 1.5.0 |
| 42 | 42 | */ |
| 43 | 43 | private function _constants() { |
| 44 | - define( 'WP2D_EXT_WPORG', esc_url( 'https://wordpress.org/plugins/wp-to-diaspora' ) ); |
|
| 45 | - define( 'WP2D_EXT_I18N', esc_url( 'https://poeditor.com/join/project?hash=c085b3654a5e04c69ec942e0f136716a' ) ); |
|
| 46 | - define( 'WP2D_EXT_GH', esc_url( 'https://github.com/DiasPHPora/wp-to-diaspora' ) ); |
|
| 47 | - define( 'WP2D_EXT_DONATE', esc_url( 'https://github.com/DiasPHPora/wp-to-diaspora#donate' ) ); |
|
| 48 | - define( 'WP2D_EXT_GH_ISSUES', esc_url( 'https://github.com/DiasPHPora/wp-to-diaspora/issues' ) ); |
|
| 44 | + define( 'WP2D_EXT_WPORG', esc_url( 'https://wordpress.org/plugins/wp-to-diaspora' ) ); |
|
| 45 | + define( 'WP2D_EXT_I18N', esc_url( 'https://poeditor.com/join/project?hash=c085b3654a5e04c69ec942e0f136716a' ) ); |
|
| 46 | + define( 'WP2D_EXT_GH', esc_url( 'https://github.com/DiasPHPora/wp-to-diaspora' ) ); |
|
| 47 | + define( 'WP2D_EXT_DONATE', esc_url( 'https://github.com/DiasPHPora/wp-to-diaspora#donate' ) ); |
|
| 48 | + define( 'WP2D_EXT_GH_ISSUES', esc_url( 'https://github.com/DiasPHPora/wp-to-diaspora/issues' ) ); |
|
| 49 | 49 | define( 'WP2D_EXT_GH_ISSUES_NEW', esc_url( 'https://github.com/DiasPHPora/wp-to-diaspora/issues/new' ) ); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | get_current_screen()->set_help_sidebar( |
| 90 | 90 | '<p><strong>' . esc_html__( 'WP to diaspora*', 'wp-to-diaspora' ) . '</strong></p> |
| 91 | 91 | <ul> |
| 92 | - <li><a href="' . WP2D_EXT_GH . '" target="_blank">GitHub</a> |
|
| 93 | - <li><a href="' . WP2D_EXT_WPORG . '" target="_blank">WordPress.org</a> |
|
| 94 | - <li><a href="' . WP2D_EXT_I18N . '" target="_blank">' . esc_html__( 'Help with translations', 'wp-to-diaspora' ) . '</a> |
|
| 95 | - <li><a href="' . WP2D_EXT_DONATE . '" target="_blank">' . esc_html__( 'Make a donation', 'wp-to-diaspora' ) . '</a> |
|
| 92 | + <li><a href="' . WP2D_EXT_GH . '" target="_blank">GitHub</a> |
|
| 93 | + <li><a href="' . WP2D_EXT_WPORG . '" target="_blank">WordPress.org</a> |
|
| 94 | + <li><a href="' . WP2D_EXT_I18N . '" target="_blank">' . esc_html__( 'Help with translations', 'wp-to-diaspora' ) . '</a> |
|
| 95 | + <li><a href="' . WP2D_EXT_DONATE . '" target="_blank">' . esc_html__( 'Make a donation', 'wp-to-diaspora' ) . '</a> |
|
| 96 | 96 | </ul>' |
| 97 | 97 | ); |
| 98 | 98 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 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 | - <li><strong>' . esc_html__( 'Post tags', 'wp-to-diaspora' ) . '</strong>: ' . esc_html__( 'Default WordPress Tags of individual posts.', 'wp-to-diaspora' ) . ' |
|
| 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 | 156 | esc_html__( 'A list of tags that gets added to every post.', 'wp-to-diaspora' ) . ' |
@@ -217,10 +217,10 @@ discard block |
||
| 217 | 217 | 'content' => '<p><strong>' . esc_html__( 'So you feel like contributing to the WP to diaspora* plugin? Great!', 'wp-to-diaspora' ) . '</strong></p> |
| 218 | 218 | <p>' . esc_html__( 'There are many different ways that you can help out with this plugin:', 'wp-to-diaspora' ) . '</p> |
| 219 | 219 | <ul> |
| 220 | - <li><a href="' . WP2D_EXT_GH_ISSUES_NEW . '" target="_blank">' . esc_html__( 'Report a bug', 'wp-to-diaspora' ) . '</a> |
|
| 221 | - <li><a href="' . WP2D_EXT_GH_ISSUES_NEW . '" target="_blank">' . esc_html__( 'Suggest a new feature', 'wp-to-diaspora' ) . '</a> |
|
| 222 | - <li><a href="' . WP2D_EXT_I18N . '" target="_blank">' . esc_html__( 'Help with translations', 'wp-to-diaspora' ) . '</a> |
|
| 223 | - <li><a href="' . WP2D_EXT_DONATE . '" target="_blank">' . esc_html__( 'Make a donation', 'wp-to-diaspora' ) . '</a> |
|
| 220 | + <li><a href="' . WP2D_EXT_GH_ISSUES_NEW . '" target="_blank">' . esc_html__( 'Report a bug', 'wp-to-diaspora' ) . '</a> |
|
| 221 | + <li><a href="' . WP2D_EXT_GH_ISSUES_NEW . '" target="_blank">' . esc_html__( 'Suggest a new feature', 'wp-to-diaspora' ) . '</a> |
|
| 222 | + <li><a href="' . WP2D_EXT_I18N . '" target="_blank">' . esc_html__( 'Help with translations', 'wp-to-diaspora' ) . '</a> |
|
| 223 | + <li><a href="' . WP2D_EXT_DONATE . '" target="_blank">' . esc_html__( 'Make a donation', 'wp-to-diaspora' ) . '</a> |
|
| 224 | 224 | </ul>', |
| 225 | 225 | ) ); |
| 226 | 226 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | public static function get_help_tab_quick_link( $error ) { |
| 251 | 251 | $help_tab = ''; |
| 252 | 252 | if ( is_wp_error( $error ) && ( $error_data = $error->get_error_data() ) && array_key_exists( 'help_tab', $error_data ) ) { |
| 253 | - $help_tab = $error_data['help_tab']; |
|
| 253 | + $help_tab = $error_data[ 'help_tab' ]; |
|
| 254 | 254 | } elseif ( is_string( $error ) ) { |
| 255 | 255 | $help_tab = $error; |
| 256 | 256 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 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 |
||
| 117 | 117 | */ |
| 118 | 118 | private function _version_check() { |
| 119 | 119 | // Check for version requirements. |
| 120 | - if ( version_compare( $GLOBALS['wp_version'], $this->_min_wp, '<' ) |
|
| 120 | + if ( version_compare( $GLOBALS[ 'wp_version' ], $this->_min_wp, '<' ) |
|
| 121 | 121 | || version_compare( PHP_VERSION, $this->_min_php, '<' ) ) { |
| 122 | 122 | add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
| 123 | 123 | return false; |
@@ -136,12 +136,12 @@ discard block |
||
| 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 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $tags_to_post = array_filter( array( |
| 237 | 237 | ( ( false !== strpos( $tags_to_post_old, 'g' ) ) ? 'global' : null ), |
| 238 | 238 | ( ( false !== strpos( $tags_to_post_old, 'c' ) ) ? 'custom' : null ), |
| 239 | - ( ( false !== strpos( $tags_to_post_old, 'p' ) ) ? 'post' : null ), |
|
| 239 | + ( ( false !== strpos( $tags_to_post_old, 'p' ) ) ? 'post' : null ), |
|
| 240 | 240 | ) ); |
| 241 | 241 | $options->set_option( 'tags_to_post', $tags_to_post ); |
| 242 | 242 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @return array Links to display for plugin on plugins page. |
| 291 | 291 | */ |
| 292 | 292 | public function settings_link( $links ) { |
| 293 | - $links[] = '<a href="' . admin_url( 'options-general.php?page=wp_to_diaspora' ) . '">' . __( 'Settings' ) . '</a>'; |
|
| 293 | + $links[ ] = '<a href="' . admin_url( 'options-general.php?page=wp_to_diaspora' ) . '">' . __( 'Settings' ) . '</a>'; |
|
| 294 | 294 | return $links; |
| 295 | 295 | } |
| 296 | 296 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | * @todo esc_html |
| 379 | 379 | */ |
| 380 | 380 | public function check_pod_connection_status_callback() { |
| 381 | - if ( isset( $_REQUEST['debugging'] ) && ! defined( 'WP2D_DEBUGGING' ) ) { |
|
| 381 | + if ( isset( $_REQUEST[ 'debugging' ] ) && ! defined( 'WP2D_DEBUGGING' ) ) { |
|
| 382 | 382 | define( 'WP2D_DEBUGGING', true ); |
| 383 | 383 | } |
| 384 | 384 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | if ( true === $status ) { |
| 393 | 393 | wp_send_json_success( $data ); |
| 394 | 394 | } elseif ( false === $status && $this->_load_api()->has_last_error() ) { |
| 395 | - $data['message'] = $this->_load_api()->get_last_error() . ' ' . WP2D_Contextual_Help::get_help_tab_quick_link( $this->_load_api()->get_last_error_object() ); |
|
| 395 | + $data[ 'message' ] = $this->_load_api()->get_last_error() . ' ' . WP2D_Contextual_Help::get_help_tab_quick_link( $this->_load_api()->get_last_error_object() ); |
|
| 396 | 396 | wp_send_json_error( $data ); |
| 397 | 397 | } |
| 398 | 398 | // If $status === null, do nothing. |