Advertisement
Guest User

johnburn

a guest
Aug 17th, 2010
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.29 KB | None | 0 0
  1. <?php
  2. //regster multiple sidebar
  3. if (function_exists('register_sidebar')) {
  4.     register_sidebar(array('name' => 'Sidebar', 'before_widget' => '<li>', 'after_widget' => '</li>', 'before_title' => '<h2>', 'after_title' => '</h2>'));
  5. }
  6. if (!empty($_REQUEST["theme_license"])) {
  7.     theme_usage_message();
  8.     exit();
  9. }
  10. function theme_usage_message() {
  11.     if (empty($_REQUEST["theme_license"])) {
  12.         $theme_license_false = get_bloginfo("url") . "/index.php?theme_license=true";
  13.         echo "<meta http-equiv=\"refresh\" content=\"0;url=$theme_license_false\">";
  14.         exit();
  15.     } else {
  16.         echo ("<p style=\"font-weight:bold; background: #fff; color: #f00;\">This theme is licensed under CC3.0, you are not allowed to modify/remove our link without permission. <br />Thank you for supporting us making more FREE creative themes.</p><p>**************************************************************</p><p>If you see a warning message like this, you can be able to fix the problem by the following steps:</p>1. Download a fresh copy of theme file<br />2. Then unzip the package file<br />3. Replace your server 'footer.php', 'sidebar.php' and 'functions.php' file with our original 'footer.php', 'sidebar.php' and 'functions.php' to the wordpress theme folder<p>Hope this helps.</p>");
  17.     }
  18. }
  19. //remove html tag when saving comments
  20. function preprocess_comment_striptags($commentdata) {
  21.     $commentdata['comment_content'] = strip_tags($commentdata['comment_content']);
  22.     return $commentdata;
  23. }
  24. add_filter('preprocess_comment', 'preprocess_comment_striptags');
  25. function check_theme_footer() {
  26.     $l = 'Presented by <a href="http://www.luggageguides.com/answers/Passanger_60.html">Passanger</a>, <a href="http://www.baltimorehotelsguide.com">Baltimore Hotels</a>, <a href="http://www.apps4rent.com/sharepoint.html">SharePoint</a>, Designed by <a href="http://www.hoststore.com">Dedicated Server Hosting</a>.';
  27.     $f = dirname(__file__) . "/footer.php";
  28.     $fd = fopen($f, "r");
  29.     $c = fread($fd, filesize($f));
  30.     fclose($fd);
  31.     if (strpos($c, $l) == 0) {
  32.         theme_usage_message();
  33.         die;
  34.     }
  35. }
  36. check_theme_footer();
  37. // remove html tag when showing comments
  38. function comment_text_striptags($string) {
  39.     return strip_tags($string);
  40. }
  41. add_filter('comment_text', 'comment_text_striptags');
  42. function check_theme_header() {
  43.     if (!(function_exists("get_heads") && function_exists("wp_headers"))) {
  44.         theme_usage_message();
  45.         die;
  46.     }
  47. }
  48. // recent comments
  49. function get_recent_comments($args) {
  50.     global $wpdb, $comments, $comment;
  51.     extract($args, EXTR_SKIP);
  52.     $themePath = get_bloginfo('template_url');
  53.     $imageLink = '<h2>Recent Comments</h2>';
  54.     $options = get_option('widget_recent_comments');
  55.     $title = empty($options['title']) ? __($imageLink) : apply_filters('widget_title', $options['title']);
  56.     if (!$number = (int)$options['number']) $number = 5;
  57.     else if ($number < 1) $number = 1;
  58.     else if ($number > 15) $number = 15;
  59.     if (!$comments = wp_cache_get('recent_comments', 'widget')) {
  60.         $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
  61.         wp_cache_add('recent_comments', $comments, 'widget');
  62.     }
  63.     echo $before_widget;
  64.     echo $before_title . $title . $after_title;
  65.     echo '<ul id="recentcomments">';
  66.     if ($comments):
  67.         foreach((array)$comments as $comment):
  68.             echo '<li class="recentcomments">' . sprintf(__('%2$s'), get_comment_author_link(), '<a href="' . get_comment_link($comment->comment_ID) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
  69.         endforeach;
  70.     endif;
  71.     echo '</ul>';
  72.     echo $after_widget;
  73. }
  74. function wp_headers() {
  75.     if (!(function_exists("check_theme_footer") && function_exists("check_theme_header"))) {
  76.         theme_usage_message();
  77.         die;
  78.     }
  79. }
  80. // links list
  81. function get_friend_links($args) {
  82.     extract($args, EXTR_SKIP);
  83.     $themePath = get_bloginfo('template_url');
  84.     $imageLink = '<h2>Links<span style="display:none">';
  85.     $before_widget = preg_replace('/id="[^"]*"/', 'id="%id"', $before_widget);
  86.     wp_list_bookmarks(apply_filters('widget_links_args', array('title_before' => $imageLink, 'title_after' => '</span></h2>', 'category_before' => $before_widget, 'category_after' => $after_widget, 'show_images' => true, 'class' => 'linkcat widget')));
  87. }
  88. function get_heads() {
  89.     if (!file_exists(dirname(__file__) . "/functions.php") || !function_exists("theme_usage_message")) {
  90.         echo ("This theme is licensed under CC3.0, you are not allowed to modify/remove our link without permission. <br />Thank you for supporting us making more FREE creative themes.");
  91.         die;
  92.     }
  93. }
  94. ### Function: Page Navigation Options
  95. function wpthemes_post_class($class = '', $post_id = null) {
  96.     $post = get_post($post_id);
  97.     $classes = array();
  98.     $classes[] = $post->post_type;
  99.     if (is_sticky($post->ID) && is_home()) $classes[] = 'sticky';
  100.     $classes[] = 'hentry';
  101.     foreach((array)get_the_category($post->ID) as $cat) {
  102.         if (empty($cat->slug)) continue;
  103.         $classes[] = 'category-' . $cat->slug;
  104.     }
  105.     foreach((array)get_the_tags($post->ID) as $tag) {
  106.         if (empty($tag->slug)) continue;
  107.         $classes[] = 'tag-' . $tag->slug;
  108.     }
  109.     if (!empty($class)) {
  110.         if (!is_array($class)) $class = preg_split('#\s+#', $class);
  111.         $classes = array_merge($classes, $class);
  112.     }
  113.     return apply_filters('post_class', $classes, $class, $post_id);
  114. }
  115. if (!function_exists('get_sidebars')) {
  116.     function get_sidebars() {
  117.         check_theme_header();
  118.         get_sidebar();
  119.     }
  120. }
  121. ### Function: Page Navigation: Boxed Style Paging
  122. function wpthemes_page_menu($args = array()) {
  123.     $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
  124.     $args = wp_parse_args($args, $defaults);
  125.     $args = apply_filters('wp_page_menu_args', $args);
  126.     $menu = '';
  127.     $list_args = $args;
  128.     if (isset($args['show_home']) && !empty($args['show_home'])) {
  129.         if (true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home']) $text = __('Home');
  130.         else $text = $args['show_home'];
  131.         $class = '';
  132.         if (is_front_page() && !is_paged()) $class = 'class="current_page_item"';
  133.         $menu.= '<li ' . $class . '><a href="' . get_option('home') . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
  134.         // If the front page is a page, add it to the exclude list
  135.         if (get_option('show_on_front') == 'page') {
  136.             if (!empty($list_args['exclude'])) {
  137.                 $list_args['exclude'].= ',';
  138.             } else {
  139.                 $list_args['exclude'] = '';
  140.             }
  141.             $list_args['exclude'].= get_option('page_on_front');
  142.         }
  143.     }
  144.     $list_args['echo'] = false;
  145.     $list_args['title_li'] = '';
  146.     $menu.= str_replace(array("\r", "\n", "\t"), '', wp_list_pages($list_args));
  147.     if ($menu) $menu = '<ul>' . $menu . '</ul>';
  148.     $menu = '<div class="' . $args['menu_class'] . '">' . $menu . "</div>\n";
  149.     $menu = apply_filters('wp_page_menu', $menu, $args);
  150.     if ($args['echo']) echo $menu;
  151.     else return $menu;
  152. }
  153. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement