本文整理汇总了PHP中eZURLAliasML::urlToAction方法的典型用法代码示例。如果您正苦于以下问题:PHP eZURLAliasML::urlToAction方法的具体用法?PHP eZURLAliasML::urlToAction怎么用?PHP eZURLAliasML::urlToAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZURLAliasML
的用法示例。
在下文中一共展示了eZURLAliasML::urlToAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testURLToAction
public function testURLToAction()
{
$url1 = "content/view/full/123";
$url2 = "user/register";
$invalidUrl1 = "/content/view/full/123";
$invalidUrl2 = "unknown/module";
// Test valid urls
self::assertEquals("eznode:123", eZURLAliasML::urlToAction($url1));
self::assertEquals("module:user/register", eZURLAliasML::urlToAction($url2));
// Test invalid urls
self::assertEquals(false, eZURLAliasML::urlToAction($invalidUrl1));
self::assertEquals(false, eZURLAliasML::urlToAction($invalidUrl2));
}
示例2: reverseTranslate
public static function reverseTranslate(&$uri, $uriString, $internalURIString)
{
$db = eZDB::instance();
$action = eZURLAliasML::urlToAction($internalURIString);
if ($action !== false) {
$langMask = trim(eZContentLanguage::languagesSQLFilter('ezurlalias_ml', 'lang_mask'));
$actionStr = $db->escapeString($action);
$query = "SELECT id, parent, lang_mask, text, action FROM ezurlalias_ml WHERE ({$langMask}) AND action='{$actionStr}' AND is_original = 1 AND is_alias = 0";
$rows = $db->arrayQuery($query);
$path = array();
$count = count($rows);
if ($count != 0) {
$row = eZURLAliasML::choosePrioritizedRow($rows);
if ($row === false) {
$row = $rows[0];
}
$paren = (int) $row['parent'];
$path[] = $row['text'];
// We have the parent so now do an iterative lookup until we have the top element
while ($paren != 0) {
$query = "SELECT id, parent, lang_mask, text FROM ezurlalias_ml WHERE ({$langMask}) AND id={$paren} AND is_original = 1 AND is_alias = 0";
$rows = $db->arrayQuery($query);
$count = count($rows);
if ($count != 0) {
$row = eZURLAliasML::choosePrioritizedRow($rows);
if ($row === false) {
$row = $rows[0];
}
$paren = (int) $row['parent'];
array_unshift($path, $row['text']);
} else {
eZDebug::writeError("Lookup of parent ID {$paren} failed, cannot perform reverse lookup of alias.");
return false;
}
}
$uriString = join('/', $path);
if ($uri instanceof eZURI) {
$uri->setURIString($uriString, false);
} else {
$uri = $uriString;
}
return true;
} else {
return false;
}
}
return false;
}
示例3:
$infoData['language'] = $languageCode;
} else {
if (strlen($aliasText) == 0) {
$infoCode = "error-no-alias-text";
} else {
if (strlen(trim($aliasDestinationTextUnmodified)) == 0) {
$infoCode = "error-no-alias-destination-text";
} else {
$parentID = 0;
// Start from the top
$linkID = 0;
$mask = $language->attribute('id');
if ($isAlwaysAvailable) {
$mask |= 1;
}
$action = eZURLAliasML::urlToAction($aliasDestinationText);
if (!$action) {
$elements = eZURLAliasML::fetchByPath($aliasDestinationText);
if (count($elements) > 0) {
$action = $elements[0]->attribute('action');
$linkID = $elements[0]->attribute('link');
}
}
if (!$action) {
$infoCode = "error-action-invalid";
$infoData['aliasText'] = $aliasDestinationText;
} else {
$origAliasText = $aliasText;
if ($linkID == 0) {
$linkID = true;
}