PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-admin/includes/deprecated.php

https://gitlab.com/geyson/geyson
PHP | 1199 lines | 436 code | 146 blank | 617 comment | 45 complexity | 246fe855f6c3ea1afaf678f939e7f9cf MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  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
  16. * @deprecated Use wp_editor().
  17. * @see wp_editor()
  18. */
  19. function tinymce_include() {
  20. _deprecated_function( __FUNCTION__, '2.1', 'wp_editor()' );
  21. wp_tiny_mce();
  22. }
  23. /**
  24. * Unused Admin function.
  25. *
  26. * @since 2.0.0
  27. * @deprecated 2.5.0
  28. *
  29. */
  30. function documentation_link() {
  31. _deprecated_function( __FUNCTION__, '2.5' );
  32. }
  33. /**
  34. * Calculates the new dimensions for a downsampled image.
  35. *
  36. * @since 2.0.0
  37. * @deprecated 3.0.0
  38. * @deprecated Use wp_constrain_dimensions()
  39. * @see wp_constrain_dimensions()
  40. *
  41. * @param int $width Current width of the image
  42. * @param int $height Current height of the image
  43. * @param int $wmax Maximum wanted width
  44. * @param int $hmax Maximum wanted height
  45. * @return array Shrunk dimensions (width, height).
  46. */
  47. function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
  48. _deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' );
  49. return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
  50. }
  51. /**
  52. * Calculated the new dimensions for a downsampled image.
  53. *
  54. * @since 2.0.0
  55. * @deprecated 3.5.0
  56. * @deprecated Use wp_constrain_dimensions()
  57. * @see wp_constrain_dimensions()
  58. *
  59. * @param int $width Current width of the image
  60. * @param int $height Current height of the image
  61. * @return array Shrunk dimensions (width, height).
  62. */
  63. function get_udims( $width, $height ) {
  64. _deprecated_function( __FUNCTION__, '3.5', 'wp_constrain_dimensions()' );
  65. return wp_constrain_dimensions( $width, $height, 128, 96 );
  66. }
  67. /**
  68. * {@internal Missing Short Description}}
  69. *
  70. * @since 0.71
  71. * @deprecated 2.6.0
  72. * @deprecated Use wp_category_checklist()
  73. * @see wp_category_checklist()
  74. *
  75. * @param int $default
  76. * @param int $parent
  77. * @param array $popular_ids
  78. */
  79. function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
  80. _deprecated_function( __FUNCTION__, '2.6', 'wp_category_checklist()' );
  81. global $post_ID;
  82. wp_category_checklist( $post_ID );
  83. }
  84. /**
  85. * {@internal Missing Short Description}}
  86. *
  87. * @since 2.1.0
  88. * @deprecated 2.6.0
  89. * @deprecated Use wp_link_category_checklist()
  90. * @see wp_link_category_checklist()
  91. *
  92. * @param int $default
  93. */
  94. function dropdown_link_categories( $default = 0 ) {
  95. _deprecated_function( __FUNCTION__, '2.6', 'wp_link_category_checklist()' );
  96. global $link_id;
  97. wp_link_category_checklist( $link_id );
  98. }
  99. /**
  100. * Get the real filesystem path to a file to edit within the admin.
  101. *
  102. * @since 1.5.0
  103. * @deprecated 2.9.0
  104. * @uses WP_CONTENT_DIR Full filesystem path to the wp-content directory.
  105. *
  106. * @param string $file Filesystem path relative to the wp-content directory.
  107. * @return string Full filesystem path to edit.
  108. */
  109. function get_real_file_to_edit( $file ) {
  110. _deprecated_function( __FUNCTION__, '2.9' );
  111. return WP_CONTENT_DIR . $file;
  112. }
  113. /**
  114. * {@internal Missing Short Description}}
  115. *
  116. * @since 1.2.0
  117. * @deprecated 3.0.0
  118. * @deprecated Use wp_dropdown_categories()
  119. * @see wp_dropdown_categories()
  120. *
  121. * @param int $currentcat
  122. * @param int $currentparent
  123. * @param int $parent
  124. * @param int $level
  125. * @param array $categories
  126. * @return bool|null
  127. */
  128. function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
  129. _deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' );
  130. if (!$categories )
  131. $categories = get_categories( array('hide_empty' => 0) );
  132. if ( $categories ) {
  133. foreach ( $categories as $category ) {
  134. if ( $currentcat != $category->term_id && $parent == $category->parent) {
  135. $pad = str_repeat( '&#8211; ', $level );
  136. $category->name = esc_html( $category->name );
  137. echo "\n\t<option value='$category->term_id'";
  138. if ( $currentparent == $category->term_id )
  139. echo " selected='selected'";
  140. echo ">$pad$category->name</option>";
  141. wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories );
  142. }
  143. }
  144. } else {
  145. return false;
  146. }
  147. }
  148. /**
  149. * Register a setting and its sanitization callback
  150. *
  151. * @since 2.7.0
  152. * @deprecated 3.0.0
  153. * @deprecated Use register_setting()
  154. * @see register_setting()
  155. *
  156. * @param string $option_group A settings group name. Should correspond to a whitelisted option key name.
  157. * Default whitelisted option key names include "general," "discussion," and "reading," among others.
  158. * @param string $option_name The name of an option to sanitize and save.
  159. * @param callable $sanitize_callback A callback function that sanitizes the option's value.
  160. */
  161. function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
  162. _deprecated_function( __FUNCTION__, '3.0', 'register_setting()' );
  163. register_setting( $option_group, $option_name, $sanitize_callback );
  164. }
  165. /**
  166. * Unregister a setting
  167. *
  168. * @since 2.7.0
  169. * @deprecated 3.0.0
  170. * @deprecated Use unregister_setting()
  171. * @see unregister_setting()
  172. *
  173. * @param string $option_group
  174. * @param string $option_name
  175. * @param callable $sanitize_callback
  176. */
  177. function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
  178. _deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' );
  179. unregister_setting( $option_group, $option_name, $sanitize_callback );
  180. }
  181. /**
  182. * Determines the language to use for CodePress syntax highlighting.
  183. *
  184. * @since 2.8.0
  185. * @deprecated 3.0.0
  186. *
  187. * @param string $filename
  188. **/
  189. function codepress_get_lang( $filename ) {
  190. _deprecated_function( __FUNCTION__, '3.0' );
  191. }
  192. /**
  193. * Adds JavaScript required to make CodePress work on the theme/plugin editors.
  194. *
  195. * @since 2.8.0
  196. * @deprecated 3.0.0
  197. **/
  198. function codepress_footer_js() {
  199. _deprecated_function( __FUNCTION__, '3.0' );
  200. }
  201. /**
  202. * Determine whether to use CodePress.
  203. *
  204. * @since 2.8.0
  205. * @deprecated 3.0.0
  206. **/
  207. function use_codepress() {
  208. _deprecated_function( __FUNCTION__, '3.0' );
  209. }
  210. /**
  211. * @deprecated 3.1.0
  212. *
  213. * @return array List of user IDs.
  214. */
  215. function get_author_user_ids() {
  216. _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
  217. global $wpdb;
  218. if ( !is_multisite() )
  219. $level_key = $wpdb->get_blog_prefix() . 'user_level';
  220. else
  221. $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
  222. return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
  223. }
  224. /**
  225. * @deprecated 3.1.0
  226. *
  227. * @param int $user_id User ID.
  228. * @return array|bool List of editable authors. False if no editable users.
  229. */
  230. function get_editable_authors( $user_id ) {
  231. _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
  232. global $wpdb;
  233. $editable = get_editable_user_ids( $user_id );
  234. if ( !$editable ) {
  235. return false;
  236. } else {
  237. $editable = join(',', $editable);
  238. $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
  239. }
  240. return apply_filters('get_editable_authors', $authors);
  241. }
  242. /**
  243. * @deprecated 3.1.0
  244. *
  245. * @param int $user_id User ID.
  246. * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
  247. * @return mixed
  248. */
  249. function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
  250. _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
  251. global $wpdb;
  252. if ( ! $user = get_userdata( $user_id ) )
  253. return array();
  254. $post_type_obj = get_post_type_object($post_type);
  255. if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
  256. if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
  257. return array($user->ID);
  258. else
  259. return array();
  260. }
  261. if ( !is_multisite() )
  262. $level_key = $wpdb->get_blog_prefix() . 'user_level';
  263. else
  264. $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
  265. $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
  266. if ( $exclude_zeros )
  267. $query .= " AND meta_value != '0'";
  268. return $wpdb->get_col( $query );
  269. }
  270. /**
  271. * @deprecated 3.1.0
  272. */
  273. function get_nonauthor_user_ids() {
  274. _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
  275. global $wpdb;
  276. if ( !is_multisite() )
  277. $level_key = $wpdb->get_blog_prefix() . 'user_level';
  278. else
  279. $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
  280. return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
  281. }
  282. if ( !class_exists('WP_User_Search') ) :
  283. /**
  284. * WordPress User Search class.
  285. *
  286. * @since 2.1.0
  287. * @deprecated 3.1.0
  288. */
  289. class WP_User_Search {
  290. /**
  291. * {@internal Missing Description}}
  292. *
  293. * @since 2.1.0
  294. * @access private
  295. * @var mixed
  296. */
  297. var $results;
  298. /**
  299. * {@internal Missing Description}}
  300. *
  301. * @since 2.1.0
  302. * @access private
  303. * @var string
  304. */
  305. var $search_term;
  306. /**
  307. * Page number.
  308. *
  309. * @since 2.1.0
  310. * @access private
  311. * @var int
  312. */
  313. var $page;
  314. /**
  315. * Role name that users have.
  316. *
  317. * @since 2.5.0
  318. * @access private
  319. * @var string
  320. */
  321. var $role;
  322. /**
  323. * Raw page number.
  324. *
  325. * @since 2.1.0
  326. * @access private
  327. * @var int|bool
  328. */
  329. var $raw_page;
  330. /**
  331. * Amount of users to display per page.
  332. *
  333. * @since 2.1.0
  334. * @access public
  335. * @var int
  336. */
  337. var $users_per_page = 50;
  338. /**
  339. * {@internal Missing Description}}
  340. *
  341. * @since 2.1.0
  342. * @access private
  343. * @var int
  344. */
  345. var $first_user;
  346. /**
  347. * {@internal Missing Description}}
  348. *
  349. * @since 2.1.0
  350. * @access private
  351. * @var int
  352. */
  353. var $last_user;
  354. /**
  355. * {@internal Missing Description}}
  356. *
  357. * @since 2.1.0
  358. * @access private
  359. * @var string
  360. */
  361. var $query_limit;
  362. /**
  363. * {@internal Missing Description}}
  364. *
  365. * @since 3.0.0
  366. * @access private
  367. * @var string
  368. */
  369. var $query_orderby;
  370. /**
  371. * {@internal Missing Description}}
  372. *
  373. * @since 3.0.0
  374. * @access private
  375. * @var string
  376. */
  377. var $query_from;
  378. /**
  379. * {@internal Missing Description}}
  380. *
  381. * @since 3.0.0
  382. * @access private
  383. * @var string
  384. */
  385. var $query_where;
  386. /**
  387. * {@internal Missing Description}}
  388. *
  389. * @since 2.1.0
  390. * @access private
  391. * @var int
  392. */
  393. var $total_users_for_query = 0;
  394. /**
  395. * {@internal Missing Description}}
  396. *
  397. * @since 2.1.0
  398. * @access private
  399. * @var bool
  400. */
  401. var $too_many_total_users = false;
  402. /**
  403. * {@internal Missing Description}}
  404. *
  405. * @since 2.1.0
  406. * @access private
  407. * @var WP_Error
  408. */
  409. var $search_errors;
  410. /**
  411. * {@internal Missing Description}}
  412. *
  413. * @since 2.7.0
  414. * @access private
  415. * @var string
  416. */
  417. var $paging_text;
  418. /**
  419. * PHP5 Constructor - Sets up the object properties.
  420. *
  421. * @since 2.1.0
  422. *
  423. * @param string $search_term Search terms string.
  424. * @param int $page Optional. Page ID.
  425. * @param string $role Role name.
  426. * @return WP_User_Search
  427. */
  428. function __construct( $search_term = '', $page = '', $role = '' ) {
  429. _deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' );
  430. $this->search_term = wp_unslash( $search_term );
  431. $this->raw_page = ( '' == $page ) ? false : (int) $page;
  432. $this->page = (int) ( '' == $page ) ? 1 : $page;
  433. $this->role = $role;
  434. $this->prepare_query();
  435. $this->query();
  436. $this->do_paging();
  437. }
  438. /**
  439. * PHP4 Constructor - Sets up the object properties.
  440. *
  441. * @since 2.1.0
  442. *
  443. * @param string $search_term Search terms string.
  444. * @param int $page Optional. Page ID.
  445. * @param string $role Role name.
  446. * @return WP_User_Search
  447. */
  448. public function WP_User_Search( $search_term = '', $page = '', $role = '' ) {
  449. self::__construct( $search_term, $page, $role );
  450. }
  451. /**
  452. * {@internal Missing Short Description}}
  453. *
  454. * {@internal Missing Long Description}}
  455. *
  456. * @since 2.1.0
  457. * @access public
  458. */
  459. function prepare_query() {
  460. global $wpdb;
  461. $this->first_user = ($this->page - 1) * $this->users_per_page;
  462. $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
  463. $this->query_orderby = ' ORDER BY user_login';
  464. $search_sql = '';
  465. if ( $this->search_term ) {
  466. $searches = array();
  467. $search_sql = 'AND (';
  468. foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
  469. $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
  470. $search_sql .= implode(' OR ', $searches);
  471. $search_sql .= ')';
  472. }
  473. $this->query_from = " FROM $wpdb->users";
  474. $this->query_where = " WHERE 1=1 $search_sql";
  475. if ( $this->role ) {
  476. $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
  477. $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
  478. } elseif ( is_multisite() ) {
  479. $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
  480. $this->query_from .= ", $wpdb->usermeta";
  481. $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
  482. }
  483. do_action_ref_array( 'pre_user_search', array( &$this ) );
  484. }
  485. /**
  486. * {@internal Missing Short Description}}
  487. *
  488. * {@internal Missing Long Description}}
  489. *
  490. * @since 2.1.0
  491. * @access public
  492. */
  493. function query() {
  494. global $wpdb;
  495. $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
  496. if ( $this->results )
  497. $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
  498. else
  499. $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
  500. }
  501. /**
  502. * {@internal Missing Short Description}}
  503. *
  504. * {@internal Missing Long Description}}
  505. *
  506. * @since 2.1.0
  507. * @access public
  508. */
  509. function prepare_vars_for_template_usage() {}
  510. /**
  511. * {@internal Missing Short Description}}
  512. *
  513. * {@internal Missing Long Description}}
  514. *
  515. * @since 2.1.0
  516. * @access public
  517. */
  518. function do_paging() {
  519. if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
  520. $args = array();
  521. if ( ! empty($this->search_term) )
  522. $args['usersearch'] = urlencode($this->search_term);
  523. if ( ! empty($this->role) )
  524. $args['role'] = urlencode($this->role);
  525. $this->paging_text = paginate_links( array(
  526. 'total' => ceil($this->total_users_for_query / $this->users_per_page),
  527. 'current' => $this->page,
  528. 'base' => 'users.php?%_%',
  529. 'format' => 'userspage=%#%',
  530. 'add_args' => $args
  531. ) );
  532. if ( $this->paging_text ) {
  533. $this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
  534. number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
  535. number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
  536. number_format_i18n( $this->total_users_for_query ),
  537. $this->paging_text
  538. );
  539. }
  540. }
  541. }
  542. /**
  543. * {@internal Missing Short Description}}
  544. *
  545. * {@internal Missing Long Description}}
  546. *
  547. * @since 2.1.0
  548. * @access public
  549. *
  550. * @return array
  551. */
  552. function get_results() {
  553. return (array) $this->results;
  554. }
  555. /**
  556. * Displaying paging text.
  557. *
  558. * @see do_paging() Builds paging text.
  559. *
  560. * @since 2.1.0
  561. * @access public
  562. */
  563. function page_links() {
  564. echo $this->paging_text;
  565. }
  566. /**
  567. * Whether paging is enabled.
  568. *
  569. * @see do_paging() Builds paging text.
  570. *
  571. * @since 2.1.0
  572. * @access public
  573. *
  574. * @return bool
  575. */
  576. function results_are_paged() {
  577. if ( $this->paging_text )
  578. return true;
  579. return false;
  580. }
  581. /**
  582. * Whether there are search terms.
  583. *
  584. * @since 2.1.0
  585. * @access public
  586. *
  587. * @return bool
  588. */
  589. function is_search() {
  590. if ( $this->search_term )
  591. return true;
  592. return false;
  593. }
  594. }
  595. endif;
  596. /**
  597. * Retrieve editable posts from other users.
  598. *
  599. * @deprecated 3.1.0
  600. *
  601. * @param int $user_id User ID to not retrieve posts from.
  602. * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
  603. * @return array List of posts from others.
  604. */
  605. function get_others_unpublished_posts($user_id, $type='any') {
  606. _deprecated_function( __FUNCTION__, '3.1' );
  607. global $wpdb;
  608. $editable = get_editable_user_ids( $user_id );
  609. if ( in_array($type, array('draft', 'pending')) )
  610. $type_sql = " post_status = '$type' ";
  611. else
  612. $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
  613. $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
  614. if ( !$editable ) {
  615. $other_unpubs = '';
  616. } else {
  617. $editable = join(',', $editable);
  618. $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) );
  619. }
  620. return apply_filters('get_others_drafts', $other_unpubs);
  621. }
  622. /**
  623. * Retrieve drafts from other users.
  624. *
  625. * @deprecated 3.1.0
  626. *
  627. * @param int $user_id User ID.
  628. * @return array List of drafts from other users.
  629. */
  630. function get_others_drafts($user_id) {
  631. _deprecated_function( __FUNCTION__, '3.1' );
  632. return get_others_unpublished_posts($user_id, 'draft');
  633. }
  634. /**
  635. * Retrieve pending review posts from other users.
  636. *
  637. * @deprecated 3.1.0
  638. *
  639. * @param int $user_id User ID.
  640. * @return array List of posts with pending review post type from other users.
  641. */
  642. function get_others_pending($user_id) {
  643. _deprecated_function( __FUNCTION__, '3.1' );
  644. return get_others_unpublished_posts($user_id, 'pending');
  645. }
  646. /**
  647. * Output the QuickPress dashboard widget.
  648. *
  649. * @since 3.0.0
  650. * @deprecated 3.2.0
  651. * @deprecated Use wp_dashboard_quick_press()
  652. * @see wp_dashboard_quick_press()
  653. */
  654. function wp_dashboard_quick_press_output() {
  655. _deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' );
  656. wp_dashboard_quick_press();
  657. }
  658. /**
  659. * @since 2.7.0
  660. * @deprecated 3.3.0
  661. * @deprecated Use wp_editor()
  662. * @see wp_editor()
  663. *
  664. * @staticvar int $num
  665. */
  666. function wp_tiny_mce( $teeny = false, $settings = false ) {
  667. _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
  668. static $num = 1;
  669. if ( ! class_exists('_WP_Editors' ) )
  670. require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
  671. $editor_id = 'content' . $num++;
  672. $set = array(
  673. 'teeny' => $teeny,
  674. 'tinymce' => $settings ? $settings : true,
  675. 'quicktags' => false
  676. );
  677. $set = _WP_Editors::parse_settings($editor_id, $set);
  678. _WP_Editors::editor_settings($editor_id, $set);
  679. }
  680. /**
  681. * @deprecated 3.3.0
  682. * @deprecated Use wp_editor()
  683. * @see wp_editor()
  684. */
  685. function wp_preload_dialogs() {
  686. _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
  687. }
  688. /**
  689. * @deprecated 3.3.0
  690. * @deprecated Use wp_editor()
  691. * @see wp_editor()
  692. */
  693. function wp_print_editor_js() {
  694. _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
  695. }
  696. /**
  697. * @deprecated 3.3.0
  698. * @deprecated Use wp_editor()
  699. * @see wp_editor()
  700. */
  701. function wp_quicktags() {
  702. _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
  703. }
  704. /**
  705. * Returns the screen layout options.
  706. *
  707. * @since 2.8.0
  708. * @deprecated 3.3.0
  709. * @deprecated Use $current_screen->render_screen_layout()
  710. * @see WP_Screen::render_screen_layout()
  711. */
  712. function screen_layout( $screen ) {
  713. _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_screen_layout()' );
  714. $current_screen = get_current_screen();
  715. if ( ! $current_screen )
  716. return '';
  717. ob_start();
  718. $current_screen->render_screen_layout();
  719. return ob_get_clean();
  720. }
  721. /**
  722. * Returns the screen's per-page options.
  723. *
  724. * @since 2.8.0
  725. * @deprecated 3.3.0
  726. * @deprecated Use $current_screen->render_per_page_options()
  727. * @see WP_Screen::render_per_page_options()
  728. */
  729. function screen_options( $screen ) {
  730. _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_per_page_options()' );
  731. $current_screen = get_current_screen();
  732. if ( ! $current_screen )
  733. return '';
  734. ob_start();
  735. $current_screen->render_per_page_options();
  736. return ob_get_clean();
  737. }
  738. /**
  739. * Renders the screen's help.
  740. *
  741. * @since 2.7.0
  742. * @deprecated 3.3.0
  743. * @deprecated Use $current_screen->render_screen_meta()
  744. * @see WP_Screen::render_screen_meta()
  745. */
  746. function screen_meta( $screen ) {
  747. $current_screen = get_current_screen();
  748. $current_screen->render_screen_meta();
  749. }
  750. /**
  751. * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
  752. *
  753. * @since 2.7.0
  754. * @deprecated 3.2.0
  755. */
  756. function favorite_actions() {
  757. _deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' );
  758. }
  759. function media_upload_image() {
  760. _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
  761. return wp_media_upload_handler();
  762. }
  763. function media_upload_audio() {
  764. _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
  765. return wp_media_upload_handler();
  766. }
  767. function media_upload_video() {
  768. _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
  769. return wp_media_upload_handler();
  770. }
  771. function media_upload_file() {
  772. _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
  773. return wp_media_upload_handler();
  774. }
  775. function type_url_form_image() {
  776. _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('image')" );
  777. return wp_media_insert_url_form( 'image' );
  778. }
  779. function type_url_form_audio() {
  780. _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('audio')" );
  781. return wp_media_insert_url_form( 'audio' );
  782. }
  783. function type_url_form_video() {
  784. _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('video')" );
  785. return wp_media_insert_url_form( 'video' );
  786. }
  787. function type_url_form_file() {
  788. _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('file')" );
  789. return wp_media_insert_url_form( 'file' );
  790. }
  791. /**
  792. * Add contextual help text for a page.
  793. *
  794. * Creates an 'Overview' help tab.
  795. *
  796. * @since 2.7.0
  797. * @deprecated 3.3.0
  798. * @deprecated Use get_current_screen()->add_help_tab()
  799. * @see WP_Screen
  800. *
  801. * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
  802. * @param string $help The content of an 'Overview' help tab.
  803. */
  804. function add_contextual_help( $screen, $help ) {
  805. _deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' );
  806. if ( is_string( $screen ) )
  807. $screen = convert_to_screen( $screen );
  808. WP_Screen::add_old_compat_help( $screen, $help );
  809. }
  810. /**
  811. * Get the allowed themes for the current blog.
  812. *
  813. * @since 3.0.0
  814. * @deprecated 3.4.0
  815. * @deprecated Use wp_get_themes()
  816. * @see wp_get_themes()
  817. *
  818. * @return array $themes Array of allowed themes.
  819. */
  820. function get_allowed_themes() {
  821. _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'allowed' => true ) )" );
  822. $themes = wp_get_themes( array( 'allowed' => true ) );
  823. $wp_themes = array();
  824. foreach ( $themes as $theme ) {
  825. $wp_themes[ $theme->get('Name') ] = $theme;
  826. }
  827. return $wp_themes;
  828. }
  829. /**
  830. * {@internal Missing Short Description}}
  831. *
  832. * @since 1.5.0
  833. * @deprecated 3.4.0
  834. *
  835. * @return array
  836. */
  837. function get_broken_themes() {
  838. _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'errors' => true )" );
  839. $themes = wp_get_themes( array( 'errors' => true ) );
  840. $broken = array();
  841. foreach ( $themes as $theme ) {
  842. $name = $theme->get('Name');
  843. $broken[ $name ] = array(
  844. 'Name' => $name,
  845. 'Title' => $name,
  846. 'Description' => $theme->errors()->get_error_message(),
  847. );
  848. }
  849. return $broken;
  850. }
  851. /**
  852. * {@internal Missing Short Description}}
  853. *
  854. * @since 2.0.0
  855. * @deprecated 3.4.0
  856. *
  857. * @return WP_Theme
  858. */
  859. function current_theme_info() {
  860. _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
  861. return wp_get_theme();
  862. }
  863. /**
  864. * This was once used to display an 'Insert into Post' button. Now it is deprecated and stubbed.
  865. *
  866. * @deprecated 3.5.0
  867. */
  868. function _insert_into_post_button( $type ) {
  869. _deprecated_function( __FUNCTION__, '3.5' );
  870. }
  871. /**
  872. * This was once used to display a media button. Now it is deprecated and stubbed.
  873. *
  874. * @deprecated 3.5.0
  875. */
  876. function _media_button($title, $icon, $type, $id) {
  877. _deprecated_function( __FUNCTION__, '3.5' );
  878. }
  879. /**
  880. * Get an existing post and format it for editing.
  881. *
  882. * @since 2.0.0
  883. * @deprecated 3.5.0
  884. *
  885. * @param int $id
  886. * @return object
  887. */
  888. function get_post_to_edit( $id ) {
  889. _deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
  890. return get_post( $id, OBJECT, 'edit' );
  891. }
  892. /**
  893. * Get the default page information to use.
  894. *
  895. * @since 2.5.0
  896. * @deprecated 3.5.0
  897. * @deprecated Use get_default_post_to_edit()
  898. *
  899. * @return WP_Post Post object containing all the default post data as attributes
  900. */
  901. function get_default_page_to_edit() {
  902. _deprecated_function( __FUNCTION__, '3.5', "get_default_post_to_edit( 'page' )" );
  903. $page = get_default_post_to_edit();
  904. $page->post_type = 'page';
  905. return $page;
  906. }
  907. /**
  908. * This was once used to create a thumbnail from an Image given a maximum side size.
  909. *
  910. * @since 1.2.0
  911. * @deprecated 3.5.0
  912. * @deprecated Use image_resize()
  913. * @see image_resize()
  914. *
  915. * @param mixed $file Filename of the original image, Or attachment id.
  916. * @param int $max_side Maximum length of a single side for the thumbnail.
  917. * @param mixed $deprecated Never used.
  918. * @return string Thumbnail path on success, Error string on failure.
  919. */
  920. function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
  921. _deprecated_function( __FUNCTION__, '3.5', 'image_resize()' );
  922. return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
  923. }
  924. /**
  925. * This was once used to display a metabox for the nav menu theme locations.
  926. *
  927. * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen.
  928. *
  929. * @since 3.0.0
  930. * @deprecated 3.6.0
  931. */
  932. function wp_nav_menu_locations_meta_box() {
  933. _deprecated_function( __FUNCTION__, '3.6' );
  934. }
  935. /**
  936. * This was once used to kick-off the Core Updater.
  937. *
  938. * Deprecated in favor of instantating a Core_Upgrader instance directly,
  939. * and calling the 'upgrade' method.
  940. *
  941. * @since 2.7.0
  942. * @deprecated 3.7.0
  943. * @see Core_Upgrader
  944. */
  945. function wp_update_core($current, $feedback = '') {
  946. _deprecated_function( __FUNCTION__, '3.7', 'new Core_Upgrader();' );
  947. if ( !empty($feedback) )
  948. add_filter('update_feedback', $feedback);
  949. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  950. $upgrader = new Core_Upgrader();
  951. return $upgrader->upgrade($current);
  952. }
  953. /**
  954. * This was once used to kick-off the Plugin Updater.
  955. *
  956. * Deprecated in favor of instantating a Plugin_Upgrader instance directly,
  957. * and calling the 'upgrade' method.
  958. * Unused since 2.8.0.
  959. *
  960. * @since 2.5.0
  961. * @deprecated 3.7.0
  962. * @see Plugin_Upgrader
  963. */
  964. function wp_update_plugin($plugin, $feedback = '') {
  965. _deprecated_function( __FUNCTION__, '3.7', 'new Plugin_Upgrader();' );
  966. if ( !empty($feedback) )
  967. add_filter('update_feedback', $feedback);
  968. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  969. $upgrader = new Plugin_Upgrader();
  970. return $upgrader->upgrade($plugin);
  971. }
  972. /**
  973. * This was once used to kick-off the Theme Updater.
  974. *
  975. * Deprecated in favor of instantating a Theme_Upgrader instance directly,
  976. * and calling the 'upgrade' method.
  977. * Unused since 2.8.0.
  978. *
  979. * @since 2.7.0
  980. * @deprecated 3.7.0
  981. * @see Theme_Upgrader
  982. */
  983. function wp_update_theme($theme, $feedback = '') {
  984. _deprecated_function( __FUNCTION__, '3.7', 'new Theme_Upgrader();' );
  985. if ( !empty($feedback) )
  986. add_filter('update_feedback', $feedback);
  987. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  988. $upgrader = new Theme_Upgrader();
  989. return $upgrader->upgrade($theme);
  990. }
  991. /**
  992. * This was once used to display attachment links. Now it is deprecated and stubbed.
  993. *
  994. * {@internal Missing Short Description}}
  995. *
  996. * @since 2.0.0
  997. * @deprecated 3.7.0
  998. *
  999. * @param int|bool $id
  1000. */
  1001. function the_attachment_links( $id = false ) {
  1002. _deprecated_function( __FUNCTION__, '3.7' );
  1003. }
  1004. /**#@+
  1005. * Displays a screen icon.
  1006. *
  1007. * @since 2.7.0
  1008. * @since 3.8.0 Screen icons are no longer used in WordPress. This function no longer produces output.
  1009. * @deprecated 3.8.0
  1010. */
  1011. function screen_icon() {
  1012. echo get_screen_icon();
  1013. }
  1014. function get_screen_icon() {
  1015. return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
  1016. }
  1017. /**#@-*/
  1018. /**#@+
  1019. * Deprecated dashboard widget controls.
  1020. *
  1021. * @since 2.5.0
  1022. * @deprecated 3.8.0
  1023. */
  1024. function wp_dashboard_incoming_links_output() {}
  1025. function wp_dashboard_secondary_output() {}
  1026. /**#@-*/
  1027. /**#@+
  1028. * Deprecated dashboard widget controls.
  1029. *
  1030. * @since 2.7.0
  1031. * @deprecated 3.8.0
  1032. */
  1033. function wp_dashboard_incoming_links() {}
  1034. function wp_dashboard_incoming_links_control() {}
  1035. function wp_dashboard_plugins() {}
  1036. function wp_dashboard_primary_control() {}
  1037. function wp_dashboard_recent_comments_control() {}
  1038. function wp_dashboard_secondary() {}
  1039. function wp_dashboard_secondary_control() {}
  1040. /**#@-*/
  1041. /**
  1042. * This was once used to move child posts to a new parent.
  1043. *
  1044. * @since 2.3.0
  1045. * @deprecated 3.9.0
  1046. * @access private
  1047. *
  1048. * @param int $old_ID
  1049. * @param int $new_ID
  1050. */
  1051. function _relocate_children( $old_ID, $new_ID ) {
  1052. _deprecated_function( __FUNCTION__, '3.9' );
  1053. }