make_http function
This commit is contained in:
parent
52ba270e78
commit
ecef1edb14
@ -54,7 +54,7 @@ class RSS_Images extends SimpleExtension {
|
|||||||
|
|
||||||
$data = "";
|
$data = "";
|
||||||
foreach($images as $image) {
|
foreach($images as $image) {
|
||||||
$link = make_link("post/view/{$image->id}");
|
$link = make_http(make_link("post/view/{$image->id}"));
|
||||||
$tags = $image->get_tag_list();
|
$tags = $image->get_tag_list();
|
||||||
$owner = $image->get_owner();
|
$owner = $image->get_owner();
|
||||||
$thumb_url = $image->get_thumb_link();
|
$thumb_url = $image->get_thumb_link();
|
||||||
|
@ -33,9 +33,7 @@ define('ADMIN_PASS', "demo");
|
|||||||
*/
|
*/
|
||||||
class SCoreWebTestCase extends WebTestCase {
|
class SCoreWebTestCase extends WebTestCase {
|
||||||
protected function get_page($page) {
|
protected function get_page($page) {
|
||||||
$url = "http://".$_SERVER["HTTP_HOST"].get_base_href().'/'.make_link($page);
|
$raw = $this->get(make_http(make_link($url)));
|
||||||
$url = str_replace("/./", "/", $url);
|
|
||||||
$raw = $this->get($url);
|
|
||||||
$this->assertNoText("Exception:");
|
$this->assertNoText("Exception:");
|
||||||
$this->assertNoText("Error:");
|
$this->assertNoText("Error:");
|
||||||
$this->assertNoText("Warning:");
|
$this->assertNoText("Warning:");
|
||||||
|
@ -127,6 +127,19 @@ function make_link($page=null, $query=null) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn a relative link into an absolute one, including hostname
|
||||||
|
*
|
||||||
|
* @retval string
|
||||||
|
*/
|
||||||
|
function make_http($link) {
|
||||||
|
if(strpos($link, "ttp://") > 0) return $link;
|
||||||
|
if($link[0] != '/') $link = get_base_href().'/'.$link;
|
||||||
|
$link = "http://".$_SERVER["HTTP_HOST"].$link;
|
||||||
|
$link = str_replace("/./", "/", $link);
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a link to a static file in the current theme's
|
* Make a link to a static file in the current theme's
|
||||||
* directory
|
* directory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user