本文整理汇总了PHP中JCckDevHelper::hasLanguageAssociations方法的典型用法代码示例。如果您正苦于以下问题:PHP JCckDevHelper::hasLanguageAssociations方法的具体用法?PHP JCckDevHelper::hasLanguageAssociations怎么用?PHP JCckDevHelper::hasLanguageAssociations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCckDevHelper
的用法示例。
在下文中一共展示了JCckDevHelper::hasLanguageAssociations方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onCCK_Storage_LocationAfterRender
public static function onCCK_Storage_LocationAfterRender(&$buffer, &$data, $uri = array())
{
$app = JFactory::getApplication();
if ($uri['layout']) {
return;
}
if ($uri['view'] == 'featured') {
$data['return_view'] = 'featured';
$tag = '&return=featured';
} else {
$data['return_view'] = '';
$tag = '';
}
$class = JCck::on('3.4') ? ' class="hasTooltip"' : '';
$data['doIntegration'] = false;
$data['multilanguage'] = $data['options']->get('multilanguage', 0);
if ($data['multilanguage']) {
$data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)" (.*)>#U';
} else {
$data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)"#';
}
$data['search_alt'] = '#<a href = "javascript://" onclick="listItemTask\\(\'cb([0-9]*)\', \'articles.archive\'\\)">(.*)</a>#sU';
if (JCckDevHelper::hasLanguageAssociations() && $data['multilanguage']) {
$query = 'SELECT a.pk, a.cck, b.key, c.language FROM #__cck_core AS a' . ' LEFT JOIN #__associations AS b ON ( b.id = a.pk AND context = "com_content.item" )' . ' LEFT JOIN #__content AS c ON c.id = a.pk' . ' WHERE storage_location="joomla_article"';
$list_assoc = JCckDatabase::loadObjectListArray('SELECT a.id, a.key, b.language FROM #__associations AS a LEFT JOIN #__content AS b ON ( b.id = a.id AND a.context = "com_content.item" )', 'key', 'language');
} else {
$query = 'SELECT pk, cck FROM #__cck_core WHERE storage_location="joomla_article"';
$list_assoc = array();
}
$list = JCckDatabase::loadObjectList($query, 'pk');
$buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list, $list_assoc);
}
示例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 : '';
// Validate
$validate = '';
if ($config['doValidation'] > 1) {
plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config);
$validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : '';
}
// Prepare
$assoc = JCckDevHelper::hasLanguageAssociations();
$form = '';
if ($assoc && $config['pk']) {
if (isset($config['base']->location) && $config['base']->location) {
$location = $config['base']->location;
} else {
$location = JCckdatabase::loadResult('SELECT storage_location FROM #__cck_core_types WHERE name = "' . $config['type'] . '"');
}
if (is_file(JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php')) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/classes/helper.php';
$form = JCck::callFunc_Array('plgCCK_Storage_Location' . $location . '_Helper', 'getAssociationsForm', array($id, $name, $config));
}
}
// Set
if (!$field->variation) {
$field->form = $form;
if ($field->script) {
parent::g_addScriptDeclaration($field->script);
}
} else {
//
}
$field->value = $value;
// Return
if ($return === true) {
return $field;
}
}
示例3: rewriteBuffer
public static function rewriteBuffer($buffer, $data, $list, $list_assoc = array())
{
$app = JFactory::getApplication();
$class = JCck::on('3.4') ? ' class="hasTooltip"' : '';
$idx = 0;
$idx2 = 2;
$idx3 = 3;
$items = array();
$list2 = array();
$multilanguage = 0;
if (JCckDevHelper::hasLanguageAssociations()) {
$multilanguage = isset($data['multilanguage']) && $data['multilanguage'] ? 1 : 0;
}
$pks = '';
$return = $data['return_view'] ? '&return_o=' . $data['return_option'] . '&return_v=' . $data['return_view'] : '&return_o=' . $data['return_option'];
preg_match_all($data['search'], $buffer, $matches);
if (strpos($data['search'], '>') !== false) {
$isComplete = true;
$markup_end = '';
} else {
$isComplete = false;
$markup_end = '>';
}
$opt_default_type = $data['options']->get('default_type', '');
$opt_edit_alt = $data['options']->get('edit_alt', 1);
if (count($matches[$idx2])) {
if ($data['options']->get('edit', 0) == 1) {
$i = 0;
foreach ($matches[$idx2] as $k => $m) {
$type = @$list[$m]->cck;
$type = $type ? '&type=' . $type : '&type=' . $opt_default_type;
$search = $matches[$idx][$k];
$list2[$m] = array('link' => 'index.php?option=com_cck&view=form' . $return . $type . '&id=' . $m . $data['replace_end']);
$replace = '<a' . $class . ' href="' . $list2[$m]['link'];
if ($isComplete) {
$replace .= ' ' . $matches[$idx3][$k] . '>';
}
$buffer = str_replace($search, $replace, $buffer);
$items[$i] = $matches[$idx][$k];
$i++;
}
} else {
$i = 0;
foreach ($matches[$idx2] as $k => $m) {
if (isset($list[$m]->cck)) {
$type = $list[$m]->cck;
$type = $type ? '&type=' . $type : '&type=' . $opt_default_type;
$search = $matches[$idx][$k];
$list2[$m] = array('link' => 'index.php?option=com_cck&view=form' . $return . $type . '&id=' . $m . $data['replace_end']);
$replace = '<a' . $class . ' href="' . $list2[$m]['link'];
if ($isComplete) {
$replace .= ' ' . $matches[$idx3][$k] . '>';
}
$buffer = str_replace($search, $replace, $buffer);
$items[$i] = $matches[$idx][$k];
$i++;
}
}
}
}
if (JCck::on()) {
if ($data['search_alt']) {
$search = $data['search_alt'];
preg_match_all($search, $buffer, $matches2);
if (count($matches2[0])) {
if ($multilanguage) {
$languages = JLanguageHelper::getLanguages('lang_code');
}
foreach ($matches2[0] as $k => $m) {
$pk = $matches[$idx2][$k];
$pre = '';
$row = $matches2[0][$k];
$search = '';
$t_add = '';
$t_edit = '';
if (isset($matches[$idx][$k])) {
if ($opt_edit_alt) {
if (isset($list2[$pk])) {
$text = '<span class="icon-pencil"></span> ' . JText::_('JTOOLBAR_EDIT') . ' (' . JText::_('LIB_CCK_LEGACY') . ')';
$pre = $matches[$idx][$k] . $markup_end . $text . '</a></li>';
} else {
$link = 'index.php?option=com_cck&view=form' . $return . '&type=' . $opt_default_type . '&id=' . $pk . $data['replace_end'];
$text = '<span class="icon-pencil"></span> ' . JText::_('JTOOLBAR_EDIT') . ' (' . JText::_('LIB_CCK_SEBLOD') . ')';
$pre = '<a href="' . $link . '">' . $text . '</a></li>';
}
}
if ($multilanguage) {
if (isset($list[$pk]) && $list[$pk]->key) {
$cur = $list[$pk]->language;
$key = $list[$pk]->key;
$link = 'index.php?option=com_cck&view=form' . $return . '&type=' . $list[$pk]->cck;
foreach ($languages as $l => $v) {
if ($cur != $l) {
if (isset($list_assoc[$key][$l])) {
$link2 = $link . '&id=' . $list_assoc[$key][$l]->id . $data['replace_end'];
$t_edit .= '<li><a href="' . $link2 . '&plop=1"><span class="icon-arrow-right-3"> ' . $l . '</a></li>';
} else {
$link2 = $link . '&translate=' . $l . '&translate_id=' . $pk . $data['replace_end'];
$t_add .= '<li><a href="' . $link2 . '"><span class="icon-arrow-right-3"> ' . $l . '</a></li>';
}
//.........这里部分代码省略.........
示例4: getRouteByStorage
public static function getRouteByStorage(&$storage, $sef, $itemId, $config = array())
{
if (isset($storage[self::$table]->_route)) {
return JRoute::_($storage[self::$table]->_route);
}
if ($sef) {
if ($sef == '0' || $sef == '1') {
$path = '&catid=' . $storage[self::$table]->catid;
} elseif ($sef[0] == '4') {
$path = '&catid=' . (isset($storage[self::$table]->parent_alias) ? $storage[self::$table]->parent_alias : $storage[self::$table]->parent_id);
} elseif ($sef[0] == '3') {
$path = '&typeid=' . $config['type'];
} else {
$path = '';
}
if (is_object($storage[self::$table])) {
$storage[self::$table]->_route = self::_getRoute($sef, $itemId, $storage[self::$table]->slug, $path);
}
// Multilanguage Associations
if (JCckDevHelper::hasLanguageAssociations()) {
// TODO (mod_cck_lang...)
}
} else {
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
$storage[self::$table]->_route = ContentHelperRoute::getCategoryRoute($storage[self::$table]->id);
}
return JRoute::_($storage[self::$table]->_route);
}
示例5: getRouteByStorage
public static function getRouteByStorage(&$storage, $sef, $itemId, $config = array(), $lang_tag = '')
{
if (isset($storage[self::$table]->_route) && !$lang_tag) {
return JRoute::_($storage[self::$table]->_route);
}
if ($sef) {
if ($sef == '0' || $sef == '1') {
$path = '&catid=' . $storage[self::$table]->catid;
} elseif ($sef[0] == '4') {
$path = '&catid=' . (isset($storage[self::$table]->category_alias) ? $storage[self::$table]->category_alias : $storage[self::$table]->catid);
} elseif ($sef[0] == '3') {
$path = '&typeid=' . $config['type'];
} else {
$path = '';
}
if (is_object($storage[self::$table])) {
$storage[self::$table]->_route = self::_getRoute($sef, $itemId, $storage[self::$table]->slug, $path);
}
// Multilanguage Associations
if (JCckDevHelper::hasLanguageAssociations()) {
$app = JFactory::getApplication();
$pk = $storage[self::$table]->id;
if ($app->input->get('view') == 'article' && $app->input->get('id') == $storage[self::$table]->id && !count(self::$routes)) {
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
$assoc_c = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $pk);
$assoc_m = MenusHelper::getAssociations($itemId);
$languages = JLanguageHelper::getLanguages();
$lang_code = JFactory::getLanguage()->getTag();
foreach ($languages as $l) {
if ($lang_code == $l->lang_code) {
self::$routes[$l->lang_code] = $storage[self::$table]->_route;
} else {
$itemId2 = isset($assoc_m[$l->lang_code]) ? $assoc_m[$l->lang_code] : 0;
$pk2 = isset($assoc_c[$l->lang_code]) ? (int) $assoc_c[$l->lang_code]->id : 0;
self::$routes[$l->lang_code] = '';
if ($pk2 && $itemId2) {
self::$routes[$l->lang_code] = self::getRoute($pk2, $sef, $itemId2, $config, $l->sef);
}
}
}
}
}
} else {
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
$storage[self::$table]->_route = ContentHelperRoute::getArticleRoute($storage[self::$table]->slug, $storage[self::$table]->catid, $storage[self::$table]->language);
}
return JRoute::_($storage[self::$table]->_route);
}