@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | 32 | // Exit if accessed directly. |
| 33 | -defined( 'ABSPATH' ) || exit; |
|
| 33 | +defined('ABSPATH') || exit; |
|
| 34 | 34 | |
| 35 | 35 | // Set the current version. |
| 36 | -define( 'WP2D_VERSION', '1.7.2' ); |
|
| 36 | +define('WP2D_VERSION', '1.7.2'); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * WP to diaspora* main plugin class. |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | * @return WP_To_Diaspora Instance of this class. |
| 79 | 79 | */ |
| 80 | 80 | public static function instance() { |
| 81 | - if ( ! isset( self::$_instance ) ) { |
|
| 81 | + if ( ! isset(self::$_instance)) { |
|
| 82 | 82 | self::$_instance = new self(); |
| 83 | 83 | self::$_instance->_constants(); |
| 84 | - if ( self::$_instance->_version_check() ) { |
|
| 84 | + if (self::$_instance->_version_check()) { |
|
| 85 | 85 | self::$_instance->_includes(); |
| 86 | 86 | self::$_instance->_setup(); |
| 87 | 87 | } else { |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | private function _constants() { |
| 100 | 100 | // Are we in debugging mode? |
| 101 | - if ( isset( $_GET['debugging'] ) ) { |
|
| 102 | - define( 'WP2D_DEBUGGING', true ); |
|
| 101 | + if (isset($_GET['debugging'])) { |
|
| 102 | + define('WP2D_DEBUGGING', true); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - define( 'WP2D_DIR', dirname( __FILE__ ) ); |
|
| 106 | - define( 'WP2D_LIB_DIR', WP2D_DIR . '/lib' ); |
|
| 107 | - define( 'WP2D_VENDOR_DIR', WP2D_DIR . '/vendor' ); |
|
| 105 | + define('WP2D_DIR', dirname(__FILE__)); |
|
| 106 | + define('WP2D_LIB_DIR', WP2D_DIR.'/lib'); |
|
| 107 | + define('WP2D_VENDOR_DIR', WP2D_DIR.'/vendor'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | private function _version_check() { |
| 118 | 118 | // Check for version requirements. |
| 119 | - if ( version_compare( $GLOBALS['wp_version'], $this->_min_wp, '<' ) |
|
| 120 | - || version_compare( PHP_VERSION, $this->_min_php, '<' ) ) { |
|
| 121 | - add_action( 'admin_notices', array( $this, 'deactivate' ) ); |
|
| 119 | + if (version_compare($GLOBALS['wp_version'], $this->_min_wp, '<') |
|
| 120 | + || version_compare(PHP_VERSION, $this->_min_php, '<')) { |
|
| 121 | + add_action('admin_notices', array($this, 'deactivate')); |
|
| 122 | 122 | return false; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function deactivate() { |
| 134 | 134 | // First of all, deactivate the plugin. |
| 135 | - deactivate_plugins( plugin_basename( __FILE__ ) ); |
|
| 135 | + deactivate_plugins(plugin_basename(__FILE__)); |
|
| 136 | 136 | |
| 137 | 137 | // Get rid of the "Plugin activated" message. |
| 138 | - unset( $_GET['activate'] ); |
|
| 138 | + unset($_GET['activate']); |
|
| 139 | 139 | |
| 140 | 140 | // Then display the admin notice. |
| 141 | 141 | ?> |
| 142 | 142 | <div class="error"> |
| 143 | - <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> |
|
| 143 | + <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 | 144 | </div> |
| 145 | 145 | <?php |
| 146 | 146 | } |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | * @since 1.5.0 |
| 152 | 152 | */ |
| 153 | 153 | private function _includes() { |
| 154 | - require WP2D_VENDOR_DIR . '/autoload.php'; |
|
| 155 | - require_once WP2D_LIB_DIR . '/class-api.php'; |
|
| 156 | - require_once WP2D_LIB_DIR . '/class-contextual-help.php'; |
|
| 157 | - require_once WP2D_LIB_DIR . '/class-helpers.php'; |
|
| 158 | - require_once WP2D_LIB_DIR . '/class-options.php'; |
|
| 159 | - require_once WP2D_LIB_DIR . '/class-post.php'; |
|
| 154 | + require WP2D_VENDOR_DIR.'/autoload.php'; |
|
| 155 | + require_once WP2D_LIB_DIR.'/class-api.php'; |
|
| 156 | + require_once WP2D_LIB_DIR.'/class-contextual-help.php'; |
|
| 157 | + require_once WP2D_LIB_DIR.'/class-helpers.php'; |
|
| 158 | + require_once WP2D_LIB_DIR.'/class-options.php'; |
|
| 159 | + require_once WP2D_LIB_DIR.'/class-post.php'; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -165,30 +165,30 @@ discard block |
||
| 165 | 165 | private function _setup() { |
| 166 | 166 | |
| 167 | 167 | // Load languages. |
| 168 | - add_action( 'plugins_loaded', array( $this, 'l10n' ) ); |
|
| 168 | + add_action('plugins_loaded', array($this, 'l10n')); |
|
| 169 | 169 | |
| 170 | 170 | // Add "Settings" link to plugin page. |
| 171 | - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'settings_link' ) ); |
|
| 171 | + add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'settings_link')); |
|
| 172 | 172 | |
| 173 | 173 | // Perform any necessary data upgrades. |
| 174 | - add_action( 'admin_init', array( $this, 'upgrade' ) ); |
|
| 174 | + add_action('admin_init', array($this, 'upgrade')); |
|
| 175 | 175 | |
| 176 | 176 | // Enqueue CSS and JS scripts. |
| 177 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_load_scripts' ) ); |
|
| 177 | + add_action('admin_enqueue_scripts', array($this, 'admin_load_scripts')); |
|
| 178 | 178 | |
| 179 | 179 | // Set up the options. |
| 180 | - add_action( 'init', array( 'WP2D_Options', 'instance' ) ); |
|
| 180 | + add_action('init', array('WP2D_Options', 'instance')); |
|
| 181 | 181 | |
| 182 | 182 | // WP2D Post. |
| 183 | - add_action( 'init', array( 'WP2D_Post', 'setup' ) ); |
|
| 183 | + add_action('init', array('WP2D_Post', 'setup')); |
|
| 184 | 184 | |
| 185 | 185 | // AJAX actions for loading pods, aspects and services. |
| 186 | - add_action( 'wp_ajax_wp_to_diaspora_update_pod_list', array( $this, 'update_pod_list_callback' ) ); |
|
| 187 | - add_action( 'wp_ajax_wp_to_diaspora_update_aspects_list', array( $this, 'update_aspects_list_callback' ) ); |
|
| 188 | - add_action( 'wp_ajax_wp_to_diaspora_update_services_list', array( $this, 'update_services_list_callback' ) ); |
|
| 186 | + add_action('wp_ajax_wp_to_diaspora_update_pod_list', array($this, 'update_pod_list_callback')); |
|
| 187 | + add_action('wp_ajax_wp_to_diaspora_update_aspects_list', array($this, 'update_aspects_list_callback')); |
|
| 188 | + add_action('wp_ajax_wp_to_diaspora_update_services_list', array($this, 'update_services_list_callback')); |
|
| 189 | 189 | |
| 190 | 190 | // Check the pod connection status on the options page. |
| 191 | - add_action( 'wp_ajax_wp_to_diaspora_check_pod_connection_status', array( $this, 'check_pod_connection_status_callback' ) ); |
|
| 191 | + add_action('wp_ajax_wp_to_diaspora_check_pod_connection_status', array($this, 'check_pod_connection_status_callback')); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @return WP2D_API|boolean The API object, or false. |
| 198 | 198 | */ |
| 199 | 199 | private function _load_api() { |
| 200 | - if ( ! isset( $this->_api ) ) { |
|
| 200 | + if ( ! isset($this->_api)) { |
|
| 201 | 201 | $this->_api = WP2D_Helpers::api_quick_connect(); |
| 202 | 202 | } |
| 203 | 203 | return $this->_api; |
@@ -209,40 +209,40 @@ discard block |
||
| 209 | 209 | public function upgrade() { |
| 210 | 210 | // Get the current options, or assign defaults. |
| 211 | 211 | $options = WP2D_Options::instance(); |
| 212 | - $version = $options->get_option( 'version' ); |
|
| 212 | + $version = $options->get_option('version'); |
|
| 213 | 213 | |
| 214 | 214 | // If the versions differ, this is probably an update. Need to save updated options. |
| 215 | - if ( WP2D_VERSION !== $version ) { |
|
| 215 | + if (WP2D_VERSION !== $version) { |
|
| 216 | 216 | |
| 217 | 217 | // Password is stored encrypted since version 1.2.7. |
| 218 | 218 | // When upgrading to it, the plain text password is encrypted and saved again. |
| 219 | - if ( version_compare( $version, '1.2.7', '<' ) ) { |
|
| 220 | - $options->set_option( 'password', WP2D_Helpers::encrypt( (string) $options->get_option( 'password' ) ) ); |
|
| 219 | + if (version_compare($version, '1.2.7', '<')) { |
|
| 220 | + $options->set_option('password', WP2D_Helpers::encrypt((string) $options->get_option('password'))); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - if ( version_compare( $version, '1.3.0', '<' ) ) { |
|
| 223 | + if (version_compare($version, '1.3.0', '<')) { |
|
| 224 | 224 | // The 'user' setting is renamed to 'username'. |
| 225 | - $options->set_option( 'username', $options->get_option( 'user' ) ); |
|
| 226 | - $options->set_option( 'user', null ); |
|
| 225 | + $options->set_option('username', $options->get_option('user')); |
|
| 226 | + $options->set_option('user', null); |
|
| 227 | 227 | |
| 228 | 228 | // Save tags as arrays instead of comma seperated values. |
| 229 | - $global_tags = $options->get_option( 'global_tags' ); |
|
| 230 | - $options->set_option( 'global_tags', $options->validate_tags( $global_tags ) ); |
|
| 229 | + $global_tags = $options->get_option('global_tags'); |
|
| 230 | + $options->set_option('global_tags', $options->validate_tags($global_tags)); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if ( version_compare( $version, '1.4.0', '<' ) ) { |
|
| 233 | + if (version_compare($version, '1.4.0', '<')) { |
|
| 234 | 234 | // Turn tags_to_post string into an array. |
| 235 | - $tags_to_post_old = $options->get_option( 'tags_to_post' ); |
|
| 236 | - $tags_to_post = array_filter( array( |
|
| 237 | - ( ( false !== strpos( $tags_to_post_old, 'g' ) ) ? 'global' : null ), |
|
| 238 | - ( ( false !== strpos( $tags_to_post_old, 'c' ) ) ? 'custom' : null ), |
|
| 239 | - ( ( false !== strpos( $tags_to_post_old, 'p' ) ) ? 'post' : null ), |
|
| 240 | - ) ); |
|
| 241 | - $options->set_option( 'tags_to_post', $tags_to_post ); |
|
| 235 | + $tags_to_post_old = $options->get_option('tags_to_post'); |
|
| 236 | + $tags_to_post = array_filter(array( |
|
| 237 | + ((false !== strpos($tags_to_post_old, 'g')) ? 'global' : null), |
|
| 238 | + ((false !== strpos($tags_to_post_old, 'c')) ? 'custom' : null), |
|
| 239 | + ((false !== strpos($tags_to_post_old, 'p')) ? 'post' : null), |
|
| 240 | + )); |
|
| 241 | + $options->set_option('tags_to_post', $tags_to_post); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // Update version. |
| 245 | - $options->set_option( 'version', WP2D_VERSION ); |
|
| 245 | + $options->set_option('version', WP2D_VERSION); |
|
| 246 | 246 | $options->save(); |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * Set up i18n. |
| 252 | 252 | */ |
| 253 | 253 | public function l10n() { |
| 254 | - load_plugin_textdomain( 'wp-to-diaspora', false, 'wp-to-diaspora/languages' ); |
|
| 254 | + load_plugin_textdomain('wp-to-diaspora', false, 'wp-to-diaspora/languages'); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -259,27 +259,27 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function admin_load_scripts() { |
| 261 | 261 | // Get the enabled post types to load the script for. |
| 262 | - $enabled_post_types = WP2D_Options::instance()->get_option( 'enabled_post_types', array() ); |
|
| 262 | + $enabled_post_types = WP2D_Options::instance()->get_option('enabled_post_types', array()); |
|
| 263 | 263 | |
| 264 | 264 | // Get the screen to find out where we are. |
| 265 | 265 | $screen = get_current_screen(); |
| 266 | 266 | |
| 267 | 267 | // Only load the styles and scripts on the settings page and the allowed post types. |
| 268 | - if ( 'settings_page_wp_to_diaspora' === $screen->id || ( in_array( $screen->post_type, $enabled_post_types ) && 'post' === $screen->base ) ) { |
|
| 269 | - wp_enqueue_style( 'tag-it', plugins_url( '/css/jquery.tagit.css', __FILE__ ) ); |
|
| 270 | - wp_enqueue_style( 'chosen', plugins_url( '/css/chosen.min.css', __FILE__ ) ); |
|
| 271 | - wp_enqueue_style( 'wp-to-diaspora-admin', plugins_url( '/css/wp-to-diaspora.css', __FILE__ ) ); |
|
| 272 | - wp_enqueue_script( 'chosen', plugins_url( '/js/chosen.jquery.min.js', __FILE__ ), array( 'jquery' ), false, true ); |
|
| 273 | - wp_enqueue_script( 'tag-it', plugins_url( '/js/tag-it.min.js', __FILE__ ), array( 'jquery', 'jquery-ui-autocomplete' ), false, true ); |
|
| 274 | - wp_enqueue_script( 'wp-to-diaspora-admin', plugins_url( '/js/wp-to-diaspora.js', __FILE__ ), array( 'jquery' ), false, true ); |
|
| 268 | + if ('settings_page_wp_to_diaspora' === $screen->id || (in_array($screen->post_type, $enabled_post_types) && 'post' === $screen->base)) { |
|
| 269 | + wp_enqueue_style('tag-it', plugins_url('/css/jquery.tagit.css', __FILE__)); |
|
| 270 | + wp_enqueue_style('chosen', plugins_url('/css/chosen.min.css', __FILE__)); |
|
| 271 | + wp_enqueue_style('wp-to-diaspora-admin', plugins_url('/css/wp-to-diaspora.css', __FILE__)); |
|
| 272 | + wp_enqueue_script('chosen', plugins_url('/js/chosen.jquery.min.js', __FILE__), array('jquery'), false, true); |
|
| 273 | + wp_enqueue_script('tag-it', plugins_url('/js/tag-it.min.js', __FILE__), array('jquery', 'jquery-ui-autocomplete'), false, true); |
|
| 274 | + wp_enqueue_script('wp-to-diaspora-admin', plugins_url('/js/wp-to-diaspora.js', __FILE__), array('jquery'), false, true); |
|
| 275 | 275 | // Javascript-specific l10n. |
| 276 | - wp_localize_script( 'wp-to-diaspora-admin', 'WP2DL10n', array( |
|
| 277 | - 'no_services_connected' => __( 'No services connected yet.', 'wp-to-diaspora' ), |
|
| 278 | - 'sure_reset_defaults' => __( 'Are you sure you want to reset to default values?', 'wp-to-diaspora' ), |
|
| 279 | - 'conn_testing' => __( 'Testing connection...', 'wp-to-diaspora' ), |
|
| 280 | - 'conn_successful' => __( 'Connection successful.', 'wp-to-diaspora' ), |
|
| 281 | - 'conn_failed' => __( 'Connection failed.', 'wp-to-diaspora' ), |
|
| 282 | - ) ); |
|
| 276 | + wp_localize_script('wp-to-diaspora-admin', 'WP2DL10n', array( |
|
| 277 | + 'no_services_connected' => __('No services connected yet.', 'wp-to-diaspora'), |
|
| 278 | + 'sure_reset_defaults' => __('Are you sure you want to reset to default values?', 'wp-to-diaspora'), |
|
| 279 | + 'conn_testing' => __('Testing connection...', 'wp-to-diaspora'), |
|
| 280 | + 'conn_successful' => __('Connection successful.', 'wp-to-diaspora'), |
|
| 281 | + 'conn_failed' => __('Connection failed.', 'wp-to-diaspora'), |
|
| 282 | + )); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | * @param array $links Links to display for plugin on plugins page. |
| 290 | 290 | * @return array Links to display for plugin on plugins page. |
| 291 | 291 | */ |
| 292 | - public function settings_link( $links ) { |
|
| 293 | - $links[] = '<a href="' . admin_url( 'options-general.php?page=wp_to_diaspora' ) . '">' . __( 'Settings' ) . '</a>'; |
|
| 292 | + public function settings_link($links) { |
|
| 293 | + $links[] = '<a href="'.admin_url('options-general.php?page=wp_to_diaspora').'">'.__('Settings').'</a>'; |
|
| 294 | 294 | return $links; |
| 295 | 295 | } |
| 296 | 296 | |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | $pods = array(); |
| 306 | 306 | |
| 307 | 307 | // Get the response from the WP_HTTP request. |
| 308 | - $response = wp_safe_remote_get( $pod_list_url ); |
|
| 308 | + $response = wp_safe_remote_get($pod_list_url); |
|
| 309 | 309 | |
| 310 | - if ( $json = wp_remote_retrieve_body( $response ) ) { |
|
| 311 | - $pod_list = json_decode( $json ); |
|
| 310 | + if ($json = wp_remote_retrieve_body($response)) { |
|
| 311 | + $pod_list = json_decode($json); |
|
| 312 | 312 | |
| 313 | - if ( isset( $pod_list->pods ) ) { |
|
| 314 | - foreach ( $pod_list->pods as $pod ) { |
|
| 315 | - if ( 'no' === $pod->hidden ) { |
|
| 313 | + if (isset($pod_list->pods)) { |
|
| 314 | + foreach ($pod_list->pods as $pod) { |
|
| 315 | + if ('no' === $pod->hidden) { |
|
| 316 | 316 | $pods[] = array( |
| 317 | 317 | 'secure' => $pod->secure, |
| 318 | 318 | 'domain' => $pod->domain, |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | $options = WP2D_Options::instance(); |
| 324 | - $options->set_option( 'pod_list', $pods ); |
|
| 324 | + $options->set_option('pod_list', $pods); |
|
| 325 | 325 | $options->save(); |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * Update the list of pods and return them for use with AJAX. |
| 334 | 334 | */ |
| 335 | 335 | public function update_pod_list_callback() { |
| 336 | - wp_send_json( $this->_update_pod_list() ); |
|
| 336 | + wp_send_json($this->_update_pod_list()); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /** |
@@ -344,40 +344,40 @@ discard block |
||
| 344 | 344 | * @param string $type Type of list to update. |
| 345 | 345 | * @return array|boolean The list of aspects or services, false if an illegal parameter is passed. |
| 346 | 346 | */ |
| 347 | - private function _update_aspects_services_list( $type ) { |
|
| 347 | + private function _update_aspects_services_list($type) { |
|
| 348 | 348 | // Check for correct argument value. |
| 349 | - if ( ! in_array( $type, array( 'aspects', 'services' ) ) ) { |
|
| 349 | + if ( ! in_array($type, array('aspects', 'services'))) { |
|
| 350 | 350 | return false; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $options = WP2D_Options::instance(); |
| 354 | - $list = $options->get_option( $type . '_list' ); |
|
| 354 | + $list = $options->get_option($type.'_list'); |
|
| 355 | 355 | |
| 356 | 356 | // Make sure that we have at least the 'Public' aspect. |
| 357 | - if ( 'aspects' === $type && empty( $list ) ) { |
|
| 358 | - $list = array( 'public' => __( 'Public' ) ); |
|
| 357 | + if ('aspects' === $type && empty($list)) { |
|
| 358 | + $list = array('public' => __('Public')); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | // Set up the connection to diaspora*. |
| 362 | 362 | $api = $this->_load_api(); |
| 363 | 363 | |
| 364 | 364 | // If there was a problem loading the API, return false. |
| 365 | - if ( $api->has_last_error() ) { |
|
| 365 | + if ($api->has_last_error()) { |
|
| 366 | 366 | return false; |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - if ( 'aspects' === $type ) { |
|
| 370 | - $list_new = $api->get_aspects( true ); |
|
| 371 | - } elseif ( 'services' === $type ) { |
|
| 372 | - $list_new = $api->get_services( true ); |
|
| 369 | + if ('aspects' === $type) { |
|
| 370 | + $list_new = $api->get_aspects(true); |
|
| 371 | + } elseif ('services' === $type) { |
|
| 372 | + $list_new = $api->get_services(true); |
|
| 373 | 373 | } |
| 374 | 374 | // If the new list couldn't be fetched successfully, return false. |
| 375 | - if ( $api->has_last_error() ) { |
|
| 375 | + if ($api->has_last_error()) { |
|
| 376 | 376 | return false; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // We have a new list to save and return! |
| 380 | - $options->set_option( $type . '_list', $list_new ); |
|
| 380 | + $options->set_option($type.'_list', $list_new); |
|
| 381 | 381 | $options->save(); |
| 382 | 382 | |
| 383 | 383 | return $list_new; |
@@ -387,14 +387,14 @@ discard block |
||
| 387 | 387 | * Update the list of aspects and return them for use with AJAX. |
| 388 | 388 | */ |
| 389 | 389 | public function update_aspects_list_callback() { |
| 390 | - wp_send_json( $this->_update_aspects_services_list( 'aspects' ) ); |
|
| 390 | + wp_send_json($this->_update_aspects_services_list('aspects')); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | 394 | * Update the list of services and return them for use with AJAX. |
| 395 | 395 | */ |
| 396 | 396 | public function update_services_list_callback() { |
| 397 | - wp_send_json( $this->_update_aspects_services_list( 'services' ) ); |
|
| 397 | + wp_send_json($this->_update_aspects_services_list('services')); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $status = null; |
| 409 | 409 | |
| 410 | - if ( $options->is_pod_set_up() ) { |
|
| 410 | + if ($options->is_pod_set_up()) { |
|
| 411 | 411 | $status = ! $this->_load_api()->has_last_error(); |
| 412 | 412 | } |
| 413 | 413 | |
@@ -420,22 +420,22 @@ discard block |
||
| 420 | 420 | * @todo esc_html |
| 421 | 421 | */ |
| 422 | 422 | public function check_pod_connection_status_callback() { |
| 423 | - if ( isset( $_REQUEST['debugging'] ) && ! defined( 'WP2D_DEBUGGING' ) ) { |
|
| 424 | - define( 'WP2D_DEBUGGING', true ); |
|
| 423 | + if (isset($_REQUEST['debugging']) && ! defined('WP2D_DEBUGGING')) { |
|
| 424 | + define('WP2D_DEBUGGING', true); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | $status = $this->_check_pod_connection_status(); |
| 428 | 428 | |
| 429 | 429 | $data = array( |
| 430 | - 'debug' => esc_textarea( WP2D_Helpers::get_debugging() ), |
|
| 431 | - 'message' => __( 'Connection successful.', 'wp-to-diaspora' ), |
|
| 430 | + 'debug' => esc_textarea(WP2D_Helpers::get_debugging()), |
|
| 431 | + 'message' => __('Connection successful.', 'wp-to-diaspora'), |
|
| 432 | 432 | ); |
| 433 | 433 | |
| 434 | - if ( true === $status ) { |
|
| 435 | - wp_send_json_success( $data ); |
|
| 436 | - } elseif ( false === $status && $this->_load_api()->has_last_error() ) { |
|
| 437 | - $data['message'] = $this->_load_api()->get_last_error() . ' ' . WP2D_Contextual_Help::get_help_tab_quick_link( $this->_load_api()->get_last_error_object() ); |
|
| 438 | - wp_send_json_error( $data ); |
|
| 434 | + if (true === $status) { |
|
| 435 | + wp_send_json_success($data); |
|
| 436 | + } elseif (false === $status && $this->_load_api()->has_last_error()) { |
|
| 437 | + $data['message'] = $this->_load_api()->get_last_error().' '.WP2D_Contextual_Help::get_help_tab_quick_link($this->_load_api()->get_last_error_object()); |
|
| 438 | + wp_send_json_error($data); |
|
| 439 | 439 | } |
| 440 | 440 | // If $status === null, do nothing. |
| 441 | 441 | } |