本文整理汇总了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 )');
}