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


PHP Formo::splitby方法代码示例

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


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

示例1: check

 public function check($group, $element = '')
 {
     $form = Formo::instance($this->formo_name);
     if (is_object($form->{$group}) and get_class($form->{$group}) == 'Formo_Group') {
         foreach (Formo::splitby($element) as $el) {
             $form->{$group}->{$el}->checked = TRUE;
         }
     } else {
         $form->{$group}->checked = TRUE;
     }
 }
开发者ID:googlecode-mirror,项目名称:s7ncms,代码行数:11,代码来源:radio.php

示例2: add_info

 public function add_info($info)
 {
     $info = Formo::quicktags($info);
     foreach ($info as $k => $v) {
         if ($k == 'source') {
             $this->source = explode('::', $v);
         } elseif ($k == 'data') {
             $this->data = Formo::splitby($v);
         } elseif ($k == 'mode') {
             $this->mode = $v;
         } else {
             $this->{$k} = $v;
         }
     }
 }
开发者ID:carriercomm,项目名称:billing_cart,代码行数:15,代码来源:autocomplete.php

示例3: model

 public function model($model, $method, $data = array(), $construct_data = NULL)
 {
     $this->models[] = array('model' => $model, 'method' => $method, 'data' => Formo::splitby($data), 'construct_data' => $construct_data);
 }
开发者ID:googlecode-mirror,项目名称:s7ncms,代码行数:4,代码来源:mval.php

示例4: validate_this

 protected function validate_this()
 {
     $input = Input::instance();
     $fname = isset($_FILES[$this->name . '_file']) ? $this->name . '_file' : $this->name;
     $file = isset($_FILES[$fname]) ? $_FILES[$fname] : NULL;
     $already_uploaded = $input->post($this->name . '_path') ? TRUE : FALSE;
     $this->was_validated = TRUE;
     if ($this->required and empty($file['name']) and !$already_uploaded) {
         if ($already_uploaded and is_file($input->post($this->name . '_path'))) {
             unlink($input->post($this->name . '_path'));
         }
         $this->error = $this->required_msg;
         return $this->error;
     } elseif (!$this->required and !$input->post($this->name) and empty($file['name'])) {
         return;
     } else {
         $allowed_types = Formo::splitby($this->allowed_types);
         $time = time();
         // this means we're good with the file uploaded already
         if ($already_uploaded === TRUE and !$file['name']) {
             $full_path = $input->post($this->name . '_path');
             $path = array_pop(explode('/', $full_path));
             $file_name = $input->post($this->name);
         } elseif ($file['name']) {
             // delete old entry
             if ($already_uploaded) {
                 $full_path = $input->post($this->name . '_path');
                 $path = array_pop(preg_split('/\\//', $full_path));
                 $file_name = $input->post($this->name);
                 if (is_file($full_path)) {
                     unlink($full_path);
                 }
             }
             // start validating
             if (!upload::required($file)) {
                 return $this->error = Kohana::lang('formo.invalidfile');
             }
             if (!upload::size($file, array($this->max_size))) {
                 return $this->error = Kohana::lang('formo.too_large') . ' (' . $this->max_size . ')';
             }
             if (!upload::type($file, $allowed_types)) {
                 return $this->error = Kohana::lang('formo.invalid_type');
             }
             $full_path = upload::save($fname, $time . $file['name'], DOCROOT . $this->upload_path, 0777);
             $path = array_pop(preg_split('/\\//', $full_path));
             $file_name = $file['name'];
         }
         // fill $this->data with appropriate info
         $this->data['orig_name'] = $file_name;
         $this->data['file_name'] = end(preg_split('/\\//', $full_path));
         $this->data['path'] = preg_replace('/\\/' . $this->data['file_name'] . '/', '', $full_path);
         $this->data['full_path'] = $full_path;
         $this->data['file_ext'] = strtolower(substr(strrchr($file_name, '.'), 1));
         $this->data['file_type'] = reset(Kohana::config('mimes.' . $this->data['file_ext']));
         $this->data['bytes'] = filesize($full_path);
         $this->data['file_size'] = round(filesize($full_path) / 1024, 2);
         $this->data['time'] = $time;
         if ($isize = getimagesize($full_path)) {
             $this->data['is_image'] = 1;
             $this->data['image_width'] = $isize[0];
             $this->data['image_height'] = $isize[1];
             $this->data['image_size_str'] = $isize[3];
         } else {
             $this->data['is_image'] = 0;
             $this->data['image_width'] = NULL;
             $this->data['image_height'] = NULL;
             $this->data['image_size_str'] = NULL;
         }
         $this->value = $this->data;
         // create the extra stuff for saving past, accepted uploads and unvalidated forms
         $this->type = 'text';
         $this->_was_file = TRUE;
         $this->add_class($this->file_link_class);
         $this->value = $file_name;
         $this->readOnly = 'readOnly';
         $this->onClick = 'file_replace(\'' . $this->id . '\')';
         $oldclose = $this->element_close;
         $class = !empty($this->class) ? ' class="' . preg_replace('/ *' . $this->file_link_class . '/', '', $this->class) . '"' : '';
         $this->str = '<input type="text" name="' . $this->name . '" value="' . $this->value . '"' . Formo::quicktagss($this->_find_tags()) . ' />' . '<script type="text/javascript">' . "\n" . 'function file_replace(id){' . "\n" . 'var txt = document.getElementById(id);' . "\n" . 'var file = document.getElementById(id+"_file");' . "\n" . 'txt.style.display = "none";' . "\n" . 'file.style.display = "inline";' . "\n" . '}' . "\n" . '</script>' . "\n" . '<input type="hidden" name="' . $this->name . '_path" id="' . $this->id . '_path" value="' . $full_path . '" />' . "\n" . '<input type="file" name="' . $this->name . '_file" id="' . $this->id . '_file"' . $class . ' style="display:none"/>' . "\n" . $oldclose;
     }
 }
开发者ID:ready4god2513,项目名称:Journal,代码行数:81,代码来源:file.php


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