PEEL Shopping
Open source ecommerce : PEEL Shopping
Data Structures | Functions
Core.php File Reference

Go to the source code of this file.

Data Structures

class  Twig_Extension_Core
 

Functions

 twig_cycle ($values, $position)
 Cycles over a value. More...
 
 twig_random (Twig_Environment $env, $values=null)
 Returns a random value depending on the supplied parameter type: More...
 
 twig_date_format_filter (Twig_Environment $env, $date, $format=null, $timezone=null)
 Converts a date to the given format. More...
 
 twig_date_modify_filter (Twig_Environment $env, $date, $modifier)
 Returns a new date object modified. More...
 
 twig_date_converter (Twig_Environment $env, $date=null, $timezone=null)
 Converts an input to a DateTime instance. More...
 
 twig_number_format_filter (Twig_Environment $env, $number, $decimal=null, $decimalPoint=null, $thousandSep=null)
 Number format filter. More...
 
 twig_urlencode_filter ($url, $raw=false)
 URL encodes a string as a path segment or an array as a query string. More...
 

Function Documentation

twig_cycle (   $values,
  $position 
)

Cycles over a value.

Parameters
ArrayAccess | array$valuesAn array or an ArrayAccess instance
integer$positionThe cycle position
Returns
string The next value in the cycle

Definition at line 319 of file Core.php.

twig_date_converter ( Twig_Environment  $env,
  $date = null,
  $timezone = null 
)

Converts an input to a DateTime instance.

   {% if date(user.created_at) < date('+2days') %}
     {# do something #}
   {% endif %}
Parameters
Twig_Environment$envA Twig_Environment instance
DateTime | string$dateA date
DateTimeZone | string$timezoneA timezone
Returns
DateTime A DateTime instance

Definition at line 451 of file Core.php.

twig_date_format_filter ( Twig_Environment  $env,
  $date,
  $format = null,
  $timezone = null 
)

Converts a date to the given format.

  {{ post.published_at|date("m/d/Y") }}
Parameters
Twig_Environment$envA Twig_Environment instance
DateTime | DateInterval | string$dateA date
string$formatA format
DateTimeZone | string$timezoneA timezone
Returns
string The formatted date

Definition at line 401 of file Core.php.

twig_date_modify_filter ( Twig_Environment  $env,
  $date,
  $modifier 
)

Returns a new date object modified.

  {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
Parameters
Twig_Environment$envA Twig_Environment instance
DateTime | string$dateA date
string$modifierA modifier string
Returns
DateTime A new date object

Definition at line 428 of file Core.php.

twig_number_format_filter ( Twig_Environment  $env,
  $number,
  $decimal = null,
  $decimalPoint = null,
  $thousandSep = null 
)

Number format filter.

All of the formatting options can be left null, in that case the defaults will be used. Supplying any of the parameters will override the defaults set in the environment object.

Parameters
Twig_Environment$envA Twig_Environment instance
mixed$numberA float/int/string of the number to format
integer$decimalThe number of decimal points to display.
string$decimalPointThe character(s) to use for the decimal point.
string$thousandSepThe character(s) to use for the thousands separator.
Returns
string The formatted number

Definition at line 499 of file Core.php.

twig_random ( Twig_Environment  $env,
  $values = null 
)

Returns a random value depending on the supplied parameter type:

  • a random item from a Traversable or array
  • a random character from a string
  • a random integer between 0 and the integer parameter
Parameters
Twig_Environment$envA Twig_Environment instance
Traversable | array | integer | string$valuesThe values to pick a random item from
Exceptions
Twig_Error_RuntimeWhen $values is an empty array (does not apply to an empty string which is returned as is).
Returns
mixed A random value from the given sequence

Definition at line 341 of file Core.php.

twig_urlencode_filter (   $url,
  $raw = false 
)

URL encodes a string as a path segment or an array as a query string.

Parameters
string | array$urlA URL or an array of query parameters
bool$rawtrue to use rawurlencode() instead of urlencode
Returns
string The URL encoded value

JSON encodes a variable.

Parameters
mixed$valueThe value to encode.
integer$optionsNot used on PHP 5.2.x
Returns
mixed The JSON encoded value

Definition at line 525 of file Core.php.


This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:42 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.