00001 <?php
00002
00007 class oxSeoEncoderTag extends oxSeoEncoder
00008 {
00012 protected static $_instance = null;
00013
00019 public static function getInstance()
00020 {
00021
00022 if ( defined( 'OXID_PHP_UNIT' ) ) {
00023 static $inst = array();
00024 self::$_instance = $inst[oxClassCacheKey()];
00025 }
00026
00027 if ( !self::$_instance instanceof oxSeoEncoderTag ) {
00028 self::$_instance = oxNew( 'oxSeoEncoderTag' );
00029 if ( defined( 'OXID_PHP_UNIT' ) ) {
00030 $inst[oxClassCacheKey()] = self::$_instance;
00031 }
00032 }
00033
00034 if ( defined( 'OXID_PHP_UNIT' ) ) {
00035
00036 self::$_instance->_aSeoCache = array();
00037 }
00038
00039 return self::$_instance;
00040 }
00041
00050 public function getTagUri( $sTag, $iLang = null )
00051 {
00052 return $this->_getDynamicUri( $this->getStdTagUri( $sTag ), "tag/{$sTag}/", $iLang );
00053 }
00054
00063 public function getStdTagUri( $sTag, $blIncludeIndex = true )
00064 {
00065
00066 $sUri = "cl=tag&searchtag=" . rawurlencode( $sTag );
00067 if ( $blIncludeIndex ) {
00068 $sUri = "index.php?" . $sUri;
00069 }
00070 return $sUri;
00071 }
00072
00081 public function getTagUrl( $sTag, $iLang = null)
00082 {
00083 if (!isset($iLang)) {
00084 $iLang = oxLang::getInstance()->getBaseLanguage();
00085 }
00086 return $this->_getFullUrl( $this->getTagUri( $sTag, $iLang ), $iLang );
00087 }
00088
00099 public function getTagPageUrl( $sTag, $iPage, $iLang = null, $blFixed = false )
00100 {
00101 if (!isset($iLang)) {
00102 $iLang = oxLang::getInstance()->getBaseLanguage();
00103 }
00104 $sStdUrl = $this->getStdTagUri( $sTag ) . '&pgNr=' . $iPage;
00105 $sParams = sprintf( "%0" . ceil( $this->_iCntPages / 10 + 1 ) . "d", $iPage + 1 );
00106
00107 $sStdUrl = $this->_trimUrl( $sStdUrl, $iLang );
00108 $sSeoUrl = $this->getTagUri( $sTag, $iLang ) . $sParams . "/";
00109
00110 return $this->_getFullUrl( $this->_getDynamicUri( $sStdUrl, $sSeoUrl, $iLang ), $iLang );
00111 }
00112 }