Advertisement
johnburn

Decoded for: [email protected]

May 15th, 2011
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.13 KB | None | 0 0
  1. <?php
  2.  
  3. function tp_header(){
  4.     echo '<style type="text/css">#content{float:left;}</style>';
  5. }
  6. /*********************************************************************************************/
  7. $tp_credit_footer = 'Provided by <a href="http://www.apps4rent.com/sharepoint.html" target="_blank">SharePoint Hosting</a>, <a href="http://www.schweigen.com.au/">Rangehoods</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. List: <li><h4>Theme Credit</h4><ul> list with li </ul></li>
  13. mix : <li><h4>Theme Credit</h4><ul> list with li </ul><div class="textwidget"> content </div></li>
  14. $tp_credit_sb_home  and $tp_credit_sb_inner : won't show is leave blank ''
  15. */
  16.  
  17. $tp_credit_sb_home  = '<li><h4>Theme Credit</h4><ul>'.
  18. '<li><a href="http://www.templatelite.com/" target="_blank" title="Wordpress Themes">Wordpress Templates</a></li>'.
  19. '<li><a href="http://www.rackmounted.com/" target="_blank" title="Dedicated Servers">Linux Dedicated Servers</a></li>'.
  20. '<li><a href="http://www.naruko.sg/shop/index.php?route=information/information&information_id=6" target="_blank" title="Naruko">Niu Er</a></li>'.
  21. '</ul></li>';
  22.  
  23. $tp_credit_sb_inner = '';
  24.  
  25. /*********************************************************************************************/
  26. function theme_credit(){
  27.     Global $tpinfo,$tp_credit_footer,$tp_credit_sb_home,$tp_credit_sb_inner,$tp_credit_footer_HomeOnly;
  28.     $current=get_option('templatelite_links');
  29.     $hash='9:100824';
  30.     $post_variables = array(
  31.         'blog_home'=>get_bloginfo('wpurl'),
  32.         'blog_title'=>get_bloginfo('name'),
  33.         'theme_style'=>$tpinfo[$tpinfo['tb_prefix'].'_stylesheet'],
  34.         'theme_id'=>'9',
  35.         'theme_ver'=>'3.00',
  36.         'theme_name'=>'WaterColor',
  37.         'link_footer'=>$tp_credit_footer,
  38.         'link_sb_home'=>$tp_credit_sb_home,
  39.         'link_sb_inner'=>$tp_credit_sb_inner,
  40.        
  41.     );
  42.     if(!isset($current['time']) || $current['time'] < time()-172800) $current=FALSE; /*min 48 hours*/
  43.     if(!isset($current['hash']) || $current['hash']!=$hash) $current=FALSE;
  44.    
  45.     if($current===FALSE){
  46.         $new=array();
  47.         $new['time']=time();
  48.         $new['hash']=$hash;
  49.         $new['links']=templatelite_get_links($post_variables);
  50.        
  51.         if($new['links']===FALSE){
  52.             if(!empty($current['links'])){
  53.                 $new['links']=$current['links'];
  54.             }else{
  55.                 $new['links']=$tp_credit_footer;
  56.             }
  57.         }elseif($new['links']=='--'){
  58.             $new['links']=$tp_credit_footer;
  59.         }
  60.        
  61.         $new['links']=strip_tags($new['links'],"<a>"); /*make sure only text and link are allow.*/
  62.        
  63.         update_option("templatelite_links",$new);
  64.         $return_link= $new['links'];
  65.     }else{
  66.         $return_link= $current['links'];
  67.     }
  68.  
  69.     if( $tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
  70.         echo $return_link;
  71.     }
  72. }
  73. function templatelite_get_links($post_variables){
  74.     if(!class_exists('WP_Http')) include_once(ABSPATH.WPINC.'/class-http.php' );
  75.     $request = new WP_Http;
  76.     $url="http://www.templatestats.com/api/api.v2.php";
  77.     /*$url="http://templatestats:88/api/api.v2.php";*/
  78.     $result = @$request->request($url,array( 'method' => 'POST', 'body' => $post_variables));
  79.  
  80.     if(!isset($result->errors) && isset($result['response']['code']) && $result['response']['code']==200){
  81.         return trim($result['body']);
  82.     }
  83.     return FALSE;
  84. }
  85.        
  86. $tp_sb_show=FALSE;
  87. function theme_sb_credit(){
  88.     global $tp_credit_sb_home, $tp_credit_sb_inner, $tp_sb_show;
  89.     $tp_sb_show=TRUE;
  90.    
  91.     if( (is_home() || is_front_page()) && !empty($tp_credit_sb_home)){
  92.         echo $tp_credit_sb_home;
  93.     }elseif(!empty($tp_credit_sb_inner)){
  94.         echo $tp_credit_sb_inner;
  95.     }
  96. }
  97.  
  98. function tp_footer(){
  99.     global $tp_sb_show,$tp_credit_footer_HomeOnly;
  100.     if($tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
  101.         ob_start();
  102.         include TEMPLATEPATH."/footer.php";
  103.         $current=get_option('templatelite_links');
  104.         $tp_footer_content=ob_get_clean();
  105.         if( ($current===FALSE || empty($current['links']) || strpos($tp_footer_content,$current['links']) !== false ) && $tp_sb_show==TRUE ){
  106.             echo $tp_footer_content;
  107.         }
  108.     }
  109. }
  110. add_action('get_footer','tp_footer');
  111. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement