Coding style cleanups
git-svn-id: https://develop.svn.wordpress.org/trunk@12734 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8ef8b7bad5
commit
3dfc463062
47
wp-app.php
47
wp-app.php
@ -284,9 +284,8 @@ class AtomServer {
|
||||
}
|
||||
|
||||
// redirect to /service in case no path is found.
|
||||
if(strlen($path) == 0 || $path == '/') {
|
||||
if(strlen($path) == 0 || $path == '/')
|
||||
$this->redirect($this->get_service_url());
|
||||
}
|
||||
|
||||
// check to see if AtomPub is enabled
|
||||
if ( !get_option( 'enable_app' ) )
|
||||
@ -300,10 +299,9 @@ class AtomServer {
|
||||
// authenticate regardless of the operation and set the current
|
||||
// user. each handler will decide if auth is required or not.
|
||||
if ( !$this->authenticate() ) {
|
||||
if ($always_authenticate) {
|
||||
if ( $always_authenticate )
|
||||
$this->auth_required('Credentials required.');
|
||||
}
|
||||
}
|
||||
|
||||
array_shift($matches);
|
||||
call_user_func_array(array(&$this,$funcs[$method]), $matches);
|
||||
@ -398,17 +396,17 @@ EOD;
|
||||
$this->get_accepted_content_type($this->atom_content_types);
|
||||
|
||||
$parser = new AtomParser();
|
||||
if(!$parser->parse()) {
|
||||
if ( !$parser->parse() )
|
||||
$this->client_error();
|
||||
}
|
||||
|
||||
$entry = array_pop($parser->feed->entries);
|
||||
|
||||
log_app('Received entry:', print_r($entry,true));
|
||||
|
||||
$catnames = array();
|
||||
foreach($entry->categories as $cat)
|
||||
foreach ( $entry->categories as $cat ) {
|
||||
array_push($catnames, $cat["term"]);
|
||||
}
|
||||
|
||||
$wp_cats = get_categories(array('hide_empty' => false));
|
||||
|
||||
@ -498,9 +496,8 @@ EOD;
|
||||
$this->get_accepted_content_type($this->atom_content_types);
|
||||
|
||||
$parser = new AtomParser();
|
||||
if(!$parser->parse()) {
|
||||
if ( !$parser->parse() )
|
||||
$this->bad_request();
|
||||
}
|
||||
|
||||
$parsed = array_pop($parser->feed->entries);
|
||||
|
||||
@ -533,9 +530,8 @@ EOD;
|
||||
|
||||
$result = wp_update_post($postdata);
|
||||
|
||||
if (!$result) {
|
||||
if ( !$result )
|
||||
$this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
|
||||
}
|
||||
|
||||
do_action( 'atompub_put_post', $ID, $parsed );
|
||||
|
||||
@ -556,9 +552,8 @@ EOD;
|
||||
global $entry;
|
||||
$this->set_current_entry($postID);
|
||||
|
||||
if(!current_user_can('edit_post', $postID)) {
|
||||
if ( !current_user_can('edit_post', $postID) )
|
||||
$this->auth_required(__('Sorry, you do not have the right to delete this post.'));
|
||||
}
|
||||
|
||||
if ( $entry['post_type'] == 'attachment' ) {
|
||||
$this->delete_attachment($postID);
|
||||
@ -694,9 +689,8 @@ EOD;
|
||||
|
||||
$result = wp_update_post($postdata);
|
||||
|
||||
if (!$result) {
|
||||
if ( !$result )
|
||||
$this->internal_error(__('For some strange yet very annoying reason, this post could not be edited.'));
|
||||
}
|
||||
|
||||
log_app('function',"put_attachment($postID)");
|
||||
$this->ok();
|
||||
@ -716,9 +710,8 @@ EOD;
|
||||
global $entry;
|
||||
$this->set_current_entry($postID);
|
||||
|
||||
if(!current_user_can('edit_post', $postID)) {
|
||||
if ( !current_user_can('edit_post', $postID) )
|
||||
$this->auth_required(__('Sorry, you do not have the right to delete this post.'));
|
||||
}
|
||||
|
||||
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
|
||||
$filetype = wp_check_filetype($location);
|
||||
@ -732,9 +725,8 @@ EOD;
|
||||
// delete attachment
|
||||
$result = wp_delete_post($postID);
|
||||
|
||||
if (!$result) {
|
||||
if ( !$result )
|
||||
$this->internal_error(__('For some strange yet very annoying reason, this post could not be deleted.'));
|
||||
}
|
||||
|
||||
log_app('function',"delete_attachment($postID). File '$location' deleted.");
|
||||
$this->ok();
|
||||
@ -754,9 +746,8 @@ EOD;
|
||||
$this->set_current_entry($postID);
|
||||
|
||||
// then whether user can edit the specific post
|
||||
if(!current_user_can('edit_post', $postID)) {
|
||||
if ( !current_user_can('edit_post', $postID) )
|
||||
$this->auth_required(__('Sorry, you do not have the right to edit this post.'));
|
||||
}
|
||||
|
||||
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
|
||||
$location = get_option ('upload_path') . '/' . $location;
|
||||
@ -805,9 +796,8 @@ EOD;
|
||||
$this->set_current_entry($postID);
|
||||
|
||||
// then whether user can edit the specific post
|
||||
if(!current_user_can('edit_post', $postID)) {
|
||||
if ( !current_user_can('edit_post', $postID) )
|
||||
$this->auth_required(__('Sorry, you do not have the right to edit this post.'));
|
||||
}
|
||||
|
||||
$upload_dir = wp_upload_dir( );
|
||||
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
|
||||
@ -837,9 +827,8 @@ EOD;
|
||||
$post_data = compact('ID', 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt');
|
||||
$result = wp_update_post($post_data);
|
||||
|
||||
if (!$result) {
|
||||
if ( !$result )
|
||||
$this->internal_error(__('Sorry, your entry could not be posted. Something wrong happened.'));
|
||||
}
|
||||
|
||||
wp_update_attachment_metadata( $postID, wp_generate_attachment_metadata( $postID, $location ) );
|
||||
|
||||
@ -856,15 +845,13 @@ EOD;
|
||||
* @return string
|
||||
*/
|
||||
function get_entries_url($page = null) {
|
||||
if ( isset($GLOBALS['post_type']) && ( $GLOBALS['post_type'] == 'attachment' ) ) {
|
||||
if ( isset($GLOBALS['post_type']) && ( $GLOBALS['post_type'] == 'attachment' ) )
|
||||
$path = $this->MEDIA_PATH;
|
||||
} else {
|
||||
else
|
||||
$path = $this->ENTRIES_PATH;
|
||||
}
|
||||
$url = $this->app_base . $path;
|
||||
if(isset($page) && is_int($page)) {
|
||||
if ( isset($page) && is_int($page) )
|
||||
$url .= "/$page";
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
|
@ -272,9 +272,8 @@ function wp_start_object_cache() {
|
||||
|
||||
function wp_not_installed() {
|
||||
if ( is_multisite() ) {
|
||||
if ( !is_blog_installed() && !defined('WP_INSTALLING') ) {
|
||||
if ( !is_blog_installed() && !defined('WP_INSTALLING') )
|
||||
die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); // have to die here ~ Mark
|
||||
}
|
||||
} elseif ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
|
||||
if ( defined('WP_SITEURL') )
|
||||
$link = WP_SITEURL . '/wp-admin/install.php';
|
||||
@ -329,7 +328,6 @@ function wp_load_plugins() {
|
||||
unset($plugin);
|
||||
}
|
||||
unset($current_plugins);
|
||||
|
||||
}
|
||||
|
||||
function wp_set_internal_encoding() {
|
||||
|
@ -64,7 +64,7 @@ require (ABSPATH . WPINC . '/plugin.php');
|
||||
require (ABSPATH . WPINC . '/default-filters.php');
|
||||
include_once(ABSPATH . WPINC . '/pomo/mo.php');
|
||||
|
||||
if( is_multisite() && SHORTINIT ) // stop most of WP being loaded, we just want the basics
|
||||
if ( SHORTINIT ) // stop most of WP being loaded, we just want the basics
|
||||
return false;
|
||||
|
||||
require_once (ABSPATH . WPINC . '/l10n.php');
|
||||
|
Loading…
Reference in New Issue
Block a user