Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tp_header(){
- echo '<style type="text/css">#content{float:left;}</style>';
- }
- add_action('wp_head', 'tp_header');
- /*********************************************************************************************/
- $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>';
- $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 */
- /*
- Text: <li><h4>Theme Credit</h4><div class="textwidget"> content </div></li>
- List: <li><h4>Theme Credit</h4><ul> list with li </ul></li>
- mix : <li><h4>Theme Credit</h4><ul> list with li </ul><div class="textwidget"> content </div></li>
- $tp_credit_sb_home and $tp_credit_sb_inner : won't show is leave blank ''
- */
- $tp_credit_sb_home = '<li><h4>Theme Credit</h4><ul>'.
- '<li><a href="http://www.templatelite.com/wordpress-theme-customization-service/" title="Theme Customization" target="_blank">Theme Customization</a></li>'.
- '<li><a href="http://www.atlantic.net" target="_blank">Cloud Servers</a></li>'.
- '<li><a href="http://www.naruko.com/" target="_blank">Naruko</a></li>'.
- '</ul></li>';
- $tp_credit_sb_inner = '';
- /*********************************************************************************************/
- function theme_credit(){
- Global $tpinfo,$tp_credit_footer,$tp_credit_sb_home,$tp_credit_sb_inner,$tp_credit_footer_HomeOnly;
- $current=get_option('templatelite_links');
- $hash='8:110330';
- $post_variables = array(
- 'blog_home'=>get_bloginfo('wpurl'),
- 'blog_title'=>get_bloginfo('name'),
- 'theme_style'=>$tpinfo[$tpinfo['tb_prefix'].'_stylesheet'],
- 'theme_id'=>'8',
- 'theme_ver'=>'3.00',
- 'theme_name'=>'Coffee Desk',
- 'link_footer'=>$tp_credit_footer,
- 'link_sb_home'=>$tp_credit_sb_home,
- 'link_sb_inner'=>$tp_credit_sb_inner,
- );
- if(!isset($current['time']) || $current['time'] < time()-172800) $current=FALSE; /*min 48 hours*/
- if(!isset($current['hash']) || $current['hash']!=$hash) $current=FALSE;
- if($current===FALSE){
- $new=array();
- $new['time']=time();
- $new['hash']=$hash;
- $new['links']=templatelite_get_links($post_variables);
- if($new['links']===FALSE){
- if(!empty($current['links'])){
- $new['links']=$current['links'];
- }else{
- $new['links']=$tp_credit_footer;
- }
- }elseif($new['links']=='--'){
- $new['links']=$tp_credit_footer;
- }
- $new['links']=strip_tags($new['links'],"<a>"); /*make sure only text and link are allow.*/
- update_option("templatelite_links",$new);
- $return_link= $new['links'];
- }else{
- $return_link= $current['links'];
- }
- if( $tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
- echo $return_link;
- }
- }
- function templatelite_get_links($post_variables){
- if(!class_exists('WP_Http')) include_once(ABSPATH.WPINC.'/class-http.php' );
- $request = new WP_Http;
- $url="http://www.templatestats.com/api/api.v2.php";
- /*$url="http://templatestats:88/api/api.v2.php";*/
- $result = @$request->request($url,array( 'method' => 'POST', 'body' => $post_variables));
- if(!isset($result->errors) && isset($result['response']['code']) && $result['response']['code']==200){
- return trim($result['body']);
- }
- return FALSE;
- }
- $tp_sb_show=FALSE;
- function theme_sb_credit(){
- global $tp_credit_sb_home, $tp_credit_sb_inner, $tp_sb_show;
- $tp_sb_show=TRUE;
- if( (is_home() || is_front_page()) && !empty($tp_credit_sb_home)){
- echo $tp_credit_sb_home;
- }elseif(!empty($tp_credit_sb_inner)){
- echo $tp_credit_sb_inner;
- }
- }
- function tp_footer(){
- global $tp_sb_show,$tp_credit_footer_HomeOnly;
- if($tp_credit_footer_HomeOnly===FALSE || (is_home() || is_front_page()) ){
- ob_start();
- include TEMPLATEPATH."/footer.php";
- $current=get_option('templatelite_links');
- $tp_footer_content=ob_get_clean();
- if( ($current===FALSE || empty($current['links']) || strpos($tp_footer_content,$current['links']) !== false ) && $tp_sb_show==TRUE ){
- echo $tp_footer_content;
- }
- }
- }
- add_action('get_footer','tp_footer');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement