Make WordPress Core

Ticket #25377: 25377.diff

File 25377.diff, 3.2 KB (added by kpdesign, 13 years ago)

Functional docs improvements for wp-trackback.php

  • src/wp-trackback.php

     
    11<?php
    22/**
    3  * Handle Trackbacks and Pingbacks sent to WordPress
     3 * Handle Trackbacks and Pingbacks Sent to WordPress
    44 *
     5 * @since 0.71
     6 *
    57 * @package WordPress
     8 * @subpackage Trackbacks
    69 */
    710
    811if (empty($wp)) {
    … …  
    1114}
    1215
    1316/**
    14  * trackback_response() - Respond with an error or success XML message
     17 * Response to a trackback.
    1518 *
    16  * @param int|bool $error Whether there was an error
    17  * @param string $error_message Error message if an error occurred
     19 * Responds with an error or success XML message.
     20 *
     21 * @since 0.71
     22 *
     23 * @param int|bool $error              Whether there was an error.
     24 *                                              Default '0'. Accepts '0' or '1'.
     25 * @param string    $error_message Error message if an error occurred.
    1826 */
    1927function trackback_response($error = 0, $error_message = '') {
    2028        header('Content-Type: text/xml; charset=' . get_option('blog_charset') );
    … …  
    3341        }
    3442}
    3543
    36 // trackback is done by a POST
     44// Trackback is done by a POST.
    3745$request_array = 'HTTP_POST_VARS';
    3846
    3947if ( !isset($_GET['tb_id']) || !$_GET['tb_id'] ) {
    … …  
    4452$tb_url  = isset($_POST['url'])     ? $_POST['url']     : '';
    4553$charset = isset($_POST['charset']) ? $_POST['charset'] : '';
    4654
    47 // These three are stripslashed here so that they can be properly escaped after mb_convert_encoding()
     55// These three are stripslashed here so they can be properly escaped after mb_convert_encoding().
    4856$title     = isset($_POST['title'])     ? wp_unslash($_POST['title'])      : '';
    4957$excerpt   = isset($_POST['excerpt'])   ? wp_unslash($_POST['excerpt'])    : '';
    5058$blog_name = isset($_POST['blog_name']) ? wp_unslash($_POST['blog_name'])  : '';
    … …  
    5462else
    5563        $charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS';
    5664
    57 // No valid uses for UTF-7
     65// No valid uses for UTF-7.
    5866if ( false !== strpos($charset, 'UTF-7') )
    5967        die;
    6068
    61 if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
     69if ( function_exists('mb_convert_encoding') ) { // For international trackbacks.
    6270        $title     = mb_convert_encoding($title, get_option('blog_charset'), $charset);
    6371        $excerpt   = mb_convert_encoding($excerpt, get_option('blog_charset'), $charset);
    6472        $blog_name = mb_convert_encoding($blog_name, get_option('blog_charset'), $charset);
    6573}
    6674
    67 // Now that mb_convert_encoding() has been given a swing, we need to escape these three
     75// Now that mb_convert_encoding() has been given a swing, we need to escape these three.
    6876$title     = wp_slash($title);
    6977$excerpt   = wp_slash($excerpt);
    7078$blog_name = wp_slash($blog_name);
    … …  
    7684        trackback_response(1, 'I really need an ID for this to work.');
    7785
    7886if (empty($title) && empty($tb_url) && empty($blog_name)) {
    79         // If it doesn't look like a trackback at all...
     87        // If it doesn't look like a trackback at all.
    8088        wp_redirect(get_permalink($tb_id));
    8189        exit;
    8290}
    … …  
    110118         * Fires after a trackback is added to a post.
    111119         *
    112120         * @since 1.2.0
     121         *
    113122         * @param int $trackback_id Trackback ID.
    114123         */
    115124        do_action( 'trackback_post', $trackback_id );