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     public function getHomeLink()
00051     {
00052         if ( ( $sValue = $this->getViewConfigParam( 'homeLink' ) ) === null ) {
00053             $myConfig = $this->getConfig();
00054             $myUtils  = oxRegistry::getUtils();
00055             $oLang    = oxRegistry::getLang();
00056             $iLang = $oLang->getBaseLanguage();
00057 
00058             $sValue = null;
00059 
00060             $blAddStartCl = $myUtils->seoIsActive() && ( $iLang != $myConfig->getConfigParam( 'sDefaultLang' ) );
00061 
00062 
00063             if ( $blAddStartCl ) {
00064                 $sValue = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getSelfLink() . 'cl=start', $iLang );
00065                 $sValue = oxRegistry::get("oxUtilsUrl")->appendUrl(
00066                         $sValue,
00067                         oxRegistry::get("oxUtilsUrl")->getBaseAddUrlParams()
00068                     );
00069                 $sValue = getStr()->preg_replace('/(\?|&(amp;)?)$/', '', $sValue);
00070             }
00071 
00072             if ( !$sValue ) {
00073                 $sValue = getStr()->preg_replace('#index.php\??$#', '', $this->getSelfLink());
00074             }
00075 
00076             $this->setViewConfigParam( 'homeLink', $sValue );
00077         }
00078         return $sValue;
00079     }
00080 
00086     public function getActContentLoadId()
00087     {
00088         $sTplName = oxRegistry::getConfig()->getRequestParameter( 'oxloadid' );
00089         // #M1176: Logout from CMS page
00090         if ( !$sTplName && $this->getConfig()->getTopActiveView() ) {
00091             $sTplName = $this->getConfig()->getTopActiveView()->getViewConfig()->getViewConfigParam('oxloadid');
00092         }
00093         return $sTplName ? basename( $sTplName ) : null;
00094     }
00095 
00101     public function getActTplName()
00102     {
00103         return oxRegistry::getConfig()->getRequestParameter( 'tpl' );
00104     }
00105 
00111     public function getActCurrency()
00112     {
00113         return $this->getConfig()->getShopCurrency();
00114     }
00115 
00121     public function getLogoutLink()
00122     {
00123         $sClass         = $this->getTopActionClassName();
00124         $sCatnid        = $this->getActCatId();
00125         $sMnfid         = $this->getActManufacturerId();
00126         $sArtnid        = $this->getActArticleId();
00127         $sTplName       = $this->getActTplName();
00128         $sContentLoadId = $this->getActContentLoadId();
00129         $sSearchParam   = $this->getActSearchParam();
00130         $sSearchTag     = $this->getActSearchTag();
00131         $sRecommId      = $this->getActRecommendationId();
00132         $sListType      = $this->getActListType();
00133 
00134         $oConfig = $this->getConfig();
00135         return ( $oConfig->isSsl()? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl() )
00136             ."cl={$sClass}"
00137             . ( $sCatnid ? "&amp;cnid={$sCatnid}" : '' )
00138             . ( $sArtnid ? "&amp;anid={$sArtnid}" : '' )
00139             . ( $sMnfid ? "&amp;mnid={$sMnfid}" : '' )
00140             . ( $sSearchParam ? "&amp;searchparam={$sSearchParam}" : '' )
00141             . ( $sSearchTag ? "&amp;searchtag={$sSearchTag}" : '' )
00142             . ( $sRecommId ? "&amp;recommid={$sRecommId}" : '' )
00143             . ( $sListType ? "&amp;listtype={$sListType}" : '' )
00144             . "&amp;fnc=logout"
00145             . ( $sTplName ? "&amp;tpl=".basename( $sTplName ) : '' )
00146             . ( $sContentLoadId ? "&amp;oxloadid=" . $sContentLoadId : '' )
00147             . "&amp;redirect=1";
00148     }
00149 
00155     protected function _getHelpContentIdents()
00156     {
00157         $sClass   = $this->getActiveClassName();
00158         return array( 'oxhelp' . strtolower( $sClass ), 'oxhelpdefault' );
00159     }
00160 
00166     public function getHelpPageLink()
00167     {
00168         if ( $this->_sHelpPageLink === null ) {
00169             $sLink    = false;
00170 
00171             $aContentIdents = $this->_getHelpContentIdents();
00172             $oContent = oxNew( "oxContent" );
00173             foreach ( $aContentIdents as $sIdent ) {
00174                 if ( $oContent->loadByIdent( $sIdent ) ) {
00175                     $sLink = $oContent->getLink();
00176                     break;
00177                 }
00178             }
00179 
00180             $this->_sHelpPageLink = $sLink ? $sLink : $this->getHelpLink();
00181         }
00182         return $this->_sHelpPageLink;
00183     }
00184 
00190     public function getHelpLink()
00191     {
00192         $sTplName = $this->getActTplName();
00193         $sClass   = $this->getActiveClassName();
00194         return $this->getConfig()->getShopCurrentURL()."cl=help&amp;page={$sClass}".( $sTplName ? "&amp;tpl={$sTplName}" : '' );
00195     }
00196 
00202     public function getActCatId()
00203     {
00204         return oxRegistry::getConfig()->getRequestParameter( 'cnid' );
00205     }
00206 
00212     public function getActArticleId()
00213     {
00214         return oxRegistry::getConfig()->getRequestParameter( 'anid' );
00215     }
00216 
00222     public function getActSearchParam()
00223     {
00224         return oxRegistry::getConfig()->getRequestParameter( 'searchparam' );
00225     }
00226 
00232     public function getActSearchTag()
00233     {
00234         return oxRegistry::getConfig()->getRequestParameter( 'searchtag' );
00235     }
00236 
00242     public function getActRecommendationId()
00243     {
00244         return oxRegistry::getConfig()->getRequestParameter( 'recommid' );
00245     }
00246 
00252     public function getActListType()
00253     {
00254         return oxRegistry::getConfig()->getRequestParameter( 'listtype' );
00255     }
00256 
00262     public function getActManufacturerId()
00263     {
00264         return oxRegistry::getConfig()->getRequestParameter( 'mnid' );
00265     }
00266 
00272     public function getContentId()
00273     {
00274         return oxRegistry::getConfig()->getRequestParameter( 'oxcid' );
00275     }
00276 
00287     public function setViewConfigParam( $sName, $sValue )
00288     {
00289         startProfile('oxviewconfig::setViewConfigParam');
00290 
00291         $this->_aConfigParams[$sName] = $sValue;
00292 
00293         stopProfile('oxviewconfig::setViewConfigParam');
00294     }
00295 
00303     public function getViewConfigParam( $sName )
00304     {
00305         startProfile('oxviewconfig::getViewConfigParam');
00306 
00307         if ( $this->_oShop && isset( $this->_oShop->$sName ) ) {
00308             $sValue = $this->_oShop->$sName;
00309         } elseif ( $this->_aViewData && isset( $this->_aViewData[ $sName ] ) ) {
00310             $sValue = $this->_aViewData[ $sName ];
00311         } else {
00312             $sValue = ( isset( $this->_aConfigParams[ $sName ] ) ? $this->_aConfigParams[ $sName ] : null );
00313         }
00314 
00315         stopProfile('oxviewconfig::getViewConfigParam');
00316 
00317         return $sValue;
00318     }
00319 
00329     public function setViewShop( $oShop, $aViewData )
00330     {
00331         $this->_oShop     = $oShop;
00332         $this->_aViewData = $aViewData;
00333     }
00334 
00340     public function getSessionId()
00341     {
00342         if ( ( $sValue = $this->getViewConfigParam( 'sessionid' ) ) === null ) {
00343             $sValue = $this->getSession()->getId();
00344             $this->setViewConfigParam( 'sessionid', $sValue );
00345         }
00346         return $sValue;
00347     }
00348 
00354     public function getHiddenSid()
00355     {
00356         if ( ( $sValue = $this->getViewConfigParam( 'hiddensid' ) ) === null ) {
00357             $sValue = $this->getSession()->hiddenSid();
00358 
00359             // appending language info to form
00360             if ( ( $sLang = oxRegistry::getLang()->getFormLang() ) ) {
00361                 $sValue .= "\n{$sLang}";
00362             }
00363 
00364 
00365             $this->setViewConfigParam( 'hiddensid', $sValue );
00366         }
00367         return $sValue;
00368     }
00369 
00375     public function getSelfLink()
00376     {
00377         if ( ( $sValue = $this->getViewConfigParam( 'selflink' ) ) === null ) {
00378             $sValue = $this->getConfig()->getShopHomeURL();
00379             $this->setViewConfigParam( 'selflink', $sValue );
00380         }
00381         return $sValue;
00382     }
00383 
00389     public function getSslSelfLink()
00390     {
00391         if ( $this->isAdmin() ) {
00392             // using getSelfLink() method in admin mode (#2745)
00393             return $this->getSelfLink();
00394         }
00395 
00396         if ( ( $sValue = $this->getViewConfigParam( 'sslselflink' ) ) === null ) {
00397             $sValue = $this->getConfig()->getShopSecureHomeURL();
00398             $this->setViewConfigParam( 'sslselflink', $sValue );
00399         }
00400         return $sValue;
00401     }
00402 
00408     public function getBaseDir()
00409     {
00410         if ( ( $sValue = $this->getViewConfigParam( 'basedir' ) ) === null ) {
00411 
00412             if ( $this->getConfig()->isSsl() ) {
00413                 $sValue = $this->getConfig()->getSSLShopURL();
00414             } else {
00415                 $sValue = $this->getConfig()->getShopURL();
00416             }
00417 
00418             $this->setViewConfigParam( 'basedir', $sValue );
00419         }
00420         return $sValue;
00421     }
00422 
00428     public function getCoreUtilsDir()
00429     {
00430         if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
00431             $sValue = $this->getConfig()->getCoreUtilsURL();
00432             $this->setViewConfigParam( 'coreutilsdir', $sValue );
00433         }
00434         return $sValue;
00435     }
00436 
00442     public function getSelfActionLink()
00443     {
00444         if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
00445             $sValue = $this->getConfig()->getShopCurrentUrl();
00446             $this->setViewConfigParam( 'selfactionlink', $sValue );
00447         }
00448         return $sValue;
00449     }
00450 
00456     public function getCurrentHomeDir()
00457     {
00458         if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
00459             $sValue = $this->getConfig()->getCurrentShopUrl();
00460             $this->setViewConfigParam( 'currenthomedir', $sValue );
00461         }
00462         return $sValue;
00463     }
00464 
00470     public function getBasketLink()
00471     {
00472         if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
00473             $sValue = $this->getConfig()->getShopHomeURL()   . 'cl=basket';
00474             $this->setViewConfigParam( 'basketlink', $sValue );
00475         }
00476         return $sValue;
00477     }
00478 
00484     public function getOrderLink()
00485     {
00486         if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
00487             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
00488             $this->setViewConfigParam( 'orderlink', $sValue );
00489         }
00490         return $sValue;
00491     }
00492 
00498     public function getPaymentLink()
00499     {
00500         if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
00501             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
00502             $this->setViewConfigParam( 'paymentlink', $sValue );
00503         }
00504         return $sValue;
00505     }
00506 
00512     public function getExeOrderLink()
00513     {
00514         if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
00515             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&amp;fnc=execute';
00516             $this->setViewConfigParam( 'exeorderlink', $sValue );
00517         }
00518         return $sValue;
00519     }
00520 
00526     public function getOrderConfirmLink()
00527     {
00528         if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
00529             $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
00530             $this->setViewConfigParam( 'orderconfirmlink', $sValue );
00531         }
00532         return $sValue;
00533     }
00534 
00542     public function getResourceUrl( $sFile = null )
00543     {
00544         if ( $sFile ) {
00545             $sValue = $this->getConfig()->getResourceUrl( $sFile, $this->isAdmin() );
00546         } elseif ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00547             $sValue = $this->getConfig()->getResourceUrl( '', $this->isAdmin() );
00548             $this->setViewConfigParam( 'basetpldir', $sValue );
00549         }
00550         return $sValue;
00551     }
00552 
00558     public function getTemplateDir()
00559     {
00560         if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00561             $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00562             $this->setViewConfigParam( 'templatedir', $sValue );
00563         }
00564         return $sValue;
00565     }
00566 
00572     public function getUrlTemplateDir()
00573     {
00574         if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00575             $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00576             $this->setViewConfigParam( 'urltemplatedir', $sValue );
00577         }
00578         return $sValue;
00579     }
00580 
00589     public function getImageUrl( $sFile = null, $bSsl = null )
00590     {
00591         if ($sFile) {
00592            $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl, null, $sFile );
00593         } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00594             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl );
00595             $this->setViewConfigParam( 'imagedir', $sValue );
00596         }
00597         return $sValue;
00598     }
00599 
00605     public function getNoSslImageDir()
00606     {
00607         if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00608             $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00609             $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00610         }
00611         return $sValue;
00612     }
00613 
00620     public function getPictureDir()
00621     {
00622         if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00623             $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00624             $this->setViewConfigParam( 'picturedir', $sValue );
00625         }
00626         return $sValue;
00627     }
00628 
00634     public function getAdminDir()
00635     {
00636         if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00637             $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00638             $this->setViewConfigParam( 'sAdminDir', $sValue );
00639         }
00640         return $sValue;
00641     }
00642 
00648     public function getActiveShopId()
00649     {
00650         if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00651             $sValue = $this->getConfig()->getShopId();
00652             $this->setViewConfigParam( 'shopid', $sValue );
00653         }
00654         return $sValue;
00655     }
00656 
00662     public function isSsl()
00663     {
00664         if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00665             $sValue = $this->getConfig()->isSsl();
00666             $this->setViewConfigParam( 'isssl', $sValue );
00667         }
00668         return $sValue;
00669     }
00670 
00671 
00677     public function getRemoteAddress()
00678     {
00679         if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00680             $sValue = oxRegistry::get("oxUtilsServer")->getRemoteAddress();
00681             $this->setViewConfigParam( 'ip', $sValue );
00682         }
00683         return $sValue;
00684     }
00685 
00691     public function getPopupIdent()
00692     {
00693         if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00694             $sValue = md5( $this->getConfig()->getShopUrl() );
00695             $this->setViewConfigParam( 'popupident', $sValue );
00696         }
00697         return $sValue;
00698     }
00699 
00705     public function getPopupIdentRand()
00706     {
00707         if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00708             $sValue = md5( time() );
00709             $this->setViewConfigParam( 'popupidentrand', $sValue );
00710         }
00711         return $sValue;
00712     }
00713 
00719     public function getArtPerPageForm()
00720     {
00721         if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00722             $sValue = $this->getConfig()->getShopCurrentUrl();
00723             $this->setViewConfigParam( 'artperpageform', $sValue );
00724         }
00725         return $sValue;
00726     }
00727 
00733     public function isBuyableParent()
00734     {
00735         return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00736     }
00737 
00743     public function showBirthdayFields()
00744     {
00745         return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00746     }
00747 
00753     public function showFinalStep()
00754     {
00755         return $this->getConfig()->getConfigParam( 'blShowFinalStep' );
00756     }
00757 
00763     public function getNrOfCatArticles()
00764     {
00765         // checking if all needed data is set
00766         switch (oxRegistry::getSession()->getVariable( 'ldtype' )) {
00767             case 'grid':
00768                 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00769                 break;
00770             case 'line':
00771             case 'infogrid':
00772             default:
00773                 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00774         }
00775     }
00776 
00782     public function getShowWishlist()
00783     {
00784         return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00785     }
00786 
00792     public function getShowCompareList()
00793     {
00794         $myConfig = $this->getConfig();
00795         $blShowCompareList = true;
00796 
00797         if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00798             ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00799             $blShowCompareList = false;
00800         }
00801 
00802         return $blShowCompareList;
00803     }
00804 
00810     public function getShowListmania()
00811     {
00812         return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00813     }
00814 
00820     public function getShowVouchers()
00821     {
00822         return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00823     }
00824 
00830     public function getShowGiftWrapping()
00831     {
00832         return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00833     }
00834 
00840     public function getActLanguageId()
00841     {
00842         if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00843             $iLang = oxRegistry::getConfig()->getRequestParameter( 'lang' );
00844             $sValue = ( $iLang !== null ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00845             $this->setViewConfigParam( 'lang', $sValue );
00846         }
00847         return $sValue;
00848     }
00849 
00855     public function getActLanguageAbbr()
00856     {
00857         return oxRegistry::getLang()->getLanguageAbbr( $this->getActLanguageId() );
00858     }
00859 
00865     public function getActiveClassName()
00866     {
00867         return $this->getConfig()->getActiveView()->getClassName();
00868     }
00869 
00876     public function getTopActiveClassName()
00877     {
00878         return $this->getConfig()->getTopActiveView()->getClassName();
00879     }
00880 
00886     public function getArtPerPageCount()
00887     {
00888         return $this->getViewConfigParam( 'iartPerPage' );
00889     }
00890 
00896     public function getNavUrlParams()
00897     {
00898         if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00899             $sParams = '';
00900             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00901             foreach ( $aNavParams as $sName => $sValue ) {
00902                 if ( isset( $sValue ) ) {
00903                     if ( $sParams ) {
00904                         $sParams .= '&amp;';
00905                     }
00906                     $sParams .= "{$sName}=".rawurlencode( $sValue );
00907                 }
00908             }
00909             if ( $sParams ) {
00910                 $sParams = '&amp;'.$sParams;
00911             }
00912             $this->setViewConfigParam( 'navurlparams', $sParams );
00913         }
00914 
00915         return $sParams;
00916     }
00917 
00923     public function getNavFormParams()
00924     {
00925 
00926         if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00927             $oStr = getStr();
00928             $sParams = '';
00929             $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00930             foreach ( $aNavParams as $sName => $sValue ) {
00931                 if ( isset( $sValue ) ) {
00932                     $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\" />\n";
00933                 }
00934             }
00935             $this->setViewConfigParam( 'navformparams', $sParams );
00936         }
00937         return $sParams;
00938     }
00939 
00945     public function getStockOnDefaultMessage()
00946     {
00947         return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00948     }
00949 
00955     public function getStockOffDefaultMessage()
00956     {
00957         return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00958     }
00959 
00965     public function getShopVersion()
00966     {
00967         return $this->getViewConfigParam( 'sShopVersion' );
00968     }
00969 
00975     public function getAjaxLink()
00976     {
00977         return $this->getViewConfigParam( 'ajaxlink' );
00978     }
00979 
00985     public function isMultiShop()
00986     {
00987         $oShop = $this->getConfig()->getActiveShop();
00988         return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
00989     }
00990 
00996     public function getServiceUrl()
00997     {
00998         return $this->getViewConfigParam( 'sServiceUrl' );
00999     }
01000 
01007     public function getRemoteAccessToken()
01008     {
01009         $sRaToken = oxRegistry::getSession()->getRemoteAccessToken();
01010 
01011         return $sRaToken;
01012     }
01013 
01020     public function getActionClassName()
01021     {
01022         return $this->getConfig()->getActiveView()->getActionClassName();
01023     }
01024 
01031     public function getTopActionClassName()
01032     {
01033         return $this->getConfig()->getTopActiveView()->getActionClassName();
01034     }
01035 
01041     public function getFbAppId()
01042     {
01043         return $this->getConfig()->getConfigParam( 'sFbAppId' );
01044     }
01045 
01051     public function getShowBasketTimeout()
01052     {
01053         return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
01054             && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
01055     }
01056 
01062     public function getBasketTimeLeft()
01063     {
01064         if (!isset($this->_dBasketTimeLeft)) {
01065             $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
01066         }
01067         return $this->_dBasketTimeLeft;
01068     }
01069 
01076     public function getShowFbConnect()
01077     {
01078         $myConfig = $this->getConfig();
01079 
01080         if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
01081             if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
01082                 return true;
01083             }
01084         }
01085 
01086         return false;
01087     }
01088 
01094     public function getTsDomain()
01095     {
01096         $sDomain = false;
01097         $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01098         if ( is_array( $aTsConfig ) ) {
01099             $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01100         }
01101         return $sDomain;
01102     }
01103 
01109     public function getTsWidgetUrl()
01110     {
01111         $sUrl = false;
01112         if ( $sTsId = $this->getTsId() ) {
01113             $sTsUrl = $this->getTsDomain();
01114 
01115             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01116             $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01117 
01118             if ( $sTsUrl && $sTsWidgetUri ) {
01119                 //$sLocal = $this->getConfig()->getImageDir()."{$sTsId}.gif";
01120                 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01121                 //if ( $sImgName = oxRegistry::getUtils()->getRemoteCachePath( $sUrl, $sLocal ) ) {
01122                 //    $sUrl = $this->getImageUrl().basename( $sImgName );
01123                 //}
01124             }
01125         }
01126 
01127         return $sUrl;
01128     }
01129 
01135     public function getTsInfoUrl()
01136     {
01137         $sUrl = false;
01138         if ( $sTsId = $this->getTsId() ) {
01139             $sTsUrl = $this->getTsDomain();
01140 
01141             $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01142             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01143             $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01144 
01145             if ( $sTsUrl && $sTsInfoUri ) {
01146                 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01147             }
01148         }
01149 
01150         return $sUrl;
01151     }
01152 
01158     public function getTsRatingUrl()
01159     {
01160         $sUrl = false;
01161         if ( $sTsId = $this->getTsId() ) {
01162             $sTsUrl = $this->getTsDomain();
01163 
01164             $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01165             $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01166             $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01167 
01168             if ( $sTsUrl && $sTsRateUri ) {
01169                 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01170             }
01171         }
01172 
01173         return $sUrl;
01174     }
01175 
01183     public function showTs( $sType )
01184     {
01185         $blShow = false;
01186         switch ( $sType ) {
01187             case "WIDGET":
01188                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01189                 break;
01190             case "THANKYOU":
01191                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01192                 break;
01193             case "ORDEREMAIL":
01194                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01195                 break;
01196             case "ORDERCONFEMAIL":
01197                 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01198                 break;
01199         }
01200         return $blShow;
01201     }
01202 
01208     public function getTsId()
01209     {
01210         $sTsId = false;
01211         $oConfig = $this->getConfig();
01212         $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01213         $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01214 
01215         // mapping with language id
01216         $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01217         if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01218              isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01219            ) {
01220             $sTsId = $aLangIds[$sLangId];
01221         }
01222 
01223         return $sTsId;
01224     }
01225 
01231     public function isTplBlocksDebugMode()
01232     {
01233         return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01234     }
01235 
01241     public function getPasswordLength()
01242     {
01243         $iPasswordLength = 6;
01244 
01245         $oConfig = $this->getConfig();
01246 
01247         if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01248             $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01249         }
01250 
01251         return $iPasswordLength;
01252     }
01253 
01259     public function getCountryList()
01260     {
01261         if ( $this->_oCountryList === null ) {
01262             // passing country list
01263             $this->_oCountryList = oxNew( 'oxcountrylist' );
01264             $this->_oCountryList->loadActiveCountries();
01265         }
01266         return $this->_oCountryList;
01267     }
01268 
01269 
01280     public function getModulePath($sModule, $sFile = '')
01281     {
01282         if (!$sFile || ($sFile[0] != '/')) {
01283             $sFile = '/'.$sFile;
01284         }
01285         $oModule = oxNew("oxmodule");
01286         $sModulePath = $oModule->getModulePath($sModule);
01287         $sFile = $this->getConfig()->getModulesDir().$sModulePath.$sFile;
01288         if (file_exists($sFile) || is_dir($sFile)) {
01289             return $sFile;
01290         } else {
01291             $oEx = oxNew( "oxFileException", "Requested file not found for module $sModule ($sFile)" );
01292             $oEx->debugOut();
01293             if (!$this->getConfig()->getConfigParam( 'iDebug' )) {
01294                 return '';
01295             }
01296             throw $oEx;
01297         }
01298     }
01299 
01310     public function getModuleUrl($sModule, $sFile = '')
01311     {
01312         $sUrl = str_replace(
01313                     rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
01314                     rtrim($this->getConfig()->getCurrentShopUrl( false ), '/'),
01315                     $this->getModulePath($sModule, $sFile)
01316                            );
01317         return $sUrl;
01318     }
01319 
01327     public function getViewThemeParam( $sName )
01328     {
01329         $sValue = false;
01330 
01331         if ($this->getConfig()->isThemeOption( $sName ) ) {
01332             $sValue = $this->getConfig()->getConfigParam( $sName );
01333         }
01334 
01335         return $sValue;
01336     }
01337 
01338 
01344     public function showSelectLists()
01345     {
01346         return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01347     }
01348 
01354     public function showSelectListsInList()
01355     {
01356         return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01357     }
01358 
01359 
01360 
01366     public function isAltImageServerConfigured()
01367     {
01368         $oConfig = $this->getConfig();
01369 
01370         return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
01371                $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
01372     }
01373 
01381     public function isFunctionalityEnabled( $sParamName )
01382     {
01383         return (bool) $this->getConfig()->getConfigParam( $sParamName );
01384     }
01385 
01386 }