Make WordPress Core

Ticket #5640: 5640.r8786.diff

File 5640.r8786.diff, 17.9 KB (added by jacobsantos, 16 years ago)

Updated patch based off of r8786

  • general-template.php

     
    11<?php
     2/**
     3 * General template tags that can go anywhere in a template.
     4 *
     5 * @package WordPress
     6 * @subpackage Template
     7 */
    28
    3 /* Note: these tags go anywhere in the template */
    4 
     9/**
     10 * Load template header or named header file.
     11 *
     12 * {@internal Missing Long Description}}
     13 *
     14 * @uses locate_template()
     15 * @since 1.5.0
     16 * @uses do_action() Calls 'get_header' action.
     17 */
    518function get_header( $name = null ) {
    619        do_action( 'get_header' );
    720
     
    1528                load_template( get_theme_root() . '/default/header.php');
    1629}
    1730
    18 
     31/**
     32 * get_footer() - {@internal Missing Short Description}}
     33 *
     34 * {@internal Missing Long Description}}
     35 *
     36 * @since 1.5.0
     37 * @uses do_action()
     38 */
    1939function get_footer( $name = null ) {
    2040        do_action( 'get_footer' );
    2141
     
    2949                load_template( get_theme_root() . '/default/footer.php');
    3050}
    3151
    32 
     52/**
     53 * get_sidebar() - {@internal Missing Short Description}}
     54 *
     55 * {@internal Missing Long Description}}
     56 *
     57 * @since 1.5.0
     58 * @uses do_action()
     59 */
    3360function get_sidebar( $name = null ) {
    3461        do_action( 'get_sidebar' );
    3562
     
    4370                load_template( get_theme_root() . '/default/sidebar.php');
    4471}
    4572
    46 
     73/**
     74 * wp_loginout() - {@internal Missing Short Description}}
     75 *
     76 * {@internal Missing Long Description}}
     77 *
     78 * @since 1.5.0
     79 * @uses apply_filters()
     80 */
    4781function wp_loginout() {
    4882        if ( ! is_user_logged_in() )
    4983                $link = '<a href="' . site_url('wp-login.php', 'login') . '">' . __('Log in') . '</a>';
     
    5387        echo apply_filters('loginout', $link);
    5488}
    5589
    56 
     90/**
     91 * wp_register() - {@internal Missing Short Description}}
     92 *
     93 * {@internal Missing Long Description}}
     94 *
     95 * @since 1.5.0
     96 * @uses apply_filters()
     97 *
     98 * @param unknown_type $before
     99 * @param unknown_type $after
     100 */
    57101function wp_register( $before = '<li>', $after = '</li>' ) {
    58102
    59103        if ( ! is_user_logged_in() ) {
     
    68112        echo apply_filters('register', $link);
    69113}
    70114
    71 
     115/**
     116 * Theme container function for the 'wp_meta' action.
     117 *
     118 * The 'wp_meta' action can have several purposes, depending on how you use it,
     119 * but one purpose might have been to allow for theme switching.
     120 *
     121 * @since 1.5.0
     122 * @link http://trac.wordpress.org/ticket/1458 Explaination of 'wp_meta' action.
     123 * @uses do_action() Calls 'wp_meta' hook.
     124 */
    72125function wp_meta() {
    73126        do_action('wp_meta');
    74127}
    75128
    76 
     129/**
     130 * bloginfo() - {@internal Missing Short Description}}
     131 *
     132 * {@internal Missing Long Description}}
     133 *
     134 * @since 0.71
     135 *
     136 * @param unknown_type $show
     137 */
    77138function bloginfo($show='') {
    78139        echo get_bloginfo($show, 'display');
    79140}
    80141
    81142/**
     143 * get_bloginfo() - {@internal Missing Short Description}}
     144 *
     145 * {@internal Missing Long Description}}
     146 *
    82147 * Note: some of these values are DEPRECATED. Meaning they could be
    83148 * taken out at any time and shouldn't be relied upon. Options
    84149 * without "// DEPRECATED" are the preferred and recommended ways
    85150 * to get the information.
     151 *
     152 * @since 0.71
     153 *
     154 * @param unknown_type $show
     155 * @param unknown_type $filter
     156 * @return unknown
    86157 */
    87158function get_bloginfo($show = '', $filter = 'raw') {
    88159
     
    173244        return $output;
    174245}
    175246
    176 
     247/**
     248 * wp_title() - {@internal Missing Short Description}}
     249 *
     250 * {@internal Missing Long Description}}
     251 *
     252 * @since 1.0.0
     253 *
     254 * @param unknown_type $sep
     255 * @param unknown_type $display
     256 * @return unknown
     257 */
    177258function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
    178259        global $wpdb, $wp_locale, $wp_query;
    179260
     
    279360
    280361}
    281362
    282 
     363/**
     364 * single_post_title() - {@internal Missing Short Description}}
     365 *
     366 * {@internal Missing Long Description}}
     367 *
     368 * @since 0.71
     369 * @uses $wpdb
     370 *
     371 * @param unknown_type $prefix
     372 * @param unknown_type $display
     373 * @return unknown
     374 */
    283375function single_post_title($prefix = '', $display = true) {
    284376        global $wpdb;
    285377        $p = get_query_var('p');
     
    298390        }
    299391}
    300392
    301 
     393/**
     394 * single_cat_title() - {@internal Missing Short Description}}
     395 *
     396 * {@internal Missing Long Description}}
     397 *
     398 * @since 0.71
     399 *
     400 * @param unknown_type $prefix
     401 * @param unknown_type $display
     402 * @return unknown
     403 */
    302404function single_cat_title($prefix = '', $display = true ) {
    303405        $cat = intval( get_query_var('cat') );
    304406        if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
     
    314416        }
    315417}
    316418
    317 
     419/**
     420 * single_tag_title() - {@internal Missing Short Description}}
     421 *
     422 * {@internal Missing Long Description}}
     423 *
     424 * @since 2.3.0
     425 *
     426 * @param unknown_type $prefix
     427 * @param unknown_type $display
     428 * @return unknown
     429 */
    318430function single_tag_title($prefix = '', $display = true ) {
    319431        if ( !is_tag() )
    320432                return;
     
    335447        }
    336448}
    337449
    338 
     450/**
     451 * single_month_title() - {@internal Missing Short Description}}
     452 *
     453 * {@internal Missing Long Description}}
     454 *
     455 * @since 0.71
     456 *
     457 * @param unknown_type $prefix
     458 * @param unknown_type $display
     459 * @return unknown
     460 */
    339461function single_month_title($prefix = '', $display = true ) {
    340462        global $wp_locale;
    341463
     
    361483        echo $result;
    362484}
    363485
    364 
    365 /* link navigation hack by Orien http://icecode.com/ */
     486/**
     487 * get_archives_link() - {@internal Missing Short Description}}
     488 *
     489 * {@internal Missing Long Description}}
     490 *
     491 * @since 1.0.0
     492 * @author Orien
     493 * @link http://icecode.com/ link navigation hack by Orien
     494 *
     495 * @param unknown_type $url
     496 * @param unknown_type $text
     497 * @param unknown_type $format
     498 * @param unknown_type $before
     499 * @param unknown_type $after
     500 * @return unknown
     501 */
    366502function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
    367503        $text = wptexturize($text);
    368504        $title_text = attribute_escape($text);
     
    382518        return $link_html;
    383519}
    384520
    385 
     521/**
     522 * wp_get_archives() - {@internal Missing Short Description}}
     523 *
     524 * {@internal Missing Long Description}}
     525 *
     526 * @since 1.2.0
     527 *
     528 * @param unknown_type $args
     529 */
    386530function wp_get_archives($args = '') {
    387531        global $wpdb, $wp_locale;
    388532
     
    548692        }
    549693}
    550694
    551 
    552 // Used in get_calendar
     695/**
     696 * calendar_week_mod() - {@internal Missing Short Description}}
     697 *
     698 * {@internal Missing Long Description}}
     699 *
     700 * @since 1.5.0
     701 * @usedby get_calendar()
     702 *
     703 * @param unknown_type $num
     704 * @return unknown
     705 */
    553706function calendar_week_mod($num) {
    554707        $base = 7;
    555708        return ($num - $base*floor($num/$base));
    556709}
    557710
    558 
     711/**
     712 * get_calendar() - {@internal Missing Short Description}}
     713 *
     714 * {@internal Missing Long Description}}
     715 *
     716 * @since 1.0.0
     717 *
     718 * @param unknown_type $initial
     719 */
    559720function get_calendar($initial = true) {
    560721        global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
    561722
     
    748909        wp_cache_set( 'get_calendar', $cache, 'calendar' );
    749910}
    750911
     912/**
     913 * delete_get_calendar_cache() - {@internal Missing Short Description}}
     914 *
     915 * @since 2.1.0
     916 */
    751917function delete_get_calendar_cache() {
    752918        wp_cache_delete( 'get_calendar', 'calendar' );
    753919}
     
    757923add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
    758924add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
    759925
    760 
     926/**
     927 * allowed_tags() - {@internal Missing Short Description}}
     928 *
     929 * {@internal Missing Long Description}}
     930 *
     931 * @since 1.0.1
     932 * @uses $allowedtags
     933 *
     934 * @return unknown
     935 */
    761936function allowed_tags() {
    762937        global $allowedtags;
    763938        $allowed = '';
     
    773948        return htmlentities($allowed);
    774949}
    775950
    776 
    777951/***** Date/Time tags *****/
    778952
    779 
     953/**
     954 * the_date_xml() - {@internal Missing Short Description}}
     955 *
     956 * {@internal Missing Long Description}}
     957 *
     958 * @since 1.0.0
     959 *
     960 */
    780961function the_date_xml() {
    781962        global $post;
    782963        echo mysql2date('Y-m-d', $post->post_date);
    783964        //echo ""+$post->post_date;
    784965}
    785966
    786 
     967/**
     968 * the_date() - {@internal Missing Short Description}}
     969 *
     970 * {@internal Missing Long Description}}
     971 *
     972 * @since 0.71
     973 *
     974 * @param unknown_type $d
     975 * @param unknown_type $before
     976 * @param unknown_type $after
     977 * @param unknown_type $echo
     978 * @return unknown
     979 */
    787980function the_date($d='', $before='', $after='', $echo = true) {
    788981        global $post, $day, $previousday;
    789982        $the_date = '';
     
    803996                return $the_date;
    804997}
    805998
    806 
     999/**
     1000 * the_modified_date() - {@internal Missing Short Description}}
     1001 *
     1002 * {@internal Missing Long Description}}
     1003 *
     1004 * @since 2.1.0
     1005 *
     1006 * @param unknown_type $d
     1007 */
    8071008function the_modified_date($d = '') {
    8081009        echo apply_filters('the_modified_date', get_the_modified_date($d), $d);
    8091010}
    8101011
    811 
     1012/**
     1013 * get_the_modified_date() - {@internal Missing Short Description}}
     1014 *
     1015 * {@internal Missing Long Description}}
     1016 *
     1017 * @since 2.1.0
     1018 *
     1019 * @param unknown_type $d
     1020 * @return unknown
     1021 */
    8121022function get_the_modified_date($d = '') {
    8131023        if ( '' == $d )
    8141024                $the_time = get_post_modified_time(get_option('date_format'));
     
    8171027        return apply_filters('get_the_modified_date', $the_time, $d);
    8181028}
    8191029
    820 
     1030/**
     1031 * the_time() - {@internal Missing Short Description}}
     1032 *
     1033 * {@internal Missing Long Description}}
     1034 *
     1035 * @since 0.71
     1036 *
     1037 * @param unknown_type $d
     1038 */
    8211039function the_time( $d = '' ) {
    8221040        echo apply_filters('the_time', get_the_time( $d ), $d);
    8231041}
    8241042
    825 
     1043/**
     1044 * get_the_time() - {@internal Missing Short Description}}
     1045 *
     1046 * {@internal Missing Long Description}}
     1047 *
     1048 * @since 1.5.0
     1049 *
     1050 * @param unknown_type $d
     1051 * @return unknown
     1052 */
    8261053function get_the_time( $d = '' ) {
    8271054        if ( '' == $d )
    8281055                $the_time = get_post_time(get_option('time_format'));
     
    8311058        return apply_filters('get_the_time', $the_time, $d);
    8321059}
    8331060
    834 
     1061/**
     1062 * get_post_time() - {@internal Missing Short Description}}
     1063 *
     1064 * {@internal Missing Long Description}}
     1065 *
     1066 * @since 1.5.0
     1067 *
     1068 * @param unknown_type $d
     1069 * @param unknown_type $gmt
     1070 * @return unknown
     1071 */
    8351072function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
    8361073        global $post;
    8371074        if ( $gmt )
     
    8431080        return apply_filters('get_post_time', $time, $d, $gmt);
    8441081}
    8451082
    846 
     1083/**
     1084 * the_modified_time() - {@internal Missing Short Description}}
     1085 *
     1086 * {@internal Missing Long Description}}
     1087 *
     1088 * @since 2.0.0
     1089 *
     1090 * @param unknown_type $d
     1091 */
    8471092function the_modified_time($d = '') {
    8481093        echo apply_filters('the_modified_time', get_the_modified_time($d), $d);
    8491094}
    8501095
    851 
     1096/**
     1097 * get_the_modified_time() - {@internal Missing Short Description}}
     1098 *
     1099 * {@internal Missing Long Description}}
     1100 *
     1101 * @since 2.0.0
     1102 *
     1103 * @param unknown_type $d
     1104 * @return unknown
     1105 */
    8521106function get_the_modified_time($d = '') {
    8531107        if ( '' == $d )
    8541108                $the_time = get_post_modified_time(get_option('time_format'));
     
    8571111        return apply_filters('get_the_modified_time', $the_time, $d);
    8581112}
    8591113
    860 
     1114/**
     1115 * get_post_modified_time() - {@internal Missing Short Description}}
     1116 *
     1117 * {@internal Missing Long Description}}
     1118 *
     1119 * @since 2.0.0
     1120 *
     1121 * @param unknown_type $d
     1122 * @param unknown_type $gmt
     1123 * @return unknown
     1124 */
    8611125function get_post_modified_time( $d = 'U', $gmt = false ) { // returns timestamp
    8621126        global $post;
    8631127
     
    8701134        return apply_filters('get_the_modified_time', $time, $d, $gmt);
    8711135}
    8721136
    873 
     1137/**
     1138 * the_weekday() - {@internal Missing Short Description}}
     1139 *
     1140 * {@internal Missing Long Description}}
     1141 *
     1142 * @since 0.71
     1143 * @uses $wp_locale
     1144 * @uses $post
     1145 */
    8741146function the_weekday() {
    8751147        global $wp_locale, $post;
    8761148        $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date));
     
    8781150        echo $the_weekday;
    8791151}
    8801152
    881 
     1153/**
     1154 * the_weekday_date() - {@internal Missing Short Description}}
     1155 *
     1156 * {@internal Missing Long Description}}
     1157 *
     1158 * @since 0.71
     1159 *
     1160 * @param unknown_type $before
     1161 * @param unknown_type $after
     1162 */
    8821163function the_weekday_date($before='',$after='') {
    8831164        global $wp_locale, $post, $day, $previousweekday;
    8841165        $the_weekday_date = '';
     
    8921173        echo $the_weekday_date;
    8931174}
    8941175
     1176/**
     1177 * wp_head() - {@internal Missing Short Description}}
     1178 *
     1179 * {@internal Missing Long Description}}
     1180 *
     1181 * @since 1.2.0
     1182 * @uses do_action()
     1183 */
    8951184function wp_head() {
    8961185        do_action('wp_head');
    8971186}
    8981187
     1188/**
     1189 * wp_footer() - {@internal Missing Short Description}}
     1190 *
     1191 * {@internal Missing Long Description}}
     1192 *
     1193 * @since 1.5.1
     1194 * @uses do_action()
     1195 */
    8991196function wp_footer() {
    9001197        do_action('wp_footer');
    9011198}
    9021199
     1200/**
     1201 * rsd_link() - {@internal Missing Short Description}}
     1202 *
     1203 * {@internal Missing Long Description}}
     1204 *
     1205 * @since 2.0.0
     1206 *
     1207 */
    9031208function rsd_link() {
    9041209        echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n";
    9051210}
    9061211
     1212/**
     1213 * wlwmanifest_link() - {@internal Missing Short Description}}
     1214 *
     1215 * {@internal Missing Long Description}}
     1216 *
     1217 * @since 2.3.1
     1218 *
     1219 */
    9071220function wlwmanifest_link() {
    9081221        echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="'
    9091222                . get_bloginfo('wpurl') . '/wp-includes/wlwmanifest.xml" /> ' . "\n";
    9101223}
    9111224
     1225/**
     1226 * noindex() - {@internal Missing Short Description}}
     1227 *
     1228 * {@internal Missing Long Description}}
     1229 *
     1230 * @since 2.1.0
     1231 */
    9121232function noindex() {
    9131233        // If the blog is not public, tell robots to go away.
    9141234        if ( '0' == get_option('blog_public') )
    9151235                echo "<meta name='robots' content='noindex,nofollow' />\n";
    9161236}
    9171237
     1238/**
     1239 * rich_edit_exists() - {@internal Missing Short Description}}
     1240 *
     1241 * {@internal Missing Long Description}}
     1242 *
     1243 * @since 2.1.0
     1244 *
     1245 * @return unknown
     1246 */
    9181247function rich_edit_exists() {
    9191248        global $wp_rich_edit_exists;
    9201249        if ( !isset($wp_rich_edit_exists) )
     
    9221251        return $wp_rich_edit_exists;
    9231252}
    9241253
     1254/**
     1255 * user_can_richedit() - {@internal Missing Short Description}}
     1256 *
     1257 * {@internal Missing Long Description}}
     1258 *
     1259 * @since 2.0.0
     1260 *
     1261 * @return unknown
     1262 */
    9251263function user_can_richedit() {
    9261264        global $wp_rich_edit, $pagenow;
    9271265
     
    9391277        return apply_filters('user_can_richedit', $wp_rich_edit);
    9401278}
    9411279
     1280/**
     1281 * wp_default_editor() - {@internal Missing Short Description}}
     1282 *
     1283 * {@internal Missing Long Description}}
     1284 *
     1285 * @since 2.5.0
     1286 *
     1287 * @return string Either 'tinymce', or 'html', or 'test'
     1288 */
    9421289function wp_default_editor() {
    9431290        $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
    9441291        if ( $user = wp_get_current_user() ) { // look for cookie
     
    9481295        return apply_filters( 'wp_default_editor', $r ); // filter
    9491296}
    9501297
     1298/**
     1299 * the_editor() - {@internal Missing Short Description}}
     1300 *
     1301 * {@internal Missing Long Description}}
     1302 *
     1303 * @since 2.1.0
     1304 *
     1305 * @param unknown_type $content
     1306 * @param unknown_type $id
     1307 * @param unknown_type $prev_id
     1308 */
    9511309function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2) {
    9521310        $rows = get_option('default_post_edit_rows');
    9531311        if (($rows < 3) || ($rows > 100))
     
    10141372        <?php
    10151373}
    10161374
     1375/**
     1376 * get_search_query() - {@internal Missing Short Description}}
     1377 *
     1378 * {@internal Missing Long Description}}
     1379 *
     1380 * @since 2.3.0
     1381 *
     1382 * @return unknown
     1383 */
    10171384function get_search_query() {
    10181385        return apply_filters( 'get_search_query', stripslashes( get_query_var( 's' ) ) );
    10191386}
    10201387
     1388/**
     1389 * the_search_query() - {@internal Missing Short Description}}
     1390 *
     1391 * {@internal Missing Long Description}}
     1392 *
     1393 * @since 2.1.0
     1394 *
     1395 */
    10211396function the_search_query() {
    10221397        echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) );
    10231398}
    10241399
     1400/**
     1401 * language_attributes() - {@internal Missing Short Description}}
     1402 *
     1403 * {@internal Missing Long Description}}
     1404 *
     1405 * @since 2.1.0
     1406 *
     1407 * @param unknown_type $doctype
     1408 */
    10251409function language_attributes($doctype = 'html') {
    10261410        $attributes = array();
    10271411        $output = '';
     
    10421426        echo $output;
    10431427}
    10441428
     1429/**
     1430 * paginate_links() - {@internal Missing Short Description}}
     1431 *
     1432 * {@internal Missing Long Description}}
     1433 *
     1434 * @since 2.1.0
     1435 *
     1436 * @param unknown_type $args
     1437 * @return unknown
     1438 */
    10451439function paginate_links( $args = '' ) {
    10461440        $defaults = array(
    10471441                'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
     
    11361530 *
    11371531 * @see WP_Styles::_css_href and its style_loader_src filter.
    11381532 *
     1533 * @since 2.3.0
     1534 *
     1535 *
    11391536 * @param string $file file relative to wp-admin/ without its ".css" extension.
    11401537 */
    11411538
     
    11931590}
    11941591
    11951592/**
    1196  * Enqueues the default ThickBox js and css.
     1593 * wp_generator() - Outputs the XHTML generator that is generated on the wp_head hook.
     1594 *
     1595 * {@internal Missing Long Description}}
     1596 *
     1597 * @since 2.5.0
     1598 * @uses apply_filters()
     1599 * Enqueues the default ThickBox js and css.
    11971600 * If any of the settings need to be changed, this can be done with another js file
    11981601 * similar to media-upload.js and theme-preview.js. That file should require array('thickbox')
    11991602 * to ensure it is loaded after.
     
    12061609/**
    12071610 * Outputs the XHTML generator that is generated on the wp_head hook.
    12081611 */
    1209 function wp_generator()
    1210 {
     1612function wp_generator() {
    12111613        the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
    12121614}
    12131615
    12141616/**
    1215  * Outputs the generator XML or Comment for RSS, ATOM, etc.
    1216  * @param {String} $type The type of generator to return.
     1617 * the_generator() - Outputs the generator XML or Comment for RSS, ATOM, etc.
     1618 *
     1619 * {@internal Missing Long Description}}
     1620 *
     1621 * @since 2.5
     1622 * @uses apply_filters()
     1623 *
     1624 * @param string $type The type of generator to return.
    12171625 */
    1218 function the_generator ( $type ) {
    1219         echo apply_filters('the_generator',get_the_generator($type),$type) . "\n";
     1626function the_generator( $type ) {
     1627        echo apply_filters('the_generator', get_the_generator($type), $type) . "\n";
    12201628}
    12211629
    12221630/**
    1223  * Creates the generator XML or Comment for RSS, ATOM, etc.
    1224  * @param {String} $type The type of generator to return.
     1631 * get_the_generator() - Creates the generator XML or Comment for RSS, ATOM, etc.
     1632 *
     1633 * {@internal Missing Long Description}}
     1634 *
     1635 * @since 2.5
     1636 * @uses apply_filters()
     1637 *
     1638 * @param string $type The type of generator to return.
    12251639 */
    1226 function get_the_generator ( $type ) {
     1640function get_the_generator( $type ) {
    12271641        switch ($type) {
    12281642                case 'html':
    12291643                        $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">' . "\n";
     
    12491663        }
    12501664        return apply_filters( "get_the_generator_{$type}", $gen, $type );
    12511665}
     1666
    12521667?>