oxviewconfig.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxViewConfig extends oxSuperCfg
00009 {
00015     protected $_oShop = null;
00016 
00022     protected $_aViewData = null;
00023 
00029     protected $_aConfigParams = array();
00030 
00036     protected $_sHelpPageLink = null;
00037 
00043     protected $_oCountryList = null;
00044 
00050     protected $_sActiveTheme = null;
00051 
00057     public function getHomeLink()
00058     {
00059         if ( ( $sValue = $this->getViewConfigParam( 'homeLink' ) ) === null ) {
00060             $myConfig = $this->getConfig();
00061             $myUtils  = oxRegistry::getUtils();
00062             $oLang    = oxRegistry::getLang();
00063             $iLang = $oLang->getBaseLanguage();
00064 
00065             $sValue = null;
00066 
00067             $blAddStartCl = $myUtils->seoIsActive() && ( $iLang != $myConfig->getConfigParam( 'sDefaultLang' ) );
00068 
00069 
00070             if ( $blAddStartCl ) {
00071                 $sValue = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getSelfLink() . 'cl=start', $iLang );
00072                 $sValue = oxRegistry::get("oxUtilsUrl")->appendUrl(
00073                         $sValue,
00074                         oxRegistry::get("oxUtilsUrl")->getBaseAddUrlParams()
00075                     );
00076                 $sValue = getStr()->preg_replace('/(\?|&(amp;)?)$/', '', $sValue);
00077             }
00078 
00079             if ( !$sValue ) {
00080                 $sValue = getStr()->preg_replace('#index.php\??$#', '', $this->getSelfLink());
00081             }
00082 
00083             $this->setViewConfigParam( 'homeLink', $sValue );
00084         }
00085         return $sValue;
00086     }
00087 
00093     public function getActContentLoadId()
00094     {
00095         $sTplName = oxRegistry::getConfig()->getRequestParameter( 'oxloadid' );
00096         // #M1176: Logout from CMS page
00097         if ( !$sTplName && $this->getConfig()->getTopActiveView() ) {
00098             $sTplName = $this->getConfig()->getTopActiveView()->getViewConfig()->getViewConfigParam('oxloadid');
00099         }
00100         return $sTplName ? basename( $sTplName ) : null;
00101     }
00102 
00108     public function getActTplName()
00109     {
00110         return oxRegistry::getConfig()->getRequestParameter( 'tpl' );
00111     }
00112 
00118     public function getActCurrency()
00119     {
00120         return $this->getConfig()->getShopCurrency();
00121     }
00122 
00128     public function getLogoutLink()
00129     {
00130         $sClass         = $this->getTopActionClassName();
00131         $sCatnid        = $this->getActCatId();
00132         $sMnfid         = $this->getActManufacturerId();
00133         $sArtnid        = $this->getActArticleId();
00134         $sTplName       = $this->getActTplName();
00135         $sContentLoadId = $this->getActContentLoadId();
00136         $sSearchParam   = $this->getActSearchParam();
00137         $sSearchTag     = $this->getActSearchTag();
00138         $sRecommId      = $this->getActRecommendationId();
00139         $sListType      = $this->getActListType();
00140 
00141         $oConfig = $this->getConfig();
00142         return ( $oConfig->isSsl()? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl() )
00143             ."cl={$sClass}"
00144             . ( $sCatnid ? "&amp;cnid={$sCatnid}" : '' )
00145             . ( $sArtnid ? "&amp;anid={$sArtnid}" : '' )
00146             . ( $sMnfid ? "&amp;mnid={$sMnfid}" : '' )
00147             . ( $sSearchParam ? "&amp;searchparam={$sSearchParam}" : '' )
00148             . ( $sSearchTag ? "&amp;searchtag={$sSearchTag}" : '' )
00149             . ( $sRecommId ? "&amp;recommid={$sRecommId}" : '' )
00150             . ( $sListType ? "&amp;listtype={$sListType}" : '' )
00151             . "&amp;fnc=logout"
00152             . ( $sTplName ? "&amp;tpl=".basename( $sTplName ) : '' )
00153             . ( $sContentLoadId ? "&amp;oxloadid=" . $sContentLoadId : '' )
00154             . "&amp;redirect=1";
00155     }
00156 
00162     protected function _getHelpContentIdents()
00163     {
00164         $sClass   = $this->getActiveClassName();
00165         return array( 'oxhelp' . strtolower( $sClass ), 'oxhelpdefault' );
00166     }
00167 
00173     public function getHelpPageLink()
00174     {
00175         if ( $this->_sHelpPageLink === null ) {
00176             $sLink    = false;
00177 
00178             $aContentIdents = $this->_getHelpContentIdents();
00179             $oContent = oxNew( "oxContent" );
00180             foreach ( $aContentIdents as $sIdent ) {
00181                 if ( $oContent->loadByIdent( $sIdent ) ) {
00182                     $sLink = $oContent->getLink();
00183                     break;
00184                 }
00185             }
00186 
00187             $this->_sHelpPageLink = $sLink ? $sLink : $this->getHelpLink();
00188         }
00189         return $this->_sHelpPageLink;
00190     }
00191 
00197     public function getHelpLink()
00198     {
00199         $sTplName = $this->getActTplName();
00200         $sClass   = $this->getActiveClassName();
00201         return $this->getConfig()->getShopCurrentURL()."cl=help&amp;page={$sClass}".( $sTplName ? "&amp;tpl={$sTplName}" : '' );
00202     }
00203 
00209     public function getActCatId()
00210     {
00211         return oxRegistry::getConfig()->getRequestParameter( 'cnid' );
00212     }
00213 
00219     public function getActArticleId()
00220     {
00221         return oxRegistry::getConfig()->getRequestParameter( 'anid' );
00222     }
00223 
00229     public function getActSearchParam()
00230     {
00231         return oxRegistry::getConfig()->getRequestParameter( 'searchparam' );
00232     }
00233 
00239     public function getActSearchTag()
00240     {
00241         return oxRegistry::getConfig()->getRequestParameter( 'searchtag' );
00242     }
00243 
00249     public function getActRecommendationId()
00250     {
00251         return oxRegistry::getConfig()->getRequestParameter( 'recommid' );
00252     }
00253 
00259     public function getActListType()
00260     {
00261         return oxRegistry::getConfig()->getRequestParameter( 'listtype' );
00262     }
00263 
00269     public function getActManufacturerId()
00270     {
00271         return oxRegistry::getConfig()->getRequestParameter( 'mnid' );
00272     }
00273 
00279     public function getContentId()
00280     {
00281         return oxRegistry::getConfig()->getRequestParameter( 'oxcid' );
00282     }
00283 
00294     public function setViewConfigParam( $sName, $sValue )
00295     {
00296         startProfile('oxviewconfig::setViewConfigParam');
00297 
00298         $this->_aConfigParams[$sName] = $sValue;
00299 
00300         stopProfile('oxviewconfig::setViewConfigParam');
00301     }
00302 
00310     public function getViewConfigParam( $sName )
00311     {
00312         startProfile('oxviewconfig::getViewConfigParam');
00313 
00314         if ( $this->_oShop && isset( $this->_oShop->$sName ) ) {
00315             $sValue = $this->_oShop->$sName;
00316         } elseif ( $this->_aViewData && isset( $this->_aViewData[ $sName ] ) ) {
00317             $sValue = $this->_aViewData[ $sName ];
00318         } else {
00319             $sValue = ( isset( $this->_aConfigParams[ $sName ] ) ? $this->_aConfigParams[ $sName ] : null );
00320         }
00321 
00322         stopProfile('oxviewconfig::getViewConfigParam');
00323 
00324         return $sValue;
00325     }
00326 
00336     public function setViewShop( $oShop, $aViewData )
00337     {
00338         $this->_oShop     = $oShop;
00339         $this->_aViewData = $aViewData;
00340     }
00341 
00347     public function getSessionId()
00348     {
00349         if ( ( $sValue = $this->getViewConfigParam( 'sessionid' ) ) === null ) {
00350             $sValue = $this->getSession()->getId();
00351             $this->setViewConfigParam( 'sessionid', $sValue );
00352         }
00353         return $sValue;
00354     }
00355 
00361     public function getHiddenSid()
00362     {
00363         if ( ( $sValue = $this->getViewConfigParam( 'hiddensid' ) ) === null ) {
00364             $sValue = $this->getSession()->hiddenSid();
00365 
00366             // appending language info to form
00367             if ( ( $sLang = oxRegistry::getLang()->getFormLang() ) ) {
00368                 $sValue .= "\n{$sLang}";
00369             }
00370 
00371 
00372             $this->setViewConfigParam( 'hiddensid', $sValue );
00373         }
00374         return $sValue;
00375     }
00376 
00382     public function getSelfLink()
00383     {
00384         if ( ( $sValue = $this->getViewConfigParam( 'selflink' ) ) === null ) {
00385             $sValue = $this->getConfig()->getShopHomeURL();
00386             $this->setViewConfigParam( 'selflink', $sValue );
00387         }
00388         return $sValue;
00389     }
00390 
00396     public function getSslSelfLink()
00397     {
00398         if ( $this->isAdmin() ) {
00399             // using getSelfLink() method in admin mode (#2745)
00400             return $this->getSelfLink();
00401         }
00402 
00403         if ( ( $sValue = $this->getViewConfigParam( 'sslselflink' ) ) === null ) {
00404             $sValue = $this->getConfig()->getShopSecureHomeURL();
00405             $this->setViewConfigParam( 'sslselflink', $sValue );
00406         }
00407         return $sValue;
00408     }
00409 
00415     public function getBaseDir()
00416     {
00417         if ( ( $sValue = $this->getViewConfigParam( 'basedir' ) ) === null ) {
00418 
00419             if ( $this->getConfig()->isSsl() ) {
00420                 $sValue = $this->getConfig()->getSSLShopURL();
00421             } else {
00422                 $sValue = $this->getConfig()->getShopURL();
00423             }
00424 
00425             $this->setViewConfigParam( 'basedir', $sValue );
00426         }
00427         return $sValue;
00428     }
00429 
00435     public function getCoreUtilsDir()
00436     {
00437         if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
00438             $sValue = $this->getConfig()->getCoreUtilsURL();
00439             $this->setViewConfigParam( 'coreutilsdir', $sValue );
00440         }
00441         return $sValue;
00442     }
00443 
00449     public function getSelfActionLink()
00450     {
00451         if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
00452             $sValue = $this->getConfig()->getShopCurrentUrl();
00453             $this->setViewConfigParam( 'selfactionlink', $sValue );
00454         }
00455         return $sValue;
00456     }
00457 
00463     public function getCurrentHomeDir()
00464     {
00465         if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
00466             $sValue = $this->getConfig()->getCurrentShopUrl();
00467             $this->setViewConfigParam( 'currenthomedir', $sValue );
00468         }
00469         return $sValue;
00470     }
00471 
00477     public function getBasketLink()
00478     {
00479         if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
00480             $sValue = $this->getConfig()->getShopHomeURL()   . 'cl=basket';
00481             $this->setViewConfigParam( 'basketlink', $sValue );
00482         }
00483         return $sValue;
00484     }
00485 
00491     public function getOrderLink()
00492     {
00493         if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
00494             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00495             $this->setViewConfigParam( 'orderlink', $sValue );
00496         }
00497         return $sValue;
00498     }
00499 
00505     public function getPaymentLink()
00506     {
00507         if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
00508             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00509             $this->setViewConfigParam( 'paymentlink', $sValue );
00510         }
00511         return $sValue;
00512     }
00513 
00519     public function getExeOrderLink()
00520     {
00521         if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
00522             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&amp;fnc=execute';
00523             $this->setViewConfigParam( 'exeorderlink', $sValue );
00524         }
00525         return $sValue;
00526     }
00527 
00533     public function getOrderConfirmLink()
00534     {
00535         if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
00536             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00537             $this->setViewConfigParam( 'orderconfirmlink', $sValue );
00538         }
00539         return $sValue;
00540     }
00541 
00549     public function getResourceUrl( $sFile = null )
00550     {
00551         if ( $sFile ) {
00552             $sValue = $this->getConfig()->getResourceUrl( $sFile, $this->isAdmin() );
00553         } elseif ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00554             $sValue = $this->getConfig()->getResourceUrl( '', $this->isAdmin() );
00555             $this->setViewConfigParam( 'basetpldir', $sValue );
00556         }
00557         return $sValue;
00558     }
00559 
00565     public function getTemplateDir()
00566     {
00567         if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00568             $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00569             $this->setViewConfigParam( 'templatedir', $sValue );
00570         }
00571         return $sValue;
00572     }
00573 
00579     public function getUrlTemplateDir()
00580     {
00581         if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00582             $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00583             $this->setViewConfigParam( 'urltemplatedir', $sValue );
00584         }
00585         return $sValue;
00586     }
00587 
00596     public function getImageUrl( $sFile = null, $bSsl = null )
00597     {
00598         if ($sFile) {
00599            $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl, null, $sFile );
00600         } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00601             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl );
00602             $this->setViewConfigParam( 'imagedir', $sValue );
00603         }
00604         return $sValue;
00605     }
00606 
00612     public function getNoSslImageDir()
00613     {
00614         if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00615             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00616             $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00617         }
00618         return $sValue;
00619     }
00620 
00627     public function getPictureDir()
00628     {
00629         if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00630             $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00631             $this->setViewConfigParam( 'picturedir', $sValue );
00632         }
00633         return $sValue;
00634     }
00635 
00641     public function getAdminDir()
00642     {
00643         if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00644             $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00645             $this->setViewConfigParam( 'sAdminDir', $sValue );
00646         }
00647         return $sValue;
00648     }
00649 
00655     public function getActiveShopId()
00656     {
00657         if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00658             $sValue = $this->getConfig()->getShopId();
00659             $this->setViewConfigParam( 'shopid', $sValue );
00660         }
00661         return $sValue;
00662     }
00663 
00669     public function isSsl()
00670     {
00671         if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00672             $sValue = $this->getConfig()->isSsl();
00673             $this->setViewConfigParam( 'isssl', $sValue );
00674         }
00675         return $sValue;
00676     }
00677 
00678 
00684     public function getRemoteAddress()
00685     {
00686         if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00687             $sValue = oxRegistry::get("oxUtilsServer")->getRemoteAddress();
00688             $this->setViewConfigParam( 'ip', $sValue );
00689         }
00690         return $sValue;
00691     }
00692 
00698     public function getPopupIdent()
00699     {
00700         if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00701             $sValue = md5( $this->getConfig()->getShopUrl() );
00702             $this->setViewConfigParam( 'popupident', $sValue );
00703         }
00704         return $sValue;
00705     }
00706 
00712     public function getPopupIdentRand()
00713     {
00714         if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00715             $sValue = md5( time() );
00716             $this->setViewConfigParam( 'popupidentrand', $sValue );
00717         }
00718         return $sValue;
00719     }
00720 
00726     public function getArtPerPageForm()
00727     {
00728         if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00729             $sValue = $this->getConfig()->getShopCurrentUrl();
00730             $this->setViewConfigParam( 'artperpageform', $sValue );
00731         }
00732         return $sValue;
00733     }
00734 
00740     public function isBuyableParent()
00741     {
00742         return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00743     }
00744 
00750     public function showBirthdayFields()
00751     {
00752         return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00753     }
00754 
00760     public function showFinalStep()
00761     {
00762         return $this->getConfig()->getConfigParam( 'blShowFinalStep' );
00763     }
00764 
00770     public function getNrOfCatArticles()
00771     {
00772         // checking if all needed data is set
00773         switch (oxRegistry::getSession()->getVariable( 'ldtype' )) {
00774             case 'grid':
00775                 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00776                 break;
00777             case 'line':
00778             case 'infogrid':
00779             default:
00780                 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00781         }
00782     }
00783 
00789     public function getShowWishlist()
00790     {
00791         return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00792     }
00793 
00799     public function getShowCompareList()
00800     {
00801         $myConfig = $this->getConfig();
00802         $blShowCompareList = true;
00803 
00804         if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00805             ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00806             $blShowCompareList = false;
00807         }
00808 
00809         return $blShowCompareList;
00810     }
00811 
00817     public function getShowListmania()
00818     {
00819         return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00820     }
00821 
00827     public function getShowVouchers()
00828     {
00829         return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00830     }
00831 
00837     public function getShowGiftWrapping()
00838     {
00839         return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00840     }
00841 
00847     public function getActLanguageId()
00848     {
00849         if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00850             $iLang = oxRegistry::getConfig()->getRequestParameter( 'lang' );
00851             $sValue = ( $iLang !== null ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00852             $this->setViewConfigParam( 'lang', $sValue );
00853         }
00854         return $sValue;
00855     }
00856 
00862     public function getActLanguageAbbr()
00863     {
00864         return oxRegistry::getLang()->getLanguageAbbr( $this->getActLanguageId() );
00865     }
00866 
00872     public function getActiveClassName()
00873     {
00874         return $this->getConfig()->getActiveView()->getClassName();
00875     }
00876 
00883     public function getTopActiveClassName()
00884     {
00885         return $this->getConfig()->getTopActiveView()->getClassName();
00886     }
00887 
00893     public function getArtPerPageCount()
00894     {
00895         return $this->getViewConfigParam( 'iartPerPage' );
00896     }
00897 
00903     public function getNavUrlParams()
00904     {
00905         if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00906             $sParams = '';
00907             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00908             foreach ( $aNavParams as $sName => $sValue ) {
00909                 if ( isset( $sValue ) ) {
00910                     if ( $sParams ) {
00911                         $sParams .= '&amp;';
00912                     }
00913                     $sParams .= "{$sName}=".rawurlencode( $sValue );
00914                 }
00915             }
00916             if ( $sParams ) {
00917                 $sParams = '&amp;'.$sParams;
00918             }
00919             $this->setViewConfigParam( 'navurlparams', $sParams );
00920         }
00921 
00922         return $sParams;
00923     }
00924 
00930     public function getNavFormParams()
00931     {
00932 
00933         if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00934             $oStr = getStr();
00935             $sParams = '';
00936             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00937             foreach ( $aNavParams as $sName => $sValue ) {
00938                 if ( isset( $sValue ) ) {
00939                     $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\" />\n";
00940                 }
00941             }
00942             $this->setViewConfigParam( 'navformparams', $sParams );
00943         }
00944         return $sParams;
00945     }
00946 
00952     public function getStockOnDefaultMessage()
00953     {
00954         return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00955     }
00956 
00962     public function getStockOffDefaultMessage()
00963     {
00964         return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00965     }
00966 
00972     public function getShopVersion()
00973     {
00974         return $this->getViewConfigParam( 'sShopVersion' );
00975     }
00976 
00982     public function getAjaxLink()
00983     {
00984         return $this->getViewConfigParam( 'ajaxlink' );
00985     }
00986 
00992     public function isMultiShop()
00993     {
00994         $oShop = $this->getConfig()->getActiveShop();
00995         return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
00996     }
00997 
01003     public function getServiceUrl()
01004     {
01005         return $this->getViewConfigParam( 'sServiceUrl' );
01006     }
01007 
01014     public function getRemoteAccessToken()
01015     {
01016         $sRaToken = oxRegistry::getSession()->getRemoteAccessToken();
01017 
01018         return $sRaToken;
01019     }
01020 
01027     public function getActionClassName()
01028     {
01029         return $this->getConfig()->getActiveView()->getActionClassName();
01030     }
01031 
01038     public function getTopActionClassName()
01039     {
01040         return $this->getConfig()->getTopActiveView()->getActionClassName();
01041     }
01042 
01048     public function getFbAppId()
01049     {
01050         return $this->getConfig()->getConfigParam( 'sFbAppId' );
01051     }
01052 
01058     public function getShowBasketTimeout()
01059     {
01060         return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
01061             && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
01062     }
01063 
01069     public function getBasketTimeLeft()
01070     {
01071         if (!isset($this->_dBasketTimeLeft)) {
01072             $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
01073         }
01074         return $this->_dBasketTimeLeft;
01075     }
01076 
01083     public function getShowFbConnect()
01084     {
01085         $myConfig = $this->getConfig();
01086 
01087         if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
01088             if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
01089                 return true;
01090             }
01091         }
01092 
01093         return false;
01094     }
01095 
01101     public function getTsDomain()
01102     {
01103         $sDomain = false;
01104         $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01105         if ( is_array( $aTsConfig ) ) {
01106             $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01107         }
01108         return $sDomain;
01109     }
01110 
01116     public function getTsWidgetUrl()
01117     {
01118         $sUrl = false;
01119         if ( $sTsId = $this->getTsId() ) {
01120             $sTsUrl = $this->getTsDomain();
01121 
01122             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01123             $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01124 
01125             if ( $sTsUrl && $sTsWidgetUri ) {
01126                 //$sLocal = $this->getConfig()->getImageDir()."{$sTsId}.gif";
01127                 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01128                 //if ( $sImgName = oxRegistry::getUtils()->getRemoteCachePath( $sUrl, $sLocal ) ) {
01129                 //    $sUrl = $this->getImageUrl().basename( $sImgName );
01130                 //}
01131             }
01132         }
01133 
01134         return $sUrl;
01135     }
01136 
01142     public function getTsInfoUrl()
01143     {
01144         $sUrl = false;
01145         if ( $sTsId = $this->getTsId() ) {
01146             $sTsUrl = $this->getTsDomain();
01147 
01148             $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01149             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01150             $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01151 
01152             if ( $sTsUrl && $sTsInfoUri ) {
01153                 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01154             }
01155         }
01156 
01157         return $sUrl;
01158     }
01159 
01165     public function getTsRatingUrl()
01166     {
01167         $sUrl = false;
01168         if ( $sTsId = $this->getTsId() ) {
01169             $sTsUrl = $this->getTsDomain();
01170 
01171             $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01172             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01173             $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01174 
01175             if ( $sTsUrl && $sTsRateUri ) {
01176                 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01177             }
01178         }
01179 
01180         return $sUrl;
01181     }
01182 
01190     public function showTs( $sType )
01191     {
01192         $blShow = false;
01193         switch ( $sType ) {
01194             case "WIDGET":
01195                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01196                 break;
01197             case "THANKYOU":
01198                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01199                 break;
01200             case "ORDEREMAIL":
01201                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01202                 break;
01203             case "ORDERCONFEMAIL":
01204                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01205                 break;
01206         }
01207         return $blShow;
01208     }
01209 
01215     public function getTsId()
01216     {
01217         $sTsId = false;
01218         $oConfig = $this->getConfig();
01219         $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01220         $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01221 
01222         // mapping with language id
01223         $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01224         if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01225              isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01226            ) {
01227             $sTsId = $aLangIds[$sLangId];
01228         }
01229 
01230         return $sTsId;
01231     }
01232 
01238     public function isTplBlocksDebugMode()
01239     {
01240         return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01241     }
01242 
01248     public function getPasswordLength()
01249     {
01250         $iPasswordLength = 6;
01251 
01252         $oConfig = $this->getConfig();
01253 
01254         if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01255             $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01256         }
01257 
01258         return $iPasswordLength;
01259     }
01260 
01266     public function getCountryList()
01267     {
01268         if ( $this->_oCountryList === null ) {
01269             // passing country list
01270             $this->_oCountryList = oxNew( 'oxcountrylist' );
01271             $this->_oCountryList->loadActiveCountries();
01272         }
01273         return $this->_oCountryList;
01274     }
01275 
01276 
01287     public function getModulePath($sModule, $sFile = '')
01288     {
01289         if (!$sFile || ($sFile[0] != '/')) {
01290             $sFile = '/'.$sFile;
01291         }
01292         $oModule = oxNew("oxmodule");
01293         $sModulePath = $oModule->getModulePath($sModule);
01294         $sFile = $this->getConfig()->getModulesDir().$sModulePath.$sFile;
01295         if (file_exists($sFile) || is_dir($sFile)) {
01296             return $sFile;
01297         } else {
01298             $oEx = oxNew( "oxFileException", "Requested file not found for module $sModule ($sFile)" );
01299             $oEx->debugOut();
01300             if (!$this->getConfig()->getConfigParam( 'iDebug' )) {
01301                 return '';
01302             }
01303             throw $oEx;
01304         }
01305     }
01306 
01317     public function getModuleUrl($sModule, $sFile = '')
01318     {
01319         $sUrl = str_replace(
01320                     rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
01321                     rtrim($this->getConfig()->getCurrentShopUrl( false ), '/'),
01322                     $this->getModulePath($sModule, $sFile)
01323                            );
01324         return $sUrl;
01325     }
01326 
01334     public function getViewThemeParam( $sName )
01335     {
01336         $sValue = false;
01337 
01338         if ($this->getConfig()->isThemeOption( $sName ) ) {
01339             $sValue = $this->getConfig()->getConfigParam( $sName );
01340         }
01341 
01342         return $sValue;
01343     }
01344 
01345 
01351     public function showSelectLists()
01352     {
01353         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01354     }
01355 
01361     public function showSelectListsInList()
01362     {
01363         return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01364     }
01365 
01366 
01367 
01373     public function isAltImageServerConfigured()
01374     {
01375         $oConfig = $this->getConfig();
01376 
01377         return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
01378                $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
01379     }
01380 
01388     public function isFunctionalityEnabled( $sParamName )
01389     {
01390         return (bool) $this->getConfig()->getConfigParam( $sParamName );
01391     }
01392 
01398     public function getActiveTheme()
01399     {
01400         if ( $this->_sActiveTheme === null ) {
01401             $oTheme = oxNew( 'oxTheme' );
01402             $this->_sActiveTheme = $oTheme->getActiveThemeId();
01403         }
01404         return $this->_sActiveTheme;
01405     }
01406 
01407 }