Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

1399 linhas
35 KiB

  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," and "reading," among others.
  151. * @param string $option_name The name of an option to sanitize and save.
  152. * @param callable $sanitize_callback A callback function that sanitizes the option's value.
  153. */
  154. function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
  155. _deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' );
  156. register_setting( $option_group, $option_name, $sanitize_callback );
  157. }
  158. /**
  159. * Unregister a setting
  160. *
  161. * @since 2.7.0
  162. * @deprecated 3.0.0 Use unregister_setting()
  163. * @see unregister_setting()
  164. *
  165. * @param string $option_group
  166. * @param string $option_name
  167. * @param callable $sanitize_callback
  168. */
  169. function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
  170. _deprecated_function( __FUNCTION__, '3.0.0', 'unregister_setting()' );
  171. unregister_setting( $option_group, $option_name, $sanitize_callback );
  172. }
  173. /**
  174. * Determines the language to use for CodePress syntax highlighting.
  175. *
  176. * @since 2.8.0
  177. * @deprecated 3.0.0
  178. *
  179. * @param string $filename
  180. **/
  181. function codepress_get_lang( $filename ) {
  182. _deprecated_function( __FUNCTION__, '3.0.0' );
  183. }
  184. /**
  185. * Adds JavaScript required to make CodePress work on the theme/plugin editors.
  186. *
  187. * @since 2.8.0
  188. * @deprecated 3.0.0
  189. **/
  190. function codepress_footer_js() {
  191. _deprecated_function( __FUNCTION__, '3.0.0' );
  192. }
  193. /**
  194. * Determine whether to use CodePress.
  195. *
  196. * @since 2.8.0
  197. * @deprecated 3.0.0
  198. **/
  199. function use_codepress() {
  200. _deprecated_function( __FUNCTION__, '3.0.0' );
  201. }
  202. /**
  203. * Get all user IDs.
  204. *
  205. * @deprecated 3.1.0 Use get_users()
  206. *
  207. * @return array List of user IDs.
  208. */
  209. function get_author_user_ids() {
  210. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
  211. global $wpdb;
  212. if ( !is_multisite() )
  213. $level_key = $wpdb->get_blog_prefix() . 'user_level';
  214. else
  215. $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
  216. return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
  217. }
  218. /**
  219. * Gets author users who can edit posts.
  220. *
  221. * @deprecated 3.1.0 Use get_users()
  222. *
  223. * @param int $user_id User ID.
  224. * @return array|bool List of editable authors. False if no editable users.
  225. */
  226. function get_editable_authors( $user_id ) {
  227. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
  228. global $wpdb;
  229. $editable = get_editable_user_ids( $user_id );
  230. if ( !$editable ) {
  231. return false;
  232. } else {
  233. $editable = join(',', $editable);
  234. $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
  235. }
  236. return apply_filters('get_editable_authors', $authors);
  237. }
  238. /**
  239. * Gets the IDs of any users who can edit posts.
  240. *
  241. * @deprecated 3.1.0 Use get_users()
  242. *
  243. * @param int $user_id User ID.
  244. * @param bool $exclude_zeros Optional. Whether to exclude zeroes. Default true.
  245. * @return array Array of editable user IDs, empty array otherwise.
  246. */
  247. function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
  248. _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
  249. global $wpdb;
  250. if ( ! $user = get_userdata( $user_id ) )
  251. return array();
  252. $post_type_obj = get_post_type_object($post_type);
  253. if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
  254. if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
  255. return array($user->ID);
  256. else
  257. return array();
  258. }
  259. if ( !is_multisite() )
  260. $level_key = $wpdb->get_blog_prefix() . 'user_level';
  261. else
  262. $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
  263. $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
  264. if ( $exclude_zeros )
  265. $query .= " AND meta_value != '0'";
  266. return $wpdb->get_col( $query );
  267. }
  268. /**
  269. * Gets all users who are not authors.
  270. *
  271. * @deprecated 3.1.0 Use get_users()
  272. */
  273. function get_nonauthor_user_ids() {
  274. _deprecated_function( __FUNCTION__, '3.1.0', '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', false ) ) :
  283. /**
  284. * WordPress User Search class.
  285. *
  286. * @since 2.1.0
  287. * @deprecated 3.1.0 Use WP_User_Query
  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.0', '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. * Prepares the user search query (legacy).
  453. *
  454. * @since 2.1.0
  455. * @access public
  456. */
  457. public function prepare_query() {
  458. global $wpdb;
  459. $this->first_user = ($this->page - 1) * $this->users_per_page;
  460. $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
  461. $this->query_orderby = ' ORDER BY user_login';
  462. $search_sql = '';
  463. if ( $this->search_term ) {
  464. $searches = array();
  465. $search_sql = 'AND (';
  466. foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col )
  467. $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
  468. $search_sql .= implode(' OR ', $searches);
  469. $search_sql .= ')';
  470. }
  471. $this->query_from = " FROM $wpdb->users";
  472. $this->query_where = " WHERE 1=1 $search_sql";
  473. if ( $this->role ) {
  474. $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
  475. $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
  476. } elseif ( is_multisite() ) {
  477. $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels
  478. $this->query_from .= ", $wpdb->usermeta";
  479. $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
  480. }
  481. do_action_ref_array( 'pre_user_search', array( &$this ) );
  482. }
  483. /**
  484. * Executes the user search query.
  485. *
  486. * @since 2.1.0
  487. * @access public
  488. */
  489. public function query() {
  490. global $wpdb;
  491. $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
  492. if ( $this->results )
  493. $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit
  494. else
  495. $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
  496. }
  497. /**
  498. * Prepares variables for use in templates.
  499. *
  500. * @since 2.1.0
  501. * @access public
  502. */
  503. function prepare_vars_for_template_usage() {}
  504. /**
  505. * Handles paging for the user search query.
  506. *
  507. * @since 2.1.0
  508. * @access public
  509. */
  510. public function do_paging() {
  511. if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
  512. $args = array();
  513. if ( ! empty($this->search_term) )
  514. $args['usersearch'] = urlencode($this->search_term);
  515. if ( ! empty($this->role) )
  516. $args['role'] = urlencode($this->role);
  517. $this->paging_text = paginate_links( array(
  518. 'total' => ceil($this->total_users_for_query / $this->users_per_page),
  519. 'current' => $this->page,
  520. 'base' => 'users.php?%_%',
  521. 'format' => 'userspage=%#%',
  522. 'add_args' => $args
  523. ) );
  524. if ( $this->paging_text ) {
  525. $this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
  526. number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
  527. number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
  528. number_format_i18n( $this->total_users_for_query ),
  529. $this->paging_text
  530. );
  531. }
  532. }
  533. }
  534. /**
  535. * Retrieves the user search query results.
  536. *
  537. * @since 2.1.0
  538. * @access public
  539. *
  540. * @return array
  541. */
  542. public function get_results() {
  543. return (array) $this->results;
  544. }
  545. /**
  546. * Displaying paging text.
  547. *
  548. * @see do_paging() Builds paging text.
  549. *
  550. * @since 2.1.0
  551. * @access public
  552. */
  553. function page_links() {
  554. echo $this->paging_text;
  555. }
  556. /**
  557. * Whether paging is enabled.
  558. *
  559. * @see do_paging() Builds paging text.
  560. *
  561. * @since 2.1.0
  562. * @access public
  563. *
  564. * @return bool
  565. */
  566. function results_are_paged() {
  567. if ( $this->paging_text )
  568. return true;
  569. return false;
  570. }
  571. /**
  572. * Whether there are search terms.
  573. *
  574. * @since 2.1.0
  575. * @access public
  576. *
  577. * @return bool
  578. */
  579. function is_search() {
  580. if ( $this->search_term )
  581. return true;
  582. return false;
  583. }
  584. }
  585. endif;
  586. /**
  587. * Retrieves editable posts from other users.
  588. *
  589. * @since 2.3.0
  590. * @deprecated 3.1.0 Use get_posts()
  591. * @see get_posts()
  592. *
  593. * @param int $user_id User ID to not retrieve posts from.
  594. * @param string $type Optional. Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all).
  595. * Default 'any'.
  596. * @return array List of posts from others.
  597. */
  598. function get_others_unpublished_posts( $user_id, $type = 'any' ) {
  599. _deprecated_function( __FUNCTION__, '3.1.0' );
  600. global $wpdb;
  601. $editable = get_editable_user_ids( $user_id );
  602. if ( in_array($type, array('draft', 'pending')) )
  603. $type_sql = " post_status = '$type' ";
  604. else
  605. $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
  606. $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
  607. if ( !$editable ) {
  608. $other_unpubs = '';
  609. } else {
  610. $editable = join(',', $editable);
  611. $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) );
  612. }
  613. return apply_filters('get_others_drafts', $other_unpubs);
  614. }
  615. /**
  616. * Retrieve drafts from other users.
  617. *
  618. * @deprecated 3.1.0 Use get_posts()
  619. * @see get_posts()
  620. *
  621. * @param int $user_id User ID.
  622. * @return array List of drafts from other users.
  623. */
  624. function get_others_drafts($user_id) {
  625. _deprecated_function( __FUNCTION__, '3.1.0' );
  626. return get_others_unpublished_posts($user_id, 'draft');
  627. }
  628. /**
  629. * Retrieve pending review posts 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 posts with pending review post type from other users.
  636. */
  637. function get_others_pending($user_id) {
  638. _deprecated_function( __FUNCTION__, '3.1.0' );
  639. return get_others_unpublished_posts($user_id, 'pending');
  640. }
  641. /**
  642. * Output the QuickPress dashboard widget.
  643. *
  644. * @since 3.0.0
  645. * @deprecated 3.2.0 Use wp_dashboard_quick_press()
  646. * @see wp_dashboard_quick_press()
  647. */
  648. function wp_dashboard_quick_press_output() {
  649. _deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' );
  650. wp_dashboard_quick_press();
  651. }
  652. /**
  653. * Outputs the TinyMCE editor.
  654. *
  655. * @since 2.7.0
  656. * @deprecated 3.3.0 Use wp_editor()
  657. * @see wp_editor()
  658. *
  659. * @staticvar int $num
  660. */
  661. function wp_tiny_mce( $teeny = false, $settings = false ) {
  662. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  663. static $num = 1;
  664. if ( ! class_exists( '_WP_Editors', false ) )
  665. require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
  666. $editor_id = 'content' . $num++;
  667. $set = array(
  668. 'teeny' => $teeny,
  669. 'tinymce' => $settings ? $settings : true,
  670. 'quicktags' => false
  671. );
  672. $set = _WP_Editors::parse_settings($editor_id, $set);
  673. _WP_Editors::editor_settings($editor_id, $set);
  674. }
  675. /**
  676. * Preloads TinyMCE dialogs.
  677. *
  678. * @deprecated 3.3.0 Use wp_editor()
  679. * @see wp_editor()
  680. */
  681. function wp_preload_dialogs() {
  682. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  683. }
  684. /**
  685. * Prints TinyMCE editor JS.
  686. *
  687. * @deprecated 3.3.0 Use wp_editor()
  688. * @see wp_editor()
  689. */
  690. function wp_print_editor_js() {
  691. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  692. }
  693. /**
  694. * Handles quicktags.
  695. *
  696. * @deprecated 3.3.0 Use wp_editor()
  697. * @see wp_editor()
  698. */
  699. function wp_quicktags() {
  700. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  701. }
  702. /**
  703. * Returns the screen layout options.
  704. *
  705. * @since 2.8.0
  706. * @deprecated 3.3.0 WP_Screen::render_screen_layout()
  707. * @see WP_Screen::render_screen_layout()
  708. */
  709. function screen_layout( $screen ) {
  710. _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' );
  711. $current_screen = get_current_screen();
  712. if ( ! $current_screen )
  713. return '';
  714. ob_start();
  715. $current_screen->render_screen_layout();
  716. return ob_get_clean();
  717. }
  718. /**
  719. * Returns the screen's per-page options.
  720. *
  721. * @since 2.8.0
  722. * @deprecated 3.3.0 Use WP_Screen::render_per_page_options()
  723. * @see WP_Screen::render_per_page_options()
  724. */
  725. function screen_options( $screen ) {
  726. _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' );
  727. $current_screen = get_current_screen();
  728. if ( ! $current_screen )
  729. return '';
  730. ob_start();
  731. $current_screen->render_per_page_options();
  732. return ob_get_clean();
  733. }
  734. /**
  735. * Renders the screen's help.
  736. *
  737. * @since 2.7.0
  738. * @deprecated 3.3.0 Use WP_Screen::render_screen_meta()
  739. * @see WP_Screen::render_screen_meta()
  740. */
  741. function screen_meta( $screen ) {
  742. $current_screen = get_current_screen();
  743. $current_screen->render_screen_meta();
  744. }
  745. /**
  746. * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
  747. *
  748. * @since 2.7.0
  749. * @deprecated 3.2.0 Use WP_Admin_Bar
  750. * @see WP_Admin_Bar
  751. */
  752. function favorite_actions() {
  753. _deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' );
  754. }
  755. /**
  756. * Handles uploading an image.
  757. *
  758. * @deprecated 3.3.0 Use wp_media_upload_handler()
  759. * @see wp_media_upload_handler()
  760. *
  761. * @return null|string
  762. */
  763. function media_upload_image() {
  764. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  765. return wp_media_upload_handler();
  766. }
  767. /**
  768. * Handles uploading an audio file.
  769. *
  770. * @deprecated 3.3.0 Use wp_media_upload_handler()
  771. * @see wp_media_upload_handler()
  772. *
  773. * @return null|string
  774. */
  775. function media_upload_audio() {
  776. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  777. return wp_media_upload_handler();
  778. }
  779. /**
  780. * Handles uploading a video file.
  781. *
  782. * @deprecated 3.3.0 Use wp_media_upload_handler()
  783. * @see wp_media_upload_handler()
  784. *
  785. * @return null|string
  786. */
  787. function media_upload_video() {
  788. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  789. return wp_media_upload_handler();
  790. }
  791. /**
  792. * Handles uploading a generic file.
  793. *
  794. * @deprecated 3.3.0 Use wp_media_upload_handler()
  795. * @see wp_media_upload_handler()
  796. *
  797. * @return null|string
  798. */
  799. function media_upload_file() {
  800. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  801. return wp_media_upload_handler();
  802. }
  803. /**
  804. * Handles retrieving the insert-from-URL form for an image.
  805. *
  806. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  807. * @see wp_media_insert_url_form()
  808. *
  809. * @return string
  810. */
  811. function type_url_form_image() {
  812. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" );
  813. return wp_media_insert_url_form( 'image' );
  814. }
  815. /**
  816. * Handles retrieving the insert-from-URL form for an audio file.
  817. *
  818. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  819. * @see wp_media_insert_url_form()
  820. *
  821. * @return string
  822. */
  823. function type_url_form_audio() {
  824. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" );
  825. return wp_media_insert_url_form( 'audio' );
  826. }
  827. /**
  828. * Handles retrieving the insert-from-URL form for a video file.
  829. *
  830. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  831. * @see wp_media_insert_url_form()
  832. *
  833. * @return string
  834. */
  835. function type_url_form_video() {
  836. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" );
  837. return wp_media_insert_url_form( 'video' );
  838. }
  839. /**
  840. * Handles retrieving the insert-from-URL form for a generic file.
  841. *
  842. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  843. * @see wp_media_insert_url_form()
  844. *
  845. * @return string
  846. */
  847. function type_url_form_file() {
  848. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" );
  849. return wp_media_insert_url_form( 'file' );
  850. }
  851. /**
  852. * Add contextual help text for a page.
  853. *
  854. * Creates an 'Overview' help tab.
  855. *
  856. * @since 2.7.0
  857. * @deprecated 3.3.0 Use WP_Screen::add_help_tab()
  858. * @see WP_Screen::add_help_tab()
  859. *
  860. * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
  861. * @param string $help The content of an 'Overview' help tab.
  862. */
  863. function add_contextual_help( $screen, $help ) {
  864. _deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' );
  865. if ( is_string( $screen ) )
  866. $screen = convert_to_screen( $screen );
  867. WP_Screen::add_old_compat_help( $screen, $help );
  868. }
  869. /**
  870. * Get the allowed themes for the current site.
  871. *
  872. * @since 3.0.0
  873. * @deprecated 3.4.0 Use wp_get_themes()
  874. * @see wp_get_themes()
  875. *
  876. * @return array $themes Array of allowed themes.
  877. */
  878. function get_allowed_themes() {
  879. _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" );
  880. $themes = wp_get_themes( array( 'allowed' => true ) );
  881. $wp_themes = array();
  882. foreach ( $themes as $theme ) {
  883. $wp_themes[ $theme->get('Name') ] = $theme;
  884. }
  885. return $wp_themes;
  886. }
  887. /**
  888. * Retrieves a list of broken themes.
  889. *
  890. * @since 1.5.0
  891. * @deprecated 3.4.0 Use wp_get_themes()
  892. * @see wp_get_themes()
  893. *
  894. * @return array
  895. */
  896. function get_broken_themes() {
  897. _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )" );
  898. $themes = wp_get_themes( array( 'errors' => true ) );
  899. $broken = array();
  900. foreach ( $themes as $theme ) {
  901. $name = $theme->get('Name');
  902. $broken[ $name ] = array(
  903. 'Name' => $name,
  904. 'Title' => $name,
  905. 'Description' => $theme->errors()->get_error_message(),
  906. );
  907. }
  908. return $broken;
  909. }
  910. /**
  911. * Retrieves information on the current active theme.
  912. *
  913. * @since 2.0.0
  914. * @deprecated 3.4.0 Use wp_get_theme()
  915. * @see wp_get_theme()
  916. *
  917. * @return WP_Theme
  918. */
  919. function current_theme_info() {
  920. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
  921. return wp_get_theme();
  922. }
  923. /**
  924. * This was once used to display an 'Insert into Post' button.
  925. *
  926. * Now it is deprecated and stubbed.
  927. *
  928. * @deprecated 3.5.0
  929. */
  930. function _insert_into_post_button( $type ) {
  931. _deprecated_function( __FUNCTION__, '3.5.0' );
  932. }
  933. /**
  934. * This was once used to display a media button.
  935. *
  936. * Now it is deprecated and stubbed.
  937. *
  938. * @deprecated 3.5.0
  939. */
  940. function _media_button($title, $icon, $type, $id) {
  941. _deprecated_function( __FUNCTION__, '3.5.0' );
  942. }
  943. /**
  944. * Gets an existing post and format it for editing.
  945. *
  946. * @since 2.0.0
  947. * @deprecated 3.5.0 Use get_post()
  948. * @see get_post()
  949. *
  950. * @param int $id
  951. * @return object
  952. */
  953. function get_post_to_edit( $id ) {
  954. _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
  955. return get_post( $id, OBJECT, 'edit' );
  956. }
  957. /**
  958. * Gets the default page information to use.
  959. *
  960. * @since 2.5.0
  961. * @deprecated 3.5.0 Use get_default_post_to_edit()
  962. * @see get_default_post_to_edit()
  963. *
  964. * @return WP_Post Post object containing all the default post data as attributes
  965. */
  966. function get_default_page_to_edit() {
  967. _deprecated_function( __FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )" );
  968. $page = get_default_post_to_edit();
  969. $page->post_type = 'page';
  970. return $page;
  971. }
  972. /**
  973. * This was once used to create a thumbnail from an Image given a maximum side size.
  974. *
  975. * @since 1.2.0
  976. * @deprecated 3.5.0 Use image_resize()
  977. * @see image_resize()
  978. *
  979. * @param mixed $file Filename of the original image, Or attachment id.
  980. * @param int $max_side Maximum length of a single side for the thumbnail.
  981. * @param mixed $deprecated Never used.
  982. * @return string Thumbnail path on success, Error string on failure.
  983. */
  984. function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
  985. _deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' );
  986. return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
  987. }
  988. /**
  989. * This was once used to display a meta box for the nav menu theme locations.
  990. *
  991. * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen.
  992. *
  993. * @since 3.0.0
  994. * @deprecated 3.6.0
  995. */
  996. function wp_nav_menu_locations_meta_box() {
  997. _deprecated_function( __FUNCTION__, '3.6.0' );
  998. }
  999. /**
  1000. * This was once used to kick-off the Core Updater.
  1001. *
  1002. * Deprecated in favor of instantating a Core_Upgrader instance directly,
  1003. * and calling the 'upgrade' method.
  1004. *
  1005. * @since 2.7.0
  1006. * @deprecated 3.7.0 Use Core_Upgrader
  1007. * @see Core_Upgrader
  1008. */
  1009. function wp_update_core($current, $feedback = '') {
  1010. _deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' );
  1011. if ( !empty($feedback) )
  1012. add_filter('update_feedback', $feedback);
  1013. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  1014. $upgrader = new Core_Upgrader();
  1015. return $upgrader->upgrade($current);
  1016. }
  1017. /**
  1018. * This was once used to kick-off the Plugin Updater.
  1019. *
  1020. * Deprecated in favor of instantating a Plugin_Upgrader instance directly,
  1021. * and calling the 'upgrade' method.
  1022. * Unused since 2.8.0.
  1023. *
  1024. * @since 2.5.0
  1025. * @deprecated 3.7.0 Use Plugin_Upgrader
  1026. * @see Plugin_Upgrader
  1027. */
  1028. function wp_update_plugin($plugin, $feedback = '') {
  1029. _deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' );
  1030. if ( !empty($feedback) )
  1031. add_filter('update_feedback', $feedback);
  1032. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  1033. $upgrader = new Plugin_Upgrader();
  1034. return $upgrader->upgrade($plugin);
  1035. }
  1036. /**
  1037. * This was once used to kick-off the Theme Updater.
  1038. *
  1039. * Deprecated in favor of instantiating a Theme_Upgrader instance directly,
  1040. * and calling the 'upgrade' method.
  1041. * Unused since 2.8.0.
  1042. *
  1043. * @since 2.7.0
  1044. * @deprecated 3.7.0 Use Theme_Upgrader
  1045. * @see Theme_Upgrader
  1046. */
  1047. function wp_update_theme($theme, $feedback = '') {
  1048. _deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' );
  1049. if ( !empty($feedback) )
  1050. add_filter('update_feedback', $feedback);
  1051. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  1052. $upgrader = new Theme_Upgrader();
  1053. return $upgrader->upgrade($theme);
  1054. }
  1055. /**
  1056. * This was once used to display attachment links. Now it is deprecated and stubbed.
  1057. *
  1058. * @since 2.0.0
  1059. * @deprecated 3.7.0
  1060. *
  1061. * @param int|bool $id
  1062. */
  1063. function the_attachment_links( $id = false ) {
  1064. _deprecated_function( __FUNCTION__, '3.7.0' );
  1065. }
  1066. /**
  1067. * Displays a screen icon.
  1068. *
  1069. * @since 2.7.0
  1070. * @since 3.8.0 Screen icons are no longer used in WordPress. This function no longer produces output.
  1071. * @deprecated 3.8.0 Use get_screen_icon()
  1072. * @see get_screen_icon()
  1073. */
  1074. function screen_icon() {
  1075. echo get_screen_icon();
  1076. }
  1077. /**
  1078. * Retrieves the screen icon (no longer used in 3.8+).
  1079. *
  1080. * @deprecated 3.8.0
  1081. *
  1082. * @return string
  1083. */
  1084. function get_screen_icon() {
  1085. return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
  1086. }
  1087. /**
  1088. * Deprecated dashboard widget controls.
  1089. *
  1090. * @since 2.5.0
  1091. * @deprecated 3.8.0
  1092. */
  1093. function wp_dashboard_incoming_links_output() {}
  1094. /**
  1095. * Deprecated dashboard secondary output.
  1096. *
  1097. * @deprecated 3.8.0
  1098. */
  1099. function wp_dashboard_secondary_output() {}
  1100. /**
  1101. * Deprecated dashboard widget controls.
  1102. *
  1103. * @since 2.7.0
  1104. * @deprecated 3.8.0
  1105. */
  1106. function wp_dashboard_incoming_links() {}
  1107. /**
  1108. * Deprecated dashboard incoming links control.
  1109. *
  1110. * @deprecated 3.8.0
  1111. */
  1112. function wp_dashboard_incoming_links_control() {}
  1113. /**
  1114. * Deprecated dashboard plugins control.
  1115. *
  1116. * @deprecated 3.8.0
  1117. */
  1118. function wp_dashboard_plugins() {}
  1119. /**
  1120. * Deprecated dashboard primary control.
  1121. *
  1122. * @deprecated 3.8.0
  1123. */
  1124. function wp_dashboard_primary_control() {}
  1125. /**
  1126. * Deprecated dashboard recent comments control.
  1127. *
  1128. * @deprecated 3.8.0
  1129. */
  1130. function wp_dashboard_recent_comments_control() {}
  1131. /**
  1132. * Deprecated dashboard secondary section.
  1133. *
  1134. * @deprecated 3.8.0
  1135. */
  1136. function wp_dashboard_secondary() {}
  1137. /**
  1138. * Deprecated dashboard secondary control.
  1139. *
  1140. * @deprecated 3.8.0
  1141. */
  1142. function wp_dashboard_secondary_control() {}
  1143. /**
  1144. * This was once used to move child posts to a new parent.
  1145. *
  1146. * @since 2.3.0
  1147. * @deprecated 3.9.0
  1148. * @access private
  1149. *
  1150. * @param int $old_ID
  1151. * @param int $new_ID
  1152. */
  1153. function _relocate_children( $old_ID, $new_ID ) {
  1154. _deprecated_function( __FUNCTION__, '3.9.0' );
  1155. }
  1156. /**
  1157. * Add a top-level menu page in the 'objects' section.
  1158. *
  1159. * This function takes a capability which will be used to determine whether
  1160. * or not a page is included in the menu.
  1161. *
  1162. * The function which is hooked in to handle the output of the page must check
  1163. * that the user has the required capability as well.
  1164. *
  1165. * @since 2.7.0
  1166. *
  1167. * @deprecated 4.5.0 Use add_menu_page()
  1168. * @see add_menu_page()
  1169. * @global int $_wp_last_object_menu
  1170. *
  1171. * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
  1172. * @param string $menu_title The text to be used for the menu.
  1173. * @param string $capability The capability required for this menu to be displayed to the user.
  1174. * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
  1175. * @param callable $function The function to be called to output the content for this page.
  1176. * @param string $icon_url The url to the icon to be used for this menu.
  1177. * @return string The resulting page's hook_suffix.
  1178. */
  1179. function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
  1180. _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
  1181. global $_wp_last_object_menu;
  1182. $_wp_last_object_menu++;
  1183. return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_object_menu);
  1184. }
  1185. /**
  1186. * Add a top-level menu page in the 'utility' section.
  1187. *
  1188. * This function takes a capability which will be used to determine whether
  1189. * or not a page is included in the menu.
  1190. *
  1191. * The function which is hooked in to handle the output of the page must check
  1192. * that the user has the required capability as well.
  1193. *
  1194. * @since 2.7.0
  1195. *
  1196. * @deprecated 4.5.0 Use add_menu_page()
  1197. * @see add_menu_page()
  1198. * @global int $_wp_last_utility_menu
  1199. *
  1200. * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
  1201. * @param string $menu_title The text to be used for the menu.
  1202. * @param string $capability The capability required for this menu to be displayed to the user.
  1203. * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
  1204. * @param callable $function The function to be called to output the content for this page.
  1205. * @param string $icon_url The url to the icon to be used for this menu.
  1206. * @return string The resulting page's hook_suffix.
  1207. */
  1208. function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
  1209. _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
  1210. global $_wp_last_utility_menu;
  1211. $_wp_last_utility_menu++;
  1212. return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu);
  1213. }
  1214. /**
  1215. * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
  1216. * as they disregard the autocomplete setting on the editor textarea. That can break the editor
  1217. * when the user navigates to it with the browser's Back button. See #28037
  1218. *
  1219. * Replaced with wp_page_reload_on_back_button_js() that also fixes this problem.
  1220. *
  1221. * @since 4.0.0
  1222. * $deprecated 4.6.0
  1223. *
  1224. * @global bool $is_safari
  1225. * @global bool $is_chrome
  1226. */
  1227. function post_form_autocomplete_off() {
  1228. global $is_safari, $is_chrome;
  1229. _deprecated_function( __FUNCTION__, '4.6.0' );
  1230. if ( $is_safari || $is_chrome ) {
  1231. echo ' autocomplete="off"';
  1232. }
  1233. }