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


PHP JCckPluginField::g_onCCK_FieldPrepareForm_Validation方法代码示例

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


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

示例1: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $field->bool2 ? self::_p2nl($value) : self::_br2nl($value) : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true, 'maxSize' => true));
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $class = 'inputbox textarea' . $validate . ($field->css ? ' ' . $field->css : '');
     $cols = $field->cols ? $field->cols : 25;
     $rows = $field->rows ? $field->rows : 3;
     $attr = 'class="' . $class . '"';
     if ($field->attributes != '') {
         if (strpos($field->attributes, 'J(') !== false) {
             $matches = '';
             $search = '#J\\((.*)\\)#U';
             preg_match_all($search, $field->attributes, $matches);
             if (count($matches[1])) {
                 foreach ($matches[1] as $text) {
                     $field->attributes = str_replace('J(' . $text . ')', JText::_('COM_CCK_' . str_replace(' ', '_', trim($text))), $field->attributes);
                 }
             }
         }
         $attr .= ' ' . $field->attributes;
     }
     $form = '<textarea id="' . $id . '" name="' . $name . '" cols="' . $cols . '" rows="' . $rows . '" ' . $attr . '>' . $value . '</textarea>';
     // Set
     if (!$field->variation) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         $hidden = '<textarea class="inputbox" style="display: none;" id="_' . $id . '" name="' . $name . '" />' . $value . '</textarea>';
         parent::g_getDisplayVariation($field, $field->variation, $value, self::_bn2br(self::_bn2clear($value)), $form, $id, $name, '<textarea', $hidden, '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:59,代码来源:textarea.php

示例2: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         if ($config['pk']) {
             // hardfix for now
             $field->required = '';
         } else {
             plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
             parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
             $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
         }
     }
     // Prepare
     $class = 'inputbox password' . $validate . ($field->css ? ' ' . $field->css : '');
     $maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
     $attr = 'class="' . $class . '" size="' . $field->size . '" autocomplete="off"' . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
     $form = '<input type="password" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
     // Set
     if (!$field->variation) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:50,代码来源:password.php

示例3: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $field->bool2 ? self::_p2nl($value) : self::_br2nl($value) : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true, 'maxSize' => true));
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $class = 'inputbox textarea' . $validate . ($field->css ? ' ' . $field->css : '');
     $cols = $field->cols ? $field->cols : 25;
     $rows = $field->rows ? $field->rows : 3;
     $attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : '');
     $form = '<textarea id="' . $id . '" name="' . $name . '" cols="' . $cols . '" rows="' . $rows . '" ' . $attr . '>' . $value . '</textarea>';
     // Set
     if (!$field->variation) {
         $field->form = $form;
     } else {
         $hidden = '<textarea class="inputbox" style="display: none;" id="' . $id . '" name="' . $name . '" />' . $value . '</textarea>';
         parent::g_getDisplayVariation($field, $field->variation, $value, self::_bn2br(self::_bn2clear($value)), $form, $id, $name, '<textarea', $hidden, '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:pctechnikch,项目名称:SEBLOD,代码行数:43,代码来源:textarea.php

示例4: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $value = htmlspecialchars($value, ENT_QUOTES);
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
     $attr = 'class="' . $class . '" size="' . $field->size . '" maxlenght="7"' . ($field->attributes ? ' ' . $field->attributes : '');
     $form = '<input class="' . $class . '" type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
     // Set
     if (!$field->variation) {
         $field->form = $form;
         self::_addScripts($id, array(), $config);
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:hamby,项目名称:SEBLOD,代码行数:41,代码来源:colorpicker.php

示例5: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
         $name = strpos($name, '[]') !== false ? substr($name, 0, -1) . $inherit['xk'] . ']' : $name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $divider = $field->divider != '' ? $field->divider : ',';
     if (!is_array($value)) {
         $value = explode($divider, $value);
     }
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $attr = array('option.attr' => 'data-cck');
     $options = explode('||', $field->options);
     if ($field->location) {
         $attribs = explode('||', $field->location);
         $attrib = count($attribs);
         $options2 = json_decode($field->options2);
     } else {
         $attribs = array();
         $attrib = 0;
     }
     if ($field->bool8) {
         $field->bool8 = $config['doTranslation'];
     }
     if ($field->sorting == 1) {
         natsort($options);
         $optionsSorted = array_slice($options, 0);
     } elseif ($field->sorting == 2) {
         natsort($options);
         $optionsSorted = array_reverse($options, true);
     } else {
         $optionsSorted = $options;
     }
     $opts = array();
     if (count($optionsSorted)) {
         foreach ($optionsSorted as $i => $val) {
             if (trim($val) != '') {
                 $text = $val;
                 if (JString::strpos($val, '=') !== false) {
                     $opt = explode('=', $val);
                     $text = $opt[0];
                     $val = $opt[1];
                 }
                 if ($field->bool8 && trim($text) != '') {
                     $text = JText::_('COM_CCK_' . str_replace(' ', '_', trim($text)));
                 }
                 if ($attrib) {
                     $attr['attr'] = '';
                     foreach ($attribs as $k => $a) {
                         $attr['attr'] .= ' ' . $a . '="' . $options2->options[$i]->attr[$k] . '"';
                     }
                     $opts[] = JHtml::_('select.option', $val, $text, $attr);
                 } else {
                     $opts[] = JHtml::_('select.option', $val, $text, 'value', 'text');
                 }
             }
         }
     }
     $count = count($opts);
     if ($field->bool) {
         $orientation = ' vertical';
         $field->bool2 = !$field->bool2 ? 1 : $field->bool2;
         $modulo = $count % $field->bool2;
         $columns = (int) ($count / (!$field->bool2 ? 1 : $field->bool2));
     } else {
         $orientation = '';
     }
     $class = 'checkboxes' . $orientation . ($field->css ? ' ' . $field->css : '');
     $attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : '');
     $form = '<fieldset id="' . $id . '" ' . $attr . '>';
     if (JCck::on()) {
         $attr = 'class="checkbox' . $validate . '" size="1"';
     } else {
         $attr = 'class="inputbox checkbox' . $validate . '" size="1"';
     }
     $attr_key = 'data-cck';
     if ($field->bool && $field->bool2 > 1 && $count > 1) {
         $k = 0;
         foreach ($opts as $i => $o) {
             if ($i == 0) {
                 $form .= '<div class="cck-fl">';
             } elseif ($modulo && $k % ($columns + 1) == 0 || $modulo <= 0 && $k % $columns == 0) {
//.........这里部分代码省略.........
开发者ID:pctechnikch,项目名称:SEBLOD,代码行数:101,代码来源:checkbox.php

示例6: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     $value = JCckDev::fromJSON($value);
     $value['text'] = htmlspecialchars(@$value['text'], ENT_QUOTES);
     $preview = '';
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
     $class2 = 'inputbox text';
     $maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
     $attr = 'class="' . $class . '" size="' . $field->size . '"' . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
     $attr2 = 'class="' . $class2 . '" size="' . $field->size . '"' . $maxlen;
     $options2 = JCckDev::fromJSON($field->options2);
     if ($config['doTranslation']) {
         $link_label = trim(@$options2['link_label']) ? JText::_('COM_CCK_' . str_replace(' ', '_', trim(@$options2['link_label']))) : '';
         $text_label = trim(@$options2['text_label']) ? JText::_('COM_CCK_' . str_replace(' ', '_', trim(@$options2['text_label']))) : '';
     } else {
         $link_label = @$options2['link_label'] != '' ? trim($options2['link_label']) : '';
         $text_label = @$options2['text_label'] != '' ? $options2['text_label'] : '';
     }
     if (strpos($name, '[]') !== false) {
         //FieldX
         $nameH = substr($name, 0, -2);
         $nameLink = $name;
         $nameText = $nameH . '_text[]';
         $nameClass = $nameH . '_class[]';
         $nameTarget = $nameH . '_target[]';
     } elseif ($name[strlen($name) - 1] == ']') {
         //GroupX
         $nameH = substr($name, 0, -1);
         $nameLink = $name;
         $nameText = $nameH . '_text]';
         $nameClass = $nameH . '_class]';
         $nameTarget = $nameH . '_target]';
     } else {
         //Default
         $nameH = $name;
         $nameLink = $name;
         $nameText = $nameH . '_text';
         $nameClass = $nameH . '_class';
         $nameTarget = $nameH . '_target';
     }
     $form = self::_addInput($id, $nameLink, $attr, $link_label, @$value['link'], 'link');
     if ($field->bool2 == 1) {
         $form .= self::_addInput($id . '_text', $nameText, $attr2, $text_label, @$value['text'], 'text');
     }
     if ($field->bool3 == 1) {
         $form .= self::_addInput($id . '_class', $nameClass, $attr2, JText::_('COM_CCK_CLASS'), @$value['class'], 'class');
     }
     if ($field->bool4 == 1) {
         $form .= self::_addSelect($id . '_target', JText::_('COM_CCK_TARGET'), 'target', 'core_options_target', @$value['target'], array('storage_field' => $nameTarget));
     }
     if ($field->bool5 == 1 && $config['pk'] && @$value['link'] != '') {
         $p_link = @$value['link'];
         $p_text = @$value['text'] ? @$value['text'] : $p_link;
         $p_link = strpos($p_link, 'index.php') === 0 ? $p_link : (strpos($p_link, 'http://') === false && strpos($p_link, 'https://') === false ? 'http://' . $p_link : $p_link);
         $preview = '<a href="' . $p_link . '" class="cck_preview" target="_blank">' . $p_text . '</a>';
         $preview = self::_addPreview($id . '_preview', JText::_('COM_CCK_PREVIEW'), $preview, 'preview');
     }
     // Set
     if (!$field->variation) {
         $field->form = $form . $preview;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:95,代码来源:link.php

示例7: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     $value = htmlspecialchars($value);
     // Preview Video
     $options2 = JCckDev::fromJSON($field->options2);
     $preview = isset($options2['video_preview']) ? $options2['video_preview'] : '0';
     $width = isset($options2['video_width']) ? $options2['video_width'] : '300';
     $height = isset($options2['video_height']) ? $options2['video_height'] : '300';
     $video = '';
     if ($preview == 1) {
         $v_int = preg_match('/\\?v=.*/i', $value, $v_value);
         if ($v_int > 0) {
             $v_tag = str_replace('?v=', '', $v_value[0]);
         } else {
             $v_tag = $value;
         }
         if (isset($v_tag) && $v_tag != '') {
             if ($field->bool2 == 0) {
                 $video .= '<iframe width="' . $width . '" height="' . $height . '" ';
                 $video .= 'frameborder="0" allowfullscreen src="';
                 $video .= 'http://www.youtube.com/embed/' . $v_tag;
                 $video .= '" ></iframe>';
             } else {
                 $video .= '<object width="' . $width . '" height="' . $height . '">';
                 $video .= '<param value="' . $value . '" name="movie"><param value="transparent" name="wmode">';
                 $video .= '<embed width="' . $width . '" height="' . $height . '" wmode="transparent" type="application/x-shockwave-flash" src="';
                 $video .= 'http://www.youtube.com/v/' . $v_tag;
                 $video .= '"></object>';
             }
             $video .= '<div class="clear"></div>';
         }
     }
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
     $maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
     $attr = 'class="' . $class . '" size="' . $field->size . '"' . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
     $form = $video . '<input type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
     // Set
     if (!$field->variation) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:74,代码来源:video_youtube.php

示例8: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
     if ($value != '') {
         $class .= ' has-value';
     }
     $maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
     $attr = 'class="' . $class . '" size="' . $field->size . '"' . $maxlen;
     if ($field->attributes != '') {
         if (strpos($field->attributes, 'J(') !== false) {
             $matches = '';
             $search = '#J\\((.*)\\)#U';
             preg_match_all($search, $field->attributes, $matches);
             if (count($matches[1])) {
                 foreach ($matches[1] as $text) {
                     $field->attributes = str_replace('J(' . $text . ')', JText::_('COM_CCK_' . str_replace(' ', '_', trim($text))), $field->attributes);
                 }
             }
         }
         $attr .= ' ' . $field->attributes;
     }
     if (strpos($field->variation, 'custom_') !== false) {
         $isCustom = true;
         $type = substr($field->variation, 7);
     } else {
         $isCustom = false;
         $type = 'text';
     }
     $form = '<input type="' . $type . '" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
     // Set
     if (!$field->variation || $isCustom) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:68,代码来源:text.php

示例9: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Captcha only for Guest
     $user = JFactory::getUser();
     if ($user->get('id') > 0 && $user->guest != 1) {
         $field->form = '';
         $field->value = '';
         $field->display = 0;
         return;
     }
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     $value = htmlspecialchars($value, ENT_QUOTES);
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config, array('minSize' => true));
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $math = array(1 => '+', 2 => '*', 4 => '-');
     $num1 = rand(1, 5);
     $num2 = rand(6, 10);
     shuffle($math);
     $glue = $math[0];
     $eval = $num2 . $glue . $num1;
     eval("\$secure_session_var=" . $eval . ";");
     $ask = '<span class="variation_value">' . $num2 . ' ' . $glue . ' ' . $num1 . ' = </span>';
     if (empty($field->description)) {
         $field->description = JText::_('COM_CCK_CAPTCHA_DO_THE_MATH');
     }
     $class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
     $maxlen = $field->maxlength > 0 ? ' maxlength="' . $field->maxlength . '"' : '';
     $attr = 'class="' . $class . '" size="' . $field->size . '"' . $maxlen . ($field->attributes ? ' ' . $field->attributes : '');
     $form = '<input type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
     // Set
     if (!$field->variation) {
         $field->form = $ask . $form;
         // Special
         $session = JFactory::getSession();
         $session->set('secure_cckaptcha', $name);
         $session->set('secure_' . $name, $secure_session_var);
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:68,代码来源:captcha_math.php

示例10: onCCK_FieldPrepareForm

 public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
 {
     if (self::$type != $field->type) {
         return;
     }
     self::$path = parent::g_getPath(self::$type . '/');
     parent::g_onCCK_FieldPrepareForm($field, $config);
     // Init
     if (count($inherit)) {
         $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
         $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $value != '' ? $value : $field->defaultvalue;
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $attr = array('option.attr' => 'data-cck');
     $options = explode('||', $field->options);
     if ($field->location) {
         $attribs = explode('||', $field->location);
         $attrib = count($attribs);
         $options2 = json_decode($field->options2);
     } else {
         $attribs = array();
         $attrib = 0;
     }
     if ($field->bool8) {
         $field->bool8 = $config['doTranslation'];
     }
     if ($field->sorting == 1) {
         natsort($options);
         $optionsSorted = array_slice($options, 0);
     } elseif ($field->sorting == 2) {
         natsort($options);
         $optionsSorted = array_reverse($options, true);
     } else {
         $optionsSorted = $options;
     }
     $opts = array();
     if (trim($field->selectlabel)) {
         if ($config['doTranslation']) {
             $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
         }
         if ($attrib) {
             $attr['attr'] = '';
             foreach ($attribs as $k => $a) {
                 $attr['attr'] .= ' ' . $a . '=""';
             }
             $opts[] = JHtml::_('select.option', '', '- ' . $field->selectlabel . ' -', $attr);
         } else {
             $opts[] = JHtml::_('select.option', '', '- ' . $field->selectlabel . ' -', 'value', 'text');
         }
     }
     $optgroup = 0;
     if (1 == 1) {
         // !
         if (count($optionsSorted)) {
             foreach ($optionsSorted as $i => $val) {
                 if (trim($val) != '') {
                     if (JString::strpos($val, '=') !== false) {
                         $opt = explode('=', $val);
                         if ($opt[1] == 'optgroup') {
                             if ($optgroup == 1) {
                                 $opts[] = JHtml::_('select.option', '</OPTGROUP>');
                             }
                             if ($field->bool8 && trim($opt[0])) {
                                 $opt[0] = JText::_('COM_CCK_' . str_replace(' ', '_', trim($opt[0])));
                             }
                             $opts[] = JHtml::_('select.option', '<OPTGROUP>', $opt[0]);
                             $optgroup = 1;
                         } elseif ($opt[1] == 'endgroup' && $optgroup == 1) {
                             $opts[] = JHtml::_('select.option', '</OPTGROUP>');
                             $optgroup = 0;
                         } else {
                             if ($field->bool8 && trim($opt[0])) {
                                 $opt[0] = JText::_('COM_CCK_' . str_replace(' ', '_', trim($opt[0])));
                             }
                             if ($attrib) {
                                 $attr['attr'] = '';
                                 foreach ($attribs as $k => $a) {
                                     $attr['attr'] .= ' ' . $a . '="' . $options2->options[$i]->attr[$k] . '"';
                                 }
                                 $opts[] = JHtml::_('select.option', $opt[1], $opt[0], $attr);
                             } else {
                                 $opts[] = JHtml::_('select.option', $opt[1], $opt[0], 'value', 'text');
                             }
                         }
                     } else {
                         if ($val == 'endgroup' && $optgroup == 1) {
                             $opts[] = JHtml::_('select.option', '</OPTGROUP>');
                             $optgroup = 0;
                         } else {
//.........这里部分代码省略.........
开发者ID:densem-2013,项目名称:exikom,代码行数:101,代码来源:select_simple.php

示例11: onCCK_FieldPrepareForm

    public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
    {
        if (self::$type != $field->type) {
            return;
        }
        self::$path = parent::g_getPath(self::$type . '/');
        parent::g_onCCK_FieldPrepareForm($field, $config);
        // Init
        if (count($inherit)) {
            $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name;
            $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
        } else {
            $id = $field->name;
            $name = $field->name;
        }
        $field->defaultvalue = '{"imageUrl":"","areas":[{"href":"","coords":[]}]}';
        $value = json_decode($value) != NULL ? json_decode($value) : json_decode($field->defaultvalue);
        $value_raw = json_encode($value);
        // Validate
        $validate = '';
        if ($config['doValidation'] > 1) {
            plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
            parent::g_onCCK_FieldPrepareForm_Validation($field, $id, $config);
            $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
        }
        // Prepare
        $class = 'inputbox text' . $validate . ($field->css ? ' ' . $field->css : '');
        //$maxlen	=	( $field->maxlength > 0 ) ? ' maxlength="'.$field->maxlength.'"' : '';
        $xml = '
					<form>
						<field
							type="media"
							name="' . $name . '"
							id="img_' . $id . '"
							label="' . htmlspecialchars($field->label) . '"
							class="' . $class . '"
							size="10"
						/>
					</form>
				';
        $imgurl = "";
        if (isset($value->imageUrl)) {
            $imgurl = $value->imageUrl;
        }
        $imginput = JForm::getInstance($id, $xml);
        $imginput = $imginput->getInput($name, '', $imgurl);
        $attr = 'class="' . $class . '" size="' . $field->size . '"' . ($field->attributes ? ' ' . $field->attributes : '');
        $form = '<input type="hidden" id="' . $id . '" name="' . $name . '" value="' . htmlentities($value_raw) . '" ' . $attr . ' />';
        $form = '
					<div id="imgmap_' . $id . '">
						<div class="htmlimgmap_img">' . $imginput . '</div>
						<div>' . $form . '</div>
						<div class="htmlimgmap_ctrls">
							<button class="btn remove"><span class="icon-remove"></span> remove</button>
							<button class="btn reset"><span class="icon-loop"></span> reset</button>
							<button class="btn add"><span class="icon-save-new"></span> add</button>
						</div>
						<div class="htmlimgmap"></div>
						<div class="htmlimgmap_layers">
							<ul class="sortable"></ul>
						</div>
					</div>
					';
        // Set
        if (!$field->variation) {
            $field->form = $form;
            self::_addScripts($id, array(), $config, $value_raw);
            if ($field->script) {
                parent::g_addScriptDeclaration($field->script);
            }
        } else {
            parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<input', '', '', $config);
        }
        $field->value = $value;
        // Return
        if ($return === true) {
            return $field;
        }
    }
开发者ID:neshte,项目名称:seblod_plg_cck_field_htmlmap,代码行数:79,代码来源:htmlmap.php


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