<?php /* EL PSY CONGROO */     			  	 
#注册插件       			 	
RegisterPlugin("FY_Shang","ActivePlugin_FY_Shang");    			 	 		
function ActivePlugin_FY_Shang() {      						
	Add_Filter_Plugin('Filter_Plugin_ViewPost_Template','FY_Shang_Main');           	
}    	   		  
    	       
function FY_Shang_SubMenu($id){     							
	$arySubMenu = array(        		 	
		0 => array('基本设置', 'main.php', 'left', false),    	 					 
		1 => array('插件配色', 'color.php', 'left', false),       		 		
		2 => array('相关说明', 'Relevant.php', 'left', false),     		 		  
	);    				 	  
	foreach($arySubMenu as $k => $v){      	   	 
		echo '<a href="'.$v[1].'" '.($v[3]==true?'target="_blank"':'').'><span class="m-'.$v[2].' '.($id==$k?'m-now':'').'">'.$v[0].'</span></a>';      	  	 	
	}    	      	
}    	  	  		
     			 			
function FY_Shang_Main(&$template){    		 	  		
	global $zbp;      	  	  
	$zbp->header .= '<link rel="stylesheet" href="'.$zbp->host.'zb_users/plugin/FY_Shang/style/font-awesome-4.3.0/css/font-awesome.min.css" />' . "\r\n";    					 		
	if ($zbp->Config('FY_Shang')->fx_kg) {    	  					
		$zbp->header .= '<link rel="stylesheet" href="'.$zbp->host.'zb_users/plugin/FY_Shang/style/share.min.css" />' . "\r\n";    	 				 	
	}
	$zbp->header .= '<style type="text/css"> 
	.shareBox{width: 100%;margin: 0 auto;text-align: center;position: relative;}
.clearfix:after,.clearfix:before,.row:after,.row:before{content:" ";display:table}
.shareBox p{text-align: center;padding-bottom:18px}
.shareBox img{border: 0!important;border-radius: initial!important;box-shadow: initial!important;}
.shareBox .sharebtn{width:130px;height:40px;line-height:40px;border:1px solid '.$zbp->Config('FY_Shang')->color.';box-shadow:none;background:#fff;display:inline-block;text-align:center;margin:0 2px;color:'.$zbp->Config('FY_Shang')->color.';font-size:14px;text-indent: 0em;text-decoration:none;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease;    border-radius: 25px;}
.shareBox .sharebtntn{color:'.$zbp->Config('FY_Shang')->fx_color.';border-color:'.$zbp->Config('FY_Shang')->fx_color.'}
.shareBox .sharebtn:hover{background-color:'.$zbp->Config('FY_Shang')->color.';color:#fff}
.shareBox .sharebtntn:hover{background-color:'.$zbp->Config('FY_Shang')->fx_color.';color:#fff}
.shareBox .pay-author{border-color:'.$zbp->Config('FY_Shang')->ds_color.';color:'.$zbp->Config('FY_Shang')->ds_color.'}
.shareBox .pay-author:hover{background:'.$zbp->Config('FY_Shang')->ds_color.';color:#FFF}
	.fy-shang{width:80%;margin:0 auto;}
	.hide_box{z-index:999;filter:alpha(opacity=50);background:#666;opacity: 0.5;-moz-opacity: 0.5;left:0;top:0;height:99%;width:100%;position:fixed;display:none;}
	.shang_box{width:540px;height:480px;padding:10px;background-color:#fff;border-radius:10px;position:fixed;z-index:1000;left:50%;top:50%;margin-left:-280px;margin-top:-280px;border:1px dotted #dedede;display:none;}
	.shang_box img{border:none;border-width:0;}
	.dashang{display:block;width:100px;margin:5px auto;height:25px;line-height:25px;padding:10px;background-color:#E74851;color:#fff!important;text-align:center;text-decoration:none;border-radius:10px;font-weight:bold;font-size:16px;text-indent: 0em;transition: all 0.3s;}
	.dashang:hover{opacity:0.8;padding:15px;font-size:18px;}
	.shang_close{float:right;display:inline-block;}
	.shang_logo{display:block;text-align:center;margin:20px auto;}
	.shang_tit{width: 100%;height: 75px;text-align: center;line-height: 66px;color: #a3a3a3;font-size: 16px;background: url(\''.$zbp->host.'zb_users/plugin/FY_Shang/img\/cy-reward-title-bg.jpg\');font-family: \'Microsoft YaHei\';margin-top: 7px;margin-right:2px;}
	.shang_tit p{color:#a3a3a3;text-align:center;font-size:16px;text-indent: 0em!important;}
	.shang_payimg{width:172px;padding:10px;border:6px solid #EA5F00;margin:0 auto;border-radius:3px;height:172px;}
	.shang_payimg img{display:block;text-align:center;width:140px;height:140px; }
	.pay_explain{text-align:center;margin:10px auto;font-size:12px;color:#545454;}
	.radiobox{width: 16px;height: 16px;background: url(\''.$zbp->host.'zb_users/plugin/FY_Shang/img\/radio2.jpg\');display: block;float: left;margin-top: 5px;margin-right: 14px;}
	.checked .radiobox{background:url(\''.$zbp->host.'zb_users/plugin/FY_Shang/img/radio1.jpg\');}
	.shang_payselect{text-align:center;margin:0 auto;margin-top:40px;cursor:pointer;height:60px;width:280px;}
	.shang_payselect .pay_item{display:inline-block;margin-right:10px;float:left;}
	.shang_info{clear:both;}
	.shang_info p,.shang_info a{color:#C3C3C3;text-align:center;font-size:12px;text-decoration:none;line-height:2em;}
	@media screen and (max-width:1040px) {.shang_box{width: 300px;height: 440px;padding: 10px;background-color: #fff;border-radius: 10px;position: fixed;z-index: 1000;left: 50%;margin-left: -155px;top: 80px;margin-top: 0;}}
	@media screen and (max-width:640px){.shareBox .sharebtn{width:90px;height:35px;line-height:35px}}
	'.$zbp->Config('FY_Shang')->footer_css.'
</style>' . "\r\n";
if ($zbp->Config('FY_Shang')->fx_kg) {    	 			   
	$zbp->footer .= '<script src="'.$zbp->host.'zb_users/plugin/FY_Shang/js/jquery.share.min.js"></script>' . "\r\n";    		 	 	  
}
	$zbp->footer .= '<script type="text/javascript">
$(function(){
	$(".pay_item").click(function(){
		$(this).addClass(\'checked\').siblings(\'.pay_item\').removeClass(\'checked\');
		var dataid=$(this).attr(\'data-id\');
		$(".shang_payimg img").attr("src","'.$zbp->host.'zb_users/plugin/FY_Shang/img/"+dataid+"img.jpg");
		$("#shang_pay_txt").text(dataid=="alipay"?"支付宝":"微信");
	});
});
function dashangToggle(){
	$(".hide_box").fadeToggle();
	$(".shang_box").fadeToggle();
}
$(document).ready(function() {
	$(".sharebtntn").click(function() {
        $(".social-share").toggle();
    })
});
</script>' . "\r\n";
$article = $template->GetTags('article');    	 	 				
	$sf_praise_sdk=SF_praise_sdk::findPostCount($article->ID);    				    
	$con = '';
	$con .= '<div class="shareBox  clearfix">
  		<p>';
  		if ($zbp->Config('FY_Shang')->dz_kg) {
  			$con .= '<a href="javascript:;" class="sf-praise-sdk action sharebtn like" title="喜欢" sfa="click" data-postid='.$sf_praise_sdk->postid.' data-value="1" data-ok="zijiqugemingzi">
          				<span class="icon s-like"><i class="fa fa-heart-o"></i> 喜欢 </span>
          				(<span class="sf-praise-sdk count num" sfa="num" data-value="1" data-postid='.$sf_praise_sdk->postid.'>'.$sf_praise_sdk->value1.'</span>)
          			</a>';
          		}    		 	 	  
          		if ($zbp->Config('FY_Shang')->ds_kg) {    	 		 		 
          			$con .= '<a href="javascript:void(0)" onclick="dashangToggle()" class="sharebtn pay-author"><i class="fa fa-gift"></i> 打赏</a>';     	   	 	
          		}    						 	
          		if ($zbp->Config('FY_Shang')->fx_kg) {    	   		  
          			$con .= '<a href="javascript:;" class="sharebtn sharebtntn"><i class="fa fa-mail-forward (alias)"></i> 分享</a>';    	   	 	 
          		}     					  
     		 	   
          		$con .= '</p><div class="socialBox">';     	  	   
          			if ($zbp->Config('FY_Shang')->fx_kg) {
          				$con .= '<div class="social-share" data-initialized="true" style="display:none;text-align: center;">
				<a href="#" class="social-share-icon icon-weibo"></a>
				<a href="#" class="social-share-icon icon-qq"></a>
				<a href="#" class="social-share-icon icon-wechat"></a>
				<a href="#" class="social-share-icon icon-tencent"></a>
				<a href="#" class="social-share-icon icon-douban"></a>
				<a href="#" class="social-share-icon icon-qzone"></a>
				<a href="#" class="social-share-icon icon-linkedin"></a>
				<a href="#" class="social-share-icon icon-facebook"></a>
				<a href="#" class="social-share-icon icon-twitter"></a>
				<a href="#" class="social-share-icon icon-google"></a>
			</div>';
          			}    			 	 	 
          			if ($zbp->Config('FY_Shang')->ds_kg) {
          			$con .= '<div class="hide_box"></div>
<div class="shang_box">
	<a class="shang_close" href="javascript:void(0)" onclick="dashangToggle()" title="关闭"><img src="'.$zbp->host.'zb_users/plugin/FY_Shang/img/close.jpg" alt="取消" /></a>
	<div class="shang_tit">
		<p>'.$zbp->Config('FY_Shang')->shang_title.'</p>
	</div>
	<div class="shang_payimg">
		<img src="'.$zbp->host.'zb_users/plugin/FY_Shang/img/alipayimg.jpg" alt="扫码支持" title="扫一扫" />
	</div>
	<div class="pay_explain">'.$zbp->Config('FY_Shang')->shang_text.'</div>
	<div class="shang_payselect">
		<div class="pay_item checked" data-id="alipay">
			<span class="radiobox"></span>
			<span class="pay_logo">
				<img src="'.$zbp->host.'zb_users/plugin/FY_Shang/img/alipay.jpg" alt="支付宝" />
			</span>
		</div>
		<div class="pay_item" data-id="weipay">
			<span class="radiobox"></span>
			<span class="pay_logo"><img src="'.$zbp->host.'zb_users/plugin/FY_Shang/img/wechat.jpg" alt="微信" /></span>
		</div>
	</div>
	<div class="shang_info">
		<p>打开<span id="shang_pay_txt">支付宝</span>扫一扫，即可进行扫码打赏哦</p>
	</div>
</div></div>';
}
$con .= '
</div>';
if ($zbp->Config('FY_Shang')->shang_deve == 'aliplay'){    	 	  	  
	$article->Content = $article->Content.$con;    	 		  		
	$template->SetTags('article',$article);          		
}else{    	  	 	 	
	$template->SetTags('FY_Shang_deve',$con);	     		 		 	
	}    	 	   	 
}    	    	 	
    			   		
function InstallPlugin_FY_Shang() {      			 	 
	global $zbp;      		  		
	$zbp->Config('FY_Shang')->shang_title='感谢您的支持，我会继续努力的!';      	 	   
	$zbp->Config('FY_Shang')->shang_text='扫码打赏，你说多少就多少';      		   	
	$zbp->Config('FY_Shang')->shang_deve='aliplay';    	 						
	$zbp->Config('FY_Shang')->color='#F74840';    				  		
	$zbp->Config('FY_Shang')->ds_color='#ffab2e';    	  	  	 
	$zbp->Config('FY_Shang')->fx_color='#3496E6';    					 	 
	$zbp->Config('FY_Shang')->dz_kg='true';    	 		 	 	
	$zbp->Config('FY_Shang')->ds_kg='true';    	 	 	 		
	$zbp->Config('FY_Shang')->fx_kg='true';    		 	  		
	$zbp->SaveConfig('FY_Shang');	         	  
}    				  		
function UninstallPlugin_FY_Shang() {    	  	  	 
	global $zbp;     	  		 	
	$zbp->DelConfig('FY_Shang');    	  		 	 
}    		    	 