Fix syntax and add missing @access tags to a variety of methods and properties in WP_Customize_Nav_Menu_Item_Setting added in 4.3.

See [32806]. See #32891.


git-svn-id: https://develop.svn.wordpress.org/trunk@33221 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Drew Jaynes 2015-07-13 21:00:29 +00:00
parent 7dc6a749b6
commit d762023715

View File

@ -639,7 +639,6 @@ final class WP_Customize_Background_Image_Setting extends WP_Customize_Setting {
* *
* @since 4.3.0 * @since 4.3.0
* *
* @see wp_get_nav_menu_items()
* @see WP_Customize_Setting * @see WP_Customize_Setting
*/ */
class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting { class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
@ -654,7 +653,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Setting type. * Setting type.
* *
* @since 4.3.0 * @since 4.3.0
* * @access public
* @var string * @var string
*/ */
public $type = self::TYPE; public $type = self::TYPE;
@ -663,9 +662,10 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Default setting value. * Default setting value.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @var array
* *
* @see wp_setup_nav_menu_item() * @see wp_setup_nav_menu_item()
* @var array
*/ */
public $default = array( public $default = array(
// The $menu_item_data for wp_update_nav_menu_item(). // The $menu_item_data for wp_update_nav_menu_item().
@ -691,7 +691,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Default transport. * Default transport.
* *
* @since 4.3.0 * @since 4.3.0
* * @access public
* @var string * @var string
*/ */
public $transport = 'postMessage'; public $transport = 'postMessage';
@ -704,7 +704,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* @todo Should this be $db_id, and also use this for WP_Customize_Nav_Menu_Setting::$term_id * @todo Should this be $db_id, and also use this for WP_Customize_Nav_Menu_Setting::$term_id
* *
* @since 4.3.0 * @since 4.3.0
* * @access public
* @var int * @var int
*/ */
public $post_id; public $post_id;
@ -718,11 +718,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* a real post. * a real post.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @var int
* *
* @see WP_Customize_Nav_Menu_Item_Setting::update() * @see WP_Customize_Nav_Menu_Item_Setting::update()
* @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response() * @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response()
*
* @var int
*/ */
public $previous_post_id; public $previous_post_id;
@ -731,7 +731,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* which ensures that we can apply the proper filters. * which ensures that we can apply the proper filters.
* *
* @since 4.3.0 * @since 4.3.0
* * @access public
* @var int * @var int
*/ */
public $original_nav_menu_term_id; public $original_nav_menu_term_id;
@ -740,7 +740,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Whether or not preview() was called. * Whether or not preview() was called.
* *
* @since 4.3.0 * @since 4.3.0
* * @access protected
* @var bool * @var bool
*/ */
protected $is_previewed = false; protected $is_previewed = false;
@ -749,7 +749,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Whether or not update() was called. * Whether or not update() was called.
* *
* @since 4.3.0 * @since 4.3.0
* * @access protected
* @var bool * @var bool
*/ */
protected $is_updated = false; protected $is_updated = false;
@ -761,11 +761,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* When status is error, the error is stored in $update_error. * When status is error, the error is stored in $update_error.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @var string updated|inserted|deleted|error
* *
* @see WP_Customize_Nav_Menu_Item_Setting::update() * @see WP_Customize_Nav_Menu_Item_Setting::update()
* @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response() * @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response()
*
* @var string updated|inserted|deleted|error
*/ */
public $update_status; public $update_status;
@ -773,11 +773,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Any error object returned by wp_update_nav_menu_item() when setting is updated. * Any error object returned by wp_update_nav_menu_item() when setting is updated.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @var WP_Error
* *
* @see WP_Customize_Nav_Menu_Item_Setting::update() * @see WP_Customize_Nav_Menu_Item_Setting::update()
* @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response() * @see WP_Customize_Nav_Menu_Item_Setting::amend_customize_save_response()
*
* @var WP_Error
*/ */
public $update_error; public $update_error;
@ -787,11 +787,13 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Any supplied $args override class property defaults. * Any supplied $args override class property defaults.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @param WP_Customize_Manager $manager Manager instance. * @param WP_Customize_Manager $manager Bootstrap Customizer instance.
* @param string $id An specific ID of the setting. Can be a * @param string $id An specific ID of the setting. Can be a
* theme mod or option name. * theme mod or option name.
* @param array $args Optional. Setting arguments. * @param array $args Optional. Setting arguments.
*
* @throws Exception If $id is not valid for this setting type. * @throws Exception If $id is not valid for this setting type.
*/ */
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) { public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
@ -815,10 +817,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Get the instance data for a given widget setting. * Get the instance data for a given widget setting.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see wp_setup_nav_menu_item() * @see wp_setup_nav_menu_item()
* *
* @return array * @return array Instance data.
*/ */
public function value() { public function value() {
if ( $this->is_previewed && $this->_previewed_blog_id === get_current_blog_id() ) { if ( $this->is_previewed && $this->_previewed_blog_id === get_current_blog_id() ) {
@ -889,6 +892,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Handle previewing the setting. * Handle previewing the setting.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see WP_Customize_Manager::post_value() * @see WP_Customize_Manager::post_value()
*/ */
@ -916,6 +920,7 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Filter the wp_get_nav_menu_items() result to supply the previewed menu items. * Filter the wp_get_nav_menu_items() result to supply the previewed menu items.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see wp_get_nav_menu_items() * @see wp_get_nav_menu_items()
* *
@ -987,6 +992,8 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Re-apply the tail logic also applied on $items by wp_get_nav_menu_items(). * Re-apply the tail logic also applied on $items by wp_get_nav_menu_items().
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @static
* *
* @see wp_get_nav_menu_items() * @see wp_get_nav_menu_items()
* *
@ -1021,8 +1028,9 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Get the value emulated into a WP_Post and set up as a nav_menu_item. * Get the value emulated into a WP_Post and set up as a nav_menu_item.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @return WP_Post With {@see wp_setup_nav_menu_item()} applied. * @return WP_Post With wp_setup_nav_menu_item() applied.
*/ */
public function value_as_wp_post_nav_menu_item() { public function value_as_wp_post_nav_menu_item() {
$item = (object) $this->value(); $item = (object) $this->value();
@ -1055,9 +1063,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* we remove that in this override. * we remove that in this override.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @param array $menu_item_value The value to sanitize. * @param array $menu_item_value The value to sanitize.
* @return array|false|null Null if an input isn't valid. False if it is marked for deletion. Otherwise the sanitized value. * @return array|false|null Null if an input isn't valid. False if it is marked for deletion.
* Otherwise the sanitized value.
*/ */
public function sanitize( $menu_item_value ) { public function sanitize( $menu_item_value ) {
// Menu is marked for deletion. // Menu is marked for deletion.
@ -1132,13 +1142,14 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* To delete a menu, the client can send false as the value. * To delete a menu, the client can send false as the value.
* *
* @since 4.3.0 * @since 4.3.0
* @access protected
* *
* @see wp_update_nav_menu_item() * @see wp_update_nav_menu_item()
* *
* @param array|false $value The menu item array to update. If false, then the menu item will be deleted entirely. * @param array|false $value The menu item array to update. If false, then the menu item will be deleted
* See {@see WP_Customize_Nav_Menu_Item_Setting::$default} for what the value should * entirely. See WP_Customize_Nav_Menu_Item_Setting::$default for what the value
* consist of. * should consist of.
* @return void * @return null|void
*/ */
protected function update( $value ) { protected function update( $value ) {
if ( $this->is_updated ) { if ( $this->is_updated ) {
@ -1263,11 +1274,12 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
* Export data for the JS client. * Export data for the JS client.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see WP_Customize_Nav_Menu_Item_Setting::update() * @see WP_Customize_Nav_Menu_Item_Setting::update()
* *
* @param array $data Additional information passed back to the 'saved' event on `wp.customize`. * @param array $data Additional information passed back to the 'saved' event on `wp.customize`.
* @return array * @return array Save response data.
*/ */
public function amend_customize_save_response( $data ) { public function amend_customize_save_response( $data ) {
if ( ! isset( $data['nav_menu_item_updates'] ) ) { if ( ! isset( $data['nav_menu_item_updates'] ) ) {
@ -1280,7 +1292,6 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
'error' => $this->update_error ? $this->update_error->get_error_code() : null, 'error' => $this->update_error ? $this->update_error->get_error_code() : null,
'status' => $this->update_status, 'status' => $this->update_status,
); );
return $data; return $data;
} }
} }
@ -1308,7 +1319,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Setting type. * Setting type.
* *
* @since 4.3.0 * @since 4.3.0
* * @access public
* @var string * @var string
*/ */
public $type = self::TYPE; public $type = self::TYPE;
@ -1317,10 +1328,10 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Default setting value. * Default setting value.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @var array
* *
* @see wp_get_nav_menu_object() * @see wp_get_nav_menu_object()
*
* @var array
*/ */
public $default = array( public $default = array(
'name' => '', 'name' => '',
@ -1333,7 +1344,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Default transport. * Default transport.
* *
* @since 4.3.0 * @since 4.3.0
* * @access public
* @var string * @var string
*/ */
public $transport = 'postMessage'; public $transport = 'postMessage';
@ -1344,7 +1355,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* A negative value represents a placeholder ID for a new menu not yet saved. * A negative value represents a placeholder ID for a new menu not yet saved.
* *
* @since 4.3.0 * @since 4.3.0
* * @access public
* @var int * @var int
*/ */
public $term_id; public $term_id;
@ -1358,11 +1369,11 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* a real term. * a real term.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @var int
* *
* @see WP_Customize_Nav_Menu_Setting::update() * @see WP_Customize_Nav_Menu_Setting::update()
* @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response() * @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response()
*
* @var int
*/ */
public $previous_term_id; public $previous_term_id;
@ -1370,7 +1381,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Whether or not preview() was called. * Whether or not preview() was called.
* *
* @since 4.3.0 * @since 4.3.0
* * @access protected
* @var bool * @var bool
*/ */
protected $is_previewed = false; protected $is_previewed = false;
@ -1379,7 +1390,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Whether or not update() was called. * Whether or not update() was called.
* *
* @since 4.3.0 * @since 4.3.0
* * @access protected
* @var bool * @var bool
*/ */
protected $is_updated = false; protected $is_updated = false;
@ -1391,11 +1402,11 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* When status is error, the error is stored in $update_error. * When status is error, the error is stored in $update_error.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @var string updated|inserted|deleted|error
* *
* @see WP_Customize_Nav_Menu_Setting::update() * @see WP_Customize_Nav_Menu_Setting::update()
* @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response() * @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response()
*
* @var string updated|inserted|deleted|error
*/ */
public $update_status; public $update_status;
@ -1403,11 +1414,11 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Any error object returned by wp_update_nav_menu_object() when setting is updated. * Any error object returned by wp_update_nav_menu_object() when setting is updated.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* @var WP_Error
* *
* @see WP_Customize_Nav_Menu_Setting::update() * @see WP_Customize_Nav_Menu_Setting::update()
* @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response() * @see WP_Customize_Nav_Menu_Setting::amend_customize_save_response()
*
* @var WP_Error
*/ */
public $update_error; public $update_error;
@ -1417,11 +1428,13 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Any supplied $args override class property defaults. * Any supplied $args override class property defaults.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @param WP_Customize_Manager $manager Manager instance. * @param WP_Customize_Manager $manager Bootstrap Customizer instance.
* @param string $id An specific ID of the setting. Can be a * @param string $id An specific ID of the setting. Can be a
* theme mod or option name. * theme mod or option name.
* @param array $args Optional. Setting arguments. * @param array $args Optional. Setting arguments.
*
* @throws Exception If $id is not valid for this setting type. * @throws Exception If $id is not valid for this setting type.
*/ */
public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) { public function __construct( WP_Customize_Manager $manager, $id, array $args = array() ) {
@ -1442,10 +1455,11 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Get the instance data for a given widget setting. * Get the instance data for a given widget setting.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see wp_get_nav_menu_object() * @see wp_get_nav_menu_object()
* *
* @return array * @return array Instance data.
*/ */
public function value() { public function value() {
if ( $this->is_previewed && $this->_previewed_blog_id === get_current_blog_id() ) { if ( $this->is_previewed && $this->_previewed_blog_id === get_current_blog_id() ) {
@ -1487,6 +1501,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Handle previewing the setting. * Handle previewing the setting.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see WP_Customize_Manager::post_value() * @see WP_Customize_Manager::post_value()
*/ */
@ -1510,6 +1525,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Requesting a nav_menu object by anything but ID is not supported. * Requesting a nav_menu object by anything but ID is not supported.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see wp_get_nav_menu_object() * @see wp_get_nav_menu_object()
* *
@ -1558,9 +1574,10 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Filter the nav_menu_options option to include this menu's auto_add preference. * Filter the nav_menu_options option to include this menu's auto_add preference.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @param array $nav_menu_options Nav menu options including auto_add. * @param array $nav_menu_options Nav menu options including auto_add.
* @return array * @return array (Kaybe) modified nav menu options.
*/ */
public function filter_nav_menu_options( $nav_menu_options ) { public function filter_nav_menu_options( $nav_menu_options ) {
if ( $this->_previewed_blog_id !== get_current_blog_id() ) { if ( $this->_previewed_blog_id !== get_current_blog_id() ) {
@ -1584,9 +1601,11 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* we remove that in this override. * we remove that in this override.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @param array $value The value to sanitize. * @param array $value The value to sanitize.
* @return array|false|null Null if an input isn't valid. False if it is marked for deletion. Otherwise the sanitized value. * @return array|false|null Null if an input isn't valid. False if it is marked for deletion.
* Otherwise the sanitized value.
*/ */
public function sanitize( $value ) { public function sanitize( $value ) {
// Menu is marked for deletion. // Menu is marked for deletion.
@ -1631,6 +1650,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* To delete a menu, the client can send false as the value. * To delete a menu, the client can send false as the value.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see wp_update_nav_menu_object() * @see wp_update_nav_menu_object()
* *
@ -1643,7 +1663,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* @type int $parent The id of the parent term. Default 0. * @type int $parent The id of the parent term. Default 0.
* @type bool $auto_add Whether pages will auto_add to this menu. Default false. * @type bool $auto_add Whether pages will auto_add to this menu. Default false.
* } * }
* @return void * @return null|void
*/ */
protected function update( $value ) { protected function update( $value ) {
if ( $this->is_updated ) { if ( $this->is_updated ) {
@ -1730,9 +1750,10 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
} }
/** /**
* Update a nav_menu_options array. * Updates a nav_menu_options array.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see WP_Customize_Nav_Menu_Setting::filter_nav_menu_options() * @see WP_Customize_Nav_Menu_Setting::filter_nav_menu_options()
* @see WP_Customize_Nav_Menu_Setting::update() * @see WP_Customize_Nav_Menu_Setting::update()
@ -1740,7 +1761,7 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* @param array $nav_menu_options Array as returned by get_option( 'nav_menu_options' ). * @param array $nav_menu_options Array as returned by get_option( 'nav_menu_options' ).
* @param int $menu_id The term ID for the given menu. * @param int $menu_id The term ID for the given menu.
* @param bool $auto_add Whether to auto-add or not. * @param bool $auto_add Whether to auto-add or not.
* @return array * @return array (Maybe) modified nav_menu_otions array.
*/ */
protected function filter_nav_menu_options_value( $nav_menu_options, $menu_id, $auto_add ) { protected function filter_nav_menu_options_value( $nav_menu_options, $menu_id, $auto_add ) {
$nav_menu_options = (array) $nav_menu_options; $nav_menu_options = (array) $nav_menu_options;
@ -1762,11 +1783,12 @@ class WP_Customize_Nav_Menu_Setting extends WP_Customize_Setting {
* Export data for the JS client. * Export data for the JS client.
* *
* @since 4.3.0 * @since 4.3.0
* @access public
* *
* @see WP_Customize_Nav_Menu_Setting::update() * @see WP_Customize_Nav_Menu_Setting::update()
* *
* @param array $data Additional information passed back to the 'saved' event on `wp.customize`. * @param array $data Additional information passed back to the 'saved' event on `wp.customize`.
* @return array * @return array Export data.
*/ */
public function amend_customize_save_response( $data ) { public function amend_customize_save_response( $data ) {
if ( ! isset( $data['nav_menu_updates'] ) ) { if ( ! isset( $data['nav_menu_updates'] ) ) {