예제 #1
0
 protected function get_separator_str($separator)
 {
     if ($this->is_dev()) {
         $separator[2] = \Cibulka::Base('HTML', 'p', array('class' => 'description'), false, $this->get_glue_key(null) . ' / ' . $this->get_glue(null));
     }
     $result = parent::get_separator_str($separator);
     return $result;
 }
예제 #2
0
 protected function extend_attrs(array $attrs)
 {
     $attrs = parent::extend_attrs($attrs);
     $attrs['type'] = 'range';
     $attrs['min'] = $this->config['args']['min'];
     $attrs['max'] = $this->config['args']['max'];
     return $attrs;
 }
예제 #3
0
파일: Brand.php 프로젝트: xxjuan/php-coffee
 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
     $this->name = '品牌(Brand)';
     // 字段名称
     $this->fieldtype = array('smallint' => 5);
     $this->defaulttype = 'smallint';
     // 当用户没有选择字段类型时的缺省值
 }
예제 #4
0
 protected function extend_args(array $args)
 {
     $args = parent::extend_args($args);
     $args = array_replace_recursive(array('default' => false), $args);
     if (empty($args['values'])) {
         throw new \Exception("Radio button must have 'values'.");
     }
     return $args;
 }
예제 #5
0
 public function get_value($field_i = null, $group_i = null, $name = false)
 {
     if (!$this->is_excerpt()) {
         return parent::get_value($field_i, $group_i);
     }
     global $post;
     $excerpt = \Cibulka::Base('Post_Excerpt', $post->ID, false, false);
     return $excerpt;
 }
예제 #6
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
     $this->name = lang('176');
     // 字段名称
     $this->fieldtype = array('TEXT' => '');
     // TRUE表全部可用字段类型,自定义格式为 array('可用字段类型名称' => '默认长度', ... )
     $this->defaulttype = 'TEXT';
     // 当用户没有选择字段类型时的缺省值
 }
예제 #7
0
파일: Group.php 프로젝트: surgeon-xie/jxseo
 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
     $this->name = IS_ADMIN ? lang('293') : '';
     // 字段名称
     $this->fieldtype = '';
     // TRUE表全部可用字段类型,自定义格式为 array('可用字段类型名称' => '默认长度', ... )
     $this->defaulttype = '';
     // 当用户没有选择字段类型时的缺省值
 }
예제 #8
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
     $this->name = lang('m-111');
     // 字段名称
     $this->fieldtype = array('VARCHAR' => '255');
     // TRUE表全部可用字段类型,自定义格式为 array('可用字段类型名称' => '默认长度', ... )
     $this->defaulttype = 'VARCHAR';
     // 当用户没有选择字段类型时的缺省值
 }
예제 #9
0
 public function get_value($field_i = null, $group_item_i = null, $name = false)
 {
     if ($this->config['args']['is_tax_desc']) {
         global $_REQUEST;
         if (!isset($_REQUEST['tag_ID'])) {
             $result = 0;
         } else {
             $tax_id = $_REQUEST['tag_ID'];
             $tax = $_REQUEST['taxonomy'];
             $result = get_term($tax_id, $tax)->description;
         }
     } else {
         $result = parent::get_value($field_i, $group_item_i);
     }
     return $result;
 }
 public function get_value($field_i = null, $group_item_i = null, $name = null)
 {
     if (!$this->config['args']['fix_me']) {
         $result = parent::get_value($field_i, $group_item_i, $name);
     } else {
         if ($this->config['args']['repeatable']) {
             throw new \Exception("Do not fix term_select, if is repeatable");
         }
         global $post;
         $terms = wp_get_object_terms($post->ID, $this->config['args']['taxonomy'], array('fields' => 'ids'));
         if (!empty($terms) && count($terms) === 1) {
             $result = $terms[0];
         } else {
             $result = null;
         }
     }
     return $result;
 }
예제 #11
0
/**
 * 字段输出表单
 *
 * @param	string	$username
 * @return  intval
 */
function dr_field_input($name, $type, $option, $value = NULL, $id = 0)
{
    $ci =& get_instance();
    $ci->load->library('Dfield', array(APP_DIR));
    $field = $ci->dfield->get($type);
    if (!is_object($field)) {
        return NULL;
    }
    A_Field::set_input_format('{value}');
    return preg_replace('/(<div class="on.+<\\/div>)/U', '', $field->input($name, $name, $option, $value, $id));
}
예제 #12
0
 protected function extend_args(array $args)
 {
     $args = parent::extend_args($args);
     $args = array_replace_recursive(array('description' => 'Missing description.', 'html' => ''), $args);
     return $args;
 }
 protected function extend_args(array $args)
 {
     $args = parent::extend_args($args);
     $args = array_replace_recursive(array('allow_new' => false, 'query' => array(), 'print_link' => true), $args);
     return $args;
 }
예제 #14
0
 /**
  * 字段输出表单(兼容老版本)
  *
  * @param	array	$field	字段数组
  * @param	array	$data	表单值
  * @param	bool	$cat	是否显示栏目附加字段
  * @param	string	$id		id字符串
  * @return	string
  */
 public function field_input($field, $data = NULL, $cat = FALSE, $id = 'id')
 {
     return $this->new_field_input($field, $data, $cat, $id);
     exit('此方法已经被废弃');
     $group = array();
     $myfield = $mygroup = $mycat = $mark = '';
     if ($cat == TRUE) {
         $mycat = '<tbody id="dr_category_field"></tbody>';
     }
     if (!$field) {
         return $mycat;
     }
     // 分组字段筛选
     foreach ($field as $t) {
         if ($t['fieldtype'] == 'Group' && preg_match_all('/\\{(.+)\\}/U', $t['setting']['option']['value'], $value)) {
             foreach ($value[1] as $v) {
                 $group[$v] = $t['fieldname'];
             }
         }
     }
     // 字段类
     $this->load->library('dfield', array(APP_DIR));
     $pchtml = $this->get_cache('member', 'setting', 'field');
     $mbhtml = $this->get_cache('member', 'setting', 'mbfield');
     if (!IS_ADMIN) {
         if ($this->mobile && $mbhtml) {
             // 移动端格式
             A_Field::set_input_format($mbhtml);
             unset($mbhtml);
         } elseif ($pchtml) {
             // Pc端格式
             A_Field::set_input_format($pchtml);
             unset($pchtml);
         }
     }
     // 主字段
     foreach ($field as $t) {
         if (!IS_ADMIN && !$t['ismember']) {
             continue;
         }
         $obj = $this->dfield->get($t['fieldtype']);
         if (is_object($obj)) {
             // 百度地图特殊字段
             $value = $t['fieldtype'] == 'Baidumap' ? $data[$t['fieldname'] . '_lng'] && $data[$t['fieldname'] . '_lat'] ? $data[$t['fieldname'] . '_lng'] . ',' . $data[$t['fieldname'] . '_lat'] : $data[$t['fieldname']] : $data[$t['fieldname']];
             $input = $obj->input($t['name'], $t['fieldname'], $t['setting'], $value, isset($data[$id]) ? $data[$id] : 0);
             if (isset($group[$t['fieldname']])) {
                 $input = preg_replace('/(<tr id=.*<td>)/Usi', '', $input);
                 $input = str_replace(array('</td>', '</tr>'), '', $input);
                 $mygroup[$t['fieldname']] = $input;
             } else {
                 // 将栏目附加字段放在内容或者作者上面一行
                 if ($cat == TRUE && $mark == '' && in_array($t['fieldname'], array('content', 'hits'))) {
                     $mark = 1;
                     $myfield .= $mycat;
                 }
                 $myfield .= $input;
             }
         }
     }
     if ($cat == TRUE && $mark == '') {
         $myfield .= $mycat;
     }
     if ($mygroup) {
         foreach ($mygroup as $name => $t) {
             $myfield = str_replace('{' . $name . '}', $t, $myfield);
         }
     }
     return $myfield;
 }
예제 #15
0
 protected function extend_attrs(array $attrs)
 {
     $attrs = parent::extend_attrs($attrs);
     $attrs['type'] = 'text';
     return $attrs;
 }
 protected function extend_args(array $args)
 {
     $args = parent::extend_args($args);
     $args = array_replace(array('timepicker' => true, 'min-date' => false, 'max-date' => false), $args);
     return $args;
 }
예제 #17
0
 static function set_input_format($value)
 {
     self::$format = $value;
 }