Make WordPress Core

Changeset 8246


Ignore:
Timestamp:
07/03/2008 03:23:22 PM (17 years ago)
Author:
ryan
Message:

phpdoc for feed.php from jacobsantos. fixes #5636

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/feed.php

    r7244 r8246  
    11<?php
    2 
     2/**
     3 * WordPress Feed API
     4 *
     5 * Many of the functions used in here belong in The Loop, or The Loop for the
     6 * Feeds.
     7 *
     8 * @package WordPress
     9 * @subpackage Feed
     10 */
     11
     12/**
     13 * RSS container for the bloginfo function.
     14 *
     15 * You can retrieve anything that you can using the get_bloginfo() function.
     16 * Everything will be stripped of tags and characters converted, when the values
     17 * are retrieved for use in the feeds.
     18 *
     19 * @package WordPress
     20 * @subpackage Feed
     21 * @since 1.5.1
     22 * @uses apply_filters() Calls 'get_bloginfo_rss' hook with two parameters.
     23 * @see get_bloginfo() For the list of possible values to display.
     24 *
     25 * @param string $show See get_bloginfo() for possible values.
     26 * @return string
     27 */
    328function get_bloginfo_rss($show = '') {
    429    $info = strip_tags(get_bloginfo($show));
     
    631}
    732
     33/**
     34 * Display RSS container for the bloginfo function.
     35 *
     36 * You can retrieve anything that you can using the get_bloginfo() function.
     37 * Everything will be stripped of tags and characters converted, when the values
     38 * are retrieved for use in the feeds.
     39 *
     40 * @package WordPress
     41 * @subpackage Feed
     42 * @since 0.71
     43 * @uses apply_filters() Calls 'bloginfo_rss' hook with two parameters.
     44 * @see get_bloginfo() For the list of possible values to display.
     45 *
     46 * @param string $show See get_bloginfo() for possible values.
     47 */
    848function bloginfo_rss($show = '') {
    949    echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show);
    1050}
    1151
     52/**
     53 * Retrieve the default feed.
     54 *
     55 * The default feed is 'rss2', unless a plugin changes it through the
     56 * 'default_feed' filter.
     57 *
     58 * @package WordPress
     59 * @subpackage Feed
     60 * @since 2.5
     61 * @uses apply_filters() Calls 'default_feed' hook on the default feed string.
     62 *
     63 * @return string Default feed, or for example 'rss2', 'atom', etc.
     64 */
    1265function get_default_feed() {
    1366    return apply_filters('default_feed', 'rss2');
    1467}
    1568
     69/**
     70 * Retrieve the blog title for the feed title.
     71 *
     72 * @package WordPress
     73 * @subpackage Feed
     74 * @since 2.2.0
     75 * @uses apply_filters() Calls 'get_wp_title_rss' hook on title.
     76 * @uses wp_title() See function for $sep parameter usage.
     77 *
     78 * @param string $sep Optional.How to separate the title. See wp_title() for more info.
     79 * @return string Error message on failure or blog title on success.
     80 */
    1681function get_wp_title_rss($sep = '&#187;') {
    1782    $title = wp_title($sep, false);
     
    2287}
    2388
     89/**
     90 * Display the blog title for display of the feed title.
     91 *
     92 * @package WordPress
     93 * @subpackage Feed
     94 * @since 2.2.0
     95 * @uses apply_filters() Calls 'wp_title_rss' on the blog title.
     96 * @see wp_title() $sep parameter usage.
     97 *
     98 * @param string $sep Optional.
     99 */
    24100function wp_title_rss($sep = '&#187;') {
    25101    echo apply_filters('wp_title_rss', get_wp_title_rss($sep));
    26102}
    27103
     104/**
     105 * Retrieve the current post title for the feed.
     106 *
     107 * @package WordPress
     108 * @subpackage Feed
     109 * @since 2.0.0
     110 * @uses apply_filters() Calls 'the_title_rss' on the post title.
     111 *
     112 * @return string Current post title.
     113 */
    28114function get_the_title_rss() {
    29115    $title = get_the_title();
     
    32118}
    33119
    34 
     120/**
     121 * Display the post title in the feed.
     122 *
     123 * @package WordPress
     124 * @subpackage Feed
     125 * @since 0.71
     126 * @uses get_the_title_rss() Used to retrieve current post title.
     127 */
    35128function the_title_rss() {
    36129    echo get_the_title_rss();
    37130}
    38131
    39 
     132/**
     133 * Display the post content for the feed.
     134 *
     135 * For encoding the html or the $encode_html parameter, there are three possible
     136 * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
     137 * encode special characters and automatically display all of the content. The
     138 * value of '2' will strip all HTML tags from the content.
     139 *
     140 * Also note that you cannot set the amount of words and not set the html
     141 * encoding. If that is the case, then the html encoding will default to 2,
     142 * which will strip all HTML tags.
     143 *
     144 * To restrict the amount of words of the content, you can use the cut
     145 * parameter. If the content is less than the amount, then there won't be any
     146 * dots added to the end. If there is content left over, then dots will be added
     147 * and the rest of the content will be removed.
     148 *
     149 * @package WordPress
     150 * @subpackage Feed
     151 * @since 0.71
     152 * @uses apply_filters() Calls 'the_content_rss' on the content before processing.
     153 * @see get_the_content() For the $more_link_text, $stripteaser, and $more_file
     154 *      parameters.
     155 *
     156 * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
     157 * @param int|bool $stripteaser Optional. Default is 0.
     158 * @param string $more_file Optional.
     159 * @param int $cut Optional. Amount of words to keep for the content.
     160 * @param int $encode_html Optional. How to encode the content.
     161 */
    40162function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
    41163    $content = get_the_content($more_link_text, $stripteaser, $more_file);
     
    60182            $use_dotdotdot = 0;
    61183        }
     184
     185        /** @todo Check performance, might be faster to use array slice instead. */
    62186        for ( $i=0; $i<$k; $i++ )
    63187            $excerpt .= $blah[$i].' ';
     
    69193}
    70194
    71 
     195/**
     196 * Display the post excerpt for the feed.
     197 *
     198 * @package WordPress
     199 * @subpackage Feed
     200 * @since 0.71
     201 * @uses apply_filters() Calls 'the_excerpt_rss' hook on the excerpt.
     202 */
    72203function the_excerpt_rss() {
    73204    $output = get_the_excerpt();
     
    75206}
    76207
     208/**
     209 * Display the permalink to the post for use in feeds.
     210 *
     211 * @package WordPress
     212 * @subpackage Feed
     213 * @since 2.3.0
     214 * @uses apply_filters() Call 'the_permalink_rss' on the post permalink
     215 */
    77216function the_permalink_rss() {
    78217    echo apply_filters('the_permalink_rss', get_permalink());
    79 
    80 }
    81 
     218}
     219
     220/**
     221 * Display the feed GUID for the current comment.
     222 *
     223 * @package WordPress
     224 * @subpackage Feed
     225 * @since unknown
     226 */
    82227function comment_guid() {
    83228    echo get_comment_guid();
    84229}
    85230
     231/**
     232 * Retrieve the feed GUID for the current comment.
     233 *
     234 * @package WordPress
     235 * @subpackage Feed
     236 * @since unknown
     237 *
     238 * @return bool|string false on failure or guid for comment on success.
     239 */
    86240function get_comment_guid() {
    87241    global $comment;
     
    93247}
    94248
     249/**
     250 * Display the link to the comments.
     251 *
     252 * @since 1.5.0
     253 */
    95254function comment_link() {
    96255    echo get_comment_link();
    97256}
    98257
     258/**
     259 * Retrieve the current comment author for use in the feeds.
     260 *
     261 * @package WordPress
     262 * @subpackage Feed
     263 * @since 2.0.0
     264 * @uses apply_filters() Calls 'comment_author_rss' hook on comment author.
     265 * @uses get_comment_author()
     266 *
     267 * @return string Comment Author
     268 */
    99269function get_comment_author_rss() {
    100270    return apply_filters('comment_author_rss', get_comment_author() );
    101271}
    102272
     273/**
     274 * Display the current comment author in the feed.
     275 *
     276 * @package WordPress
     277 * @subpackage Feed
     278 * @since 1.0.0
     279 */
    103280function comment_author_rss() {
    104281    echo get_comment_author_rss();
    105282}
    106283
     284/**
     285 * Display the current comment content for use in the feeds.
     286 *
     287 * @package WordPress
     288 * @subpackage Feed
     289 * @since 1.0.0
     290 * @uses apply_filters() Calls 'comment_text_rss' filter on comment content.
     291 * @uses get_comment_text()
     292 */
    107293function comment_text_rss() {
    108294    $comment_text = get_comment_text();
     
    111297}
    112298
     299/**
     300 * Retrieve all of the post categories, formatted for use in feeds.
     301 *
     302 * All of the categories for the current post in the feed loop, will be
     303 * retrieved and have feed markup added, so that they can easily be added to the
     304 * RSS2, Atom, or RSS1 and RSS0.91 RDF feeds.
     305 *
     306 * @package WordPress
     307 * @subpackage Feed
     308 * @since 2.1.0
     309 * @uses apply_filters()
     310 *
     311 * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
     312 * @return string All of the post categories for displaying in the feed.
     313 */
    113314function get_the_category_rss($type = 'rss') {
    114315    $categories = get_the_category();
     
    143344}
    144345
     346/**
     347 * Display the post categories in the feed.
     348 *
     349 * @package WordPress
     350 * @subpackage Feed
     351 * @since 0.71
     352 * @see get_the_category_rss() For better explanation.
     353 *
     354 * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
     355 */
    145356function the_category_rss($type = 'rss') {
    146357    echo get_the_category_rss($type);
    147358}
    148359
     360/**
     361 * Display the HTML type based on the blog setting.
     362 *
     363 * The two possible values are either 'xhtml' or 'html'.
     364 *
     365 * @package WordPress
     366 * @subpackage Feed
     367 * @since 2.2.0
     368 */
    149369function html_type_rss() {
    150370    $type = get_bloginfo('html_type');
     
    156376}
    157377
    158 
     378/**
     379 * Display the rss enclosure for the current post.
     380 *
     381 * Uses the global $post to check whether the post requires a password and if
     382 * the user has the password for the post. If not then it will return before
     383 * displaying.
     384 *
     385 * Also uses the function get_post_custom() to get the post's 'enclosure'
     386 * metadata field and parses the value to display the enclosure(s). The
     387 * enclosure(s) consist of enclosure HTML tag(s) with a URI and other
     388 * attributes.
     389 *
     390 * @package WordPress
     391 * @subpackage Template
     392 * @since 1.5.0
     393 * @uses apply_filters() Calls 'rss_enclosure' hook on rss enclosure.
     394 * @uses get_post_custom() To get the current post enclosure metadata.
     395 */
    159396function rss_enclosure() {
    160397    global $post;
     
    172409}
    173410
     411/**
     412 * Display the atom enclosure for the current post.
     413 *
     414 * Uses the global $post to check whether the post requires a password and if
     415 * the user has the password for the post. If not then it will return before
     416 * displaying.
     417 *
     418 * Also uses the function get_post_custom() to get the post's 'enclosure'
     419 * metadata field and parses the value to display the enclosure(s). The
     420 * enclosure(s) consist of link HTML tag(s) with a URI and other attributes.
     421 *
     422 * @package WordPress
     423 * @subpackage Template
     424 * @since 2.2.0
     425 * @uses apply_filters() Calls 'atom_enclosure' hook on atom enclosure.
     426 * @uses get_post_custom() To get the current post enclosure metadata.
     427 */
    174428function atom_enclosure() {
    175429    global $post;
     
    188442
    189443/**
    190  * prep_atom_text_construct() - Determine the type of a given string of data
     444 * Determine the type of a string of data with the data formatted.
    191445 *
    192446 * Tell whether the type is text, html, or xhtml, per RFC 4287 section 3.1.
     
    203457 * @since 2.5
    204458 *
    205  * @param string $data input string
    206  * @return array $result array(type, value)
     459 * @param string $data Input string
     460 * @return array array(type, value)
    207461 */
    208462function prep_atom_text_construct($data) {
     
    233487
    234488/**
    235  * self_link() - Generate a correct link for the atom:self elemet
    236  *
    237  * Echo the link for the currently displayed feed in a XSS safe way.
     489 * Display the link for the currently displayed feed in a XSS safe way.
     490 *
     491 * Generate a correct link for the atom:self element.
    238492 *
    239493 * @package WordPress
    240494 * @subpackage Feed
    241495 * @since 2.5
    242  *
    243496 */
    244497function self_link() {
Note: See TracChangeset for help on using the changeset viewer.