本文整理汇总了PHP中JCckDev::fromJSON方法的典型用法代码示例。如果您正苦于以下问题:PHP JCckDev::fromJSON方法的具体用法?PHP JCckDev::fromJSON怎么用?PHP JCckDev::fromJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCckDev
的用法示例。
在下文中一共展示了JCckDev::fromJSON方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCCK_FieldPrepareForm
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Prepare
$app = JFactory::getApplication();
$form = '';
$options2 = JCckDev::fromJSON($field->options2);
$variables = explode('||', $field->options);
if (count($variables)) {
foreach ($variables as $k => $name) {
if ($name) {
$request = 'get' . ucfirst($options2['options'][$k]->type ? $options2['options'][$k]->type : '');
$value = $app->input->{$request}($name, '');
$value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
$form .= '<input class="inputbox hidden" type="hidden" id="' . $name . '" name="' . $name . '" value="' . $value . '" />';
}
}
}
$field->form = $form;
$field->state = 1;
$field->value = '';
// Return
if ($return === true) {
return $field;
}
}
示例2: g_getLive
public static function g_getLive($params, $format = '')
{
if ($format != '') {
return JCckDev::fromJSON($params, $format);
} else {
$reg = new JRegistry();
if ($params) {
$reg->loadString($params);
}
return $reg;
}
}
示例3: postSaveHook
protected function postSaveHook(CCKModelSite &$model, $validData = array())
{
$recordId = $model->getState($this->context . '.id');
if ($recordId == 10 || $recordId == 500) {
$db = JFactory::getDbo();
$params = JCckDatabase::loadResult('SELECT params FROM #__extensions WHERE element = "com_cck"');
$config = JCckDev::fromJSON($params, 'object');
$config->multisite = 1;
$params = $db->escape(JCckDev::toJSON($config));
JCckDatabase::execute('UPDATE #__extensions SET params = "' . $params . '" WHERE element = "com_cck"');
}
}
示例4: applyTypeOptions
public static function applyTypeOptions(&$config)
{
$options = JCckDatabase::loadResult('SELECT options_' . $config['client'] . ' FROM #__cck_core_types WHERE name ="' . (string) $config['type'] . '"');
$options = JCckDev::fromJSON($options);
if (isset($options['message']) && $options['message'] != '') {
$config['message'] = $options['message'];
}
if (isset($options['data_integrity_excluded'])) {
$options['data_integrity_excluded'] = explode(',', str_replace(' ', ',', trim($options['data_integrity_excluded'])));
} else {
$options['data_integrity_excluded'] = array();
}
$config['message_style'] = isset($options['message_style']) ? $options['message_style'] : 'message';
$config['options'] = $options;
}
示例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 = $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;
}
}
示例6: _typo
protected static function _typo($typo, $field, $value, &$config = array())
{
$format = $typo->get('format', 'Y-m-d');
$value = trim($field->value);
if ($format == -2) {
$typo = self::_getTimeAgo($value, $typo->get('unit', ''), $typo->get('alt_format', ''), $typo->get('format2', 'Y-m-d'));
} else {
$options2 = JCckDev::fromJSON($field->options2);
if ($format == -1) {
$format = trim($typo->get('format_custom', @$options2['format']));
}
$value = self::_getValueWithFormatStorage($value, @$options2['storage_format']);
$date_eng = $format ? date($format, $value) : $value;
$typo = self::_getDateByLang($format, $value, $date_eng);
}
return $typo;
}
示例7: prepareDisplay
function prepareDisplay()
{
$app = JFactory::getApplication();
$model = $this->getModel();
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->option = $app->input->get('option', '');
$this->state = $this->get('State');
// Check Errors
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->isNew = @$this->item->id > 0 ? 0 : 1;
$this->item->published = Helper_Admin::getSelected($this->vName, 'state', $this->item->published, 1);
$this->item->type = $this->state->get('type', '2,7');
$this->item->fields = JCck::getConfig_Param('multisite_options', array());
$this->item->options = $this->item->options ? JCckDev::fromJSON($this->item->options) : array();
Helper_Admin::addToolbarEdit($this->vName, _C5_TEXT, array('isNew' => $this->isNew, 'folder' => 0, 'checked_out' => $this->item->checked_out));
}
示例8: revert
public function revert($pk, $type)
{
$db = $this->getDbo();
$table = $this->getTable();
if (!$pk || !$type) {
return false;
}
$table->load($pk);
if (JCck::getConfig_Param('version_revert', 1) == 1) {
Helper_Version::createVersion($type, $table->e_id, JText::sprintf('COM_CCK_VERSION_AUTO_BEFORE_REVERT', $table->e_version));
}
$row = JTable::getInstance($type, 'CCK_Table');
$row->load($table->e_id);
$core = JCckDev::fromJSON($table->e_core);
if (isset($row->asset_id) && $row->asset_id && isset($core['rules'])) {
JCckDatabase::execute('UPDATE #__assets SET rules = "' . $db->escape($core['rules']) . '" WHERE id = ' . (int) $row->asset_id);
}
// More
if ($type == 'search') {
$clients = array(1 => 'search', 2 => 'filter', 3 => 'list', 4 => 'item', 5 => 'order');
} else {
$clients = array(1 => 'admin', 2 => 'site', 3 => 'intro', 4 => 'content');
}
foreach ($clients as $i => $client) {
$name = 'e_more' . $i;
$this->_revert_more($type, $client, $table->e_id, $table->{$name});
}
// Override
if ($row->version && $row->version != $table->e_version) {
$core['version'] = ++$row->version;
}
$core['checked_out'] = 0;
$core['checked_out_time'] = '0000-00-00 00:00:00';
$row->bind($core);
$row->check();
$row->store();
return true;
}
示例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;
$inherited = true;
} else {
$id = $field->name;
$name = $field->name;
$inherited = false;
}
$value = $value != '' ? (int) $value : @(int) $config['asset_id'];
// Validate
$validate = '';
// Prepare
$options2 = JCckDev::fromJSON($field->options2);
$component = @$options2['extension'] ? $options2['extension'] : 'com_content';
$section = @$options2['section'] ? $options2['section'] : 'article';
if ($field->bool) {
// Default
$class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : '');
$xml = '
<form>
<field
type="' . self::$type2 . '"
id="' . $id . '"
name="' . $name . '"
label="' . htmlspecialchars($field->label) . '"
filter="rules"
component="' . $component . '"
section="' . $section . '"
class="' . $class . '"
/>
<field
type="hidden"
name="asset_id"
readonly="true"
class="readonly"
/>
</form>
';
$form = JForm::getInstance($id, $xml);
$form->setValue('asset_id', null, $value);
$form = $form->getInput($name);
$form = str_replace('<select name="' . $name . '[', '<select class="inputbox" name="' . $name . '[', $form);
} else {
// Modal Box
$app = JFactory::getApplication();
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_PERMISSIONS');
}
$link = 'index.php?option=com_cck&task=box.add&tmpl=component&file=plugins/cck_field/' . self::$type . '/tmpl/form.php' . '&id=' . $id . '&name=' . $name . '&type=' . $value . '¶ms=' . $component . '||' . $section;
$class = 'jform_rules_box variation_href';
if ($app->input->get('option') == 'com_cck' && $app->input->get('view') != 'form') {
// todo: remove later
$class .= ' btn';
}
$class = 'class="' . $class . '" ';
$attr = $class;
$rules = '';
$form = '<textarea style="display: none;" id="' . $id . '" name="' . $name . '">' . $rules . '</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('inherited' => $inherited), $config);
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;
}
}
示例10: array
</ul>
<ul class="spe spe_description">
<?php
echo JCckDev::renderForm($cck['core_description'], $this->item->description, $config, array('label' => 'clear', 'selectlabel' => 'Description'));
?>
</ul>
</div>
<div class="seblod">
<div class="legend top left"><?php
echo JText::_('COM_CCK_OPTIONS');
?>
</div>
<ul class="adminformlist adminformlist-2cols">
<?php
$cfg = JCckDev::fromJSON($this->item->configuration, 'array');
echo JCckDev::renderForm($cck['core_site_name'], @$cfg['sitename'], $config);
echo JCckDev::renderForm($cck['core_site_pagetitles'], @$cfg['sitename_pagetitles'], $config);
echo JCckDev::renderForm($cck['core_site_metadesc'], @$cfg['metadesc'], $config);
echo JCckDev::renderForm($cck['core_site_metakeys'], @$cfg['metakeys'], $config);
echo JCckDev::renderForm($cck['core_site_homepage'], @$cfg['homepage'], $config);
echo JCckDev::renderForm($cck['core_site_language'], @$cfg['language'], $config);
echo JCckDev::renderForm($cck['core_site_offline'], @$cfg['offline'], $config);
echo JCckDev::renderForm($cck['core_site_template_style'], @$cfg['template_style'], $config);
?>
</ul>
<?php
if (!$this->isNew) {
?>
<img id="toggle_acl" src="components/com_cck/assets/images/24/icon-24-acl.png" border="0" alt="" style="float: right; margin: 9px 9px 0px 0px; cursor: pointer;" />
<?php
示例11: foreach
<th width="25%" class="center hidden-phone nowrap" colspan="4"><?php
echo JText::_('COM_CCK_FIELDS');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$named = '';
foreach ($this->items as $i => $item) {
$checkedOut = !($item->checked_out == $userId || $item->checked_out == 0);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canChange = $user->authorise('core.edit.state', CCK_COM) && $canCheckin;
$canEdit = $user->authorise('core.edit', CCK_COM);
$canEditOwn = '';
$more = JCckDev::fromJSON($item->e_more);
$link = JRoute::_('index.php?option=' . $this->option . '&task=' . $this->vName . '.edit&id=' . $item->id);
if ($canEdit) {
$goBackToVersion = '<a href="javascript:void(0);" onclick="Joomla.submitbutton(\'versions.revert\',\'cb' . $i . '\');">' . '<img class="img-action" src="components/' . CCK_COM . '/assets/images/24/icon-24-versions-revert.png" border="0" alt="" title="' . $title2 . '" /></a>';
} else {
$goBackToVersion = '-';
}
?>
<tr class="row<?php
echo $i % 2;
?>
" height="64px;">
<td class="center hidden-phone"><?php
Helper_Display::quickSlideTo('pagination-bottom', $i + 1);
?>
</td>
示例12: defined
<?php
/**
* @version SEBLOD 3.x Core ~ $Id: edit_template.php sebastienheraud $
* @package SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url http://www.seblod.com
* @editor Octopoos - www.octopoos.com
* @copyright Copyright (C) 2013 SEBLOD. All Rights Reserved.
* @license GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
if (is_object($this->style)) {
$this->style->params = JCckDev::fromJSON($this->style->params);
}
?>
<div class="<?php
echo $this->css['wrapper'];
?>
">
<div class="seblod">
<div class="legend top left"><?php
echo JText::_('COM_CCK_RENDERING') . '<span class="mini">(' . JText::_('COM_CCK_FOR_VIEW_' . $this->item->client) . ')</span>';
?>
</div>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm($cck['core_template'], $this->style->template, $config);
echo '<input type="hidden" name="template2" value="' . $this->style->template . '" />';
$style_title = strlen($this->style->title) > 32 ? substr($this->style->title, 0, 32) . '...' : $this->style->title;
echo '<li><label>' . JText::_('COM_CCK_STYLE') . '</label><span class="variation_value adminformlist-maxwidth" title="' . $this->style->title . '">' . $style_title . '</span>' . '<input class="inputbox" type="hidden" id="template_' . $this->item->client . '" name="template_' . $this->item->client . '" value="' . $this->style->id . '" /></li>';
示例13: onCCK_FieldPrepareStore
public function onCCK_FieldPrepareStore(&$field, $value = '', &$config = array(), $inherit = array(), $return = false)
{
if (self::$type != $field->type) {
return;
}
// Init
if (count($inherit)) {
$name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name;
$xk = isset($inherit['xk']) ? $inherit['xk'] : -1;
$value = isset($inherit['post']) ? $inherit['post'][$name . '_hidden'] : @$config['post'][$name . '_hidden'];
} else {
$name = $field->name;
$xk = -1;
$value = @$config['post'][$name . '_hidden'];
}
if (is_array($value)) {
$value = trim($value[$xk]);
}
$options2 = JCckDev::fromJSON($field->options2);
$options2['storage_format'] = isset($options2['storage_format']) ? $options2['storage_format'] : '0';
$value = $options2['storage_format'] == '0' ? $value : strtotime($value);
// Validate
parent::g_onCCK_FieldPrepareStore_Validation($field, $name, $value, $config);
// Set or Return
if ($return === true) {
return $value;
}
$field->value = $value;
parent::g_onCCK_FieldPrepareStore($field, $name, $value, $config);
}
示例14: getPluginOptions
public static function getPluginOptions($folder, $prefix = '', $selectlabel = false, $selectnone = false, $language = false, $excluded = array(), $file = '')
{
$base = JPATH_SITE . '/plugins/' . $prefix . $folder;
$options = array();
$options2 = array();
$lang = JFactory::getLanguage();
if ($selectlabel !== false) {
$selectlabel = is_string($selectlabel) ? $selectlabel : JText::_('COM_CCK_ALL_TYPES_SL');
$options[] = JHtml::_('select.option', '', $selectlabel, 'value', 'text');
}
if ($selectnone !== false) {
$options[] = JHtml::_('select.option', '', JText::_('COM_CCK_NONE'), 'value', 'text');
}
$where2 = '';
if (count($excluded)) {
$where2 = ' AND element NOT IN ("' . implode('","', $excluded) . '")';
}
$query = 'SELECT name AS text, element AS value, params' . ' FROM #__extensions' . ' WHERE folder = "' . $prefix . $folder . '" AND enabled = 1' . $where2 . ' ORDER BY text';
$plugins = JCckDatabase::loadObjectList($query);
foreach ($plugins as $plugin) {
if (!is_file($base . '/' . $plugin->value . '/' . $plugin->value . '.php') || $file && !is_file($base . '/' . $plugin->value . '/' . $file)) {
continue;
}
if ($language) {
$lang->load('plg_' . $prefix . $folder . '_' . $plugin->value, JPATH_ADMINISTRATOR, null, false, true);
}
$plugin->text = JText::_('plg_' . $prefix . $folder . '_' . $plugin->value . '_LABEL');
$params = JCckDev::fromJSON($plugin->params);
$group = JText::_($params['group']);
$groups[$group][$group . '_' . $plugin->text] = $plugin;
}
if (!isset($groups)) {
return $options;
}
ksort($groups);
foreach ($groups as $k => $v) {
if ($k != 'CORE') {
if ($k == '-') {
$options = array_merge($options, $v);
} elseif (strpos($k, '#') !== false) {
if ($k == '#') {
$options2[] = JHtml::_('select.option', '<OPTGROUP>', $k . ' Core');
$options2 = array_merge($options2, $v);
$options2[] = JHtml::_('select.option', '</OPTGROUP>', '');
} else {
$options2[] = JHtml::_('select.option', '<OPTGROUP>', $k);
ksort($v);
$options2 = array_merge($options2, $v);
$options2[] = JHtml::_('select.option', '</OPTGROUP>', '');
}
} else {
$options[] = JHtml::_('select.option', '<OPTGROUP>', $k);
ksort($v);
$options = array_merge($options, $v);
$options[] = JHtml::_('select.option', '</OPTGROUP>', '');
}
}
}
if (count($options2)) {
$options = array_merge($options, $options2);
}
return $options;
}
示例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;
$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;
}
}