summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-inst/wp-includes/functions.php')
-rw-r--r--wp-inst/wp-includes/functions.php117
1 files changed, 24 insertions, 93 deletions
diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php
index 94536ff..64f795e 100644
--- a/wp-inst/wp-includes/functions.php
+++ b/wp-inst/wp-includes/functions.php
@@ -195,12 +195,6 @@ function maybe_unserialize($original) {
function get_settings($setting) {
global $wpdb, $switched, $current_blog;
- if( ( $setting == 'siteurl' || $setting == 'home' ) && isset( $_SERVER[ 'HTTPS' ] ) == false && 1 == $current_blog->domain_mapping ) {
- if( is_redirected_domain() ) {
- return "http://" . $_SERVER[ 'HTTP_HOST' ];
- }
- }
-
if ( $switched == false && defined('WP_INSTALLING') == false && $_REQUEST['nomemcache'] != 'all' && $_REQUEST['nomemcache'] != $setting ) {
$value = wp_cache_get($setting, 'options');
} else {
@@ -649,86 +643,6 @@ function &get_page(&$page, $output = OBJECT) {
}
}
-function get_category_by_path($category_path, $full_match = true, $output = OBJECT) {
- global $wpdb;
- $category_path = rawurlencode(urldecode($category_path));
- $category_path = str_replace('%2F', '/', $category_path);
- $category_path = str_replace('%20', ' ', $category_path);
- $category_paths = '/' . trim($category_path, '/');
- $leaf_path = sanitize_title(basename($category_paths));
- $category_paths = explode('/', $category_paths);
- foreach($category_paths as $pathdir)
- $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
-
- $categories = $wpdb->get_results("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE category_nicename = '$leaf_path'");
-
- if ( empty($categories) )
- return NULL;
-
- foreach ($categories as $category) {
- $path = '/' . $leaf_path;
- $curcategory = $category;
- while ($curcategory->category_parent != 0) {
- $curcategory = $wpdb->get_row("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE cat_ID = '$curcategory->category_parent'");
- $path = '/' . $curcategory->category_nicename . $path;
- }
-
- if ( $path == $full_path )
- return get_category($category->cat_ID, $output);
- }
-
- // If full matching is not required, return the first cat that matches the leaf.
- if ( ! $full_match )
- return get_category($categories[0]->cat_ID, $output);
-
- return NULL;
-}
-
-// Retrieves category data given a category ID or category object.
-// Handles category caching.
-function &get_category(&$category, $output = OBJECT) {
- global $wpdb;
-
- if ( empty($category) )
- return null;
-
- if ( is_object($category) ) {
- wp_cache_add($category->cat_ID, $category, 'category');
- $_category = $category;
- } else {
- if ( ! $_category = wp_cache_get($category, 'category') ) {
- $_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1");
- wp_cache_add($category, $_category, 'category');
- }
- }
-
- if ( $output == OBJECT ) {
- return $_category;
- } elseif ( $output == ARRAY_A ) {
- return get_object_vars($_category);
- } elseif ( $output == ARRAY_N ) {
- return array_values(get_object_vars($_category));
- } else {
- return $_category;
- }
-}
-
-function get_catname($cat_ID) {
- $category = &get_category($cat_ID);
- return $category->cat_name;
-}
-
-function get_all_category_ids() {
- global $wpdb;
-
- if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
- $cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
- wp_cache_add('all_category_ids', $cat_ids, 'category');
- }
-
- return $cat_ids;
-}
-
function get_all_page_ids() {
global $wpdb;
@@ -987,15 +901,13 @@ function wp_get_http_headers( $url, $red = 1 ) {
$headers["$key"] = $matches[2][$i];
}
- $code = preg_replace('/.*?(\d{3}).*/i', '$1', $response);
-
- $headers['status_code'] = $code;
-
- if ( '302' == $code || '301' == $code )
- return wp_get_http_headers( $url, ++$red );
-
preg_match('/.*([0-9]{3}).*/', $response, $return);
$headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
+
+ $code = $headers['response'];
+ if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
+ return wp_get_http_headers( $headers['location'], ++$red );
+
return $headers;
}
@@ -1140,6 +1052,7 @@ function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args
// rebuild the list of filters
if ( isset($wp_filter[$tag]["$priority"]) ) {
+ $new_function_list = array();
foreach($wp_filter[$tag]["$priority"] as $filter) {
if ( $filter['function'] != $function_to_remove ) {
$new_function_list[] = $filter;
@@ -1690,6 +1603,16 @@ function do_feed_atom() {
load_template(ABSPATH . 'wp-atom.php');
}
+function do_robots() {
+ if ( '1' != get_option('blog_public') ) {
+ echo "User-agent: *\n";
+ echo "Disallow: /\n";
+ } else {
+ echo "User-agent: *\n";
+ echo "Disallow:\n";
+ }
+}
+
function is_blog_installed() {
global $wpdb;
$wpdb->hide_errors();
@@ -1698,4 +1621,12 @@ function is_blog_installed() {
return $installed;
}
+function wp_nonce_url($actionurl, $action = -1) {
+ return add_query_arg('_wpnonce', wp_create_nonce($action), $actionurl);
+}
+
+function wp_nonce_field($action = -1) {
+ echo '<input type="hidden" name="_wpnonce" value="' . wp_create_nonce($action) . '" />';
+}
+
?>