WordPress.org

Make WordPress Core

Changeset 28508


Ignore:
Timestamp:
05/19/2014 05:40:11 AM (7 years ago)
Author:
wonderboymusic
Message:

Add access modifier to methods/members in WP_Ajax_Response. Adds a magic __get() method for BC.

See #27881, #22234.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-ajax-response.php

    r28430 r28508  
    1414     * @access private
    1515     */
    16     var $responses = array();
     16    private $responses = array();
    1717
    1818    /**
     
    2525     * @return WP_Ajax_Response
    2626     */
    27     function __construct( $args = '' ) {
     27    public function __construct( $args = '' ) {
    2828        if ( !empty($args) )
    2929            $this->add($args);
     30    }
     31
     32    /**
     33     * Make private properties readable for backwards compatibility
     34     *
     35     * @since 4.0.0
     36     * @param string $name
     37     * @return mixed
     38     */
     39    public function __get( $name ) {
     40        return $this->$name;
    3041    }
    3142
     
    5364     * @return string XML response.
    5465     */
    55     function add( $args = '' ) {
     66    public function add( $args = '' ) {
    5667        $defaults = array(
    5768            'what' => 'object', 'action' => false,
     
    134145     * @since 2.1.0
    135146     */
    136     function send() {
     147    public function send() {
    137148        header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
    138149        echo "<?xml version='1.0' encoding='" . get_option( 'blog_charset' ) . "' standalone='yes'?><wp_ajax>";
Note: See TracChangeset for help on using the changeset viewer.