2012-08-31, 15:11:38
I would suggest changing these if-elseif:
foreach($post_data as $key => $value)
{
if($key == 'current_slug' || $key == 'time')
{
}
elseif($key == 'slug')
{
$node = $xml->addChild($key);
$node->addCData($slug);
}
elseif($key == 'title')
{
$title = safe_slash_html($value);
$node = $xml->addChild($key);
$node->addCData($title);
}
elseif($key == 'date')
{
$node = $xml->addChild($key);
$node->addCData($date);
}
elseif($key == 'content')
{
$content = safe_slash_html($value);
$node = $xml->addChild($key);
$node->addCData($content);
}
elseif($key == 'tags')
{
$node = $xml->addChild($key);
$node->addCData($tags);
}
else
{
$node = $xml->addChild($key);
$node->addCData($value);
}
}
To a switch statement for readability (it might help performance slightly http://www.phpbench.com/)
Also, the following function:
/**
* Lists All Blog Posts
*
* @param $array bool if true an array containing each posts filename and publish date will be returned instead of only the filename
* @param $sort_dates bool if true the posts array will be sorted by post date -- THIS REQUIRES $array param TO BE TRUE
* @return array the filenames & paths of all posts
*/
public function listPosts($array=false, $sort_dates=false)
Doesn't seem to take into account the pagination. I believe it'll easily become a performance issue for bigger blog. I would adjust it or create another function which includes the page index in its routine.
Like calls from:
function show_blog_category($category)
public function get_blog_archives()
function show_posts_page($index=0)
The following function should use another parameter (probably the number of post in the recent post list):
function show_blog_recent_posts($excerpt=false, $excerpt_length=null, $thumbnail=null, $read_more=null)
I'm unsure about how these changes could be implemented, but my guess is that the file blog_cache.xml might be useful to optimize the function listPosts.
Tell me if you find it useful. I could probably help on this.
I'm suggesting and reporting these issues and those in my earlier posts as I find your plugin really useful and a great way to learn GetSimple. Thanks a lot for making it.
foreach($post_data as $key => $value)
{
if($key == 'current_slug' || $key == 'time')
{
}
elseif($key == 'slug')
{
$node = $xml->addChild($key);
$node->addCData($slug);
}
elseif($key == 'title')
{
$title = safe_slash_html($value);
$node = $xml->addChild($key);
$node->addCData($title);
}
elseif($key == 'date')
{
$node = $xml->addChild($key);
$node->addCData($date);
}
elseif($key == 'content')
{
$content = safe_slash_html($value);
$node = $xml->addChild($key);
$node->addCData($content);
}
elseif($key == 'tags')
{
$node = $xml->addChild($key);
$node->addCData($tags);
}
else
{
$node = $xml->addChild($key);
$node->addCData($value);
}
}
To a switch statement for readability (it might help performance slightly http://www.phpbench.com/)
Also, the following function:
/**
* Lists All Blog Posts
*
* @param $array bool if true an array containing each posts filename and publish date will be returned instead of only the filename
* @param $sort_dates bool if true the posts array will be sorted by post date -- THIS REQUIRES $array param TO BE TRUE
* @return array the filenames & paths of all posts
*/
public function listPosts($array=false, $sort_dates=false)
Doesn't seem to take into account the pagination. I believe it'll easily become a performance issue for bigger blog. I would adjust it or create another function which includes the page index in its routine.
Like calls from:
function show_blog_category($category)
public function get_blog_archives()
function show_posts_page($index=0)
The following function should use another parameter (probably the number of post in the recent post list):
function show_blog_recent_posts($excerpt=false, $excerpt_length=null, $thumbnail=null, $read_more=null)
I'm unsure about how these changes could be implemented, but my guess is that the file blog_cache.xml might be useful to optimize the function listPosts.
Tell me if you find it useful. I could probably help on this.
I'm suggesting and reporting these issues and those in my earlier posts as I find your plugin really useful and a great way to learn GetSimple. Thanks a lot for making it.