oxseoencodercontent.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxSeoEncoderContent extends oxSeoEncoder
00009 {
00013     protected static $_instance = null;
00014 
00020     public static function getInstance()
00021     {
00022         if (!self::$_instance) {
00023             self::$_instance = oxNew("oxSeoEncoderContent");
00024         }
00025         return self::$_instance;
00026     }
00027 
00037     protected function _getContentUri( $oCont, $iLang = null)
00038     {
00039         if (!isset($iLang)) {
00040             $iLang = $oCont->getLanguage();
00041         }
00042         //load details link from DB
00043         if ( !( $sSeoUrl = $this->_loadFromDb( 'oxcontent', $oCont->getId(), $iLang ) ) ) {
00044 
00045             if ( $iLang != $oCont->getLanguage() ) {
00046                 $oCont->loadInLang( $iLang, $oCont->getId() );
00047             }
00048 
00049             $sSeoUrl = '';
00050             if ( $oCont->oxcontents__oxcatid->value ) {
00051                 $oCat = oxNew( 'oxcategory' );
00052                 if ( $oCat->loadInLang( $iLang, $oCont->oxcontents__oxcatid->value ) ) {
00053                     if ( $oCat->oxcategories__oxparentid->value && $oCat->oxcategories__oxparentid->value != 'oxrootid' ) {
00054                         $oParentCat = oxNew( 'oxcategory' );
00055                         if ( $oParentCat->loadInLang( $iLang, $oCat->oxcategories__oxparentid->value ) ) {
00056                             $sSeoUrl .= oxSeoEncoderCategory::getInstance()->getCategoryUri( $oParentCat );
00057                         }
00058                     }
00059                 }
00060             }
00061 
00062             $sSeoUrl .= $this->_prepareTitle( $oCont->oxcontents__oxtitle->value . '/' );
00063             $sSeoUrl  = $this->_getUniqueSeoUrl( $sSeoUrl, '/', $oCont->getId() );
00064 
00065             $this->_saveToDb( 'oxcontent', $oCont->getId(), $oCont->getStdLink(), $sSeoUrl, $iLang );
00066         }
00067         return $sSeoUrl;
00068     }
00069 
00080     public function getContentUrl( $oCont, $iLang = null)
00081     {
00082         if (!isset($iLang)) {
00083             $iLang = $oCont->getLanguage();
00084         }
00085         return $this->_getFullUrl( $this->_getContentUri( $oCont, $iLang ), $iLang );
00086     }
00087 
00088 }

Generated on Thu Dec 4 12:04:57 2008 for OXID eShop CE by  doxygen 1.5.5