زمان کنونی: ۹-۴-۱۴۰۵, ۰۴:۳۱ عصر درود مهمان گرامی! (ورودثبت نام)


ارسال پاسخ 
 
امتیاز موضوع:
  • 0 رأی - میانگین امتیازات: 0
  • 1
  • 2
  • 3
  • 4
  • 5
مشکل در پلاگین CB Author Plug
۳۰-۱۱-۱۳۹۰, ۰۲:۴۰ صبح
ارسال: #2
RE: مشکل در پلاگین CB Author Plug
کدهای زیر را در فایل cbauthorplug.php کنید و تست کنید !
بک اپ از این فایل فراموش نشود !!!

<?php
/**
* @version SVN: $Id$
* @package    CBAuthorPlug
* @subpackage Base
* @author     Tony Korologos {@link http://www.tkserver.com}
* @author     Created on 10-Sept-2011  updated 11-Sept-11
*/

//-- No direct access
defined('_JEXEC') or die('=;)');


jimport( 'joomla.plugin.plugin' );

jimport( 'joomla.html.parameter' );
        

            

class plgContentCBAuthorPlug extends JPlugin
{
    

    
    function plgContentCBAuthorPlug( &$subject, $params )
    {
        parent::__construct( $subject, $params );
        
            
    }
    
             
    function onPrepareContent( &$article, &$params, $limitstart )
    
    {
    
    }
    
    
function onAfterDisplayTitle( &$article, &$params, $limitstart )
    {
            //$plugin = & JPluginHelper::getPlugin('content', 'cbauthorplug');
            //$pluginParams   = new JParameter( $plugin->params );
            
            //$disablejauthor = $this->params->def('disablejauthor');
            $disablejauthor = $this->params->def('disablejauthor');
            
            
            $exclude_authors = explode(',',$exclude_authors1);
            foreach ($exclude_authors as $id) {
                if ($row->created_by == (int)trim($id)) {
                    return;
                }
            }
            
            
            $exclude_cats = explode(',',$exclude_cats1);
            foreach ($exclude_cats as $id) {
                if ($row->catid == (int)trim($id)) {
                    return;
                }
            }    
                            if ($disablejauthor == "yes" ) {
                            $article->author = "";
                                        
                            }

    }
    
    
public function onContentBeforeDisplay($context, &$row, &$params, $page=0)
    {

        // fix j1.6 media manager bug
        $curoption = JRequest::getVar('option');
        if ($curoption != "com_media"){
        
        $app = JFactory::getApplication();
        $parameter = new JParameter($row->attribs);
        
        $displayposition = $this->params->def('displayposition');
        $mainframe = JFactory::getApplication();
            
        $global_page_show_author = $mainframe->getPageParameters()->get('show_author');
        $article_show_author = $parameter->get('show_author',null);    

    
        if     ($displayposition == 'After'){ return; }

            $exclude_authors1 = $this->params->def('exclude_authors');
            $exclude_cats1 = $this->params->def('exclude_cats');
            $showfrontpage = $this->params->def('showfrontpage');
            $showavatar = $this->params->def('showavatar');
            $avatarwidth = $this->params->def('avatarwidth');
            $avatarmarginleft = $this->params->def('avatarmarginleft');
            $avatarmarginright = $this->params->def('avatarmarginright');
            $avatarfloat = $this->params->def('avatarfloat');
            $introtext = $this->params->def('introtext', '');
            $outrotext = $this->params->def('outrotext', '');
            $showname = $this->params->def('showname', 'name');
            $textfloat = $this->params->def('textfloat');
            $fontsize = $this->params->def('fontsize');
            $textcolor = $this->params->def('textcolor');
            $linkcolor = $this->params->def('linkcolor');
            $disablejauthor = $this->params->def('disablejauthor');
            
                    $exclude_authors = explode(',',$exclude_authors1);
                    foreach ($exclude_authors as $id) {
                        if ($row->created_by == (int)trim($id)) {
                            return;
                        }
                    }
                    
                    
                    $exclude_cats = explode(',',$exclude_cats1);
                    foreach ($exclude_cats as $id) {
                        if ($row->catid == (int)trim($id)) {
                            return;
                        }
                    }        
    
    if ($disablejauthor == "no" ) {
            
            
            $database = &JFactory::getDbo();
            $uri = & JFactory::getURI();
            $sql = "SELECT $showname from #__users where id = '$row->created_by' LIMIT 1";
            $database->setQuery($sql);
            $cbname = $database->loadResult();
            $sql2 = "SELECT avatar FROM #__comprofiler WHERE user_id = '$row->created_by' AND avatarapproved = 1 LIMIT 1";
            $database->setQuery($sql2);
            $avatar = $database->loadResult();    
            $sql4 = "SELECT * FROM #__content_frontpage WHERE content_id = '$row->id' LIMIT 1";
            $database->setQuery($sql4);
            $onfrontpage = $database->loadResult();        
            
            $tn = 'tn';
        
        if(($showfrontpage == 'no') && ($onfrontpage)) { return; }
                
        if($showavatar == 0) {$avatar = '';}
        if(strstr($avatar,'gallery'))
            {
            $tn = '';
            }
    
        $createdbyauthor     = $row->created_by_alias;
        $createdby_id = $row->created_by;
        
        return '<!-- CSS STYLES -->

                <style type="text/css">
                <!--

                div.idcbauthorplug {'. '
                font-size: ' . $fontsize . 'px;
                color: ' . $textcolor . ';
                float: ' . $textfloat . ';
                
                }
                
                div.idcbauthorplug a {'. '
                font-size: ' . $fontsize . 'px;
                color: ' . $linkcolor . ';
                
                }
            
                div.cbauthorplug img {
                border-style: none;
                width: ' . $avatarwidth . 'px;
                margin-right: ' . $avatarmarginright . 'px;
                margin-left: ' . $avatarmarginleft . 'px;
                float: ' . $avatarfloat . ';
            }
            
            --></style>'
            . '<div class="cbauthorplug"><a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id
            . '"><img src="images/comprofiler/' . $tn . $avatar . '"></a><div class="idcbauthorplug">' . $introtext
            . '<a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id . '"> '. $cbname . '</a> ' . $outrotext . '</div></div>';
            
             }
            
             // end if $disablejauthor no
            
    if ($disablejauthor == "yes" ) {
        

        if($article_show_author == "1") {$showcbap = 'yes';}        
        if($article_show_author == "0") {$showcbap = 'no';}
        if($global_page_show_author == "1" && $article_show_author == NULL){$showcbap = 'yes';}
        if($global_page_show_author == "0" && $article_show_author == NULL){$showcbap = 'no';}
                
        if($showcbap == 'yes'){
        $database = &JFactory::getDbo();
        $uri = & JFactory::getURI();
        $sql = "SELECT $showname from #__users where id = '$row->created_by' LIMIT 1";
        $database->setQuery($sql);
        $cbname = $database->loadResult();
        $sql2 = "SELECT avatar FROM #__comprofiler WHERE user_id = '$row->created_by' AND avatarapproved = 1 LIMIT 1";
        $database->setQuery($sql2);
        $avatar = $database->loadResult();    
        $sql3 = "SELECT state FROM #__content WHERE id = '$row->id' LIMIT 1";
        $database->setQuery($sql3);
        $pubstate = $database->loadResult();
        $sql4 = "SELECT * FROM #__content_frontpage WHERE content_id = '$row->id' LIMIT 1";
        $database->setQuery($sql4);
        $onfrontpage = $database->loadResult();    
            
        $tn = 'tn';
                
        if(($showfrontpage == 'no') && ($onfrontpage)) {
        
        return; }
        
                                
        if($showavatar == 0) {$avatar = '';}
        if(strstr($avatar,'gallery'))
            {
            $tn = '';
            }
    
        $createdbyauthor     = $row->created_by_alias;
        $createdby_id = $row->created_by;
        
        return '<!-- CSS STYLES -->

                <style type="text/css">
                <!--

                dd.createdby {display: none;}
                
                div.idcbauthorplug {'. '
                font-size: ' . $fontsize . 'px;
                color: ' . $textcolor . ';
                float: ' . $textfloat . ';
                
                }
                
                div.idcbauthorplug a {'. '
                font-size: ' . $fontsize . 'px;
                color: ' . $linkcolor . ';
                
                }
            
                div.cbauthorplug img {
                border-style: none;
                width: ' . $avatarwidth . 'px;
                margin-right: ' . $avatarmarginright . 'px;
                margin-left: ' . $avatarmarginleft . 'px;
                float: ' . $avatarfloat . ';
            }
            
            --></style>'
            . '<div class="cbauthorplug"><a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id
            . '"><img src="images/comprofiler/' . $tn . $avatar . '"></a><div class="idcbauthorplug">' . $introtext
            . '<a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id . '"> '. $cbname . '</a> ' . $outrotext
            .  '</div></div>';
            }
       }
      
       }  // end if curoption
    }  
  
public function onContentAfterDisplay($context, &$row, &$params, $page=0) {

        // fix j1.6 media manager bug
            $curoption = JRequest::getVar('option');
            if ($curoption != "com_media"){

            $app = JFactory::getApplication();
            $parameter = new JParameter($row->attribs);
            
            $displayposition = $this->params->def('displayposition');
            $mainframe = JFactory::getApplication();
                
            $global_page_show_author = $mainframe->getPageParameters()->get('show_author');
            $article_show_author = $parameter->get('show_author',null);    

            
            //$plugin = & JPluginHelper::getPlugin('content', 'cbauthorplug');
            //$pluginParams   = new JParameter( $plugin->params );
            $displayposition = $this->params->def('displayposition');
        
            if     ($displayposition == 'Before'){ return; }

            $exclude_authors1 = $this->params->def('exclude_authors');
            $exclude_cats1 = $this->params->def('exclude_cats');
            $showfrontpage = $this->params->def('showfrontpage');
            $showavatar = $this->params->def('showavatar');
            $avatarwidth = $this->params->def('avatarwidth');
            $avatarmarginleft = $this->params->def('avatarmarginleft');
            $avatarmarginright = $this->params->def('avatarmarginright');
            $avatarfloat = $this->params->def('avatarfloat');
            $introtext = $this->params->def('introtext', '');
            $outrotext = $this->params->def('outrotext', '');
            $showname = $this->params->def('showname', 'name');
            $textfloat = $this->params->def('textfloat');
            $fontsize = $this->params->def('fontsize');
            $textcolor = $this->params->def('textcolor');
            $linkcolor = $this->params->def('linkcolor');
            $disablejauthor = $this->params->def('disablejauthor');
            
            
            $exclude_authors = explode(',',$exclude_authors1);
            foreach ($exclude_authors as $id) {
                if ($row->created_by == (int)trim($id)) {
                    return;
                }
            }
            
            
            $exclude_cats = explode(',',$exclude_cats1);
            foreach ($exclude_cats as $id) {
                if ($row->catid == (int)trim($id)) {
                    return;
                }
            }    
    
            if ($disablejauthor == "no" ) {
            
        $database = &JFactory::getDbo();
        $uri = & JFactory::getURI();
        $sql = "SELECT $showname from #__users where id = '$row->created_by' LIMIT 1";
        $database->setQuery($sql);
        $cbname = $database->loadResult();
        $sql2 = "SELECT avatar FROM #__comprofiler WHERE user_id = '$row->created_by' AND avatarapproved = 1 LIMIT 1";
        $database->setQuery($sql2);
        $avatar = $database->loadResult();    
        $sql4 = "SELECT * FROM #__content_frontpage WHERE content_id = '$row->id' LIMIT 1";
        $database->setQuery($sql4);
        $onfrontpage = $database->loadResult();        
        
        $tn = 'tn';
        
        if(($showfrontpage == 'no') && ($onfrontpage)) { return; }
                
        if($showavatar == 0) {$avatar = '';}
        if(strstr($avatar,'gallery'))
            {
            $tn = '';
            }
    
        $createdbyauthor     = $row->created_by_alias;
        $createdby_id = $row->created_by;
        
        return '<!-- CSS STYLES -->

                <style type="text/css">
                <!--

                div.idcbauthorplug {'. '
                font-size: ' . $fontsize . 'px;
                color: ' . $textcolor . ';
                float: ' . $textfloat . ';
                
                }
                
                div.idcbauthorplug a {'. '
                font-size: ' . $fontsize . 'px;
                color: ' . $linkcolor . ';
                
                }
            
                div.cbauthorplug img {
                border-style: none;
                width: ' . $avatarwidth . 'px;
                margin-right: ' . $avatarmarginright . 'px;
                margin-left: ' . $avatarmarginleft . 'px;
                float: ' . $avatarfloat . ';
            }
            
            --></style>'
            . '<div class="cbauthorplug"><a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id
            . '"><img src="images/comprofiler/' . $tn . $avatar . '"></a><div class="idcbauthorplug">' . $introtext
            . '<a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id . '"> '. $cbname . '</a> ' . $outrotext . '</div></div>';
            
             }
            
             // end if $disablejauthor no
            
    if ($disablejauthor == "yes" ) {
        

        if($article_show_author == "1") {$showcbap = 'yes';}        
        if($article_show_author == "0") {$showcbap = 'no';}
        if($global_page_show_author == "1" && $article_show_author == NULL){$showcbap = 'yes';}
        if($global_page_show_author == "0" && $article_show_author == NULL){$showcbap = 'no';}
                
        if($showcbap == 'yes'){
        $database = &JFactory::getDbo();
        $uri = & JFactory::getURI();
        $sql = "SELECT $showname from #__users where id = '$row->created_by' LIMIT 1";
        $database->setQuery($sql);
        $cbname = $database->loadResult();
        $sql2 = "SELECT avatar FROM #__comprofiler WHERE user_id = '$row->created_by' AND avatarapproved = 1 LIMIT 1";
        $database->setQuery($sql2);
        $avatar = $database->loadResult();    
        $sql3 = "SELECT state FROM #__content WHERE id = '$row->id' LIMIT 1";
        $database->setQuery($sql3);
        $pubstate = $database->loadResult();
        $sql4 = "SELECT * FROM #__content_frontpage WHERE content_id = '$row->id' LIMIT 1";
        $database->setQuery($sql4);
        $onfrontpage = $database->loadResult();    
            
        $tn = 'tn';
                
        if(($showfrontpage == 'no') && ($onfrontpage)) {
        
        return; }
        
                                
        if($showavatar == 0) {$avatar = '';}
        if(strstr($avatar,'gallery'))
            {
            $tn = '';
            }
    
        $createdbyauthor     = $row->created_by_alias;
        $createdby_id = $row->created_by;
        
        return '<!-- CSS STYLES -->

                <style type="text/css">
                <!--

                dd.createdby {display: none;}
                
                div.idcbauthorplug {'. '
                font-size: ' . $fontsize . 'px;
                color: ' . $textcolor . ';
                float: ' . $textfloat . ';
                
                }
                
                div.idcbauthorplug a {'. '
                font-size: ' . $fontsize . 'px;
                color: ' . $linkcolor . ';
                
                }
            
                div.cbauthorplug img {
                border-style: none;
                width: ' . $avatarwidth . 'px;
                margin-right: ' . $avatarmarginright . 'px;
                margin-left: ' . $avatarmarginleft . 'px;
                float: ' . $avatarfloat . ';
            }
            
            --></style>'
            . '<div class="cbauthorplug"><a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id
            . '"><img src="images/comprofiler/' . $tn . $avatar . '"></a><div class="idcbauthorplug">' . $introtext
            . '<a href="index.php?option=com_comprofiler&task=userProfile&user=' . $createdby_id . '"> '. $cbname . '</a> ' . $outrotext
            .  '</div></div>';
            }
       }
       } // end J1.6 media manager bug
}  

    


}//class
امضاء Reza Ganji
انجمن پارس جوم
مشاهده‌ی وب‌سایت کاربر یافتن تمامی ارسال‌های این کاربر
نقل قول این ارسال در یک پاسخ بازگشت به بالا
 سپاس شده توسط صدرا حسابی ، gamentech ، Pourdaryaei ، شاهین سمیع عادل
ارسال پاسخ 


پیام‌های داخل این موضوع
مشکل در پلاگین CB Author Plug - gamentech - ۲۹-۱۱-۱۳۹۰, ۰۸:۲۳ عصر
RE: مشکل در پلاگین CB Author Plug - Reza Ganji - ۳۰-۱۱-۱۳۹۰ ۰۲:۴۰ صبح
RE: مشکل در پلاگین CB Author Plug - gamentech - ۳۰-۱۱-۱۳۹۰, ۱۰:۰۱ عصر
RE: مشکل در پلاگین CB Author Plug - gamentech - ۳-۱۲-۱۳۹۰, ۰۳:۴۵ صبح
RE: مشکل در پلاگین CB Author Plug - Reza Ganji - ۳-۱۲-۱۳۹۰, ۰۴:۳۴ صبح
RE: مشکل در پلاگین CB Author Plug - gamentech - ۳-۱۲-۱۳۹۰, ۰۷:۳۷ عصر
RE: مشکل در پلاگین CB Author Plug - ehsansabet - ۳-۱۲-۱۳۹۰, ۰۸:۱۲ عصر

پرش به انجمن:


کاربرانِ درحال بازدید از این موضوع: 1 مهمان