本文整理汇总了PHP中shTranslateUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP shTranslateUrl函数的具体用法?PHP shTranslateUrl怎么用?PHP shTranslateUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shTranslateUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: shGetNEWSPCategories
function shGetNEWSPCategories($catId, $option, $shLangName, &$cat, &$sec)
{
if (empty($catId)) {
return false;
}
static $catData = null;
$sefConfig =& Sh404sefFactory::getConfig();
if (!is_null($catData[$shLangName][$catId])) {
// get DB
$database =& JFactory::getDBO();
$query = "SELECT c.id, c.section, c.title, s.id as sectionid, s.title as stitle" . "\n FROM #__categories as c, #__sections as s" . "\n WHERE " . "\n s.id = c.section" . "\n AND c.id = '" . $catId . "'";
$database->setQuery($query);
if (shTranslateUrl($option, $shLangName)) {
$categories = $database->loadObjectList();
} else {
$categories = $database->loadObjectList(false);
}
if (!empty($categories)) {
$sec = ($sefConfig->shNewsPInsertSecId ? $sectionId . $sefConfig->replacement : '') . $categories[0]->stitle;
// section
$cat = ($sefConfig->shNewsPInsertCatId ? $sectionId . $sefConfig->replacement : '') . $categories[0]->title;
// category
$catData[$shLangName][$catId]['cat'] = $cat;
$catData[$shLangName][$catId]['sec'] = $sec;
}
} else {
$cat = $catData[$shLangName][$catId]['cat'];
$sec = $catData[$shLangName][$catId]['sec'];
}
return !empty($cat);
}
示例2: dm_sef_get_category_array
function dm_sef_get_category_array($category_id, $option, $shLangName)
{
global $shMosConfig_locale;
$sefConfig =& shRouter::shGetConfig();
// get DB
$database =& JFactory::getDBO();
static $DMtree = null;
if (empty($tree[$shMosConfig_locale])) {
$q = "SELECT id, title, parent_id FROM #__categories";
// load them all in memory
$database->setQuery($q);
if (!shTranslateUrl($option, $shLangName)) {
// V 1.2.4.m
$DMtree[$shMosConfig_locale] = $database->loadObjectList('id', false);
} else {
$DMtree[$shMosConfig_locale] = $database->loadObjectList('id');
}
}
$title = array();
if ($sefConfig->shDMInsertCategories == 1) {
// only one category
$title[] = ($sefConfig->shDMInsertCategoryId ? $DMtree[$shMosConfig_locale][$category_id]->id . $sefConfig->replacement : '') . $DMtree[$shMosConfig_locale][$category_id]->title;
} else {
do {
// all categories and subcategories. We don't really need id, as path
$title[] = ($sefConfig->shDMInsertCategoryId ? $DMtree[$shMosConfig_locale][$category_id]->id . $sefConfig->replacement : '') . $DMtree[$shMosConfig_locale][$category_id]->title;
// will always be unique
$category_id = $DMtree[$shMosConfig_locale][$category_id]->parent_id;
} while ($category_id != 0);
}
return array_reverse($title);
}
示例3: vm_sef_get_category_title
function vm_sef_get_category_title(&$db, &$catDesc, $category_id, $option, $shLangName)
{
global $shMosConfig_locale;
$sefConfig =& shRouter::shGetConfig();
if (empty($category_id)) {
return '';
}
$q = "SELECT c.category_name, c.category_id, c.category_description, x.category_parent_id FROM #__vm_category AS c";
$q .= "\n LEFT JOIN #__vm_category_xref AS x ON c.category_id = x.category_child_id;";
$db->setQuery($q);
if (!shTranslateUrl($option, $shLangName)) {
// V 1.2.4.m
$tree = $db->loadObjectList('category_id', false);
} else {
$tree = $db->loadObjectList('category_id');
}
$catDesc = $tree[$category_id]->category_description;
$title = '';
$securityCounter = 0;
do {
// all categories and subcategories
$securityCounter++;
$title .= ($sefConfig->shInsertCategoryId ? $tree[$category_id]->category_id . $sefConfig->replacement : '') . $tree[$category_id]->category_name . ' | ';
$category_id = $tree[$category_id]->category_parent_id;
} while ($category_id != 0 && $securityCounter < 10);
if ($securityCounter >= 10) {
JError::raiseError(500, 'Unable to create SEF url for Virtuemart: could not find category with id : ' . $category_id);
}
return JString::rtrim($title, ' | ');
}
示例4: shFetchPostId
function shFetchPostId($show, $option, $shLangName)
{
if (empty($show)) {
return null;
}
// get DB
$database =& JFactory::getDBO();
$sql = 'SELECT contentid from #__myblog_permalinks WHERE permalink = \'' . $show . '\'';
$database->setQuery($sql);
if (shTranslateUrl($option, $shLangName)) {
$postId = $database->loadResult();
} else {
$postId = $database->loadResult(false);
}
return isset($postId) ? $postId : '';
}
示例5: shGetFileName
function shGetFileName($id, $option, $shLangName)
{
if (empty($id)) {
return null;
}
$sefConfig =& shRouter::shGetConfig();
// get DB
$database =& JFactory::getDBO();
$database->setQuery('SELECT id, filetitle, containerid FROM #__downloads_files WHERE id = ' . $database->Quote($id));
if (!shTranslateUrl($option, $shLangName)) {
$rows = $database->loadRow(false);
} else {
$rows = $database->loadRow();
}
$title = shGetContainerName($rows[2], $option, $shLangName);
if (count($title) > 1) {
array_pop($title);
}
// V w 27/08/2007 13:56:13 remove trailling slash
$title[] = ($sefConfig->shRemoInsertDocId ? $id . $sefConfig->replacement : '') . $rows[1];
return $title;
}
示例6: dp_sef_get_category_array
function dp_sef_get_category_array($category_id, $option, $shLangName)
{
global $shMosConfig_locale;
$sefConfig =& shRouter::shGetConfig();
// get DB
$db =& JFactory::getDBO();
static $tree = null;
// V 1.2.4.m $tree must an array based on current language
$title = array();
if (SH404SEF_DP_INSERT_ALL_CATEGORIES == 0) {
return $title;
}
if (empty($tree[$shMosConfig_lang])) {
// load up all cat details
$q = 'SELECT title, id, parent_id FROM #__dp_categories';
$q .= "\n WHERE published <> '0';";
// V x
$db->setQuery($q);
if (!shTranslateUrl($option, $shLangName)) {
// V 1.2.4.m
$tree[$shMosConfig_lang] = $db->loadObjectList('id', false);
} else {
$tree[$shMosConfig_lang] = $db->loadObjectList('id');
}
}
if (SH404SEF_DP_INSERT_ALL_CATEGORIES == 1) {
// only one category
$title[] = (SH404SEF_DP_INSERT_CAT_ID != 0 ? $tree[$shMosConfig_lang][$category_id]->id . $sefConfig->replacement : '') . $tree[$shMosConfig_lang][$category_id]->title;
} else {
do {
// all categories and subcategories.
$title[] = (SH404SEF_DP_INSERT_CAT_ID ? $tree[$shMosConfig_lang][$category_id]->id . $sefConfig->replacement : '') . $tree[$shMosConfig_lang][$category_id]->title;
// will always be unique
$category_id = $tree[$shMosConfig_lang][$category_id]->parent_id;
} while ($category_id != 0);
}
return array_reverse($title);
}
示例7: shRemoveFromGETVarsList
$title[] = $sh_LANG[$shLangIso]['_HP_SEF_SENDENQUIRY'];
$title[] = $row->company_name;
shRemoveFromGETVarsList('id');
// Sendenquiry does not use this ID to determine whether this is directed to company or agent, the form has a hidden field called 'sbj' to distinguish this.
break;
}
break;
# View Agent Email
# View Agent Email
case 'viewagentemail':
$agent_id = id;
$title[] = $sh_LANG[$shLangIso]['_HP_SEF_EMAIL'];
shRemoveFromGETVarsList('task');
if (is_numeric($agent_id)) {
$database->setQuery("SELECT a.id, a.name AS agent_name, c.id, c.name AS company_name FROM #__hp_agents AS a" . "\nLEFT JOIN #__hp_companies AS c ON a.company = c.id" . "\nWHERE a.id = " . $database->Quote($agent_id) . "\nLIMIT 1");
if (shTranslateUrl($option, $shLangName)) {
$row = $database->loadObject();
} else {
$row = $database->loadObject(false);
}
$title[] = $row->company_name;
$title[] = $row->agent_name;
$title[] = '/';
shRemoveFromGETVarsList('id');
} else {
$dosef = false;
}
break;
# Standard Search
# Standard Search
case 'search':
示例8: explode
for ($ccnt = $first_url_cat; $ccnt <= $last_url_cat; $ccnt++) {
$title[] = $cat_titles[$ccnt];
}
/*print_r($title);
die($row->title);
exit;*/
}
// Add item title as URL segment
$row_title = $sefConfig->UseAlias ? $row->alias : $row->title;
$row_title .= $sefConfig->ContentTitleInsertArticleId ? "-" . $row->id : "";
$title[] = $row_title;
// V 1.2.4.j 2007/04/11 : numerical ID, on some categories only
if ($sefConfig->shInsertNumericalId && isset($sefConfig->shInsertNumericalIdCatList) && !empty($id) && $view == 'items' && !in_array($row->type_id, $globalnopath)) {
$q = 'SELECT id, catid, created FROM #__content WHERE id = ' . $database->Quote($id);
$database->setQuery($q);
if (shTranslateUrl($option, $shLangName) || !FLEXI_FISH) {
// V 1.2.4.m
$contentElement = $database->loadObject();
} else {
$contentElement = $database->loadObject(null, false);
}
if ($contentElement) {
$foundCat = array_search($contentElement->catid, $sefConfig->shInsertNumericalIdCatList);
if ($foundCat !== null && $foundCat !== false || $sefConfig->shInsertNumericalIdCatList[0] == '') {
// test both in case PHP < 4.2.0
$shTemp = explode(' ', $contentElement->created);
$title[] = str_replace('-', '', $shTemp[0]) . $contentElement->id;
}
}
}
shMustCreatePageId('set', true);
示例9: shGetArticleIdString
/**
* Returns a string with an article id, in accordance
* with various settings
* @param $id
* @param $view
* @param $option
* @param $shLangName
*/
function shGetArticleIdString($id, $view, $option, $shLangName)
{
$database =& JFactory::getDBO();
$sefConfig =& shRouter::shGetConfig();
// V 1.5.7 : article id, on some categories only
$articleId = '';
if ($sefConfig->ContentTitleInsertArticleId && isset($sefConfig->shInsertContentArticleIdCatList) && !empty($id) && $view == 'article') {
$q = 'SELECT id, catid FROM #__content WHERE id = ' . $id;
$database->setQuery($q);
if (shTranslateUrl($option, $shLangName)) {
// V 1.2.4.m
$contentElement = $database->loadObject();
} else {
$contentElement = $database->loadObject(false);
}
if ($contentElement) {
$foundCat = array_search($contentElement->catid, $sefConfig->shInsertContentArticleIdCatList);
if ($foundCat !== null && $foundCat !== false || $sefConfig->shInsertContentArticleIdCatList[0] == '') {
// test both in case PHP < 4.2.0
$articleId = $contentElement->id;
}
}
}
return $articleId;
}
示例10: vmSefGetProductName
function vmSefGetProductName($productId, $option, $shLangName, $shLangIso)
{
if (empty($productId)) {
return null;
}
global $sh_LANG;
$sefConfig =& shRouter::shGetConfig();
// get DB
$database =& JFactory::getDBO();
$q = "SELECT product_id, product_sku, product_name FROM #__vm_product";
// then try to add its name as well
$q .= "\n WHERE product_id = " . $database->Quote($productId);
$database->setQuery($q);
if (!shTranslateUrl($option, $shLangName)) {
$row = $database->loadObject(false);
} else {
$row = $database->loadObject();
}
if (empty($row)) {
// non name available
return $sh_LANG[$shLangIso]['_PHPSHOP_PRODUCT'] . $sefConfig->replacement . $product_id;
}
$shName = '';
if ($sefConfig->shInsertProductId) {
$shName .= $row->product_id;
}
if ($sefConfig->shVmUseProductSKU) {
$shName .= (empty($shName) ? '' : $sefConfig->replacement) . $row->product_sku;
}
if ($sefConfig->shVmInsertProductName) {
$shName .= (empty($shName) ? '' : $sefConfig->replacement) . $row->product_name;
}
if (empty($shName)) {
$shName = $row->product_name;
}
return $shName;
}
示例11: shInitializePlugin
function shInitializePlugin($lang, &$shLangName, &$shLangIso, $option) {
$conf =& JFactory::getConfig();
$configDefaultLanguage = $conf->getValue('config.language');
$shLangName = empty($lang) ? Sh404sefFactory::getPageInfo()->shMosConfig_locale : shGetNameFromIsoCode( $lang);
$shLangIso = (shTranslateUrl($option, $shLangName)) ?
(isset($lang) ? $lang : shGetIsoCodeFromName( Sh404sefFactory::getPageInfo()->shMosConfig_locale))
: (isset($configDefaultLanguage) ? shGetIsoCodeFromName($configDefaultLanguage) : shGetIsoCodeFromName( Sh404sefFactory::getPageInfo()->shMosConfig_locale));
if (strpos($shLangIso, '_') !== false) {
//11/08/2007 14:30:16 mambo compat
$shTemp = explode( '_', $shLangIso);
$shLangIso = $shTemp[0];
}
// reset pageid creation : the plugin must turn it on by itself
shMustCreatePageId( 'set', false);
// added protection : do not SEF if component is not installed. Do not attempt to build SEF URL
// if component is not installed, or else plugin may try to read from comp DB tables. This will cause DB table names
// to be displayed
return !sh404SEF_CHECK_COMP_IS_INSTALLED
|| ( sh404SEF_CHECK_COMP_IS_INSTALLED &&
shFileExists(sh404SEF_ABS_PATH.'components/'.$option.'/'.str_replace('com_', '',$option).'.php'));
}
示例12: shGetJSVideoTitle
function shGetJSVideoTitle($id, $option, $shLangName)
{
$sefConfig =& Sh404sefFactory::getConfig();
$database =& JFactory::getDBO();
$query = 'SELECT id, title, category_id FROM #__community_videos WHERE id = ' . $database->Quote($id);
$database->setQuery($query);
if (!shTranslateUrl($option, $shLangName)) {
$result = $database->loadObject(false);
} else {
$result = $database->loadObject();
}
$videoName = ($sefConfig->shJSInsertVideoId ? $id . $sefConfig->replacement : '') . $result->title;
// optionnally insert video category
if ($sefConfig->shJSInsertVideoCat) {
$title = array(shGetJSVideoCategoryTitle($result->category_id, $option, $shLangName), $videoName);
} else {
$title = array($videoName);
}
return $title;
}
示例13: shKUTopicName
function shKUTopicName($topicid, $option, $shLangIso, $shLangName)
{
static $topics = array();
$sefConfig =& shRouter::shGetConfig();
if (empty($topicid) || !$sefConfig->shFbInsertMessageSubject) {
return '';
}
if (class_exists('KunenaForum')) {
// Kunena 2.0 support
$topic = KunenaForumTopic::getInstance($topicid);
$topicsubject = $topic->subject;
} elseif (class_exists('KunenaRouter')) {
// Kunena 1.6 support
if (empty(KunenaRouter::$msgidcache[$topicid])) {
$database =& JFactory::getDBO();
$query = 'SELECT subject, id FROM #__kunena_messages WHERE id=' . (int) $topicid;
$database->setQuery($query);
KunenaRouter::$msgidcache[$topicid] = $database->loadResult();
}
$topicsubject = KunenaRouter::$msgidcache[$topicid];
} else {
// Kunena 1.0 / 1.5 support
if (empty($topics[$topicid])) {
$database =& JFactory::getDBO();
$query = 'SELECT id, subject FROM #__fb_messages WHERE id = ' . (int) $topicid;
$database->setQuery($query);
if (!shTranslateUrl($option, $shLangName)) {
$topicDetails = $database->loadObject(false);
} else {
$topicDetails = $database->loadObject();
}
$topics[$topicid] = empty($topicDetails) ? '' : $topicDetails->subject;
}
$topicsubject = $topics[$topicid];
}
// we have a user name
$topicstring = empty($topicsubject) ? 't' . $sefConfig->replacement . $topicid : ($sefConfig->shFbInsertMessageId ? $topicid . $sefConfig->replacement : '');
// if name, put ID only if requested
$topicstring = $topicstring . (empty($topicsubject) ? '' : $topicsubject);
return $topicstring;
}
示例14: shKUTopicName
function shKUTopicName($topicid, $option, $shLangIso, $shLangName)
{
static $topics = array();
$sefConfig =& shRouter::shGetConfig();
if (empty($topicid) || !$sefConfig->shFbInsertMessageSubject) {
return '';
}
if (empty($topics[$topicid])) {
$database =& JFactory::getDBO();
$query = "SELECT id, subject FROM #__fb_messages where id = " . $database->Quote($topicid);
$database->setQuery($query);
if (!shTranslateUrl($option, $shLangName)) {
$topicDetails = $database->loadObject(false);
} else {
$topicDetails = $database->loadObject();
}
if (!empty($topicDetails)) {
$topics[$topicid] = $topicDetails->subject;
}
}
// we have a user name
$topicstring = empty($topics[$topicid]) ? 't' . $sefConfig->replacement . $topicid : ($sefConfig->shFbInsertMessageId ? $topicid . $sefConfig->replacement : '');
// if name, put ID only if requested
$topicstring = $topicstring . (empty($topics[$topicid]) ? '' : $topics[$topicid]);
return $topicstring;
}
示例15: shMustCreatePageId
$dosef = false;
}
break;
default:
if (sh404SEF_PDF_DIR && $view == 'article' && !empty($format) && $format == 'pdf') {
$title[] = sh404SEF_PDF_DIR; // insert pdf directory
shMustCreatePageId( 'set', true);
}
// V 1.2.4.j 2007/04/11 : numerical ID, on some categories only
if ($sefConfig->shInsertNumericalId && isset($sefConfig->shInsertNumericalIdCatList)
&& !empty($id) && ($view == 'article')) {
$q = 'SELECT id, catid, created FROM #__content WHERE id = '.$database->Quote( $id);
$database->setQuery($q);
if (shTranslateUrl($option, $shLangName)) // V 1.2.4.m
$contentElement = $database->loadObject( );
else $contentElement = $database->loadObject( false);
if ($contentElement) {
$foundCat = array_search($contentElement->catid, $sefConfig->shInsertNumericalIdCatList);
if (($foundCat !== null && $foundCat !== false)
|| ($sefConfig->shInsertNumericalIdCatList[0] == '')) { // test both in case PHP < 4.2.0
$shTemp = explode(' ', $contentElement->created);
$title[] = str_replace('-','', $shTemp[0]).$contentElement->id;
}
}
}
// use libray function to fetch Joomla content title
if ($task == 'article.edit') {
if (empty($a_id)) { // submit new article