当前位置: 首页>>代码示例>>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;未经允许,请勿转载。