PageRenderTime 68ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-admin/includes/deprecated.php

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