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


PHP opToolkit::unifyEOLCharacter方法代碼示例

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


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

示例1: run

 public function run()
 {
     $path = $this->options['dir'] . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . $this->options['name'] . '.sql';
     if (!file_exists($path)) {
         throw new RuntimeException('The specified sql doesn\'t exist.');
     }
     $db = $this->getDatabaseManager()->getDatabase('doctrine');
     $this->conn = $db->getDoctrineConnection();
     $this->conn->beginTransaction();
     $this->conn->execute('SET FOREIGN_KEY_CHECKS = 0');
     // for mysql
     $sql = opToolkit::unifyEOLCharacter($this->parseSql($path));
     $queries = explode("\n", $sql);
     try {
         $this->executeQueries($queries);
         $this->conn->commit();
     } catch (Exception $e) {
         $this->conn->rollback();
         $this->conn->execute('SET FOREIGN_KEY_CHECKS = 0');
         // for mysql
         throw $e;
     }
     $this->conn->execute('SET FOREIGN_KEY_CHECKS = 0');
     // for mysql
 }
開發者ID:kawahara,項目名稱:OpenPNE3,代碼行數:25,代碼來源:opUpgradeSQLImportStrategy.class.php

示例2: validate

 public function validate($validator, $value, $arguments = array())
 {
     $value = opToolkit::unifyEOLCharacter($value);
     $list = array_map('trim', explode("\n", $value));
     $list = array_unique($list);
     foreach ($list as $item) {
         if (!preg_match('/^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$/', $item)) {
             throw new sfValidatorError($validator, 'invalid');
         }
     }
     return implode("\n", $list);
 }
開發者ID:nothan,項目名稱:opCCCCPlugin,代碼行數:12,代碼來源:ConfigForm.class.php

示例3: validate

 public function validate($validator, $values, $arguments = array())
 {
     $values = $values + array('pc' => array(), 'mobile' => array(), 'invalid' => array());
     $inputList = explode("\n", opToolkit::unifyEOLCharacter($values['mail_address']));
     $inputList = array_unique(array_map('trim', $inputList));
     foreach ($inputList as $value) {
         try {
             $result = parent::validate($validator, array('mail_address' => $value));
             if (!empty($result['pc_address'])) {
                 $values['pc'][] = $result['pc_address'];
             } elseif (!empty($result['mobile_address'])) {
                 $values['mobile'][] = $result['mobile_address'];
             }
         } catch (sfValidatorError $e) {
             $values['invalid'][] = $value;
         }
     }
     if (empty($values['pc']) && empty($values['mobile'])) {
         throw new sfValidatorError($validator, 'All of the inputted E-mail addresses are invalid.');
     }
     return $values;
 }
開發者ID:kawahara,項目名稱:OpenPNE3,代碼行數:22,代碼來源:AdminInviteForm.class.php


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