deprecated.php 38 KB

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