public function tokenValueFromArrayParam($token_data, $language, $options = array()) {
        // if you provided an array, it better have some values
        if (count($token_data) == 0)
            return $this->error("Invalid number of params of an array");

        $object = $token_data[0];
        $method = count($token_data) > 1 ? $token_data[1] : null;

        // if the first value of an array is an array handle it here
        if (is_array($object) && !(ArrayUtils::isHash($object))) {
            return $this->tokenValuesFromArray($token_data, $language, $options);
        }

        if ($method == null)
            return $this->sanitize("" . $object, $object, $language, array_merge($options, array("safe" => true)));

        if (is_string($method)) {
            if (preg_match('/^@/', $method))
                return $this->tokenValueFromObjectUsingAttributeMethod($object, $method, $language, $options);
            return $this->sanitize($method, $object, $language, array_merge($options, array("safe" => true)));
        }

        return $this->error("Unsupported second array value");
    }
public function tokenValueFromArrayParam($token_data, $language, $options = array()) {
        // if you provided an array, it better have some values
        if (count($token_data) == 0)
            return $this->error("Invalid number of params of an array");

        $object = $token_data[0];
        $method = count($token_data) > 1 ? $token_data[1] : null;

        // if the first value of an array is an array handle it here
        if (is_array($object) && !(ArrayUtils::isHash($object))) {
            return $this->tokenValuesFromArray($token_data, $language, $options);
        }

        if ($method == null)
            return $this->sanitize("" . $object, $object, $language, array_merge($options, array("safe" => true)));

        if (is_string($method)) {
            if (preg_match('/^@/', $method))
                return $this->tokenValueFromObjectUsingAttributeMethod($object, $method, $language, $options);
            return $this->sanitize($method, $object, $language, array_merge($options, array("safe" => true)));
        }

        return $this->error("Unsupported second array value");
    }
public function tokenValueFromArrayParam ( $ token_data , $ language , $ options = array ( ) ) { // if you provided an array, it better have some values if ( count ( $ token_data ) == 0 ) return $ this -> error ( "Invalid number of params of an array" ) ; $ object = $ token_data [ 0 ] ; $ method = count ( $ token_data ) > 1 ? $ token_data [ 1 ] : null ; // if the first value of an array is an array handle it here if ( is_array ( $ object ) && ! ( ArrayUtils :: isHash ( $ object ) ) ) { return $ this -> tokenValuesFromArray ( $ token_data , $ language , $ options ) ; } if ( $ method == null ) return $ this -> sanitize ( "" . $ object , $ object , $ language , array_merge ( $ options , array ( "safe" => true ) ) ) ; if ( is_string ( $ method ) ) { if ( preg_match ( '/^@/' , $ method ) ) return $ this -> tokenValueFromObjectUsingAttributeMethod ( $ object , $ method , $ language , $ options ) ; return $ this -> sanitize ( $ method , $ object , $ language , array_merge ( $ options , array ( "safe" => true ) ) ) ; } return $ this -> error ( "Unsupported second array value" ) ; }
gets the value based on various evaluation methods

examples:

tr("Hello {user}", array("user" => array($current_user, $current_user->name)))
tr("Hello {user}", array("user" => array($current_user, "@name")))
tr("Hello {user}", array("user" => array($current_user, "@@firstName")))

tr("Hello {user}", {:user => array(array("name" => "Michael", "gender" => "male"), "Michael")))
tr("Hello {user}", {:user => array(array("name" => "Michael", "gender" => "male"), "@name")))

@param $array
@param $language
@param $options
gets the value based on various evaluation methods