summaryrefslogtreecommitdiffstats
path: root/wp-includes/general-template.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-includes/general-template.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-includes/general-template.php')
-rw-r--r--wp-includes/general-template.php103
1 files changed, 79 insertions, 24 deletions
diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
index 4a7f1bb..afc6c56 100644
--- a/wp-includes/general-template.php
+++ b/wp-includes/general-template.php
@@ -7,7 +7,7 @@ function get_header() {
if ( file_exists( TEMPLATEPATH . '/header.php') )
load_template( TEMPLATEPATH . '/header.php');
else
- load_template( ABSPATH . 'wp-content/themes/default/header.php');
+ load_template( WP_CONTENT_DIR . '/themes/default/header.php');
}
@@ -16,7 +16,7 @@ function get_footer() {
if ( file_exists( TEMPLATEPATH . '/footer.php') )
load_template( TEMPLATEPATH . '/footer.php');
else
- load_template( ABSPATH . 'wp-content/themes/default/footer.php');
+ load_template( WP_CONTENT_DIR . '/themes/default/footer.php');
}
@@ -27,15 +27,15 @@ function get_sidebar( $name = null ) {
elseif ( file_exists( TEMPLATEPATH . '/sidebar.php') )
load_template( TEMPLATEPATH . '/sidebar.php');
else
- load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
+ load_template( WP_CONTENT_DIR . '/themes/default/sidebar.php');
}
function wp_loginout() {
if ( ! is_user_logged_in() )
- $link = '<a href="' . get_option('siteurl') . '/wp-login.php">' . __('Log in') . '</a>';
+ $link = '<a href="' . site_url('wp-login.php', 'login') . '">' . __('Log in') . '</a>';
else
- $link = '<a href="' . get_option('siteurl') . '/wp-login.php?action=logout">' . __('Log out') . '</a>';
+ $link = '<a href="' . site_url('wp-login.php?action=logout', 'login') . '">' . __('Log out') . '</a>';
echo apply_filters('loginout', $link);
}
@@ -45,11 +45,11 @@ function wp_register( $before = '<li>', $after = '</li>' ) {
if ( ! is_user_logged_in() ) {
if ( get_option('users_can_register') )
- $link = $before . '<a href="' . get_option('siteurl') . '/wp-login.php?action=register">' . __('Register') . '</a>' . $after;
+ $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;
else
$link = '';
} else {
- $link = $before . '<a href="' . get_option('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after;
+ $link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
}
echo apply_filters('register', $link);
@@ -233,6 +233,19 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
$title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
}
+ // If there's a taxonomy
+ if ( is_tax() ) {
+ $taxonomy = get_query_var( 'taxonomy' );
+ $tax = get_taxonomy( $taxonomy );
+ $tax = $tax->label;
+ $term = $wp_query->get_queried_object();
+ $term = $term->name;
+ if ( 'right' == $seplocation )
+ $title = "$term $sep $tax";
+ else
+ $title = "$tax $sep $term";
+ }
+
$prefix = '';
if ( !empty($title) )
$prefix = " $sep ";
@@ -814,7 +827,7 @@ function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
$time = $post->post_date;
$time = mysql2date($d, $time);
- return apply_filters('get_the_time', $time, $d, $gmt);
+ return apply_filters('get_post_time', $time, $d, $gmt);
}
@@ -1115,34 +1128,76 @@ function wp_admin_css_color($key, $name, $url, $colors = array()) {
$_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'colors' => $colors);
}
+/**
+ * wp_admin_css_uri() - Outputs the URL of a WordPress admin CSS file
+ *
+ * @see WP_Styles::_css_href and its style_loader_src filter.
+ *
+ * @param string $file file relative to wp-admin/ without its ".css" extension.
+ */
+
function wp_admin_css_uri( $file = 'wp-admin' ) {
if ( defined('WP_INSTALLING') ) {
$_file = "./$file.css";
} else {
- if ( 'css/colors' == $file || 'css/colors-rtl' == $file ) {
- global $_wp_admin_css_colors;
- $color = get_user_option('admin_color');
- if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
- $color = 'fresh';
- $color = $_wp_admin_css_colors[$color];
- $_file = $color->url;
- $_file = ('css/colors-rtl' == $file) ? str_replace('.css','-rtl.css',$_file) : $_file;
- } else {
- $_file = get_option( 'siteurl' ) . "/wp-admin/$file.css";
- }
+ $_file = admin_url("$file.css");
}
$_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file );
return apply_filters( 'wp_admin_css_uri', $_file, $file );
}
-function wp_admin_css( $file = 'wp-admin' ) {
+/**
+ * wp_admin_css() - Enqueues or directly prints a stylesheet link to the specified CSS file.
+ *
+ * "Intelligently" decides to enqueue or to print the CSS file.
+ * If the wp_print_styles action has *not* yet been called, the CSS file will be enqueued.
+ * If the wp_print_styles action *has* been called, the CSS link will be printed.
+ * Printing may be forced by passing TRUE as the $force_echo (second) parameter.
+ *
+ * For backward compatibility with WordPress 2.3 calling method:
+ * If the $file (first) parameter does not correspond to a registered CSS file, we assume $file is a
+ * file relative to wp-admin/ without its ".css" extension. A stylesheet link to that generated URL is printed.
+ *
+ * @package WordPress
+ * @since 2.3
+ *
+ * @uses $wp_styles WordPress Styles Object
+ *
+ * @param string $file Style handle name or file name (without ".css" extension) relative to wp-admin/
+ * @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued.
+ */
+
+function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
+ global $wp_styles;
+ if ( !is_a($wp_styles, 'WP_Styles') )
+ $wp_styles = new WP_Styles();
+
+ // For backward compatibility
+ $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
- echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $file ) . "' type='text/css' />\n", $file );
- if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
- $rtl = ( 'wp-admin' == $file ) ? 'rtl' : "$file-rtl";
- echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . wp_admin_css_uri( $rtl ) . "' type='text/css' />\n", $rtl );
+ if ( $wp_styles->query( $handle ) ) {
+ if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately
+ wp_print_styles( $handle );
+ else // Add to style queue
+ wp_enqueue_style( $handle );
+ return;
}
+
+ echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
+ if ( 'rtl' == get_bloginfo( 'text_direction' ) )
+ echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
+}
+
+/**
+ * Enqueues the default ThickBox js and css.
+ * If any of the settings need to be changed, this can be done with another js file
+ * similar to media-upload.js and theme-preview.js. That file should require array('thickbox')
+ * to ensure it is loaded after.
+ */
+function add_thickbox() {
+ wp_enqueue_script( 'thickbox' );
+ wp_enqueue_style( 'thickbox' );
}
/**