WordPress.org

Make WordPress Core

Ticket #16303: 16303.ep-docs.diff

File 16303.ep-docs.diff, 2.5 KB (added by duck_, 2 years ago)
  • wp-includes/rewrite.php

     
    202202/** 
    203203 * Add an endpoint, like /trackback/. 
    204204 * 
    205  * The endpoints are added to the end of the request. So a request matching 
    206  * "/2008/10/14/my_post/myep/", the endpoint will be "/myep/". 
     205 * Adding an endpoint creates extra rewrite rules for each of the matching 
     206 * places specified by the provided bitmask. For example: 
    207207 * 
    208  * Be sure to flush the rewrite rules (wp_rewrite->flush_rules()) when your plugin gets 
    209  * activated (register_activation_hook()) and deactivated (register_deactivation_hook()) 
     208 * <code> 
     209 * add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES ); 
     210 * </code> 
    210211 * 
     212 * will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct 
     213 * that describes a permalink (post) or page. This is rewritten to "json=$match" 
     214 * where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in 
     215 * "<permalink>/json/foo/"). 
     216 * 
     217 * A new query var with the same name as the endpoint will also be created. 
     218 * 
     219 * Be sure to flush the rewrite rules - flush_rewrite_rules() - when your plugin gets 
     220 * activated and deactivated. 
     221 * 
    211222 * @since 2.1.0 
    212  * @see WP_Rewrite::add_endpoint() Parameters and more description. 
    213  * @uses $wp_rewrite 
     223 * @see WP_Rewrite::add_endpoint() 
     224 * @global object $wp_rewrite 
    214225 * 
    215  * @param unknown_type $name 
    216  * @param unknown_type $places 
     226 * @param string $name Name of the endpoint. 
     227 * @param int $places Endpoint mask describing the places the endpoint should be added. 
    217228 */ 
    218 function add_rewrite_endpoint($name, $places) { 
     229function add_rewrite_endpoint( $name, $places ) { 
    219230        global $wp_rewrite; 
    220         $wp_rewrite->add_endpoint($name, $places); 
     231        $wp_rewrite->add_endpoint( $name, $places ); 
    221232} 
    222233 
    223234/** 
     
    18021813        /** 
    18031814         * Add an endpoint, like /trackback/. 
    18041815         * 
    1805          * To be inserted after certain URL types (specified in $places). 
     1816         * See {@link add_rewrite_endpoint()} for full documentation. 
    18061817         * 
     1818         * @see add_rewrite_endpoint() 
    18071819         * @since 2.1.0 
    18081820         * @access public 
     1821         * @uses WP::add_query_var() 
    18091822         * 
    1810          * @param string $name Name of endpoint. 
    1811          * @param array $places URL types that endpoint can be used. 
     1823         * @param string $name Name of the endpoint. 
     1824         * @param int $places Endpoint mask describing the places the endpoint should be added. 
    18121825         */ 
    18131826        function add_endpoint($name, $places) { 
    18141827                global $wp;