OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
oxviewconfig.php
Go to the documentation of this file.
1 <?php
2 
8 class oxViewConfig extends oxSuperCfg
9 {
15  protected $_oShop = null;
16 
22  protected $_aViewData = null;
23 
29  protected $_aConfigParams = array();
30 
36  protected $_sHelpPageLink = null;
37 
43  protected $_oCountryList = null;
44 
50  protected $_aTrustedShopRatings = null;
51 
57  protected $_sActiveTheme = null;
58 
63  protected $_sShopLogo = null;
64 
70  public function getHomeLink()
71  {
72  if ( ( $sValue = $this->getViewConfigParam( 'homeLink' ) ) === null ) {
73  $myConfig = $this->getConfig();
74  $myUtils = oxRegistry::getUtils();
75  $oLang = oxRegistry::getLang();
76  $iLang = $oLang->getBaseLanguage();
77 
78  $sValue = null;
79 
80  $blAddStartCl = $myUtils->seoIsActive() && ( $iLang != $myConfig->getConfigParam( 'sDefaultLang' ) );
81 
82 
83  if ( $blAddStartCl ) {
84  $sValue = oxRegistry::get("oxSeoEncoder")->getStaticUrl( $this->getSelfLink() . 'cl=start', $iLang );
85  $sValue = oxRegistry::get("oxUtilsUrl")->appendUrl(
86  $sValue,
87  oxRegistry::get("oxUtilsUrl")->getBaseAddUrlParams()
88  );
89  $sValue = getStr()->preg_replace('/(\?|&(amp;)?)$/', '', $sValue);
90  }
91 
92  if ( !$sValue ) {
93  $sValue = getStr()->preg_replace('#index.php\??$#', '', $this->getSelfLink());
94  }
95 
96  $this->setViewConfigParam( 'homeLink', $sValue );
97  }
98  return $sValue;
99  }
100 
106  public function getActContentLoadId()
107  {
108  $sTplName = oxRegistry::getConfig()->getRequestParameter( 'oxloadid' );
109  // #M1176: Logout from CMS page
110  if ( !$sTplName && $this->getConfig()->getTopActiveView() ) {
111  $sTplName = $this->getConfig()->getTopActiveView()->getViewConfig()->getViewConfigParam('oxloadid');
112  }
113  return $sTplName ? basename( $sTplName ) : null;
114  }
115 
121  public function getActTplName()
122  {
123  return oxRegistry::getConfig()->getRequestParameter( 'tpl' );
124  }
125 
131  public function getActCurrency()
132  {
133  return $this->getConfig()->getShopCurrency();
134  }
135 
141  public function getLogoutLink()
142  {
143  $sClass = $this->getTopActionClassName();
144  $sCatnid = $this->getActCatId();
145  $sMnfid = $this->getActManufacturerId();
146  $sArtnid = $this->getActArticleId();
147  $sTplName = $this->getActTplName();
148  $sContentLoadId = $this->getActContentLoadId();
149  $sSearchParam = $this->getActSearchParam();
150  $sSearchTag = $this->getActSearchTag();
151  $sRecommId = $this->getActRecommendationId();
152  $sListType = $this->getActListType();
153 
154  $oConfig = $this->getConfig();
155  return ( $oConfig->isSsl()? $oConfig->getShopSecureHomeUrl() : $oConfig->getShopHomeUrl() )
156  ."cl={$sClass}"
157  . ( $sCatnid ? "&amp;cnid={$sCatnid}" : '' )
158  . ( $sArtnid ? "&amp;anid={$sArtnid}" : '' )
159  . ( $sMnfid ? "&amp;mnid={$sMnfid}" : '' )
160  . ( $sSearchParam ? "&amp;searchparam={$sSearchParam}" : '' )
161  . ( $sSearchTag ? "&amp;searchtag={$sSearchTag}" : '' )
162  . ( $sRecommId ? "&amp;recommid={$sRecommId}" : '' )
163  . ( $sListType ? "&amp;listtype={$sListType}" : '' )
164  . "&amp;fnc=logout"
165  . ( $sTplName ? "&amp;tpl=".basename( $sTplName ) : '' )
166  . ( $sContentLoadId ? "&amp;oxloadid=" . $sContentLoadId : '' )
167  . "&amp;redirect=1";
168  }
169 
175  protected function _getHelpContentIdents()
176  {
177  $sClass = $this->getActiveClassName();
178  return array( 'oxhelp' . strtolower( $sClass ), 'oxhelpdefault' );
179  }
180 
186  public function getHelpPageLink()
187  {
188  if ( $this->_sHelpPageLink === null ) {
189  $sLink = false;
190 
191  $aContentIdents = $this->_getHelpContentIdents();
192  $oContent = oxNew( "oxContent" );
193  foreach ( $aContentIdents as $sIdent ) {
194  if ( $oContent->loadByIdent( $sIdent ) ) {
195  $sLink = $oContent->getLink();
196  break;
197  }
198  }
199 
200  $this->_sHelpPageLink = $sLink ? $sLink : $this->getHelpLink();
201  }
202  return $this->_sHelpPageLink;
203  }
204 
210  public function getHelpLink()
211  {
212  $sTplName = $this->getActTplName();
213  $sClass = $this->getActiveClassName();
214  return $this->getConfig()->getShopCurrentURL()."cl=help&amp;page={$sClass}".( $sTplName ? "&amp;tpl={$sTplName}" : '' );
215  }
216 
222  public function getActCatId()
223  {
224  return oxRegistry::getConfig()->getRequestParameter( 'cnid' );
225  }
226 
232  public function getActArticleId()
233  {
234  return oxRegistry::getConfig()->getRequestParameter( 'anid' );
235  }
236 
242  public function getActSearchParam()
243  {
244  return oxRegistry::getConfig()->getRequestParameter( 'searchparam' );
245  }
246 
252  public function getActSearchTag()
253  {
254  return oxRegistry::getConfig()->getRequestParameter( 'searchtag' );
255  }
256 
262  public function getActRecommendationId()
263  {
264  return oxRegistry::getConfig()->getRequestParameter( 'recommid' );
265  }
266 
272  public function getActListType()
273  {
274  return oxRegistry::getConfig()->getRequestParameter( 'listtype' );
275  }
276 
282  public function getActManufacturerId()
283  {
284  return oxRegistry::getConfig()->getRequestParameter( 'mnid' );
285  }
286 
292  public function getContentId()
293  {
294  return oxRegistry::getConfig()->getRequestParameter( 'oxcid' );
295  }
296 
307  public function setViewConfigParam( $sName, $sValue )
308  {
309  startProfile('oxviewconfig::setViewConfigParam');
310 
311  $this->_aConfigParams[$sName] = $sValue;
312 
313  stopProfile('oxviewconfig::setViewConfigParam');
314  }
315 
323  public function getViewConfigParam( $sName )
324  {
325  startProfile('oxviewconfig::getViewConfigParam');
326 
327  if ( $this->_oShop && isset( $this->_oShop->$sName ) ) {
328  $sValue = $this->_oShop->$sName;
329  } elseif ( $this->_aViewData && isset( $this->_aViewData[ $sName ] ) ) {
330  $sValue = $this->_aViewData[ $sName ];
331  } else {
332  $sValue = ( isset( $this->_aConfigParams[ $sName ] ) ? $this->_aConfigParams[ $sName ] : null );
333  }
334 
335  stopProfile('oxviewconfig::getViewConfigParam');
336 
337  return $sValue;
338  }
339 
349  public function setViewShop( $oShop, $aViewData )
350  {
351  $this->_oShop = $oShop;
352  $this->_aViewData = $aViewData;
353  }
354 
362  public function getSessionId()
363  {
364  if ( ( $sValue = $this->getViewConfigParam( 'sessionid' ) ) === null ) {
365  $sValue = $this->getSession()->getId();
366  $this->setViewConfigParam( 'sessionid', $sValue );
367  }
368  return $sValue;
369  }
370 
376  public function getHiddenSid()
377  {
378  if ( ( $sValue = $this->getViewConfigParam( 'hiddensid' ) ) === null ) {
379  $sValue = $this->getSession()->hiddenSid();
380 
381  // appending language info to form
382  if ( ( $sLang = oxRegistry::getLang()->getFormLang() ) ) {
383  $sValue .= "\n{$sLang}";
384  }
385 
386 
387  $this->setViewConfigParam( 'hiddensid', $sValue );
388  }
389  return $sValue;
390  }
391 
397  public function getSelfLink()
398  {
399  if ( ( $sValue = $this->getViewConfigParam( 'selflink' ) ) === null ) {
400  $sValue = $this->getConfig()->getShopHomeURL();
401  $this->setViewConfigParam( 'selflink', $sValue );
402  }
403  return $sValue;
404  }
405 
411  public function getSslSelfLink()
412  {
413  if ( $this->isAdmin() ) {
414  // using getSelfLink() method in admin mode (#2745)
415  return $this->getSelfLink();
416  }
417 
418  if ( ( $sValue = $this->getViewConfigParam( 'sslselflink' ) ) === null ) {
419  $sValue = $this->getConfig()->getShopSecureHomeURL();
420  $this->setViewConfigParam( 'sslselflink', $sValue );
421  }
422  return $sValue;
423  }
424 
430  public function getBaseDir()
431  {
432  if ( ( $sValue = $this->getViewConfigParam( 'basedir' ) ) === null ) {
433 
434  if ( $this->getConfig()->isSsl() ) {
435  $sValue = $this->getConfig()->getSSLShopURL();
436  } else {
437  $sValue = $this->getConfig()->getShopURL();
438  }
439 
440  $this->setViewConfigParam( 'basedir', $sValue );
441  }
442  return $sValue;
443  }
444 
450  public function getCoreUtilsDir()
451  {
452  if ( ( $sValue = $this->getViewConfigParam( 'coreutilsdir' ) ) === null ) {
453  $sValue = $this->getConfig()->getCoreUtilsURL();
454  $this->setViewConfigParam( 'coreutilsdir', $sValue );
455  }
456  return $sValue;
457  }
458 
464  public function getSelfActionLink()
465  {
466  if ( ( $sValue = $this->getViewConfigParam( 'selfactionlink' ) ) === null ) {
467  $sValue = $this->getConfig()->getShopCurrentUrl();
468  $this->setViewConfigParam( 'selfactionlink', $sValue );
469  }
470  return $sValue;
471  }
472 
478  public function getCurrentHomeDir()
479  {
480  if ( ( $sValue = $this->getViewConfigParam( 'currenthomedir' ) ) === null ) {
481  $sValue = $this->getConfig()->getCurrentShopUrl();
482  $this->setViewConfigParam( 'currenthomedir', $sValue );
483  }
484  return $sValue;
485  }
486 
492  public function getBasketLink()
493  {
494  if ( ( $sValue = $this->getViewConfigParam( 'basketlink' ) ) === null ) {
495  $sValue = $this->getConfig()->getShopHomeURL() . 'cl=basket';
496  $this->setViewConfigParam( 'basketlink', $sValue );
497  }
498  return $sValue;
499  }
500 
506  public function getOrderLink()
507  {
508  if ( ( $sValue = $this->getViewConfigParam( 'orderlink' ) ) === null ) {
509  $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=user';
510  $this->setViewConfigParam( 'orderlink', $sValue );
511  }
512  return $sValue;
513  }
514 
520  public function getPaymentLink()
521  {
522  if ( ( $sValue = $this->getViewConfigParam( 'paymentlink' ) ) === null ) {
523  $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=payment';
524  $this->setViewConfigParam( 'paymentlink', $sValue );
525  }
526  return $sValue;
527  }
528 
534  public function getExeOrderLink()
535  {
536  if ( ( $sValue = $this->getViewConfigParam( 'exeorderlink' ) ) === null ) {
537  $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order&amp;fnc=execute';
538  $this->setViewConfigParam( 'exeorderlink', $sValue );
539  }
540  return $sValue;
541  }
542 
548  public function getOrderConfirmLink()
549  {
550  if ( ( $sValue = $this->getViewConfigParam( 'orderconfirmlink' ) ) === null ) {
551  $sValue = $this->getConfig()->getShopSecureHomeUrl() . 'cl=order';
552  $this->setViewConfigParam( 'orderconfirmlink', $sValue );
553  }
554  return $sValue;
555  }
556 
564  public function getResourceUrl( $sFile = null )
565  {
566  if ( $sFile ) {
567  $sValue = $this->getConfig()->getResourceUrl( $sFile, $this->isAdmin() );
568  } elseif ( ( $sValue = $this->getViewConfigParam( 'basetpldir' ) ) === null ) {
569  $sValue = $this->getConfig()->getResourceUrl( '', $this->isAdmin() );
570  $this->setViewConfigParam( 'basetpldir', $sValue );
571  }
572  return $sValue;
573  }
574 
580  public function getTemplateDir()
581  {
582  if ( ( $sValue = $this->getViewConfigParam( 'templatedir' ) ) === null ) {
583  $sValue = $this->getConfig()->getTemplateDir( $this->isAdmin() );
584  $this->setViewConfigParam( 'templatedir', $sValue );
585  }
586  return $sValue;
587  }
588 
594  public function getUrlTemplateDir()
595  {
596  if ( ( $sValue = $this->getViewConfigParam( 'urltemplatedir' ) ) === null ) {
597  $sValue = $this->getConfig()->getTemplateUrl( $this->isAdmin() );
598  $this->setViewConfigParam( 'urltemplatedir', $sValue );
599  }
600  return $sValue;
601  }
602 
611  public function getImageUrl( $sFile = null, $bSsl = null )
612  {
613  if ($sFile) {
614  $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl, null, $sFile );
615  } elseif ( ( $sValue = $this->getViewConfigParam( 'imagedir' ) ) === null ) {
616  $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), $bSsl );
617  $this->setViewConfigParam( 'imagedir', $sValue );
618  }
619  return $sValue;
620  }
621 
627  public function getNoSslImageDir()
628  {
629  if ( ( $sValue = $this->getViewConfigParam( 'nossl_imagedir' ) ) === null ) {
630  $sValue = $this->getConfig()->getImageUrl( $this->isAdmin(), false );
631  $this->setViewConfigParam( 'nossl_imagedir', $sValue );
632  }
633  return $sValue;
634  }
635 
642  public function getPictureDir()
643  {
644  if ( ( $sValue = $this->getViewConfigParam( 'picturedir' ) ) === null ) {
645  $sValue = $this->getConfig()->getPictureUrl( null, $this->isAdmin() );
646  $this->setViewConfigParam( 'picturedir', $sValue );
647  }
648  return $sValue;
649  }
650 
656  public function getAdminDir()
657  {
658  if ( ( $sValue = $this->getViewConfigParam( 'sAdminDir' ) ) === null ) {
659  $sValue = $this->getConfig()->getConfigParam( 'sAdminDir' );
660  $this->setViewConfigParam( 'sAdminDir', $sValue );
661  }
662  return $sValue;
663  }
664 
670  public function getActiveShopId()
671  {
672  if ( ( $sValue = $this->getViewConfigParam( 'shopid' ) ) === null ) {
673  $sValue = $this->getConfig()->getShopId();
674  $this->setViewConfigParam( 'shopid', $sValue );
675  }
676  return $sValue;
677  }
678 
684  public function isSsl()
685  {
686  if ( ( $sValue = $this->getViewConfigParam( 'isssl' ) ) === null ) {
687  $sValue = $this->getConfig()->isSsl();
688  $this->setViewConfigParam( 'isssl', $sValue );
689  }
690  return $sValue;
691  }
692 
693 
699  public function getRemoteAddress()
700  {
701  if ( ( $sValue = $this->getViewConfigParam( 'ip' ) ) === null ) {
702  $sValue = oxRegistry::get("oxUtilsServer")->getRemoteAddress();
703  $this->setViewConfigParam( 'ip', $sValue );
704  }
705  return $sValue;
706  }
707 
713  public function getPopupIdent()
714  {
715  if ( ( $sValue = $this->getViewConfigParam( 'popupident' ) ) === null ) {
716  $sValue = md5( $this->getConfig()->getShopUrl() );
717  $this->setViewConfigParam( 'popupident', $sValue );
718  }
719  return $sValue;
720  }
721 
727  public function getPopupIdentRand()
728  {
729  if ( ( $sValue = $this->getViewConfigParam( 'popupidentrand' ) ) === null ) {
730  $sValue = md5( time() );
731  $this->setViewConfigParam( 'popupidentrand', $sValue );
732  }
733  return $sValue;
734  }
735 
741  public function getArtPerPageForm()
742  {
743  if ( ( $sValue = $this->getViewConfigParam( 'artperpageform' ) ) === null ) {
744  $sValue = $this->getConfig()->getShopCurrentUrl();
745  $this->setViewConfigParam( 'artperpageform', $sValue );
746  }
747  return $sValue;
748  }
749 
755  public function isBuyableParent()
756  {
757  return $this->getConfig()->getConfigParam( 'blVariantParentBuyable' );
758  }
759 
765  public function showBirthdayFields()
766  {
767  return $this->getConfig()->getConfigParam( 'blShowBirthdayFields' );
768  }
769 
777  public function showFinalStep()
778  {
779  return true;
780  }
781 
787  public function getNrOfCatArticles()
788  {
789  // checking if all needed data is set
790  switch (oxRegistry::getSession()->getVariable( 'ldtype' )) {
791  case 'grid':
792  return $this->getConfig()->getConfigParam( 'aNrofCatArticlesInGrid' );
793  break;
794  case 'line':
795  case 'infogrid':
796  default:
797  return $this->getConfig()->getConfigParam( 'aNrofCatArticles' );
798  }
799  }
800 
806  public function getShowWishlist()
807  {
808  return $this->getConfig()->getConfigParam( 'bl_showWishlist' );
809  }
810 
816  public function getShowCompareList()
817  {
818  $myConfig = $this->getConfig();
819  $blShowCompareList = true;
820 
821  if ( !$myConfig->getConfigParam( 'bl_showCompareList' ) ||
822  ( $myConfig->getConfigParam( 'blDisableNavBars' ) && $myConfig->getActiveView()->getIsOrderStep() ) ) {
823  $blShowCompareList = false;
824  }
825 
826  return $blShowCompareList;
827  }
828 
834  public function getShowListmania()
835  {
836  return $this->getConfig()->getConfigParam( 'bl_showListmania' );
837  }
838 
844  public function getShowVouchers()
845  {
846  return $this->getConfig()->getConfigParam( 'bl_showVouchers' );
847  }
848 
854  public function getShowGiftWrapping()
855  {
856  return $this->getConfig()->getConfigParam( 'bl_showGiftWrapping' );
857  }
858 
864  public function getActLanguageId()
865  {
866  if ( ( $sValue = $this->getViewConfigParam( 'lang' ) ) === null ) {
867  $iLang = oxRegistry::getConfig()->getRequestParameter( 'lang' );
868  $sValue = ( $iLang !== null ) ? $iLang : oxRegistry::getLang()->getBaseLanguage();
869  $this->setViewConfigParam( 'lang', $sValue );
870  }
871  return $sValue;
872  }
873 
879  public function getActLanguageAbbr()
880  {
881  return oxRegistry::getLang()->getLanguageAbbr( $this->getActLanguageId() );
882  }
883 
889  public function getActiveClassName()
890  {
891  return $this->getConfig()->getActiveView()->getClassName();
892  }
893 
900  public function getTopActiveClassName()
901  {
902  return $this->getConfig()->getTopActiveView()->getClassName();
903  }
904 
910  public function getArtPerPageCount()
911  {
912  return $this->getViewConfigParam( 'iartPerPage' );
913  }
914 
920  public function getNavUrlParams()
921  {
922  if ( ( $sParams = $this->getViewConfigParam( 'navurlparams' ) ) === null ) {
923  $sParams = '';
924  $aNavParams = $this->getConfig()->getActiveView()->getNavigationParams();
925  foreach ( $aNavParams as $sName => $sValue ) {
926  if ( isset( $sValue ) ) {
927  if ( $sParams ) {
928  $sParams .= '&amp;';
929  }
930  $sParams .= "{$sName}=".rawurlencode( $sValue );
931  }
932  }
933  if ( $sParams ) {
934  $sParams = '&amp;'.$sParams;
935  }
936  $this->setViewConfigParam( 'navurlparams', $sParams );
937  }
938 
939  return $sParams;
940  }
941 
947  public function getNavFormParams()
948  {
949 
950  if ( ( $sParams = $this->getViewConfigParam( 'navformparams' ) ) === null ) {
951  $oStr = getStr();
952  $sParams = '';
953  $aNavParams = $this->getConfig()->getTopActiveView()->getNavigationParams();
954  foreach ( $aNavParams as $sName => $sValue ) {
955  if ( isset( $sValue ) ) {
956  $sParams .= "<input type=\"hidden\" name=\"{$sName}\" value=\"".$oStr->htmlentities( $sValue )."\" />\n";
957  }
958  }
959  $this->setViewConfigParam( 'navformparams', $sParams );
960  }
961  return $sParams;
962  }
963 
969  public function getStockOnDefaultMessage()
970  {
971  return $this->getConfig()->getConfigParam( 'blStockOnDefaultMessage' );
972  }
973 
979  public function getStockOffDefaultMessage()
980  {
981  return $this->getConfig()->getConfigParam( 'blStockOffDefaultMessage' );
982  }
983 
989  public function getShopVersion()
990  {
991  return $this->getViewConfigParam( 'sShopVersion' );
992  }
993 
999  public function getAjaxLink()
1000  {
1001  return $this->getViewConfigParam( 'ajaxlink' );
1002  }
1003 
1009  public function isMultiShop()
1010  {
1011  $oShop = $this->getConfig()->getActiveShop();
1012  return isset( $oShop->oxshops__oxismultishop ) ? ( (bool) $oShop->oxshops__oxismultishop->value ) : false;
1013  }
1014 
1020  public function getServiceUrl()
1021  {
1022  return $this->getViewConfigParam( 'sServiceUrl' );
1023  }
1024 
1031  public function getRemoteAccessToken()
1032  {
1033  $sRaToken = oxRegistry::getSession()->getRemoteAccessToken();
1034 
1035  return $sRaToken;
1036  }
1037 
1044  public function getActionClassName()
1045  {
1046  return $this->getConfig()->getActiveView()->getActionClassName();
1047  }
1048 
1055  public function getTopActionClassName()
1056  {
1057  return $this->getConfig()->getTopActiveView()->getActionClassName();
1058  }
1059 
1065  public function getFbAppId()
1066  {
1067  return $this->getConfig()->getConfigParam( 'sFbAppId' );
1068  }
1069 
1075  public function getShowBasketTimeout()
1076  {
1077  return $this->getConfig()->getConfigParam( 'blPsBasketReservationEnabled' )
1078  && ($this->getSession()->getBasketReservations()->getTimeLeft() > 0);
1079  }
1080 
1086  public function getBasketTimeLeft()
1087  {
1088  if (!isset($this->_dBasketTimeLeft)) {
1089  $this->_dBasketTimeLeft = $this->getSession()->getBasketReservations()->getTimeLeft();
1090  }
1091  return $this->_dBasketTimeLeft;
1092  }
1093 
1100  public function getShowFbConnect()
1101  {
1102  $myConfig = $this->getConfig();
1103 
1104  if ( $myConfig->getConfigParam( 'bl_showFbConnect' ) ) {
1105  if ( $myConfig->getConfigParam( "sFbAppId" ) && $myConfig->getConfigParam( "sFbSecretKey" ) ) {
1106  return true;
1107  }
1108  }
1109 
1110  return false;
1111  }
1112 
1118  public function getTsDomain()
1119  {
1120  $sDomain = false;
1121  $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
1122  if ( is_array( $aTsConfig ) ) {
1123  $sDomain = $aTsConfig["blTestMode"] ? $aTsConfig["sTsTestUrl"] : $aTsConfig["sTsUrl"];
1124  }
1125  return $sDomain;
1126  }
1127 
1135  public function getTsWidgetUrl()
1136  {
1137  $sUrl = false;
1138  if ( $sTsId = $this->getTsId() ) {
1139  $sTsUrl = $this->getTsDomain();
1140 
1141  $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
1142  $sTsWidgetUri = isset( $aTsConfig["sTsWidgetUri"] ) ? current( $aTsConfig["sTsWidgetUri"] ) : false;
1143 
1144  if ( $sTsUrl && $sTsWidgetUri ) {
1145  //$sLocal = $this->getConfig()->getImageDir()."{$sTsId}.gif";
1146  $sUrl = sprintf( "{$sTsUrl}/{$sTsWidgetUri}", $sTsId );
1147  //if ( $sImgName = oxRegistry::getUtils()->getRemoteCachePath( $sUrl, $sLocal ) ) {
1148  // $sUrl = $this->getImageUrl().basename( $sImgName );
1149  //}
1150  }
1151  }
1152 
1153  return $sUrl;
1154  }
1155 
1163  public function getTsInfoUrl()
1164  {
1165  $sUrl = false;
1166  if ( $sTsId = $this->getTsId() ) {
1167  $sTsUrl = $this->getTsDomain();
1168 
1169  $sLangId = oxRegistry::getLang()->getLanguageAbbr();
1170  $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
1171  $sTsInfoUri = ( isset( $aTsConfig["sTsInfoUri"] ) && isset( $aTsConfig["sTsInfoUri"][$sLangId] ) ) ? $aTsConfig["sTsInfoUri"][$sLangId] : false;
1172 
1173  if ( $sTsUrl && $sTsInfoUri ) {
1174  $sUrl = sprintf( "{$sTsUrl}/{$sTsInfoUri}", $sTsId );
1175  }
1176  }
1177 
1178  return $sUrl;
1179  }
1180 
1186  public function getTsRatings()
1187  {
1188  if ( $this->_aTrustedShopRatings === null ) {
1189  if ( $sTsId = $this->getTsId() ) {
1190  $oTsRatings = oxNew( "oxTsRatings" );
1191  $oTsRatings->setTsId( $sTsId );
1192  $this->_aTrustedShopRatings = $oTsRatings->getRatings();
1193 
1195  }
1196  }
1198  }
1199 
1205  public function getTsRatingUrl()
1206  {
1207  $sUrl = false;
1208  if ( $sTsId = $this->getTsId() ) {
1209  $sTsUrl = $this->getTsDomain();
1210 
1211  $sLangId = oxRegistry::getLang()->getLanguageAbbr();
1212  $aTsConfig = $this->getConfig()->getConfigParam( "aTsConfig" );
1213  $sTsRateUri = ( isset( $aTsConfig["sTsRatingUri"] ) && isset( $aTsConfig["sTsRatingUri"][$sLangId] ) ) ? $aTsConfig["sTsRatingUri"][$sLangId] : false;
1214 
1215  if ( $sTsUrl && $sTsRateUri ) {
1216  $sUrl = sprintf( "{$sTsUrl}/{$sTsRateUri}", $sTsId );
1217  }
1218  }
1219 
1220  return $sUrl;
1221  }
1222 
1230  public function showTs( $sType )
1231  {
1232  $blShow = false;
1233  switch ( $sType ) {
1234  case "WIDGET":
1235  $blShow = (bool) $this->getConfig()->getConfigParam( "blTsWidget" );
1236  break;
1237  case "THANKYOU":
1238  $blShow = (bool) $this->getConfig()->getConfigParam( "blTsThankyouReview" );
1239  break;
1240  case "ORDEREMAIL":
1241  $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderEmailReview" );
1242  break;
1243  case "ORDERCONFEMAIL":
1244  $blShow = (bool) $this->getConfig()->getConfigParam( "blTsOrderSendEmailReview" );
1245  break;
1246  }
1247  return $blShow;
1248  }
1249 
1255  public function getTsId()
1256  {
1257  $sTsId = false;
1258  $oConfig = $this->getConfig();
1259  $aLangIds = $oConfig->getConfigParam( "aTsLangIds" );
1260  $aActInfo = $oConfig->getConfigParam( "aTsActiveLangIds" );
1261 
1262  // mapping with language id
1263  $sLangId = oxRegistry::getLang()->getLanguageAbbr();
1264  if ( isset( $aActInfo[$sLangId] ) && $aActInfo[$sLangId] &&
1265  isset( $aLangIds[$sLangId] ) && $aLangIds[$sLangId]
1266  ) {
1267  $sTsId = $aLangIds[$sLangId];
1268  }
1269 
1270  return $sTsId;
1271  }
1272 
1278  public function isTplBlocksDebugMode()
1279  {
1280  return (bool) $this->getConfig()->getConfigParam('blDebugTemplateBlocks');
1281  }
1282 
1288  public function getPasswordLength()
1289  {
1290  $iPasswordLength = 6;
1291 
1292  $oConfig = $this->getConfig();
1293 
1294  if ($oConfig->getConfigParam( "iPasswordLength" ) ) {
1295  $iPasswordLength = $oConfig->getConfigParam( "iPasswordLength" );
1296  }
1297 
1298  return $iPasswordLength;
1299  }
1300 
1306  public function getCountryList()
1307  {
1308  if ( $this->_oCountryList === null ) {
1309  // passing country list
1310  $this->_oCountryList = oxNew( 'oxcountrylist' );
1311  $this->_oCountryList->loadActiveCountries();
1312  }
1313  return $this->_oCountryList;
1314  }
1315 
1316 
1327  public function getModulePath($sModule, $sFile = '')
1328  {
1329  if (!$sFile || ($sFile[0] != '/')) {
1330  $sFile = '/'.$sFile;
1331  }
1332  $oModule = oxNew("oxmodule");
1333  $sModulePath = $oModule->getModulePath($sModule);
1334  $sFile = $this->getConfig()->getModulesDir().$sModulePath.$sFile;
1335  if (file_exists($sFile) || is_dir($sFile)) {
1336  return $sFile;
1337  } else {
1338  $oEx = oxNew( "oxFileException", "Requested file not found for module $sModule ($sFile)" );
1339  $oEx->debugOut();
1340  if (!$this->getConfig()->getConfigParam( 'iDebug' )) {
1341  return '';
1342  }
1343  throw $oEx;
1344  }
1345  }
1346 
1357  public function getModuleUrl($sModule, $sFile = '')
1358  {
1359  $sUrl = str_replace(
1360  rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'),
1361  rtrim($this->getConfig()->getCurrentShopUrl( false ), '/'),
1362  $this->getModulePath($sModule, $sFile)
1363  );
1364  return $sUrl;
1365  }
1366 
1374  public function getViewThemeParam( $sName )
1375  {
1376  $sValue = false;
1377 
1378  if ($this->getConfig()->isThemeOption( $sName ) ) {
1379  $sValue = $this->getConfig()->getConfigParam( $sName );
1380  }
1381 
1382  return $sValue;
1383  }
1384 
1385 
1391  public function showSelectLists()
1392  {
1393  return (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectLists' );
1394  }
1395 
1401  public function showSelectListsInList()
1402  {
1403  return $this->showSelectLists() && (bool) $this->getConfig()->getConfigParam( 'bl_perfLoadSelectListsInAList' );
1404  }
1405 
1406 
1407 
1413  public function isAltImageServerConfigured()
1414  {
1415  $oConfig = $this->getConfig();
1416 
1417  return $oConfig->getConfigParam('sAltImageUrl') || $oConfig->getConfigParam('sSSLAltImageUrl') ||
1418  $oConfig->getConfigParam('sAltImageDir') || $oConfig->getConfigParam('sSSLAltImageDir');
1419  }
1420 
1428  public function isFunctionalityEnabled( $sParamName )
1429  {
1430  return (bool) $this->getConfig()->getConfigParam( $sParamName );
1431  }
1432 
1438  public function getActiveTheme()
1439  {
1440  if ( $this->_sActiveTheme === null ) {
1441  $oTheme = oxNew( 'oxTheme' );
1442  $this->_sActiveTheme = $oTheme->getActiveThemeId();
1443  }
1444  return $this->_sActiveTheme;
1445  }
1446 
1452  public function getShopLogo()
1453  {
1454  if ( is_null( $this->_sShopLogo ) ) {
1455 
1456  $sLogoImage = $this->getConfig()->getConfigParam( 'sShopLogo' );
1457  if ( empty( $sLogoImage ) )
1458  {
1459  $sLogoImage = "logo.png";
1460  }
1461 
1462  $this->setShopLogo( $sLogoImage );
1463  }
1464 
1465  return $this->_sShopLogo;
1466  }
1467 
1475  public function setShopLogo( $sLogo )
1476  {
1477  $this->_sShopLogo = $sLogo;
1478  }
1479 
1485  public function getSessionChallengeToken()
1486  {
1487  if (oxRegistry::getSession()->isSessionStarted()) {
1488  $sessionChallengeToken = $this->getSession()->getSessionChallengeToken();
1489  } else {
1490  $sessionChallengeToken = "";
1491  }
1492 
1493  return $sessionChallengeToken;
1494  }
1495 }