oxseoencodertag.php

Go to the documentation of this file.
00001 <?php
00002 
00007 class oxSeoEncoderTag 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 oxSeoEncoderTag ) {
00027             self::$_instance = oxNew( 'oxSeoEncoderTag' );
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 getTagUri( $sTag, $iLang = null )
00050     {
00051         return $this->_getDynamicUri( $this->getStdTagUri( $sTag ), "tag/{$sTag}/", $iLang );
00052     }
00053 
00062     public function getStdTagUri( $sTag, $blIncludeIndex = true )
00063     {
00064         // while tags are just strings, standard ulrs formatted stays here
00065         $sUri = "cl=tag&amp;searchtag=" . rawurlencode( $sTag );
00066         if ( $blIncludeIndex ) {
00067             $sUri = "index.php?" . $sUri;
00068         }
00069         return $sUri;
00070     }
00071 
00080     public function getTagUrl( $sTag, $iLang = null)
00081     {
00082         if (!isset($iLang)) {
00083             $iLang = oxLang::getInstance()->getBaseLanguage();
00084         }
00085         return $this->_getFullUrl( $this->getTagUri( $sTag, $iLang ), $iLang );
00086     }
00087 
00098     public function getTagPageUrl( $sTag, $iPage, $iLang = null, $blFixed = false )
00099     {
00100         if (!isset($iLang)) {
00101             $iLang = oxLang::getInstance()->getBaseLanguage();
00102         }
00103         $sStdUrl = $this->getStdTagUri( $sTag ) . '&amp;pgNr=' . $iPage;
00104         $sParams = (int) ($iPage + 1);
00105 
00106         $sStdUrl = $this->_trimUrl( $sStdUrl, $iLang );
00107         $sSeoUrl = $this->getTagUri( $sTag, $iLang ) . $sParams . "/";
00108 
00109         return $this->_getFullUrl( $this->_getDynamicUri( $sStdUrl, $sSeoUrl, $iLang ), $iLang );
00110     }
00111 }

Generated by  doxygen 1.6.2