/** * Call an element method * * Runs the method specified in $params on the current element. */ protected function tagElement($params) { if (!isset($this->_element_view) || is_null($element_id = $this->_element_view->key())) { return null; } $element_rows =& $this->_element_view->getProperty('rows'); $element =& $element_rows[$element_id]['object']; if (!method_exists($element, $params)) { return null; } return TIP::toRaw($element->{$params}()); }
/** * Stringify a value to its raw representation * * Converts the given $value to its raw representation. This is * different from a simple (string) cast: booleans, for instance, * are converted to 'true' or 'false', not to '1' or ''. * * Useful on expanding values for eval()ued code. * * @param mixed $value The value to convert * @return string The converted value */ public static function toRaw($value) { if (is_bool($value)) { return $value ? 'true' : 'false'; } elseif (is_numeric($value)) { return (string) $value; } elseif (is_string($value)) { return $value; } elseif (is_array($value)) { // Canonicalize the name return TIP::toRaw(implode(',', $value)); } return ''; }