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


PHP JCckPluginField::g_getDisplayVariation方法代码示例

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


在下文中一共展示了JCckPluginField::g_getDisplayVariation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 != '' ? $value : $field->defaultvalue;
        $value = $value != ' ' ? $value : '';
        // Validate
        $validate = '';
        if ($config['doValidation'] > 1) {
            plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
            $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
        }
        // Prepare
        $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
        $xml = '
					<form>
						<field
							type="' . self::$type2 . '"
							name="' . $name . '"
							id="' . $id . '"
							label="' . htmlspecialchars($field->label) . '"
							class="' . $class . '"
						>
						<option value="">JOPTION_USE_DEFAULT</option>
					</field>
					</form>
				';
        $form = JForm::getInstance($id, $xml);
        $form = $form->getInput($name, '', $value);
        // 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, '<select', '', '', $config);
        }
        $field->value = $value;
        // Return
        if ($return === true) {
            return $field;
        }
    }
开发者ID:densem-2013,项目名称:exikom,代码行数:55,代码来源:jform_timezone.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;
     }
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     if (trim($field->selectlabel)) {
         if ($config['doTranslation']) {
             $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
         }
     }
     $options2 = JCckDev::fromJSON($field->options2);
     if (isset($options2['prepareform']) && $options2['prepareform'] != '') {
         $form = self::_eval($options2['prepareform'], 'form', $field, $value, $name, $id, $config);
     } else {
         $form = '';
     }
     // 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:codigoaberto,项目名称:SEBLOD,代码行数:48,代码来源:42.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;
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $options2 = JCckDev::fromJSON($field->options2);
     $opts = self::_getOptionsList($options2, $field, $config);
     $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
     if ($value != '') {
         $class .= ' has-value';
     }
     $attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : '');
     $form = count($opts) ? JHtml::_('select.genericlist', $opts, $name, $attr, 'value', 'text', $value, $id) : '';
     // 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, '<select', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:46,代码来源:select_numeric.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;
     } else {
         $id = $field->name;
         $name = $field->name;
     }
     $value = $field->defaultvalue;
     // Prepare
     $value = JCckDevHelper::replaceLive($value);
     if ($field->bool8) {
         $field->bool8 = $config['doTranslation'];
     }
     if ($field->bool8) {
         $value = trim(preg_replace('/[^A-Za-z0-9_ ]/', '', strip_tags($value)));
         if ($value) {
             $value = JText::_('COM_CCK_' . str_replace(' ', '_', $value));
         }
     }
     $form = htmlspecialchars_decode($value);
     // 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, '', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:kenyonjohnston,项目名称:hott_theater,代码行数:43,代码来源:freetext.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 != '' ? $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

示例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 = 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

示例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 = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
     // Validate
     $validate = '';
     // Prepare
     $class = 'inputbox hidden' . $validate . ($field->css ? ' ' . $field->css : '');
     $form = '<input class="' . $class . '" type="hidden" id="' . $id . '" name="' . $name . '" value="' . $value . '" />';
     // 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,代码行数:37,代码来源:hidden.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);
     // 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

示例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;
     $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

示例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;
     }
     $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

示例12: 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;
     $name = @$field->bool3 ? $name . '[]' : $name;
     $divider = '';
     if ($field->bool3) {
         $divider = $field->divider != '' ? $field->divider : ',';
         if (!is_array($value)) {
             $value = explode($divider, $value);
         }
     } else {
         $field->divider = '';
     }
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     if (parent::g_isStaticVariation($field, $field->variation, true)) {
         $form = '';
         $field->text = '';
         parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
     } else {
         $attr = array('option.attr' => 'data-cck');
         $auto = 1;
         $items = array();
         $opts = array();
         if ($field->location) {
             $attribs = explode('||', $field->location);
             $attrib = count($attribs);
         } else {
             $attribs = array();
             $attrib = 0;
         }
         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');
             }
             if ($field->required) {
                 $auto++;
             }
         }
         $count2 = JCck::getConfig_Param('development_attr', 6);
         $opt_attr = '';
         $opt_attrs = array();
         $options2 = JCckDev::fromJSON($field->options2);
         $optgroups = false;
         if ($field->bool4 == 1 || $field->bool4 == 3) {
             $results = self::_getStaticOption($field, $field->options, $config, $optgroups);
             $static = count($results);
             if ($field->bool4 == 3) {
                 if ($static > 0) {
                     $current = 0;
                     $half = (int) ($static / 2);
                     $half = $static % 2 ? $half + 1 : $half;
                     for ($current = 0; $current < $half; $current++) {
                         $opts[] = $results[$current];
                     }
                 }
             } else {
                 foreach ($results as $result) {
                     $opts[] = $result;
                 }
             }
         }
         if ($field->bool2 == 0) {
             $opt_table = isset($options2['table']) ? ' FROM ' . $options2['table'] : '';
             $opt_name = isset($options2['name']) ? $options2['name'] : '';
             $opt_value = isset($options2['value']) ? $options2['value'] : '';
             if ($count2) {
                 for ($i = 1; $i <= $count2; $i++) {
                     $opt_attrs[] = isset($options2['attr' . $i]) && $options2['attr' . $i] != '' ? $options2['attr' . $i] : '';
                 }
             }
             $opt_where = @$options2['where'] != '' ? ' WHERE ' . $options2['where'] : '';
             $opt_orderby = @$options2['orderby'] != '' ? ' ORDER BY ' . $options2['orderby'] . ' ' . (@$options2['orderby_direction'] != '' ? $options2['orderby_direction'] : 'ASC') : '';
//.........这里部分代码省略.........
开发者ID:hamby,项目名称:SEBLOD,代码行数:101,代码来源:select_dynamic.php

示例13: 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;
         $inherited = true;
     } else {
         $id = $field->name;
         $name = $field->name;
         $inherited = false;
     }
     $value = $value != '' ? htmlspecialchars($value, ENT_COMPAT, 'UTF-8') : @$field->defaultvalue;
     $value = $value != ' ' ? $value : '';
     // Validate
     $validate = '';
     if ($config['doValidation'] > 1) {
         plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $app = JFactory::getApplication();
     $options2 = JCckDev::fromJSON($field->options2);
     $user = JFactory::getUser();
     if ($config['pk'] && @$options2['import'] && $field->storage_location) {
         if (!JCckDatabase::loadResult('SELECT pk FROM #__cck_core WHERE pk=' . (int) $config['pk'] . ' AND storage_location="' . (string) $field->storage_location . '"')) {
             $properties = array('custom', 'table');
             $properties = JCck::callFunc('plgCCK_Storage_Location' . $field->storage_location, 'getStaticProperties', $properties);
             $custom = $options2['import'] == 2 ? 'fulltext' : $properties['custom'];
             $value = $config['storages'][$properties['table']]->{$custom};
         }
     }
     if (!$user->id && $this->params->get('guest_access', 0) == 0) {
         $form = '';
     } else {
         $width = @$options2['width'] ? str_replace('px', '', $options2['width']) : '100%';
         $height = @$options2['height'] ? str_replace('px', '', $options2['height']) : '280';
         $asset = $config['asset_id'] > 0 ? $config['asset_id'] : $config['asset'];
         if ($app->input->get('option') == 'com_cck' && $app->input->get('view') == 'form' && $config['client'] == '') {
             $field->bool = 1;
         }
         if ($field->bool) {
             // Default
             $buttons = array('pagebreak', 'readmore');
             $editor = JFactory::getEditor(@$options2['editor'] ? $options2['editor'] : null);
             $form = '<div>' . $editor->display($name, $value, $width, $height, '60', '20', $buttons, $id, $asset) . '</div>';
         } else {
             // Modal Box
             if (trim($field->selectlabel)) {
                 if ($config['doTranslation']) {
                     $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
                 }
                 $buttonlabel = $field->selectlabel;
             } else {
                 $buttonlabel = JText::_('COM_CCK_EDITOR');
             }
             $e_type = @$options2['editor'] != '' ? '&type=' . $options2['editor'] : '';
             $link = 'index.php?option=com_cck&task=box.add&tmpl=component&file=plugins/cck_field/' . self::$type . '/tmpl/form.php' . '&id=' . $id . '&name=' . $name . $e_type . '&params=' . urlencode(urlencode($width)) . '||' . $height . '||' . $asset;
             $app = JFactory::getApplication();
             $class = 'wysiwyg_editor_box variation_href';
             $component = $app->input->get('option');
             if ($component == 'com_cck' && $app->input->get('view') != 'form' || $component == 'com_cck_ecommerce' || $component == 'com_cck_toolbox' || $component == 'com_cck_webservices') {
                 // todo: remove later
                 $class .= ' btn';
             }
             $class = 'class="' . $class . '" ';
             $attr = $class;
             $form = '<textarea style="display: none;" id="' . $id . '" name="' . $name . '">' . $value . '</textarea>';
             $form .= '<a href="' . $link . '" ' . $attr . '>' . $buttonlabel . '</a>';
             $field->markup_class .= ' cck_form_wysiwyg_editor_box';
         }
     }
     // Set
     if (!$field->variation) {
         $field->form = $form;
         self::_addScripts($field->bool, array('height' => @$height, 'inherited' => $inherited), $config);
     } else {
         $hidden = '<textarea class="inputbox" style="display: none;" id="' . $id . '" name="' . $name . '" />' . $value . '</textarea>';
         parent::g_getDisplayVariation($field, $field->variation, $value, $value, $form, $id, $name, '<textarea', $hidden, '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:91,代码来源:wysiwyg_editor.php

示例14: 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);
        if (is_file(JPATH_LIBRARIES . '/joomla/html/html/category.php')) {
            require_once JPATH_LIBRARIES . '/joomla/html/html/category.php';
        }
        // 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;
        }
        $app = JFactory::getApplication();
        $value = $value != '' ? $value : $field->defaultvalue;
        $value = $value != ' ' ? $value : '';
        // Validate
        $validate = '';
        if ($config['doValidation'] > 1) {
            plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
            $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
        }
        // Prepare
        if (parent::g_isStaticVariation($field, $field->variation, true)) {
            $form = '';
            $field->text = '';
            parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
        } elseif ($field->variation == 'value') {
            $form = '';
            $field->text = JCckDatabase::loadResult('SELECT title FROM #__categories WHERE id = ' . (int) $value);
            parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
        } else {
            $opt = '';
            $options2 = JCckDev::fromJSON($field->options2);
            if (trim($field->selectlabel)) {
                if ($config['doTranslation']) {
                    $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
                }
                $opt = '<option value="' . ($field->storage_field == 'parent_id' ? 1 : '') . '">' . '- ' . $field->selectlabel . ' -' . '</option>';
            }
            if ($config['client'] == 'search') {
                $opt .= '<option value="">' . '- ' . JText::_('COM_CCK_ALL_CATEGORIES') . ' -' . '</option>';
            }
            $multiple = $field->bool3 == 1 ? 'multiple="multiple"' : '';
            $size = $field->rows ? $field->rows : 1;
            $extension = $app->input->getString('extension', @$options2['extension']);
            $extension = $extension ? $extension : 'com_content';
            $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
            $xml = '
						<form>
							<field
								type="' . self::$type2 . '"
								name="' . $name . '"
								id="' . $id . '"
								label="' . htmlspecialchars($field->label) . '"
								extension="' . $extension . '"
								' . $multiple . '
								class="' . $class . '"
								size="' . $size . '"
							>' . $opt . '</field>
						</form>
					';
            $form = JForm::getInstance($id, $xml);
            if ($config['client'] == 'admin' || $config['client'] == 'site' || $config['client'] == 'search') {
                if ($config['pk']) {
                    $form->setFieldAttribute($name, 'action', 'core.edit');
                    $form->setFieldAttribute($name, 'action', 'core.edit.own');
                } else {
                    $form->setFieldAttribute($name, 'action', 'core.create');
                }
            }
            $form = $form->getInput($name, '', $value);
            if ($field->attributes) {
                $form = str_replace('<select', '<select ' . $field->attributes, $form);
            }
            // Set
            if (!$field->variation) {
                $field->form = $form;
                if ($field->script) {
                    parent::g_addScriptDeclaration($field->script);
                }
            } else {
                $field->text = JCckDatabase::loadResult('SELECT title FROM #__categories WHERE id = ' . (int) $value);
                parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
            }
        }
        $field->value = $value;
        // Return
        if ($return === true) {
            return $field;
        }
    }
开发者ID:pctechnikch,项目名称:SEBLOD,代码行数:97,代码来源:jform_category.php

示例15: 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);
         $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
     }
     // Prepare
     $opts = array();
     if (trim($field->selectlabel)) {
         if ($config['doTranslation']) {
             $field->selectlabel = JText::_('COM_CCK_' . str_replace(' ', '_', trim($field->selectlabel)));
         }
         $opts[] = JHtml::_('select.option', '', '- ' . $field->selectlabel . ' -', 'value', 'text');
     }
     $options = '"' . str_replace('||', '","', $field->options) . '"';
     $opts2 = JCckDatabase::loadObjectList('SELECT title AS text, id AS value FROM ' . self::$table . ' WHERE catid IN(' . $options . ') AND state = 1 ORDER BY title', 'value');
     if (count($opts2)) {
         $opts = array_merge($opts, $opts2);
     }
     $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
     $attr = 'class="' . $class . '"' . ($field->attributes ? ' ' . $field->attributes : '');
     $form = count($opts) ? JHtml::_('select.genericlist', $opts, $name, $attr, 'value', 'text', $value, $id) : '';
     // Set
     if (!$field->variation) {
         $field->form = $form;
         if ($field->script) {
             parent::g_addScriptDeclaration($field->script);
         }
     } else {
         $field->text = isset($opts2[$value]->text) ? $opts2[$value]->text : $value;
         parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config);
     }
     $field->value = $value;
     // Return
     if ($return === true) {
         return $field;
     }
 }
开发者ID:hamby,项目名称:SEBLOD,代码行数:54,代码来源:joomla_article.php


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