Add access modifier to methods/members in `WP_Ajax_Response`. Adds a magic `__get()` method for BC.
See #27881, #22234. Built from https://develop.svn.wordpress.org/trunk@28508 git-svn-id: http://core.svn.wordpress.org/trunk@28334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
27e8d17be2
commit
4938497b3a
|
@ -13,7 +13,7 @@ class WP_Ajax_Response {
|
||||||
* @var array
|
* @var array
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
var $responses = array();
|
private $responses = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor - Passes args to {@link WP_Ajax_Response::add()}.
|
* Constructor - Passes args to {@link WP_Ajax_Response::add()}.
|
||||||
|
@ -24,11 +24,22 @@ class WP_Ajax_Response {
|
||||||
* @param string|array $args Optional. Will be passed to add() method.
|
* @param string|array $args Optional. Will be passed to add() method.
|
||||||
* @return WP_Ajax_Response
|
* @return WP_Ajax_Response
|
||||||
*/
|
*/
|
||||||
function __construct( $args = '' ) {
|
public function __construct( $args = '' ) {
|
||||||
if ( !empty($args) )
|
if ( !empty($args) )
|
||||||
$this->add($args);
|
$this->add($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make private properties readable for backwards compatibility
|
||||||
|
*
|
||||||
|
* @since 4.0.0
|
||||||
|
* @param string $name
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function __get( $name ) {
|
||||||
|
return $this->$name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append to XML response based on given arguments.
|
* Append to XML response based on given arguments.
|
||||||
*
|
*
|
||||||
|
@ -52,7 +63,7 @@ class WP_Ajax_Response {
|
||||||
* @param string|array $args Override defaults.
|
* @param string|array $args Override defaults.
|
||||||
* @return string XML response.
|
* @return string XML response.
|
||||||
*/
|
*/
|
||||||
function add( $args = '' ) {
|
public function add( $args = '' ) {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'what' => 'object', 'action' => false,
|
'what' => 'object', 'action' => false,
|
||||||
'id' => '0', 'old_id' => false,
|
'id' => '0', 'old_id' => false,
|
||||||
|
@ -133,7 +144,7 @@ class WP_Ajax_Response {
|
||||||
*
|
*
|
||||||
* @since 2.1.0
|
* @since 2.1.0
|
||||||
*/
|
*/
|
||||||
function send() {
|
public function send() {
|
||||||
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
|
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
|
||||||
echo "<?xml version='1.0' encoding='" . get_option( 'blog_charset' ) . "' standalone='yes'?><wp_ajax>";
|
echo "<?xml version='1.0' encoding='" . get_option( 'blog_charset' ) . "' standalone='yes'?><wp_ajax>";
|
||||||
foreach ( (array) $this->responses as $response )
|
foreach ( (array) $this->responses as $response )
|
||||||
|
|
Loading…
Reference in New Issue