本文整理汇总了PHP中v类的典型用法代码示例。如果您正苦于以下问题:PHP v类的具体用法?PHP v怎么用?PHP v使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了v类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
function indexAction()
{
if (isset($_POST['check'])) {
if ($_POST['FORM']['ua'] == 'on') {
$_POST['FORM']['ua'] = 1;
} else {
$_POST['FORM']['ua'] = 0;
}
if ($_POST['FORM']['en'] == 'on') {
$_POST['FORM']['en'] = 1;
} else {
$_POST['FORM']['en'] = 0;
}
if ($_POST['FORM']['fr'] == 'on') {
$_POST['FORM']['fr'] = 1;
} else {
$_POST['FORM']['fr'] = 0;
}
if ($_POST['FORM']['esp'] == 'on') {
$_POST['FORM']['esp'] = 1;
} else {
$_POST['FORM']['esp'] = 0;
}
if ($_POST['FORM']['ger'] == 'on') {
$_POST['FORM']['ger'] = 1;
} else {
$_POST['FORM']['ger'] = 0;
}
forms::multy_update_form($this->tablename, 1, 0);
$this->msg = general::messages(1, v::getI18n('backend_after_save'));
}
$sql = "SELECT * FROM languages";
$res = mysql::query_one($sql, 0);
return system::show_tpl(array('obj' => $res, 'msg' => $this->msg, '_status' => isset($_POST['status']) ? $_POST['status'] : 2, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/index.php');
}
示例2: postTransfer
public function postTransfer()
{
try {
if ($this->app->session->phrase != $this->app->request->post("captcha")) {
throw new InvalidCustomException("Captcha yang anda masukan salah");
}
$member_from = $this->app->em->find("Mabes\\Entity\\Member", $this->app->request->post("login_from"));
$member_to = $this->app->em->find("Mabes\\Entity\\Member", $this->app->request->post("login_to"));
v::object()->assert($member_from);
v::object()->assert($member_to);
$transfer = new Transfer();
$transfer->massAssignment($this->app->request->post());
$transfer->setFromLogin($member_from);
$transfer->setToLogin($member_to);
$this->app->em->persist($transfer);
$this->app->em->flush();
$this->app->view()->appendData(["isSuccess" => true, "successTitle" => "Success", "successMessage" => "Transfer Request anda sudah kami terima"]);
} catch (AbstractNestedException $e) {
$errors = $e->findMessages(["numeric" => "{{name}} harus berisi numeric", "alnum" => "{{name}} harus berisi alphanumeric", "email" => "{{name}} harus berisi email yang valid", "float" => "{{name}} harus bernilai desimal", "notEmpty" => "Mohon diisi semua field", "equals" => "{{input}} tidak cocok dengan yang ada didatabase", "object" => "no login tidak dapat ditemukan didalam database", "startsWith" => "Nomor telepon harus berawalan dengan +", 'uploaded' => "file upload gagal"]);
$this->validationMessage($errors);
} catch (InvalidCustomException $e) {
$this->validationMessage(["custom" => $e->getMessage()]);
}
$this->app->render('Pages/_transferBalance.twig');
}
示例3: port
/**
* Returns the port for the given url
*
* @return mixed
*/
public static function port($url = null)
{
if (is_null($url)) {
$url = static::current();
}
$port = intval(parse_url($url, PHP_URL_PORT));
return v::between($port, 1, 65535) ? $port : false;
}
示例4: deleteAction
/**
* delete podrasdel
*/
function deleteAction()
{
$this->msg = general::messages(1, v::getI18n('backend_after_delete'));
// удаляем из таблицы Content
$_sql = 'DELETE FROM `' . $this->tablename . '` WHERE (`id`="' . $_GET['id'] . '")';
$result = mysql::just_query($_sql, 0);
return self::indexAction();
}
示例5: extractAddress
/**
* Extracts the email address from an address string
*
* @return string
*/
protected function extractAddress($string)
{
if (v::email($string)) {
return $string;
}
preg_match('/<(.*?)>/i', $string, $array);
return empty($array[1]) ? $string : $array[1];
}
示例6: validaCaptcha
protected function validaCaptcha()
{
$captcha = f::request('post', 'normal', f::id('captcha'));
if (str_replace(' ', '', strtolower($captcha)) != str_replace(' ', '', strtolower(f::getSession('captcha')))) {
v::setError('El código de la imágen no es válido.');
} else {
f::setSession('captcha', Cifrar::random(10));
}
}
示例7: validate
public function validate()
{
$result = $this->result();
if (empty($result)) {
return !$this->required();
} else {
return v::date($result);
}
}
示例8: logoff
public function logoff()
{
f::setSession('idUsuario', null);
f::setSession('nombre', null);
v::setTrueJSON();
v::setJSON('tag', 'body');
v::setJSON('ubicacion', 'up');
v::setJSON('descripcion', c::getViewSystem('modulos/login/index.php', false));
v::printJSON();
}
示例9: field
public function field($key, $field = null)
{
if (is_null($field)) {
$field = $key;
}
$value = a::get($this->data, $field);
if ($key == 'url' and !v::url($value)) {
$value = null;
}
$this->{$key} = new Field($this->page, $key, esc($value));
}
示例10: connect
/**
* connect to database
* @param none
*/
static function connect()
{
global $dbname;
global $hostname;
global $username;
global $password;
//mysql_connect(v::getConfig('db/host'), v::getConfig('db/user'), v::getConfig('db/password')) or
//die(v::getI18n('mysql_connect_faild'));
mysql_connect($hostname, $username, $password) or die(v::getI18n('mysql_connect_faild'));
$result = mysql_db_query($dbname, "SET CHARACTER SET utf8");
}
示例11: addAction
/**
* добавляем новый материал
*/
function addAction()
{
$this->table_name = $_GET['tablename'];
if ($_POST) {
// проверяем на checkbox
forms::check_box(array('status'));
// записываем в базу
forms::multy_insert_form($this->table_name, 0);
$this->msg = general::messages(1, v::getI18n('backend_after_save'));
}
return system::show_tpl(array('msg' => $this->msg, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/add.php');
}
示例12: validate
public function validate()
{
if (!v::num($this->result())) {
return false;
}
if ($this->min and !v::min($this->result(), $this->min)) {
return false;
}
if ($this->max and !v::max($this->result(), $this->max)) {
return false;
}
return true;
}
示例13: editAction
/**
* редактирование настроек
*/
function editAction()
{
if ($_POST) {
// записываем в базу
forms::multy_update_form_all_records($this->tablename, 'zna', 0);
$this->msg = general::messages(1, v::getI18n('backend_after_save'));
}
// строим запрос
$_sql = 'SELECT * FROM ' . $this->tablename . ' where status=1 order by sort';
// выполняем запрос + при необходимости выводим сам запрос
$result = mysql::query($_sql, 0);
return system::show_tpl(array('result' => $result, 'msg' => $this->msg, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/edit.php');
}
示例14: editAction
/**
* редактируем материал
*/
function editAction()
{
if ($_POST) {
// записываем в базу
forms::multy_update_form($this->tablename, $_POST['id'], 0);
$this->msg = general::messages(1, v::getI18n('backend_after_save'));
$_sql = 'SELECT * FROM ' . $this->tablename . ' where id=' . $_POST['id'];
} else {
$_sql = 'SELECT * FROM ' . $this->tablename . ' where id=' . $_GET['id'];
}
// выполняем запрос + при необходимости выводим сам запрос
$result = mysql::query_one($_sql, 0);
return system::show_tpl(array('obj' => $result, 'msg' => $this->msg, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/edit.php');
}
示例15: validate
public function validate()
{
if ($this->validate and is_array($this->validate)) {
return parent::validate();
} else {
if ($this->min and !v::min($this->result(), $this->min)) {
return false;
}
if ($this->max and !v::max($this->result(), $this->max)) {
return false;
}
}
return true;
}