function get_index($langName = null, $tag = null) { $text = trim($langName ? __($langName)->get() : $this->viewData('title')); $tag or $tag = $langName ? 'h2' : 'h1'; is_numeric($tag) and $tag = "h{$tag}"; if ($text === '') { return ''; } else { $html = $this->in('html', false) ? $text : HLEx::q($text); return compact('tag', 'html'); } }
<?php namespace VaneMart; use Px\Query; use Vane\Mail; use Vane\Current; /*----------------------------------------------------------------------- | GENERAL LISTENERS |----------------------------------------------------------------------*/ // Fires to get HTML representation of user message $text (can be used to attach // BB-code processor, Markdown, wiki, etc.). // //= str HTML Event::listen(VANE_NS . 'format.generic', function (&$text) { return nl2br(HLEx::q($text)); }); Event::listen(VANE_NS . 'format.post', function (&$text) { return format('generic', $text); }); Event::listen(VANE_NS . 'format.product', function (&$text) { return format('generic', $text); }); /*----------------------------------------------------------------------- | FILE MODEL |----------------------------------------------------------------------*/ // Fired to determine local path for storing File data. // //* $path str - can be '' to get root folder's path; guaranteed to be safe (no '..'). // //= str absolute path
function q($str, $quotes = ENT_COMPAT, $doubleEncode = true) { return HLEx::q($str, $quotes, $doubleEncode); }