本文整理汇总了PHP中Alias::selectByAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP Alias::selectByAlias方法的具体用法?PHP Alias::selectByAlias怎么用?PHP Alias::selectByAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alias
的用法示例。
在下文中一共展示了Alias::selectByAlias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAliasId
public function getAliasId()
{
$intReturn = 0;
if ($this->usesAliases()) {
$strRewrite = Request::get('rewrite');
if (!empty($strRewrite)) {
$strRewrite = rtrim($strRewrite, " \\/");
switch ($strRewrite) {
case "sitemap.xml":
//*** Automatic Sitemap generation.
header("Content-type: text/xml");
echo $this->renderSitemap();
exit;
break;
default:
if (strtolower(substr($strRewrite, 0, 4)) == "eid/") {
//*** Clean the rewrite string.
$strRewrite = $this->cleanRewrite($strRewrite);
//*** Google friendly eid URL.
$strUrl = substr($strRewrite, 4);
if (is_numeric($strUrl)) {
$intReturn = $strUrl;
}
} else {
if (strtolower(substr($strRewrite, 0, 15)) == "download/media/") {
//*** Google friendly media URL.
$arrMediaPath = explode("/", substr($strRewrite, 15));
$blnInline = count($arrMediaPath) > 1 && $arrMediaPath[1] == "inline" ? TRUE : FALSE;
$strMediaId = $arrMediaPath[0];
if (is_numeric($strMediaId)) {
$this->downloadMediaItem($strMediaId, $blnInline);
exit;
break;
}
} else {
if (strtolower(substr($strRewrite, 0, 9)) == "download/") {
//*** Google friendly element field URL.
$arrMediaPath = explode("/", substr($strRewrite, 9));
$blnInline = count($arrMediaPath) > 1 && $arrMediaPath[1] == "inline" ? TRUE : FALSE;
$arrField = explode("_", $arrMediaPath[0]);
if (is_numeric($arrField[0])) {
$intIndex = count($arrField) > 1 ? $arrField[1] : 0;
$this->downloadElementField($arrField[0], $intIndex, "", $blnInline);
exit;
break;
}
} else {
if (stristr($strRewrite, "/eid/") !== FALSE) {
//*** Clean the rewrite string.
$strRewrite = $this->cleanRewrite($strRewrite);
//*** Google friendly eid URL after language definition.
$strUrl = substr(stristr($strRewrite, "eid/"), 4);
if (is_numeric($strUrl)) {
$intReturn = $strUrl;
}
} else {
//*** Clean the rewrite string.
$strRewrite = $this->cleanRewrite($strRewrite);
//*** Get the alias.
if (!empty($strRewrite)) {
$objUrls = Alias::selectByAlias($strRewrite);
if (!is_null($objUrls) && $objUrls->count() > 0) {
$strUrl = $objUrls->current()->getUrl();
if (is_numeric($strUrl)) {
$intReturn = $strUrl;
} else {
Request::redirect($strUrl);
}
}
}
}
}
}
}
}
}
}
return $intReturn;
}
示例2: ContentLanguage
$_CONF['app']['languageDefault'] = $objLang->default;
}
}
}
$objTemp = new ContentLanguage();
$objTemp->setId($_CONF['app']['language']);
$objTemp->setAbbr($_CONF['app']['languageAbbr']);
$objTemp->setName($_CONF['app']['languageName']);
$objTemp->default = $_CONF['app']['languageDefault'];
$objTemp->setActive(TRUE);
$objCms->setLanguage($objTemp);
//*** Check if the current alias is forcing a language switch.
if (!empty($strRewrite)) {
$strRewrite = $objCms->cleanRewrite($strRewrite);
//*** Get aliases for this URL.
$objUrls = Alias::selectByAlias($strRewrite);
if (!is_null($objUrls) && $objUrls->count() > 0) {
//*** Check if the current language is in the list of aliases.
$blnFoundLanguage = false;
foreach ($objUrls as $objUrl) {
$intLanguage = $objUrl->getLanguageId();
if (($intLanguage == 0 || $intLanguage == $objCms->getLanguage()->getId()) && $objUrl->getActive()) {
$blnFoundLanguage = true;
break;
}
}
if (!$blnFoundLanguage) {
//*** Current language is not valid for this alias.
$objUrls->rewind();
$objUrl = $objUrls->current();
if ($objUrl->getActive()) {
示例3: importIn
//.........这里部分代码省略.........
}
}
}
}
if ($validTemplateStructure || !$validate) {
//*** Import elements
foreach ($objDoc->childNodes as $rootNode) {
foreach ($rootNode->childNodes as $logicNode) {
if ($logicNode->nodeName == "logic") {
foreach ($logicNode->childNodes as $childNode) {
switch ($childNode->nodeName) {
case "languages":
// Get all languages
$arrCurrentLangs = array();
$objContentLangs = ContentLanguage::select();
$objDefaultLang = NULL;
foreach ($objContentLangs as $objContentLang) {
$arrCurrentLangs[$objContentLang->getAbbr()] = $objContentLang->getId();
if ($objContentLang->default == 1) {
$objDefaultLang = $objContentLang;
}
}
$arrLanguageIds[0] = 0;
// loop trough languages from export
foreach ($childNode->childNodes as $languageNode) {
// if abbreviations match, use that language ID
if (array_key_exists($languageNode->getAttribute('abbr'), $arrCurrentLangs)) {
$arrLanguageIds[$languageNode->getAttribute("id")] = $arrCurrentLangs[$languageNode->getAttribute('abbr')];
} else {
// if no match, use default current language
$arrLanguageIds[$languageNode->getAttribute("id")] = $arrCurrentLangs[$objDefaultLang->getAbbr()];
}
}
break;
case "templates":
if ($importTemplates) {
//*** Add templates to the account.
self::importTemplates($childNode, $_CONF['app']['account']->getId(), $arrTemplateIds, $arrTemplateFieldIds, $arrLinkFieldIds, $intTemplateId);
}
break;
case "elements":
if ($importElements) {
if ($intElementId == NULL) {
$strSql = sprintf("SELECT * FROM pcms_element WHERE templateId = '%s' AND accountId = '%s' ORDER BY sort LIMIT 1", $intTemplateId, $intAccountId);
$objElements = Element::select($strSql);
foreach ($objElements as $objElement) {
self::importElements($childNode, $intAccountId, $arrTemplateIds, $arrTemplateFieldIds, $arrElementIds, $arrElementFieldIds, $arrLinkFieldIds, $arrLanguageIds, $arrUserIds, $arrGroupIds, $arrStorageIds, $arrFeedIds, $objElement->getId());
}
} else {
self::importElements($childNode, $intAccountId, $arrTemplateIds, $arrTemplateFieldIds, $arrElementIds, $arrElementFieldIds, $arrLinkFieldIds, $arrLanguageIds, $arrUserIds, $arrGroupIds, $arrStorageIds, $arrFeedIds, $intElementId);
}
}
break;
case "aliases":
if ($importElements) {
//*** Add aliases to the account.
foreach ($childNode->childNodes as $aliasNode) {
if (in_array($aliasNode->getAttribute("url"), $arrElementIds)) {
$objAlias = new Alias();
$objAlias->setAccountId($_CONF['app']['account']->getId());
$objAlias->setAlias($aliasNode->getAttribute("alias"));
$objAlias->setUrl($arrElementIds[$aliasNode->getAttribute("url")]);
$objAlias->setLanguageId($arrLanguageIds[$aliasNode->getAttribute("language")]);
// check for existence of alias
$objTmpAliases = Alias::selectByAlias($aliasNode->getAttribute("alias"));
$objTmpAlias = $objTmpAliases->current();
if (!is_object($objTmpAlias)) {
$objAlias->setCascade($aliasNode->getAttribute("cascade"));
$objAlias->setActive($aliasNode->getAttribute("active"));
$objAlias->setSort($aliasNode->getAttribute("sort"));
$objAlias->setCreated($aliasNode->getAttribute("created"));
$objAlias->setModified($aliasNode->getAttribute("modified"));
$objAlias->save();
}
}
}
}
break;
}
if ($importElements) {
//*** Adjust the links for deeplink fields.
self::adjustDeeplinks($arrElementFieldIds["link"], $arrElementIds, $arrLanguageIds);
//*** Adjust the links in large text fields.
self::adjustTextlinks($arrElementFieldIds["largeText"], $arrElementIds, $arrLanguageIds, array(0));
}
}
}
}
}
//*** Import files
$objAccount = Account::selectByPK($_CONF['app']['account']->getId());
if ($blnZip && is_object($objAccount) && $importElements) {
self::importFiles($objZip, $objAccount);
//*** Move files to remote server.
self::moveImportedFiles($objAccount);
}
return true;
}
return false;
}