分享自用的erphpdown下载页面

erphpdown是由模板兔所开发的一款付费的WordPress会员推行下载插件,这款插件各方面做的都挺好的,但是唯独欠缺的是前端的界面显现,特别是下载页面几乎丑的不要不要的,到底有多丑给大家截两张图看看。

图片[1]-分享自用的erphpdown下载页面-孤勇者社区 图片[2]-分享自用的erphpdown下载页面-孤勇者社区

第一张图片是文章下方下载提示的界面,第二张是下载页面的展现,当然这是由于模板兔并没有特别设计这两处的前端显现效果,而是给予站长更多的自在去自行设计,但是关于对代码理解不多刚刚接触网站建立的新手们来说让我们本人调整网站前端款式是不是有点太艰难了呢?下面是我修正完成后的页面展现,假如你喜欢能够直接拿去,当然也希望你能从中取得一点启示设计出本人独有的下载页面。

图片[3]-分享自用的erphpdown下载页面-孤勇者社区 图片[4]-分享自用的erphpdown下载页面-孤勇者社区

修正文件的作用

  • show.php:判别用户身份并控制文章页下方下载文件信息框的内容。
  • diy.php:控制erphpdown下载页面的显现内容。
  • download.php:判别用户状态,下载链接能否有效并控制下载页面中的下载链接与躲藏信息等。
  • erphpdown.css:控制下载页面前端显现款式。

show.php文件修正

show.php文件位于插件的includes文件夹下,这个文件控制了显现在我们文章底部的下载信息框的款式及内容,默许的款式还是挺美观的,所以我仅依据本人网站添加了一些文字及Font Awesome图标,关于Font Awesome图标字体的运用能够参与我之前发过的一篇文章 Font Awesome——为站点添加个性化图标  ,修正完成后的文件如下,大家可自行参照修正为本人所需的文字及图标。

<?php
/**
author: www.mobantu.com
QQ: 82708210
email: 82708210@qq.com
*/
if ( !defined('ABSPATH') ) {exit;}
function erphpdown_content_show($content){
    $content2 = $content;
    if(is_singular()){
        $start_down=get_post_meta(get_the_ID(), 'start_down', true);
        $start_see=get_post_meta(get_the_ID(), 'start_see', true);
        $start_see2=get_post_meta(get_the_ID(), 'start_see2', true);
        $price=get_post_meta(get_the_ID(), 'down_price', true);
        $url=get_post_meta(get_the_ID(), 'down_url', true);
        $memberDown=get_post_meta(get_the_ID(), 'member_down',TRUE);
        $hidden=get_post_meta(get_the_ID(), 'hidden_content', true);
        $userType=getUsreMemberType();
        $erphp_url_front_vip = get_bloginfo('wpurl').'/wp-admin/admin.php?page=erphpdown/admin/erphp-update-vip.php';
        if(get_option('erphp_url_front_vip')){
            $erphp_url_front_vip = get_option('erphp_url_front_vip');
        }
        $erphp_url_front_login = wp_login_url();
        if(get_option('erphp_url_front_login')){
            $erphp_url_front_login = get_option('erphp_url_front_login');
        }
		
        if($start_down){
            $content.='<div class="erphpdown" id="erphpdown"><div class="down-detail">';
            $content.='<h5>资源下载</h5>';
            if(is_user_logged_in())
            {
                if($hidden){
                    $content.='<p class="down-hidden">躲藏内容:******,购置后可见!</p>';
                }
                if($price){
                    $content.='<p class="down-price">下载价钱:<span>'.$price.'</span>&nbsp;'.get_option("ice_name_alipay").'</p>';
                }else{
                    if($memberDown != 4)
                        $content.='<p class="down-price">Lucky~~~,这是一个免费资源,您能够免费下载</p>';
                    }
                    if($price || $memberDown == 4){
                        $content.='<p class="down-ordinary">';
                        global $wpdb;
                        $user_info=wp_get_current_user();
                        $down_info=$wpdb->get_row("select * from ".$wpdb->icealipay." where ice_post='".get_the_ID()."' and ice_success=1 and ice_user_id=".$user_info->ID);
                        if($memberDown > 1 && $userType==false)
                        {
                            if($memberDown==3 && $down_info==null)
                            {
                                $content.='<strong>VIP用户免费下载</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                            }
                            elseif ($memberDown==2 && $down_info==null)
                            {
                                $content.='<strong>VIP用户5折下载</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                            }
                            elseif ($memberDown==5 && $down_info==null)
                            {
                                $content.='<strong>VIP用户8折下载</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                            }
                            elseif ($memberDown==6 && $down_info==null)
                            {
                                $content.='<strong>包年VIP用户免费下载</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                            }
                            elseif ($memberDown==7 && $down_info==null)
                            {
                                $content.='<strong>终身VIP用户免费下载</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                            }
                        }
                        if($memberDown==4 && $userType==FALSE)
                        {
                            $content.='仅对VIP用户开放下载,<a href="'.$erphp_url_front_vip.'">晋级VIP</a><br/>';
                        }
                        else 
                        {
						
                            if($userType && $memberDown > 1)
                            {
                                $msg='<i class="fa fa-download" aria-hidden="true"></i> 下载地址:&nbsp;';
                                if($memberDown==3 || $memberDown==4)
                                {
                                    $msg.='您是VIP用户,能够免费下载此资源!';
                                    $content.=$msg."<a href=".constant("erphpdown").'download.php?postid='.get_the_ID()." target='_blank'>进入下载页面</a>";
                                }
                                elseif ($memberDown==2 && $down_info==null)
                                {
                                    $msg.='您是VIP用户,能够5折(价钱为:'.($price*0.5).get_option('ice_name_alipay').')购置下载此资源!';
                                    $content.=$msg.'<a class=iframe href='.constant("erphpdown").
                                          'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                }
                                elseif ($memberDown==5 && $down_info==null)
                                {
                                    $msg.='您是VIP用户,能够8折(价钱为:'.($price*0.8).get_option('ice_name_alipay').')购置下载此资源!';
                                    $content.=$msg.'<a class=iframe href='.constant("erphpdown").
                                          'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                }
                                elseif ($memberDown==6 && $down_info==null)
                                {
                                    if($userType == 9){
                                        $msg.='您是包年VIP用户,能够免费下载此资源!';
                                        $content.=$msg."<a href=".constant("erphpdown").'download.php?postid='.get_the_ID()." target='_blank'>进入下载页面</a>";
										
                                    }elseif($userType == 10){
                                         $msg.='您是终身VIP用户,能够免费下载此资源!';
                                         $content.=$msg."<a href=".constant("erphpdown").'download.php?postid='.get_the_ID()." target='_blank'>进入下载页面</a>";
										
                                    }else{
                                         $msg.='您是VIP用户,原价购置下载此资源!(年费VIP用户免费)';
                                         $content.=$msg.'<a class=iframe href='.constant("erphpdown").
                                               'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                    }
                            }
                            elseif ($memberDown==7 && $down_info==null)
                            {
                                if($userType == 10){
                                    $msg.='您是终身VIP用户,能够免费下载此资源!';
                                    $content.=$msg."<a href=".constant("erphpdown").'download.php?postid='.get_the_ID()." target='_blank'>进入下载页面</a>";
										
                                }else{
                                    $msg.='您是VIP用户,原价购置下载此资源!(终身VIP用户免费)';
                                    $content.=$msg.'<a class=iframe href='.constant("erphpdown").
                                              'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                }
                            }
                            elseif($down_info)
                            {
                                $ice_url = $wpdb->get_var("SELECT ice_url FROM $wpdb->icealipay where ice_success=1 and ice_user_id=$user_info->ID and ice_post=".get_the_ID());
                                $content.='<i class="fa fa-download" aria-hidden="true"></i> 蝈蝈提示:您已购置过,可直接去下载!<a href='.constant("erphpdown").
                                          'download.php?url='.$ice_url.' target="_blank">进入下载页面</a>';
                            }
                        }
                        else 
                        {
							
                            if($down_info && $down_info->ice_price > 0)
                            {
                                $ice_url = $wpdb->get_var("SELECT ice_url FROM $wpdb->icealipay where ice_success=1 and ice_user_id=$user_info->ID and ice_post=".get_the_ID());
                                $content.='<i class="fa fa-download" aria-hidden="true"></i> 蝈蝈提示:您已购置过,可直接去下载!<a href='.constant("erphpdown").
                                          'download.php?url='.$ice_url.' target="_blank">进入下载页面</a>';
                            }
                            else 
                            {
                                $content.='<i class="fa fa-credit-card" aria-hidden="true"></i>  蝈蝈提示:请购置后再下载资源>>><a class=iframe href='.constant("erphpdown").'icealipay-pay-center.php?postid='.get_the_ID().' target="_blank">立刻购置</a>';
                            }
                        }
                    }
                    $content.='</p>';
                }else{
                    $content.='<p class="down-ordinary"><i class="fa fa-download" aria-hidden="true"></i>  下载地址:&nbsp蝈蝈要安静(blog.quietguoguo.com)>>><a href="'.constant("erphpdown").'download.php?postid='.get_the_ID().'" target="_blank">进入下载页面</a></p>';
                }
				
            }
            else {
                $content.='<p class="down-hidden">躲藏内容:******,购置后可见!</p>';
                $content.='<p class="down-price">下载价钱:<span>'.$price.'</span>&nbsp;'.get_option('ice_name_alipay').'</p>';
                $content.='<p class="down-ordinary">';
                $content.='您需求先<a href="'.$erphp_url_front_login.'" target="_blank" class="erphp-login-must">登录</a>后,才干购置资源</p>';
				
            }
			
           if(get_option('ice_tips')) $content.='<p class="down-tip">'.get_option('ice_tips').'</p>';
               $content.='</div></div>';
			
           }elseif($start_see){
			
               if(is_user_logged_in())
               {
                   global $wpdb;
                   $user_info=wp_get_current_user();
                   $down_info=$wpdb->get_row("select * from ".$wpdb->icealipay." where ice_post='".get_the_ID()."' and ice_success=1 and ice_user_id=".$user_info->ID);
                   if( ($userType && ($memberDown==3 || $memberDown==4)) || ($down_info && $down_info->ice_price > 0) || ($memberDown==6 && $userType >= 9) || ($memberDown==7 && $userType == 10) ){
                       return $content;
                   }else{
				
                       $content2='<div class="erphpdown" id="erphpdown"><div class="down-detail">';
                       $content2.='<h5>内容查看</h5>';
                       if($price){
                           $content2.='<p class="down-price">查看价钱:<span>'.$price.'</span>&nbsp;'.get_option('ice_name_alipay').'</p>';
                       }
                       $content2.='<p class="down-ordinary">';
					
					
                       if($memberDown > 1 && $userType==false)
                       {
                           if($memberDown==3)
                           {
                               $content2.='<strong>VIP用户免费查看</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                           }
                           elseif ($memberDown==2)
                           {
                               $content2.='<strong>VIP用户5折查看</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                           }
                           elseif ($memberDown==5)
                           {
                                $content2.='<strong>VIP用户8折查看</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                           }
                           elseif ($memberDown==6)
                           {
                           $content2.='<strong>包年VIP用户免费查看</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                           }
                           elseif ($memberDown==7)
                           {
                               $content2.='<strong>终身VIP用户免费查看</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                           }
                        }
					
                        if($memberDown==4 && $userType==FALSE)
                        {
                            $content2.='<strong>仅对VIP用户开放查看</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                        }
                        else 
                        {
                            if($userType && $memberDown > 1)
                            {
                                if ($memberDown==2 && $down_info==null)
                                {
                                    $msg.='您是VIP用户,能够5折(价钱为:'.($price*0.5).get_option('ice_name_alipay').')购置查看此内容!';
                                    $content2.=$msg.'<a class=\'iframe\' href='.constant("erphpdown").
                                           'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                }
                                elseif ($memberDown==5 && $down_info==null)
                                {
                                    $msg.='您是VIP用户,能够8折(价钱为:'.($price*0.8).get_option('ice_name_alipay').')购置查看此内容!';
                                    $content2.=$msg.'<a class=\'iframe\'  href='.constant("erphpdown").
                                               'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                }
                                elseif ($memberDown==6 && $down_info==null)
                                {
                                    if($userType < 9){
                                        $msg.='您是VIP用户,原价购置查看此内容!(包年VIP用户免费查看)';
                                        $content2.=$msg.'<a class=\'iframe\'  href='.constant("erphpdown").
                                               'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                    }
                                }
                                elseif ($memberDown==7 && $down_info==null)
                                {
                                    if($userType < 10){
                                        $msg.='您是VIP用户,原价购置查看此内容!(终身VIP用户免费查看)';
                                        $content2.=$msg.'<a class=\'iframe\'  href='.constant("erphpdown").
                                               'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                    }
                                }
                            }
                            else 
                            {
                                if($down_info  && $down_info->ice_price > 0){
			 					
                                }else {
                                    $content2.='<i class="fa fa-eye" aria-hidden="true"></i> 蝈蝈提示:请先购置后查看此躲藏内容!<a class=iframe href='.constant("erphpdown").'icealipay-pay-center.php?postid='.get_the_ID().'>立刻购置</a>';
                                }
                            }
                        }
                    }	
                }else{
                    $content2='<div class="erphpdown" id="erphpdown"><div class="down-detail">';
                    $content2.='<h5>内容查看</h5>';
                    $content2.='<p class="down-price">查看价钱:<span>'.$price.'</span>&nbsp;'.get_option('ice_name_alipay').'</p>';
                    $content2.='<p class="down-ordinary">';
                    $content2.='您需求先<a href="'.$erphp_url_front_login.'" target="_blank" class="erphp-login-must">登录</a>后,才干购置查看内容</p>';
                }
                $content2.='</div></div>';
	        return $content2;
			
            }elseif($start_see2){

                if(is_user_logged_in())
                    {
                        global $wpdb;
                        $user_info=wp_get_current_user();
                        $down_info=$wpdb->get_row("select * from ".$wpdb->icealipay." where ice_post='".get_the_ID()."' and ice_success=1 and ice_user_id=".$user_info->ID);
                        if( (($memberDown==3 || $memberDown==4) && $userType) || ($down_info && $down_info->ice_price > 0) || ($memberDown==6 && $userType >= 9) || ($memberDown==7 && $userType == 10)){
                        //
                        }else{
                            $content.='<div class="erphpdown" id="erphpdown"><div class="down-detail">';
                            $content.='<h5>内容查看</h5>';
                            if($price){
                                $content.='<p class="down-price">查看价钱:<span>'.$price.'</span>&nbsp;'.get_option('ice_name_alipay').'</p>';
                            }
                            $content.='<p class="down-ordinary">';
					
                            if($memberDown > 1 && $userType==false)
                            {
                                if($memberDown==3 && $down_info==null)
                                {
                                    $content.='<strong>VIP用户免费查看躲藏内容</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                                }
                                elseif ($memberDown==2 && $down_info==null)
                                {
                                    $content.='<strong>VIP用户5折查看躲藏内容</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                                }
                                elseif ($memberDown==5 && $down_info==null)
                                {
                                    $content.='<strong>VIP用户8折查看躲藏内容</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                                }
                                elseif ($memberDown==6 && $down_info==null)
                                {
                                    $content.='<strong>包年VIP用户免费查看</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                                }
                                elseif ($memberDown==7 && $down_info==null)
                                {
                                    $content.='<strong>终身VIP用户免费查看</strong>,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                                }
                   }
                   if($memberDown==4 && $userType==FALSE){
                       $content.='仅对VIP用户开放查看躲藏内容,<a href="'.$erphp_url_front_vip.'" target="_blank">晋级VIP</a><br/>';
                   }
                   else 
                   {
						
                       if($userType && $memberDown > 1)
                       {
                           if ($memberDown==2 && $down_info==null)
                           {
                               $msg.='您是VIP用户,能够5折(价钱为:'.($price*0.5).get_option('ice_name_alipay').')购置查看此躲藏内容!';
                               $content.=$msg.'<a class=iframe href='.constant("erphpdown").'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                           }
                           elseif ($memberDown==5 && $down_info==null)
                           {
                               $msg.='您是VIP用户,能够8折(价钱为:'.($price*0.8).get_option('ice_name_alipay').')购置查看此躲藏内容!';
                               $content.=$msg.'<a class=iframe href='.constant("erphpdown").
                                        'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                           }
                           elseif ($memberDown==6 && $down_info==null)
                           {
                               if($userType < 9){
                                    $msg.='您是VIP用户,原价购置查看此躲藏内容!(包年VIP用户免费查看)';
                                    $content.=$msg.'<a class=iframe href='.constant("erphpdown").
                                              'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                               }
                           }
                           elseif ($memberDown==7 && $down_info==null)
                           {
                                if($userType < 10){
                                    $msg.='您是VIP用户,原价购置查看此躲藏内容!(终身VIP用户免费查看)';
                                    $content.=$msg.'<a class=iframe href='.constant("erphpdown").
                                    'icealipay-pay-center.php?postid='.get_the_ID().' target=\'_blank\'>立刻购置</a>';
                                }
                            }
							
                        }
                        else 
                        {
                            $content.='<i class="fa fa-eye" aria-hidden="true"></i> 蝈蝈提示:请先购置后查看此躲藏内容!<a class=iframe href='.constant("erphpdown").'icealipay-pay-center.php?postid='.get_the_ID().' target="_blank">立刻购置</a>';
                        }
                    }
                    $content.='</p>';
                    if(get_option('ice_tips')) $content.='<p class="down-tip">'.get_option('ice_tips').'</p>';
                    $content.='</div></div>';
				
                    }
				
                }
                else {
                $content.='<div class="erphpdown" id="erphpdown"><div class="down-detail">';
                $content.='<h5>内容查看</h5>';
                $content.='<p class="down-price">查看价钱:<span>'.$price.'</span>&nbsp;'.get_option('ice_name_alipay').'</p>';
                $content.='<p class="down-ordinary">';
                $content.='您需求先<a href="'.$erphp_url_front_login.'" target="_blank" class="erphp-login-must">登录</a>后,才干购置查看躲藏内容!</p>';
                if(get_option('ice_tips')) $content.='<p class="down-tip">'.get_option('ice_tips').'</p>';
                $content.='</div></div>';
				
            }

        }
		
    }
	
    return $content;
}
add_action('the_content','erphpdown_content_show');

在这里给大家提供一个修正小技巧,由于文件中很多内容是反复的,大家能够直接CTRL+F查找并交换一下即可。

download.php文件修正

与diy.php文件一样,download.php文件同样位于插件的根目录下,该文件内容主要用于判别用户状态的,不倡议做太多修正,我也仅仅是将文件最下面一些无关紧要的代码做了些简单的修正。

修正前的代码:

foreach ($downList as $k=>$v)
{
    $downMsg.="文件".($k+1)."地址:<a href='download.php?postid=".$postid."&url=".$down_info->ice_url."&key=".($k+1)."' targert='_blank'>点击下载</a><br/>";
}
$hiddens = get_post_meta($pp,'hidden_content',true);
if($hiddens){
    $downMsg .='<br /><p><h3>躲藏信息:</h3></p><p>'.$hiddens.'</p>';
}
showMsg($downMsg);

修正后的代码:

foreach ($downList as $k=>$v)
{
    $downMsg.="<p>文件地址".($k+1).":<a href='download.php?postid=".$postid."&url=".$down_info->ice_url."&key=".($k+1)."' target='_blank'>点击下载</a><br/></p>";
}
$hiddens = get_post_meta($pp,'hidden_content',true);
if($hiddens){
    $downMsg .='<h1 style="text-align: center;">躲藏信息</h1><p>'.$hiddens.'</p>';
}
showMsg($downMsg);

未做太多修正,仅将几个标签交换为本人设置好CSS款式的标签以更好地交融进下载页面。

erphpdown.css文件修正

erphpdown.css文件位于erphpdown插件的static文件夹下,该文件包含一些控制下载页面款式的内容,关于该文件我主要是修正了#erphpdown-download 及 #erphpdown-download h1 的款式,并为其添加了一个p标签的款式以便当对下载页面文本的款式控制。修正完成后的代码如下:

#erphpdown-download{
    margin:16px auto 0;
    font-family:'Microsoft Yahei','Sans-serif';
    font-size:15px;
    color: #868686;
    width: 800px;
    text-indent: 2em;
    min-height: 240px;
    border: 1px solid #aabbcc;
    border-radius:3px;
    padding: 0px 0px 8px;
}

#erphpdown-download h1{
    font-size:18;
    color: #888888;
    font-weight:bold; 
    background-color: #EFEFEF;
    margin:20px 0;
    border-bottom: 0px solid #12b4f0;
    padding: 8px 12px;
    border-left: 8px solid #24b4f0;
    margin:18px 0px;
}

#erphpdown-download p{
    color: #868686; 
    text-indent: 2em;
    padding: 6px 18px 8px;
}

此次对erphpdown下载页面的修正需求改动的文件比拟多,这里给大家提供一下我修正后的这几个文件的下载,大家能够将文件下载下来后做简单修正直接掩盖掉插件目录下的对应文件即可。

资源下载

免费资源本公开载点击下载百度网清点击下载提取码: IQGG复制留意:本站资源多为网络搜集,如触及版权问题请及时与站长联络,我们会在第一时间内与您协商处理。如非特殊阐明,本站一切资源解压密码均为:zibuyu.life。

------本页内容已结束,喜欢请分享------

感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
THE END
喜欢就支持一下吧
点赞14赞赏 分享
评论 共1条
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片
    • 头像及死0