<?php
#CMS - CMS Made Simple
#
# Type:		Tag
# Name:		lorem_ipsum
# Purpose:	Populate content with a given number of lorem ipsum paragraphs.
# Version:	1.0
# Date:		18 November 2009
# Author:	Fernando Morgado (JoMorg)
# Link:		NA
# Example:	{lorem_ipsum}
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; version 2 of the License
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

function smarty_cms_function_lorem_ipsum( $params, &$smarty )
{


	$loremparag = '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>';
	$paragnum = 1;
	if (isset($params['paragnum'])) $paragnum = $params['paragnum'];

	
	if ($paragnum > 10) {
		$paragnum = 10;
	} // if
	
	if ($paragnum < 1) {
		$paragnum = 1;
	} // if
	
	$output = '<!-- Lorem Ipsum Start -->  ';

	$i = 0;
	while ($i < $paragnum) {
		$output = $output . $loremparag;
			++$i;
	} // while


	$output = $output . '<!-- Lorem Ipsum End -->';

	return $output;
}

function smarty_cms_help_function_lorem_ipsum()
{
?>
<h3>What does this do?</h3>
<p>This tag populates content with a given number (up to ten) of Lorem Ipsum paragraphs.</p>
<h3>How do I use it?</h3>

<p>1. Insert tag <strong>{lorem_ipsum}</strong> in your content textarea or template:<br /><br />
 <code>{lorem_ipsum paragnum=1}</code>

<h3>What parameters does it take?</h3>
<p>Only one, optional: <tt>paragnum</tt><br />

<ul>
<li><em>(optional)</em> <tt>paragnum</tt> - A number between 1 and 10: the number of paragraphs</li>
</ul>

</p>
<?php
}

function smarty_cms_about_function_lorem_ipsum()
{
?>
<p>Author: Fernando Morgado (JoMorg)</p>
<p>Version: 1.0</p>
<p>Change History:<br />
1.0 - Initial release<br />
</p>
<?php
}
?>