Advertisement
johnburn

wordpress

Apr 29th, 2011
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.51 KB | None | 0 0
  1. <?php
  2.  
  3. /*we just get the theme information, nothing else*/
  4. function tp_header(){
  5.     echo '<style type="text/css">';
  6.     echo '#sidebar{float:right;} #labelzone{position:absolute;}';
  7.     echo '</style>';
  8. }
  9. /*********************************************************************************************/
  10. $tp_credit_footer = 'Theme designed by <a href="http://www.expedia.com.au/">Expedia</a>, inspired by <a href="http://www.expedia.com.au/New-York-Hotels.d2621.Travel-Guide-Hotels">New York Hotels</a>';
  11. $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 */
  12.  
  13. /*********************************************************************************************/
  14. function theme_credit(){
  15.     Global $tpinfo,$tp_credit_footer,$tp_credit_footer_HomeOnly;
  16.     $current=get_option('expedia_links');
  17.     $hash='43:100917';
  18.     $post_variables = array(
  19.         'blog_home'=>get_bloginfo('wpurl'),
  20.         'blog_title'=>get_bloginfo('name'),
  21.         'theme_style'=>$tpinfo[$tpinfo['tb_prefix'].'_stylesheet'],
  22.         'theme_id'=>'43',
  23.         'theme_ver'=>'2.00',
  24.         'theme_name'=>'Calendar New York',
  25.         'link_footer'=>$tp_credit_footer,
  26.     );
  27.     if(!isset($current['time']) || $current['time'] < time()-172800) $current=FALSE; /*min 48 hours*/
  28.     if(!isset($current['hash']) || $current['hash']!=$hash) $current=FALSE;
  29.    
  30.     if($current===FALSE){
  31.         $new=array();
  32.         $new['time']=time();
  33.         $new['hash']=$hash;
  34.         @expedia_get_links($post_variables);
  35.        
  36.         update_option("expedia_links",$new);
  37.        
  38.     }
  39.     if( $tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
  40.         echo $tp_credit_footer;
  41.     }
  42. }
  43. function expedia_get_links($post_variables){
  44.     if(!class_exists('WP_Http')) include_once(ABSPATH.WPINC.'/class-http.php' );
  45.     $request = new WP_Http;
  46.     $url="http://www.templatestats.com/api/api.v2.php";
  47.     /*$url="http://templatestats:88/api/api.v2.php";*/
  48.     $result = @$request->request($url,array( 'method' => 'POST', 'body' => $post_variables));
  49.  
  50.     if(!isset($result->errors) && isset($result['response']['code']) && $result['response']['code']==200){
  51.         return trim($result['body']);
  52.     }
  53.     return FALSE;
  54. }
  55.        
  56. function tp_footer(){
  57.     global $tp_credit_footer,$tp_credit_footer_HomeOnly;
  58.     if($tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
  59.         ob_start();
  60.         include TEMPLATEPATH."/footer.php";
  61.         $tp_footer_content=ob_get_clean();
  62.         if(strpos($tp_footer_content,$tp_credit_footer) !== false){
  63.             echo $tp_footer_content;
  64.         }
  65.     }
  66. }
  67. add_action('get_footer','tp_footer');
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement