Exemplo n.º 1
0
 * @param string
 * @param string
 * @param int plural form (positive number)
 * @param array for vsprintf
 * @return string
 */
function _nx($single, $plural, $number, array $args)
{
    // trigger_error(__FUNCTION__ . '() is deprecated; use __(array(\$single, \$plural), array(\$number, $args[0], $args[1], ...) instead.', E_USER_DEPRECATED);
    return Nette\Environment::getService('translator')->translate(array($single, $plural), array_merge(array($number), $args));
}
// -----------------------------------------------------------------------------
// Extension methods
// -----------------------------------------------------------------------------
Nette\Application\UI\Form::extensionMethod('loadFromEntity', 'vBuilder\\Orm\\FormHelper::loadFromEntity');
Nette\Application\UI\Form::extensionMethod('fillInEntity', 'vBuilder\\Orm\\FormHelper::fillInEntity');
Nette\Forms\Container::extensionMethod('addBootstrapSelect', 'vBuilder\\Forms\\Controls\\BootstrapSelect::addToContainer');
// -----------------------------------------------------------------------------
// Some predefines Route classes
// -----------------------------------------------------------------------------
Route::addStyle('#month');
/// @todo this should accept all translations (because we don't know the language yet)
Route::setStyleProperty('#month', Route::FILTER_IN, function ($val) {
    if (preg_match('/^([a-z]+)-([1-9][0-9]{3})/i', $val, $m)) {
        $months = array_flip(array_map('Nette\\Utils\\Strings::webalize', vBuilder\Utils\DateTime::monthName()));
        if (isset($months[$m[1]])) {
            return $m[2] . '-' . str_pad($months[$m[1]], 2, "0", STR_PAD_LEFT);
        }
    }
    return NULL;
});