PageRenderTime 55ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-admin/includes/deprecated.php

https://github.com/markjaquith/WordPress
PHP | 1569 lines | 543 code | 191 blank | 835 comment | 65 complexity | 733082b59e22f93d06d3a825b0f13eb1 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * Deprecated admin functions from past WordPress versions. You shouldn't use these
  4. * functions and look for the alternatives instead. The functions will be removed
  5. * in a later version.
  6. *
  7. * @package WordPress
  8. * @subpackage Deprecated
  9. */
  10. /*
  11. * Deprecated functions come here to die.
  12. */
  13. /**
  14. * @since 2.1.0
  15. * @deprecated 2.1.0 Use wp_editor()
  16. * @see wp_editor()
  17. */
  18. function tinymce_include() {
  19. _deprecated_function( __FUNCTION__, '2.1.0', 'wp_editor()' );
  20. wp_tiny_mce();
  21. }
  22. /**
  23. * Unused Admin function.
  24. *
  25. * @since 2.0.0
  26. * @deprecated 2.5.0
  27. *
  28. */
  29. function documentation_link() {
  30. _deprecated_function( __FUNCTION__, '2.5.0' );
  31. }
  32. /**
  33. * Calculates the new dimensions for a downsampled image.
  34. *
  35. * @since 2.0.0
  36. * @deprecated 3.0.0 Use wp_constrain_dimensions()
  37. * @see wp_constrain_dimensions()
  38. *
  39. * @param int $width Current width of the image
  40. * @param int $height Current height of the image
  41. * @param int $wmax Maximum wanted width
  42. * @param int $hmax Maximum wanted height
  43. * @return array Shrunk dimensions (width, height).
  44. */
  45. function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
  46. _deprecated_function( __FUNCTION__, '3.0.0', 'wp_constrain_dimensions()' );
  47. return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
  48. }
  49. /**
  50. * Calculated the new dimensions for a downsampled image.
  51. *
  52. * @since 2.0.0
  53. * @deprecated 3.5.0 Use wp_constrain_dimensions()
  54. * @see wp_constrain_dimensions()
  55. *
  56. * @param int $width Current width of the image
  57. * @param int $height Current height of the image
  58. * @return array Shrunk dimensions (width, height).
  59. */
  60. function get_udims( $width, $height ) {
  61. _deprecated_function( __FUNCTION__, '3.5.0', 'wp_constrain_dimensions()' );
  62. return wp_constrain_dimensions( $width, $height, 128, 96 );
  63. }
  64. /**
  65. * Legacy function used to generate the categories checklist control.
  66. *
  67. * @since 0.71
  68. * @deprecated 2.6.0 Use wp_category_checklist()
  69. * @see wp_category_checklist()
  70. *
  71. * @global int $post_ID
  72. *
  73. * @param int $default Unused.
  74. * @param int $parent Unused.
  75. * @param array $popular_ids Unused.
  76. */
  77. function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
  78. _deprecated_function( __FUNCTION__, '2.6.0', 'wp_category_checklist()' );
  79. global $post_ID;
  80. wp_category_checklist( $post_ID );
  81. }
  82. /**
  83. * Legacy function used to generate a link categories checklist control.
  84. *
  85. * @since 2.1.0
  86. * @deprecated 2.6.0 Use wp_link_category_checklist()
  87. * @see wp_link_category_checklist()
  88. *
  89. * @global int $link_id
  90. *
  91. * @param int $default Unused.
  92. */
  93. function dropdown_link_categories( $default = 0 ) {
  94. _deprecated_function( __FUNCTION__, '2.6.0', 'wp_link_category_checklist()' );
  95. global $link_id;
  96. wp_link_category_checklist( $link_id );
  97. }
  98. /**
  99. * Get the real filesystem path to a file to edit within the admin.
  100. *
  101. * @since 1.5.0
  102. * @deprecated 2.9.0
  103. * @uses WP_CONTENT_DIR Full filesystem path to the wp-content directory.
  104. *
  105. * @param string $file Filesystem path relative to the wp-content directory.
  106. * @return string Full filesystem path to edit.
  107. */
  108. function get_real_file_to_edit( $file ) {
  109. _deprecated_function( __FUNCTION__, '2.9.0' );
  110. return WP_CONTENT_DIR . $file;
  111. }
  112. /**
  113. * Legacy function used for generating a categories drop-down control.
  114. *
  115. * @since 1.2.0
  116. * @deprecated 3.0.0 Use wp_dropdown_categories()
  117. * @see wp_dropdown_categories()
  118. *
  119. * @param int $currentcat Optional. ID of the current category. Default 0.
  120. * @param int $currentparent Optional. Current parent category ID. Default 0.
  121. * @param int $parent Optional. Parent ID to retrieve categories for. Default 0.
  122. * @param int $level Optional. Number of levels deep to display. Default 0.
  123. * @param array $categories Optional. Categories to include in the control. Default 0.
  124. * @return void|false Void on success, false if no categories were found.
  125. */
  126. function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
  127. _deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' );
  128. if (!$categories )
  129. $categories = get_categories( array('hide_empty' => 0) );
  130. if ( $categories ) {
  131. foreach ( $categories as $category ) {
  132. if ( $currentcat != $category->term_id && $parent == $category->parent) {
  133. $pad = str_repeat( '&#8211; ', $level );
  134. $category->name = esc_html( $category->name );
  135. echo "\n\t<option value='$category->term_id'";
  136. if ( $currentparent == $category->term_id )
  137. echo " selected='selected'";
  138. echo ">$pad$category->name</option>";
  139. wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
  140. }
  141. }
  142. } else {
  143. return false;
  144. }
  145. }
  146. /**
  147. * Register a setting and its sanitization callback
  148. *
  149. * @since 2.7.0
  150. * @deprecated 3.0.0 Use register_setting()
  151. * @see register_setting()
  152. *
  153. * @param string $option_group A settings group name. Should correspond to an allowed option key name.
  154. * Default allowed option key names include 'general', 'discussion', 'media',
  155. * 'reading', 'writing', and 'options'.
  156. * @param string $option_name The name of an option to sanitize and save.
  157. * @param callable $sanitize_callback Optional. A callback function that sanitizes the option's value.
  158. */
  159. function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
  160. _deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' );
  161. register_setting( $option_group, $option_name, $sanitize_callback );
  162. }
  163. /**
  164. * Unregister a setting
  165. *
  166. * @since 2.7.0
  167. * @deprecated 3.0.0 Use unregister_setting()
  168. * @see unregister_setting()
  169. *
  170. * @param string $option_group The settings group name used during registration.
  171. * @param string $option_name The name of the option to unregister.
  172. * @param callable $sanitize_callback Optional. Deprecated.
  173. */
  174. function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
  175. _deprecated_function( __FUNCTION__, '3.0.0', 'unregister_setting()' );
  176. unregister_setting( $option_group, $option_name, $sanitize_callback );
  177. }
  178. /**
  179. * Determines the language to use for CodePress syntax highlighting.
  180. *
  181. * @since 2.8.0
  182. * @deprecated 3.0.0
  183. *
  184. * @param string $filename
  185. **/
  186. function codepress_get_lang( $filename ) {
  187. _deprecated_function( __FUNCTION__, '3.0.0' );
  188. }
  189. /**
  190. * Adds JavaScript required to make CodePress work on the theme/plugin file editors.
  191. *
  192. * @since 2.8.0
  193. * @deprecated 3.0.0
  194. **/
  195. function codepress_footer_js() {
  196. _deprecated_function( __FUNCTION__, '3.0.0' );
  197. }
  198. /**
  199. * Determine whether to use CodePress.
  200. *
  201. * @since 2.8.0
  202. * @deprecated 3.0.0
  203. **/
  204. function use_codepress() {
  205. _deprecated_function( __FUNCTION__, '3.0.0' );
  206. }
  207. /**
  208. * Get all user IDs.
  209. *
  210. * @deprecated 3.1.0 Use get_users()
  211. *
  212. * @global wpdb $wpdb WordPress database abstraction object.
  213. *
  214. * @return array List of user IDs.
  215. */
  216. function get_author_user_ids() {
  217. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
  218. global $wpdb;
  219. if ( !is_multisite() )
  220. $level_key = $wpdb->get_blog_prefix() . 'user_level';
  221. else
  222. $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
  223. return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
  224. }
  225. /**
  226. * Gets author users who can edit posts.
  227. *
  228. * @deprecated 3.1.0 Use get_users()
  229. *
  230. * @global wpdb $wpdb WordPress database abstraction object.
  231. *
  232. * @param int $user_id User ID.
  233. * @return array|false List of editable authors. False if no editable users.
  234. */
  235. function get_editable_authors( $user_id ) {
  236. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
  237. global $wpdb;
  238. $editable = get_editable_user_ids( $user_id );
  239. if ( !$editable ) {
  240. return false;
  241. } else {
  242. $editable = join(',', $editable);
  243. $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
  244. }
  245. return apply_filters('get_editable_authors', $authors);
  246. }
  247. /**
  248. * Gets the IDs of any users who can edit posts.
  249. *
  250. * @deprecated 3.1.0 Use get_users()
  251. *
  252. * @global wpdb $wpdb WordPress database abstraction object.
  253. *
  254. * @param int $user_id User ID.
  255. * @param bool $exclude_zeros Optional. Whether to exclude zeroes. Default true.
  256. * @return array Array of editable user IDs, empty array otherwise.
  257. */
  258. function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
  259. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
  260. global $wpdb;
  261. if ( ! $user = get_userdata( $user_id ) )
  262. return array();
  263. $post_type_obj = get_post_type_object($post_type);
  264. if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
  265. if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
  266. return array($user->ID);
  267. else
  268. return array();
  269. }
  270. if ( !is_multisite() )
  271. $level_key = $wpdb->get_blog_prefix() . 'user_level';
  272. else
  273. $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
  274. $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
  275. if ( $exclude_zeros )
  276. $query .= " AND meta_value != '0'";
  277. return $wpdb->get_col( $query );
  278. }
  279. /**
  280. * Gets all users who are not authors.
  281. *
  282. * @deprecated 3.1.0 Use get_users()
  283. *
  284. * @global wpdb $wpdb WordPress database abstraction object.
  285. */
  286. function get_nonauthor_user_ids() {
  287. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
  288. global $wpdb;
  289. if ( !is_multisite() )
  290. $level_key = $wpdb->get_blog_prefix() . 'user_level';
  291. else
  292. $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
  293. return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
  294. }
  295. if ( ! class_exists( 'WP_User_Search', false ) ) :
  296. /**
  297. * WordPress User Search class.
  298. *
  299. * @since 2.1.0
  300. * @deprecated 3.1.0 Use WP_User_Query
  301. */
  302. class WP_User_Search {
  303. /**
  304. * {@internal Missing Description}}
  305. *
  306. * @since 2.1.0
  307. * @access private
  308. * @var mixed
  309. */
  310. var $results;
  311. /**
  312. * {@internal Missing Description}}
  313. *
  314. * @since 2.1.0
  315. * @access private
  316. * @var string
  317. */
  318. var $search_term;
  319. /**
  320. * Page number.
  321. *
  322. * @since 2.1.0
  323. * @access private
  324. * @var int
  325. */
  326. var $page;
  327. /**
  328. * Role name that users have.
  329. *
  330. * @since 2.5.0
  331. * @access private
  332. * @var string
  333. */
  334. var $role;
  335. /**
  336. * Raw page number.
  337. *
  338. * @since 2.1.0
  339. * @access private
  340. * @var int|bool
  341. */
  342. var $raw_page;
  343. /**
  344. * Amount of users to display per page.
  345. *
  346. * @since 2.1.0
  347. * @access public
  348. * @var int
  349. */
  350. var $users_per_page = 50;
  351. /**
  352. * {@internal Missing Description}}
  353. *
  354. * @since 2.1.0
  355. * @access private
  356. * @var int
  357. */
  358. var $first_user;
  359. /**
  360. * {@internal Missing Description}}
  361. *
  362. * @since 2.1.0
  363. * @access private
  364. * @var int
  365. */
  366. var $last_user;
  367. /**
  368. * {@internal Missing Description}}
  369. *
  370. * @since 2.1.0
  371. * @access private
  372. * @var string
  373. */
  374. var $query_limit;
  375. /**
  376. * {@internal Missing Description}}
  377. *
  378. * @since 3.0.0
  379. * @access private
  380. * @var string
  381. */
  382. var $query_orderby;
  383. /**
  384. * {@internal Missing Description}}
  385. *
  386. * @since 3.0.0
  387. * @access private
  388. * @var string
  389. */
  390. var $query_from;
  391. /**
  392. * {@internal Missing Description}}
  393. *
  394. * @since 3.0.0
  395. * @access private
  396. * @var string
  397. */
  398. var $query_where;
  399. /**
  400. * {@internal Missing Description}}
  401. *
  402. * @since 2.1.0
  403. * @access private
  404. * @var int
  405. */
  406. var $total_users_for_query = 0;
  407. /**
  408. * {@internal Missing Description}}
  409. *
  410. * @since 2.1.0
  411. * @access private
  412. * @var bool
  413. */
  414. var $too_many_total_users = false;
  415. /**
  416. * {@internal Missing Description}}
  417. *
  418. * @since 2.1.0
  419. * @access private
  420. * @var WP_Error
  421. */
  422. var $search_errors;
  423. /**
  424. * {@internal Missing Description}}
  425. *
  426. * @since 2.7.0
  427. * @access private
  428. * @var string
  429. */
  430. var $paging_text;
  431. /**
  432. * PHP5 Constructor - Sets up the object properties.
  433. *
  434. * @since 2.1.0
  435. *
  436. * @param string $search_term Search terms string.
  437. * @param int $page Optional. Page ID.
  438. * @param string $role Role name.
  439. * @return WP_User_Search
  440. */
  441. function __construct( $search_term = '', $page = '', $role = '' ) {
  442. _deprecated_function( __FUNCTION__, '3.1.0', 'WP_User_Query' );
  443. $this->search_term = wp_unslash( $search_term );
  444. $this->raw_page = ( '' == $page ) ? false : (int) $page;
  445. $this->page = ( '' == $page ) ? 1 : (int) $page;
  446. $this->role = $role;
  447. $this->prepare_query();
  448. $this->query();
  449. $this->do_paging();
  450. }
  451. /**
  452. * PHP4 Constructor - Sets up the object properties.
  453. *
  454. * @since 2.1.0
  455. *
  456. * @param string $search_term Search terms string.
  457. * @param int $page Optional. Page ID.
  458. * @param string $role Role name.
  459. * @return WP_User_Search
  460. */
  461. public function WP_User_Search( $search_term = '', $page = '', $role = '' ) {
  462. self::__construct( $search_term, $page, $role );
  463. }
  464. /**
  465. * Prepares the user search query (legacy).
  466. *
  467. * @since 2.1.0
  468. * @access public
  469. */
  470. public function prepare_query() {
  471. global $wpdb;
  472. $this->first_user = ($this->page - 1) * $this->users_per_page;
  473. $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
  474. $this->query_orderby = ' ORDER BY user_login';
  475. $search_sql = '';
  476. if ( $this->search_term ) {
  477. $searches = array();
  478. $search_sql = 'AND (';
  479. foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
  480. $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
  481. $search_sql .= implode(' OR ', $searches);
  482. $search_sql .= ')';
  483. }
  484. $this->query_from = " FROM $wpdb->users";
  485. $this->query_where = " WHERE 1=1 $search_sql";
  486. if ( $this->role ) {
  487. $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
  488. $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
  489. } elseif ( is_multisite() ) {
  490. $level_key = $wpdb->prefix . 'capabilities'; // WPMU site admins don't have user_levels.
  491. $this->query_from .= ", $wpdb->usermeta";
  492. $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
  493. }
  494. do_action_ref_array( 'pre_user_search', array( &$this ) );
  495. }
  496. /**
  497. * Executes the user search query.
  498. *
  499. * @since 2.1.0
  500. * @access public
  501. */
  502. public function query() {
  503. global $wpdb;
  504. $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
  505. if ( $this->results )
  506. $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // No limit.
  507. else
  508. $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
  509. }
  510. /**
  511. * Prepares variables for use in templates.
  512. *
  513. * @since 2.1.0
  514. * @access public
  515. */
  516. function prepare_vars_for_template_usage() {}
  517. /**
  518. * Handles paging for the user search query.
  519. *
  520. * @since 2.1.0
  521. * @access public
  522. */
  523. public function do_paging() {
  524. if ( $this->total_users_for_query > $this->users_per_page ) { // Have to page the results.
  525. $args = array();
  526. if ( ! empty($this->search_term) )
  527. $args['usersearch'] = urlencode($this->search_term);
  528. if ( ! empty($this->role) )
  529. $args['role'] = urlencode($this->role);
  530. $this->paging_text = paginate_links( array(
  531. 'total' => ceil($this->total_users_for_query / $this->users_per_page),
  532. 'current' => $this->page,
  533. 'base' => 'users.php?%_%',
  534. 'format' => 'userspage=%#%',
  535. 'add_args' => $args
  536. ) );
  537. if ( $this->paging_text ) {
  538. $this->paging_text = sprintf(
  539. /* translators: 1: Starting number of users on the current page, 2: Ending number of users, 3: Total number of users. */
  540. '<span class="displaying-num">' . __( 'Displaying %1$s&#8211;%2$s of %3$s' ) . '</span>%s',
  541. number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
  542. number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
  543. number_format_i18n( $this->total_users_for_query ),
  544. $this->paging_text
  545. );
  546. }
  547. }
  548. }
  549. /**
  550. * Retrieves the user search query results.
  551. *
  552. * @since 2.1.0
  553. * @access public
  554. *
  555. * @return array
  556. */
  557. public function get_results() {
  558. return (array) $this->results;
  559. }
  560. /**
  561. * Displaying paging text.
  562. *
  563. * @see do_paging() Builds paging text.
  564. *
  565. * @since 2.1.0
  566. * @access public
  567. */
  568. function page_links() {
  569. echo $this->paging_text;
  570. }
  571. /**
  572. * Whether paging is enabled.
  573. *
  574. * @see do_paging() Builds paging text.
  575. *
  576. * @since 2.1.0
  577. * @access public
  578. *
  579. * @return bool
  580. */
  581. function results_are_paged() {
  582. if ( $this->paging_text )
  583. return true;
  584. return false;
  585. }
  586. /**
  587. * Whether there are search terms.
  588. *
  589. * @since 2.1.0
  590. * @access public
  591. *
  592. * @return bool
  593. */
  594. function is_search() {
  595. if ( $this->search_term )
  596. return true;
  597. return false;
  598. }
  599. }
  600. endif;
  601. /**
  602. * Retrieves editable posts from other users.
  603. *
  604. * @since 2.3.0
  605. * @deprecated 3.1.0 Use get_posts()
  606. * @see get_posts()
  607. *
  608. * @global wpdb $wpdb WordPress database abstraction object.
  609. *
  610. * @param int $user_id User ID to not retrieve posts from.
  611. * @param string $type Optional. Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all).
  612. * Default 'any'.
  613. * @return array List of posts from others.
  614. */
  615. function get_others_unpublished_posts( $user_id, $type = 'any' ) {
  616. _deprecated_function( __FUNCTION__, '3.1.0' );
  617. global $wpdb;
  618. $editable = get_editable_user_ids( $user_id );
  619. if ( in_array($type, array('draft', 'pending')) )
  620. $type_sql = " post_status = '$type' ";
  621. else
  622. $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
  623. $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
  624. if ( !$editable ) {
  625. $other_unpubs = '';
  626. } else {
  627. $editable = join(',', $editable);
  628. $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
  629. }
  630. return apply_filters('get_others_drafts', $other_unpubs);
  631. }
  632. /**
  633. * Retrieve drafts from other users.
  634. *
  635. * @deprecated 3.1.0 Use get_posts()
  636. * @see get_posts()
  637. *
  638. * @param int $user_id User ID.
  639. * @return array List of drafts from other users.
  640. */
  641. function get_others_drafts($user_id) {
  642. _deprecated_function( __FUNCTION__, '3.1.0' );
  643. return get_others_unpublished_posts($user_id, 'draft');
  644. }
  645. /**
  646. * Retrieve pending review posts from other users.
  647. *
  648. * @deprecated 3.1.0 Use get_posts()
  649. * @see get_posts()
  650. *
  651. * @param int $user_id User ID.
  652. * @return array List of posts with pending review post type from other users.
  653. */
  654. function get_others_pending($user_id) {
  655. _deprecated_function( __FUNCTION__, '3.1.0' );
  656. return get_others_unpublished_posts($user_id, 'pending');
  657. }
  658. /**
  659. * Output the QuickPress dashboard widget.
  660. *
  661. * @since 3.0.0
  662. * @deprecated 3.2.0 Use wp_dashboard_quick_press()
  663. * @see wp_dashboard_quick_press()
  664. */
  665. function wp_dashboard_quick_press_output() {
  666. _deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' );
  667. wp_dashboard_quick_press();
  668. }
  669. /**
  670. * Outputs the TinyMCE editor.
  671. *
  672. * @since 2.7.0
  673. * @deprecated 3.3.0 Use wp_editor()
  674. * @see wp_editor()
  675. */
  676. function wp_tiny_mce( $teeny = false, $settings = false ) {
  677. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  678. static $num = 1;
  679. if ( ! class_exists( '_WP_Editors', false ) )
  680. require_once ABSPATH . WPINC . '/class-wp-editor.php';
  681. $editor_id = 'content' . $num++;
  682. $set = array(
  683. 'teeny' => $teeny,
  684. 'tinymce' => $settings ? $settings : true,
  685. 'quicktags' => false
  686. );
  687. $set = _WP_Editors::parse_settings($editor_id, $set);
  688. _WP_Editors::editor_settings($editor_id, $set);
  689. }
  690. /**
  691. * Preloads TinyMCE dialogs.
  692. *
  693. * @deprecated 3.3.0 Use wp_editor()
  694. * @see wp_editor()
  695. */
  696. function wp_preload_dialogs() {
  697. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  698. }
  699. /**
  700. * Prints TinyMCE editor JS.
  701. *
  702. * @deprecated 3.3.0 Use wp_editor()
  703. * @see wp_editor()
  704. */
  705. function wp_print_editor_js() {
  706. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  707. }
  708. /**
  709. * Handles quicktags.
  710. *
  711. * @deprecated 3.3.0 Use wp_editor()
  712. * @see wp_editor()
  713. */
  714. function wp_quicktags() {
  715. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  716. }
  717. /**
  718. * Returns the screen layout options.
  719. *
  720. * @since 2.8.0
  721. * @deprecated 3.3.0 WP_Screen::render_screen_layout()
  722. * @see WP_Screen::render_screen_layout()
  723. */
  724. function screen_layout( $screen ) {
  725. _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' );
  726. $current_screen = get_current_screen();
  727. if ( ! $current_screen )
  728. return '';
  729. ob_start();
  730. $current_screen->render_screen_layout();
  731. return ob_get_clean();
  732. }
  733. /**
  734. * Returns the screen's per-page options.
  735. *
  736. * @since 2.8.0
  737. * @deprecated 3.3.0 Use WP_Screen::render_per_page_options()
  738. * @see WP_Screen::render_per_page_options()
  739. */
  740. function screen_options( $screen ) {
  741. _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' );
  742. $current_screen = get_current_screen();
  743. if ( ! $current_screen )
  744. return '';
  745. ob_start();
  746. $current_screen->render_per_page_options();
  747. return ob_get_clean();
  748. }
  749. /**
  750. * Renders the screen's help.
  751. *
  752. * @since 2.7.0
  753. * @deprecated 3.3.0 Use WP_Screen::render_screen_meta()
  754. * @see WP_Screen::render_screen_meta()
  755. */
  756. function screen_meta( $screen ) {
  757. $current_screen = get_current_screen();
  758. $current_screen->render_screen_meta();
  759. }
  760. /**
  761. * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
  762. *
  763. * @since 2.7.0
  764. * @deprecated 3.2.0 Use WP_Admin_Bar
  765. * @see WP_Admin_Bar
  766. */
  767. function favorite_actions() {
  768. _deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' );
  769. }
  770. /**
  771. * Handles uploading an image.
  772. *
  773. * @deprecated 3.3.0 Use wp_media_upload_handler()
  774. * @see wp_media_upload_handler()
  775. *
  776. * @return null|string
  777. */
  778. function media_upload_image() {
  779. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  780. return wp_media_upload_handler();
  781. }
  782. /**
  783. * Handles uploading an audio file.
  784. *
  785. * @deprecated 3.3.0 Use wp_media_upload_handler()
  786. * @see wp_media_upload_handler()
  787. *
  788. * @return null|string
  789. */
  790. function media_upload_audio() {
  791. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  792. return wp_media_upload_handler();
  793. }
  794. /**
  795. * Handles uploading a video file.
  796. *
  797. * @deprecated 3.3.0 Use wp_media_upload_handler()
  798. * @see wp_media_upload_handler()
  799. *
  800. * @return null|string
  801. */
  802. function media_upload_video() {
  803. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  804. return wp_media_upload_handler();
  805. }
  806. /**
  807. * Handles uploading a generic file.
  808. *
  809. * @deprecated 3.3.0 Use wp_media_upload_handler()
  810. * @see wp_media_upload_handler()
  811. *
  812. * @return null|string
  813. */
  814. function media_upload_file() {
  815. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  816. return wp_media_upload_handler();
  817. }
  818. /**
  819. * Handles retrieving the insert-from-URL form for an image.
  820. *
  821. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  822. * @see wp_media_insert_url_form()
  823. *
  824. * @return string
  825. */
  826. function type_url_form_image() {
  827. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" );
  828. return wp_media_insert_url_form( 'image' );
  829. }
  830. /**
  831. * Handles retrieving the insert-from-URL form for an audio file.
  832. *
  833. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  834. * @see wp_media_insert_url_form()
  835. *
  836. * @return string
  837. */
  838. function type_url_form_audio() {
  839. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" );
  840. return wp_media_insert_url_form( 'audio' );
  841. }
  842. /**
  843. * Handles retrieving the insert-from-URL form for a video file.
  844. *
  845. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  846. * @see wp_media_insert_url_form()
  847. *
  848. * @return string
  849. */
  850. function type_url_form_video() {
  851. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" );
  852. return wp_media_insert_url_form( 'video' );
  853. }
  854. /**
  855. * Handles retrieving the insert-from-URL form for a generic file.
  856. *
  857. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  858. * @see wp_media_insert_url_form()
  859. *
  860. * @return string
  861. */
  862. function type_url_form_file() {
  863. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" );
  864. return wp_media_insert_url_form( 'file' );
  865. }
  866. /**
  867. * Add contextual help text for a page.
  868. *
  869. * Creates an 'Overview' help tab.
  870. *
  871. * @since 2.7.0
  872. * @deprecated 3.3.0 Use WP_Screen::add_help_tab()
  873. * @see WP_Screen::add_help_tab()
  874. *
  875. * @param string $screen The handle for the screen to add help to. This is usually
  876. * the hook name returned by the `add_*_page()` functions.
  877. * @param string $help The content of an 'Overview' help tab.
  878. */
  879. function add_contextual_help( $screen, $help ) {
  880. _deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' );
  881. if ( is_string( $screen ) )
  882. $screen = convert_to_screen( $screen );
  883. WP_Screen::add_old_compat_help( $screen, $help );
  884. }
  885. /**
  886. * Get the allowed themes for the current site.
  887. *
  888. * @since 3.0.0
  889. * @deprecated 3.4.0 Use wp_get_themes()
  890. * @see wp_get_themes()
  891. *
  892. * @return WP_Theme[] Array of WP_Theme objects keyed by their name.
  893. */
  894. function get_allowed_themes() {
  895. _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" );
  896. $themes = wp_get_themes( array( 'allowed' => true ) );
  897. $wp_themes = array();
  898. foreach ( $themes as $theme ) {
  899. $wp_themes[ $theme->get('Name') ] = $theme;
  900. }
  901. return $wp_themes;
  902. }
  903. /**
  904. * Retrieves a list of broken themes.
  905. *
  906. * @since 1.5.0
  907. * @deprecated 3.4.0 Use wp_get_themes()
  908. * @see wp_get_themes()
  909. *
  910. * @return array
  911. */
  912. function get_broken_themes() {
  913. _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )" );
  914. $themes = wp_get_themes( array( 'errors' => true ) );
  915. $broken = array();
  916. foreach ( $themes as $theme ) {
  917. $name = $theme->get('Name');
  918. $broken[ $name ] = array(
  919. 'Name' => $name,
  920. 'Title' => $name,
  921. 'Description' => $theme->errors()->get_error_message(),
  922. );
  923. }
  924. return $broken;
  925. }
  926. /**
  927. * Retrieves information on the current active theme.
  928. *
  929. * @since 2.0.0
  930. * @deprecated 3.4.0 Use wp_get_theme()
  931. * @see wp_get_theme()
  932. *
  933. * @return WP_Theme
  934. */
  935. function current_theme_info() {
  936. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
  937. return wp_get_theme();
  938. }
  939. /**
  940. * This was once used to display an 'Insert into Post' button.
  941. *
  942. * Now it is deprecated and stubbed.
  943. *
  944. * @deprecated 3.5.0
  945. */
  946. function _insert_into_post_button( $type ) {
  947. _deprecated_function( __FUNCTION__, '3.5.0' );
  948. }
  949. /**
  950. * This was once used to display a media button.
  951. *
  952. * Now it is deprecated and stubbed.
  953. *
  954. * @deprecated 3.5.0
  955. */
  956. function _media_button($title, $icon, $type, $id) {
  957. _deprecated_function( __FUNCTION__, '3.5.0' );
  958. }
  959. /**
  960. * Gets an existing post and format it for editing.
  961. *
  962. * @since 2.0.0
  963. * @deprecated 3.5.0 Use get_post()
  964. * @see get_post()
  965. *
  966. * @param int $id
  967. * @return WP_Post
  968. */
  969. function get_post_to_edit( $id ) {
  970. _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
  971. return get_post( $id, OBJECT, 'edit' );
  972. }
  973. /**
  974. * Gets the default page information to use.
  975. *
  976. * @since 2.5.0
  977. * @deprecated 3.5.0 Use get_default_post_to_edit()
  978. * @see get_default_post_to_edit()
  979. *
  980. * @return WP_Post Post object containing all the default post data as attributes
  981. */
  982. function get_default_page_to_edit() {
  983. _deprecated_function( __FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )" );
  984. $page = get_default_post_to_edit();
  985. $page->post_type = 'page';
  986. return $page;
  987. }
  988. /**
  989. * This was once used to create a thumbnail from an Image given a maximum side size.
  990. *
  991. * @since 1.2.0
  992. * @deprecated 3.5.0 Use image_resize()
  993. * @see image_resize()
  994. *
  995. * @param mixed $file Filename of the original image, Or attachment ID.
  996. * @param int $max_side Maximum length of a single side for the thumbnail.
  997. * @param mixed $deprecated Never used.
  998. * @return string Thumbnail path on success, Error string on failure.
  999. */
  1000. function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
  1001. _deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' );
  1002. return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
  1003. }
  1004. /**
  1005. * This was once used to display a meta box for the nav menu theme locations.
  1006. *
  1007. * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen.
  1008. *
  1009. * @since 3.0.0
  1010. * @deprecated 3.6.0
  1011. */
  1012. function wp_nav_menu_locations_meta_box() {
  1013. _deprecated_function( __FUNCTION__, '3.6.0' );
  1014. }
  1015. /**
  1016. * This was once used to kick-off the Core Updater.
  1017. *
  1018. * Deprecated in favor of instantating a Core_Upgrader instance directly,
  1019. * and calling the 'upgrade' method.
  1020. *
  1021. * @since 2.7.0
  1022. * @deprecated 3.7.0 Use Core_Upgrader
  1023. * @see Core_Upgrader
  1024. */
  1025. function wp_update_core($current, $feedback = '') {
  1026. _deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' );
  1027. if ( !empty($feedback) )
  1028. add_filter('update_feedback', $feedback);
  1029. require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
  1030. $upgrader = new Core_Upgrader();
  1031. return $upgrader->upgrade($current);
  1032. }
  1033. /**
  1034. * This was once used to kick-off the Plugin Updater.
  1035. *
  1036. * Deprecated in favor of instantating a Plugin_Upgrader instance directly,
  1037. * and calling the 'upgrade' method.
  1038. * Unused since 2.8.0.
  1039. *
  1040. * @since 2.5.0
  1041. * @deprecated 3.7.0 Use Plugin_Upgrader
  1042. * @see Plugin_Upgrader
  1043. */
  1044. function wp_update_plugin($plugin, $feedback = '') {
  1045. _deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' );
  1046. if ( !empty($feedback) )
  1047. add_filter('update_feedback', $feedback);
  1048. require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
  1049. $upgrader = new Plugin_Upgrader();
  1050. return $upgrader->upgrade($plugin);
  1051. }
  1052. /**
  1053. * This was once used to kick-off the Theme Updater.
  1054. *
  1055. * Deprecated in favor of instantiating a Theme_Upgrader instance directly,
  1056. * and calling the 'upgrade' method.
  1057. * Unused since 2.8.0.
  1058. *
  1059. * @since 2.7.0
  1060. * @deprecated 3.7.0 Use Theme_Upgrader
  1061. * @see Theme_Upgrader
  1062. */
  1063. function wp_update_theme($theme, $feedback = '') {
  1064. _deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' );
  1065. if ( !empty($feedback) )
  1066. add_filter('update_feedback', $feedback);
  1067. require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
  1068. $upgrader = new Theme_Upgrader();
  1069. return $upgrader->upgrade($theme);
  1070. }
  1071. /**
  1072. * This was once used to display attachment links. Now it is deprecated and stubbed.
  1073. *
  1074. * @since 2.0.0
  1075. * @deprecated 3.7.0
  1076. *
  1077. * @param int|bool $id
  1078. */
  1079. function the_attachment_links( $id = false ) {
  1080. _deprecated_function( __FUNCTION__, '3.7.0' );
  1081. }
  1082. /**
  1083. * Displays a screen icon.
  1084. *
  1085. * @since 2.7.0
  1086. * @deprecated 3.8.0
  1087. */
  1088. function screen_icon() {
  1089. _deprecated_function( __FUNCTION__, '3.8.0' );
  1090. echo get_screen_icon();
  1091. }
  1092. /**
  1093. * Retrieves the screen icon (no longer used in 3.8+).
  1094. *
  1095. * @since 3.2.0
  1096. * @deprecated 3.8.0
  1097. *
  1098. * @return string An HTML comment explaining that icons are no longer used.
  1099. */
  1100. function get_screen_icon() {
  1101. _deprecated_function( __FUNCTION__, '3.8.0' );
  1102. return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
  1103. }
  1104. /**
  1105. * Deprecated dashboard widget controls.
  1106. *
  1107. * @since 2.5.0
  1108. * @deprecated 3.8.0
  1109. */
  1110. function wp_dashboard_incoming_links_output() {}
  1111. /**
  1112. * Deprecated dashboard secondary output.
  1113. *
  1114. * @deprecated 3.8.0
  1115. */
  1116. function wp_dashboard_secondary_output() {}
  1117. /**
  1118. * Deprecated dashboard widget controls.
  1119. *
  1120. * @since 2.7.0
  1121. * @deprecated 3.8.0
  1122. */
  1123. function wp_dashboard_incoming_links() {}
  1124. /**
  1125. * Deprecated dashboard incoming links control.
  1126. *
  1127. * @deprecated 3.8.0
  1128. */
  1129. function wp_dashboard_incoming_links_control() {}
  1130. /**
  1131. * Deprecated dashboard plugins control.
  1132. *
  1133. * @deprecated 3.8.0
  1134. */
  1135. function wp_dashboard_plugins() {}
  1136. /**
  1137. * Deprecated dashboard primary control.
  1138. *
  1139. * @deprecated 3.8.0
  1140. */
  1141. function wp_dashboard_primary_control() {}
  1142. /**
  1143. * Deprecated dashboard recent comments control.
  1144. *
  1145. * @deprecated 3.8.0
  1146. */
  1147. function wp_dashboard_recent_comments_control() {}
  1148. /**
  1149. * Deprecated dashboard secondary section.
  1150. *
  1151. * @deprecated 3.8.0
  1152. */
  1153. function wp_dashboard_secondary() {}
  1154. /**
  1155. * Deprecated dashboard secondary control.
  1156. *
  1157. * @deprecated 3.8.0
  1158. */
  1159. function wp_dashboard_secondary_control() {}
  1160. /**
  1161. * Display plugins text for the WordPress news widget.
  1162. *
  1163. * @since 2.5.0
  1164. * @deprecated 4.8.0
  1165. *
  1166. * @param string $rss The RSS feed URL.
  1167. * @param array $args Array of arguments for this RSS feed.
  1168. */
  1169. function wp_dashboard_plugins_output( $rss, $args = array() ) {
  1170. _deprecated_function( __FUNCTION__, '4.8.0' );
  1171. // Plugin feeds plus link to install them.
  1172. $popular = fetch_feed( $args['url']['popular'] );
  1173. if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
  1174. $plugin_slugs = array_keys( get_plugins() );
  1175. set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
  1176. }
  1177. echo '<ul>';
  1178. foreach ( array( $popular ) as $feed ) {
  1179. if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
  1180. continue;
  1181. $items = $feed->get_items(0, 5);
  1182. // Pick a random, non-installed plugin.
  1183. while ( true ) {
  1184. // Abort this foreach loop iteration if there's no plugins left of this type.
  1185. if ( 0 === count($items) )
  1186. continue 2;
  1187. $item_key = array_rand($items);
  1188. $item = $items[$item_key];
  1189. list($link, $frag) = explode( '#', $item->get_link() );
  1190. $link = esc_url($link);
  1191. if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
  1192. $slug = $matches[1];
  1193. else {
  1194. unset( $items[$item_key] );
  1195. continue;
  1196. }
  1197. // Is this random plugin's slug already installed? If so, try again.
  1198. reset( $plugin_slugs );
  1199. foreach ( $plugin_slugs as $plugin_slug ) {
  1200. if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
  1201. unset( $items[$item_key] );
  1202. continue 2;
  1203. }
  1204. }
  1205. // If we get to this point, then the random plugin isn't installed and we can stop the while().
  1206. break;
  1207. }
  1208. // Eliminate some common badly formed plugin descriptions.
  1209. while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
  1210. unset($items[$item_key]);
  1211. if ( !isset($items[$item_key]) )
  1212. continue;
  1213. $raw_title = $item->get_title();
  1214. $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
  1215. echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
  1216. '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
  1217. /* translators: %s: Plugin name. */
  1218. esc_attr( sprintf( _x( 'Install %s', 'plugin' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
  1219. $feed->__destruct();
  1220. unset( $feed );
  1221. }
  1222. echo '</ul>';
  1223. }
  1224. /**
  1225. * This was once used to move child posts to a new parent.
  1226. *
  1227. * @since 2.3.0
  1228. * @deprecated 3.9.0
  1229. * @access private
  1230. *
  1231. * @param int $old_ID
  1232. * @param int $new_ID
  1233. */
  1234. function _relocate_children( $old_ID, $new_ID ) {
  1235. _deprecated_function( __FUNCTION__, '3.9.0' );
  1236. }
  1237. /**
  1238. * Add a top-level menu page in the 'objects' section.
  1239. *
  1240. * This function takes a capability which will be used to determine whether
  1241. * or not a page is included in the menu.
  1242. *
  1243. * The function which is hooked in to handle the output of the page must check
  1244. * that the user has the required capability as well.
  1245. *
  1246. * @since 2.7.0
  1247. *
  1248. * @deprecated 4.5.0 Use add_menu_page()
  1249. * @see add_menu_page()
  1250. * @global int $_wp_last_object_menu
  1251. *
  1252. * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
  1253. * @param string $menu_title The text to be used for the menu.
  1254. * @param string $capability The capability required for this menu to be displayed to the user.
  1255. * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
  1256. * @param callable $function Optional. The function to be called to output the content for this page.
  1257. * @param string $icon_url Optional. The URL to the icon to be used for this menu.
  1258. * @return string The resulting page's hook_suffix.
  1259. */
  1260. function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
  1261. _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
  1262. global $_wp_last_object_menu;
  1263. $_wp_last_object_menu++;
  1264. return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_object_menu);
  1265. }
  1266. /**
  1267. * Add a top-level menu page in the 'utility' section.
  1268. *
  1269. * This function takes a capability which will be used to determine whether
  1270. * or not a page is included in the menu.
  1271. *
  1272. * The function which is hooked in to handle the output of the page must check
  1273. * that the user has the required capability as well.
  1274. *
  1275. * @since 2.7.0
  1276. *
  1277. * @deprecated 4.5.0 Use add_menu_page()
  1278. * @see add_menu_page()
  1279. * @global int $_wp_last_utility_menu
  1280. *
  1281. * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
  1282. * @param string $menu_title The text to be used for the menu.
  1283. * @param string $capability The capability required for this menu to be displayed to the user.
  1284. * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
  1285. * @param callable $function Optional. The function to be called to output the content for this page.
  1286. * @param string $icon_url Optional. The URL to the icon to be used for this menu.
  1287. * @return string The resulting page's hook_suffix.
  1288. */
  1289. function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
  1290. _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
  1291. global $_wp_last_utility_menu;
  1292. $_wp_last_utility_menu++;
  1293. return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu);
  1294. }
  1295. /**
  1296. * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
  1297. * as they disregard the autocomplete setting on the editor textarea. That can break the editor
  1298. * when the user navigates to it with the browser's Back button. See #28037
  1299. *
  1300. * Replaced with wp_page_reload_on_back_button_js() that also fixes this problem.
  1301. *
  1302. * @since 4.0.0
  1303. * @deprecated 4.6.0
  1304. *
  1305. * @link https://core.trac.wordpress.org/ticket/35852
  1306. *
  1307. * @global bool $is_safari
  1308. * @global bool $is_chrome
  1309. */
  1310. function post_form_autocomplete_off() {
  1311. global $is_safari, $is_chrome;
  1312. _deprecated_function( __FUNCTION__, '4.6.0' );
  1313. if ( $is_safari || $is_chrome ) {
  1314. echo ' autocomplete="off"';
  1315. }
  1316. }
  1317. /**
  1318. * Display JavaScript on the page.
  1319. *
  1320. * @since 3.5.0
  1321. * @deprecated 4.9.0
  1322. */
  1323. function options_permalink_add_js() {
  1324. ?>
  1325. <script type="text/javascript">
  1326. jQuery( function() {
  1327. jQuery('.permalink-structure input:radio').change(function() {
  1328. if ( 'custom' == this.value )
  1329. return;
  1330. jQuery('#permalink_structure').val( this.value );
  1331. });
  1332. jQuery( '#permalink_structure' ).on( 'click input', function() {
  1333. jQuery( '#custom_selection' ).prop( 'checked', true );
  1334. });
  1335. } );
  1336. </script>
  1337. <?php
  1338. }
  1339. /**
  1340. * Previous class for list table for privacy data export requests.
  1341. *
  1342. * @since 4.9.6
  1343. * @deprecated 5.3.0
  1344. */
  1345. class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Data_Export_Requests_List_Table {
  1346. function __construct( $args ) {
  1347. _deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Export_Requests_List_Table' );
  1348. if ( ! isset( $args['screen'] ) || $args['screen'] === 'export_personal_data' ) {
  1349. $args['screen'] = 'export-personal-data';
  1350. }
  1351. parent::__construct( $args );
  1352. }
  1353. }
  1354. /**
  1355. * Previous class for list table for privacy data erasure requests.
  1356. *
  1357. * @since 4.9.6
  1358. * @deprecated 5.3.0
  1359. */
  1360. class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Data_Removal_Requests_List_Table {
  1361. function __construct( $args ) {
  1362. _deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Removal_Requests_List_Table' );
  1363. if ( ! isset( $args['screen'] ) || $args['screen'] === 'remove_personal_data' ) {
  1364. $args['screen'] = 'erase-personal-data';
  1365. }
  1366. parent::__construct( $args );
  1367. }
  1368. }
  1369. /**
  1370. * Was used to add options for the privacy requests screens before they were separate files.
  1371. *
  1372. * @since 4.9.8
  1373. * @access private
  1374. * @deprecated 5.3.0
  1375. */
  1376. function _wp_privacy_requests_screen_options() {
  1377. _deprecated_function( __FUNCTION__, '5.3.0' );
  1378. }