當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Languages::classXML方法代碼示例

本文整理匯總了PHP中Languages::classXML方法的典型用法代碼示例。如果您正苦於以下問題:PHP Languages::classXML方法的具體用法?PHP Languages::classXML怎麽用?PHP Languages::classXML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Languages的用法示例。


在下文中一共展示了Languages::classXML方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Run as first
  */
 public function __construct()
 {
     $objLanguages = new Languages();
     $this->_lang = $objLanguages->classXML('scripts.xml');
 }
開發者ID:kas-test,項目名稱:framework,代碼行數:8,代碼來源:SendEmail.php

示例2: checkFields

 /**
  * Probe all data in form and give errors in case of input failed
  * @param array $data
  */
 public function checkFields($data)
 {
     $objLanguages = new Languages();
     $lang = $objLanguages->classXML('scripts.xml');
     foreach ($data as $key => $value) {
         // Required fields
         if ($value[0] == null && $value[1] == true) {
             $data[$key] = array($value[0], 'error' => true);
             $data['errmsg'] = $lang->emptyFields;
         }
         // Check email format
         if ($value[2] == 'email') {
             if (!preg_match('^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-.]?[0-9a-zA-Z])*\\.[a-zA-Z]{2,4}$^', $value[0])) {
                 $data[$key] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->noEmail;
                 }
             }
         }
         // Check string format
         if ($value[2] == 'string') {
             if (!preg_match('/^./', $value[0])) {
                 // @TODO: Check the correct format
                 $data[$key] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->onlyString;
                 }
             }
         }
         // Check text format
         if ($value[2] == 'text') {
             if (!preg_match('/^[a-zA-Z]/', $value[0])) {
                 $data[$key] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->onlyText;
                 }
             }
         }
         // Check date format
         if ($value[2] == 'date') {
             if (!preg_match('/^[0-9]{2}+\\.[0-9]{2}+\\.[0-9]{4}/', $value[0])) {
                 $data[$key] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->onlyDate;
                 }
             }
         }
         // Check password format
         if ($value[2] == 'pw') {
             if (!preg_match('/^[a-zA-Z0-9]{5,}/', $value[0])) {
                 $data[$key] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->tooShort;
                 }
             }
         }
         // Check password identical
         if ($value[2] == 'pwa') {
             if ($value[0] != $data['pw'][0]) {
                 $data[$key] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->noEqualPw;
                 }
             }
         }
         // Check captcha code
         if ($value[2] == 'captcha') {
             if ($data['code'][0] != $_SESSION['cptCode']) {
                 $data['code'] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->noCaptcha;
                 }
             }
         }
         // Check zip code
         if ($value[2] == 'postCode') {
             if (!preg_match('/^[0-9]{5}/', $value[0])) {
                 $data[$key] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->noPostCode;
                 }
             }
         }
         // Check string without spaces
         if ($value[2] == 'oneWord') {
             if (strstr($value[0], ' ')) {
                 $data[$key] = array($value[0], 'error' => true);
                 if (!isset($data['errmsg'])) {
                     $data['errmsg'] = $lang->noSpaces;
                 }
             }
         }
         // Check string without spaces
         if ($value[2] == 'select') {
             if (!$value[0]) {
                 $data[$key] = array($value[0], 'error' => true);
//.........這裏部分代碼省略.........
開發者ID:kas-test,項目名稱:framework,代碼行數:101,代碼來源:FormValidate.php


注:本文中的Languages::classXML方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。