当前位置: 首页>>代码示例>>PHP>>正文


PHP Validator::run方法代码示例

本文整理汇总了PHP中Validator::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::run方法的具体用法?PHP Validator::run怎么用?PHP Validator::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validator的用法示例。


在下文中一共展示了Validator::run方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: is_valid

 /**
  * Shorthand method for inline validation
  *
  * @param array $data The data to be validated
  * @param array $validators The GUMP validators
  * @return mixed True(boolean) or the array of error messages
  */
 public static function is_valid(array $data, array $validators)
 {
     $validator = new Validator();
     $validator->validation_rules($validators);
     if ($validator->run($data) === false) {
         return $validator->get_readable_errors(false);
     } else {
         return true;
     }
 }
开发者ID:sergey-sla,项目名称:framework,代码行数:17,代码来源:Validator.php

示例2: mdControl

function mdControl($xmlSource)
{
    // podle jednoho validatoru
    if ($xmlSource == '') {
        return array();
    }
    include PHPINC_DIR . "/../validator/resources/Validator.php";
    $validator = new Validator("gmd", MICKA_LANG);
    $validator->run($xmlSource);
    $a = $validator->asArray();
    for ($i = 0; $i < count($a); $i++) {
        $d = explode('(', $a[$i]['description']);
        $a[$i]['description'] = $d[0];
    }
    return $a;
}
开发者ID:riskatlas,项目名称:micka,代码行数:16,代码来源:micka_lib_xml.php

示例3: deleteAction

 public function deleteAction()
 {
     $params = Request::getParams();
     $validator = new Validator();
     $params = $validator->sanitize($params);
     $validator->validation_rules(array("id" => "required|numeric|checkIfRecordIdExists"));
     $validated_data = $validator->run($params);
     if ($validated_data === false) {
         Response::setStatus(404);
         $returnArray = array("error" => "Invalid data was sent", "messages" => $validator->get_readable_errors());
     } else {
         $model = new Model_Record();
         $model->delete($params['id']);
         Response::setStatus(204);
         $returnArray = array();
     }
     return $returnArray;
 }
开发者ID:blindly,项目名称:ginger-pdns-api,代码行数:18,代码来源:Record.php

示例4: getCommandName

                }
            }
            $table->render();
        } else {
            $io->success('No issues found.');
        }
        return count($messages);
    }
}
final class Validator extends Application
{
    protected function getCommandName(InputInterface $input)
    {
        return 'validate';
    }
    protected function getDefaultCommands()
    {
        $defaultCommands = parent::getDefaultCommands();
        $defaultCommands[] = new Validate();
        return $defaultCommands;
    }
    public function getDefinition()
    {
        $inputDefinition = parent::getDefinition();
        $inputDefinition->setArguments();
        return $inputDefinition;
    }
}
$application = new Validator();
$application->run();
开发者ID:sensiolabs,项目名称:security-advisories,代码行数:30,代码来源:validator.php

示例5: updateMd


//.........这里部分代码省略.........
                         $poly = $row['MD_VALUE'];
                     }
                     if ($row['MD_ID'] == 11 || $row['MD_ID'] == 5063) {
                         $title = $row['MD_VALUE'];
                         if ($lang_main == $row['LANG']) {
                             $title_lang_main = $row['MD_VALUE'];
                         }
                     }
                     break;
                 case 1:
                     if ($row['MD_ID'] == 14) {
                         $dc_geom = $row['MD_VALUE'];
                     }
                     if ($row['MD_ID'] == 11) {
                         $title = $row['MD_VALUE'];
                     }
                     break;
                 case 2:
                     if ($row['MD_ID'] == 11) {
                         $title = $row['MD_VALUE'];
                     }
                     break;
             }
         }
         $data = $data + $this->getGeom($x1, $y1, $x2, $y2, $poly, $dc_geom);
         $title = $title_lang_main != '' ? $title_lang_main : $title;
         $data['title'] = $title != '' ? $title : NULL;
     }
     $this->setMd($recno, $data);
     // update datestamp v md_values
     if ($this->md_record['md']['MD_STANDARD'] == 0 || $this->md_record['md']['MD_STANDARD'] == 10) {
         $this->setMdValuesDateStamp($this->md_record['md']['RECNO'], $this->md_record['md']['MD_STANDARD'], $update = TRUE);
     }
     // xmldata
     $xml = $this->getMdXmlData($this->md_record['md']['UUID']);
     if ($xml != '') {
         if (DB_DRIVER == 'oracle') {
             $conn = dibi::getConnection()->driver->getResource();
             setXmlToClob($conn, $this->table_md, 'xmldata', "recno={$recno}", $xml);
             //$data['pxml%sql'] = "XMLType('$xml')";
             //$data['xmldata'] = $xml;
         } elseif (DB_DRIVER == 'mssql2005') {
             // XMLDATA
             $data['xmldata'] = $xml;
         } elseif (DB_DRIVER == 'postgre') {
             // XMLDATA
             $data['xmldata'] = $xml;
         } elseif (DB_DRIVER == 'postgre_pxml') {
             $xml = str_replace("'", "&#39;", $xml);
             $data['pxml%sql'] = "XMLPARSE(DOCUMENT '{$xml}')";
         } else {
             $data['pxml'] = $xml;
         }
     }
     // --- validace XML ve vestavenem validatoru ---
     $data['valid'] = 0;
     $data['prim'] = 0;
     if (VALIDATOR == 1) {
         require_once WWW_DIR . '/validator/resources/Validator.php';
         $validator = new Validator();
         $validator->run($xml);
         $vResult = $validator->getPass();
         switch ($this->report_valid_type['type']) {
             case 'xml':
                 $this->md_record['report_valid'] = $validator->asXML($this->report_valid_type['short']);
                 break;
             case 'json':
                 $this->md_record['report_valid'] = $validator->asJSON();
                 break;
             case 'array':
                 $this->md_record['report_valid'] = $validator->asArray($this->report_valid_type['short']);
                 break;
             case 'html':
                 $this->md_record['report_valid'] = $validator->asHTML($this->report_valid_type['short']);
                 break;
             case 'htmlsmall':
                 $this->md_record['report_valid'] = $validator->asHTMLSmall($this->report_valid_type['short']);
                 break;
             default:
                 $this->md_record['report_valid'] = $validator->asHTML();
                 break;
         }
         if ($vResult) {
             if ($vResult['fail'] > 0) {
                 $data['valid'] = 0;
             } else {
                 if ($vResult['warn'] > 0) {
                     $data['valid'] = 1;
                 } else {
                     $data['valid'] = 2;
                 }
             }
             $data['prim'] = $vResult['primary'];
         }
         setMickaLog("VALIDACE valid=" . $data['valid'], 'DEBUG', 'MdRecord.updateMd');
     }
     $this->setMd($recno, $data);
     setXmldata2Pxml($this->table_md, $recno);
     return $rs;
 }
开发者ID:riskatlas,项目名称:micka,代码行数:101,代码来源:MdRecord.php

示例6: catch

        }
        if (!strpos(strtolower($url), "request=")) {
            $url .= "&REQUEST=GetCapabilities";
        }
        //echo $url; exit;
    }
    try {
        $data = file_get_contents($url);
    } catch (Exception $e) {
        die("source not found.");
    }
}
if (!$data) {
    die("Data not entered");
}
$validator->run($data);
switch (htmlspecialchars($_REQUEST['format'])) {
    case "application/json":
        header("Content-type: application/json charset=\"utf-8\"");
        echo $validator->asJSON();
        break;
    case "application/xml":
        header("Content-type: application/xml charset=\"utf-8\"");
        echo $validator->result;
        break;
    case "array":
        var_dump($validator->asArray($short));
        break;
    default:
        if ($_REQUEST['head'] != 'false') {
            ?>
开发者ID:riskatlas,项目名称:micka,代码行数:31,代码来源:validator.php

示例7: mainValid

function mainValid($uuid)
{
    $rs = array();
    $rs['akce'] = 'error';
    $rs['ok'] = FALSE;
    $rs['report'] = '';
    $rs['data'] = '';
    if ($uuid == '') {
        //$rs['report'] = 'Identifier not found!';
        //return $rs;
        require PHPINC_DIR . '/templates/404_record.php';
    }
    $table = 'md';
    $md_record = new MdRecord();
    $md_record->setTableMode($table);
    $record = $md_record->getMd('uuid', $uuid);
    if (is_array($record) && count($record) > 0) {
        if ($record['report'] == 'ok') {
            $rs['akce'] = '_valid';
            require_once WWW_DIR . '/validator/resources/Validator.php';
            $lang_valid = MICKA_LANG == 'cze' ? 'cze' : 'eng';
            $validator = new Validator('gmd', $lang_valid);
            $validator->run($record['md']['PXML']);
            $rs['data'] = $validator->asHTML();
            $rs['ok'] = TRUE;
        } else {
            //$rs['akce'] = 'error';
            //$rs['report'] = $record['report'];
            require PHPINC_DIR . '/templates/404_record.php';
        }
    }
    return $rs['data'];
}
开发者ID:riskatlas,项目名称:micka,代码行数:33,代码来源:micka_main_lib.php

示例8: snippet

<?php

$validator = new Validator();
if (isset($_POST['submit'])) {
    $validator->add_rule('contactname', 'Name', 'required');
    $validator->add_rule('email', 'Email', 'required|email');
    $validator->add_rule('message', 'Message', 'required|min(5)');
    $validator->custom_message('email', 'required', "Please enter your email, this will only be used to respond to your message");
    $validator->custom_message('email', 'email', "Please enter a valid email, this will only be used to respond to your message");
    if ($validator->run() == true) {
        $email = new Email(array('to' => c::get('site_email'), 'from' => 'Aurer emailer <noreply@aurer.co.uk>', 'subject' => $validator->get_value('subject', 'Response from the Aurer site'), 'body' => $validator->get_value('contactname') . " sent you a message\n\n" . $validator->get_value('message') . "\n\n" . $validator->get_value('email'), 'service' => 'mailgun', 'options' => array('key' => c::get('mailgun_key'), 'domain' => c::get('mailgun_domain'))));
        if ($email->send()) {
            s::set('email_sent', true);
            go($page->url());
        } else {
            s::set('email_sent', false);
            message::set('mail_error', 'It appears your message cannot be sent right now, many appologies.', 'error');
            go($page->url());
        }
    }
}
?>

<?php 
echo snippet('header');
?>

<div class="section section--contact">
	<div class="section-inner">
		<h1><?php 
echo html($page->title());
开发者ID:aoimedia,项目名称:aurer-kirby,代码行数:31,代码来源:contact.php

示例9: NewsFeed

/**
 * Created by PhpStorm.
 * User: Asus
 * Date: 5/30/2015
 * Time: 10:35 AM
 */
if (isset($_POST['save_feed'])) {
    require_once "../../includes/loader.php";
    if (isset($_POST['Id'])) {
        $feed = new NewsFeed(get_input("Id"));
    } else {
        $feed = new NewsFeed();
    }
    $validator = new Validator();
    $rules = array("Name" => "required", "PH_NO" => "required|numeric", "PostTitle" => "required", "PostDetail" => "required");
    $validator->run($rules);
    if (!$validator->fails()) {
        $feed->Name = get_input("Name");
        $feed->PH_NO = get_input("PH_NO");
        $feed->PostTitle = get_input("PostTitle");
        $feed->PostDetail = get_input("PostDetail");
        $feed->save();
        $messages = array("success" => 1, "message" => array("status" => "News Feed Sucessfully posted"));
    } else {
        $messages["message"] = $validator->getMessages();
        $messages["success"] = 0;
        Validator::reset();
    }
} else {
    $messages["message"] = array("status" => "Not enough Data Provided");
    $messages["success"] = 0;
开发者ID:amriterry,项目名称:HelpNepal,代码行数:31,代码来源:save.php

示例10: reset

       reset($_REQUEST);
       //header("Pragma: no-cache");
       //header('Content-Disposition: attachment; filename="metadata_'.$_REQUEST['md']['fileIdentifier'].'.xml"');
       echo $cswClient->processTemplate($input, dirname(__FILE__) . '/resources/kote2iso.xsl', $params);
   } else {
       if ($_REQUEST["action-eu"]) {
           $xml = $cswClient->processTemplate($input, 'resources/kote2iso.xsl', $params);
           echo Kote::postFileForm(JRC_VALIDATOR, $xml);
       } else {
           if ($_REQUEST["action-cr"]) {
               echo '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
 	<link rel="stylesheet" type="text/css" href="../validator/style/validator.css"/></head><body>';
               $xml = $cswClient->processTemplate($input, dirname(__FILE__) . '/resources/kote2iso.xsl', $params);
               include dirname(__FILE__) . "/../validator/resources/Validator.php";
               $validator = new Validator();
               $validator->run($xml);
               echo $validator->asHTML();
           } else {
               if ($_REQUEST["action-html"]) {
                   echo "comming soon...";
                   //$s = $cswClient->processTemplate($input,'resources/kote2iso.xsl', $params);
                   //echo $cswClient->processTemplate($s,'../include/xsl/iso2html.xsl', $params);
               } else {
                   if ($_REQUEST["action-paspprint"]) {
                       $s = $cswClient->processTemplate($input, dirname(__FILE__) . 'resources/kote2iso.xsl', $params);
                       $par['komu'] = $_REQUEST['md']['komu'];
                       $par['cislo'] = $_REQUEST['md']['cislo'];
                       echo $cswClient->processTemplate($s, PHPPRG_DIR . '/../xsl/iso2pasport.xsl', $par);
                   } else {
                       if ($_REQUEST["action-pasport"]) {
                           echo $cswClient->processTemplateFile('', dirname(__FILE__) . '/resources/kote_pass.xsl');
开发者ID:riskatlas,项目名称:micka,代码行数:31,代码来源:index.php


注:本文中的Validator::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。