PageRenderTime 70ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/library/legacy/deprecated.php

https://github.com/middlesister/Thematic
PHP | 602 lines | 252 code | 111 blank | 239 comment | 29 complexity | 9f9bf5a889265b392df76591ce8e7515 MD5 | raw file
  1. <?php
  2. /**
  3. * Deprecated Functions
  4. *
  5. * @package ThematicLegacy
  6. */
  7. /**
  8. * Function for handling the bloginfo / get_bloginfo data using our own 'cache'.
  9. *
  10. * We removed the functionality because it will not run on all systems. The system used
  11. * a fallback, but we could not guarantee that the fallback would meet every possible
  12. * error condition.
  13. *
  14. * @since 0.9.6
  15. * @deprecated 0.9.6.1
  16. */
  17. function thm_bloginfo($command = '', $echo = FALSE) {
  18. _deprecated_function( __FUNCTION__, '0.9.6.1', 'bloginfo() or get_bloginfo()' );
  19. if ($echo) {
  20. bloginfo($command);
  21. } else {
  22. return get_bloginfo($command);
  23. }
  24. }
  25. /**
  26. * Function for testing, if a sidebar has registered widgets.
  27. *
  28. * We removed the functionality because WordPress own function is_active_sidebar() is
  29. * stable.
  30. *
  31. * @since 0.9.6
  32. * @deprecated 0.9.7.3
  33. */
  34. function is_sidebar_active( $index ){
  35. _deprecated_function( __FUNCTION__, '0.9.7.3', 'is_active_sidebar()' );
  36. return is_active_sidebar( $index );
  37. }
  38. /**
  39. * Switch adding the comment-reply script
  40. *
  41. * Removed in favor of hooking into wp_enqueue_scripts over calling directly in header.php
  42. * Note that in 1.0 the comment reply script is still enqueued by default.
  43. * Use wp_dequeue_script('comment-reply') to remove the script instead of using the filter: thematic_show_commentreply.
  44. *
  45. * @deprecated 1.0
  46. */
  47. function thematic_show_commentreply() {
  48. _deprecated_function( __FUNCTION__, '1.0' );
  49. $display = TRUE;
  50. $display = apply_filters('thematic_show_commentreply', $display);
  51. if ($display) {
  52. if ( is_singular() ) {
  53. wp_enqueue_script('comment-reply');
  54. }
  55. }
  56. }
  57. /**
  58. * thematic_canonical_url is no longer necessary because the functionality has been included in WordPress core since 2.9.0
  59. *
  60. * @deprecated 1.0
  61. */
  62. function thematic_canonical_url() {
  63. _deprecated_function( __FUNCTION__, '1.0' );
  64. }
  65. /**
  66. * Get the page number for title tag
  67. *
  68. * This has been integrated into thematic_doctitle()
  69. *
  70. * @deprecated 1.0
  71. */
  72. function pageGetPageNo() {
  73. _deprecated_function( __FUNCTION__, '1.0' );
  74. if ( get_query_var('paged') ) {
  75. print ' | Page ' . get_query_var('paged');
  76. }
  77. }
  78. if ( function_exists( 'childtheme_override_comment_class' ) ) {
  79. _deprecated_function('childtheme_override_comment_class', '1.0', 'comment_class()' );
  80. /**
  81. * @ignore
  82. */
  83. function thematic_comment_class() {
  84. childtheme_override_comment_class();
  85. }
  86. } else {
  87. /**
  88. * Generates semantic classes for each comment LI element
  89. *
  90. * Removed due to duplication of the core WordPress comment_class()
  91. *
  92. * @deprecated 1.0
  93. */
  94. function thematic_comment_class( $print = true ) {
  95. _deprecated_function( __FUNCTION__, '1.0', 'comment_class()' );
  96. global $comment, $post, $thematic_comment_alt, $comment_depth, $comment_thread_alt;
  97. // Collects the comment type (comment, trackback),
  98. $c = array( $comment->comment_type );
  99. // Counts trackbacks (t[n]) or comments (c[n])
  100. if ( $comment->comment_type == 'comment' ) {
  101. $c[] = "c$thematic_comment_alt";
  102. } else {
  103. $c[] = "t$thematic_comment_alt";
  104. }
  105. // If the comment author has an id (registered), then print the log in name
  106. if ( $comment->user_id > 0 ) {
  107. $user = get_userdata($comment->user_id);
  108. // For all registered users, 'byuser'; to specificy the registered user, 'commentauthor+[log in name]'
  109. $c[] = 'byuser comment-author-' . sanitize_title_with_dashes(strtolower( $user->user_login ));
  110. // For comment authors who are the author of the post
  111. if ( $comment->user_id === $post->post_author )
  112. $c[] = 'bypostauthor';
  113. }
  114. // If it's the other to the every, then add 'alt' class; collects time- and date-based classes
  115. thematic_date_classes( mysql2date( 'U', $comment->comment_date ), $c, 'c-' );
  116. if ( ++$thematic_comment_alt % 2 ) {
  117. $c[] = 'alt';
  118. }
  119. // Comment depth
  120. $c[] = "depth-$comment_depth";
  121. // Separates classes with a single space, collates classes for comment LI
  122. $c = join( ' ', apply_filters( 'comment_class', $c ) ); // Available filter: comment_class
  123. // Tada again!
  124. return $print ? print($c) : $c;
  125. }
  126. }
  127. /**
  128. * Generates the Thematic "Read more" text for excerpts
  129. *
  130. * Removed for namespacing
  131. *
  132. * @deprecated 1.0
  133. */
  134. function more_text() {
  135. _deprecated_function( __FUNCTION__, '1.0', 'thematic_more_text()');
  136. thematic_more_text();
  137. }
  138. /**
  139. * Filter: list_comments_arg
  140. *
  141. * Removed for namespacing
  142. *
  143. * @deprecated 1.0
  144. */
  145. function list_comments_arg() {
  146. _deprecated_function( __FUNCTION__, '1.0', 'thematic_list_comments_arg()');
  147. thematic_list_comments_arg();
  148. }
  149. /**
  150. * Create the arguments for wp_list_bookmarks in links.php
  151. *
  152. * Removed for namespacing
  153. *
  154. * @deprecated 1.0
  155. */
  156. function list_bookmarks_args() {
  157. _deprecated_function( __FUNCTION__, '1.0', 'thematic_list_bookmarks_args()' );
  158. thematic_list_bookmarks_args();
  159. }
  160. /**
  161. * Register action hook: widget_area_primary_aside
  162. *
  163. * Removed for namespacing
  164. *
  165. * @deprecated 1.0
  166. */
  167. function widget_area_primary_aside() {
  168. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_primary_aside()' );
  169. thematic_widget_area_primary_aside();
  170. }
  171. /**
  172. * Register action hook: widget_area_secondary_aside
  173. *
  174. * Removed for namespacing
  175. *
  176. * @deprecated 1.0
  177. */
  178. function widget_area_secondary_aside() {
  179. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_secondary_aside()' );
  180. thematic_widget_area_secondary_aside();
  181. }
  182. /**
  183. * Register action hook: widget_area_index_top
  184. *
  185. * Removed for namespacing
  186. *
  187. * @deprecated 1.0
  188. */
  189. function widget_area_index_top() {
  190. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_index_top()' );
  191. thematic_widget_area_index_top();
  192. }
  193. /**
  194. * Register action hook: widget_area_index_insert
  195. *
  196. * Removed for namespacing
  197. *
  198. * @deprecated 1.0
  199. */
  200. function widget_area_index_insert() {
  201. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_index_insert()' );
  202. thematic_widget_area_index_insert();
  203. }
  204. /**
  205. * Register action hook: widget_area_index_bottom
  206. *
  207. * Removed for namespacing
  208. *
  209. * @deprecated 1.0
  210. */
  211. function widget_area_index_bottom() {
  212. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_index_bottom()' );
  213. thematic_widget_area_index_bottom();
  214. }
  215. /**
  216. * Register action hook: widget_area_single_top
  217. *
  218. * Removed for namespacing
  219. *
  220. * @deprecated 1.0
  221. */
  222. function widget_area_single_top() {
  223. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_single_top()' );
  224. thematic_widget_area_single_top();
  225. }
  226. /**
  227. * Register action hook: widget_area_single_insert
  228. *
  229. * Removed for namespacing
  230. *
  231. * @deprecated 1.0
  232. */
  233. function widget_area_single_insert() {
  234. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_single_insert()' );
  235. thematic_widget_area_single_insert();
  236. }
  237. /**
  238. * Register action hook: widget_area_single_bottom
  239. *
  240. * Removed for namespacing
  241. *
  242. * @deprecated 1.0
  243. */
  244. function widget_area_single_bottom() {
  245. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_single_bottom()' );
  246. thematic_widget_area_single_bottom();
  247. }
  248. /**
  249. * Register action hook: widget_area_page_top
  250. *
  251. * Removed for namespacing
  252. *
  253. * @deprecated 1.0
  254. */
  255. function widget_area_page_top() {
  256. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_page_top()' );
  257. thematic_widget_area_page_top();
  258. }
  259. /**
  260. * Register action hook: widget_area_page_bottom
  261. *
  262. * Removed for namespacing
  263. *
  264. * @deprecated 1.0
  265. */
  266. function widget_area_page_bottom() {
  267. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_page_bottom()' );
  268. thematic_widget_page_bottom();
  269. }
  270. /**
  271. * Register action hook: widget_area_subsidiaries
  272. *
  273. * Removed for namespacing
  274. *
  275. * @deprecated 1.0
  276. */
  277. function widget_area_subsidiaries() {
  278. _deprecated_function( __FUNCTION__, '1.0', 'thematic_widget_area_subsidiaries()' );
  279. thematic_widget_area_subsidiaries();
  280. }
  281. /**
  282. * Generates the legacy comment form
  283. *
  284. * We removed the functionality because WordPress supplies its own function comment_form()
  285. *
  286. * @deprecated 1.0.2.3
  287. */
  288. function thematic_legacy_comment_form(){
  289. _deprecated_function( __FUNCTION__, '1.0.2.3', 'comment_form( thematic_comment_form_args() )' );
  290. $user = wp_get_current_user();
  291. $user_ID = ! ( is_wp_error( $user ) ) ? $user->ID : FALSE; ?>
  292. <div id="respond">
  293. <h3><?php comment_form_title( thematic_postcomment_text(), thematic_postreply_text() ); ?></h3>
  294. <div id="cancel-comment-reply"><?php cancel_comment_reply_link() ?></div>
  295. <?php if ( get_option( 'comment_registration' ) && !$user_ID ) : ?>
  296. <p id="login-req"><?php printf( __('You must be %1$slogged in%2$s to post a comment.', 'thematic'), sprintf('<a href="%s" title ="%s">', wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ), esc_attr__( 'Log in', 'thematic' ) ), '</a>' ) ?></p>
  297. <?php else : ?>
  298. <div class="formcontainer">
  299. <?php
  300. // action hook for inserting content above #commentform
  301. thematic_abovecommentsform()
  302. ?>
  303. <form id="commentform" action="<?php echo site_url( '/wp-comments-post.php' ) ?>" method="post">
  304. <?php if ( $user_ID ) : ?>
  305. <p id="login"><span class="loggedin"><?php _e('Logged in as', 'thematic' ) . printf( ' <a href="%1$s" title="%2$s">%3$s</a>', admin_url( 'profile.php' ), sprintf( esc_attr__('Logged in as %s', 'thematic'), $user_identity ) , $user_identity ) ;?></span> <span class="logout"><?php printf('<a href="%s" title="%s">%s</a>' , esc_attr( wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ), esc_attr__('Log out of this account', 'thematic' ) , __('Log out?', 'thematic' ) ); ?></span>
  306. </p>
  307. <?php else : ?>
  308. <p id="comment-notes"><?php printf( _x( 'Your email is %1$snever%2$s published nor shared.' , '%$1s and %$2s are <em> tags for emphasis on never', 'thematic' ), '<em>' , '</em>' ) ?></p>
  309. <div id="form-section-author" class="form-section">
  310. <div class="form-label"><label for="author"><?php _e( 'Name', 'thematic' ) ?></label> <?php if ( $req ) { _e( '<span class="required">*</span>', 'thematic' ); } ?></div>
  311. <div class="form-input"><input id="author" name="author" type="text" value="<?php echo $comment_author ?>" size="30" maxlength="20" tabindex="3" /></div>
  312. </div><!-- #form-section-author .form-section -->
  313. <div id="form-section-email" class="form-section">
  314. <div class="form-label"><label for="email"><?php _e( 'Email', 'thematic' ) ?></label> <?php if ( $req ) { _e( '<span class="required">*</span>', 'thematic' ); } ?></div>
  315. <div class="form-input"><input id="email" name="email" type="text" value="<?php echo $comment_author_email ?>" size="30" maxlength="50" tabindex="4" /></div>
  316. </div><!-- #form-section-email .form-section -->
  317. <div id="form-section-url" class="form-section">
  318. <div class="form-label"><label for="url"><?php _e( 'Website', 'thematic' ) ?></label></div>
  319. <div class="form-input"><input id="url" name="url" type="text" value="<?php echo $comment_author_url ?>" size="30" maxlength="50" tabindex="5" /></div>
  320. </div><!-- #form-section-url .form-section -->
  321. <?php endif /* if ( $user_ID ) */ ?>
  322. <div id="form-section-comment" class="form-section">
  323. <div class="form-label"><label for="comment"><?php _e( thematic_commentbox_text(), 'thematic' ) ?></label></div>
  324. <div class="form-textarea"><textarea id="comment" name="comment" cols="45" rows="8" tabindex="6"></textarea></div>
  325. </div><!-- #form-section-comment .form-section -->
  326. <div id="form-allowed-tags" class="form-section">
  327. <p><span><?php printf( _x('You may use these %1$sHTML%2$s tags and attributes', '%$1s and %$2s are <abbr> tags', 'thematic'), '<abbr title="HyperText Markup Language">', '</abbr>' ) ?></span> <code><?php echo allowed_tags(); ?></code></p>
  328. </div>
  329. <?php do_action( 'comment_form', $post->ID ); ?>
  330. <div class="form-submit"><input id="submit" name="submit" type="submit" value="<?php echo thematic_commentbutton_text(); ?>" tabindex="7" /><input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /></div>
  331. <?php comment_id_fields(); ?>
  332. </form><!-- #commentform -->
  333. <?php
  334. // action hook for inserting content below #commentform
  335. thematic_belowcommentsform()
  336. ?>
  337. </div><!-- .formcontainer -->
  338. <?php endif /* if ( get_option('comment_registration') && !$user_ID ) */ ?>
  339. </div><!-- #respond -->
  340. <?php
  341. }
  342. /**
  343. * Redundant function for opening body tag
  344. *
  345. * the contents of this function were moved to thematic_body()
  346. *
  347. * @deprecated 1.0.3.3
  348. */
  349. function thematic_bodyopen() {
  350. _deprecated_function( __FUNCTION__, '1.0.3.3', 'thematic_body()' );
  351. }
  352. /**
  353. * Added a settings section to display legacy help text and theme links WP 3.2 compatible
  354. *
  355. * @removed in favor of adding contextual help via get_current_screen()
  356. */
  357. function thematic_legacy_help() {
  358. _deprecated_function( __FUNCTION__, '1.0.4', 'thematic_opt_page_help' );
  359. }
  360. /**
  361. * Rendered the legacy help text and theme links WP 3.2 compatible
  362. *
  363. * @removed in favor of adding contextual help via get_current_screen()
  364. */
  365. function thematic_do_legacy_help_section() {
  366. _deprecated_function( __FUNCTION__, '1.0.4', 'thematic_opt_page_help' );
  367. }
  368. /**
  369. * Displays the HEAD profile
  370. *
  371. * Filter: thematic_head_profile
  372. */
  373. function thematic_head_profile() {
  374. if ( !current_theme_supports( 'thematic_legacy_quiet' ) ) {
  375. _deprecated_function( __FUNCTION__, '2.0', 'childtheme_override_head' );
  376. }
  377. $content = "\n" . '<head profile="http://gmpg.org/xfn/11">' . "\n";
  378. echo apply_filters( 'thematic_head_profile', $content );
  379. }
  380. /**
  381. * Displays the xhtml1.0 DOCTYPE
  382. *
  383. * Filter: thematic_create_doctype
  384. */
  385. function thematic_create_doctype() {
  386. if ( !current_theme_supports( 'thematic_legacy_quiet' ) ) {
  387. _deprecated_function( __FUNCTION__, '2.0', 'childtheme_override_doctype' );
  388. }
  389. $content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
  390. $content .= '<html xmlns="http://www.w3.org/1999/xhtml"';
  391. echo apply_filters( 'thematic_create_doctype', $content );
  392. }
  393. // Display the meta content type
  394. function thematic_create_contenttype() {
  395. if ( !current_theme_supports( 'thematic_legacy_quiet' ) ) {
  396. _deprecated_function( __FUNCTION__, '2.0', 'childtheme_override_meta_charset' );
  397. }
  398. $content = '<meta http-equiv="Content-Type" content="' . get_bloginfo('html_type') . '; charset=' . get_bloginfo('charset') . '" />' . "\n";
  399. echo apply_filters('thematic_create_contenttype', $content);
  400. }
  401. /**
  402. * Switch for displaying the meta-tag description
  403. * Removed after thematic_show_description switch was merged with thematic_create_description into thematic_meta_description
  404. *
  405. * Filter: thematic_show_description
  406. */
  407. function thematic_show_description() {
  408. _deprecated_function( __FUNCTION__, '2.0', 'thematic_meta_description' );
  409. thematic_create_description();
  410. } // end thematic_show_description
  411. /**
  412. * Switch for creating the meta-tag description
  413. * Removed after thematic_show_description switch was merged with thematic_create_description into thematic_meta_description
  414. */
  415. function thematic_create_description() {
  416. _deprecated_function( __FUNCTION__, '2.0', 'thematic_meta_description' );
  417. thematic_meta_description();
  418. } // end thematic_show_description
  419. /**
  420. * Switch creating the robots meta-tag
  421. *
  422. * Removed after thematic_show_robots switch was merged with thematic_create_robots into thematic_meta_robots
  423. */
  424. function thematic_show_robots() {
  425. _deprecated_function( __FUNCTION__, '2.0', 'thematic_meta_robots' );
  426. thematic_create_robots();
  427. } // end thematic_show_robots
  428. /**
  429. * Created the robots meta-tag
  430. *
  431. * Removed after thematic_show_robots switch was merged with thematic_create_robots into thematic_meta_robots
  432. */
  433. function thematic_create_robots() {
  434. _deprecated_function( __FUNCTION__, '2.0', 'thematic_meta_robots' );
  435. thematic_meta_robots();
  436. } // end thematic_create_robots
  437. /**
  438. * Search widget class
  439. *
  440. * Deprecated since core widgets should not be deregisterd.
  441. * Functionality is replaced with a filter in thematic_filter_search_widget()
  442. *
  443. * @since 0.9.6.3
  444. * @deprecated 2.0
  445. */
  446. class Thematic_Widget_Search extends WP_Widget {
  447. function Thematic_Widget_Search() {
  448. $widget_ops = array('classname' => 'widget_search', 'description' => __( 'A search form for your blog', 'thematic') );
  449. $this->WP_Widget('search', __('Search', 'thematic'), $widget_ops);
  450. }
  451. function widget( $args, $instance ) {
  452. extract($args);
  453. $title = apply_filters('widget_title', empty($instance['title']) ? __('Search', 'thematic') : $instance['title']);
  454. echo $before_widget;
  455. if ( $title ) {
  456. echo $before_title ?><label for="s"><?php echo $title ?></label><?php echo $after_title;
  457. }
  458. // Use current theme search form if it exists
  459. get_search_form();
  460. echo $after_widget;
  461. }
  462. function form( $instance ) {
  463. $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
  464. $title = $instance['title'];
  465. ?>
  466. <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'thematic'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
  467. <?php
  468. }
  469. function update( $new_instance, $old_instance ) {
  470. $instance = $old_instance;
  471. $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
  472. $instance['title'] = strip_tags($new_instance['title']);
  473. return $instance;
  474. }
  475. }
  476. // Legacy feed links handling
  477. // If you add theme support for thematic_legacy_feedlinks, thematic_show_rss() and thematic_show_commentsrss() are used instead of add_theme_support( 'automatic-feed-links' )
  478. if ( defined( 'THEMATIC_COMPATIBLE_FEEDLINKS' ) ) { add_theme_support( 'thematic_legacy_feedlinks' ); }
  479. // Legacy comments handling for pages, archives and links
  480. // If you add_theme_support for thematic_legacy_comment_handling, Thematic will only show comments on pages with a key/value of "comments"
  481. if ( defined( 'THEMATIC_COMPATIBLE_COMMENT_HANDLING' ) ) { add_theme_support( 'thematic_legacy_comment_handling' ); }
  482. // Legacy body class handling
  483. // If you add theme support for thematic_legacy_body_class, Thematic will use thematic_body_class instead of body_class()
  484. if ( defined( 'THEMATIC_COMPATIBLE_BODY_CLASS' ) ) { add_theme_support( 'thematic_legacy_body_class' ); }
  485. // Legacy post class handling
  486. // If you add theme support for thematic_legacy_post_class, Thematic will use thematic_body_class instead of post_class()
  487. if ( defined( 'THEMATIC_COMPATIBLE_POST_CLASS' ) ) { add_theme_support( 'thematic_legacy_post_class' ); }
  488. // Legacy post class handling
  489. // If you add theme support for thematic_legacy_post_class, Thematic will use it's legacy comment form
  490. if ( defined( 'THEMATIC_COMPATIBLE_COMMENT_FORM' ) ) { add_theme_support( 'thematic_legacy_comment_form' ); }
  491. ?>