-
+ 16C5908A112243D1CD25306B9225B53419E6AEBC3D9F235037B77386FED111DCECF69D58699D7CEBFAEC27E366B4FEE8000C46B293030D9C6BBFDCD88498CB77mp-wp/wp-includes/general-template.php(0 . 0)(1 . 1902)
94720 <?php
94721 /**
94722 * General template tags that can go anywhere in a template.
94723 *
94724 * @package WordPress
94725 * @subpackage Template
94726 */
94727
94728 /**
94729 * Load header template.
94730 *
94731 * Includes the header template for a theme or if a name is specified then a
94732 * specialised header will be included. If the theme contains no header.php file
94733 * then the header from the default theme will be included.
94734 *
94735 * For the parameter, if the file is called "header-special.php" then specify
94736 * "special".
94737 *
94738 * @uses locate_template()
94739 * @since 1.5.0
94740 * @uses do_action() Calls 'get_header' action.
94741 *
94742 * @param string $name The name of the specialised header.
94743 */
94744 function get_header( $name = null ) {
94745 do_action( 'get_header' );
94746
94747 $templates = array();
94748 if ( isset($name) )
94749 $templates[] = "header-{$name}.php";
94750
94751 $templates[] = "header.php";
94752
94753 if ('' == locate_template($templates, true))
94754 load_template( get_theme_root() . '/default/header.php');
94755 }
94756
94757 /**
94758 * Load footer template.
94759 *
94760 * Includes the footer template for a theme or if a name is specified then a
94761 * specialised footer will be included. If the theme contains no footer.php file
94762 * then the footer from the default theme will be included.
94763 *
94764 * For the parameter, if the file is called "footer-special.php" then specify
94765 * "special".
94766 *
94767 * @uses locate_template()
94768 * @since 1.5.0
94769 * @uses do_action() Calls 'get_footer' action.
94770 *
94771 * @param string $name The name of the specialised footer.
94772 */
94773 function get_footer( $name = null ) {
94774 do_action( 'get_footer' );
94775
94776 $templates = array();
94777 if ( isset($name) )
94778 $templates[] = "footer-{$name}.php";
94779
94780 $templates[] = "footer.php";
94781
94782 if ('' == locate_template($templates, true))
94783 load_template( get_theme_root() . '/default/footer.php');
94784 }
94785
94786 /**
94787 * Load sidebar template.
94788 *
94789 * Includes the sidebar template for a theme or if a name is specified then a
94790 * specialised sidebar will be included. If the theme contains no sidebar.php
94791 * file then the sidebar from the default theme will be included.
94792 *
94793 * For the parameter, if the file is called "sidebar-special.php" then specify
94794 * "special".
94795 *
94796 * @uses locate_template()
94797 * @since 1.5.0
94798 * @uses do_action() Calls 'get_sidebar' action.
94799 *
94800 * @param string $name The name of the specialised sidebar.
94801 */
94802 function get_sidebar( $name = null ) {
94803 do_action( 'get_sidebar' );
94804
94805 $templates = array();
94806 if ( isset($name) )
94807 $templates[] = "sidebar-{$name}.php";
94808
94809 $templates[] = "sidebar.php";
94810
94811 if ('' == locate_template($templates, true))
94812 load_template( get_theme_root() . '/default/sidebar.php');
94813 }
94814
94815 /**
94816 * Display search form.
94817 *
94818 * Will first attempt to locate the searchform.php file in either the child or
94819 * the parent, then load it. If it doesn't exist, then the default search form
94820 * will be displayed.
94821 *
94822 * @since 2.7.0
94823 */
94824 function get_search_form() {
94825 do_action( 'get_search_form' );
94826
94827 if ( '' != locate_template(array('searchform.php'), true) )
94828 return;
94829
94830 $form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
94831 <label class="hidden" for="s">' . __('Search for:') . '</label>
94832 <div><input type="text" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
94833 <input type="submit" id="searchsubmit" value="'.attribute_escape(__('Search')).'" />
94834 </div>
94835 </form>';
94836
94837 echo apply_filters('get_search_form', $form);
94838 }
94839
94840 /**
94841 * Display the Log In/Out link.
94842 *
94843 * Displays a link, which allows the user to navigate to the Log In page to log in
94844 * or log out depending on whether or not they are currently logged in.
94845 *
94846 * @since 1.5.0
94847 * @uses apply_filters() Calls 'loginout' hook on HTML link content.
94848 */
94849 function wp_loginout() {
94850 if ( ! is_user_logged_in() )
94851 $link = '<a href="' . wp_login_url() . '">' . __('Log in') . '</a>';
94852 else
94853 $link = '<a href="' . wp_logout_url() . '">' . __('Log out') . '</a>';
94854
94855 echo apply_filters('loginout', $link);
94856 }
94857
94858 /**
94859 * Returns the Log Out URL.
94860 *
94861 * Returns the URL that allows the user to log out of the site
94862 *
94863 * @since 2.7
94864 * @uses wp_nonce_url() To protect against CSRF
94865 * @uses site_url() To generate the log in URL
94866 *
94867 * @param string $redirect Path to redirect to on logout.
94868 */
94869 function wp_logout_url($redirect = '') {
94870 if ( strlen($redirect) )
94871 $redirect = "&redirect_to=$redirect";
94872
94873 return wp_nonce_url( site_url("wp-login.php?action=logout$redirect", 'login'), 'log-out' );
94874 }
94875
94876 /**
94877 * Returns the Log In URL.
94878 *
94879 * Returns the URL that allows the user to log in to the site
94880 *
94881 * @since 2.7
94882 * @uses site_url() To generate the log in URL
94883 *
94884 * @param string $redirect Path to redirect to on login.
94885 */
94886 function wp_login_url($redirect = '') {
94887 if ( strlen($redirect) )
94888 $redirect = "?redirect_to=$redirect";
94889
94890 return site_url("wp-login.php$redirect", 'login');
94891 }
94892
94893 /**
94894 * Display the Registration or Admin link.
94895 *
94896 * Display a link which allows the user to navigate to the registration page if
94897 * not logged in and registration is enabled or to the dashboard if logged in.
94898 *
94899 * @since 1.5.0
94900 * @uses apply_filters() Calls 'register' hook on register / admin link content.
94901 *
94902 * @param string $before Text to output before the link (defaults to <li>).
94903 * @param string $after Text to output after the link (defaults to </li>).
94904 */
94905 function wp_register( $before = '<li>', $after = '</li>' ) {
94906
94907 if ( ! is_user_logged_in() ) {
94908 if ( get_option('users_can_register') )
94909 $link = $before . '<a href="' . site_url('wp-login.php?action=register', 'login') . '">' . __('Register') . '</a>' . $after;
94910 else
94911 $link = '';
94912 } else {
94913 $link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
94914 }
94915
94916 echo apply_filters('register', $link);
94917 }
94918
94919 /**
94920 * Theme container function for the 'wp_meta' action.
94921 *
94922 * The 'wp_meta' action can have several purposes, depending on how you use it,
94923 * but one purpose might have been to allow for theme switching.
94924 *
94925 * @since 1.5.0
94926 * @link http://trac.wordpress.org/ticket/1458 Explanation of 'wp_meta' action.
94927 * @uses do_action() Calls 'wp_meta' hook.
94928 */
94929 function wp_meta() {
94930 do_action('wp_meta');
94931 }
94932
94933 /**
94934 * Display information about the blog.
94935 *
94936 * @see get_bloginfo() For possible values for the parameter.
94937 * @since 0.71
94938 *
94939 * @param string $show What to display.
94940 */
94941 function bloginfo($show='') {
94942 echo get_bloginfo($show, 'display');
94943 }
94944
94945 /**
94946 * Retrieve information about the blog.
94947 *
94948 * Some show parameter values are deprecated and will be removed in future
94949 * versions. Care should be taken to check the function contents and know what
94950 * the deprecated blog info options are. Options without "// DEPRECATED" are
94951 * the preferred and recommended ways to get the information.
94952 *
94953 * The possible values for the 'show' parameter are listed below.
94954 * <ol>
94955 * <li><strong>url<strong> - Blog URI to homepage.</li>
94956 * <li><strong>wpurl</strong> - Blog URI path to WordPress.</li>
94957 * <li><strong>description</strong> - Secondary title</li>
94958 * </ol>
94959 *
94960 * The feed URL options can be retrieved from 'rdf_url' (RSS 0.91),
94961 * 'rss_url' (RSS 1.0), 'rss2_url' (RSS 2.0), or 'atom_url' (Atom feed). The
94962 * comment feeds can be retrieved from the 'comments_atom_url' (Atom comment
94963 * feed) or 'comments_rss2_url' (RSS 2.0 comment feed).
94964 *
94965 * There are many other options and you should check the function contents:
94966 * {@source 32 37}
94967 *
94968 * @since 0.71
94969 *
94970 * @param string $show Blog info to retrieve.
94971 * @param string $filter How to filter what is retrieved.
94972 * @return string Mostly string values, might be empty.
94973 */
94974 function get_bloginfo($show = '', $filter = 'raw') {
94975
94976 switch($show) {
94977 case 'url' :
94978 case 'home' : // DEPRECATED
94979 case 'siteurl' : // DEPRECATED
94980 $output = get_option('home');
94981 break;
94982 case 'wpurl' :
94983 $output = get_option('siteurl');
94984 break;
94985 case 'description':
94986 $output = get_option('blogdescription');
94987 break;
94988 case 'rdf_url':
94989 $output = get_feed_link('rdf');
94990 break;
94991 case 'rss_url':
94992 $output = get_feed_link('rss');
94993 break;
94994 case 'rss2_url':
94995 $output = get_feed_link('rss2');
94996 break;
94997 case 'atom_url':
94998 $output = get_feed_link('atom');
94999 break;
95000 case 'comments_atom_url':
95001 $output = get_feed_link('comments_atom');
95002 break;
95003 case 'comments_rss2_url':
95004 $output = get_feed_link('comments_rss2');
95005 break;
95006 case 'pingback_url':
95007 $output = get_option('siteurl') .'/xmlrpc.php';
95008 break;
95009 case 'stylesheet_url':
95010 $output = get_stylesheet_uri();
95011 break;
95012 case 'stylesheet_directory':
95013 $output = get_stylesheet_directory_uri();
95014 break;
95015 case 'template_directory':
95016 case 'template_url':
95017 $output = get_template_directory_uri();
95018 break;
95019 case 'admin_email':
95020 $output = get_option('admin_email');
95021 break;
95022 case 'charset':
95023 $output = get_option('blog_charset');
95024 if ('' == $output) $output = 'UTF-8';
95025 break;
95026 case 'html_type' :
95027 $output = get_option('html_type');
95028 break;
95029 case 'version':
95030 global $wp_version;
95031 $output = $wp_version;
95032 break;
95033 case 'language':
95034 $output = get_locale();
95035 $output = str_replace('_', '-', $output);
95036 break;
95037 case 'text_direction':
95038 global $wp_locale;
95039 $output = $wp_locale->text_direction;
95040 break;
95041 case 'name':
95042 default:
95043 $output = get_option('blogname');
95044 break;
95045 }
95046
95047 $url = true;
95048 if (strpos($show, 'url') === false &&
95049 strpos($show, 'directory') === false &&
95050 strpos($show, 'home') === false)
95051 $url = false;
95052
95053 if ( 'display' == $filter ) {
95054 if ( $url )
95055 $output = apply_filters('bloginfo_url', $output, $show);
95056 else
95057 $output = apply_filters('bloginfo', $output, $show);
95058 }
95059
95060 return $output;
95061 }
95062
95063 /**
95064 * Display or retrieve page title for all areas of blog.
95065 *
95066 * By default, the page title will display the separator before the page title,
95067 * so that the blog title will be before the page title. This is not good for
95068 * title display, since the blog title shows up on most tabs and not what is
95069 * important, which is the page that the user is looking at.
95070 *
95071 * There are also SEO benefits to having the blog title after or to the 'right'
95072 * or the page title. However, it is mostly common sense to have the blog title
95073 * to the right with most browsers supporting tabs. You can achieve this by
95074 * using the seplocation parameter and setting the value to 'right'. This change
95075 * was introduced around 2.5.0, in case backwards compatibility of themes is
95076 * important.
95077 *
95078 * @since 1.0.0
95079 *
95080 * @param string $sep Optional, default is '»'. How to separate the various items within the page title.
95081 * @param bool $display Optional, default is true. Whether to display or retrieve title.
95082 * @param string $seplocation Optional. Direction to display title, 'right'.
95083 * @return string|null String on retrieve, null when displaying.
95084 */
95085 function wp_title($sep = '»', $display = true, $seplocation = '') {
95086 global $wpdb, $wp_locale, $wp_query;
95087
95088 $cat = get_query_var('cat');
95089 $tag = get_query_var('tag_id');
95090 $category_name = get_query_var('category_name');
95091 $author = get_query_var('author');
95092 $author_name = get_query_var('author_name');
95093 $m = get_query_var('m');
95094 $year = get_query_var('year');
95095 $monthnum = get_query_var('monthnum');
95096 $day = get_query_var('day');
95097 $title = '';
95098
95099 $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
95100
95101 // If there's a category
95102 if ( !empty($cat) ) {
95103 // category exclusion
95104 if ( !stristr($cat,'-') )
95105 $title = apply_filters('single_cat_title', get_the_category_by_ID($cat));
95106 } elseif ( !empty($category_name) ) {
95107 if ( stristr($category_name,'/') ) {
95108 $category_name = explode('/',$category_name);
95109 if ( $category_name[count($category_name)-1] )
95110 $category_name = $category_name[count($category_name)-1]; // no trailing slash
95111 else
95112 $category_name = $category_name[count($category_name)-2]; // there was a trailling slash
95113 }
95114 $cat = get_term_by('slug', $category_name, 'category', OBJECT, 'display');
95115 if ( $cat )
95116 $title = apply_filters('single_cat_title', $cat->name);
95117 }
95118
95119 if ( !empty($tag) ) {
95120 $tag = get_term($tag, 'post_tag', OBJECT, 'display');
95121 if ( is_wp_error( $tag ) )
95122 return $tag;
95123 if ( ! empty($tag->name) )
95124 $title = apply_filters('single_tag_title', $tag->name);
95125 }
95126
95127 // If there's an author
95128 if ( !empty($author) ) {
95129 $title = get_userdata($author);
95130 $title = $title->display_name;
95131 }
95132 if ( !empty($author_name) ) {
95133 // We do a direct query here because we don't cache by nicename.
95134 $title = $wpdb->get_var($wpdb->prepare("SELECT display_name FROM $wpdb->users WHERE user_nicename = %s", $author_name));
95135 }
95136
95137 // If there's a month
95138 if ( !empty($m) ) {
95139 $my_year = substr($m, 0, 4);
95140 $my_month = $wp_locale->get_month(substr($m, 4, 2));
95141 $my_day = intval(substr($m, 6, 2));
95142 $title = "$my_year" . ($my_month ? "$t_sep$my_month" : "") . ($my_day ? "$t_sep$my_day" : "");
95143 }
95144
95145 if ( !empty($year) ) {
95146 $title = $year;
95147 if ( !empty($monthnum) )
95148 $title .= "$t_sep" . $wp_locale->get_month($monthnum);
95149 if ( !empty($day) )
95150 $title .= "$t_sep" . zeroise($day, 2);
95151 }
95152
95153 // If there is a post
95154 if ( is_single() || ( is_page() && !is_front_page() ) ) {
95155 $post = $wp_query->get_queried_object();
95156 $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
95157 }
95158
95159 // If there's a taxonomy
95160 if ( is_tax() ) {
95161 $taxonomy = get_query_var( 'taxonomy' );
95162 $tax = get_taxonomy( $taxonomy );
95163 $tax = $tax->label;
95164 $term = $wp_query->get_queried_object();
95165 $term = $term->name;
95166 $title = "$tax$t_sep$term";
95167 }
95168
95169 if ( is_404() ) {
95170 $title = __('Page not found');
95171 }
95172
95173 $prefix = '';
95174 if ( !empty($title) )
95175 $prefix = " $sep ";
95176
95177 // Determines position of the separator and direction of the breadcrumb
95178 if ( 'right' == $seplocation ) { // sep on right, so reverse the order
95179 $title_array = explode( $t_sep, $title );
95180 $title_array = array_reverse( $title_array );
95181 $title = implode( " $sep ", $title_array ) . $prefix;
95182 } else {
95183 $title_array = explode( $t_sep, $title );
95184 $title = $prefix . implode( " $sep ", $title_array );
95185 }
95186
95187 $title = apply_filters('wp_title', $title, $sep, $seplocation);
95188
95189 // Send it out
95190 if ( $display )
95191 echo $title;
95192 else
95193 return $title;
95194
95195 }
95196
95197 /**
95198 * Display or retrieve page title for post.
95199 *
95200 * This is optimized for single.php template file for displaying the post title.
95201 * Only useful for posts, does not support pages for example.
95202 *
95203 * It does not support placing the separator after the title, but by leaving the
95204 * prefix parameter empty, you can set the title separator manually. The prefix
95205 * does not automatically place a space between the prefix, so if there should
95206 * be a space, the parameter value will need to have it at the end.
95207 *
95208 * @since 0.71
95209 * @uses $wpdb
95210 *
95211 * @param string $prefix Optional. What to display before the title.
95212 * @param bool $display Optional, default is true. Whether to display or retrieve title.
95213 * @return string|null Title when retrieving, null when displaying or failure.
95214 */
95215 function single_post_title($prefix = '', $display = true) {
95216 global $wpdb;
95217 $p = get_query_var('p');
95218 $name = get_query_var('name');
95219
95220 if ( intval($p) || '' != $name ) {
95221 if ( !$p )
95222 $p = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s", $name));
95223 $post = & get_post($p);
95224 $title = $post->post_title;
95225 $title = apply_filters('single_post_title', $title);
95226 if ( $display )
95227 echo $prefix.strip_tags($title);
95228 else
95229 return strip_tags($title);
95230 }
95231 }
95232
95233 /**
95234 * Display or retrieve page title for category archive.
95235 *
95236 * This is useful for category template file or files, because it is optimized
95237 * for category page title and with less overhead than {@link wp_title()}.
95238 *
95239 * It does not support placing the separator after the title, but by leaving the
95240 * prefix parameter empty, you can set the title separator manually. The prefix
95241 * does not automatically place a space between the prefix, so if there should
95242 * be a space, the parameter value will need to have it at the end.
95243 *
95244 * @since 0.71
95245 *
95246 * @param string $prefix Optional. What to display before the title.
95247 * @param bool $display Optional, default is true. Whether to display or retrieve title.
95248 * @return string|null Title when retrieving, null when displaying or failure.
95249 */
95250 function single_cat_title($prefix = '', $display = true ) {
95251 $cat = intval( get_query_var('cat') );
95252 if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
95253 $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat));
95254 if ( !empty($my_cat_name) ) {
95255 if ( $display )
95256 echo $prefix.strip_tags($my_cat_name);
95257 else
95258 return strip_tags($my_cat_name);
95259 }
95260 } else if ( is_tag() ) {
95261 return single_tag_title($prefix, $display);
95262 }
95263 }
95264
95265 /**
95266 * Display or retrieve page title for tag post archive.
95267 *
95268 * Useful for tag template files for displaying the tag page title. It has less
95269 * overhead than {@link wp_title()}, because of its limited implementation.
95270 *
95271 * It does not support placing the separator after the title, but by leaving the
95272 * prefix parameter empty, you can set the title separator manually. The prefix
95273 * does not automatically place a space between the prefix, so if there should
95274 * be a space, the parameter value will need to have it at the end.
95275 *
95276 * @since 2.3.0
95277 *
95278 * @param string $prefix Optional. What to display before the title.
95279 * @param bool $display Optional, default is true. Whether to display or retrieve title.
95280 * @return string|null Title when retrieving, null when displaying or failure.
95281 */
95282 function single_tag_title($prefix = '', $display = true ) {
95283 if ( !is_tag() )
95284 return;
95285
95286 $tag_id = intval( get_query_var('tag_id') );
95287
95288 if ( !empty($tag_id) ) {
95289 $my_tag = &get_term($tag_id, 'post_tag', OBJECT, 'display');
95290 if ( is_wp_error( $my_tag ) )
95291 return false;
95292 $my_tag_name = apply_filters('single_tag_title', $my_tag->name);
95293 if ( !empty($my_tag_name) ) {
95294 if ( $display )
95295 echo $prefix . $my_tag_name;
95296 else
95297 return $my_tag_name;
95298 }
95299 }
95300 }
95301
95302 /**
95303 * Display or retrieve page title for post archive based on date.
95304 *
95305 * Useful for when the template only needs to display the month and year, if
95306 * either are available. Optimized for just this purpose, so if it is all that
95307 * is needed, should be better than {@link wp_title()}.
95308 *
95309 * It does not support placing the separator after the title, but by leaving the
95310 * prefix parameter empty, you can set the title separator manually. The prefix
95311 * does not automatically place a space between the prefix, so if there should
95312 * be a space, the parameter value will need to have it at the end.
95313 *
95314 * @since 0.71
95315 *
95316 * @param string $prefix Optional. What to display before the title.
95317 * @param bool $display Optional, default is true. Whether to display or retrieve title.
95318 * @return string|null Title when retrieving, null when displaying or failure.
95319 */
95320 function single_month_title($prefix = '', $display = true ) {
95321 global $wp_locale;
95322
95323 $m = get_query_var('m');
95324 $year = get_query_var('year');
95325 $monthnum = get_query_var('monthnum');
95326
95327 if ( !empty($monthnum) && !empty($year) ) {
95328 $my_year = $year;
95329 $my_month = $wp_locale->get_month($monthnum);
95330 } elseif ( !empty($m) ) {
95331 $my_year = substr($m, 0, 4);
95332 $my_month = $wp_locale->get_month(substr($m, 4, 2));
95333 }
95334
95335 if ( empty($my_month) )
95336 return false;
95337
95338 $result = $prefix . $my_month . $prefix . $my_year;
95339
95340 if ( !$display )
95341 return $result;
95342 echo $result;
95343 }
95344
95345 /**
95346 * Retrieve archive link content based on predefined or custom code.
95347 *
95348 * The format can be one of four styles. The 'link' for head element, 'option'
95349 * for use in the select element, 'html' for use in list (either ol or ul HTML
95350 * elements). Custom content is also supported using the before and after
95351 * parameters.
95352 *
95353 * The 'link' format uses the link HTML element with the <em>archives</em>
95354 * relationship. The before and after parameters are not used. The text
95355 * parameter is used to describe the link.
95356 *
95357 * The 'option' format uses the option HTML element for use in select element.
95358 * The value is the url parameter and the before and after parameters are used
95359 * between the text description.
95360 *
95361 * The 'html' format, which is the default, uses the li HTML element for use in
95362 * the list HTML elements. The before parameter is before the link and the after
95363 * parameter is after the closing link.
95364 *
95365 * The custom format uses the before parameter before the link ('a' HTML
95366 * element) and the after parameter after the closing link tag. If the above
95367 * three values for the format are not used, then custom format is assumed.
95368 *
95369 * @since 1.0.0
95370 * @author Orien
95371 * @link http://icecode.com/ link navigation hack by Orien
95372 *
95373 * @param string $url URL to archive.
95374 * @param string $text Archive text description.
95375 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
95376 * @param string $before Optional.
95377 * @param string $after Optional.
95378 * @return string HTML link content for archive.
95379 */
95380 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
95381 $text = wptexturize($text);
95382 $title_text = attribute_escape($text);
95383 $url = clean_url($url);
95384
95385 if ('link' == $format)
95386 $link_html = "\t<link rel='archives' title='$title_text' href='$url' />\n";
95387 elseif ('option' == $format)
95388 $link_html = "\t<option value='$url'>$before $text $after</option>\n";
95389 elseif ('html' == $format)
95390 $link_html = "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n";
95391 else // custom
95392 $link_html = "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
95393
95394 $link_html = apply_filters( "get_archives_link", $link_html );
95395
95396 return $link_html;
95397 }
95398
95399 /**
95400 * Display archive links based on type and format.
95401 *
95402 * The 'type' argument offers a few choices and by default will display monthly
95403 * archive links. The other options for values are 'daily', 'weekly', 'monthly',
95404 * 'yearly', 'postbypost' or 'alpha'. Both 'postbypost' and 'alpha' display the
95405 * same archive link list, the difference between the two is that 'alpha'
95406 * will order by post title and 'postbypost' will order by post date.
95407 *
95408 * The date archives will logically display dates with links to the archive post
95409 * page. The 'postbypost' and 'alpha' values for 'type' argument will display
95410 * the post titles.
95411 *
95412 * The 'limit' argument will only display a limited amount of links, specified
95413 * by the 'limit' integer value. By default, there is no limit. The
95414 * 'show_post_count' argument will show how many posts are within the archive.
95415 * By default, the 'show_post_count' argument is set to false.
95416 *
95417 * For the 'format', 'before', and 'after' arguments, see {@link
95418 * get_archives_link()}. The values of these arguments have to do with that
95419 * function.
95420 *
95421 * @since 1.2.0
95422 *
95423 * @param string|array $args Optional. Override defaults.
95424 */
95425 function wp_get_archives($args = '') {
95426 global $wpdb, $wp_locale;
95427
95428 $defaults = array(
95429 'type' => 'monthly', 'limit' => '',
95430 'format' => 'html', 'before' => '',
95431 'after' => '', 'show_post_count' => false,
95432 'echo' => 1, 'start' => 1
95433 );
95434
95435 $r = wp_parse_args( $args, $defaults );
95436 extract( $r, EXTR_SKIP );
95437
95438 if ( '' == $type )
95439 $type = 'monthly';
95440
95441 if ( '' != $limit ) {
95442 $limit = absint($limit);
95443 $limit = ' LIMIT '.$limit;
95444 }
95445
95446 // this is what will separate dates on weekly archive links
95447 $archive_week_separator = '–';
95448
95449 // over-ride general date format ? 0 = no: use the date format set in Options, 1 = yes: over-ride
95450 $archive_date_format_over_ride = 0;
95451
95452 // options for daily archive (only if you over-ride the general date format)
95453 $archive_day_date_format = 'Y/m/d';
95454
95455 // options for weekly archive (only if you over-ride the general date format)
95456 $archive_week_start_date_format = 'Y/m/d';
95457 $archive_week_end_date_format = 'Y/m/d';
95458
95459 if ( !$archive_date_format_over_ride ) {
95460 $archive_day_date_format = get_option('date_format');
95461 $archive_week_start_date_format = get_option('date_format');
95462 $archive_week_end_date_format = get_option('date_format');
95463 }
95464
95465 //filters
95466 $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
95467 $join = apply_filters('getarchives_join', "", $r);
95468
95469 $output = '';
95470
95471 if ( 'monthly' == $type ) {
95472 $query = "SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where AND post_date_gmt > FROM_UNIXTIME(".$start.") GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC $limit";
95473 $key = md5($query);
95474 $cache = wp_cache_get( 'wp_get_archives' , 'general');
95475 if ( !isset( $cache[ $key ] ) ) {
95476 $arcresults = $wpdb->get_results($query);
95477 $cache[ $key ] = $arcresults;
95478 wp_cache_add( 'wp_get_archives', $cache, 'general' );
95479 } else {
95480 $arcresults = $cache[ $key ];
95481 }
95482 if ( $arcresults ) {
95483 $afterafter = $after;
95484 foreach ( (array) $arcresults as $arcresult ) {
95485 $url = get_month_link( $arcresult->year, $arcresult->month );
95486 $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
95487 if ( $show_post_count )
95488 $after = ' ('.$arcresult->posts.')' . $afterafter;
95489 $output .= get_archives_link($url, $text, $format, $before, $after);
95490 }
95491 }
95492 } elseif ('yearly' == $type) {
95493 $query = "SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where AND post_date_gmt > FROM_UNIXTIME(".$start.") GROUP BY YEAR(post_date) ORDER BY post_date DESC $limit";
95494 $key = md5($query);
95495 $cache = wp_cache_get( 'wp_get_archives' , 'general');
95496 if ( !isset( $cache[ $key ] ) ) {
95497 $arcresults = $wpdb->get_results($query);
95498 $cache[ $key ] = $arcresults;
95499 wp_cache_add( 'wp_get_archives', $cache, 'general' );
95500 } else {
95501 $arcresults = $cache[ $key ];
95502 }
95503 if ($arcresults) {
95504 $afterafter = $after;
95505 foreach ( (array) $arcresults as $arcresult) {
95506 $url = get_year_link($arcresult->year);
95507 $text = sprintf('%d', $arcresult->year);
95508 if ($show_post_count)
95509 $after = ' ('.$arcresult->posts.')' . $afterafter;
95510 $output .= get_archives_link($url, $text, $format, $before, $after);
95511 }
95512 }
95513 } elseif ( 'daily' == $type ) {
95514 $query = "SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where AND post_date_gmt > FROM_UNIXTIME(".$start.") GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC $limit";
95515 $key = md5($query);
95516 $cache = wp_cache_get( 'wp_get_archives' , 'general');
95517 if ( !isset( $cache[ $key ] ) ) {
95518 $arcresults = $wpdb->get_results($query);
95519 $cache[ $key ] = $arcresults;
95520 wp_cache_add( 'wp_get_archives', $cache, 'general' );
95521 } else {
95522 $arcresults = $cache[ $key ];
95523 }
95524 if ( $arcresults ) {
95525 $afterafter = $after;
95526 foreach ( (array) $arcresults as $arcresult ) {
95527 $url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
95528 $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
95529 $text = mysql2date($archive_day_date_format, $date);
95530 if ($show_post_count)
95531 $after = ' ('.$arcresult->posts.')'.$afterafter;
95532 $output .= get_archives_link($url, $text, $format, $before, $after);
95533 }
95534 }
95535 } elseif ( 'weekly' == $type ) {
95536 $start_of_week = get_option('start_of_week');
95537 $query = "SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd, count(ID) as posts FROM $wpdb->posts $join $where AND post_date_gmt > FROM_UNIXTIME(".$start.") GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC $limit";
95538 $key = md5($query);
95539 $cache = wp_cache_get( 'wp_get_archives' , 'general');
95540 if ( !isset( $cache[ $key ] ) ) {
95541 $arcresults = $wpdb->get_results($query);
95542 $cache[ $key ] = $arcresults;
95543 wp_cache_add( 'wp_get_archives', $cache, 'general' );
95544 } else {
95545 $arcresults = $cache[ $key ];
95546 }
95547 $arc_w_last = '';
95548 $afterafter = $after;
95549 if ( $arcresults ) {
95550 foreach ( (array) $arcresults as $arcresult ) {
95551 if ( $arcresult->week != $arc_w_last ) {
95552 $arc_year = $arcresult->yr;
95553 $arc_w_last = $arcresult->week;
95554 $arc_week = get_weekstartend($arcresult->yyyymmdd, get_option('start_of_week'));
95555 $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
95556 $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
95557 $url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', get_option('home'), '', '?', '=', $arc_year, '&', '=', $arcresult->week);
95558 $text = $arc_week_start . $archive_week_separator . $arc_week_end;
95559 if ($show_post_count)
95560 $after = ' ('.$arcresult->posts.')'.$afterafter;
95561 $output .= get_archives_link($url, $text, $format, $before, $after);
95562 }
95563 }
95564 }
95565 } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
95566 $orderby = ('alpha' == $type) ? "post_title ASC " : "post_date DESC ";
95567 $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
95568 $key = md5($query);
95569 $cache = wp_cache_get( 'wp_get_archives' , 'general');
95570 if ( !isset( $cache[ $key ] ) ) {
95571 $arcresults = $wpdb->get_results($query);
95572 $cache[ $key ] = $arcresults;
95573 wp_cache_add( 'wp_get_archives', $cache, 'general' );
95574 } else {
95575 $arcresults = $cache[ $key ];
95576 }
95577 if ( $arcresults ) {
95578 foreach ( (array) $arcresults as $arcresult ) {
95579 if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {
95580 $url = get_permalink($arcresult);
95581 $arc_title = $arcresult->post_title;
95582 if ( $arc_title )
95583 $text = strip_tags(apply_filters('the_title', $arc_title));
95584 else
95585 $text = $arcresult->ID;
95586 $output .= get_archives_link($url, $text, $format, $before, $after);
95587 }
95588 }
95589 }
95590 }
95591 if ( $echo )
95592 echo $output;
95593 else
95594 return $output;
95595 }
95596
95597 /**
95598 * Get number of days since the start of the week.
95599 *
95600 * @since 1.5.0
95601 * @usedby get_calendar()
95602 *
95603 * @param int $num Number of day.
95604 * @return int Days since the start of the week.
95605 */
95606 function calendar_week_mod($num) {
95607 $base = 7;
95608 return ($num - $base*floor($num/$base));
95609 }
95610
95611 /**
95612 * Display calendar with days that have posts as links.
95613 *
95614 * The calendar is cached, which will be retrieved, if it exists. If there are
95615 * no posts for the month, then it will not be displayed.
95616 *
95617 * @since 1.0.0
95618 *
95619 * @param bool $initial Optional, default is true. Use initial calendar names.
95620 */
95621 function get_calendar($initial = true) {
95622 global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
95623
95624 $key = md5( $m . $monthnum . $year );
95625 if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
95626 if ( isset( $cache[ $key ] ) ) {
95627 echo $cache[ $key ];
95628 return;
95629 }
95630 }
95631
95632 ob_start();
95633 // Quick check. If we have no posts at all, abort!
95634 if ( !$posts ) {
95635 $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
95636 if ( !$gotsome )
95637 return;
95638 }
95639
95640 if ( isset($_GET['w']) )
95641 $w = ''.intval($_GET['w']);
95642
95643 // week_begins = 0 stands for Sunday
95644 $week_begins = intval(get_option('start_of_week'));
95645
95646 // Let's figure out when we are
95647 if ( !empty($monthnum) && !empty($year) ) {
95648 $thismonth = ''.zeroise(intval($monthnum), 2);
95649 $thisyear = ''.intval($year);
95650 } elseif ( !empty($w) ) {
95651 // We need to get the month from MySQL
95652 $thisyear = ''.intval(substr($m, 0, 4));
95653 $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
95654 $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')");
95655 } elseif ( !empty($m) ) {
95656 $thisyear = ''.intval(substr($m, 0, 4));
95657 if ( strlen($m) < 6 )
95658 $thismonth = '01';
95659 else
95660 $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2);
95661 } else {
95662 $thisyear = gmdate('Y', current_time('timestamp'));
95663 $thismonth = gmdate('m', current_time('timestamp'));
95664 }
95665
95666 $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);
95667
95668 // Get the next and previous month and year with at least one post
95669 $previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
95670 FROM $wpdb->posts
95671 WHERE post_date < '$thisyear-$thismonth-01'
95672 AND post_type = 'post' AND post_status = 'publish'
95673 ORDER BY post_date DESC
95674 LIMIT 1");
95675 $next = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
95676 FROM $wpdb->posts
95677 WHERE post_date > '$thisyear-$thismonth-01'
95678 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
95679 AND post_type = 'post' AND post_status = 'publish'
95680 ORDER BY post_date ASC
95681 LIMIT 1");
95682
95683 echo '<table id="wp-calendar" summary="' . __('Calendar') . '">
95684 <caption>' . sprintf(_c('%1$s %2$s|Used as a calendar caption'), $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption>
95685 <thead>
95686 <tr>';
95687
95688 $myweek = array();
95689
95690 for ( $wdcount=0; $wdcount<=6; $wdcount++ ) {
95691 $myweek[] = $wp_locale->get_weekday(($wdcount+$week_begins)%7);
95692 }
95693
95694 foreach ( $myweek as $wd ) {
95695 $day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
95696 echo "\n\t\t<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">$day_name</th>";
95697 }
95698
95699 echo '
95700 </tr>
95701 </thead>
95702
95703 <tfoot>
95704 <tr>';
95705
95706 if ( $previous ) {
95707 echo "\n\t\t".'<td abbr="' . $wp_locale->get_month($previous->month) . '" colspan="3" id="prev"><a href="' .
95708 get_month_link($previous->year, $previous->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($previous->month),
95709 date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year))) . '">« ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
95710 } else {
95711 echo "\n\t\t".'<td colspan="3" id="prev" class="pad"> </td>';
95712 }
95713
95714 echo "\n\t\t".'<td class="pad"> </td>';
95715
95716 if ( $next ) {
95717 echo "\n\t\t".'<td abbr="' . $wp_locale->get_month($next->month) . '" colspan="3" id="next"><a href="' .
95718 get_month_link($next->year, $next->month) . '" title="' . sprintf(__('View posts for %1$s %2$s'), $wp_locale->get_month($next->month),
95719 date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' »</a></td>';
95720 } else {
95721 echo "\n\t\t".'<td colspan="3" id="next" class="pad"> </td>';
95722 }
95723
95724 echo '
95725 </tr>
95726 </tfoot>
95727
95728 <tbody>
95729 <tr>';
95730
95731 // Get days with posts
95732 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
95733 FROM $wpdb->posts WHERE MONTH(post_date) = '$thismonth'
95734 AND YEAR(post_date) = '$thisyear'
95735 AND post_type = 'post' AND post_status = 'publish'
95736 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
95737 if ( $dayswithposts ) {
95738 foreach ( (array) $dayswithposts as $daywith ) {
95739 $daywithpost[] = $daywith[0];
95740 }
95741 } else {
95742 $daywithpost = array();
95743 }
95744
95745 if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false)
95746 $ak_title_separator = "\n";
95747 else
95748 $ak_title_separator = ', ';
95749
95750 $ak_titles_for_day = array();
95751 $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom "
95752 ."FROM $wpdb->posts "
95753 ."WHERE YEAR(post_date) = '$thisyear' "
95754 ."AND MONTH(post_date) = '$thismonth' "
95755 ."AND post_date < '".current_time('mysql')."' "
95756 ."AND post_type = 'post' AND post_status = 'publish'"
95757 );
95758 if ( $ak_post_titles ) {
95759 foreach ( (array) $ak_post_titles as $ak_post_title ) {
95760
95761 $post_title = apply_filters( "the_title", $ak_post_title->post_title );
95762 $post_title = str_replace('"', '"', wptexturize( $post_title ));
95763
95764 if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) )
95765 $ak_titles_for_day['day_'.$ak_post_title->dom] = '';
95766 if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one
95767 $ak_titles_for_day["$ak_post_title->dom"] = $post_title;
95768 else
95769 $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title;
95770 }
95771 }
95772
95773
95774 // See how much we should pad in the beginning
95775 $pad = calendar_week_mod(date('w', $unixmonth)-$week_begins);
95776 if ( 0 != $pad )
95777 echo "\n\t\t".'<td colspan="'.$pad.'" class="pad"> </td>';
95778
95779 $daysinmonth = intval(date('t', $unixmonth));
95780 for ( $day = 1; $day <= $daysinmonth; ++$day ) {
95781 if ( isset($newrow) && $newrow )
95782 echo "\n\t</tr>\n\t<tr>\n\t\t";
95783 $newrow = false;
95784
95785 if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) )
95786 echo '<td id="today">';
95787 else
95788 echo '<td>';
95789
95790 if ( in_array($day, $daywithpost) ) // any posts today?
95791 echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>";
95792 else
95793 echo $day;
95794 echo '</td>';
95795
95796 if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) )
95797 $newrow = true;
95798 }
95799
95800 $pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins);
95801 if ( $pad != 0 && $pad != 7 )
95802 echo "\n\t\t".'<td class="pad" colspan="'.$pad.'"> </td>';
95803
95804 echo "\n\t</tr>\n\t</tbody>\n\t</table>";
95805
95806 $output = ob_get_contents();
95807 ob_end_clean();
95808 echo $output;
95809 $cache[ $key ] = $output;
95810 wp_cache_set( 'get_calendar', $cache, 'calendar' );
95811 }
95812
95813 /**
95814 * Purge the cached results of get_calendar.
95815 *
95816 * @see get_calendar
95817 * @since 2.1.0
95818 */
95819 function delete_get_calendar_cache() {
95820 wp_cache_delete( 'get_calendar', 'calendar' );
95821 }
95822 add_action( 'save_post', 'delete_get_calendar_cache' );
95823 add_action( 'delete_post', 'delete_get_calendar_cache' );
95824 add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
95825 add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
95826 add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
95827
95828 /**
95829 * Display all of the allowed tags in HTML format with attributes.
95830 *
95831 * This is useful for displaying in the comment area, which elements and
95832 * attributes are supported. As well as any plugins which want to display it.
95833 *
95834 * @since 1.0.1
95835 * @uses $allowedtags
95836 *
95837 * @return string HTML allowed tags entity encoded.
95838 */
95839 function allowed_tags() {
95840 global $allowedtags;
95841 $allowed = '';
95842 foreach ( (array) $allowedtags as $tag => $attributes ) {
95843 $allowed .= '<'.$tag;
95844 if ( 0 < count($attributes) ) {
95845 foreach ( $attributes as $attribute => $limits ) {
95846 $allowed .= ' '.$attribute.'=""';
95847 }
95848 }
95849 $allowed .= '> ';
95850 }
95851 return htmlentities($allowed);
95852 }
95853
95854 /***** Date/Time tags *****/
95855
95856 /**
95857 * Outputs the date in iso8601 format for xml files.
95858 *
95859 * @since 1.0.0
95860 */
95861 function the_date_xml() {
95862 global $post;
95863 echo mysql2date('Y-m-d', $post->post_date);
95864 }
95865
95866 /**
95867 * Display or Retrieve the date the post was written.
95868 *
95869 * Will only output the date if the current post's date is different from the
95870 * previous one output.
95871 *
95872 * @since 0.71
95873 *
95874 * @param string $d Optional. PHP date format defaults to the date_format option if not specified.
95875 * @param string $before Optional. Output before the date.
95876 * @param string $after Optional. Output after the date.
95877 * @param bool $echo Optional, default is display. Whether to echo the date or return it.
95878 * @return string|null Null if displaying, string if retrieving.
95879 */
95880 function the_date($d='', $before='', $after='', $echo = true) {
95881 global $post, $day, $previousday;
95882 $the_date = '';
95883 if ( $day != $previousday ) {
95884 $the_date .= $before;
95885 if ( $d=='' )
95886 $the_date .= mysql2date(get_option('date_format'), $post->post_date);
95887 else
95888 $the_date .= mysql2date($d, $post->post_date);
95889 $the_date .= $after;
95890 $previousday = $day;
95891 }
95892 $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
95893 if ( $echo )
95894 echo $the_date;
95895 else
95896 return $the_date;
95897 }
95898
95899 /**
95900 * Display the date on which the post was last modified.
95901 *
95902 * @since 2.1.0
95903 *
95904 * @param string $d Optional. PHP date format.
95905 * @return string
95906 */
95907 function the_modified_date($d = '') {
95908 echo apply_filters('the_modified_date', get_the_modified_date($d), $d);
95909 }
95910
95911 /**
95912 * Retrieve the date on which the post was last modified.
95913 *
95914 * @since 2.1.0
95915 *
95916 * @param string $d Optional. PHP date format. Defaults to the "date_format" option
95917 * @return string
95918 */
95919 function get_the_modified_date($d = '') {
95920 if ( '' == $d )
95921 $the_time = get_post_modified_time(get_option('date_format'));
95922 else
95923 $the_time = get_post_modified_time($d);
95924 return apply_filters('get_the_modified_date', $the_time, $d);
95925 }
95926
95927 /**
95928 * Display the time at which the post was written.
95929 *
95930 * @since 0.71
95931 *
95932 * @param string $d Either 'G', 'U', or php date format.
95933 */
95934 function the_time( $d = '' ) {
95935 echo apply_filters('the_time', get_the_time( $d ), $d);
95936 }
95937
95938 /**
95939 * Retrieve the time at which the post was written.
95940 *
95941 * @since 1.5.0
95942 *
95943 * @param string $d Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
95944 * @param int|object $post Optional post ID or object. Default is global $post object.
95945 * @return string
95946 */
95947 function get_the_time( $d = '', $post = null ) {
95948 $post = get_post($post);
95949
95950 if ( '' == $d )
95951 $the_time = get_post_time(get_option('time_format'), false, $post);
95952 else
95953 $the_time = get_post_time($d, false, $post);
95954 return apply_filters('get_the_time', $the_time, $d, $post);
95955 }
95956
95957 /**
95958 * Retrieve the time at which the post was written.
95959 *
95960 * @since 2.0.0
95961 *
95962 * @param string $d Either 'G', 'U', or php date format.
95963 * @param bool $gmt Whether of not to return the gmt time.
95964 * @param int|object $post Optional post ID or object. Default is global $post object.
95965 * @return string
95966 */
95967 function get_post_time( $d = 'U', $gmt = false, $post = null ) { // returns timestamp
95968 $post = get_post($post);
95969
95970 if ( $gmt )
95971 $time = $post->post_date_gmt;
95972 else
95973 $time = $post->post_date;
95974
95975 $time = mysql2date($d, $time);
95976 return apply_filters('get_post_time', $time, $d, $gmt);
95977 }
95978
95979 /**
95980 * Display the time at which the post was last modified.
95981 *
95982 * @since 2.0.0
95983 *
95984 * @param string $d Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
95985 */
95986 function the_modified_time($d = '') {
95987 echo apply_filters('the_modified_time', get_the_modified_time($d), $d);
95988 }
95989
95990 /**
95991 * Retrieve the time at which the post was last modified.
95992 *
95993 * @since 2.0.0
95994 *
95995 * @param string $d Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
95996 * @return string
95997 */
95998 function get_the_modified_time($d = '') {
95999 if ( '' == $d )
96000 $the_time = get_post_modified_time(get_option('time_format'));
96001 else
96002 $the_time = get_post_modified_time($d);
96003 return apply_filters('get_the_modified_time', $the_time, $d);
96004 }
96005
96006 /**
96007 * Retrieve the time at which the post was last modified.
96008 *
96009 * @since 2.0.0
96010 *
96011 * @param string $d Either 'G', 'U', or php date format.
96012 * @param bool $gmt Whether of not to return the gmt time.
96013 * @return string Returns timestamp
96014 */
96015 function get_post_modified_time( $d = 'U', $gmt = false ) {
96016 global $post;
96017
96018 if ( $gmt )
96019 $time = $post->post_modified_gmt;
96020 else
96021 $time = $post->post_modified;
96022 $time = mysql2date($d, $time);
96023
96024 return apply_filters('get_the_modified_time', $time, $d, $gmt);
96025 }
96026
96027 /**
96028 * Display the weekday on which the post was written.
96029 *
96030 * @since 0.71
96031 * @uses $wp_locale
96032 * @uses $post
96033 */
96034 function the_weekday() {
96035 global $wp_locale, $post;
96036 $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date));
96037 $the_weekday = apply_filters('the_weekday', $the_weekday);
96038 echo $the_weekday;
96039 }
96040
96041 /**
96042 * Display the weekday on which the post was written.
96043 *
96044 * Will only output the weekday if the current post's weekday is different from
96045 * the previous one output.
96046 *
96047 * @since 0.71
96048 *
96049 * @param string $before output before the date.
96050 * @param string $after output after the date.
96051 */
96052 function the_weekday_date($before='',$after='') {
96053 global $wp_locale, $post, $day, $previousweekday;
96054 $the_weekday_date = '';
96055 if ( $day != $previousweekday ) {
96056 $the_weekday_date .= $before;
96057 $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', $post->post_date));
96058 $the_weekday_date .= $after;
96059 $previousweekday = $day;
96060 }
96061 $the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after);
96062 echo $the_weekday_date;
96063 }
96064
96065 /**
96066 * Fire the wp_head action
96067 *
96068 * @since 1.2.0
96069 * @uses do_action() Calls 'wp_head' hook.
96070 */
96071 function wp_head() {
96072 do_action('wp_head');
96073 }
96074
96075 /**
96076 * Fire the wp_footer action
96077 *
96078 * @since 1.5.1
96079 * @uses do_action() Calls 'wp_footer' hook.
96080 */
96081 function wp_footer() {
96082 do_action('wp_footer');
96083 }
96084
96085 /**
96086 * Display the link to the Really Simple Discovery service endpoint.
96087 *
96088 * @link http://archipelago.phrasewise.com/rsd
96089 * @since 2.0.0
96090 */
96091 function rsd_link() {
96092 echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n";
96093 }
96094
96095 /**
96096 * Display the link to the Windows Live Writer manifest file.
96097 *
96098 * @link http://msdn.microsoft.com/en-us/library/bb463265.aspx
96099 * @since 2.3.1
96100 */
96101 function wlwmanifest_link() {
96102 echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="'
96103 . get_bloginfo('wpurl') . '/wp-includes/wlwmanifest.xml" /> ' . "\n";
96104 }
96105
96106 /**
96107 * Display a noindex meta tag if required by the blog configuration.
96108 *
96109 * If a blog is marked as not being public then the noindex meta tag will be
96110 * output to tell web robots not to index the page content.
96111 *
96112 * @since 2.1.0
96113 */
96114 function noindex() {
96115 // If the blog is not public, tell robots to go away.
96116 if ( '0' == get_option('blog_public') )
96117 echo "<meta name='robots' content='noindex,nofollow' />\n";
96118 }
96119
96120 /**
96121 * Determine if TinyMCE is available.
96122 *
96123 * Checks to see if the user has deleted the tinymce files to slim down there WordPress install.
96124 *
96125 * @since 2.1.0
96126 *
96127 * @return bool Whether of not TinyMCE exists.
96128 */
96129 function rich_edit_exists() {
96130 global $wp_rich_edit_exists;
96131 if ( !isset($wp_rich_edit_exists) )
96132 $wp_rich_edit_exists = file_exists(ABSPATH . WPINC . '/js/tinymce/tiny_mce.js');
96133 return $wp_rich_edit_exists;
96134 }
96135
96136 /**
96137 * Whether or not the user should have a WYSIWIG editor.
96138 *
96139 * Checks that the user requires a WYSIWIG editor and that the editor is
96140 * supported in the users browser.
96141 *
96142 * @since 2.0.0
96143 *
96144 * @return bool
96145 */
96146 function user_can_richedit() {
96147 global $wp_rich_edit, $pagenow;
96148
96149 if ( !isset( $wp_rich_edit) ) {
96150 if ( get_user_option( 'rich_editing' ) == 'true' &&
96151 ( ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval($match[1]) >= 420 ) ||
96152 !preg_match( '!opera[ /][2-8]|konqueror|safari!i', $_SERVER['HTTP_USER_AGENT'] ) )
96153 && 'comment.php' != $pagenow ) {
96154 $wp_rich_edit = true;
96155 } else {
96156 $wp_rich_edit = false;
96157 }
96158 }
96159
96160 return apply_filters('user_can_richedit', $wp_rich_edit);
96161 }
96162
96163 /**
96164 * Find out which editor should be displayed by default.
96165 *
96166 * Works out which of the two editors to display as the current editor for a
96167 * user.
96168 *
96169 * @since 2.5.0
96170 *
96171 * @return string Either 'tinymce', or 'html', or 'test'
96172 */
96173 function wp_default_editor() {
96174 $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
96175 if ( $user = wp_get_current_user() ) { // look for cookie
96176 $ed = get_user_setting('editor', 'tinymce');
96177 $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r;
96178 }
96179 return apply_filters( 'wp_default_editor', $r ); // filter
96180 }
96181
96182 /**
96183 * Display visual editor forms: TinyMCE, or HTML, or both.
96184 *
96185 * The amount of rows the text area will have for the content has to be between
96186 * 3 and 100 or will default at 12. There is only one option used for all users,
96187 * named 'default_post_edit_rows'.
96188 *
96189 * If the user can not use the rich editor (TinyMCE), then the switch button
96190 * will not be displayed.
96191 *
96192 * @since 2.1.0
96193 *
96194 * @param string $content Textarea content.
96195 * @param string $id HTML ID attribute value.
96196 * @param string $prev_id HTML ID name for switching back and forth between visual editors.
96197 * @param bool $media_buttons Optional, default is true. Whether to display media buttons.
96198 * @param int $tab_index Optional, default is 2. Tabindex for textarea element.
96199 */
96200 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2) {
96201 $rows = get_option('default_post_edit_rows');
96202 if (($rows < 3) || ($rows > 100))
96203 $rows = 12;
96204
96205 if ( !current_user_can( 'upload_files' ) )
96206 $media_buttons = false;
96207
96208 $richedit = user_can_richedit();
96209 $rows = "rows='$rows'";
96210
96211 if ( $richedit || $media_buttons ) { ?>
96212 <div id="editor-toolbar">
96213 <?php if ( $richedit ) {
96214 $wp_default_editor = wp_default_editor(); ?>
96215 <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
96216 <?php if ( 'html' == $wp_default_editor ) {
96217 add_filter('the_editor_content', 'wp_htmledit_pre'); ?>
96218 <a id="edButtonHTML" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
96219 <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
96220 <?php } else {
96221 add_filter('the_editor_content', 'wp_richedit_pre'); ?>
96222 <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>', 'html');"><?php _e('HTML'); ?></a>
96223 <a id="edButtonPreview" class="active" onclick="switchEditors.go('<?php echo $id; ?>', 'tinymce');"><?php _e('Visual'); ?></a>
96224 <?php }
96225 }
96226
96227 if ( $media_buttons ) { ?>
96228 <div id="media-buttons" class="hide-if-no-js">
96229 <?php do_action( 'media_buttons' ); ?>
96230 </div>
96231 <?php } ?>
96232 </div>
96233 <?php } ?>
96234
96235 <div id="quicktags">
96236 <?php wp_print_scripts( 'quicktags' ); ?>
96237 <script type="text/javascript">edToolbar()</script>
96238 </div>
96239
96240 <?php $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea $rows cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
96241 $the_editor_content = apply_filters('the_editor_content', $content);
96242
96243 printf($the_editor, $the_editor_content);
96244
96245 ?>
96246 <script type="text/javascript">
96247 // <![CDATA[
96248 edCanvas = document.getElementById('<?php echo $id; ?>');
96249 <?php if ( user_can_richedit() && $prev_id ) { ?>
96250 var dotabkey = true;
96251 // If tinyMCE is defined.
96252 if ( typeof tinyMCE != 'undefined' ) {
96253 // This code is meant to allow tabbing from Title to Post (TinyMCE).
96254 jQuery('#<?php echo $prev_id; ?>')[jQuery.browser.opera ? 'keypress' : 'keydown'](function (e) {
96255 if (e.which == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
96256 if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
96257 if ( tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() && dotabkey ) {
96258 e.preventDefault();
96259 dotabkey = false;
96260 tinyMCE.activeEditor.focus();
96261 return false;
96262 }
96263 }
96264 });
96265 }
96266 <?php } ?>
96267 // ]]>
96268 </script>
96269 <?php
96270 }
96271
96272 /**
96273 * Retrieve the contents of the search WordPress query variable.
96274 *
96275 * @since 2.3.0
96276 *
96277 * @return string
96278 */
96279 function get_search_query() {
96280 return apply_filters( 'get_search_query', stripslashes( get_query_var( 's' ) ) );
96281 }
96282
96283 /**
96284 * Display the contents of the search query variable.
96285 *
96286 * The search query string is passed through {@link attribute_escape()}
96287 * to ensure that it is safe for placing in an html attribute.
96288 *
96289 * @uses attribute_escape
96290 * @since 2.1.0
96291 */
96292 function the_search_query() {
96293 echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) );
96294 }
96295
96296 /**
96297 * Display the language attributes for the html tag.
96298 *
96299 * Builds up a set of html attributes containing the text direction and language
96300 * information for the page.
96301 *
96302 * @since 2.1.0
96303 *
96304 * @param string $doctype The type of html document (xhtml|html).
96305 */
96306 function language_attributes($doctype = 'html') {
96307 $attributes = array();
96308 $output = '';
96309
96310 if ( $dir = get_bloginfo('text_direction') )
96311 $attributes[] = "dir=\"$dir\"";
96312
96313 if ( $lang = get_bloginfo('language') ) {
96314 if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' )
96315 $attributes[] = "lang=\"$lang\"";
96316
96317 if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
96318 $attributes[] = "xml:lang=\"$lang\"";
96319 }
96320
96321 $output = implode(' ', $attributes);
96322 $output = apply_filters('language_attributes', $output);
96323 echo $output;
96324 }
96325
96326 /**
96327 * Retrieve paginated link for archive post pages.
96328 *
96329 * Technically, the function can be used to create paginated link list for any
96330 * area. The 'base' argument is used to reference the url, which will be used to
96331 * create the paginated links. The 'format' argument is then used for replacing
96332 * the page number. It is however, most likely and by default, to be used on the
96333 * archive post pages.
96334 *
96335 * The 'type' argument controls format of the returned value. The default is
96336 * 'plain', which is just a string with the links separated by a newline
96337 * character. The other possible values are either 'array' or 'list'. The
96338 * 'array' value will return an array of the paginated link list to offer full
96339 * control of display. The 'list' value will place all of the paginated links in
96340 * an unordered HTML list.
96341 *
96342 * The 'total' argument is the total amount of pages and is an integer. The
96343 * 'current' argument is the current page number and is also an integer.
96344 *
96345 * An example of the 'base' argument is "http://example.com/all_posts.php%_%"
96346 * and the '%_%' is required. The '%_%' will be replaced by the contents of in
96347 * the 'format' argument. An example for the 'format' argument is "?page=%#%"
96348 * and the '%#%' is also required. The '%#%' will be replaced with the page
96349 * number.
96350 *
96351 * You can include the previous and next links in the list by setting the
96352 * 'prev_next' argument to true, which it is by default. You can set the
96353 * previous text, by using the 'prev_text' argument. You can set the next text
96354 * by setting the 'next_text' argument.
96355 *
96356 * If the 'show_all' argument is set to true, then it will show all of the pages
96357 * instead of a short list of the pages near the current page. By default, the
96358 * 'show_all' is set to false and controlled by the 'end_size' and 'mid_size'
96359 * arguments. The 'end_size' argument is how many numbers on either the start
96360 * and the end list edges, by default is 1. The 'mid_size' argument is how many
96361 * numbers to either side of current page, but not including current page.
96362 *
96363 * It is possible to add query vars to the link by using the 'add_args' argument
96364 * and see {@link add_query_arg()} for more information.
96365 *
96366 * @since 2.1.0
96367 *
96368 * @param string|array $args Optional. Override defaults.
96369 * @return array|string String of page links or array of page links.
96370 */
96371 function paginate_links( $args = '' ) {
96372 $defaults = array(
96373 'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
96374 'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
96375 'total' => 1,
96376 'current' => 0,
96377 'show_all' => false,
96378 'prev_next' => true,
96379 'prev_text' => __('« Previous'),
96380 'next_text' => __('Next »'),
96381 'end_size' => 1,
96382 'mid_size' => 2,
96383 'type' => 'plain',
96384 'add_args' => false, // array of query args to add
96385 'add_fragment' => ''
96386 );
96387
96388 $args = wp_parse_args( $args, $defaults );
96389 extract($args, EXTR_SKIP);
96390
96391 // Who knows what else people pass in $args
96392 $total = (int) $total;
96393 if ( $total < 2 )
96394 return;
96395 $current = (int) $current;
96396 $end_size = 0 < (int) $end_size ? (int) $end_size : 1; // Out of bounds? Make it the default.
96397 $mid_size = 0 <= (int) $mid_size ? (int) $mid_size : 2;
96398 $add_args = is_array($add_args) ? $add_args : false;
96399 $r = '';
96400 $page_links = array();
96401 $n = 0;
96402 $dots = false;
96403
96404 if ( $prev_next && $current && 1 < $current ) :
96405 $link = str_replace('%_%', 2 == $current ? '' : $format, $base);
96406 $link = str_replace('%#%', $current - 1, $link);
96407 if ( $add_args )
96408 $link = add_query_arg( $add_args, $link );
96409 $link .= $add_fragment;
96410 $page_links[] = "<a class='prev page-numbers' href='" . clean_url($link) . "'>$prev_text</a>";
96411 endif;
96412 for ( $n = 1; $n <= $total; $n++ ) :
96413 $n_display = number_format_i18n($n);
96414 if ( $n == $current ) :
96415 $page_links[] = "<span class='page-numbers current'>$n_display</span>";
96416 $dots = true;
96417 else :
96418 if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
96419 $link = str_replace('%_%', 1 == $n ? '' : $format, $base);
96420 $link = str_replace('%#%', $n, $link);
96421 if ( $add_args )
96422 $link = add_query_arg( $add_args, $link );
96423 $link .= $add_fragment;
96424 $page_links[] = "<a class='page-numbers' href='" . clean_url($link) . "'>$n_display</a>";
96425 $dots = true;
96426 elseif ( $dots && !$show_all ) :
96427 $page_links[] = "<span class='page-numbers dots'>...</span>";
96428 $dots = false;
96429 endif;
96430 endif;
96431 endfor;
96432 if ( $prev_next && $current && ( $current < $total || -1 == $total ) ) :
96433 $link = str_replace('%_%', $format, $base);
96434 $link = str_replace('%#%', $current + 1, $link);
96435 if ( $add_args )
96436 $link = add_query_arg( $add_args, $link );
96437 $link .= $add_fragment;
96438 $page_links[] = "<a class='next page-numbers' href='" . clean_url($link) . "'>$next_text</a>";
96439 endif;
96440 switch ( $type ) :
96441 case 'array' :
96442 return $page_links;
96443 break;
96444 case 'list' :
96445 $r .= "<ul class='page-numbers'>\n\t<li>";
96446 $r .= join("</li>\n\t<li>", $page_links);
96447 $r .= "</li>\n</ul>\n";
96448 break;
96449 default :
96450 $r = join("\n", $page_links);
96451 break;
96452 endswitch;
96453 return $r;
96454 }
96455
96456 /**
96457 * Registers an admin colour scheme css file.
96458 *
96459 * Allows a plugin to register a new admin colour scheme. For example:
96460 * <code>
96461 * wp_admin_css_color('classic', __('Classic'), admin_url("css/colors-classic.css"),
96462 * array('#07273E', '#14568A', '#D54E21', '#2683AE'));
96463 * </code>
96464 *
96465 * @since 2.5.0
96466 *
96467 * @param string $key The unique key for this theme.
96468 * @param string $name The name of the theme.
96469 * @param string $url The url of the css file containing the colour scheme.
96470 * @param array @colors An array of CSS color definitions which are used to give the user a feel for the theme.
96471 */
96472 function wp_admin_css_color($key, $name, $url, $colors = array()) {
96473 global $_wp_admin_css_colors;
96474
96475 if ( !isset($_wp_admin_css_colors) )
96476 $_wp_admin_css_colors = array();
96477
96478 $_wp_admin_css_colors[$key] = (object) array('name' => $name, 'url' => $url, 'colors' => $colors);
96479 }
96480
96481 /**
96482 * Display the URL of a WordPress admin CSS file.
96483 *
96484 * @see WP_Styles::_css_href and its style_loader_src filter.
96485 *
96486 * @since 2.3.0
96487 *
96488 * @param string $file file relative to wp-admin/ without its ".css" extension.
96489 */
96490 function wp_admin_css_uri( $file = 'wp-admin' ) {
96491 if ( defined('WP_INSTALLING') ) {
96492 $_file = "./$file.css";
96493 } else {
96494 $_file = admin_url("$file.css");
96495 }
96496 $_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file );
96497
96498 return apply_filters( 'wp_admin_css_uri', $_file, $file );
96499 }
96500
96501 /**
96502 * Enqueues or directly prints a stylesheet link to the specified CSS file.
96503 *
96504 * "Intelligently" decides to enqueue or to print the CSS file. If the
96505 * 'wp_print_styles' action has *not* yet been called, the CSS file will be
96506 * enqueued. If the wp_print_styles action *has* been called, the CSS link will
96507 * be printed. Printing may be forced by passing TRUE as the $force_echo
96508 * (second) parameter.
96509 *
96510 * For backward compatibility with WordPress 2.3 calling method: If the $file
96511 * (first) parameter does not correspond to a registered CSS file, we assume
96512 * $file is a file relative to wp-admin/ without its ".css" extension. A
96513 * stylesheet link to that generated URL is printed.
96514 *
96515 * @package WordPress
96516 * @since 2.3.0
96517 * @uses $wp_styles WordPress Styles Object
96518 *
96519 * @param string $file Style handle name or file name (without ".css" extension) relative to wp-admin/
96520 * @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued.
96521 */
96522 function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
96523 global $wp_styles;
96524 if ( !is_a($wp_styles, 'WP_Styles') )
96525 $wp_styles = new WP_Styles();
96526
96527 // For backward compatibility
96528 $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
96529
96530 if ( $wp_styles->query( $handle ) ) {
96531 if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately
96532 wp_print_styles( $handle );
96533 else // Add to style queue
96534 wp_enqueue_style( $handle );
96535 return;
96536 }
96537
96538 echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
96539 if ( 'rtl' == get_bloginfo( 'text_direction' ) )
96540 echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
96541 }
96542
96543 /**
96544 * Enqueues the default ThickBox js and css.
96545 *
96546 * If any of the settings need to be changed, this can be done with another js
96547 * file similar to media-upload.js and theme-preview.js. That file should
96548 * require array('thickbox') to ensure it is loaded after.
96549 *
96550 * @since 2.5.0
96551 */
96552 function add_thickbox() {
96553 wp_enqueue_script( 'thickbox' );
96554 wp_enqueue_style( 'thickbox' );
96555 }
96556
96557 /**
96558 * Display the XHTML generator that is generated on the wp_head hook.
96559 *
96560 * @since 2.5.0
96561 */
96562 function wp_generator() {
96563 the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
96564 }
96565
96566 /**
96567 * Display the generator XML or Comment for RSS, ATOM, etc.
96568 *
96569 * Returns the correct generator type for the requested output format. Allows
96570 * for a plugin to filter generators overall the the_generator filter.
96571 *
96572 * @since 2.5.0
96573 * @uses apply_filters() Calls 'the_generator' hook.
96574 *
96575 * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export).
96576 */
96577 function the_generator( $type ) {
96578 echo apply_filters('the_generator', get_the_generator($type), $type) . "\n";
96579 }
96580
96581 /**
96582 * Creates the generator XML or Comment for RSS, ATOM, etc.
96583 *
96584 * Returns the correct generator type for the requested output format. Allows
96585 * for a plugin to filter generators on an individual basis using the
96586 * 'get_the_generator_{$type}' filter.
96587 *
96588 * @since 2.5.0
96589 * @uses apply_filters() Calls 'get_the_generator_$type' hook.
96590 *
96591 * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export).
96592 * @return string The HTML content for the generator.
96593 */
96594 function get_the_generator( $type ) {
96595 switch ($type) {
96596 case 'html':
96597 $gen = '<meta name="generator" content="Polimedia">' . "\n";
96598 break;
96599 case 'xhtml':
96600 $gen = '<meta name="generator" content="Polimedia " />' . "\n";
96601 break;
96602 case 'atom':
96603 $gen = '<generator uri="http://polimedia.us/" version="1.0">Polimedia</generator>';
96604 break;
96605 case 'rss2':
96606 $gen = '<generator>http://polimedia.us</generator>';
96607 break;
96608 case 'rdf':
96609 $gen = '<admin:generatorAgent rdf:resource="http://polimedia.us" />';
96610 break;
96611 case 'comment':
96612 $gen = '<!-- generator="Polimedia/" -->';
96613 break;
96614 case 'export':
96615 $gen = '<!-- generator="Polimedia/" created="'. date('Y-m-d H:i') . '"-->';
96616 break;
96617 }
96618 return apply_filters( "get_the_generator_{$type}", $gen, $type );
96619 }
96620
96621 ?>