本文整理匯總了PHP中HTTP::urlRewriter方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTTP::urlRewriter方法的具體用法?PHP HTTP::urlRewriter怎麽用?PHP HTTP::urlRewriter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HTTP
的用法示例。
在下文中一共展示了HTTP::urlRewriter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: transform
public function transform($item, $parent, $strategy)
{
$page = new WordpressPage();
$params = $this->importer->getParams();
$exists = DataObject::get_one('WordpressPage', sprintf('"WordpressID" = %d AND "ParentID" = %d', $item->WordpressID, $parent->ID));
if ($exists) {
switch ($strategy) {
case ExternalContentTransformer::DS_OVERWRITE:
$page = $exists;
break;
case ExternalContentTransformer::DS_DUPLICATE:
break;
case ExternalContentTransformer::DS_SKIP:
return;
}
}
$page->Title = $item->Title;
$page->MenuTitle = $item->Title;
$page->Content = $item->Description;
$page->Content = HTTP::urlRewriter($page->Content, ' WordpressPageTransformer::transform_url($URL) ');
$page->URLSegment = $item->Slug;
$page->ParentID = $parent->ID;
$page->ProvideComments = $item->AllowComments;
$page->WordpressID = $item->WordpressID;
$properties = $item->getRemoteProperties();
$page->OriginalData = serialize($properties);
$page->OriginalLink = isset($properties['Link']) ? $properties['Link'] : null;
$page->write();
if (isset($params['ImportMedia'])) {
$this->importMedia($item, $page);
}
return new TransformResult($page, $item->stageChildren());
}
開發者ID:helpfulrobot,項目名稱:silverstripe-australia-wordpressconnector,代碼行數:33,代碼來源:WordpressPageTransformer.php
示例2: absoluteURLs
/**
* Turn all relative URLs in the content to absolute URLs
*/
public static function absoluteURLs($html)
{
$html = str_replace('$CurrentPageURL', $_SERVER['REQUEST_URI'], $html);
return HTTP::urlRewriter($html, function ($url) {
//no need to rewrite, if uri has a protocol (determined here by existence of reserved URI character ":")
if (preg_match('/^\\w+:/', $url)) {
return $url;
}
return Director::absoluteURL($url, true);
});
}
示例3: absoluteURLs
/**
* Turn all relative URLs in the content to absolute URLs
*/
static function absoluteURLs($html)
{
$html = str_replace('$CurrentPageURL', $_SERVER['REQUEST_URI'], $html);
return HTTP::urlRewriter($html, '(substr($URL,0,1) == "/") ? ( Director::protocolAndHost() . $URL ) : ( (ereg("^[A-Za-z]+:", $URL)) ? $URL : Director::absoluteBaseURL() . $URL )');
}