<?php

/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 4.X
 *	LICENSE: FL0M2SG681CQ - http://www.flynax.com/license-agreement.html
 *	PRODUCT: Pets Classifieds
 *	DOMAIN: pupsnshop.com
 *	FILE: RLSMARTY.CLASS.PHP
 *
 *	The software is a commercial product delivered under single, non-exclusive, 
 *	non-transferable license for one domain or IP address. Therefore distribution, 
 *	sale or transfer of the file in whole or in part without permission of Flynax 
 *	respective owners is considered to be illegal and breach of Flynax License End 
 *	User Agreement. 
 *
 *	You are not allowed to remove this information from the file without permission
 *	of Flynax respective owners.
 *
 *	Flynax Classifieds Software 2014 |  All copyrights reserved. 
 *
 *	http://www.flynax.com/
 *
 ******************************************************************************/

class rlSmarty
{
	/**
	* Convert string to url path
	*
	* @param string $string - string
	**/
	function str2path($string = false)
	{
		return $GLOBALS['rlValid'] -> str2path($string);
	}

	/**
	* Convert to money format
	*
	* @param string $string
	**/
	function str2money($string = false)
	{
		$len = strlen($string);
		$string = strrev($string);

		if ( strpos($string, '.') )
		{
			$rest = substr($string, 0, strpos($string, '.'));
			$string = substr($string, strpos($string, '.') + 1, $len);
			$len -= strlen($rest) + 1;
			$rest = strrev(substr(strrev($rest), 0, 2)) .".";
		}
		elseif ( $GLOBALS['config']['show_cents'] )
		{
			$rest = '00.';
		}

		for ($i = 0; $i <= $len; $i++)
		{
			$val .= $string[$i];
			if ( ( ( $i + 1 ) % 3 == 0 ) && ( $i + 1 < $len ) )
			{
				$val .= $GLOBALS['config']['price_delimiter'];
			}
		}
		return strrev($rest . $val);
	}

	/**
	* blank flange
	**/
	function assign_by_ref() {}
	function assign() {}
	function register_compiler_function() {}
}