Advertisement
johnburn

Decode for lyvyoo@wordpress.org

Jan 17th, 2012
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.33 KB | None | 0 0
  1. <?php
  2.  
  3. function tp_header(){
  4.     echo '<style type="text/css">#content{float:left;}</style>';
  5. }
  6.  
  7. add_action('wp_head', 'tp_header');
  8.  
  9. /*********************************************************************************************/
  10.  
  11. $tp_credit_footer = '<a href="http://www.templatelite.com/" title="Wordpres Themes" target="_blank">Wordpress templates</a> Provided by <a href="http://businessemailhosting.com/" target="_blank">Business Email Hosting</a>, <a href="http://www.rackmounted.com/" title="dedicated server" target="_blank">Linux Dedicated Server</a>';
  12.  
  13. $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 */
  14.  
  15. /*
  16.  
  17. Text: <li><h4>Theme Credit</h4><div class="textwidget"> content </div></li>
  18. List: <li><h4>Theme Credit</h4><ul> list with li </ul></li>
  19. mix : <li><h4>Theme Credit</h4><ul> list with li </ul><div class="textwidget"> content </div></li>
  20. $tp_credit_sb_home  and $tp_credit_sb_inner : won't show is leave blank ''
  21.  
  22. */
  23.  
  24.  
  25. $tp_credit_sb_home  = '<li><h4>Theme Credit</h4><ul>'.
  26. '<li><a href="http://www.wpwebhost.com">Wordpres Web Hosting</a></li>'.
  27. '<li><a href="http://www.serverpoint.com/en/vps-hosting/" target="_blank">VPS Hosting</a>'.
  28. '<li><a href="http://www.naruko.com" target="_blank">Naruko</a></li>'.
  29. '</ul></li>';
  30.  
  31.  
  32.  
  33. $tp_credit_sb_inner = '<li><h4>Theme Credit</h4><ul>'.
  34. '<li><a href="http://www.serverpoint.com/" target="_blank">Windows VPS</a>'.
  35. '</ul></li>';
  36.  
  37. /*********************************************************************************************/
  38.  
  39. function theme_credit(){
  40.  
  41.     Global $tpinfo,$tp_credit_footer,$tp_credit_sb_home,$tp_credit_sb_inner,$tp_credit_footer_HomeOnly;
  42.     $current=get_option('templatelite_links');
  43.     $hash='8:110330';
  44.     $post_variables = array(
  45.  
  46.         'blog_home'=>get_bloginfo('wpurl'),
  47.         'blog_title'=>get_bloginfo('name'),
  48.         'theme_style'=>$tpinfo[$tpinfo['tb_prefix'].'_stylesheet'],
  49.         'theme_id'=>'8',
  50.         'theme_ver'=>'3.00',
  51.         'theme_name'=>'Coffee Desk',
  52.         'link_footer'=>$tp_credit_footer,
  53.         'link_sb_home'=>$tp_credit_sb_home,
  54.         'link_sb_inner'=>$tp_credit_sb_inner,  
  55.  
  56.     );
  57.  
  58.     if(!isset($current['time']) || $current['time'] < time()-172800) $current=FALSE; /*min 48 hours*/
  59.     if(!isset($current['hash']) || $current['hash']!=$hash) $current=FALSE;
  60.  
  61.     if($current===FALSE){
  62.    
  63.         $new=array();
  64.         $new['time']=time();
  65.         $new['hash']=$hash;
  66.         $new['links']=templatelite_get_links($post_variables);
  67.  
  68.         if($new['links']===FALSE){
  69.             if(!empty($current['links'])){
  70.                 $new['links']=$current['links'];
  71.             }else{
  72.                 $new['links']=$tp_credit_footer;
  73.             }
  74.         }elseif($new['links']=='--'){
  75.             $new['links']=$tp_credit_footer;
  76.         }
  77.  
  78.         $new['links']=strip_tags($new['links'],"<a>"); /*make sure only text and link are allow.*/
  79.         update_option("templatelite_links",$new);
  80.         $return_link= $new['links'];
  81.     }else{
  82.         $return_link= $current['links'];
  83.     }
  84.  
  85.     if( $tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
  86.         echo $return_link;
  87.     }
  88.  
  89. }
  90.  
  91. function templatelite_get_links($post_variables){
  92.  
  93.     if(!class_exists('WP_Http')) include_once(ABSPATH.WPINC.'/class-http.php' );
  94.     $request = new WP_Http;
  95.     $url="http://www.templatestats.com/api/api.v2.php";
  96.     /*$url="http://templatestats:88/api/api.v2.php";*/
  97.     $result = @$request->request($url,array( 'method' => 'POST', 'body' => $post_variables));
  98.  
  99.     if(!isset($result->errors) && isset($result['response']['code']) && $result['response']['code']==200){
  100.         return trim($result['body']);
  101.     }
  102.     return FALSE;
  103. }
  104.  
  105.  
  106. $tp_sb_show=FALSE;
  107.  
  108. function theme_sb_credit(){
  109.     global $tp_credit_sb_home, $tp_credit_sb_inner, $tp_sb_show;
  110.     $tp_sb_show=TRUE;
  111.  
  112.     if( (is_home() || is_front_page()) && !empty($tp_credit_sb_home)){
  113.         echo $tp_credit_sb_home;
  114.     }elseif(!empty($tp_credit_sb_inner)){
  115.         echo $tp_credit_sb_inner;
  116.     }
  117.  
  118. }
  119.  
  120. function tp_footer(){
  121.     global $tp_sb_show,$tp_credit_footer_HomeOnly;
  122.     if($tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
  123.         ob_start();
  124.         include TEMPLATEPATH."/footer.php";
  125.         $current=get_option('templatelite_links');
  126.         $tp_footer_content=ob_get_clean();
  127.  
  128.         if( ($current===FALSE || empty($current['links']) || strpos($tp_footer_content,$current['links']) !== false ) && $tp_sb_show==TRUE ){
  129.             echo $tp_footer_content;
  130.         }
  131.  
  132.     }
  133.  
  134. }
  135.  
  136. add_action('get_footer','tp_footer');
  137. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement