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


PHP Arrays::stringArray方法代码示例

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


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

示例1: running

 /**
 @param	commands	list of commands to look for in input for running (will only run one, order by priority)
 @param	default	the command to use if none of the provided were found.  Will be run regardless of whether corersponding input command found
 */
 protected function handle($commands = array(), $default = 'read')
 {
     $commands = \Arrays::stringArray($commands);
     $this->attempted = $this->called = array();
     foreach ($commands as $command) {
         if ($this->control->in['_cmd_' . $command]) {
             $return = $this->callFunction($command);
             if ($return === null || $return === false) {
                 continue;
             }
             return new CrudResult($command, $return, $this->control->in['_cmd_' . $command], array('control' => $this));
         }
     }
     if ($default && !in_array($default, $this->attempted)) {
         $return = $this->callFunction($default, $this->control->in['_cmd_' . $command]);
         return new CrudResult($default, $return, null, array('control' => $this));
     }
     return new CrudResult('', null);
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:23,代码来源:Crud.php

示例2: getAttributes

 static function getAttributes($tag, $attributes)
 {
     $attributes = Arrays::stringArray($attributes);
     $collected = array();
     foreach ($attributes as $attribute) {
         preg_match('@' . $attribute . '=([\'"]).+?\\1@i', $tag, $match);
         if ($match) {
             $collected[] = $match[0];
         }
     }
     return $collected;
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:12,代码来源:InputFilter.php

示例3: prepend

 static function prepend($rule, $rules)
 {
     $rules = Arrays::stringArray($rules);
     array_unshift($rules, $rule);
     return $rules;
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:6,代码来源:Field.php

示例4: row

 /**
 Ex: 
 	- row('select * from user where id = 20') vs row('user',20);
 	- rows('select name from user where id > 20') vs sRows('user',array('id?>'=>20),'name')
 @param	from	table, array of tables, or from statement
 @param	where	see self::$where()
 @param	columns	list of columns; either string or array.	"*" default.
 @param	order	order by columns
 @param	limit	result limit
 @return sql string
 @note	this function is just designed for simple queries
 */
 protected function select($from, $where = null, $columns = '*', $order = null, $limit = null)
 {
     if (is_array($from)) {
         $from = '"' . implode('", "', $from) . '"';
     } elseif (strpos($from, ' ') === false) {
         //ensure no space; don't quote a from statement
         $from = '"' . $from . '"';
     }
     if (is_array($columns)) {
         $columns = implode(', ', array_map([$this, 'quoteIdentity'], $columns));
     }
     $select = 'SELECT ' . $columns . "\nFROM " . $from . $this->where($where);
     if ($order) {
         if (!is_array($order)) {
             $order = Arrays::stringArray($order);
         }
         $orders = array();
         foreach ($order as $part) {
             $part = explode(' ', $part);
             if (!$part[1]) {
                 $part[1] = 'ASC';
             }
             //'"' works with functions like "sum(cost)"
             $orders[] = '"' . $part[0] . '" ' . $part[1];
         }
         $select .= "\nORDER BY " . implode(',', $orders);
     }
     if ($limit) {
         $select .= "\nLIMIT " . $limit;
     }
     return $select;
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:44,代码来源:Db.php

示例5: part

 /**
 @param	rules	string or array	
 	Rules can be an array of rules, or a string separated by "," for each rule.  
 	Each rule can be a string or an array.  
 	As a string, the rule should be in one of the following forms:
 			"f:name|param1;param2" indicates InputFilter method
 			"v:name|param1;param2" indicates InputValidate function
 			"g:name|param1;param2" indicates global scoped function
 			"class:name|param1,param2,param3" indicates static method "name: of class "class" 
 			"l:name|param1,param2,param3" Local tool method
 			"name" replaced by Field fieldType of the same name
 	As an array, the rule function part (type:method) is the first element, and the parameters to the function part are the following elements.  Useful if function arguments contain commas or semicolons.  Ex:
 		array('type:method','arg1','arg2','arg3')
 	
 	The "type:method" part can be prefixed with "!" to indicate there should be a break on error, and no more rules for that field should be applied
 	The "type:method" part can be prefixed with "!!" to indicate there should be a break on error and no more rules for any field should be applied
 	
 	If array, first part of rule is taken as string with the behavior above without parameters and the second part is taken as the parameters; useful for parameters that include commas or semicolons or which aren't strings
 	
 	Examples for rules:
 		1: 'v:email|bob.com,customClass:method|param1;param2',
 		2: array('v:email|bob.com','customClass:method|param1;param2'),
 		3: array(array('v:email','bob.com'),array('customClass:method','param1','param2')),
 */
 function applyFilterValidateRules($field, $rules, $errorOptions)
 {
     $originalRules = $rules;
     $rules = Arrays::stringArray($rules);
     for ($i = 0; $i < count($rules); $i++) {
         $rule = $rules[$i];
         $params = array(&$this->in[$field]);
         if (is_array($rule)) {
             $callback = array_shift($rule);
             $params2 =& $rule;
         } else {
             list($callback, $params2) = explode('|', $rule);
             if ($params2) {
                 $params2 = explode(';', $params2);
             }
         }
         ///merge field value param with the user provided params
         if ($params2) {
             Arrays::mergeInto($params, $params2);
         }
         //used in combination with !, like ?! for fields that, if not empty, should be validated, otherwise, ignored.
         $ignoreError = false;
         if (substr($callback, 0, 1) == '?') {
             $callback = substr($callback, 1);
             $ignoreError = true;
         }
         if (substr($callback, 0, 2) == '!!') {
             $callback = substr($callback, 2);
             $superBreak = true;
         }
         if (substr($callback, 0, 1) == '!') {
             $callback = substr($callback, 1);
             $break = true;
         }
         list($type, $method) = explode(':', $callback, 2);
         if (!$method) {
             $method = $type;
             $type = '';
         }
         if (!$method) {
             Debug::quit('Failed to provide method for input handler on field: ' . $field, 'Rules:', $rules);
         }
         try {
             switch ($type) {
                 case 'f':
                     call_user_func_array(array('InputFilter', $method), $params);
                     break;
                 case 'v':
                     call_user_func_array(array('InputValidate', $method), $params);
                     break;
                 case 'l':
                     call_user_func_array(array($this->lt, $method), $params);
                     break;
                 case 'g':
                     call_user_func_array($method, $params);
                     break;
                 case '':
                     if ($this->inputRuleAliases === null) {
                         $this->inputRuleAliases = \control\Field::$ruleAliases;
                     }
                     //get new named rules and parse
                     if (!$this->inputRuleAliases[$method]) {
                         Debug::toss('Unknown input rule alias on field ' . $field . ' Rule:' . $rule);
                     }
                     $newRules = Arrays::stringArray($this->inputRuleAliases[$method]);
                     if ($i + 1 < count($rules)) {
                         ///there are rules after this alias, so combine alias with those existing after
                         $newRules = array_merge($newRules, array_slice($rules, $i + 1));
                     }
                     $rules = $newRules;
                     $i = -1;
                     break;
                 default:
                     call_user_func_array(array($type, $method), $params);
                     break;
             }
//.........这里部分代码省略.........
开发者ID:jstacoder,项目名称:brushfire,代码行数:101,代码来源:Control.php

示例6: notMime

 /**
 @param	mimes	array of either whole mimes "part/part", or the last part of the mime "part"
 */
 static function notMime($v, $name, $mimes)
 {
     $mimes = Arrays::stringArray($mimes);
     $mime = File::mime($_FILES[$name]['tmp_name']);
     foreach ($mimes as $matchMime) {
         if (preg_match('@' . preg_quote($matchMime) . '$@', $mime)) {
             $mimes = implode(', ', $mimes);
             Debug::toss(sprintf(self::$errorMessages['notMime'], $mimes), 'InputException');
         }
     }
     return true;
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:15,代码来源:InputValidate.php

示例7: gets

 function gets($concerns, $crudType = null)
 {
     $crudType = $this->getCrudType($crudType);
     $concerns = Arrays::stringArray($concerns);
     foreach ($concerns as $concern) {
         $concernsData[$concern] = $this->get($concern, $crudType);
     }
     return $concernsData;
 }
开发者ID:jstacoder,项目名称:brushfire,代码行数:9,代码来源:CrudPage.php


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