oxseoencoderrecomm.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxSeoEncoderRecomm extends oxSeoEncoder
00008 {
00012     protected static $_instance = null;
00013 
00019     public static function getInstance()
00020     {
00021         // disable caching for test modules
00022         if ( defined( 'OXID_PHP_UNIT' ) ) {
00023             self::$_instance = modInstances::getMod( __CLASS__ );
00024         }
00025 
00026         if ( !self::$_instance instanceof oxSeoEncoderRecomm ) {
00027             self::$_instance = oxNew( 'oxSeoEncoderRecomm' );
00028             if ( defined( 'OXID_PHP_UNIT' ) ) {
00029                 modInstances::addMod( __CLASS__, self::$_instance);
00030             }
00031         }
00032 
00033         if ( defined( 'OXID_PHP_UNIT' ) ) {
00034             // resetting cache
00035             self::$_instance->_aSeoCache = array();
00036         }
00037 
00038         return self::$_instance;
00039     }
00040 
00049     public function getRecommUri( $oRecomm, $iLang = null )
00050     {
00051         if ( !( $sSeoUrl = $this->_loadFromDb( 'dynamic', $oRecomm->getId(), $iLang ) ) ) {
00052             $myConfig = $this->getConfig();
00053 
00054             // fetching part of base url
00055             $sSeoUrl = $this->_getStaticUri( $oRecomm->getBaseStdLink( $iLang, false ), $myConfig->getShopId(), $iLang ) . $this->_prepareTitle( $oRecomm->oxrecommlists__oxtitle->value );
00056 
00057             // creating unique
00058             $sSeoUrl = $this->_processSeoUrl( $sSeoUrl, $oRecomm->getId(), $iLang );
00059 
00060             // inserting
00061             $this->_saveToDb( 'dynamic', $oRecomm->getId(), $oRecomm->getStdLink( $iLang ), $sSeoUrl, $iLang, $myConfig->getShopId() );
00062         }
00063 
00064         return $sSeoUrl;
00065     }
00066 
00075     public function getRecommUrl( $oRecomm, $iLang = null)
00076     {
00077         if (!isset($iLang)) {
00078             $iLang = oxLang::getInstance()->getBaseLanguage();
00079         }
00080         return $this->_getFullUrl( $this->getRecommUri( $oRecomm, $iLang ), $iLang );
00081     }
00082 
00093     public function getRecommPageUrl( $oRecomm, $iPage, $iLang = null, $blFixed = false )
00094     {
00095         if (!isset($iLang)) {
00096             $iLang = oxLang::getInstance()->getBaseLanguage();
00097         }
00098         $sStdUrl = $oRecomm->getStdLink( $iLang ) . '&amp;pgNr=' . $iPage;
00099         $sParams = (int) ($iPage + 1);
00100 
00101         $sStdUrl = $this->_trimUrl( $sStdUrl, $iLang );
00102         $sSeoUrl = $this->getRecommUri( $oRecomm, $iLang ) . $sParams . "/";
00103 
00104         return $this->_getFullUrl( $this->_getPageUri( $oRecomm, 'dynamic', $sStdUrl, $sSeoUrl, $sParams, $iLang, $blFixed ), $iLang );
00105     }
00106 }

Generated by  doxygen 1.6.2