本文整理汇总了PHP中JCckDev类的典型用法代码示例。如果您正苦于以下问题:PHP JCckDev类的具体用法?PHP JCckDev怎么用?PHP JCckDev使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JCckDev类的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_onCCK_WebserviceConstruct
public function g_onCCK_WebserviceConstruct(&$data)
{
// JSON
if (isset($data['json']) && is_array($data['json'])) {
foreach ($data['json'] as $k => $v) {
if (is_array($v)) {
$data[$k] = JCckDev::toJSON($v);
}
}
}
// STRING
if (isset($data['string']) && is_array($data['string'])) {
foreach ($data['string'] as $k => $v) {
if (is_array($v)) {
$string = '';
foreach ($v as $s) {
if ($s) {
$string .= $s . '||';
}
}
if ($string) {
$string = substr($string, 0, -2);
}
$data[$k] = $string;
}
}
}
}
示例3: _getCategories
protected static function _getCategories($value, $glue, $data)
{
$values = JCckDev::fromSTRING($value, $glue);
$value = array();
foreach ($values as $v) {
if (isset($data['categories'][$v])) {
$value[] = $data['categories'][$v];
}
}
return implode($glue, $value);
}
示例4: 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;
}
}
示例5: 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"');
}
}
示例6: prepareLanguages
public function prepareLanguages($lang)
{
$config = JFactory::getConfig();
$tmp_path = $config->get('tmp_path');
$tmp_dir = uniqid('cck_');
$path = $tmp_path . '/' . $tmp_dir;
$name = 'seblod2';
$filename = $lang . '_' . $name;
$path_zip = $tmp_path . '/' . $filename . '.zip';
if (!$filename) {
return;
}
// Core
jimport('cck.base.install.export');
$manifest = JCckDev::fromXML(JPATH_ADMINISTRATOR . '/manifests/packages/pkg_cck.xml');
$extensions = array();
if (count(@$manifest->files->file)) {
foreach ($manifest->files->file as $file) {
$id = (string) $file;
$id = str_replace('.zip', '', $id);
if (strpos($id, 'var_cck_') !== false) {
$id = 'files_' . $id;
}
$extensions[$id] = '';
}
}
$extensions['com_cck_core'] = '';
$extensions['com_cck_default'] = '';
// Admin
$dest = $path . '/admin';
CCK_Export::exportLanguages(JPATH_ADMINISTRATOR . '/language/' . $lang, $dest, $lang, 'admin', 'cck', $extensions);
CCK_Export::zip($dest, $path . '/cck_' . $lang . '_admin.zip');
// Site
$dest = $path . '/site';
CCK_Export::exportLanguages(JPATH_SITE . '/language/' . $lang, $dest, $lang, 'site', 'cck|tpl_seb', $extensions);
CCK_Export::zip($dest, $path . '/cck_' . $lang . '_site.zip');
// Manifest
$package = (object) array('title' => 'SEBLOD ' . $lang, 'name' => 'cck_' . $lang, 'description' => 'SEBLOD 3.x ' . $lang . ' Language Pack - www.seblod.com');
$xml = CCK_Export::preparePackage($package);
$files = $xml->addChild('files');
$file1 = $files->addChild('file', 'cck_' . $lang . '_admin.zip');
$file1->addAttribute('type', 'file');
$file1->addAttribute('src', 'administrator/language/' . $lang);
$file1->addAttribute('id', 'cck_' . $lang . '_admin');
$file2 = $files->addChild('file', 'cck_' . $lang . '_site.zip');
$file2->addAttribute('type', 'file');
$file2->addAttribute('src', 'language/' . $lang);
$file2->addAttribute('id', 'cck_' . $lang . '_site');
CCK_Export::clean($path);
CCK_Export::createFile($path . '/pkg_cck_' . $lang . '.xml', '<?xml version="1.0" encoding="utf-8"?>' . $xml->asIndentedXML());
return CCK_Export::zip($path, $path_zip);
}
示例7: 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;
}
示例8: check
public function check()
{
$this->title = trim($this->title);
if (empty($this->title)) {
return false;
}
if (empty($this->name)) {
$this->name = $this->title;
$this->name = JCckDev::toSafeSTRING($this->name);
if (trim(str_replace('_', '', $this->name)) == '') {
$datenow = JFactory::getDate();
$this->name = $datenow->format('Y_m_d_H_i_s');
}
}
return true;
}
示例9: _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;
}
示例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);
$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;
}
}
示例11: 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));
}
示例12: 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;
}
示例13: defined
* @package SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder)
* @url http://www.seblod.com
* @editor Octopoos - www.octopoos.com
* @copyright Copyright (C) 2009 - 2016 SEBLOD. All Rights Reserved.
* @license GNU General Public License version 2 or later; see _LICENSE.php
**/
defined('_JEXEC') or die;
$doc = JFactory::getDocument();
$user = JFactory::getUser();
$userId = $user->id;
$listOrder = $this->state->get('list.ordering');
$listDir = $this->state->get('list.direction');
$title2 = JText::_('COM_CCK_DOWNLOAD_THIS_VARIATION');
$top = !JCck::on() ? 'border-top' : 'content';
$config = JCckDev::init(array('42', 'button_submit', 'select_simple', 'text'), true, array('vName' => $this->vName));
$cck = JCckDev::preload(array('core_filter_input', 'core_filter_go', 'core_filter_search', 'core_filter_clear', 'core_location_filter'));
JText::script('COM_CCK_CONFIRM_DELETE');
Helper_Include::addDependencies($this->getName(), $this->getLayout());
?>
<form action="<?php
echo JRoute::_('index.php?option=' . $this->option . '&view=' . $this->getName());
?>
" method="post" id="adminForm" name="adminForm">
<?php
if (!empty($this->sidebar)) {
?>
<div id="j-sidebar-container" class="span2">
<?php
echo $this->sidebar;
?>
示例14: defined
**/
defined('_JEXEC') or die;
?>
<div class="seblod cck-padding-top-0 cck-padding-bottom-0">
<?php
echo JCckDev::renderLegend(JText::_('COM_CCK_DEFAULT_VALUES'));
?>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm('core_joomla_user_groups', '', $config, array('label' => 'User Groups', 'storage_field' => 'values[groups]'));
?>
</ul><div class="clr"></div>
<?php
echo JCckDev::renderLegend(JText::_('COM_CCK_SETTINGS'));
?>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm('core_bool', 0, $config, array('label' => 'Force Password', 'storage_field' => 'options[force_password]'));
?>
</ul><div class="clr"></div>
<?php
echo JCckDev::renderLegend(JText::_('COM_CCK_UPDATE'));
?>
<ul class="adminformlist adminformlist-2cols">
<?php
echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Update By Key', 'defaultvalue' => 'email', 'selectlabel' => '', 'options' => 'ID=id||Email=email||Username=username||', 'storage_field' => 'options[key]'));
echo JCckDev::renderForm('core_dev_select', '', $config, array('label' => 'Update By Diff', 'selectlabel' => 'None', 'options' => 'Update By Diff Desc=optgroup||Block=block', 'storage_field' => 'options[diff]'));
?>
</ul>
</div>
示例15: prepareExport
//.........这里部分代码省略.........
}
// Name & Root
if ($isApp) {
$filename = 'app_cck_' . $name;
} else {
if ($isCck) {
$filename = 'cck_' . $name;
} else {
$filename = $name;
}
if (isset($dependencies['categories']) && file_exists($data['root_content'] . '/joomla_category')) {
$items = JFolder::files($data['root_content'] . '/joomla_category', '\\.xml$');
if (count($items) == 1 && isset($items[0]) && $data['root_category'] != '' && JFile::stripExt($items[0]) == $data['root_category']) {
JFolder::delete($data['root_content'] . '/joomla_category');
}
}
}
// Elements
if ($copyright) {
CCK_Export::update($data['root_elements'], $copyright);
}
// Xml
$folders[0]->description = 'SEBLOD 3.x ' . $folders[0]->title . ' App - www.seblod.com';
$folders[0]->name = $filename;
$folders[0]->title = 'pkg_' . $folders['0']->name;
$manifest = NULL;
$xml = CCK_Export::preparePackage($folders[0]);
if (is_object($xml)) {
$manifest = JPATH_ADMINISTRATOR . '/manifests/packages/pkg_' . $filename . '.xml';
if (is_file($manifest)) {
if ($copyright) {
CCK_Export::update($manifest, $copyright);
}
$manifest = JCckDev::fromXML($manifest);
$tags = array('copyright', 'creationDate', 'description', 'packager', 'packageurl', 'version');
if (is_object($manifest)) {
foreach ($tags as $tag) {
if (isset($manifest->{$tag}) && isset($xml->{$tag}) && $manifest->{$tag} != $xml->{$tag}) {
$xml->{$tag} = (string) $manifest->{$tag};
}
}
}
}
}
// Filename
$path_zip = $tmp_path . '/' . $filename;
if (isset($options['filename_version']) && $options['filename_version']) {
$path_zip .= '_' . (isset($manifest->version) ? $manifest->version : '1.0.0');
}
if (isset($options['filename_date']) && $options['filename_date']) {
$path_zip .= '_' . JFactory::getDate()->format('Y_m_d');
}
$path_zip .= '.zip';
// Script
if (is_file(JPATH_ADMINISTRATOR . '/manifests/packages/' . $name . '/pkg_script.php')) {
if ($copyright) {
CCK_Export::update(JPATH_ADMINISTRATOR . '/manifests/packages/' . $name . '/pkg_script.php', $copyright);
}
}
// todo: else
$script = $xml->addChild('scriptfile', 'pkg_script.php');
JFile::copy(JPATH_SITE . '/libraries/cck/development/apps/script.php', $path . '/pkg_script.php');
$buffer = JFile::read($path . '/pkg_script.php');
$buffer = str_replace('%class%', $filename, $buffer);
JFile::write($path . '/pkg_script.php', $buffer);
if ($copyright) {