deprecated.php 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565
  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(
  534. /* translators: 1: Starting number of users on the current page, 2: Ending number of users, 3: Total number of users. */
  535. '<span class="displaying-num">' . __( 'Displaying %1$s&#8211;%2$s of %3$s' ) . '</span>%s',
  536. number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
  537. number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
  538. number_format_i18n( $this->total_users_for_query ),
  539. $this->paging_text
  540. );
  541. }
  542. }
  543. }
  544. /**
  545. * Retrieves the user search query results.
  546. *
  547. * @since 2.1.0
  548. * @access public
  549. *
  550. * @return array
  551. */
  552. public function get_results() {
  553. return (array) $this->results;
  554. }
  555. /**
  556. * Displaying paging text.
  557. *
  558. * @see do_paging() Builds paging text.
  559. *
  560. * @since 2.1.0
  561. * @access public
  562. */
  563. function page_links() {
  564. echo $this->paging_text;
  565. }
  566. /**
  567. * Whether paging is enabled.
  568. *
  569. * @see do_paging() Builds paging text.
  570. *
  571. * @since 2.1.0
  572. * @access public
  573. *
  574. * @return bool
  575. */
  576. function results_are_paged() {
  577. if ( $this->paging_text )
  578. return true;
  579. return false;
  580. }
  581. /**
  582. * Whether there are search terms.
  583. *
  584. * @since 2.1.0
  585. * @access public
  586. *
  587. * @return bool
  588. */
  589. function is_search() {
  590. if ( $this->search_term )
  591. return true;
  592. return false;
  593. }
  594. }
  595. endif;
  596. /**
  597. * Retrieves editable posts from other users.
  598. *
  599. * @since 2.3.0
  600. * @deprecated 3.1.0 Use get_posts()
  601. * @see get_posts()
  602. *
  603. * @global wpdb $wpdb WordPress database abstraction object.
  604. *
  605. * @param int $user_id User ID to not retrieve posts from.
  606. * @param string $type Optional. Post type to retrieve. Accepts 'draft', 'pending' or 'any' (all).
  607. * Default 'any'.
  608. * @return array List of posts from others.
  609. */
  610. function get_others_unpublished_posts( $user_id, $type = 'any' ) {
  611. _deprecated_function( __FUNCTION__, '3.1.0' );
  612. global $wpdb;
  613. $editable = get_editable_user_ids( $user_id );
  614. if ( in_array($type, array('draft', 'pending')) )
  615. $type_sql = " post_status = '$type' ";
  616. else
  617. $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
  618. $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
  619. if ( !$editable ) {
  620. $other_unpubs = '';
  621. } else {
  622. $editable = join(',', $editable);
  623. $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) );
  624. }
  625. return apply_filters('get_others_drafts', $other_unpubs);
  626. }
  627. /**
  628. * Retrieve drafts from other users.
  629. *
  630. * @deprecated 3.1.0 Use get_posts()
  631. * @see get_posts()
  632. *
  633. * @param int $user_id User ID.
  634. * @return array List of drafts from other users.
  635. */
  636. function get_others_drafts($user_id) {
  637. _deprecated_function( __FUNCTION__, '3.1.0' );
  638. return get_others_unpublished_posts($user_id, 'draft');
  639. }
  640. /**
  641. * Retrieve pending review posts from other users.
  642. *
  643. * @deprecated 3.1.0 Use get_posts()
  644. * @see get_posts()
  645. *
  646. * @param int $user_id User ID.
  647. * @return array List of posts with pending review post type from other users.
  648. */
  649. function get_others_pending($user_id) {
  650. _deprecated_function( __FUNCTION__, '3.1.0' );
  651. return get_others_unpublished_posts($user_id, 'pending');
  652. }
  653. /**
  654. * Output the QuickPress dashboard widget.
  655. *
  656. * @since 3.0.0
  657. * @deprecated 3.2.0 Use wp_dashboard_quick_press()
  658. * @see wp_dashboard_quick_press()
  659. */
  660. function wp_dashboard_quick_press_output() {
  661. _deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' );
  662. wp_dashboard_quick_press();
  663. }
  664. /**
  665. * Outputs the TinyMCE editor.
  666. *
  667. * @since 2.7.0
  668. * @deprecated 3.3.0 Use wp_editor()
  669. * @see wp_editor()
  670. *
  671. * @staticvar int $num
  672. */
  673. function wp_tiny_mce( $teeny = false, $settings = false ) {
  674. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  675. static $num = 1;
  676. if ( ! class_exists( '_WP_Editors', false ) )
  677. require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
  678. $editor_id = 'content' . $num++;
  679. $set = array(
  680. 'teeny' => $teeny,
  681. 'tinymce' => $settings ? $settings : true,
  682. 'quicktags' => false
  683. );
  684. $set = _WP_Editors::parse_settings($editor_id, $set);
  685. _WP_Editors::editor_settings($editor_id, $set);
  686. }
  687. /**
  688. * Preloads TinyMCE dialogs.
  689. *
  690. * @deprecated 3.3.0 Use wp_editor()
  691. * @see wp_editor()
  692. */
  693. function wp_preload_dialogs() {
  694. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  695. }
  696. /**
  697. * Prints TinyMCE editor JS.
  698. *
  699. * @deprecated 3.3.0 Use wp_editor()
  700. * @see wp_editor()
  701. */
  702. function wp_print_editor_js() {
  703. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  704. }
  705. /**
  706. * Handles quicktags.
  707. *
  708. * @deprecated 3.3.0 Use wp_editor()
  709. * @see wp_editor()
  710. */
  711. function wp_quicktags() {
  712. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
  713. }
  714. /**
  715. * Returns the screen layout options.
  716. *
  717. * @since 2.8.0
  718. * @deprecated 3.3.0 WP_Screen::render_screen_layout()
  719. * @see WP_Screen::render_screen_layout()
  720. */
  721. function screen_layout( $screen ) {
  722. _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' );
  723. $current_screen = get_current_screen();
  724. if ( ! $current_screen )
  725. return '';
  726. ob_start();
  727. $current_screen->render_screen_layout();
  728. return ob_get_clean();
  729. }
  730. /**
  731. * Returns the screen's per-page options.
  732. *
  733. * @since 2.8.0
  734. * @deprecated 3.3.0 Use WP_Screen::render_per_page_options()
  735. * @see WP_Screen::render_per_page_options()
  736. */
  737. function screen_options( $screen ) {
  738. _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' );
  739. $current_screen = get_current_screen();
  740. if ( ! $current_screen )
  741. return '';
  742. ob_start();
  743. $current_screen->render_per_page_options();
  744. return ob_get_clean();
  745. }
  746. /**
  747. * Renders the screen's help.
  748. *
  749. * @since 2.7.0
  750. * @deprecated 3.3.0 Use WP_Screen::render_screen_meta()
  751. * @see WP_Screen::render_screen_meta()
  752. */
  753. function screen_meta( $screen ) {
  754. $current_screen = get_current_screen();
  755. $current_screen->render_screen_meta();
  756. }
  757. /**
  758. * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
  759. *
  760. * @since 2.7.0
  761. * @deprecated 3.2.0 Use WP_Admin_Bar
  762. * @see WP_Admin_Bar
  763. */
  764. function favorite_actions() {
  765. _deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' );
  766. }
  767. /**
  768. * Handles uploading an image.
  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_image() {
  776. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  777. return wp_media_upload_handler();
  778. }
  779. /**
  780. * Handles uploading an audio 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_audio() {
  788. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  789. return wp_media_upload_handler();
  790. }
  791. /**
  792. * Handles uploading a video 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_video() {
  800. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  801. return wp_media_upload_handler();
  802. }
  803. /**
  804. * Handles uploading a generic file.
  805. *
  806. * @deprecated 3.3.0 Use wp_media_upload_handler()
  807. * @see wp_media_upload_handler()
  808. *
  809. * @return null|string
  810. */
  811. function media_upload_file() {
  812. _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
  813. return wp_media_upload_handler();
  814. }
  815. /**
  816. * Handles retrieving the insert-from-URL form for an image.
  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_image() {
  824. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" );
  825. return wp_media_insert_url_form( 'image' );
  826. }
  827. /**
  828. * Handles retrieving the insert-from-URL form for an audio 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_audio() {
  836. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" );
  837. return wp_media_insert_url_form( 'audio' );
  838. }
  839. /**
  840. * Handles retrieving the insert-from-URL form for a video 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_video() {
  848. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" );
  849. return wp_media_insert_url_form( 'video' );
  850. }
  851. /**
  852. * Handles retrieving the insert-from-URL form for a generic file.
  853. *
  854. * @deprecated 3.3.0 Use wp_media_insert_url_form()
  855. * @see wp_media_insert_url_form()
  856. *
  857. * @return string
  858. */
  859. function type_url_form_file() {
  860. _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" );
  861. return wp_media_insert_url_form( 'file' );
  862. }
  863. /**
  864. * Add contextual help text for a page.
  865. *
  866. * Creates an 'Overview' help tab.
  867. *
  868. * @since 2.7.0
  869. * @deprecated 3.3.0 Use WP_Screen::add_help_tab()
  870. * @see WP_Screen::add_help_tab()
  871. *
  872. * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
  873. * @param string $help The content of an 'Overview' help tab.
  874. */
  875. function add_contextual_help( $screen, $help ) {
  876. _deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' );
  877. if ( is_string( $screen ) )
  878. $screen = convert_to_screen( $screen );
  879. WP_Screen::add_old_compat_help( $screen, $help );
  880. }
  881. /**
  882. * Get the allowed themes for the current site.
  883. *
  884. * @since 3.0.0
  885. * @deprecated 3.4.0 Use wp_get_themes()
  886. * @see wp_get_themes()
  887. *
  888. * @return array $themes Array of allowed themes.
  889. */
  890. function get_allowed_themes() {
  891. _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" );
  892. $themes = wp_get_themes( array( 'allowed' => true ) );
  893. $wp_themes = array();
  894. foreach ( $themes as $theme ) {
  895. $wp_themes[ $theme->get('Name') ] = $theme;
  896. }
  897. return $wp_themes;
  898. }
  899. /**
  900. * Retrieves a list of broken themes.
  901. *
  902. * @since 1.5.0
  903. * @deprecated 3.4.0 Use wp_get_themes()
  904. * @see wp_get_themes()
  905. *
  906. * @return array
  907. */
  908. function get_broken_themes() {
  909. _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )" );
  910. $themes = wp_get_themes( array( 'errors' => true ) );
  911. $broken = array();
  912. foreach ( $themes as $theme ) {
  913. $name = $theme->get('Name');
  914. $broken[ $name ] = array(
  915. 'Name' => $name,
  916. 'Title' => $name,
  917. 'Description' => $theme->errors()->get_error_message(),
  918. );
  919. }
  920. return $broken;
  921. }
  922. /**
  923. * Retrieves information on the current active theme.
  924. *
  925. * @since 2.0.0
  926. * @deprecated 3.4.0 Use wp_get_theme()
  927. * @see wp_get_theme()
  928. *
  929. * @return WP_Theme
  930. */
  931. function current_theme_info() {
  932. _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
  933. return wp_get_theme();
  934. }
  935. /**
  936. * This was once used to display an 'Insert into Post' button.
  937. *
  938. * Now it is deprecated and stubbed.
  939. *
  940. * @deprecated 3.5.0
  941. */
  942. function _insert_into_post_button( $type ) {
  943. _deprecated_function( __FUNCTION__, '3.5.0' );
  944. }
  945. /**
  946. * This was once used to display a media button.
  947. *
  948. * Now it is deprecated and stubbed.
  949. *
  950. * @deprecated 3.5.0
  951. */
  952. function _media_button($title, $icon, $type, $id) {
  953. _deprecated_function( __FUNCTION__, '3.5.0' );
  954. }
  955. /**
  956. * Gets an existing post and format it for editing.
  957. *
  958. * @since 2.0.0
  959. * @deprecated 3.5.0 Use get_post()
  960. * @see get_post()
  961. *
  962. * @param int $id
  963. * @return object
  964. */
  965. function get_post_to_edit( $id ) {
  966. _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
  967. return get_post( $id, OBJECT, 'edit' );
  968. }
  969. /**
  970. * Gets the default page information to use.
  971. *
  972. * @since 2.5.0
  973. * @deprecated 3.5.0 Use get_default_post_to_edit()
  974. * @see get_default_post_to_edit()
  975. *
  976. * @return WP_Post Post object containing all the default post data as attributes
  977. */
  978. function get_default_page_to_edit() {
  979. _deprecated_function( __FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )" );
  980. $page = get_default_post_to_edit();
  981. $page->post_type = 'page';
  982. return $page;
  983. }
  984. /**
  985. * This was once used to create a thumbnail from an Image given a maximum side size.
  986. *
  987. * @since 1.2.0
  988. * @deprecated 3.5.0 Use image_resize()
  989. * @see image_resize()
  990. *
  991. * @param mixed $file Filename of the original image, Or attachment id.
  992. * @param int $max_side Maximum length of a single side for the thumbnail.
  993. * @param mixed $deprecated Never used.
  994. * @return string Thumbnail path on success, Error string on failure.
  995. */
  996. function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
  997. _deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' );
  998. return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
  999. }
  1000. /**
  1001. * This was once used to display a meta box for the nav menu theme locations.
  1002. *
  1003. * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen.
  1004. *
  1005. * @since 3.0.0
  1006. * @deprecated 3.6.0
  1007. */
  1008. function wp_nav_menu_locations_meta_box() {
  1009. _deprecated_function( __FUNCTION__, '3.6.0' );
  1010. }
  1011. /**
  1012. * This was once used to kick-off the Core Updater.
  1013. *
  1014. * Deprecated in favor of instantating a Core_Upgrader instance directly,
  1015. * and calling the 'upgrade' method.
  1016. *
  1017. * @since 2.7.0
  1018. * @deprecated 3.7.0 Use Core_Upgrader
  1019. * @see Core_Upgrader
  1020. */
  1021. function wp_update_core($current, $feedback = '') {
  1022. _deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' );
  1023. if ( !empty($feedback) )
  1024. add_filter('update_feedback', $feedback);
  1025. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  1026. $upgrader = new Core_Upgrader();
  1027. return $upgrader->upgrade($current);
  1028. }
  1029. /**
  1030. * This was once used to kick-off the Plugin Updater.
  1031. *
  1032. * Deprecated in favor of instantating a Plugin_Upgrader instance directly,
  1033. * and calling the 'upgrade' method.
  1034. * Unused since 2.8.0.
  1035. *
  1036. * @since 2.5.0
  1037. * @deprecated 3.7.0 Use Plugin_Upgrader
  1038. * @see Plugin_Upgrader
  1039. */
  1040. function wp_update_plugin($plugin, $feedback = '') {
  1041. _deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' );
  1042. if ( !empty($feedback) )
  1043. add_filter('update_feedback', $feedback);
  1044. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  1045. $upgrader = new Plugin_Upgrader();
  1046. return $upgrader->upgrade($plugin);
  1047. }
  1048. /**
  1049. * This was once used to kick-off the Theme Updater.
  1050. *
  1051. * Deprecated in favor of instantiating a Theme_Upgrader instance directly,
  1052. * and calling the 'upgrade' method.
  1053. * Unused since 2.8.0.
  1054. *
  1055. * @since 2.7.0
  1056. * @deprecated 3.7.0 Use Theme_Upgrader
  1057. * @see Theme_Upgrader
  1058. */
  1059. function wp_update_theme($theme, $feedback = '') {
  1060. _deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' );
  1061. if ( !empty($feedback) )
  1062. add_filter('update_feedback', $feedback);
  1063. include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
  1064. $upgrader = new Theme_Upgrader();
  1065. return $upgrader->upgrade($theme);
  1066. }
  1067. /**
  1068. * This was once used to display attachment links. Now it is deprecated and stubbed.
  1069. *
  1070. * @since 2.0.0
  1071. * @deprecated 3.7.0
  1072. *
  1073. * @param int|bool $id
  1074. */
  1075. function the_attachment_links( $id = false ) {
  1076. _deprecated_function( __FUNCTION__, '3.7.0' );
  1077. }
  1078. /**
  1079. * Displays a screen icon.
  1080. *
  1081. * @since 2.7.0
  1082. * @deprecated 3.8.0
  1083. */
  1084. function screen_icon() {
  1085. _deprecated_function( __FUNCTION__, '3.8.0' );
  1086. echo get_screen_icon();
  1087. }
  1088. /**
  1089. * Retrieves the screen icon (no longer used in 3.8+).
  1090. *
  1091. * @since 3.2.0
  1092. * @deprecated 3.8.0
  1093. *
  1094. * @return string An HTML comment explaining that icons are no longer used.
  1095. */
  1096. function get_screen_icon() {
  1097. _deprecated_function( __FUNCTION__, '3.8.0' );
  1098. return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
  1099. }
  1100. /**
  1101. * Deprecated dashboard widget controls.
  1102. *
  1103. * @since 2.5.0
  1104. * @deprecated 3.8.0
  1105. */
  1106. function wp_dashboard_incoming_links_output() {}
  1107. /**
  1108. * Deprecated dashboard secondary output.
  1109. *
  1110. * @deprecated 3.8.0
  1111. */
  1112. function wp_dashboard_secondary_output() {}
  1113. /**
  1114. * Deprecated dashboard widget controls.
  1115. *
  1116. * @since 2.7.0
  1117. * @deprecated 3.8.0
  1118. */
  1119. function wp_dashboard_incoming_links() {}
  1120. /**
  1121. * Deprecated dashboard incoming links control.
  1122. *
  1123. * @deprecated 3.8.0
  1124. */
  1125. function wp_dashboard_incoming_links_control() {}
  1126. /**
  1127. * Deprecated dashboard plugins control.
  1128. *
  1129. * @deprecated 3.8.0
  1130. */
  1131. function wp_dashboard_plugins() {}
  1132. /**
  1133. * Deprecated dashboard primary control.
  1134. *
  1135. * @deprecated 3.8.0
  1136. */
  1137. function wp_dashboard_primary_control() {}
  1138. /**
  1139. * Deprecated dashboard recent comments control.
  1140. *
  1141. * @deprecated 3.8.0
  1142. */
  1143. function wp_dashboard_recent_comments_control() {}
  1144. /**
  1145. * Deprecated dashboard secondary section.
  1146. *
  1147. * @deprecated 3.8.0
  1148. */
  1149. function wp_dashboard_secondary() {}
  1150. /**
  1151. * Deprecated dashboard secondary control.
  1152. *
  1153. * @deprecated 3.8.0
  1154. */
  1155. function wp_dashboard_secondary_control() {}
  1156. /**
  1157. * Display plugins text for the WordPress news widget.
  1158. *
  1159. * @since 2.5.0
  1160. * @deprecated 4.8.0
  1161. *
  1162. * @param string $rss The RSS feed URL.
  1163. * @param array $args Array of arguments for this RSS feed.
  1164. */
  1165. function wp_dashboard_plugins_output( $rss, $args = array() ) {
  1166. _deprecated_function( __FUNCTION__, '4.8.0' );
  1167. // Plugin feeds plus link to install them
  1168. $popular = fetch_feed( $args['url']['popular'] );
  1169. if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
  1170. $plugin_slugs = array_keys( get_plugins() );
  1171. set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
  1172. }
  1173. echo '<ul>';
  1174. foreach ( array( $popular ) as $feed ) {
  1175. if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
  1176. continue;
  1177. $items = $feed->get_items(0, 5);
  1178. // Pick a random, non-installed plugin
  1179. while ( true ) {
  1180. // Abort this foreach loop iteration if there's no plugins left of this type
  1181. if ( 0 == count($items) )
  1182. continue 2;
  1183. $item_key = array_rand($items);
  1184. $item = $items[$item_key];
  1185. list($link, $frag) = explode( '#', $item->get_link() );
  1186. $link = esc_url($link);
  1187. if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
  1188. $slug = $matches[1];
  1189. else {
  1190. unset( $items[$item_key] );
  1191. continue;
  1192. }
  1193. // Is this random plugin's slug already installed? If so, try again.
  1194. reset( $plugin_slugs );
  1195. foreach ( $plugin_slugs as $plugin_slug ) {
  1196. if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
  1197. unset( $items[$item_key] );
  1198. continue 2;
  1199. }
  1200. }
  1201. // If we get to this point, then the random plugin isn't installed and we can stop the while().
  1202. break;
  1203. }
  1204. // Eliminate some common badly formed plugin descriptions
  1205. while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
  1206. unset($items[$item_key]);
  1207. if ( !isset($items[$item_key]) )
  1208. continue;
  1209. $raw_title = $item->get_title();
  1210. $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';
  1211. echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
  1212. '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
  1213. /* translators: %s: Plugin name. */
  1214. esc_attr( sprintf( __( 'Install %s' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
  1215. $feed->__destruct();
  1216. unset( $feed );
  1217. }
  1218. echo '</ul>';
  1219. }
  1220. /**
  1221. * This was once used to move child posts to a new parent.
  1222. *
  1223. * @since 2.3.0
  1224. * @deprecated 3.9.0
  1225. * @access private
  1226. *
  1227. * @param int $old_ID
  1228. * @param int $new_ID
  1229. */
  1230. function _relocate_children( $old_ID, $new_ID ) {
  1231. _deprecated_function( __FUNCTION__, '3.9.0' );
  1232. }
  1233. /**
  1234. * Add a top-level menu page in the 'objects' section.
  1235. *
  1236. * This function takes a capability which will be used to determine whether
  1237. * or not a page is included in the menu.
  1238. *
  1239. * The function which is hooked in to handle the output of the page must check
  1240. * that the user has the required capability as well.
  1241. *
  1242. * @since 2.7.0
  1243. *
  1244. * @deprecated 4.5.0 Use add_menu_page()
  1245. * @see add_menu_page()
  1246. * @global int $_wp_last_object_menu
  1247. *
  1248. * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
  1249. * @param string $menu_title The text to be used for the menu.
  1250. * @param string $capability The capability required for this menu to be displayed to the user.
  1251. * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
  1252. * @param callable $function The function to be called to output the content for this page.
  1253. * @param string $icon_url The url to the icon to be used for this menu.
  1254. * @return string The resulting page's hook_suffix.
  1255. */
  1256. function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
  1257. _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
  1258. global $_wp_last_object_menu;
  1259. $_wp_last_object_menu++;
  1260. return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_object_menu);
  1261. }
  1262. /**
  1263. * Add a top-level menu page in the 'utility' section.
  1264. *
  1265. * This function takes a capability which will be used to determine whether
  1266. * or not a page is included in the menu.
  1267. *
  1268. * The function which is hooked in to handle the output of the page must check
  1269. * that the user has the required capability as well.
  1270. *
  1271. * @since 2.7.0
  1272. *
  1273. * @deprecated 4.5.0 Use add_menu_page()
  1274. * @see add_menu_page()
  1275. * @global int $_wp_last_utility_menu
  1276. *
  1277. * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected.
  1278. * @param string $menu_title The text to be used for the menu.
  1279. * @param string $capability The capability required for this menu to be displayed to the user.
  1280. * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
  1281. * @param callable $function The function to be called to output the content for this page.
  1282. * @param string $icon_url The url to the icon to be used for this menu.
  1283. * @return string The resulting page's hook_suffix.
  1284. */
  1285. function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
  1286. _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
  1287. global $_wp_last_utility_menu;
  1288. $_wp_last_utility_menu++;
  1289. return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu);
  1290. }
  1291. /**
  1292. * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
  1293. * as they disregard the autocomplete setting on the editor textarea. That can break the editor
  1294. * when the user navigates to it with the browser's Back button. See #28037
  1295. *
  1296. * Replaced with wp_page_reload_on_back_button_js() that also fixes this problem.
  1297. *
  1298. * @since 4.0.0
  1299. * @deprecated 4.6.0
  1300. *
  1301. * @link https://core.trac.wordpress.org/ticket/35852
  1302. *
  1303. * @global bool $is_safari
  1304. * @global bool $is_chrome
  1305. */
  1306. function post_form_autocomplete_off() {
  1307. global $is_safari, $is_chrome;
  1308. _deprecated_function( __FUNCTION__, '4.6.0' );
  1309. if ( $is_safari || $is_chrome ) {
  1310. echo ' autocomplete="off"';
  1311. }
  1312. }
  1313. /**
  1314. * Display JavaScript on the page.
  1315. *
  1316. * @since 3.5.0
  1317. * @deprecated 4.9.0
  1318. */
  1319. function options_permalink_add_js() {
  1320. ?>
  1321. <script type="text/javascript">
  1322. jQuery(document).ready(function() {
  1323. jQuery('.permalink-structure input:radio').change(function() {
  1324. if ( 'custom' == this.value )
  1325. return;
  1326. jQuery('#permalink_structure').val( this.value );
  1327. });
  1328. jQuery( '#permalink_structure' ).on( 'click input', function() {
  1329. jQuery( '#custom_selection' ).prop( 'checked', true );
  1330. });
  1331. });
  1332. </script>
  1333. <?php
  1334. }
  1335. /**
  1336. * Previous class for list table for privacy data export requests.
  1337. *
  1338. * @since 4.9.6
  1339. * @deprecated 5.3.0
  1340. */
  1341. class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Data_Export_Requests_List_Table {
  1342. function __construct( $args ) {
  1343. _deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Export_Requests_List_Table' );
  1344. if ( ! isset( $args['screen'] ) || $args['screen'] === 'export_personal_data' ) {
  1345. $args['screen'] = 'export-personal-data';
  1346. }
  1347. parent::__construct( $args );
  1348. }
  1349. }
  1350. /**
  1351. * Previous class for list table for privacy data erasure requests.
  1352. *
  1353. * @since 4.9.6
  1354. * @deprecated 5.3.0
  1355. */
  1356. class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Data_Removal_Requests_List_Table {
  1357. function __construct( $args ) {
  1358. _deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Removal_Requests_List_Table' );
  1359. if ( ! isset( $args['screen'] ) || $args['screen'] === 'remove_personal_data' ) {
  1360. $args['screen'] = 'erase-personal-data';
  1361. }
  1362. parent::__construct( $args );
  1363. }
  1364. }
  1365. /**
  1366. * Was used to add options for the privacy requests screens before they were separate files.
  1367. *
  1368. * @since 4.9.8
  1369. * @access private
  1370. * @deprecated 5.3.0
  1371. */
  1372. function _wp_privacy_requests_screen_options() {
  1373. _deprecated_function( __FUNCTION__, '5.3.0' );
  1374. }