Permalink
Browse files

ApiLoader: Http host bug in console fixed.

  • Loading branch information...
kayue committed Aug 20, 2012
1 parent ec8324a commit c24f0cda5d07e2b7ec5a752661b6f3c19ec87258
Showing with 9 additions and 6 deletions.
  1. +9 −6 Wordpress/ApiLoader.php
View
@@ -39,6 +39,13 @@ class ApiLoader
*/
private $domain;
+ /**
+ * HTTP Host
+ *
+ * @var string
+ */
+ private $httpHost;
+
/**
* Constructor
*
@@ -49,10 +56,7 @@ public function __construct($wordpressPath, $shortInit = false, $domain = null)
{
$this->wordpressPath = $wordpressPath;
$this->domain = $domain;
-
- if(!isset($_SERVER['HTTP_HOST'])) {
- $this->domain = false;
- }
+ $this->httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null;
if(!defined('SHORTINIT')) {
define('SHORTINIT', $shortInit);
@@ -76,7 +80,6 @@ public function load($bootstrap='wp-load.php')
// Modify HTTP_HOST to fix WordPress multi-site's redirection bug.
if($this->domain) {
- $httpHost = $_SERVER['HTTP_HOST'];
$_SERVER['HTTP_HOST'] = $this->domain;
}
@@ -121,7 +124,7 @@ public function load($bootstrap='wp-load.php')
// Change back the HTTP_HOST to the original one.
if($this->domain) {
- $_SERVER['HTTP_HOST'] = $httpHost;
+ $_SERVER['HTTP_HOST'] = $this->httpHost;
}
return $returnValue;

0 comments on commit c24f0cd

Please sign in to comment.