This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 5th, 2011  |  syntax: PHP  |  size: 4.23 KB  |  views: 57  |  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. function tp_header(){
  2.         echo '<style type="text/css">#content{float:left;}</style>';
  3. }
  4. add_action('wp_head', 'tp_header');
  5.  
  6. /*********************************************************************************************/
  7. $tp_credit_footer = 'Provided by <a href="http://www.serverpoint.com/" target="_blank">dedicated server</a>, <a href="http://www.apps4rent.com/hosted-exchange-hosting.html" target="_blank">Hosted Exchange Email</a>, <a href="http://www.rackmounted.com/" title="dedicated server" target="_blank">Linux Dedicated Servers</a>';
  8. $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 */
  9.  
  10. /*
  11. Text: <li><h4>Theme Credit</h4><div class="textwidget"> content </div></li>
  12.  
  13. List: <li><h4>Theme Credit</h4><ul> list with li </ul></li>
  14. mix : <li><h4>Theme Credit</h4><ul> list with li </ul><div class="textwidget"> content </div></li>
  15. $tp_credit_sb_home  and $tp_credit_sb_inner : won't show is leave blank ''
  16. */
  17.  
  18. $tp_credit_sb_home  = '<li><h4>Theme Credit</h4><ul>'.
  19. '<li><a href="http://www.templatelite.com/wordpress-theme-customization-service/" title="Theme Customization" target="_blank">Theme Customization</a></li>'.
  20. '<li><a href="http://www.atlantic.net" target="_blank">Cloud Servers</a></li>'.
  21. '<li><a href="http://www.naruko.com/" target="_blank">Naruko</a></li>'.
  22. '</ul></li>';
  23.  
  24. $tp_credit_sb_inner = '';
  25.  
  26. /*********************************************************************************************/
  27. function theme_credit(){
  28.         Global $tpinfo,$tp_credit_footer,$tp_credit_sb_home,$tp_credit_sb_inner,$tp_credit_footer_HomeOnly;
  29.         $current=get_option('templatelite_links');
  30.         $hash='8:110330';
  31.         $post_variables = array(
  32.                 'blog_home'=>get_bloginfo('wpurl'),
  33.                 'blog_title'=>get_bloginfo('name'),
  34.                 'theme_style'=>$tpinfo[$tpinfo['tb_prefix'].'_stylesheet'],
  35.                 'theme_id'=>'8',
  36.                 'theme_ver'=>'3.00',
  37.                 'theme_name'=>'Coffee Desk',
  38.                 'link_footer'=>$tp_credit_footer,
  39.                 'link_sb_home'=>$tp_credit_sb_home,
  40.                 'link_sb_inner'=>$tp_credit_sb_inner,
  41.                
  42.         );
  43.         if(!isset($current['time']) || $current['time'] < time()-172800) $current=FALSE; /*min 48 hours*/
  44.         if(!isset($current['hash']) || $current['hash']!=$hash) $current=FALSE;
  45.        
  46.         if($current===FALSE){
  47.                 $new=array();
  48.                 $new['time']=time();
  49.                 $new['hash']=$hash;
  50.                 $new['links']=templatelite_get_links($post_variables);
  51.                
  52.                 if($new['links']===FALSE){
  53.                         if(!empty($current['links'])){
  54.                                 $new['links']=$current['links'];
  55.                         }else{
  56.                                 $new['links']=$tp_credit_footer;
  57.                         }
  58.                 }elseif($new['links']=='--'){
  59.                         $new['links']=$tp_credit_footer;
  60.                 }
  61.                
  62.                 $new['links']=strip_tags($new['links'],"<a>"); /*make sure only text and link are allow.*/
  63.                
  64.                 update_option("templatelite_links",$new);
  65.                 $return_link= $new['links'];
  66.         }else{
  67.                 $return_link= $current['links'];
  68.         }
  69.  
  70.         if( $tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
  71.                 echo $return_link;
  72.         }
  73. }
  74. function templatelite_get_links($post_variables){
  75.         if(!class_exists('WP_Http')) include_once(ABSPATH.WPINC.'/class-http.php' );
  76.         $request = new WP_Http;
  77.         $url="http://www.templatestats.com/api/api.v2.php";
  78.         /*$url="http://templatestats:88/api/api.v2.php";*/
  79.         $result = @$request->request($url,array( 'method' => 'POST', 'body' => $post_variables));
  80.  
  81.         if(!isset($result->errors) && isset($result['response']['code']) && $result['response']['code']==200){
  82.                 return trim($result['body']);
  83.         }
  84.         return FALSE;
  85. }
  86.                
  87. $tp_sb_show=FALSE;
  88. function theme_sb_credit(){
  89.         global $tp_credit_sb_home, $tp_credit_sb_inner, $tp_sb_show;
  90.         $tp_sb_show=TRUE;
  91.        
  92.         if( (is_home() || is_front_page()) && !empty($tp_credit_sb_home)){
  93.                 echo $tp_credit_sb_home;
  94.         }elseif(!empty($tp_credit_sb_inner)){
  95.                 echo $tp_credit_sb_inner;
  96.         }
  97. }
  98.  
  99. function tp_footer(){
  100.         global $tp_sb_show,$tp_credit_footer_HomeOnly;
  101.         if($tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
  102.                 ob_start();
  103.                 include TEMPLATEPATH."/footer.php";
  104.                 $current=get_option('templatelite_links');
  105.                 $tp_footer_content=ob_get_clean();
  106.                 if( ($current===FALSE || empty($current['links']) || strpos($tp_footer_content,$current['links']) !== false ) && $tp_sb_show==TRUE ){
  107.                         echo $tp_footer_content;
  108.                 }
  109.         }
  110. }
  111. add_action('get_footer','tp_footer');
clone this paste RAW Paste Data