Exemplo n.º 1
0
 /**
  * Initialize
  *
  * @param none
  * @return void
  */
 public function init()
 {
     $this->getLogger()->log('Version: ' . $this->getVersion());
     $this->getLogger()->log('HTTP URL: ' . $this->getHttpUrl()->toString());
     $this->getLogger()->log('HTTPS URL: ' . $this->getHttpsUrl()->toString());
     $this->getLogger()->log('SSL: ' . ($this->isSsl() ? 'Yes' : 'No'));
     $this->getLogger()->log('Diff Host: ' . ($this->getSetting('ssl_host_diff') ? 'Yes' : 'No'));
     $this->getLogger()->log('Subdomain: ' . ($this->getSetting('ssl_host_subdomain') ? 'Yes' : 'No'));
     $this->getLogger()->log('Proxy: ' . ($this->getSetting('ssl_proxy') === 'auto' ? 'Auto' : ($this->getSetting('ssl_proxy') ? 'Yes' : 'No')));
     $this->getLogger()->log('Secure External URLs: [ ' . implode(', ', (array) $this->getSetting('secure_external_urls')) . ' ]');
     $this->getLogger()->log('Unsecure External URLs: [ ' . implode(', ', (array) $this->getSetting('unsecure_external_urls')) . ' ]');
     parent::init();
 }
Exemplo n.º 2
0
 /**
  * Initialize
  *
  * @param none
  * @return void
  */
 public function init()
 {
     // HTTP URL
     $this->setHttpUrl(WordPressHTTPS_Url::fromString('http://' . parse_url(get_bloginfo('template_url'), PHP_URL_HOST) . parse_url(home_url('/'), PHP_URL_PATH)));
     // HTTPS URL
     $this->setHttpsUrl(WordPressHTTPS_Url::fromString('https://' . parse_url(get_bloginfo('template_url'), PHP_URL_HOST) . parse_url(home_url('/'), PHP_URL_PATH)));
     // If using a different host for SSL
     if ($this->getSetting('ssl_host') && $this->getSetting('ssl_host') != $this->getHttpsUrl()->toString()) {
         // Assign HTTPS URL to SSL Host
         $this->setSetting('ssl_host_diff', 1);
         $this->setHttpsUrl(WordPressHTTPS_Url::fromString(rtrim($this->getSetting('ssl_host'), '/') . '/'));
     } else {
         $this->setSetting('ssl_host_diff', 0);
     }
     // Prepend SSL Host path
     if (strpos($this->getHttpsUrl()->getPath(), $this->getHttpUrl()->getPath()) === false) {
         $this->getHttpsUrl()->setPath($this->getHttpsUrl()->getPath() . $this->getHttpUrl()->getPath());
     }
     // Add SSL Port to HTTPS URL
     $this->getHttpsUrl()->setPort($this->getSetting('ssl_port'));
     $this->getLogger()->log('Version: ' . $this->getVersion());
     $this->getLogger()->log('HTTP URL: ' . $this->getHttpUrl());
     $this->getLogger()->log('HTTPS URL: ' . $this->getHttpsUrl());
     $this->getLogger()->log('SSL: ' . ($this->isSsl() ? 'Yes' : 'No'));
     $this->getLogger()->log('Diff Host: ' . ($this->getSetting('ssl_host_diff') ? 'Yes' : 'No'));
     $this->getLogger()->log('Subdomain: ' . ($this->getSetting('ssl_host_subdomain') ? 'Yes' : 'No'));
     $this->getLogger()->log('Proxy: ' . ($this->getSetting('ssl_proxy') === 'auto' ? 'Auto' : ($this->getSetting('ssl_proxy') ? 'Yes' : 'No')));
     $this->getLogger()->log('Secure External URLs: [ ' . implode(', ', (array) $this->getSetting('secure_external_urls')) . ' ]');
     $this->getLogger()->log('Unsecure External URLs: [ ' . implode(', ', (array) $this->getSetting('unsecure_external_urls')) . ' ]');
     // Redirect login page. This is not pluggable due to the redirect methods used in wp-login.php
     if ($GLOBALS['pagenow'] == 'wp-login.php') {
         setcookie(constant('TEST_COOKIE'), 'WP Cookie check', 0);
         if ($this->getSetting('ssl_admin') && !$this->isSsl()) {
             $this->redirect('https');
         }
     }
     parent::init();
 }