function shGetJSGroupTitleArray($id, $option, $shLangName) { $sefConfig =& Sh404sefFactory::getConfig(); try { $result = ShlDbHelper::selectObject('#__community_groups', array('id', 'name', 'categoryid'), array('id' => $id)); } catch (Exception $e) { ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage()); } $prefix = !is_object($result) || empty($result->name) || $sefConfig->shJSInsertGroupId ? $id : ''; $groupName = !is_object($result) || empty($result->name) ? '' : $result->name; $groupName = $prefix . (empty($groupName) ? '' : $sefConfig->replacement) . $groupName; // optionnally insert group category if ($sefConfig->shJSInsertGroupCategory) { $title = array(shGetJSGroupCategoryTitle($result->categoryid, $option, $shLangName), $groupName); } else { $title = array($groupName); } return $title; }
function shGetJSGroupTitleArray($id, $option, $shLangName) { $sefConfig =& Sh404sefFactory::getConfig(); $database =& JFactory::getDBO(); $query = 'SELECT id, name, categoryid FROM #__community_groups WHERE id = ' . $database->Quote($id); $database->setQuery($query); if (!shTranslateUrl($option, $shLangName)) { $result = $database->loadObject(false); } else { $result = $database->loadObject(); } $prefix = !is_object($result) || empty($result->name) || $sefConfig->shJSInsertGroupId ? $id : ''; $groupName = !is_object($result) || empty($result->name) ? '' : $result->name; $groupName = $prefix . (empty($groupName) ? '' : $sefConfig->replacement) . $groupName; // optionnally insert group category if ($sefConfig->shJSInsertGroupCategory) { $title = array(shGetJSGroupCategoryTitle($result->categoryid, $option, $shLangName), $groupName); } else { $title = array($groupName); } return $title; }