当前位置: 首页>>代码示例>>PHP>>正文


PHP Url::getHost方法代码示例

本文整理汇总了PHP中Piwik\Url::getHost方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::getHost方法的具体用法?PHP Url::getHost怎么用?PHP Url::getHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\Url的用法示例。


在下文中一共展示了Url::getHost方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $serverGlobal = $input->getOption('server-global');
     if ($serverGlobal) {
         $_SERVER = json_decode($serverGlobal, true);
     }
     $this->requireFixtureFiles($input);
     $this->setIncludePathAsInTestBootstrap();
     $host = Url::getHost();
     if (empty($host)) {
         Url::setHost('localhost');
     }
     $fixture = $this->createFixture($input);
     $this->setupDatabaseOverrides($input, $fixture);
     // perform setup and/or teardown
     if ($input->getOption('teardown')) {
         $fixture->getTestEnvironment()->save();
         $fixture->performTearDown();
     } else {
         $fixture->performSetUp();
     }
     if ($input->getOption('set-phantomjs-symlinks')) {
         $this->createSymbolicLinksForUITests();
     }
     $this->writeSuccessMessage($output, array("Fixture successfully setup!"));
     $sqlDumpPath = $input->getOption('sqldump');
     if ($sqlDumpPath) {
         $this->createSqlDump($sqlDumpPath, $output);
     }
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:30,代码来源:TestsSetupFixture.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!defined('PIWIK_TEST_MODE')) {
         define('PIWIK_TEST_MODE', true);
     }
     Environment::setGlobalEnvironmentManipulator(new TestingEnvironmentManipulator(new TestingEnvironmentVariables()));
     $serverGlobal = $input->getOption('server-global');
     if ($serverGlobal) {
         $_SERVER = json_decode($serverGlobal, true);
     }
     if (Config::getInstance()->database_tests['tables_prefix'] !== '') {
         throw new \Exception("To generate OmniFixture for the UI tests, you must set an empty tables_prefix in [database_tests]");
     }
     $this->requireFixtureFiles($input);
     $this->setIncludePathAsInTestBootstrap();
     $host = Url::getHost();
     if (empty($host)) {
         $host = 'localhost';
         Url::setHost('localhost');
     }
     $configDomainToSave = $input->getOption('save-config');
     if (!empty($configDomainToSave)) {
         $pathToDomainConfig = PIWIK_INCLUDE_PATH . '/config/' . $host . '.config.ini.php';
         if (!file_exists($pathToDomainConfig)) {
             link(PIWIK_INCLUDE_PATH . '/config/config.ini.php', $pathToDomainConfig);
         }
     }
     if ($input->getOption('set-phantomjs-symlinks')) {
         $this->createSymbolicLinksForUITests();
     }
     $fixture = $this->createFixture($input, $allowSave = !empty($configDomainToSave));
     $this->setupDatabaseOverrides($input, $fixture);
     // perform setup and/or teardown
     if ($input->getOption('teardown')) {
         $fixture->getTestEnvironment()->save();
         $fixture->performTearDown();
     } else {
         $fixture->performSetUp();
     }
     $this->writeSuccessMessage($output, array("Fixture successfully setup!"));
     $sqlDumpPath = $input->getOption('sqldump');
     if ($sqlDumpPath) {
         $this->createSqlDump($sqlDumpPath, $output);
     }
     if (!empty($configDomainToSave)) {
         Config::getInstance()->forceSave();
     }
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:48,代码来源:TestsSetupFixture.php

示例3: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $serverGlobal = $input->getOption('server-global');
     if ($serverGlobal) {
         $_SERVER = json_decode($serverGlobal, true);
     }
     $this->requireFixtureFiles($input);
     $this->setIncludePathAsInTestBootstrap();
     $host = Url::getHost();
     if (empty($host)) {
         $host = 'localhost';
         Url::setHost('localhost');
     }
     $configDomainToSave = $input->getOption('save-config');
     if (!empty($configDomainToSave)) {
         $pathToDomainConfig = PIWIK_INCLUDE_PATH . '/config/' . $host . '.config.ini.php';
         if (!file_exists($pathToDomainConfig)) {
             link(PIWIK_INCLUDE_PATH . '/config/config.ini.php', $pathToDomainConfig);
         }
     }
     $fixture = $this->createFixture($input);
     $this->setupDatabaseOverrides($input, $fixture);
     // perform setup and/or teardown
     if ($input->getOption('teardown')) {
         $fixture->getTestEnvironment()->save();
         $fixture->performTearDown();
     } else {
         $fixture->performSetUp();
     }
     if ($input->getOption('set-phantomjs-symlinks')) {
         $this->createSymbolicLinksForUITests();
     }
     $this->writeSuccessMessage($output, array("Fixture successfully setup!"));
     $sqlDumpPath = $input->getOption('sqldump');
     if ($sqlDumpPath) {
         $this->createSqlDump($sqlDumpPath, $output);
     }
     if (!empty($configDomainToSave)) {
         Config::getInstance()->forceSave();
     }
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:41,代码来源:TestsSetupFixture.php

示例4: addTrustedHosts

 /**
  * Add trusted hosts
  */
 private function addTrustedHosts($siteUrl)
 {
     $trustedHosts = array();
     // extract host from the request header
     if (($host = $this->extractHost('http://' . Url::getHost())) !== false) {
         $trustedHosts[] = $host;
     }
     // extract host from first web site
     if (($host = $this->extractHost(urldecode($siteUrl))) !== false) {
         $trustedHosts[] = $host;
     }
     $trustedHosts = array_unique($trustedHosts);
     if (count($trustedHosts)) {
         $general = Config::getInstance()->General;
         $general['trusted_hosts'] = $trustedHosts;
         Config::getInstance()->General = $general;
         Config::getInstance()->forceSave();
     }
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:22,代码来源:Controller.php

示例5: getHostname

 protected static function getHostname()
 {
     $host = Url::getHost($checkIfTrusted = false);
     // Check trusted requires config file which is not ready yet
     return $host;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:6,代码来源:Config.php

示例6: getHostname

 /**
  * Returns the hostname of the current request (without port number)
  *
  * @return string
  */
 public static function getHostname()
 {
     // Check trusted requires config file which is not ready yet
     $host = Url::getHost($checkIfTrusted = false);
     // Remove any port number to get actual hostname
     $host = Url::getHostSanitized($host);
     return $host;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:13,代码来源:Config.php

示例7: getFirstPartyCookieDomainHash

 private function getFirstPartyCookieDomainHash()
 {
     $host = \Piwik\Url::getHost();
     $cookiePath = PiwikTracker::DEFAULT_COOKIE_PATH;
     return substr(sha1($host . $cookiePath), 0, 4);
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:6,代码来源:SomeVisitsCustomVariablesCampaignsNotHeuristics.php

示例8: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $serverGlobal = $input->getOption('server-global');
     if ($serverGlobal) {
         $_SERVER = json_decode($serverGlobal, true);
     }
     $this->requireFixtureFiles();
     $this->setIncludePathAsInTestBootstrap();
     $file = $input->getOption('file');
     if ($file) {
         if (is_file($file)) {
             require_once $file;
         } else {
             if (is_file(PIWIK_INCLUDE_PATH . '/' . $file)) {
                 require_once PIWIK_INCLUDE_PATH . '/' . $file;
             } else {
                 throw new \Exception("Cannot find --file option file '{$file}'.");
             }
         }
     }
     $host = Url::getHost();
     if (empty($host)) {
         Url::setHost('localhost');
     }
     // get the fixture class
     $fixtureClass = $input->getArgument('fixture');
     if (class_exists("Piwik\\Tests\\Fixtures\\" . $fixtureClass)) {
         $fixtureClass = "Piwik\\Tests\\Fixtures\\" . $fixtureClass;
     }
     if (!class_exists($fixtureClass)) {
         throw new \Exception("Cannot find fixture class '{$fixtureClass}'.");
     }
     // create the fixture
     $fixture = new $fixtureClass();
     $fixture->printToScreen = true;
     $dbName = $input->getOption('db-name');
     if ($dbName) {
         $fixture->dbName = $dbName;
     }
     if ($input->getOption('persist-fixture-data')) {
         $fixture->persistFixtureData = true;
     }
     if ($input->getOption('drop')) {
         $fixture->resetPersistedFixture = true;
     }
     $extraPluginsToLoad = $input->getOption('plugins');
     if ($extraPluginsToLoad) {
         $fixture->extraPluginsToLoad = explode(',', $extraPluginsToLoad);
     }
     if ($fixture->createConfig) {
         Config::getInstance()->setTestEnvironment();
     }
     $fixture->createConfig = false;
     // setup database overrides
     $testingEnvironment = $fixture->getTestEnvironment();
     $optionsToOverride = array('dbname' => $fixture->getDbName(), 'host' => $input->getOption('db-host'), 'user' => $input->getOption('db-user'), 'password' => $input->getOption('db-pass'));
     foreach ($optionsToOverride as $configOption => $value) {
         if ($value) {
             $configOverride = $testingEnvironment->configOverride;
             $configOverride['database_tests'][$configOption] = $configOverride['database'][$configOption] = $value;
             $testingEnvironment->configOverride = $configOverride;
             Config::getInstance()->database[$configOption] = $value;
         }
     }
     // perform setup and/or teardown
     if ($input->getOption('teardown')) {
         $testingEnvironment->save();
         $fixture->performTearDown();
     } else {
         $fixture->performSetUp();
     }
     if ($input->getOption('set-phantomjs-symlinks')) {
         // make sure symbolic links exist (phantomjs doesn't support symlink-ing yet)
         foreach (array('libs', 'plugins', 'tests', 'piwik.js') as $linkName) {
             $linkPath = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/' . $linkName;
             if (!file_exists($linkPath)) {
                 symlink(PIWIK_INCLUDE_PATH . '/' . $linkName, $linkPath);
             }
         }
     }
     $this->writeSuccessMessage($output, array("Fixture successfully setup!"));
 }
开发者ID:kreynen,项目名称:elmsln,代码行数:82,代码来源:SetupFixture.php

示例9: executeNotAsyncHttp

 private function executeNotAsyncHttp($url, Output $output)
 {
     $piwikUrl = $this->urlToPiwik ?: SettingsPiwik::getPiwikUrl();
     if (empty($piwikUrl)) {
         $piwikUrl = 'http://' . Url::getHost() . '/';
     }
     $url = $piwikUrl . $url;
     if (Config::getInstance()->General['force_ssl'] == 1) {
         $url = str_replace("http://", "https://", $url);
     }
     if ($this->runAsSuperUser) {
         $tokenAuths = self::getSuperUserTokenAuths();
         $tokenAuth = reset($tokenAuths);
         if (strpos($url, '?') === false) {
             $url .= '?';
         } else {
             $url .= '&';
         }
         $url .= 'token_auth=' . $tokenAuth;
     }
     try {
         Log::debug("Execute HTTP API request: " . $url);
         $response = Http::sendHttpRequestBy('curl', $url, $timeout = 0, $userAgent = null, $destinationPath = null, $file = null, $followDepth = 0, $acceptLanguage = false, $this->acceptInvalidSSLCertificate);
         $output->write($response);
     } catch (\Exception $e) {
         $message = "Got invalid response from API request: {$url}. ";
         if (isset($response) && empty($response)) {
             $message .= "The response was empty. This usually means a server error. This solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. Please check your Web server Error Log file for more details.";
         } else {
             $message .= "Response was '" . $e->getMessage() . "'";
         }
         $output->write($message);
         Log::debug($e);
     }
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:35,代码来源:CliMulti.php

示例10: addTrustedHosts

 /**
  * Add trusted hosts
  */
 protected function addTrustedHosts()
 {
     $trustedHosts = array();
     // extract host from the request header
     if (($host = $this->extractHost('http://' . Url::getHost())) !== false) {
         $trustedHosts[] = $host;
     }
     // extract host from first web site
     if (($host = $this->extractHost(urldecode($this->session->site_url))) !== false) {
         $trustedHosts[] = $host;
     }
     $trustedHosts = array_unique($trustedHosts);
     if (count($trustedHosts)) {
         $this->session->general_infos['trusted_hosts'] = $trustedHosts;
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:19,代码来源:Controller.php


注:本文中的Piwik\Url::getHost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。