Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

Untitled

By: johnburn on Nov 27th, 2011  |  syntax: PHP  |  size: 4.61 KB  |  views: 63  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. function tp_header() {
  3.     echo '<style type="text/css">';
  4.     echo '#content{float:left;}';
  5.     echo '</style>';
  6. }
  7. add_action('wp_head', 'tp_header');
  8. /*********************************************************************************************/
  9. $tp_credit_footer = 'Provided by <a href="http://projectserverhosting.com/project-management-tools/" target="_blank">Project Management Tools</a>, <a href="http://www.hivelocity.net/" target="_blank">Windows Dedicated Server</a>, <a href="http://www.ecommercewebsites.com.au/" target="_blank">Web Design Company</a> ';
  10. $tp_credit_footer_HomeOnly = FALSE; /* FALSE or TRUE : TRUE will show only home/front page ( include page 2,3,4... ); FALSE show on every pages */
  11. /*
  12.  
  13. Text: <li><h4>Theme Credit</h4><div class="textwidget"> content </div></li>
  14.  
  15. List: <li><h4>Theme Credit</h4><ul> list with li </ul></li>
  16.  
  17. mix : <li><h4>Theme Credit</h4><ul> list with li </ul><div class="textwidget"> content </div></li>
  18.  
  19. $tp_credit_sb_home  and $tp_credit_sb_inner : won't show is leave blank ''
  20.  
  21. */
  22. $tp_credit_sb_home = '<li><h4>Theme Credit</h4><ul>' . '<li><a href="http://www.singlehop.com/cloud/" target="_blank">Cloud Hosting Server</a></li>' . '<li><a href="http://www.rackmounted.com/" title="Dedicated Server" target="_blank">Linux Dedicated Server</a></li>' . '<li><a href="http://www.smsiseasy.com" title="Bulk SMS Broadcast System" target="_blank">Internet SMS</a></li>' . '</ul></li>';
  23. $tp_credit_sb_inner = '';
  24. /*********************************************************************************************/
  25. function theme_credit() {
  26.     Global $tpinfo, $tp_credit_footer, $tp_credit_sb_home, $tp_credit_sb_inner, $tp_credit_footer_HomeOnly;
  27.     $current = get_option('templatelite_links');
  28.     $hash = '35:110729';
  29.     $post_variables = array('blog_home' => get_bloginfo('wpurl'), 'blog_title' => get_bloginfo('name'), 'theme_style' => $tpinfo[$tpinfo['tb_prefix'] . '_stylesheet'], 'theme_id' => '35', 'theme_ver' => '1.01', 'theme_name' => 'Wooden Wall', 'link_footer' => $tp_credit_footer, 'link_sb_home' => $tp_credit_sb_home, 'link_sb_inner' => $tp_credit_sb_inner,);
  30.     if (!isset($current['time']) || $current['time'] < time() - 172800) $current = FALSE; /*min 48 hours*/
  31.     if (!isset($current['hash']) || $current['hash'] != $hash) $current = FALSE;
  32.     if ($current === FALSE) {
  33.         $new = array();
  34.         $new['time'] = time();
  35.         $new['hash'] = $hash;
  36.         $new['links'] = templatelite_get_links($post_variables);
  37.         if ($new['links'] === FALSE) {
  38.             if (!empty($current['links'])) {
  39.                 $new['links'] = $current['links'];
  40.             } else {
  41.                 $new['links'] = $tp_credit_footer;
  42.             }
  43.         } elseif ($new['links'] == '--') {
  44.             $new['links'] = $tp_credit_footer;
  45.         }
  46.         $new['links'] = strip_tags($new['links'], "<a>"); /*make sure only text and link are allow.*/
  47.         update_option("templatelite_links", $new);
  48.         $return_link = $new['links'];
  49.     } else {
  50.         $return_link = $current['links'];
  51.     }
  52.     if ($tp_credit_footer_HomeOnly === FALSE || (is_home() || is_front_page())) {
  53.         echo $return_link;
  54.     }
  55. }
  56. function templatelite_get_links($post_variables) {
  57.     if (!class_exists('WP_Http')) include_once (ABSPATH . WPINC . '/class-http.php');
  58.     $request = new WP_Http;
  59.     $url = "http://www.templatestats.com/api/api.v2.php";
  60.     /*$url="http://templatestats:88/api/api.v2.php";*/
  61.     $result = @$request->request($url, array('method' => 'POST', 'body' => $post_variables));
  62.     if (!isset($result->errors) && isset($result['response']['code']) && $result['response']['code'] == 200) {
  63.         return trim($result['body']);
  64.     }
  65.     return FALSE;
  66. }
  67. $tp_sb_show = FALSE;
  68. function theme_sb_credit() {
  69.     global $tp_credit_sb_home, $tp_credit_sb_inner, $tp_sb_show;
  70.     $tp_sb_show = TRUE;
  71.     if ((is_home() || is_front_page()) && !empty($tp_credit_sb_home)) {
  72.         echo $tp_credit_sb_home;
  73.     } elseif (!empty($tp_credit_sb_inner)) {
  74.         echo $tp_credit_sb_inner;
  75.     }
  76. }
  77. function tp_footer() {
  78.     global $tp_sb_show, $tp_credit_footer_HomeOnly;
  79.     if ($tp_credit_footer_HomeOnly === FALSE || (is_home() || is_front_page())) {
  80.         ob_start();
  81.         include TEMPLATEPATH . "/footer.php";
  82.         $current = get_option('templatelite_links');
  83.         $tp_footer_content = ob_get_clean();
  84.         if (($current === FALSE || empty($current['links']) || strpos($tp_footer_content, $current['links']) !== false) && $tp_sb_show == TRUE) {
  85.             echo $tp_footer_content;
  86.         }
  87.     }
  88. }
  89. add_action('get_footer', 'tp_footer');
  90. ?>
  91.