<?php
/**********************************************************************************
* Copyright 2004 BIT, Ltd. http://limb-project.com, mailto: support@limb-project.com
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id$
*
***********************************************************************************/
FilterDictionary::registerFilter(new FilterInfo('ip', 'LimbIpFilter', 0, 0), __FILE__);

class LimbIpFilter extends CompilerFilter
{
  function getValue()
  {
    include_once(LIMB_DIR . '/core/http/Ip.class.php');

    if ($this->isConstant())
      return Ip :: decode($this->base->getValue());
    else
      RaiseError('compiler', 'UNRESOLVED_BINDING');
  }

  function generateExpression(&$code)
  {
    $code->registerInclude(LIMB_DIR . '/core/http/Ip.class.php');

    $code->writePHP('Ip :: decode(');
    $this->base->generateExpression($code);
    $code->writePHP(')');
<?php
/**********************************************************************************
* Copyright 2004 BIT, Ltd. http://limb-project.com, mailto: support@limb-project.com
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id: LimbIp.filter.php 1028 2005-01-18 11:06:55Z pachanga $
*
***********************************************************************************/
FilterDictionary::registerFilter(new FilterInfo('LimbI18NNumber', 'LimbLocaleNumberFilter', 0, 5), __FILE__);

class LimbLocaleNumberFilter extends CompilerFilter
{
  var $locale_var;

  function getValue()
  {
    $value = $this->base->getValue();

    $locale_value = $this->_getLocale();

    $toolkit =& Limb :: toolkit();
    $locale =& $toolkit->getLocale($locale_value);

    if(isset($this->parameters[2]) && $this->parameters[2]->getValue())
      $fract_digits = $this->parameters[2]->getValue();
    else
      $fract_digits = $locale->fract_digits;

    if(isset($this->parameters[3]) && $this->parameters[3]->getValue())
<?php
/**********************************************************************************
* Copyright 2004 BIT, Ltd. http://limb-project.com, mailto: support@limb-project.com
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id: String.tag.php 1043 2005-01-21 08:57:12Z seregalimb $
*
***********************************************************************************/

FilterDictionary::registerFilter(new FilterInfo('LimbI18NString', 'LimbLocaleStringFilter', 1, 3), __FILE__);

class LimbLocaleStringFilter extends CompilerFilter
{
  function getValue()
  {
    require_once(LIMB_DIR . '/core/i18n/Strings.class.php');

    $locale_value = $this->_getLocale();

    if(isset($this->parameters[0]) && $this->parameters[0]->getValue())
      $file = $this->parameters[0]->getValue();
    else
      $file = 'common';

    $value = $this->base->getValue();

    if ($this->isConstant())
      return  Strings :: get($value, $file, $locale_value);
    else