wp/wp-includes/deprecated.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    51 /**
    51 /**
    52  * Sets up the WordPress Loop.
    52  * Sets up the WordPress Loop.
    53  *
    53  *
    54  * Use The Loop instead.
    54  * Use The Loop instead.
    55  *
    55  *
    56  * @link https://codex.wordpress.org/The_Loop
    56  * @link https://developer.wordpress.org/themes/basics/the-loop/
    57  *
    57  *
    58  * @since 1.0.1
    58  * @since 1.0.1
    59  * @deprecated 1.5.0
    59  * @deprecated 1.5.0
    60  */
    60  */
    61 function start_wp() {
    61 function start_wp() {
   245 	$author_data = get_userdata($user_id);
   245 	$author_data = get_userdata($user_id);
   246 	$post = get_post($post_id);
   246 	$post = get_post($post_id);
   247 	$post_author_data = get_userdata($post->post_author);
   247 	$post_author_data = get_userdata($post->post_author);
   248 
   248 
   249 	if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
   249 	if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
   250 			 || ($author_data->user_level > $post_author_data->user_level)
   250 			|| ($author_data->user_level > $post_author_data->user_level)
   251 			 || ($author_data->user_level >= 10) ) {
   251 			|| ($author_data->user_level >= 10) ) {
   252 		return true;
   252 		return true;
   253 	} else {
   253 	} else {
   254 		return false;
   254 		return false;
   255 	}
   255 	}
   256 }
   256 }
   268  * @return bool
   268  * @return bool
   269  */
   269  */
   270 function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
   270 function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
   271 	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
   271 	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
   272 
   272 
   273 	// right now if one can edit, one can delete
   273 	// Right now if one can edit, one can delete.
   274 	return user_can_edit_post($user_id, $post_id, $blog_id);
   274 	return user_can_edit_post($user_id, $post_id, $blog_id);
   275 }
   275 }
   276 
   276 
   277 /**
   277 /**
   278  * Whether user can set new posts' dates.
   278  * Whether user can set new posts' dates.
   325  * @return bool returns true if $user_id can edit $post_id's comments
   325  * @return bool returns true if $user_id can edit $post_id's comments
   326  */
   326  */
   327 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
   327 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
   328 	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
   328 	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
   329 
   329 
   330 	// right now if one can edit a post, one can edit comments made on it
   330 	// Right now if one can edit a post, one can edit comments made on it.
   331 	return user_can_edit_post($user_id, $post_id, $blog_id);
   331 	return user_can_edit_post($user_id, $post_id, $blog_id);
   332 }
   332 }
   333 
   333 
   334 /**
   334 /**
   335  * Whether user can delete a post.
   335  * Whether user can delete a post.
   344  * @return bool returns true if $user_id can delete $post_id's comments
   344  * @return bool returns true if $user_id can delete $post_id's comments
   345  */
   345  */
   346 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
   346 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
   347 	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
   347 	_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
   348 
   348 
   349 	// right now if one can edit comments, one can delete comments
   349 	// Right now if one can edit comments, one can delete comments.
   350 	return user_can_edit_post_comments($user_id, $post_id, $blog_id);
   350 	return user_can_edit_post_comments($user_id, $post_id, $blog_id);
   351 }
   351 }
   352 
   352 
   353 /**
   353 /**
   354  * Can user can edit other user.
   354  * Can user can edit other user.
   377  *
   377  *
   378  * @since 0.71
   378  * @since 0.71
   379  * @deprecated 2.1.0 Use get_bookmarks()
   379  * @deprecated 2.1.0 Use get_bookmarks()
   380  * @see get_bookmarks()
   380  * @see get_bookmarks()
   381  *
   381  *
   382  * @param string $cat_name Optional. The category name to use. If no match is found uses all.
   382  * @param string $cat_name         Optional. The category name to use. If no match is found, uses all.
   383  * @param string $before Optional. The html to output before the link.
   383  *                                 Default 'noname'.
   384  * @param string $after Optional. The html to output after the link.
   384  * @param string $before           Optional. The HTML to output before the link. Default empty.
   385  * @param string $between Optional. The html to output between the link/image and its description. Not used if no image or $show_images is true.
   385  * @param string $after            Optional. The HTML to output after the link. Default '<br />'.
   386  * @param bool $show_images Optional. Whether to show images (if defined).
   386  * @param string $between          Optional. The HTML to output between the link/image and its description.
   387  * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
   387  *                                 Not used if no image or $show_images is true. Default ' '.
   388  *		If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a
   388  * @param bool   $show_images      Optional. Whether to show images (if defined). Default true.
   389  *		random order.
   389  * @param string $orderby          Optional. The order to output the links. E.g. 'id', 'name', 'url',
   390  * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
   390  *                                 'description', 'rating', or 'owner'. Default 'id'.
   391  * @param bool $show_rating Optional. Show rating stars/chars.
   391  *                                 If you start the name with an underscore, the order will be reversed.
   392  * @param int $limit		Optional. Limit to X entries. If not specified, all entries are shown.
   392  *                                 Specifying 'rand' as the order will return links in a random order.
   393  * @param int $show_updated Optional. Whether to show last updated timestamp
   393  * @param bool   $show_description Optional. Whether to show the description if show_images=false/not defined.
       
   394  *                                 Default true.
       
   395  * @param bool   $show_rating      Optional. Show rating stars/chars. Default false.
       
   396  * @param int    $limit            Optional. Limit to X entries. If not specified, all entries are shown.
       
   397  *                                 Default -1.
       
   398  * @param int    $show_updated     Optional. Whether to show last updated timestamp. Default 0.
   394  */
   399  */
   395 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
   400 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
   396 						 $show_description = true, $show_rating = false,
   401 						$show_description = true, $show_rating = false,
   397 						 $limit = -1, $show_updated = 0) {
   402 						$limit = -1, $show_updated = 0) {
   398 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   403 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   399 
   404 
   400 	$cat_id = -1;
   405 	$cat_id = -1;
   401 	$cat = get_term_by('name', $cat_name, 'link_category');
   406 	$cat = get_term_by('name', $cat_name, 'link_category');
   402 	if ( $cat )
   407 	if ( $cat )
   428 		'category_name' => $category,
   433 		'category_name' => $category,
   429 		'show_description' => 1,
   434 		'show_description' => 1,
   430 		'title_li' => '',
   435 		'title_li' => '',
   431 	);
   436 	);
   432 
   437 
   433 	$r = wp_parse_args( $args, $defaults );
   438 	$parsed_args = wp_parse_args( $args, $defaults );
   434 
   439 
   435 	return wp_list_bookmarks($r);
   440 	return wp_list_bookmarks($parsed_args);
   436 }
   441 }
   437 
   442 
   438 /**
   443 /**
   439  * Gets an array of link objects associated with category $cat_name.
   444  * Gets an array of link objects associated with category $cat_name.
   440  *
   445  *
   445  *
   450  *
   446  * @since 1.0.1
   451  * @since 1.0.1
   447  * @deprecated 2.1.0 Use get_bookmarks()
   452  * @deprecated 2.1.0 Use get_bookmarks()
   448  * @see get_bookmarks()
   453  * @see get_bookmarks()
   449  *
   454  *
   450  * @param string $cat_name The category name to use. If no match is found uses all.
   455  * @param string $cat_name Optional. The category name to use. If no match is found, uses all.
   451  * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url', 'description', or 'rating'.
   456  *                         Default 'noname'.
   452  *		Or maybe owner. If you start the name with an underscore the order will be reversed. You can also
   457  * @param string $orderby  Optional. The order to output the links. E.g. 'id', 'name', 'url',
   453  *		specify 'rand' as the order which will return links in a random order.
   458  *                         'description', 'rating', or 'owner'. Default 'name'.
   454  * @param int $limit Limit to X entries. If not specified, all entries are shown.
   459  *                         If you start the name with an underscore, the order will be reversed.
       
   460  *                         Specifying 'rand' as the order will return links in a random order.
       
   461  * @param int    $limit    Optional. Limit to X entries. If not specified, all entries are shown.
       
   462  *                         Default -1.
   455  * @return array
   463  * @return array
   456  */
   464  */
   457 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
   465 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
   458 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   466 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   459 
   467 
   495  *
   503  *
   496  * @since 1.0.1
   504  * @since 1.0.1
   497  * @deprecated 2.1.0 Use get_bookmarks()
   505  * @deprecated 2.1.0 Use get_bookmarks()
   498  * @see get_bookmarks()
   506  * @see get_bookmarks()
   499  *
   507  *
   500  * @param int $category The category to use. If no category supplied uses all
   508  * @param int    $category Optional. The category to use. If no category supplied, uses all.
   501  * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
   509  *                         Default 0.
   502  *		'description', or 'rating'. Or maybe owner. If you start the name with an
   510  * @param string $orderby  Optional. The order to output the links. E.g. 'id', 'name', 'url',
   503  *		underscore the order will be reversed. You can also specify 'rand' as the
   511  *                         'description', 'rating', or 'owner'. Default 'name'.
   504  *		order which will return links in a random order.
   512  *                         If you start the name with an underscore, the order will be reversed.
   505  * @param int $limit Limit to X entries. If not specified, all entries are shown.
   513  *                         Specifying 'rand' as the order will return links in a random order.
       
   514  * @param int    $limit    Optional. Limit to X entries. If not specified, all entries are shown.
       
   515  *                         Default 0.
   506  * @return array
   516  * @return array
   507  */
   517  */
   508 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
   518 function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
   509 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   519 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   510 
   520 
   522  *
   532  *
   523  * @since 0.71
   533  * @since 0.71
   524  * @deprecated 2.1.0 Use get_bookmarks()
   534  * @deprecated 2.1.0 Use get_bookmarks()
   525  * @see get_bookmarks()
   535  * @see get_bookmarks()
   526  *
   536  *
   527  * @param string $cat_name The category name to use. If no match is found uses all
   537  * @param string $cat_name         Optional. The category name to use. If no match is found, uses all.
   528  * @param string $before The html to output before the link
   538  *                                 Default 'noname'.
   529  * @param string $after The html to output after the link
   539  * @param string $before           Optional. The HTML to output before the link. Default empty.
   530  * @param string $between The html to output between the link/image and its description. Not used if no image or show_images is true
   540  * @param string $after            Optional. The HTML to output after the link. Default '<br />'.
   531  * @param bool $show_images Whether to show images (if defined).
   541  * @param string $between          Optional. The HTML to output between the link/image and its description.
   532  * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
   542  *                                 Not used if no image or $show_images is true. Default ' '.
   533  *		'description', or 'rating'. Or maybe owner. If you start the name with an
   543  * @param bool   $show_images      Optional. Whether to show images (if defined). Default true.
   534  *		underscore the order will be reversed. You can also specify 'rand' as the
   544  * @param string $orderby          Optional. The order to output the links. E.g. 'id', 'name', 'url',
   535  *		order which will return links in a random order.
   545  *                                 'description', 'rating', or 'owner'. Default 'id'.
   536  * @param bool $show_description Whether to show the description if show_images=false/not defined
   546  *                                 If you start the name with an underscore, the order will be reversed.
   537  * @param int $limit Limit to X entries. If not specified, all entries are shown.
   547  *                                 Specifying 'rand' as the order will return links in a random order.
   538  * @param int $show_updated Whether to show last updated timestamp
   548  * @param bool   $show_description Optional. Whether to show the description if show_images=false/not defined.
       
   549  *                                 Default true.
       
   550  * @param int    $limit		       Optional. Limit to X entries. If not specified, all entries are shown.
       
   551  *                                 Default -1.
       
   552  * @param int    $show_updated     Optional. Whether to show last updated timestamp. Default 0.
   539  */
   553  */
   540 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
   554 function get_linksbyname_withrating($cat_name = "noname", $before = '', $after = '<br />', $between = " ",
   541 									$show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
   555 									$show_images = true, $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
   542 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   556 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   543 
   557 
   549  *
   563  *
   550  * @since 0.71
   564  * @since 0.71
   551  * @deprecated 2.1.0 Use get_bookmarks()
   565  * @deprecated 2.1.0 Use get_bookmarks()
   552  * @see get_bookmarks()
   566  * @see get_bookmarks()
   553  *
   567  *
   554  * @param int $category The category to use. If no category supplied uses all
   568  * @param int    $category         Optional. The category to use. If no category supplied, uses all.
   555  * @param string $before The html to output before the link
   569  *                                 Default 0.
   556  * @param string $after The html to output after the link
   570  * @param string $before           Optional. The HTML to output before the link. Default empty.
   557  * @param string $between The html to output between the link/image and its description. Not used if no image or show_images == true
   571  * @param string $after            Optional. The HTML to output after the link. Default '<br />'.
   558  * @param bool $show_images Whether to show images (if defined).
   572  * @param string $between          Optional. The HTML to output between the link/image and its description.
   559  * @param string $orderby The order to output the links. E.g. 'id', 'name', 'url',
   573  *                                 Not used if no image or $show_images is true. Default ' '.
   560  *		'description', or 'rating'. Or maybe owner. If you start the name with an
   574  * @param bool   $show_images      Optional. Whether to show images (if defined). Default true.
   561  *		underscore the order will be reversed. You can also specify 'rand' as the
   575  * @param string $orderby          Optional. The order to output the links. E.g. 'id', 'name', 'url',
   562  *		order which will return links in a random order.
   576  *                                 'description', 'rating', or 'owner'. Default 'id'.
   563  * @param bool $show_description Whether to show the description if show_images=false/not defined.
   577  *                                 If you start the name with an underscore, the order will be reversed.
   564  * @param int $limit Limit to X entries. If not specified, all entries are shown.
   578  *                                 Specifying 'rand' as the order will return links in a random order.
   565  * @param int $show_updated Whether to show last updated timestamp
   579  * @param bool   $show_description Optional. Whether to show the description if show_images=false/not defined.
       
   580  *                                 Default true.
       
   581  * @param int    $limit		       Optional. Limit to X entries. If not specified, all entries are shown.
       
   582  *                                 Default -1.
       
   583  * @param int    $show_updated     Optional. Whether to show last updated timestamp. Default 0.
   566  */
   584  */
   567 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
   585 function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
   568 							  $orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
   586 							$orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
   569 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   587 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   570 
   588 
   571 	get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
   589 	get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
   572 }
   590 }
   573 
   591 
   608  * @param int $recurse
   626  * @param int $recurse
   609  * @param string $feed
   627  * @param string $feed
   610  * @param string $feed_image
   628  * @param string $feed_image
   611  * @param string $exclude
   629  * @param string $exclude
   612  * @param bool $hierarchical
   630  * @param bool $hierarchical
   613  * @return false|null
   631  * @return null|false
   614  */
   632  */
   615 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
   633 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0,
   616 				   $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
   634 				$optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=false, $child_of=0, $categories=0,
   617 				   $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
   635 				$recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=false) {
   618 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
   636 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
   619 
   637 
   620 	$query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
   638 	$query = compact('optionall', 'all', 'sort_column', 'sort_order', 'file', 'list', 'optiondates', 'optioncount', 'hide_empty', 'use_desc_for_title', 'children',
   621 		'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
   639 		'child_of', 'categories', 'recurse', 'feed', 'feed_image', 'exclude', 'hierarchical');
   622 	return wp_list_cats($query);
   640 	return wp_list_cats($query);
   628  * @since 1.2.0
   646  * @since 1.2.0
   629  * @deprecated 2.1.0 Use wp_list_categories()
   647  * @deprecated 2.1.0 Use wp_list_categories()
   630  * @see wp_list_categories()
   648  * @see wp_list_categories()
   631  *
   649  *
   632  * @param string|array $args
   650  * @param string|array $args
   633  * @return false|null|string
   651  * @return null|string|false
   634  */
   652  */
   635 function wp_list_cats($args = '') {
   653 function wp_list_cats($args = '') {
   636 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
   654 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_categories()' );
   637 
   655 
   638 	$r = wp_parse_args( $args );
   656 	$parsed_args = wp_parse_args( $args );
   639 
   657 
   640 	// Map to new names.
   658 	// Map to new names.
   641 	if ( isset($r['optionall']) && isset($r['all']))
   659 	if ( isset($parsed_args['optionall']) && isset($parsed_args['all']))
   642 		$r['show_option_all'] = $r['all'];
   660 		$parsed_args['show_option_all'] = $parsed_args['all'];
   643 	if ( isset($r['sort_column']) )
   661 	if ( isset($parsed_args['sort_column']) )
   644 		$r['orderby'] = $r['sort_column'];
   662 		$parsed_args['orderby'] = $parsed_args['sort_column'];
   645 	if ( isset($r['sort_order']) )
   663 	if ( isset($parsed_args['sort_order']) )
   646 		$r['order'] = $r['sort_order'];
   664 		$parsed_args['order'] = $parsed_args['sort_order'];
   647 	if ( isset($r['optiondates']) )
   665 	if ( isset($parsed_args['optiondates']) )
   648 		$r['show_last_update'] = $r['optiondates'];
   666 		$parsed_args['show_last_update'] = $parsed_args['optiondates'];
   649 	if ( isset($r['optioncount']) )
   667 	if ( isset($parsed_args['optioncount']) )
   650 		$r['show_count'] = $r['optioncount'];
   668 		$parsed_args['show_count'] = $parsed_args['optioncount'];
   651 	if ( isset($r['list']) )
   669 	if ( isset($parsed_args['list']) )
   652 		$r['style'] = $r['list'] ? 'list' : 'break';
   670 		$parsed_args['style'] = $parsed_args['list'] ? 'list' : 'break';
   653 	$r['title_li'] = '';
   671 	$parsed_args['title_li'] = '';
   654 
   672 
   655 	return wp_list_categories($r);
   673 	return wp_list_categories($parsed_args);
   656 }
   674 }
   657 
   675 
   658 /**
   676 /**
   659  * Deprecated method for generating a drop-down of categories.
   677  * Deprecated method for generating a drop-down of categories.
   660  *
   678  *
   730 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' );
   748 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_post_categories()' );
   731 	return wp_get_post_categories($post_ID);
   749 	return wp_get_post_categories($post_ID);
   732 }
   750 }
   733 
   751 
   734 /**
   752 /**
   735  * Sets the categories that the post id belongs to.
   753  * Sets the categories that the post ID belongs to.
   736  *
   754  *
   737  * @since 1.0.1
   755  * @since 1.0.1
   738  * @deprecated 2.1.0
   756  * @deprecated 2.1.0
   739  * @deprecated Use wp_set_post_categories()
   757  * @deprecated Use wp_set_post_categories()
   740  * @see wp_set_post_categories()
   758  * @see wp_set_post_categories()
   890 		'show_rating' => false,
   908 		'show_rating' => false,
   891 		'show_updated' => true,
   909 		'show_updated' => true,
   892 		'title_li' => '',
   910 		'title_li' => '',
   893 	);
   911 	);
   894 
   912 
   895 	$r = wp_parse_args( $args, $defaults );
   913 	$parsed_args = wp_parse_args( $args, $defaults );
   896 
   914 
   897 	return wp_list_bookmarks($r);
   915 	return wp_list_bookmarks($parsed_args);
   898 }
   916 }
   899 
   917 
   900 /**
   918 /**
   901  * Gets the links associated with category by id.
   919  * Gets the links associated with category by ID.
   902  *
   920  *
   903  * @since 0.71
   921  * @since 0.71
   904  * @deprecated 2.1.0 Use get_bookmarks()
   922  * @deprecated 2.1.0 Use get_bookmarks()
   905  * @see get_bookmarks()
   923  * @see get_bookmarks()
   906  *
   924  *
   907  * @param int $category The category to use. If no category supplied uses all
   925  * @param int    $category         Optional. The category to use. If no category supplied uses all.
   908  * @param string $before the html to output before the link
   926  *                                 Default 0.
   909  * @param string $after the html to output after the link
   927  * @param string $before           Optional. The HTML to output before the link. Default empty.
   910  * @param string $between the html to output between the link/image and its description.
   928  * @param string $after            Optional. The HTML to output after the link. Default '<br />'.
   911  *		Not used if no image or show_images == true
   929  * @param string $between          Optional. The HTML to output between the link/image and its description.
   912  * @param bool $show_images whether to show images (if defined).
   930  *                                 Not used if no image or $show_images is true. Default ' '.
   913  * @param string $orderby the order to output the links. E.g. 'id', 'name', 'url',
   931  * @param bool   $show_images      Optional. Whether to show images (if defined). Default true.
   914  *		'description', or 'rating'. Or maybe owner. If you start the name with an
   932  * @param string $orderby          Optional. The order to output the links. E.g. 'id', 'name', 'url',
   915  *		underscore the order will be reversed. You can also specify 'rand' as the order
   933  *                                 'description', 'rating', or 'owner'. Default 'name'.
   916  *		which will return links in a random order.
   934  *                                 If you start the name with an underscore, the order will be reversed.
   917  * @param bool $show_description whether to show the description if show_images=false/not defined.
   935  *                                 Specifying 'rand' as the order will return links in a random order.
   918  * @param bool $show_rating show rating stars/chars
   936  * @param bool   $show_description Optional. Whether to show the description if show_images=false/not defined.
   919  * @param int $limit Limit to X entries. If not specified, all entries are shown.
   937  *                                 Default true.
   920  * @param int $show_updated whether to show last updated timestamp
   938  * @param bool   $show_rating      Optional. Show rating stars/chars. Default false.
   921  * @param bool $echo whether to echo the results, or return them instead
   939  * @param int    $limit            Optional. Limit to X entries. If not specified, all entries are shown.
       
   940  *                                 Default -1.
       
   941  * @param int    $show_updated     Optional. Whether to show last updated timestamp. Default 1.
       
   942  * @param bool   $echo             Whether to echo the results, or return them instead.
   922  * @return null|string
   943  * @return null|string
   923  */
   944  */
   924 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
   945 function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
   925 			$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
   946 			$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
   926 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   947 	_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
   929 	if ( substr($orderby, 0, 1) == '_' ) {
   950 	if ( substr($orderby, 0, 1) == '_' ) {
   930 		$order = 'DESC';
   951 		$order = 'DESC';
   931 		$orderby = substr($orderby, 1);
   952 		$orderby = substr($orderby, 1);
   932 	}
   953 	}
   933 
   954 
   934 	if ( $category == -1 ) //get_bookmarks uses '' to signify all categories
   955 	if ( $category == -1 ) // get_bookmarks() uses '' to signify all categories.
   935 		$category = '';
   956 		$category = '';
   936 
   957 
   937 	$results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
   958 	$results = get_bookmarks(array('category' => $category, 'orderby' => $orderby, 'order' => $order, 'show_updated' => $show_updated, 'limit' => $limit));
   938 
   959 
   939 	if ( !$results )
   960 	if ( !$results )
   958 		$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
   979 		$name = esc_attr(sanitize_bookmark_field('link_name', $row->link_name, $row->link_id, 'display'));
   959 		$title = $desc;
   980 		$title = $desc;
   960 
   981 
   961 		if ( $show_updated )
   982 		if ( $show_updated )
   962 			if (substr($row->link_updated_f, 0, 2) != '00')
   983 			if (substr($row->link_updated_f, 0, 2) != '00')
   963 				$title .= ' ('.__('Last updated') . ' ' . date(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
   984 				$title .= ' ('.__('Last updated') . ' ' . gmdate(get_option('links_updated_date_format'), $row->link_updated_f + (get_option('gmt_offset') * HOUR_IN_SECONDS)) . ')';
   964 
   985 
   965 		if ( '' != $title )
   986 		if ( '' != $title )
   966 			$title = ' title="' . $title . '"';
   987 			$title = ' title="' . $title . '"';
   967 
   988 
   968 		$alt = ' alt="' . $name . '"';
   989 		$alt = ' alt="' . $name . '"';
   974 		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
   995 		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
   975 
   996 
   976 		if ( $row->link_image != null && $show_images ) {
   997 		if ( $row->link_image != null && $show_images ) {
   977 			if ( strpos($row->link_image, 'http') !== false )
   998 			if ( strpos($row->link_image, 'http') !== false )
   978 				$output .= "<img src=\"$row->link_image\" $alt $title />";
   999 				$output .= "<img src=\"$row->link_image\" $alt $title />";
   979 			else // If it's a relative path
  1000 			else // If it's a relative path.
   980 				$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
  1001 				$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
   981 		} else {
  1002 		} else {
   982 			$output .= $name;
  1003 			$output .= $name;
   983 		}
  1004 		}
   984 
  1005 
   993 		if ($show_rating) {
  1014 		if ($show_rating) {
   994 			$output .= $between . get_linkrating($row);
  1015 			$output .= $between . get_linkrating($row);
   995 		}
  1016 		}
   996 
  1017 
   997 		$output .= "$after\n";
  1018 		$output .= "$after\n";
   998 	} // end while
  1019 	} // End while.
   999 
  1020 
  1000 	if ( !$echo )
  1021 	if ( !$echo )
  1001 		return $output;
  1022 		return $output;
  1002 	echo $output;
  1023 	echo $output;
  1003 }
  1024 }
  1017 function get_links_list($order = 'name') {
  1038 function get_links_list($order = 'name') {
  1018 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
  1039 	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
  1019 
  1040 
  1020 	$order = strtolower($order);
  1041 	$order = strtolower($order);
  1021 
  1042 
  1022 	// Handle link category sorting
  1043 	// Handle link category sorting.
  1023 	$direction = 'ASC';
  1044 	$direction = 'ASC';
  1024 	if ( '_' == substr($order,0,1) ) {
  1045 	if ( '_' == substr($order,0,1) ) {
  1025 		$direction = 'DESC';
  1046 		$direction = 'DESC';
  1026 		$order = substr($order,1);
  1047 		$order = substr($order,1);
  1027 	}
  1048 	}
  1029 	if ( !isset($direction) )
  1050 	if ( !isset($direction) )
  1030 		$direction = '';
  1051 		$direction = '';
  1031 
  1052 
  1032 	$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
  1053 	$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
  1033 
  1054 
  1034 	// Display each category
  1055 	// Display each category.
  1035 	if ( $cats ) {
  1056 	if ( $cats ) {
  1036 		foreach ( (array) $cats as $cat ) {
  1057 		foreach ( (array) $cats as $cat ) {
  1037 			// Handle each category.
  1058 			// Handle each category.
  1038 
  1059 
  1039 			// Display the category name
  1060 			// Display the category name.
  1040 			echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
  1061 			echo '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
  1041 			// Call get_links() with all the appropriate params
  1062 			// Call get_links() with all the appropriate params.
  1042 			get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
  1063 			get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
  1043 
  1064 
  1044 			// Close the last category
  1065 			// Close the last category.
  1045 			echo "\n\t</ul>\n</li>\n";
  1066 			echo "\n\t</ul>\n</li>\n";
  1046 		}
  1067 		}
  1047 	}
  1068 	}
  1048 }
  1069 }
  1049 
  1070 
  1077 	_deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' );
  1098 	_deprecated_function( __FUNCTION__, '2.1.0', 'sanitize_bookmark_field()' );
  1078 	return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
  1099 	return sanitize_bookmark_field('link_rating', $link->link_rating, $link->link_id, 'display');
  1079 }
  1100 }
  1080 
  1101 
  1081 /**
  1102 /**
  1082  * Gets the name of category by id.
  1103  * Gets the name of category by ID.
  1083  *
  1104  *
  1084  * @since 0.71
  1105  * @since 0.71
  1085  * @deprecated 2.1.0 Use get_category()
  1106  * @deprecated 2.1.0 Use get_category()
  1086  * @see get_category()
  1107  * @see get_category()
  1087  *
  1108  *
  1240  *
  1261  *
  1241  * @since 1.2.0
  1262  * @since 1.2.0
  1242  * @deprecated 2.8.0 Use get_term_children()
  1263  * @deprecated 2.8.0 Use get_term_children()
  1243  * @see get_term_children()
  1264  * @see get_term_children()
  1244  *
  1265  *
  1245  * @param int $id Category ID to retrieve children.
  1266  * @param int    $id      Category ID to retrieve children.
  1246  * @param string $before Optional. Prepend before category term ID.
  1267  * @param string $before  Optional. Prepend before category term ID. Default '/'.
  1247  * @param string $after Optional, default is empty string. Append after category term ID.
  1268  * @param string $after   Optional. Append after category term ID. Default empty string.
  1248  * @param array $visited Optional. Category Term IDs that have already been added.
  1269  * @param array  $visited Optional. Category Term IDs that have already been added.
       
  1270  *                        Default empty array.
  1249  * @return string
  1271  * @return string
  1250  */
  1272  */
  1251 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
  1273 function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
  1252 	_deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' );
  1274 	_deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' );
  1253 	if ( 0 == $id )
  1275 	if ( 0 == $id )
  1254 		return '';
  1276 		return '';
  1255 
  1277 
  1256 	$chain = '';
  1278 	$chain = '';
  1257 	/** TODO: consult hierarchy */
  1279 	/** TODO: Consult hierarchy */
  1258 	$cat_ids = get_all_category_ids();
  1280 	$cat_ids = get_all_category_ids();
  1259 	foreach ( (array) $cat_ids as $cat_id ) {
  1281 	foreach ( (array) $cat_ids as $cat_id ) {
  1260 		if ( $cat_id == $id )
  1282 		if ( $cat_id == $id )
  1261 			continue;
  1283 			continue;
  1262 
  1284 
  1277  *
  1299  *
  1278  * @since 2.0.0
  1300  * @since 2.0.0
  1279  * @deprecated 4.0.0 Use get_terms()
  1301  * @deprecated 4.0.0 Use get_terms()
  1280  * @see get_terms()
  1302  * @see get_terms()
  1281  *
  1303  *
  1282  * @link https://codex.wordpress.org/Function_Reference/get_all_category_ids
  1304  * @link https://developer.wordpress.org/reference/functions/get_all_category_ids/
  1283  *
  1305  *
  1284  * @return object List of all of the category IDs.
  1306  * @return object List of all of the category IDs.
  1285  */
  1307  */
  1286 function get_all_category_ids() {
  1308 function get_all_category_ids() {
  1287 	_deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' );
  1309 	_deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' );
  1288 
  1310 
  1289 	if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
  1311 	$cat_ids = get_terms(
  1290 		$cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
  1312 		array(
  1291 		wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
  1313 			'taxonomy' => 'category',
  1292 	}
  1314 			'fields'   => 'ids',
       
  1315 			'get'      => 'all',
       
  1316 		)
       
  1317 	);
  1293 
  1318 
  1294 	return $cat_ids;
  1319 	return $cat_ids;
  1295 }
  1320 }
  1296 
  1321 
  1297 /**
  1322 /**
  1622 }
  1647 }
  1623 
  1648 
  1624 /**
  1649 /**
  1625  * Display the post content for the feed.
  1650  * Display the post content for the feed.
  1626  *
  1651  *
  1627  * For encoding the html or the $encode_html parameter, there are three possible
  1652  * For encoding the HTML or the $encode_html parameter, there are three possible values:
  1628  * values. '0' will make urls footnotes and use make_url_footnote(). '1' will
  1653  * - '0' will make urls footnotes and use make_url_footnote().
  1629  * encode special characters and automatically display all of the content. The
  1654  * - '1' will encode special characters and automatically display all of the content.
  1630  * value of '2' will strip all HTML tags from the content.
  1655  * - '2' will strip all HTML tags from the content.
  1631  *
  1656  *
  1632  * Also note that you cannot set the amount of words and not set the html
  1657  * Also note that you cannot set the amount of words and not set the HTML encoding.
  1633  * encoding. If that is the case, then the html encoding will default to 2,
  1658  * If that is the case, then the HTML encoding will default to 2, which will strip
  1634  * which will strip all HTML tags.
  1659  * all HTML tags.
  1635  *
  1660  *
  1636  * To restrict the amount of words of the content, you can use the cut
  1661  * To restrict the amount of words of the content, you can use the cut parameter.
  1637  * parameter. If the content is less than the amount, then there won't be any
  1662  * If the content is less than the amount, then there won't be any dots added to the end.
  1638  * dots added to the end. If there is content left over, then dots will be added
  1663  * If there is content left over, then dots will be added and the rest of the content
  1639  * and the rest of the content will be removed.
  1664  * will be removed.
  1640  *
  1665  *
  1641  * @since 0.71
  1666  * @since 0.71
  1642  *
  1667  *
  1643  * @deprecated 2.9.0 Use the_content_feed()
  1668  * @deprecated 2.9.0 Use the_content_feed()
  1644  * @see the_content_feed()
  1669  * @see the_content_feed()
  1645  *
  1670  *
  1646  * @param string $more_link_text Optional. Text to display when more content is available but not displayed.
  1671  * @param string $more_link_text Optional. Text to display when more content is available
  1647  * @param int $stripteaser Optional. Default is 0.
  1672  *                               but not displayed. Default '(more...)'.
  1648  * @param string $more_file Optional.
  1673  * @param int    $stripteaser    Optional. Default 0.
  1649  * @param int $cut Optional. Amount of words to keep for the content.
  1674  * @param string $more_file      Optional.
  1650  * @param int $encode_html Optional. How to encode the content.
  1675  * @param int    $cut            Optional. Amount of words to keep for the content.
       
  1676  * @param int    $encode_html    Optional. How to encode the content.
  1651  */
  1677  */
  1652 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
  1678 function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
  1653 	_deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' );
  1679 	_deprecated_function( __FUNCTION__, '2.9.0', 'the_content_feed()' );
  1654 	$content = get_the_content($more_link_text, $stripteaser);
  1680 	$content = get_the_content($more_link_text, $stripteaser);
  1655 
  1681 
  1698  * them at the bottom of the content with numbers.
  1724  * them at the bottom of the content with numbers.
  1699  *
  1725  *
  1700  * @since 0.71
  1726  * @since 0.71
  1701  * @deprecated 2.9.0
  1727  * @deprecated 2.9.0
  1702  *
  1728  *
  1703  * @param string $content Content to get links
  1729  * @param string $content Content to get links.
  1704  * @return string HTML stripped out of content with links at the bottom.
  1730  * @return string HTML stripped out of content with links at the bottom.
  1705  */
  1731  */
  1706 function make_url_footnote( $content ) {
  1732 function make_url_footnote( $content ) {
  1707 	_deprecated_function( __FUNCTION__, '2.9.0', '' );
  1733 	_deprecated_function( __FUNCTION__, '2.9.0', '' );
  1708 	preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
  1734 	preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
  1736  *
  1762  *
  1737  * @since 2.2.0
  1763  * @since 2.2.0
  1738  * @deprecated 2.9.0 Use _x()
  1764  * @deprecated 2.9.0 Use _x()
  1739  * @see _x()
  1765  * @see _x()
  1740  *
  1766  *
  1741  * @param string $text Text to translate
  1767  * @param string $text Text to translate.
  1742  * @param string $domain Optional. Domain to retrieve the translated text
  1768  * @param string $domain Optional. Domain to retrieve the translated text.
  1743  * @return string Translated context string without pipe
  1769  * @return string Translated context string without pipe.
  1744  */
  1770  */
  1745 function _c( $text, $domain = 'default' ) {
  1771 function _c( $text, $domain = 'default' ) {
  1746 	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
  1772 	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
  1747 	return before_last_bar( translate( $text, $domain ) );
  1773 	return before_last_bar( translate( $text, $domain ) );
  1748 }
  1774 }
  1753  *
  1779  *
  1754  * @since 2.5.0
  1780  * @since 2.5.0
  1755  * @deprecated 3.0.0 Use _x()
  1781  * @deprecated 3.0.0 Use _x()
  1756  * @see _x()
  1782  * @see _x()
  1757  *
  1783  *
  1758  * @param string $text Text to translate
  1784  * @param string $text Text to translate.
  1759  * @param string $domain Domain to retrieve the translated text
  1785  * @param string $domain Domain to retrieve the translated text.
  1760  * @return string Translated text
  1786  * @return string Translated text.
  1761  */
  1787  */
  1762 function translate_with_context( $text, $domain = 'default' ) {
  1788 function translate_with_context( $text, $domain = 'default' ) {
  1763 	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
  1789 	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
  1764 	return before_last_bar( translate( $text, $domain ) );
  1790 	return before_last_bar( translate( $text, $domain ) );
  1765 }
  1791 }
  1790  *
  1816  *
  1791  * @since 1.2.0
  1817  * @since 1.2.0
  1792  * @deprecated 2.8.0 Use _n()
  1818  * @deprecated 2.8.0 Use _n()
  1793  * @see _n()
  1819  * @see _n()
  1794  */
  1820  */
  1795 function __ngettext() {
  1821 function __ngettext( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
  1796 	_deprecated_function( __FUNCTION__, '2.8.0', '_n()' );
  1822 	_deprecated_function( __FUNCTION__, '2.8.0', '_n()' );
  1797 	$args = func_get_args();
  1823 	return _n( ...$args );
  1798 	return call_user_func_array('_n', $args);
       
  1799 }
  1824 }
  1800 
  1825 
  1801 /**
  1826 /**
  1802  * Register plural strings in POT file, but don't translate them.
  1827  * Register plural strings in POT file, but don't translate them.
  1803  *
  1828  *
  1804  * @since 2.5.0
  1829  * @since 2.5.0
  1805  * @deprecated 2.8.0 Use _n_noop()
  1830  * @deprecated 2.8.0 Use _n_noop()
  1806  * @see _n_noop()
  1831  * @see _n_noop()
  1807  */
  1832  */
  1808 function __ngettext_noop() {
  1833 function __ngettext_noop( ...$args ) { // phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
  1809 	_deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' );
  1834 	_deprecated_function( __FUNCTION__, '2.8.0', '_n_noop()' );
  1810 	$args = func_get_args();
  1835 	return _n_noop( ...$args );
  1811 	return call_user_func_array('_n_noop', $args);
       
  1812 
  1836 
  1813 }
  1837 }
  1814 
  1838 
  1815 /**
  1839 /**
  1816  * Retrieve all autoload options, or all options if no autoloaded ones exist.
  1840  * Retrieve all autoload options, or all options if no autoloaded ones exist.
  1831  *
  1855  *
  1832  * @since 2.0.0
  1856  * @since 2.0.0
  1833  * @deprecated 2.5.0 Use wp_get_attachment_link()
  1857  * @deprecated 2.5.0 Use wp_get_attachment_link()
  1834  * @see wp_get_attachment_link()
  1858  * @see wp_get_attachment_link()
  1835  *
  1859  *
  1836  * @param int $id Optional. Post ID.
  1860  * @param int   $id       Optional. Post ID.
  1837  * @param bool $fullsize Optional, default is false. Whether to use full size image.
  1861  * @param bool  $fullsize Optional. Whether to use full size image. Default false.
  1838  * @param array $max_dims Optional. Max image dimensions.
  1862  * @param array $max_dims Optional. Max image dimensions.
  1839  * @param bool $permalink Optional, default is false. Whether to include permalink to image.
  1863  * @param bool $permalink Optional. Whether to include permalink to image. Default false.
  1840  * @return string
  1864  * @return string
  1841  */
  1865  */
  1842 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
  1866 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
  1843 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' );
  1867 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' );
  1844 	$id = (int) $id;
  1868 	$id = (int) $id;
  1861  *
  1885  *
  1862  * @since 2.1.0
  1886  * @since 2.1.0
  1863  * @deprecated 2.5.0 Use wp_get_attachment_image_src()
  1887  * @deprecated 2.5.0 Use wp_get_attachment_image_src()
  1864  * @see wp_get_attachment_image_src()
  1888  * @see wp_get_attachment_image_src()
  1865  *
  1889  *
  1866  * @param int $id Optional. Post ID.
  1890  * @param int  $id       Optional. Post ID.
  1867  * @param bool $fullsize Optional, default to false. Whether to have full image.
  1891  * @param bool $fullsize Optional. Whether to have full image. Default false.
  1868  * @return array Icon URL and full path to file, respectively.
  1892  * @return array Icon URL and full path to file, respectively.
  1869  */
  1893  */
  1870 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
  1894 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
  1871 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' );
  1895 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' );
  1872 	$id = (int) $id;
  1896 	$id = (int) $id;
  1874 		return false;
  1898 		return false;
  1875 
  1899 
  1876 	$file = get_attached_file( $post->ID );
  1900 	$file = get_attached_file( $post->ID );
  1877 
  1901 
  1878 	if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
  1902 	if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
  1879 		// We have a thumbnail desired, specified and existing
  1903 		// We have a thumbnail desired, specified and existing.
  1880 
  1904 
  1881 		$src_file = wp_basename($src);
  1905 		$src_file = wp_basename($src);
  1882 	} elseif ( wp_attachment_is_image( $post->ID ) ) {
  1906 	} elseif ( wp_attachment_is_image( $post->ID ) ) {
  1883 		// We have an image without a thumbnail
  1907 		// We have an image without a thumbnail.
  1884 
  1908 
  1885 		$src = wp_get_attachment_url( $post->ID );
  1909 		$src = wp_get_attachment_url( $post->ID );
  1886 		$src_file = & $file;
  1910 		$src_file = & $file;
  1887 	} elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
  1911 	} elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
  1888 		// No thumb, no image. We'll look for a mime-related icon instead.
  1912 		// No thumb, no image. We'll look for a mime-related icon instead.
  1902  *
  1926  *
  1903  * @since 2.0.0
  1927  * @since 2.0.0
  1904  * @deprecated 2.5.0 Use wp_get_attachment_image()
  1928  * @deprecated 2.5.0 Use wp_get_attachment_image()
  1905  * @see wp_get_attachment_image()
  1929  * @see wp_get_attachment_image()
  1906  *
  1930  *
  1907  * @param int $id Optional. Post ID.
  1931  * @param int   $id       Optional. Post ID.
  1908  * @param bool $fullsize Optional, default to false. Whether to have full size image.
  1932  * @param bool  $fullsize Optional. Whether to have full size image. Default false.
  1909  * @param array $max_dims Optional. Dimensions of image.
  1933  * @param array $max_dims Optional. Dimensions of image.
  1910  * @return false|string HTML content.
  1934  * @return string|false HTML content.
  1911  */
  1935  */
  1912 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
  1936 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
  1913 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
  1937 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
  1914 	$id = (int) $id;
  1938 	$id = (int) $id;
  1915 	if ( !$post = get_post($id) )
  1939 	if ( !$post = get_post($id) )
  1921 	list($src, $src_file) = $src;
  1945 	list($src, $src_file) = $src;
  1922 
  1946 
  1923 	// Do we need to constrain the image?
  1947 	// Do we need to constrain the image?
  1924 	if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
  1948 	if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
  1925 
  1949 
  1926 		$imagesize = getimagesize($src_file);
  1950 		$imagesize = @getimagesize($src_file);
  1927 
  1951 
  1928 		if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
  1952 		if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
  1929 			$actual_aspect = $imagesize[0] / $imagesize[1];
  1953 			$actual_aspect = $imagesize[0] / $imagesize[1];
  1930 			$desired_aspect = $max_dims[0] / $max_dims[1];
  1954 			$desired_aspect = $max_dims[0] / $max_dims[1];
  1931 
  1955 
  1958  *
  1982  *
  1959  * @since 2.0.0
  1983  * @since 2.0.0
  1960  * @deprecated 2.5.0 Use wp_get_attachment_image()
  1984  * @deprecated 2.5.0 Use wp_get_attachment_image()
  1961  * @see wp_get_attachment_image()
  1985  * @see wp_get_attachment_image()
  1962  *
  1986  *
  1963  * @param int $id Optional. Post ID.
  1987  * @param int   $id       Optional. Post ID.
  1964  * @param bool $fullsize Optional, default to false. Whether to have full size image.
  1988  * @param bool  $fullsize Optional. Whether to have full size image. Default false.
  1965  * @param array $max_dims Optional. Dimensions of image.
  1989  * @param array $max_dims Optional. Dimensions of image.
  1966  * @return false|string
  1990  * @return string|false
  1967  */
  1991  */
  1968 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
  1992 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
  1969 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
  1993 	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
  1970 	$id = (int) $id;
  1994 	$id = (int) $id;
  1971 	if ( !$post = get_post($id) )
  1995 	if ( !$post = get_post($id) )
  2068  * @return string Escaped `$string`.
  2092  * @return string Escaped `$string`.
  2069  */
  2093  */
  2070 function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
  2094 function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
  2071 	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
  2095 	_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
  2072 	if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
  2096 	if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
  2073 		$args = func_get_args();
  2097 		return _wp_specialchars( $string, $quote_style, $charset, $double_encode );
  2074 		return call_user_func_array( '_wp_specialchars', $args );
       
  2075 	} else {
  2098 	} else {
  2076 		return esc_html( $string );
  2099 		return esc_html( $string );
  2077 	}
  2100 	}
  2078 }
  2101 }
  2079 
  2102 
  2107  * @see wp_register_sidebar_widget()
  2130  * @see wp_register_sidebar_widget()
  2108  *
  2131  *
  2109  * @param string|int $name            Widget ID.
  2132  * @param string|int $name            Widget ID.
  2110  * @param callable   $output_callback Run when widget is called.
  2133  * @param callable   $output_callback Run when widget is called.
  2111  * @param string     $classname       Optional. Classname widget option. Default empty.
  2134  * @param string     $classname       Optional. Classname widget option. Default empty.
  2112  * @param mixed      $params ,...     Widget parameters.
  2135  * @param mixed      ...$params       Widget parameters.
  2113  */
  2136  */
  2114 function register_sidebar_widget($name, $output_callback, $classname = '') {
  2137 function register_sidebar_widget($name, $output_callback, $classname = '', ...$params) {
  2115 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
  2138 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_sidebar_widget()' );
  2116 	// Compat
  2139 	// Compat.
  2117 	if ( is_array($name) ) {
  2140 	if ( is_array( $name ) ) {
  2118 		if ( count($name) == 3 )
  2141 		if ( count( $name ) === 3 ) {
  2119 			$name = sprintf($name[0], $name[2]);
  2142 			$name = sprintf( $name[0], $name[2] );
  2120 		else
  2143 		} else {
  2121 			$name = $name[0];
  2144 			$name = $name[0];
       
  2145 		}
  2122 	}
  2146 	}
  2123 
  2147 
  2124 	$id = sanitize_title($name);
  2148 	$id      = sanitize_title( $name );
  2125 	$options = array();
  2149 	$options = array();
  2126 	if ( !empty($classname) && is_string($classname) )
  2150 	if ( ! empty( $classname ) && is_string( $classname ) ) {
  2127 		$options['classname'] = $classname;
  2151 		$options['classname'] = $classname;
  2128 	$params = array_slice(func_get_args(), 2);
  2152 	}
  2129 	$args = array($id, $name, $output_callback, $options);
  2153 
  2130 	if ( !empty($params) )
  2154 	wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params );
  2131 		$args = array_merge($args, $params);
       
  2132 
       
  2133 	call_user_func_array('wp_register_sidebar_widget', $args);
       
  2134 }
  2155 }
  2135 
  2156 
  2136 /**
  2157 /**
  2137  * Serves as an alias of wp_unregister_sidebar_widget().
  2158  * Serves as an alias of wp_unregister_sidebar_widget().
  2138  *
  2159  *
  2159  *
  2180  *
  2160  * @since 2.2.0
  2181  * @since 2.2.0
  2161  * @deprecated 2.8.0 Use wp_register_widget_control()
  2182  * @deprecated 2.8.0 Use wp_register_widget_control()
  2162  * @see wp_register_widget_control()
  2183  * @see wp_register_widget_control()
  2163  *
  2184  *
  2164  * @param int|string $name Sidebar ID.
  2185  * @param int|string $name             Sidebar ID.
  2165  * @param callable $control_callback Widget control callback to display and process form.
  2186  * @param callable   $control_callback Widget control callback to display and process form.
  2166  * @param int $width Widget width.
  2187  * @param int        $width            Widget width.
  2167  * @param int $height Widget height.
  2188  * @param int        $height           Widget height.
  2168  */
  2189  * @param mixed      ...$params        Widget parameters.
  2169 function register_widget_control($name, $control_callback, $width = '', $height = '') {
  2190  */
       
  2191 function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) {
  2170 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
  2192 	_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
  2171 	// Compat
  2193 	// Compat.
  2172 	if ( is_array($name) ) {
  2194 	if ( is_array( $name ) ) {
  2173 		if ( count($name) == 3 )
  2195 		if ( count( $name ) === 3 ) {
  2174 			$name = sprintf($name[0], $name[2]);
  2196 			$name = sprintf( $name[0], $name[2] );
  2175 		else
  2197 		} else {
  2176 			$name = $name[0];
  2198 			$name = $name[0];
       
  2199 		}
  2177 	}
  2200 	}
  2178 
  2201 
  2179 	$id = sanitize_title($name);
  2202 	$id      = sanitize_title( $name );
  2180 	$options = array();
  2203 	$options = array();
  2181 	if ( !empty($width) )
  2204 	if ( ! empty( $width ) ) {
  2182 		$options['width'] = $width;
  2205 		$options['width'] = $width;
  2183 	if ( !empty($height) )
  2206 	}
       
  2207 	if ( ! empty( $height ) ) {
  2184 		$options['height'] = $height;
  2208 		$options['height'] = $height;
  2185 	$params = array_slice(func_get_args(), 4);
  2209 	}
  2186 	$args = array($id, $name, $control_callback, $options);
  2210 
  2187 	if ( !empty($params) )
  2211 	wp_register_widget_control( $id, $name, $control_callback, $options, ...$params );
  2188 		$args = array_merge($args, $params);
       
  2189 
       
  2190 	call_user_func_array('wp_register_widget_control', $args);
       
  2191 }
  2212 }
  2192 
  2213 
  2193 /**
  2214 /**
  2194  * Alias of wp_unregister_widget_control().
  2215  * Alias of wp_unregister_widget_control().
  2195  *
  2216  *
  2211  * @deprecated 3.0.0 Use delete_user_meta()
  2232  * @deprecated 3.0.0 Use delete_user_meta()
  2212  * @see delete_user_meta()
  2233  * @see delete_user_meta()
  2213  *
  2234  *
  2214  * @param int $user_id User ID.
  2235  * @param int $user_id User ID.
  2215  * @param string $meta_key Metadata key.
  2236  * @param string $meta_key Metadata key.
  2216  * @param mixed $meta_value Metadata value.
  2237  * @param mixed $meta_value Optional. Metadata value. Default empty.
  2217  * @return bool True deletion completed and false if user_id is not a number.
  2238  * @return bool True deletion completed and false if user_id is not a number.
  2218  */
  2239  */
  2219 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
  2240 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
  2220 	_deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' );
  2241 	_deprecated_function( __FUNCTION__, '3.0.0', 'delete_user_meta()' );
  2221 	global $wpdb;
  2242 	global $wpdb;
  2257  * @since 2.0.0
  2278  * @since 2.0.0
  2258  * @deprecated 3.0.0 Use get_user_meta()
  2279  * @deprecated 3.0.0 Use get_user_meta()
  2259  * @see get_user_meta()
  2280  * @see get_user_meta()
  2260  *
  2281  *
  2261  * @param int $user_id User ID
  2282  * @param int $user_id User ID
  2262  * @param string $meta_key Optional. Metadata key.
  2283  * @param string $meta_key Optional. Metadata key. Default empty.
  2263  * @return mixed
  2284  * @return mixed
  2264  */
  2285  */
  2265 function get_usermeta( $user_id, $meta_key = '' ) {
  2286 function get_usermeta( $user_id, $meta_key = '' ) {
  2266 	_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' );
  2287 	_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' );
  2267 	global $wpdb;
  2288 	global $wpdb;
  2271 		return false;
  2292 		return false;
  2272 
  2293 
  2273 	if ( !empty($meta_key) ) {
  2294 	if ( !empty($meta_key) ) {
  2274 		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
  2295 		$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
  2275 		$user = wp_cache_get($user_id, 'users');
  2296 		$user = wp_cache_get($user_id, 'users');
  2276 		// Check the cached user object
  2297 		// Check the cached user object.
  2277 		if ( false !== $user && isset($user->$meta_key) )
  2298 		if ( false !== $user && isset($user->$meta_key) )
  2278 			$metas = array($user->$meta_key);
  2299 			$metas = array($user->$meta_key);
  2279 		else
  2300 		else
  2280 			$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
  2301 			$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
  2281 	} else {
  2302 	} else {
  2362  *
  2383  *
  2363  * @since 2.2.0
  2384  * @since 2.2.0
  2364  * @deprecated 3.1.0 Use get_users()
  2385  * @deprecated 3.1.0 Use get_users()
  2365  * @see get_users()
  2386  * @see get_users()
  2366  *
  2387  *
  2367  * @global wpdb $wpdb    WordPress database abstraction object.
  2388  * @global wpdb $wpdb WordPress database abstraction object.
  2368  *
  2389  *
  2369  * @param int $id Site ID.
  2390  * @param int $id Site ID.
  2370  * @return array List of users that are part of that site ID
  2391  * @return array List of users that are part of that site ID
  2371  */
  2392  */
  2372 function get_users_of_blog( $id = '' ) {
  2393 function get_users_of_blog( $id = '' ) {
  2386  *
  2407  *
  2387  * @since 2.8.0
  2408  * @since 2.8.0
  2388  * @deprecated 3.0.0 Use add_theme_support()
  2409  * @deprecated 3.0.0 Use add_theme_support()
  2389  * @see add_theme_support()
  2410  * @see add_theme_support()
  2390  *
  2411  *
  2391  * @param bool $add Optional, default is true. Add or remove links. Defaults to true.
  2412  * @param bool $add Optional. Add or remove links. Default true.
  2392  */
  2413  */
  2393 function automatic_feed_links( $add = true ) {
  2414 function automatic_feed_links( $add = true ) {
  2394 	_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
  2415 	_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
  2395 
  2416 
  2396 	if ( $add )
  2417 	if ( $add )
  2397 		add_theme_support( 'automatic-feed-links' );
  2418 		add_theme_support( 'automatic-feed-links' );
  2398 	else
  2419 	else
  2399 		remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
  2420 		remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+.
  2400 }
  2421 }
  2401 
  2422 
  2402 /**
  2423 /**
  2403  * Retrieve user data based on field.
  2424  * Retrieve user data based on field.
  2404  *
  2425  *
  2405  * @since 1.5.0
  2426  * @since 1.5.0
  2406  * @deprecated 3.0.0 Use get_the_author_meta()
  2427  * @deprecated 3.0.0 Use get_the_author_meta()
  2407  * @see get_the_author_meta()
  2428  * @see get_the_author_meta()
  2408  *
  2429  *
  2409  * @param string    $field User meta field.
  2430  * @param string    $field User meta field.
  2410  * @param false|int $user Optional. User ID to retrieve the field for. Default false (current user).
  2431  * @param false|int $user  Optional. User ID to retrieve the field for. Default false (current user).
  2411  * @return string The author's field from the current author's DB object.
  2432  * @return string The author's field from the current author's DB object.
  2412  */
  2433  */
  2413 function get_profile( $field, $user = false ) {
  2434 function get_profile( $field, $user = false ) {
  2414 	_deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' );
  2435 	_deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' );
  2415 	if ( $user ) {
  2436 	if ( $user ) {
  2498  * @see term_exists()
  2519  * @see term_exists()
  2499  *
  2520  *
  2500  * @param int|string $term The term to check
  2521  * @param int|string $term The term to check
  2501  * @param string $taxonomy The taxonomy name to use
  2522  * @param string $taxonomy The taxonomy name to use
  2502  * @param int $parent ID of parent term under which to confine the exists search.
  2523  * @param int $parent ID of parent term under which to confine the exists search.
  2503  * @return mixed Get the term id or Term Object, if exists.
  2524  * @return mixed Get the term ID or term object, if exists.
  2504  */
  2525  */
  2505 function is_term( $term, $taxonomy = '', $parent = 0 ) {
  2526 function is_term( $term, $taxonomy = '', $parent = 0 ) {
  2506 	_deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' );
  2527 	_deprecated_function( __FUNCTION__, '3.0.0', 'term_exists()' );
  2507 	return term_exists( $term, $taxonomy, $parent );
  2528 	return term_exists( $term, $taxonomy, $parent );
  2508 }
  2529 }
  2509 
  2530 
  2510 /**
  2531 /**
  2511  * Determines whether the current admin page is generated by a plugin.
  2532  * Determines whether the current admin page is generated by a plugin.
  2512  *
  2533  *
  2513  * Use global $plugin_page and/or get_plugin_page_hookname() hooks.
  2534  * Use global $plugin_page and/or get_plugin_page_hookname() hooks.
  2514  * 
  2535  *
  2515  * For more information on this and similar theme functions, check out
  2536  * For more information on this and similar theme functions, check out
  2516  * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 
  2537  * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
  2517  * Conditional Tags} article in the Theme Developer Handbook.
  2538  * Conditional Tags} article in the Theme Developer Handbook.
  2518  * 
  2539  *
  2519  * @since 1.5.0
  2540  * @since 1.5.0
  2520  * @deprecated 3.1.0
  2541  * @deprecated 3.1.0
  2521  *
  2542  *
  2522  * @global $plugin_page
  2543  * @global $plugin_page
  2523  *
  2544  *
  2623  * If the context is 'raw', then the user object or array will get minimal santization of the int fields.
  2644  * If the context is 'raw', then the user object or array will get minimal santization of the int fields.
  2624  *
  2645  *
  2625  * @since 2.3.0
  2646  * @since 2.3.0
  2626  * @deprecated 3.3.0
  2647  * @deprecated 3.3.0
  2627  *
  2648  *
  2628  * @param object|array $user The User Object or Array
  2649  * @param object|array $user    The user object or array.
  2629  * @param string $context Optional, default is 'display'. How to sanitize user fields.
  2650  * @param string       $context Optional. How to sanitize user fields. Default 'display'.
  2630  * @return object|array The now sanitized User Object or Array (will be the same type as $user)
  2651  * @return object|array The now sanitized user object or array (will be the same type as $user).
  2631  */
  2652  */
  2632 function sanitize_user_object($user, $context = 'display') {
  2653 function sanitize_user_object($user, $context = 'display') {
  2633 	_deprecated_function( __FUNCTION__, '3.3.0' );
  2654 	_deprecated_function( __FUNCTION__, '3.3.0' );
  2634 
  2655 
  2635 	if ( is_object($user) ) {
  2656 	if ( is_object($user) ) {
  2660  * Can either be start or end post relational link.
  2681  * Can either be start or end post relational link.
  2661  *
  2682  *
  2662  * @since 2.8.0
  2683  * @since 2.8.0
  2663  * @deprecated 3.3.0
  2684  * @deprecated 3.3.0
  2664  *
  2685  *
  2665  * @param string $title Optional. Link title format.
  2686  * @param string $title               Optional. Link title format. Default '%title'.
  2666  * @param bool $in_same_cat Optional. Whether link should be in a same category.
  2687  * @param bool   $in_same_cat         Optional. Whether link should be in a same category.
  2667  * @param string $excluded_categories Optional. Excluded categories IDs.
  2688  *                                    Default false.
  2668  * @param bool $start Optional, default is true. Whether to display link to first or last post.
  2689  * @param string $excluded_categories Optional. Excluded categories IDs. Default empty.
       
  2690  * @param bool   $start               Optional. Whether to display link to first or last post.
       
  2691  *                                    Default true.
  2669  * @return string
  2692  * @return string
  2670  */
  2693  */
  2671 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
  2694 function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
  2672 	_deprecated_function( __FUNCTION__, '3.3.0' );
  2695 	_deprecated_function( __FUNCTION__, '3.3.0' );
  2673 
  2696 
  2674 	$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
  2697 	$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
  2675 	// If there is no post stop.
  2698 	// If there is no post, stop.
  2676 	if ( empty($posts) )
  2699 	if ( empty($posts) )
  2677 		return;
  2700 		return;
  2678 
  2701 
  2679 	// Even though we limited get_posts to return only 1 item it still returns an array of objects.
  2702 	// Even though we limited get_posts() to return only 1 item it still returns an array of objects.
  2680 	$post = $posts[0];
  2703 	$post = $posts[0];
  2681 
  2704 
  2682 	if ( empty($post->post_title) )
  2705 	if ( empty($post->post_title) )
  2683 		$post->post_title = $start ? __('First Post') : __('Last Post');
  2706 		$post->post_title = $start ? __('First Post') : __('Last Post');
  2684 
  2707 
  2828  *
  2851  *
  2829  * @since 0.71
  2852  * @since 0.71
  2830  * @deprecated 3.4.0 Use error_log()
  2853  * @deprecated 3.4.0 Use error_log()
  2831  * @see error_log()
  2854  * @see error_log()
  2832  *
  2855  *
  2833  * @link https://secure.php.net/manual/en/function.error-log.php
  2856  * @link https://www.php.net/manual/en/function.error-log.php
  2834  *
  2857  *
  2835  * @param string $filename File name.
  2858  * @param string $filename File name.
  2836  * @param string $mode     Type of access you required to the stream.
  2859  * @param string $mode     Type of access you required to the stream.
  2837  * @return false Always false.
  2860  * @return false Always false.
  2838  */
  2861  */
  2846  *
  2869  *
  2847  * @since 0.71
  2870  * @since 0.71
  2848  * @deprecated 3.4.0 Use error_log()
  2871  * @deprecated 3.4.0 Use error_log()
  2849  * @see error_log()
  2872  * @see error_log()
  2850  *
  2873  *
  2851  * @link https://secure.php.net/manual/en/function.error-log.php
  2874  * @link https://www.php.net/manual/en/function.error-log.php
  2852  *
  2875  *
  2853  * @param mixed  $fp     Unused.
  2876  * @param mixed  $fp     Unused.
  2854  * @param string $string Message to log.
  2877  * @param string $string Message to log.
  2855  */
  2878  */
  2856 function debug_fwrite( $fp, $string ) {
  2879 function debug_fwrite( $fp, $string ) {
  2864  *
  2887  *
  2865  * @since 0.71
  2888  * @since 0.71
  2866  * @deprecated 3.4.0 Use error_log()
  2889  * @deprecated 3.4.0 Use error_log()
  2867  * @see error_log()
  2890  * @see error_log()
  2868  *
  2891  *
  2869  * @link https://secure.php.net/manual/en/function.error-log.php
  2892  * @link https://www.php.net/manual/en/function.error-log.php
  2870  *
  2893  *
  2871  * @param mixed $fp Unused.
  2894  * @param mixed $fp Unused.
  2872  */
  2895  */
  2873 function debug_fclose( $fp ) {
  2896 function debug_fclose( $fp ) {
  2874 	_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
  2897 	_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
  2947 
  2970 
  2948 /**
  2971 /**
  2949  * Accepts matches array from preg_replace_callback in wpautop() or a string.
  2972  * Accepts matches array from preg_replace_callback in wpautop() or a string.
  2950  *
  2973  *
  2951  * Ensures that the contents of a `<pre>...</pre>` HTML block are not
  2974  * Ensures that the contents of a `<pre>...</pre>` HTML block are not
  2952  * converted into paragraphs or line-breaks.
  2975  * converted into paragraphs or line breaks.
  2953  *
  2976  *
  2954  * @since 1.2.0
  2977  * @since 1.2.0
  2955  * @deprecated 3.4.0
  2978  * @deprecated 3.4.0
  2956  *
  2979  *
  2957  * @param array|string $matches The array or string
  2980  * @param array|string $matches The array or string
  2958  * @return string The pre block without paragraph/line-break conversion.
  2981  * @return string The pre block without paragraph/line break conversion.
  2959  */
  2982  */
  2960 function clean_pre($matches) {
  2983 function clean_pre($matches) {
  2961 	_deprecated_function( __FUNCTION__, '3.4.0' );
  2984 	_deprecated_function( __FUNCTION__, '3.4.0' );
  2962 
  2985 
  2963 	if ( is_array($matches) )
  2986 	if ( is_array($matches) )
  3180 
  3203 
  3181 	if ( is_numeric( $file ) )
  3204 	if ( is_numeric( $file ) )
  3182 		$file = get_attached_file( $file );
  3205 		$file = get_attached_file( $file );
  3183 
  3206 
  3184 	if ( ! is_file( $file ) ) {
  3207 	if ( ! is_file( $file ) ) {
  3185 		/* translators: %s: file name */
  3208 		/* translators: %s: File name. */
  3186 		return sprintf( __( 'File &#8220;%s&#8221; doesn&#8217;t exist?' ), $file );
  3209 		return sprintf( __( 'File &#8220;%s&#8221; doesn&#8217;t exist?' ), $file );
  3187 	}
  3210 	}
  3188 
  3211 
  3189 	if ( ! function_exists('imagecreatefromstring') )
  3212 	if ( ! function_exists('imagecreatefromstring') )
  3190 		return __('The GD image library is not installed.');
  3213 		return __('The GD image library is not installed.');
  3193 	wp_raise_memory_limit( 'image' );
  3216 	wp_raise_memory_limit( 'image' );
  3194 
  3217 
  3195 	$image = imagecreatefromstring( file_get_contents( $file ) );
  3218 	$image = imagecreatefromstring( file_get_contents( $file ) );
  3196 
  3219 
  3197 	if ( ! is_resource( $image ) ) {
  3220 	if ( ! is_resource( $image ) ) {
  3198 		/* translators: %s: file name */
  3221 		/* translators: %s: File name. */
  3199 		return sprintf( __( 'File &#8220;%s&#8221; is not an image.' ), $file );
  3222 		return sprintf( __( 'File &#8220;%s&#8221; is not an image.' ), $file );
  3200 	}
  3223 	}
  3201 
  3224 
  3202 	return $image;
  3225 	return $image;
  3203 }
  3226 }
  3215  *
  3238  *
  3216  * @since 2.5.0
  3239  * @since 2.5.0
  3217  * @deprecated 3.5.0 Use wp_get_image_editor()
  3240  * @deprecated 3.5.0 Use wp_get_image_editor()
  3218  * @see wp_get_image_editor()
  3241  * @see wp_get_image_editor()
  3219  *
  3242  *
  3220  * @param string $file Image file path.
  3243  * @param string $file         Image file path.
  3221  * @param int $max_w Maximum width to resize to.
  3244  * @param int    $max_w        Maximum width to resize to.
  3222  * @param int $max_h Maximum height to resize to.
  3245  * @param int    $max_h        Maximum height to resize to.
  3223  * @param bool $crop Optional. Whether to crop image or resize.
  3246  * @param bool   $crop         Optional. Whether to crop image or resize. Default false.
  3224  * @param string $suffix Optional. File suffix.
  3247  * @param string $suffix       Optional. File suffix. Default null.
  3225  * @param string $dest_path Optional. New image file path.
  3248  * @param string $dest_path    Optional. New image file path. Default null.
  3226  * @param int $jpeg_quality Optional, default is 90. Image quality percentage.
  3249  * @param int    $jpeg_quality Optional. Image quality percentage. Default 90.
  3227  * @return mixed WP_Error on failure. String with new destination path.
  3250  * @return mixed WP_Error on failure. String with new destination path.
  3228  */
  3251  */
  3229 function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
  3252 function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
  3230 	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
  3253 	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
  3231 
  3254 
  3343 	_deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' );
  3366 	_deprecated_function( __FUNCTION__, '3.6.0', 'size_format()' );
  3344 
  3367 
  3345 	$units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
  3368 	$units = array( 0 => 'B', 1 => 'KB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
  3346 	$log   = log( $bytes, KB_IN_BYTES );
  3369 	$log   = log( $bytes, KB_IN_BYTES );
  3347 	$power = (int) $log;
  3370 	$power = (int) $log;
  3348 	$size  = pow( KB_IN_BYTES, $log - $power );
  3371 	$size  = KB_IN_BYTES ** ( $log - $power );
  3349 
  3372 
  3350 	if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
  3373 	if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
  3351 		$unit = $units[ $power ];
  3374 		$unit = $units[ $power ];
  3352 	} else {
  3375 	} else {
  3353 		$size = $bytes;
  3376 		$size = $bytes;
  3596  */
  3619  */
  3597 function wp_htmledit_pre($output) {
  3620 function wp_htmledit_pre($output) {
  3598 	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
  3621 	_deprecated_function( __FUNCTION__, '4.3.0', 'format_for_editor()' );
  3599 
  3622 
  3600 	if ( !empty($output) )
  3623 	if ( !empty($output) )
  3601 		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // convert only < > &
  3624 		$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) ); // Convert only '< > &'.
  3602 
  3625 
  3603 	/**
  3626 	/**
  3604 	 * Filters the text before it is formatted for the HTML editor.
  3627 	 * Filters the text before it is formatted for the HTML editor.
  3605 	 *
  3628 	 *
  3606 	 * @since 2.5.0
  3629 	 * @since 2.5.0
  3673 	}
  3696 	}
  3674 
  3697 
  3675 	if ( false == $file_path )
  3698 	if ( false == $file_path )
  3676 		return $headers;
  3699 		return $headers;
  3677 
  3700 
  3678 	// GET request - write it to the supplied filename
  3701 	// GET request - write it to the supplied filename.
  3679 	$out_fp = fopen($file_path, 'w');
  3702 	$out_fp = fopen($file_path, 'w');
  3680 	if ( !$out_fp )
  3703 	if ( !$out_fp )
  3681 		return $headers;
  3704 		return $headers;
  3682 
  3705 
  3683 	fwrite( $out_fp,  wp_remote_retrieve_body( $response ) );
  3706 	fwrite( $out_fp,  wp_remote_retrieve_body( $response ) );
  3716 	return '';
  3739 	return '';
  3717 }
  3740 }
  3718 
  3741 
  3719 /**
  3742 /**
  3720  * Determines whether the current URL is within the comments popup window.
  3743  * Determines whether the current URL is within the comments popup window.
  3721  * 
  3744  *
  3722  * For more information on this and similar theme functions, check out
  3745  * For more information on this and similar theme functions, check out
  3723  * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ 
  3746  * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
  3724  * Conditional Tags} article in the Theme Developer Handbook.
  3747  * Conditional Tags} article in the Theme Developer Handbook.
  3725  * 
  3748  *
  3726  * @since 1.5.0
  3749  * @since 1.5.0
  3727  * @deprecated 4.5.0
  3750  * @deprecated 4.5.0
  3728  *
  3751  *
  3729  * @return bool
  3752  * @return false Always returns false.
  3730  */
  3753  */
  3731 function is_comments_popup() {
  3754 function is_comments_popup() {
  3732 	_deprecated_function( __FUNCTION__, '4.5.0' );
  3755 	_deprecated_function( __FUNCTION__, '4.5.0' );
  3733 
  3756 
  3734 	return false;
  3757 	return false;
  3926 * @deprecated 4.9.0
  3949 * @deprecated 4.9.0
  3927 */
  3950 */
  3928 function wp_ajax_press_this_save_post() {
  3951 function wp_ajax_press_this_save_post() {
  3929 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3952 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3930 	if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
  3953 	if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
  3931 		include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' );
  3954 		include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
  3932 		$wp_press_this = new WP_Press_This_Plugin();
  3955 		$wp_press_this = new WP_Press_This_Plugin();
  3933 		$wp_press_this->save_post();
  3956 		$wp_press_this->save_post();
  3934 	} else {
  3957 	} else {
  3935 		wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
  3958 		wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
  3936 	}
  3959 	}
  3943 * @deprecated 4.9.0
  3966 * @deprecated 4.9.0
  3944 */
  3967 */
  3945 function wp_ajax_press_this_add_category() {
  3968 function wp_ajax_press_this_add_category() {
  3946 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3969 	_deprecated_function( __FUNCTION__, '4.9.0' );
  3947 	if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
  3970 	if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
  3948 		include( WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php' );
  3971 		include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
  3949 		$wp_press_this = new WP_Press_This_Plugin();
  3972 		$wp_press_this = new WP_Press_This_Plugin();
  3950 		$wp_press_this->add_category();
  3973 		$wp_press_this->add_category();
  3951 	} else {
  3974 	} else {
  3952 		wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
  3975 		wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
  3953 	}
  3976 	}
  3954 }
  3977 }
       
  3978 
       
  3979 /**
       
  3980  * Return the user request object for the specified request ID.
       
  3981  *
       
  3982  * @since 4.9.6
       
  3983  * @deprecated 5.4.0 Use wp_get_user_request()
       
  3984  * @see wp_get_user_request()
       
  3985  *
       
  3986  * @param int $request_id The ID of the user request.
       
  3987  * @return WP_User_Request|false
       
  3988  */
       
  3989 function wp_get_user_request_data( $request_id ) {
       
  3990 	_deprecated_function( __FUNCTION__, '5.4.0', 'wp_get_user_request()' );
       
  3991 	return wp_get_user_request( $request_id );
       
  3992 }
       
  3993 
       
  3994 /**
       
  3995  * Filters 'img' elements in post content to add 'srcset' and 'sizes' attributes.
       
  3996  *
       
  3997  * @since 4.4.0
       
  3998  * @deprecated 5.5.0
       
  3999  *
       
  4000  * @see wp_image_add_srcset_and_sizes()
       
  4001  *
       
  4002  * @param string $content The raw post content to be filtered.
       
  4003  * @return string Converted content with 'srcset' and 'sizes' attributes added to images.
       
  4004  */
       
  4005 function wp_make_content_images_responsive( $content ) {
       
  4006 	_deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' );
       
  4007 
       
  4008 	// This will also add the `loading` attribute to `img` tags, if enabled.
       
  4009 	return wp_filter_content_tags( $content );
       
  4010 }
       
  4011 
       
  4012 /**
       
  4013  * Turn register globals off.
       
  4014  *
       
  4015  * @since 2.1.0
       
  4016  * @access private
       
  4017  * @deprecated 5.5.0
       
  4018  */
       
  4019 function wp_unregister_GLOBALS() {  // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
       
  4020 	// register_globals was deprecated in PHP 5.3 and removed entirely in PHP 5.4.
       
  4021 	_deprecated_function( __FUNCTION__, '5.5.0' );
       
  4022 }
       
  4023 
       
  4024 /**
       
  4025  * Does comment contain disallowed characters or words.
       
  4026  *
       
  4027  * @since 1.5.0
       
  4028  * @deprecated 5.5.0 Use wp_check_comment_disallowed_list() instead.
       
  4029  *                   Please consider writing more inclusive code.
       
  4030  *
       
  4031  * @param string $author The author of the comment
       
  4032  * @param string $email The email of the comment
       
  4033  * @param string $url The url used in the comment
       
  4034  * @param string $comment The comment content
       
  4035  * @param string $user_ip The comment author's IP address
       
  4036  * @param string $user_agent The author's browser user agent
       
  4037  * @return bool True if comment contains disallowed content, false if comment does not
       
  4038  */
       
  4039 function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) {
       
  4040 	_deprecated_function( __FUNCTION__, '5.5.0', 'wp_check_comment_disallowed_list()' );
       
  4041 
       
  4042 	return wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent );
       
  4043 }
       
  4044 
       
  4045 /**
       
  4046  * Filters out `register_meta()` args based on an allowed list.
       
  4047  *
       
  4048  * `register_meta()` args may change over time, so requiring the allowed list
       
  4049  * to be explicitly turned off is a warranty seal of sorts.
       
  4050  *
       
  4051  * @access private
       
  4052  * @since 4.6.0
       
  4053  * @deprecated 5.5.0 Use _wp_register_meta_args_allowed_list() instead.
       
  4054  *                   Please consider writing more inclusive code.
       
  4055  *
       
  4056  * @param array $args         Arguments from `register_meta()`.
       
  4057  * @param array $default_args Default arguments for `register_meta()`.
       
  4058  * @return array Filtered arguments.
       
  4059  */
       
  4060 function _wp_register_meta_args_whitelist( $args, $default_args ) {
       
  4061 	_deprecated_function( __FUNCTION__, '5.5.0', '_wp_register_meta_args_allowed_list()' );
       
  4062 
       
  4063 	return _wp_register_meta_args_allowed_list( $args, $default_args );
       
  4064 }
       
  4065 
       
  4066 /**
       
  4067  * Adds an array of options to the list of allowed options.
       
  4068  *
       
  4069  * @since 2.7.0
       
  4070  * @deprecated 5.5.0 Use add_allowed_options() instead.
       
  4071  *                   Please consider writing more inclusive code.
       
  4072  *
       
  4073  * @global array $allowed_options
       
  4074  *
       
  4075  * @param array        $new_options
       
  4076  * @param string|array $options
       
  4077  * @return array
       
  4078  */
       
  4079 function add_option_whitelist( $new_options, $options = '' ) {
       
  4080 	_deprecated_function( __FUNCTION__, '5.5.0', 'add_allowed_options()' );
       
  4081 
       
  4082 	return add_allowed_options( $new_options, $options );
       
  4083 }
       
  4084 
       
  4085 /**
       
  4086  * Removes a list of options from the allowed options list.
       
  4087  *
       
  4088  * @since 2.7.0
       
  4089  * @deprecated 5.5.0 Use remove_allowed_options() instead.
       
  4090  *                   Please consider writing more inclusive code.
       
  4091  *
       
  4092  * @global array $allowed_options
       
  4093  *
       
  4094  * @param array        $del_options
       
  4095  * @param string|array $options
       
  4096  * @return array
       
  4097  */
       
  4098 function remove_option_whitelist( $del_options, $options = '' ) {
       
  4099 	_deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' );
       
  4100 
       
  4101 	return remove_allowed_options( $del_options, $options );
       
  4102 }