[pLog-svn] r2631 - in plog/trunk/class: dao gallery/dao net
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Nov 24 21:05:45 GMT 2005
Author: oscar
Date: 2005-11-24 21:05:45 +0000 (Thu, 24 Nov 2005)
New Revision: 2631
Modified:
plog/trunk/class/dao/articlecategories.class.php
plog/trunk/class/dao/articlecategory.class.php
plog/trunk/class/gallery/dao/galleryalbum.class.php
plog/trunk/class/gallery/dao/galleryalbums.class.php
plog/trunk/class/net/customrequestgenerator.class.php
Log:
A few modifications to the CustomRequestGenerator class so that it users the getMangledName() method of the db objects instead of calling Textfilter all the time.
Modified: plog/trunk/class/dao/articlecategories.class.php
===================================================================
--- plog/trunk/class/dao/articlecategories.class.php 2005-11-24 21:04:56 UTC (rev 2630)
+++ plog/trunk/class/dao/articlecategories.class.php 2005-11-24 21:05:45 UTC (rev 2631)
@@ -155,6 +155,7 @@
$category->setNumArticles( $row["num_articles"] );
$category->setNumPublishedArticles( $row["num_published_articles"] );
$category->setLastModification( $row["last_modification"] );
+ $category->setMangledName( $row["mangled_name"] );
return( $category );
}
Modified: plog/trunk/class/dao/articlecategory.class.php
===================================================================
--- plog/trunk/class/dao/articlecategory.class.php 2005-11-24 21:04:56 UTC (rev 2630)
+++ plog/trunk/class/dao/articlecategory.class.php 2005-11-24 21:05:45 UTC (rev 2631)
@@ -23,6 +23,7 @@
var $_description;
var $_lastModification;
var $_blog;
+ var $_mangledName;
function ArticleCategory( $name, $url, $blogId, $inMainPage, $description = "", $numArticles = 0, $properties = Array(), $id = -1, $lastModification=null, $parentId = null)
{
@@ -44,6 +45,7 @@
$this->_numArticles = 0;
$this->_numPublishedArticles = 0;
$this->_blog = null;
+ $this->_mangledName = "";
$this->_pk = "id";
$this->_fields = Array( "name" => "getName",
@@ -303,10 +305,19 @@
function getMangledName()
{
- include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
- return( Textfilter::urlize( $this->getName()));
+ if( $this->_mangledName == "" ) {
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+ $this->_mangledName = Textfilter::urlize( $this->getName());
+ }
+
+ return( $this->_mangledName );
}
+ function setMangledName( $mangledName )
+ {
+ $this->_mangledName = $mangledName;
+ }
+
function getBlog()
{
if( $this->_blog == null ) {
Modified: plog/trunk/class/gallery/dao/galleryalbum.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryalbum.class.php 2005-11-24 21:04:56 UTC (rev 2630)
+++ plog/trunk/class/gallery/dao/galleryalbum.class.php 2005-11-24 21:05:45 UTC (rev 2631)
@@ -375,8 +375,17 @@
function getMangledName()
{
- include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
- return( Textfilter::urlize( $this->getName()));
+ if( $this->_mangledName == "" ) {
+ include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+ $this->_mangledName = Textfilter::urlize( $this->getName());
+ }
+
+ return( $this->_mangledName );
}
+
+ function setMangledName( $mangledName )
+ {
+ $this->_mangledName = $mangledName;
+ }
}
?>
\ No newline at end of file
Modified: plog/trunk/class/gallery/dao/galleryalbums.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryalbums.class.php 2005-11-24 21:04:56 UTC (rev 2630)
+++ plog/trunk/class/gallery/dao/galleryalbums.class.php 2005-11-24 21:05:45 UTC (rev 2631)
@@ -344,6 +344,7 @@
$row["id"] );
$album->setNumResources( $row['num_resources'] );
$album->setNumChildren( $row['num_children'] );
+ $album->setMangledName( $row['mangled_name'] );
return $album;
}
Modified: plog/trunk/class/net/customrequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/customrequestgenerator.class.php 2005-11-24 21:04:56 UTC (rev 2630)
+++ plog/trunk/class/net/customrequestgenerator.class.php 2005-11-24 21:05:45 UTC (rev 2631)
@@ -2,9 +2,6 @@
include_once( PLOG_CLASS_PATH."class/net/baserequestgenerator.class.php" );
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
- include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
- include_once( PLOG_CLASS_PATH."class/database/db.class.php" );
- include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
/**
* \ingroup Net
@@ -73,7 +70,7 @@
'{minute}' => $t->getMinutes(),
'{postid}' => $post->getId(),
'{postname}' => $post->getPostSlug(),
- '{catname}' => TextFilter::urlize($category->getName()),
+ '{catname}' => $category->getMangledName(),
'{catid}' => $category->getId(),
'{userid}' => $user->getId(),
'{username}' => $user->getUsername()
@@ -170,7 +167,7 @@
$categoryFormat = $this->_config->getValue( "category_link_format" );
$ownerInfo = $this->_blogInfo->getOwnerInfo();
$params = Array( "{catid}" => $category->getId(),
- "{catname}" => TextFilter::urlize($category->getName()),
+ "{catname}" => $category->getMangledName(),
"{blogid}" => $this->_blogInfo->getId(),
"{blogowner}" => $ownerInfo->getUsername(),
"{blogname}" => $this->_blogInfo->getMangledBlog());
@@ -346,7 +343,7 @@
if( $album != null ) {
$params["{albumid}"] = $album->getId();
- $params["{albumname}"] = Textfilter::urlize($album->getName());
+ $params["{albumname}"] = $album->getMangledName();
}
$albumLink = $this->getBaseUrl().$this->_replaceTags( $albumLinkFormat, $params );
@@ -465,6 +462,7 @@
if ( $blogId != $ownerId ) {
$blogId = $ownerId;
+ include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
$blogs =& new Blogs();
$blogInfo = $blogs->getBlogInfo($blogId);
$blogShortName = $blogInfo->getMangledBlog();
@@ -473,14 +471,14 @@
$blogShortName = $this->_blogInfo->getMangledBlog();
$ownerInfo = $this->_blogInfo->getOwnerInfo();
}
-
+
$params = Array( "{blogid}" => $blogId,
"{blogname}" => $blogShortName,
"{blogowner}" => $ownerInfo->getUsername(),
"{resourceid}" => $resource->getId(),
"{resourcename}" => rawurlencode($resource->getFileName()),
"{albumid}" => $album->getId(),
- "{albumname}" => Textfilter::urlize($album->getName()));
+ "{albumname}" => $album->getMangledName());
return $params;
}
More information about the pLog-svn
mailing list