summaryrefslogtreecommitdiffstats
path: root/wp-app.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-06-13 17:21:00 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-06-13 17:21:00 +0000
commit12de05107e4c8b006bde6ee8916f34eb476d08da (patch)
tree123ee54ecd1f3f777373b7df54a4604012d43640 /wp-app.php
parente51c7a9ca4bfdb45fa3ec7334bd33871e78c68b1 (diff)
downloadwordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.tar.gz
wordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.tar.xz
wordpress-mu-12de05107e4c8b006bde6ee8916f34eb476d08da.zip
WP Merge with revision 8075
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1328 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-app.php')
-rw-r--r--wp-app.php89
1 files changed, 76 insertions, 13 deletions
diff --git a/wp-app.php b/wp-app.php
index 52ce7b7..607bed3 100644
--- a/wp-app.php
+++ b/wp-app.php
@@ -1,26 +1,60 @@
<?php
-/*
- * wp-app.php - Atom Publishing Protocol support for WordPress
- * Original code by: Elias Torres, http://torrez.us/archives/2006/08/31/491/
- * Modified by: Dougal Campbell, http://dougal.gunters.org/
+/**
+ * Atom Publishing Protocol support for WordPress
*
- * Version: 1.0.5-dc
+ * @author Original by Elias Torres <http://torrez.us/archives/2006/08/31/491/>
+ * @author Modified by Dougal Campbell <http://dougal.gunters.org/>
+ * @version 1.0.5-dc
*/
+/**
+ * WordPress is handling an Atom Publishing Protocol request.
+ *
+ * @var bool
+ */
define('APP_REQUEST', true);
-require_once('./wp-config.php');
+/** Set up WordPress environment */
+require_once('./wp-load.php');
+
+/** Post Template API */
require_once(ABSPATH . WPINC . '/post-template.php');
+
+/** Atom Publishing Protocol Class */
require_once(ABSPATH . WPINC . '/atomlib.php');
+
+/** Feed Handling API */
require_once(ABSPATH . WPINC . '/feed.php');
$_SERVER['PATH_INFO'] = preg_replace( '/.*\/wp-app\.php/', '', $_SERVER['REQUEST_URI'] );
+/**
+ * Whether to enable Atom Publishing Protocol Logging.
+ *
+ * @name app_logging
+ * @var int|bool
+ */
$app_logging = 0;
-// TODO: Should be an option somewhere
+/**
+ * Whether to always authenticate user. Permanently set to true.
+ *
+ * @name always_authenticate
+ * @var int|bool
+ * @todo Should be an option somewhere
+ */
$always_authenticate = 1;
+/**
+ * log_app() - Writes logging info to a file.
+ *
+ * @uses $app_logging
+ * @package WordPress
+ * @subpackage Logging
+ *
+ * @param string $label Type of logging
+ * @param string $msg Information describing logging reason.
+ */
function log_app($label,$msg) {
global $app_logging;
if ($app_logging) {
@@ -32,6 +66,18 @@ function log_app($label,$msg) {
}
if ( !function_exists('wp_set_current_user') ) :
+/**
+ * wp_set_current_user() - Sets the current WordPress User
+ *
+ * Pluggable function which is also found in pluggable.php.
+ *
+ * @see wp-includes/pluggable.php Documentation for this function.
+ * @uses $current_user Global of current user to test whether $id is the same.
+ *
+ * @param int $id The user's ID
+ * @param string $name Optional. The username of the user.
+ * @return WP_User Current user's User object
+ */
function wp_set_current_user($id, $name = '') {
global $current_user;
@@ -44,13 +90,26 @@ function wp_set_current_user($id, $name = '') {
}
endif;
+/**
+ * wa_posts_where_include_drafts_filter() - Filter to add more post statuses
+ *
+ * @param string $where SQL statement to filter
+ * @return string Filtered SQL statement with added post_status for where clause
+ */
function wa_posts_where_include_drafts_filter($where) {
- $where = str_replace("post_status = 'publish'","post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'inherit'", $where);
- return $where;
+ $where = str_replace("post_status = 'publish'","post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'inherit'", $where);
+ return $where;
}
add_filter('posts_where', 'wa_posts_where_include_drafts_filter');
+/**
+ * @internal
+ * Left undocumented to work on later. If you want to finish, then please do so.
+ *
+ * @package WordPress
+ * @subpackage Publishing
+ */
class AtomServer {
var $ATOM_CONTENT_TYPE = 'application/atom+xml';
@@ -113,7 +172,11 @@ class AtomServer {
function handle_request() {
global $always_authenticate;
- $path = $_SERVER['PATH_INFO'];
+ if( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
+ $path = $_SERVER['ORIG_PATH_INFO'];
+ else
+ $path = $_SERVER['PATH_INFO'];
+
$method = $_SERVER['REQUEST_METHOD'];
log_app('REQUEST',"$method $path\n================");
@@ -170,9 +233,9 @@ class AtomServer {
$entries_url = attribute_escape($this->get_entries_url());
$categories_url = attribute_escape($this->get_categories_url());
$media_url = attribute_escape($this->get_attachments_url());
- foreach ($this->media_content_types as $med) {
- $accepted_media_types = $accepted_media_types . "<accept>" . $med . "</accept>";
- }
+ foreach ($this->media_content_types as $med) {
+ $accepted_media_types = $accepted_media_types . "<accept>" . $med . "</accept>";
+ }
$atom_prefix="atom";
$atom_blogname=get_bloginfo('name');
$service_doc = <<<EOD