本文整理汇总了PHP中JCckPluginField::g_onCCK_FieldPrepareContent方法的典型用法代码示例。如果您正苦于以下问题:PHP JCckPluginField::g_onCCK_FieldPrepareContent方法的具体用法?PHP JCckPluginField::g_onCCK_FieldPrepareContent怎么用?PHP JCckPluginField::g_onCCK_FieldPrepareContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCckPluginField
的用法示例。
在下文中一共展示了JCckPluginField::g_onCCK_FieldPrepareContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Prepare
$link = '';
$html = '';
$text = '';
if ($value) {
$app = JFactory::getApplication();
$menu = $app->getMenu()->getItem($value);
if (is_object($menu)) {
$link = JRoute::_('index.php?Itemid=' . $value);
$text = $menu->title;
$html = '<a href="' . $link . '">' . $text . '</a>';
} else {
$value = '';
}
}
// Set
$field->html = $html;
$field->link = $link;
$field->linked = true;
$field->text = $text;
$field->typo_target = 'text';
$field->value = $value;
}
示例2: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
$html = '';
if ($value || ($config['client'] == 'list' || $config['client'] == 'item')) {
$location = isset($config['location']) && $config['location'] ? $config['location'] : 'joomla_article';
$properties = array('context');
$properties = JCck::callFunc('plgCCK_Storage_Location' . $location, 'getStaticProperties', $properties);
/* temporary fix for content categories */
if ($properties['context'] == 'com_categories.category') {
$properties['context'] = 'com_content.category';
// todo: dynamic context per extension (#__categories)
}
/* temporary fix for content categories */
if (is_object($value) && isset($value->tags)) {
$value = $value->tags;
}
$tags = new JHelperTags();
$tags->getItemTags($properties['context'], $config['pk']);
$tagLayout = new JLayoutFile('joomla.content.tags');
$html = $tagLayout->render($tags->itemTags);
}
// Set
$field->value = $value;
$field->html = $html;
}
示例3: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Init
$options2 = JCckDev::fromJSON($field->options2);
$divider = '';
$lang_code = '';
$value2 = '';
/* tmp */
$jtext = $config['doTranslation'];
$config['doTranslation'] = 0;
/* tmp */
// Prepare
self::_languageDetection($lang_code, $value2, $options2);
if ($field->bool3) {
$divider = $field->divider != '' ? $field->divider : ',';
}
$options_2 = self::_getOptionsList($options2, $field->bool2, $lang_code, true);
$field->options = $field->options ? $field->options . '||' . $options_2 : $options_2;
// Set
$field->text = parent::g_getOptionText($value, $field->options, $divider, $config);
$field->value = $value;
$field->typo_target = 'text';
/* tmp */
$config['doTranslation'] = $jtext;
/* tmp */
}
示例4: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
}
示例5: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Init
$id = $field->name;
// Prepare
// Prepare
$html = '';
if ($field->state) {
$group_id = $field->location != '' ? $field->location : 'cck_tabs1';
if ($field->bool == 2) {
$html = JCckDevTabs::end();
} elseif ($field->bool == 1) {
$html = JCckDevTabs::open($group_id, $id, $field->label);
} else {
$html = JCckDevTabs::start($group_id, $id, $field->label, array('active' => $id));
}
}
// Set
$field->html = $html;
$field->value = $field->label;
$field->label = '';
}
示例6: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Init
$html = '';
// Prepare
if ($field->bool == 2) {
$html = '</div>';
} elseif ($field->bool == 1) {
$class = $field->markup_class ? ' class="' . trim($field->markup_class) . '"' : '';
$attr = $class . ($field->attributes ? ' ' . $field->attributes : '');
$html = '</div><div' . $attr . '>';
} else {
$class = $field->markup_class ? ' class="' . trim($field->markup_class) . '"' : '';
$attr = $class . ($field->attributes ? ' ' . $field->attributes : '');
$html = '<div' . $attr . '>';
}
// Set
$field->html = $html;
$field->value = '';
$field->label = '';
}
示例7: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
$name = $field->name;
$dispatcher = JDispatcher::getInstance();
$f = self::_getChild($field, $config);
$xn = $value;
$content = array();
if ($xn > 0 && is_object($f)) {
for ($xi = 0; $xi < $xn; $xi++) {
$f_value = '';
$inherit = array('parent' => $field->name, 'xi' => $xi);
$content[$xi] = clone $f;
//
$table = $f->storage_table;
if ($table && !isset($config['storages'][$table])) {
$config['storages'][$table] = '';
$dispatcher->trigger('onCCK_Storage_LocationPrepareForm', array(&$f, &$config['storages'][$table], $config['pk']));
}
$dispatcher->trigger('onCCK_StoragePrepareForm_Xi', array(&$f, &$f_value, &$config['storages'][$table], $name, $xi));
//
$dispatcher->trigger('onCCK_FieldPrepareContent', array(&$content[$xi], $f_value, &$config, $inherit, true));
}
if ($content[0]) {
$field->display = $content[0]->display;
}
}
$field->value = $content;
}
示例8: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Init
$doTranslation = $config['doTranslation'];
if ($config['doTranslation']) {
$config['doTranslation'] = $field->bool8;
}
// Prepare
$divider = $field->divider != '' ? $field->divider : ',';
if (is_array($value)) {
$value = implode($divider, $value);
}
// Set
$field->text = parent::g_getOptionText($value, $field->options, $divider, $config);
$field->value = $value;
$texts = explode($divider, $field->text);
$values = explode($divider, $field->value);
if (count($values)) {
$field->values = array();
foreach ($values as $k => $v) {
$field->values[$k] = (object) array('text' => $texts[$k], 'typo_target' => 'text', 'value' => $v);
}
}
$field->typo_target = 'text';
$config['doTranslation'] = $doTranslation;
}
示例9: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Init
$id = $field->name;
$form_id = $field->name . '_form';
$name = $field->name;
$value = $field->label;
$field->label = '';
// Prepare
$pre_task = '';
$options2 = JCckDev::fromJSON($field->options2);
$task = isset($options2['task']) && $options2['task'] ? $options2['task'] : 'save';
$task_auto = isset($options2['task_auto']) && $options2['task_auto'] == '0' ? 0 : 1;
$task_id = isset($options2['task_id']) && $options2['task_id'] ? $options2['task_id'] : 0;
if ($task_id) {
$pre_task = htmlspecialchars('jQuery("#' . $form_id . '").append(\'<input type="hidden" name="tid" value="' . $task_id . '">\');');
}
$class = 'button btn' . ($field->css ? ' ' . $field->css : '');
if ($task == 'export' || $task == 'process') {
$click = '';
} else {
echo 'This task is not supported on the Content view.';
$field->html = '';
$field->value = '';
return;
}
$attr = 'class="' . $class . '"' . $click . ($field->attributes ? ' ' . $field->attributes : '');
if ($field->bool) {
$label = $value;
if (JCck::on()) {
if ($field->bool6 == 3) {
$label = '<span class="icon-' . $options2['icon'] . '"></span>';
$attr .= ' title="' . $value . '"';
} elseif ($field->bool6 == 2) {
$label = $value . "\n" . '<span class="icon-' . $options2['icon'] . '"></span>';
} elseif ($field->bool6 == 1) {
$label = '<span class="icon-' . $options2['icon'] . '"></span>' . "\n" . $value;
}
}
$type = $field->bool7 == 1 || !$click ? 'submit' : 'button';
$form = '<button type="' . $type . '" id="' . $id . '" name="' . $name . '" ' . $attr . '>' . $label . '</button>';
$tag = 'button';
} else {
$form = '<input type="submit" id="' . $id . '" name="' . $name . '" value="' . $value . '" ' . $attr . ' />';
$tag = 'input';
}
if ($form != '') {
$form = '<form action="' . JRoute::_('index.php?option=com_cck') . '" autocomplete="off" enctype="multipart/form-data" method="post" id="' . $form_id . '" name="' . $form_id . '">' . $form . '<input type="hidden" name="task" value="' . $task . '" />' . '<input type="hidden" name="cid" value="' . $config['id'] . '">' . '<input type="hidden" name="tid" value="' . $task_id . '">' . JHtml::_('form.token') . '</form>';
}
// Set
$field->html = $form;
$field->value = '';
}
示例10: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
$field->value = $value;
$field->text = JCckDatabase::loadResult('SELECT title FROM #__usergroups WHERE id = ' . (int) $value);
$field->typo_target = 'text';
}
示例11: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareContent($field, $config);
/*
if ( !$field->state ) {
$field->value = '';
return;
}
// TODO: SEBLOD 3.7 while checking for all Restriction plug-in behaviors..
*/
// Prepare
$name = $field->name;
$dispatcher = JDispatcher::getInstance();
$fields = self::_getChildren($field, $config);
$xn = 1;
$content = array();
for ($xi = 0; $xi < $xn; $xi++) {
foreach ($fields as $f) {
if (is_object($f)) {
$f_name = $f->name;
$f_value = '';
$inherit = array();
$content[$f_name] = clone $f;
$table = $f->storage_table;
if ($table && !isset($config['storages'][$table])) {
$config['storages'][$table] = '';
$dispatcher->trigger('onCCK_Storage_LocationPrepareForm', array(&$f, &$config['storages'][$table], $config['pk']));
}
$dispatcher->trigger('onCCK_StoragePrepareForm_Xi', array(&$f, &$f_value, &$config['storages'][$table], $name, $xi));
//
$dispatcher->trigger('onCCK_FieldPrepareContent', array(&$content[$f_name], $f_value, &$config, $inherit, true));
$target = $content[$f_name]->typo_target;
if ($content[$f_name]->link != '') {
$dispatcher->trigger('onCCK_Field_LinkPrepareContent', array(&$content[$f_name], &$config));
if ($content[$f_name]->link && !@$content[$f_name]->linked) {
JCckPluginLink::g_setHtml($content[$f_name], $target);
}
}
if (@$content[$f_name]->typo && $content[$f_name]->{$target} != '' && $config['doTypo']) {
$dispatcher->trigger('onCCK_Field_TypoPrepareContent', array(&$content[$f_name], $content[$f_name]->typo_target, &$config));
} else {
$content[$f_name]->typo = '';
}
$config['fields'][$f->name] = $content[$f_name];
}
}
}
// Set
$field->value = $content;
}
示例12: onCCK_FieldPrepareContentDebug
public function onCCK_FieldPrepareContentDebug(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Set
$field->value = $value;
$field->text = plgCCK_StorageLipsum::getLipsum(2);
$field->typo_target = 'text';
}
示例13: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
$value = $field->bool3 ? self::_bn2clear($value) : $value;
if ($value) {
$value = $field->bool2 ? $field->bool2 == 2 ? self::_bn2br_in_p($value) : self::_bn2p($value) : self::_bn2br($value);
}
$field->value = $value;
}
示例14: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
self::$path = parent::g_getPath(self::$type . '/');
parent::g_onCCK_FieldPrepareContent($field, $config);
// Prepare
$name = $field->name;
$dispatcher = JDispatcher::getInstance();
$fields = self::_getChildren($field, $config);
// TODO: call storage plugin.
$xn = $field->storage == 'xml' ? is_object($value) ? count($value->children()) : count($value) : $value;
$content = array();
for ($xi = 0; $xi < $xn; $xi++) {
foreach ($fields as $f) {
if (is_object($f)) {
$f_name = $f->name;
$f_value = '';
$inherit = array('parent' => $field->name, 'xi' => $xi);
$content[$xi][$f_name] = clone $f;
//
if ($field->storage == 'custom') {
$f->storage = $field->storage;
$f->storage_table = $field->storage_table;
$f->storage_field = $field->storage_field;
}
$table = $f->storage_table;
if ($table && !isset($config['storages'][$table])) {
$config['storages'][$table] = '';
$dispatcher->trigger('onCCK_Storage_LocationPrepareForm', array(&$f, &$config['storages'][$table], $config['pk']));
}
$dispatcher->trigger('onCCK_StoragePrepareForm_Xi', array(&$f, &$f_value, &$config['storages'][$table], $name, $xi, $field));
//
$f_value2 = (string) $f_value;
$dispatcher->trigger('onCCK_FieldPrepareContent', array(&$content[$xi][$f_name], $f_value2, &$config, $inherit, true));
$target = $content[$xi][$f_name]->typo_target;
if ($content[$xi][$f_name]->link != '') {
$dispatcher->trigger('onCCK_Field_LinkPrepareContent', array(&$content[$xi][$f_name], &$config));
if ($content[$xi][$f_name]->link && !@$content[$xi][$f_name]->linked) {
JCckPluginLink::g_setHtml($content[$xi][$f_name], $target);
}
}
if (@$content[$xi][$f_name]->typo && $content[$xi][$f_name]->{$target} != '' && $config['doTypo']) {
$dispatcher->trigger('onCCK_Field_TypoPrepareContent', array(&$content[$xi][$f_name], $content[$xi][$f_name]->typo_target, &$config));
} else {
$content[$xi][$f_name]->typo = '';
}
}
}
}
$field->value = $content;
}
示例15: onCCK_FieldPrepareContent
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Set
$value_json = JCckDev::fromJSON($value);
$options2 = JCckDev::fromJSON($field->options2);
if (is_array($value_json) && !empty($value_json)) {
$value = trim($value_json['image_location']) == '' ? trim($field->defaultvalue) : trim($value_json['image_location']);
$file_name = $value == '' ? '' : substr(strrchr(JFile::stripExt($value), '/'), 1);
$img_title = self::_getTitle(trim($value_json['image_title']), $file_name);
$img_title = htmlspecialchars($img_title, ENT_QUOTES);
$img_desc = isset($value_json['image_description']) ? trim($value_json['image_description']) : (isset($value_json['image_descr']) ? trim($value_json['image_descr']) : '');
$img_desc = self::_getAlt($img_desc, $img_title, $file_name);
$img_desc = htmlspecialchars($img_desc, ENT_QUOTES);
} else {
$value = trim($value) == '' ? trim($field->defaultvalue) : trim($value);
$file_name = $value == '' ? '' : substr(strrchr(JFile::stripExt($value), '/'), 1);
$img_title = $file_name;
$img_desc = $file_name;
}
if (@$options2['storage_format']) {
$value = $options2['path'] . (@$options2['path_content'] ? $config['pk'] . '/' : '') . $value;
}
if ($value && JFile::exists(JPATH_SITE . '/' . $value)) {
$path = substr($value, 0, strrpos($value, '/')) . '/';
for ($i = 1; $i < 11; $i++) {
$thumb = $path . '_thumb' . $i . '/' . substr(strrchr($value, '/'), 1);
$field->{'thumb' . $i} = JFile::exists(JPATH_SITE . '/' . $thumb) ? $thumb : '';
}
self::_addThumbs($field, $options2, $value, $path);
if (isset($options2['content_preview']) && $options2['content_preview']) {
$i = (int) $options2['content_preview'];
$field->html = $field->{'thumb' . $i} ? '<img src="' . $field->{'thumb' . $i} . '" title="' . $img_title . '" alt="' . $img_desc . '" />' : '<img src="' . $value . '" title="' . $img_title . '" alt="' . $img_desc . '" />';
} else {
$field->html = '<img src="' . $value . '" title="' . $img_title . '" alt="' . $img_desc . '" />';
}
$field->value = $value;
$field->image_title = $img_title;
$field->image_alt = $img_desc;
} else {
$field->value = '';
$field->html = '';
$field->image_title = '';
$field->image_alt = '';
}
$field->typo_target = 'html';
}