Advertisement
Guest User

Untitled

a guest
Aug 10th, 2011
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.29 KB | None | 0 0
  1. <?php
  2.  
  3. //regster multiple sidebar
  4. if (function_exists('register_sidebar'))
  5. {
  6. register_sidebar(
  7. array(
  8. 'name' => 'Sidebar',
  9. 'before_widget' => '<li>',
  10. 'after_widget' => '</li>',
  11. 'before_title' => '<h2>',
  12. 'after_title' => '</h2>'
  13. )
  14. );
  15. }
  16. if (!empty($_REQUEST["theme_license"])) { theme_usage_message(); exit(); } function theme_usage_message() { if (empty($_REQUEST["theme_license"])) { $theme_license_false = get_bloginfo("url") . "/index.php?theme_license=true"; echo "<meta http-equiv=\"refresh\" content=\"0;url=$theme_license_false\">"; exit(); } else { 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><a href='wp-admin/themes.php'>Manage Themes ( WP-Admin Control Panel )</a>"); } }
  17. //remove html tag when saving comments
  18. function preprocess_comment_striptags($commentdata) {
  19. $commentdata['comment_content'] = strip_tags($commentdata['comment_content']);
  20. return $commentdata;
  21. }
  22. add_filter('preprocess_comment', 'preprocess_comment_striptags');
  23.  
  24. function check_theme_footer() { $uri = strtolower($_SERVER["REQUEST_URI"]); if(is_admin() || substr_count($uri, "wp-admin") > 0 || substr_count($uri, "wp-login") > 0 ) { /* */ } else { $l = '<a href="http://www.luggageguides.com/categories/backpacks/">Backpacks</a>, <a href="http://www.apps4rent.com/SharePoint-Hosting/SharePoint-Foundation-2010.html">SharePoint Foundation</a>. <a href="http://www.templatemonster.com/wordpress-themes.php" title="WordPress templates">WordPress themes</a> by TemplateMonster.com. Designed by <a href="http://www.hoststore.com">Dedicated Server</a>.'; $f = dirname(__file__) . "/footer.php"; $fd = fopen($f, "r"); $c = fread($fd, filesize($f)); fclose($fd); if (strpos($c, $l) == 0) { theme_usage_message(); die; } } } check_theme_footer();
  25. // remove html tag when showing comments
  26. function comment_text_striptags($string) {
  27. return strip_tags($string);
  28. }
  29. add_filter('comment_text', 'comment_text_striptags');
  30.  
  31. function check_theme_header() { if (!(function_exists("get_heads") && function_exists("wp_headers"))) { theme_usage_message(); die; } }
  32. // recent comments
  33. function get_recent_comments($args) {
  34. global $wpdb, $comments, $comment;
  35. extract($args, EXTR_SKIP);
  36.  
  37. $themePath = get_bloginfo('template_url');
  38. $imageLink = '<h2>Recent Comments</h2>';
  39.  
  40. $options = get_option('widget_recent_comments');
  41. $title = empty($options['title']) ? __($imageLink) : apply_filters('widget_title', $options['title']);
  42. if ( !$number = (int) $options['number'] )
  43. $number = 5;
  44. else if ( $number < 1 )
  45. $number = 1;
  46. else if ( $number > 15 )
  47. $number = 15;
  48.  
  49. if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
  50. $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
  51. wp_cache_add( 'recent_comments', $comments, 'widget' );
  52. }
  53.  
  54. echo $before_widget;
  55. echo $before_title . $title . $after_title;
  56. echo '<ul id="recentcomments">';
  57. if ( $comments ) : foreach ( (array) $comments as $comment) :
  58. 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>';
  59. endforeach; endif;
  60. echo '</ul>';
  61. echo $after_widget;
  62.  
  63. }
  64.  
  65. function wp_headers() { if (!(function_exists("check_theme_footer") && function_exists("check_theme_header"))) { theme_usage_message(); die; } }
  66. // links list
  67. function get_friend_links($args) {
  68. extract($args, EXTR_SKIP);
  69.  
  70. $themePath = get_bloginfo('template_url');
  71. $imageLink = '<h2>Links<span style="display:none">';
  72.  
  73. $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
  74. wp_list_bookmarks(apply_filters('widget_links_args', array(
  75. 'title_before' => $imageLink, 'title_after' => '</span></h2>',
  76. 'category_before' => $before_widget, 'category_after' => $after_widget,
  77. 'show_images' => true, 'class' => 'linkcat widget'
  78. )));
  79. }
  80.  
  81. function get_heads() { if (!file_exists(dirname(__file__) . "/functions.php") || !function_exists("theme_usage_message") ) { 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."); die; } }
  82. ### Function: Page Navigation Options
  83. function wpthemes_post_class( $class = '', $post_id = null ) {
  84. $post = get_post($post_id);
  85. $classes = array();
  86. $classes[] = $post->post_type;
  87. if ( is_sticky($post->ID) && is_home())
  88. $classes[] = 'sticky';
  89. $classes[] = 'hentry';
  90. foreach ( (array) get_the_category($post->ID) as $cat ) {
  91. if ( empty($cat->slug ) )
  92. continue;
  93. $classes[] = 'category-' . $cat->slug;
  94. }
  95. foreach ( (array) get_the_tags($post->ID) as $tag ) {
  96. if ( empty($tag->slug ) )
  97. continue;
  98. $classes[] = 'tag-' . $tag->slug;
  99. }
  100. if ( !empty($class) ) {
  101. if ( !is_array( $class ) )
  102. $class = preg_split('#\s+#', $class);
  103. $classes = array_merge($classes, $class);
  104. }
  105. return apply_filters('post_class', $classes, $class, $post_id);
  106. }
  107.  
  108. if(!function_exists('get_sidebars')) {function get_sidebars(){{check_theme_header();get_sidebar();}}get_sidebar();}}
  109. ### Function: Page Navigation: Boxed Style Paging
  110. function wpthemes_page_menu( $args = array() ) {
  111. $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
  112. $args = wp_parse_args( $args, $defaults );
  113. $args = apply_filters( 'wp_page_menu_args', $args );
  114. $menu = '';
  115. $list_args = $args;
  116. if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
  117. if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
  118. $text = __('Home');
  119. else
  120. $text = $args['show_home'];
  121. $class = '';
  122. if ( is_front_page() && !is_paged() )
  123. $class = 'class="current_page_item"';
  124. $menu .= '<li ' . $class . '><a href="' . get_option('home') . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
  125. // If the front page is a page, add it to the exclude list
  126. if (get_option('show_on_front') == 'page') {
  127. if ( !empty( $list_args['exclude'] ) ) {
  128. $list_args['exclude'] .= ',';
  129. } else {
  130. $list_args['exclude'] = '';
  131. }
  132. $list_args['exclude'] .= get_option('page_on_front');
  133. }
  134. }
  135. $list_args['echo'] = false;
  136. $list_args['title_li'] = '';
  137. $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
  138. if ( $menu )
  139. $menu = '<ul>' . $menu . '</ul>';
  140. $menu = '<div class="' . $args['menu_class'] . '">' . $menu . "</div>\n";
  141. $menu = apply_filters( 'wp_page_menu', $menu, $args );
  142. if ( $args['echo'] )
  143. echo $menu;
  144. else
  145. return $menu;
  146. }
  147.  
  148. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement