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 = oxConfig::getParameter( 'oxloadid' );
00089
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 oxConfig::getParameter( '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
00135 return $this->getConfig()->getShopHomeURL()
00136 ."cl={$sClass}"
00137 . ( $sCatnid ? "&cnid={$sCatnid}" : '' )
00138 . ( $sArtnid ? "&anid={$sArtnid}" : '' )
00139 . ( $sMnfid ? "&mnid={$sMnfid}" : '' )
00140 . ( $sSearchParam ? "&searchparam={$sSearchParam}" : '' )
00141 . ( $sSearchTag ? "&searchtag={$sSearchTag}" : '' )
00142 . ( $sRecommId ? "&recommid={$sRecommId}" : '' )
00143 . ( $sListType ? "&listtype={$sListType}" : '' )
00144 . "&fnc=logout"
00145 . ( $sTplName ? "&tpl=".basename( $sTplName ) : '' )
00146 . ( $sContentLoadId ? "&oxloadid=" . $sContentLoadId : '' )
00147 . "&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&page={$sClass}".( $sTplName ? "&tpl={$sTplName}" : '' );
00195 }
00196
00202 public function getActCatId()
00203 {
00204 return oxConfig::getParameter( 'cnid' );
00205 }
00206
00212 public function getActArticleId()
00213 {
00214 return oxConfig::getParameter( 'anid' );
00215 }
00216
00222 public function getActSearchParam()
00223 {
00224 return oxConfig::getParameter( 'searchparam' );
00225 }
00226
00232 public function getActSearchTag()
00233 {
00234 return oxConfig::getParameter( 'searchtag' );
00235 }
00236
00242 public function getActRecommendationId()
00243 {
00244 return oxConfig::getParameter( 'recommid' );
00245 }
00246
00252 public function getActListType()
00253 {
00254 return oxConfig::getParameter( 'listtype' );
00255 }
00256
00262 public function getActManufacturerId()
00263 {
00264 return oxConfig::getParameter( 'mnid' );
00265 }
00266
00272 public function getContentId()
00273 {
00274 return oxConfig::getParameter( '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
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
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&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 ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
00545 $sValue = $this->getConfig()->getResourceUrl( $sFile, $this->isAdmin() );
00546 $this->setViewConfigParam( 'basetpldir', $sValue );
00547 }
00548 return $sValue;
00549 }
00550
00556 public function getTemplateDir()
00557 {
00558 if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
00559 $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
00560 $this->setViewConfigParam( 'templatedir', $sValue );
00561 }
00562 return $sValue;
00563 }
00564
00570 public function getUrlTemplateDir()
00571 {
00572 if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
00573 $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
00574 $this->setViewConfigParam( 'urltemplatedir', $sValue );
00575 }
00576 return $sValue;
00577 }
00578
00587 public function getImageUrl( $sFile = null, $bSsl = null )
00588 {
00589 if ($sFile) {
00590 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl, null, $sFile );
00591 } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
00592 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl );
00593 $this->setViewConfigParam( 'imagedir', $sValue );
00594 }
00595 return $sValue;
00596 }
00597
00603 public function getNoSslImageDir()
00604 {
00605 if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
00606 $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
00607 $this->setViewConfigParam( 'nossl_imagedir', $sValue );
00608 }
00609 return $sValue;
00610 }
00611
00618 public function getPictureDir()
00619 {
00620 if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
00621 $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
00622 $this->setViewConfigParam( 'picturedir', $sValue );
00623 }
00624 return $sValue;
00625 }
00626
00632 public function getAdminDir()
00633 {
00634 if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
00635 $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
00636 $this->setViewConfigParam( 'sAdminDir', $sValue );
00637 }
00638 return $sValue;
00639 }
00640
00646 public function getActiveShopId()
00647 {
00648 if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
00649 $sValue = $this->getConfig()->getShopId();
00650 $this->setViewConfigParam( 'shopid', $sValue );
00651 }
00652 return $sValue;
00653 }
00654
00660 public function isSsl()
00661 {
00662 if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
00663 $sValue = $this->getConfig()->isSsl();
00664 $this->setViewConfigParam( 'isssl', $sValue );
00665 }
00666 return $sValue;
00667 }
00668
00669
00675 public function getRemoteAddress()
00676 {
00677 if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
00678 $sValue = oxRegistry::get("oxUtilsServer")->getRemoteAddress();
00679 $this->setViewConfigParam( 'ip', $sValue );
00680 }
00681 return $sValue;
00682 }
00683
00689 public function getPopupIdent()
00690 {
00691 if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
00692 $sValue = md5( $this->getConfig()->getShopUrl() );
00693 $this->setViewConfigParam( 'popupident', $sValue );
00694 }
00695 return $sValue;
00696 }
00697
00703 public function getPopupIdentRand()
00704 {
00705 if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
00706 $sValue = md5( time() );
00707 $this->setViewConfigParam( 'popupidentrand', $sValue );
00708 }
00709 return $sValue;
00710 }
00711
00717 public function getArtPerPageForm()
00718 {
00719 if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
00720 $sValue = $this->getConfig()->getShopCurrentUrl();
00721 $this->setViewConfigParam( 'artperpageform', $sValue );
00722 }
00723 return $sValue;
00724 }
00725
00731 public function isBuyableParent()
00732 {
00733 return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
00734 }
00735
00741 public function showBirthdayFields()
00742 {
00743 return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
00744 }
00745
00751 public function showFinalStep()
00752 {
00753 return $this->getConfig()->getConfigParam( 'blShowFinalStep' );
00754 }
00755
00761 public function getNrOfCatArticles()
00762 {
00763
00764 switch (oxSession::getVar( 'ldtype' )) {
00765 case 'grid':
00766 return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
00767 break;
00768 case 'line':
00769 case 'infogrid':
00770 default:
00771 return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
00772 }
00773 }
00774
00780 public function getShowWishlist()
00781 {
00782 return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
00783 }
00784
00790 public function getShowCompareList()
00791 {
00792 $myConfig = $this->getConfig();
00793 $blShowCompareList = true;
00794
00795 if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
00796 ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
00797 $blShowCompareList = false;
00798 }
00799
00800 return $blShowCompareList;
00801 }
00802
00808 public function getShowListmania()
00809 {
00810 return $this->getConfig()->getConfigParam( 'bl_showListmania' );
00811 }
00812
00818 public function getShowVouchers()
00819 {
00820 return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
00821 }
00822
00828 public function getShowGiftWrapping()
00829 {
00830 return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
00831 }
00832
00838 public function getActLanguageId()
00839 {
00840 if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
00841 $iLang = oxConfig::getParameter( 'lang' );
00842 $sValue = ( $iLang !== null ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
00843 $this->setViewConfigParam( 'lang', $sValue );
00844 }
00845 return $sValue;
00846 }
00847
00853 public function getActLanguageAbbr()
00854 {
00855 return oxRegistry::getLang()->getLanguageAbbr( $this->getActLanguageId() );
00856 }
00857
00863 public function getActiveClassName()
00864 {
00865 return $this->getConfig()->getActiveView()->getClassName();
00866 }
00867
00874 public function getTopActiveClassName()
00875 {
00876 return $this->getConfig()->getTopActiveView()->getClassName();
00877 }
00878
00884 public function getArtPerPageCount()
00885 {
00886 return $this->getViewConfigParam( 'iartPerPage' );
00887 }
00888
00894 public function getNavUrlParams()
00895 {
00896 if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
00897 $sParams = '';
00898 $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00899 foreach ( $aNavParams as $sName => $sValue ) {
00900 if ( isset( $sValue ) ) {
00901 if ( $sParams ) {
00902 $sParams .= '&';
00903 }
00904 $sParams .= "{$sName}=".rawurlencode( $sValue );
00905 }
00906 }
00907 if ( $sParams ) {
00908 $sParams = '&'.$sParams;
00909 }
00910 $this->setViewConfigParam( 'navurlparams', $sParams );
00911 }
00912
00913 return $sParams;
00914 }
00915
00921 public function getNavFormParams()
00922 {
00923
00924 if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
00925 $oStr = getStr();
00926 $sParams = '';
00927 $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
00928 foreach ( $aNavParams as $sName => $sValue ) {
00929 if ( isset( $sValue ) ) {
00930 $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\">\n";
00931 }
00932 }
00933 $this->setViewConfigParam( 'navformparams', $sParams );
00934 }
00935 return $sParams;
00936 }
00937
00943 public function getStockOnDefaultMessage()
00944 {
00945 return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
00946 }
00947
00953 public function getStockOffDefaultMessage()
00954 {
00955 return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
00956 }
00957
00963 public function getShopVersion()
00964 {
00965 return $this->getViewConfigParam( 'sShopVersion' );
00966 }
00967
00973 public function getAjaxLink()
00974 {
00975 return $this->getViewConfigParam( 'ajaxlink' );
00976 }
00977
00983 public function isMultiShop()
00984 {
00985 $oShop = $this->getConfig()->getActiveShop();
00986 return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
00987 }
00988
00994 public function getServiceUrl()
00995 {
00996 return $this->getViewConfigParam( 'sServiceUrl' );
00997 }
00998
01005 public function getRemoteAccessToken()
01006 {
01007 $sRaToken = oxRegistry::getSession()->getRemoteAccessToken();
01008
01009 return $sRaToken;
01010 }
01011
01018 public function getActionClassName()
01019 {
01020 return $this->getConfig()->getActiveView()->getActionClassName();
01021 }
01022
01029 public function getTopActionClassName()
01030 {
01031 return $this->getConfig()->getTopActiveView()->getActionClassName();
01032 }
01033
01039 public function getFbAppId()
01040 {
01041 return $this->getConfig()->getConfigParam( 'sFbAppId' );
01042 }
01043
01049 public function getShowBasketTimeout()
01050 {
01051 return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
01052 && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
01053 }
01054
01060 public function getBasketTimeLeft()
01061 {
01062 if (!isset($this->_dBasketTimeLeft)) {
01063 $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
01064 }
01065 return $this->_dBasketTimeLeft;
01066 }
01067
01074 public function getShowFbConnect()
01075 {
01076 $myConfig = $this->getConfig();
01077
01078 if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
01079 if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
01080 return true;
01081 }
01082 }
01083
01084 return false;
01085 }
01086
01092 public function getTsDomain()
01093 {
01094 $sDomain = false;
01095 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01096 if ( is_array( $aTsConfig ) ) {
01097 $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
01098 }
01099 return $sDomain;
01100 }
01101
01107 public function getTsWidgetUrl()
01108 {
01109 $sUrl = false;
01110 if ( $sTsId = $this->getTsId() ) {
01111 $sTsUrl = $this->getTsDomain();
01112
01113 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01114 $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
01115
01116 if ( $sTsUrl && $sTsWidgetUri ) {
01117
01118 $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
01119
01120
01121
01122 }
01123 }
01124
01125 return $sUrl;
01126 }
01127
01133 public function getTsInfoUrl()
01134 {
01135 $sUrl = false;
01136 if ( $sTsId = $this->getTsId() ) {
01137 $sTsUrl = $this->getTsDomain();
01138
01139 $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01140 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01141 $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
01142
01143 if ( $sTsUrl && $sTsInfoUri ) {
01144 $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
01145 }
01146 }
01147
01148 return $sUrl;
01149 }
01150
01156 public function getTsRatingUrl()
01157 {
01158 $sUrl = false;
01159 if ( $sTsId = $this->getTsId() ) {
01160 $sTsUrl = $this->getTsDomain();
01161
01162 $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01163 $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
01164 $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
01165
01166 if ( $sTsUrl && $sTsRateUri ) {
01167 $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
01168 }
01169 }
01170
01171 return $sUrl;
01172 }
01173
01181 public function showTs( $sType )
01182 {
01183 $blShow = false;
01184 switch ( $sType ) {
01185 case "WIDGET":
01186 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
01187 break;
01188 case "THANKYOU":
01189 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
01190 break;
01191 case "ORDEREMAIL":
01192 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
01193 break;
01194 case "ORDERCONFEMAIL":
01195 $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
01196 break;
01197 }
01198 return $blShow;
01199 }
01200
01206 public function getTsId()
01207 {
01208 $sTsId = false;
01209 $oConfig = $this->getConfig();
01210 $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
01211 $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
01212
01213
01214 $sLangId = oxRegistry::getLang()->getLanguageAbbr();
01215 if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
01216 isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
01217 ) {
01218 $sTsId = $aLangIds[$sLangId];
01219 }
01220
01221 return $sTsId;
01222 }
01223
01229 public function isTplBlocksDebugMode()
01230 {
01231 return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
01232 }
01233
01239 public function getPasswordLength()
01240 {
01241 $iPasswordLength = 6;
01242
01243 $oConfig = $this->getConfig();
01244
01245 if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
01246 $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
01247 }
01248
01249 return $iPasswordLength;
01250 }
01251
01257 public function getCountryList()
01258 {
01259 if ( $this->_oCountryList === null ) {
01260
01261 $this->_oCountryList = oxNew( 'oxcountrylist' );
01262 $this->_oCountryList->loadActiveCountries();
01263 }
01264 return $this->_oCountryList;
01265 }
01266
01267
01278 public function getModulePath($sModule, $sFile = '')
01279 {
01280 if (!$sFile || ($sFile[0] != '/')) {
01281 $sFile = '/'.$sFile;
01282 }
01283 $oModule = oxNew("oxmodule");
01284 $sModulePath = $oModule->getModulePath($sModule);
01285 $sFile = $this->getConfig()->getModulesDir().$sModulePath.$sFile;
01286 if (file_exists($sFile) || is_dir($sFile)) {
01287 return $sFile;
01288 } else {
01289 $oEx = oxNew( "oxFileException", "Requested file not found for module $sModule ($sFile)" );
01290 $oEx->debugOut();
01291 if (!$this->getConfig()->getConfigParam( 'iDebug' )) {
01292 return '';
01293 }
01294 throw $oEx;
01295 }
01296 }
01297
01308 public function getModuleUrl($sModule, $sFile = '')
01309 {
01310 $sUrl = str_replace(
01311 rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
01312 rtrim($this->getConfig()->getCurrentShopUrl( false ), '/'),
01313 $this->getModulePath($sModule, $sFile)
01314 );
01315 return $sUrl;
01316 }
01317
01325 public function getViewThemeParam( $sName )
01326 {
01327 $sValue = false;
01328
01329 if ($this->getConfig()->isThemeOption( $sName ) ) {
01330 $sValue = $this->getConfig()->getConfigParam( $sName );
01331 }
01332
01333 return $sValue;
01334 }
01335
01336
01342 public function showSelectLists()
01343 {
01344 return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
01345 }
01346
01352 public function showSelectListsInList()
01353 {
01354 return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
01355 }
01356
01357
01358
01364 public function isAltImageServerConfigured()
01365 {
01366 $oConfig = $this->getConfig();
01367
01368 return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
01369 $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
01370 }
01371
01379 public function isFunctionalityEnabled( $sParamName )
01380 {
01381 return (bool) $this->getConfig()->getConfigParam( $sParamName );
01382 }
01383
01384 }