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


PHP Piwik\SettingsPiwik类代码示例

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


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

示例1: tableInsertBatch

 /**
  * Performs a batch insert into a specific table using either LOAD DATA INFILE or plain INSERTs,
  * as a fallback. On MySQL, LOAD DATA INFILE is 20x faster than a series of plain INSERTs.
  *
  * @param string $tableName PREFIXED table name! you must call Common::prefixTable() before passing the table name
  * @param array $fields array of unquoted field names
  * @param array $values array of data to be inserted
  * @param bool $throwException Whether to throw an exception that was caught while trying
  *                                LOAD DATA INFILE, or not.
  * @throws Exception
  * @return bool  True if the bulk LOAD was used, false if we fallback to plain INSERTs
  */
 public static function tableInsertBatch($tableName, $fields, $values, $throwException = false)
 {
     $filePath = PIWIK_USER_PATH . '/tmp/assets/' . $tableName . '-' . Common::generateUniqId() . '.csv';
     $filePath = SettingsPiwik::rewriteTmpPathWithInstanceId($filePath);
     $loadDataInfileEnabled = Config::getInstance()->General['enable_load_data_infile'];
     if ($loadDataInfileEnabled && Db::get()->hasBulkLoader()) {
         try {
             $fileSpec = array('delim' => "\t", 'quote' => '"', 'escape' => '\\\\', 'escapespecial_cb' => function ($str) {
                 return str_replace(array(chr(92), chr(34)), array(chr(92) . chr(92), chr(92) . chr(34)), $str);
             }, 'eol' => "\r\n", 'null' => 'NULL');
             // hack for charset mismatch
             if (!DbHelper::isDatabaseConnectionUTF8() && !isset(Config::getInstance()->database['charset'])) {
                 $fileSpec['charset'] = 'latin1';
             }
             self::createCSVFile($filePath, $fileSpec, $values);
             if (!is_readable($filePath)) {
                 throw new Exception("File {$filePath} could not be read.");
             }
             $rc = self::createTableFromCSVFile($tableName, $fields, $filePath, $fileSpec);
             if ($rc) {
                 unlink($filePath);
                 return true;
             }
         } catch (Exception $e) {
             Log::info("LOAD DATA INFILE failed or not supported, falling back to normal INSERTs... Error was: %s", $e->getMessage());
             if ($throwException) {
                 throw $e;
             }
         }
     }
     // if all else fails, fallback to a series of INSERTs
     @unlink($filePath);
     self::tableInsertBatchIterate($tableName, $fields, $values);
     return false;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:47,代码来源:BatchInsert.php

示例2: isInstalled

 public function isInstalled()
 {
     if (is_null($this->isInstalled)) {
         $this->isInstalled = SettingsPiwik::isPiwikInstalled();
     }
     return $this->isInstalled;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:Tracker.php

示例3: generateHash

 /**
  * Generate hash on user info and password
  *
  * @param string $userInfo User name, email, etc
  * @param string $password
  * @return string
  */
 private function generateHash($userInfo, $password)
 {
     // mitigate rainbow table attack
     $passwordLen = strlen($password) / 2;
     $hash = Common::hash($userInfo . substr($password, 0, $passwordLen) . SettingsPiwik::getSalt() . substr($password, $passwordLen));
     return $hash;
 }
开发者ID:bnkems,项目名称:piwik,代码行数:14,代码来源:Controller.php

示例4: piwikVersionBasedCacheBuster

 /**
  * Cache buster based on
  *  - Piwik version
  *  - Loaded plugins
  *  - Super user salt
  *  - Latest
  *
  * @param string[] $pluginNames
  * @return string
  */
 public function piwikVersionBasedCacheBuster($pluginNames = false)
 {
     $currentGitHash = @file_get_contents(PIWIK_INCLUDE_PATH . '/.git/refs/heads/master');
     $pluginList = md5(implode(",", !$pluginNames ? Manager::getInstance()->getLoadedPluginsName() : $pluginNames));
     $cacheBuster = md5(SettingsPiwik::getSalt() . $pluginList . PHP_VERSION . Version::VERSION . trim($currentGitHash));
     return $cacheBuster;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:17,代码来源:UIAssetCacheBuster.php

示例5: sendNotifications

 protected function sendNotifications()
 {
     $latestVersion = $this->getLatestVersion();
     $host = SettingsPiwik::getPiwikUrl();
     $subject = Piwik::translate('CoreUpdater_NotificationSubjectAvailableCoreUpdate', $latestVersion);
     $message = Piwik::translate('ScheduledReports_EmailHello');
     $message .= "\n\n";
     $message .= Piwik::translate('CoreUpdater_ThereIsNewVersionAvailableForUpdate');
     $message .= "\n\n";
     $message .= Piwik::translate('CoreUpdater_YouCanUpgradeAutomaticallyOrDownloadPackage', $latestVersion);
     $message .= "\n";
     $message .= $host . 'index.php?module=CoreUpdater&action=newVersionAvailable';
     $message .= "\n\n";
     $version = new Version();
     if ($version->isStableVersion($latestVersion)) {
         $message .= Piwik::translate('CoreUpdater_ViewVersionChangelog');
         $message .= "\n";
         $message .= $this->getLinkToChangeLog($latestVersion);
         $message .= "\n\n";
     }
     $message .= Piwik::translate('CoreUpdater_FeedbackRequest');
     $message .= "\n";
     $message .= 'http://piwik.org/contact/';
     $this->sendEmailNotification($subject, $message);
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:25,代码来源:UpdateCommunication.php

示例6: __construct

 public function __construct()
 {
     $loader = $this->getDefaultThemeLoader();
     $this->addPluginNamespaces($loader);
     // If theme != default we need to chain
     $chainLoader = new Twig_Loader_Chain(array($loader));
     // Create new Twig Environment and set cache dir
     $templatesCompiledPath = PIWIK_USER_PATH . '/tmp/templates_c';
     $templatesCompiledPath = SettingsPiwik::rewriteTmpPathWithHostname($templatesCompiledPath);
     $this->twig = new Twig_Environment($chainLoader, array('debug' => true, 'strict_variables' => true, 'cache' => $templatesCompiledPath));
     $this->twig->addExtension(new Twig_Extension_Debug());
     $this->twig->clearTemplateCache();
     $this->addFilter_translate();
     $this->addFilter_urlRewriteWithParameters();
     $this->addFilter_sumTime();
     $this->addFilter_money();
     $this->addFilter_truncate();
     $this->addFilter_notificiation();
     $this->addFilter_percentage();
     $this->twig->addFilter(new Twig_SimpleFilter('implode', 'implode'));
     $this->twig->addFilter(new Twig_SimpleFilter('ucwords', 'ucwords'));
     $this->addFunction_includeAssets();
     $this->addFunction_linkTo();
     $this->addFunction_sparkline();
     $this->addFunction_postEvent();
     $this->addFunction_isPluginLoaded();
     $this->addFunction_getJavascriptTranslations();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:28,代码来源:Twig.php

示例7: renderTable

 /**
  * Computes the output for the given data table
  *
  * @param DataTable $table
  * @return string
  * @throws Exception
  */
 protected function renderTable($table)
 {
     if (!$table instanceof DataTable\Map || $table->getKeyName() != 'date') {
         throw new Exception("RSS feeds can be generated for one specific website &idSite=X." . "\nPlease specify only one idSite or consider using &format=XML instead.");
     }
     $idSite = Common::getRequestVar('idSite', 1, 'int');
     $period = Common::getRequestVar('period');
     $piwikUrl = SettingsPiwik::getPiwikUrl() . "?module=CoreHome&action=index&idSite=" . $idSite . "&period=" . $period;
     $out = "";
     $moreRecentFirst = array_reverse($table->getDataTables(), true);
     foreach ($moreRecentFirst as $date => $subtable) {
         /** @var DataTable $subtable */
         $timestamp = $subtable->getMetadata(Archive\DataTableFactory::TABLE_METADATA_PERIOD_INDEX)->getDateStart()->getTimestamp();
         $site = $subtable->getMetadata(Archive\DataTableFactory::TABLE_METADATA_SITE_INDEX);
         $pudDate = date('r', $timestamp);
         $dateInSiteTimezone = Date::factory($timestamp);
         if ($site) {
             $dateInSiteTimezone = $dateInSiteTimezone->setTimezone($site->getTimezone());
         }
         $dateInSiteTimezone = $dateInSiteTimezone->toString('Y-m-d');
         $thisPiwikUrl = Common::sanitizeInputValue($piwikUrl . "&date={$dateInSiteTimezone}");
         $siteName = $site ? $site->getName() : '';
         $title = $siteName . " on " . $date;
         $out .= "\t<item>\n\t\t<pubDate>{$pudDate}</pubDate>\n\t\t<guid>{$thisPiwikUrl}</guid>\n\t\t<link>{$thisPiwikUrl}</link>\n\t\t<title>{$title}</title>\n\t\t<author>http://piwik.org</author>\n\t\t<description>";
         $out .= Common::sanitizeInputValue($this->renderDataTable($subtable));
         $out .= "</description>\n\t</item>\n";
     }
     $header = $this->getRssHeader();
     $footer = $this->getRssFooter();
     return $header . $out . $footer;
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:38,代码来源:Rss.php

示例8: configureTopMenu

 public function configureTopMenu(MenuTop $menu)
 {
     if (Piwik::isUserIsAnonymous() || !SettingsPiwik::isPiwikInstalled()) {
         $langManager = new LanguagesManager();
         $menu->addHtml('LanguageSelector', $langManager->getLanguagesSelector(), true, $order = 30, false);
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:7,代码来源:Menu.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = sprintf('%s/tmp/logs/', PIWIK_DOCUMENT_ROOT);
     $path = SettingsPiwik::rewriteTmpPathWithInstanceId($path);
     $cmd = sprintf('tail -f %s*.log', $path);
     $output->writeln('Executing command: ' . $cmd);
     passthru($cmd);
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:8,代码来源:WatchLog.php

示例10: getConfigHash

 /**
  * Returns a 64-bit hash of all the configuration settings
  * @param $os
  * @param $browserName
  * @param $browserVersion
  * @param $plugin_Flash
  * @param $plugin_Java
  * @param $plugin_Director
  * @param $plugin_Quicktime
  * @param $plugin_RealPlayer
  * @param $plugin_PDF
  * @param $plugin_WindowsMedia
  * @param $plugin_Gears
  * @param $plugin_Silverlight
  * @param $plugin_Cookie
  * @param $ip
  * @param $browserLang
  * @return string
  */
 protected function getConfigHash($os, $browserName, $browserVersion, $plugin_Flash, $plugin_Java, $plugin_Director, $plugin_Quicktime, $plugin_RealPlayer, $plugin_PDF, $plugin_WindowsMedia, $plugin_Gears, $plugin_Silverlight, $plugin_Cookie, $ip, $browserLang)
 {
     // prevent the config hash from being the same, across different Piwik instances
     // (limits ability of different Piwik instances to cross-match users)
     $salt = SettingsPiwik::getSalt();
     $configString = $os . $browserName . $browserVersion . $plugin_Flash . $plugin_Java . $plugin_Director . $plugin_Quicktime . $plugin_RealPlayer . $plugin_PDF . $plugin_WindowsMedia . $plugin_Gears . $plugin_Silverlight . $plugin_Cookie . $ip . $browserLang . $salt;
     $hash = md5($configString, $raw_output = true);
     return substr($hash, 0, Tracker::LENGTH_BINARY_ID);
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:28,代码来源:Settings.php

示例11: __construct

 /**
  * @param string $directory directory to use
  * @param int $timeToLiveInSeconds TTL
  */
 public function __construct($directory, $timeToLiveInSeconds = 300)
 {
     $cachePath = PIWIK_USER_PATH . '/tmp/cache/' . $directory . '/';
     $this->cachePath = SettingsPiwik::rewriteTmpPathWithHostname($cachePath);
     if ($timeToLiveInSeconds < self::MINIMUM_TTL) {
         $timeToLiveInSeconds = self::MINIMUM_TTL;
     }
     $this->ttl = $timeToLiveInSeconds;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:13,代码来源:CacheFile.php

示例12: checkPiwikSetupForTests

function checkPiwikSetupForTests()
{
    if (empty($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == '@REQUEST_URI@') {
        echo "WARNING: for tests to pass, you must first:\n1) Install webserver on localhost, eg. apache\n2) Make these Piwik files available on the webserver, at eg. http://localhost/dev/piwik/\n3) Install Piwik by going through the installation process\n4) Copy phpunit.xml.dist to phpunit.xml\n5) Edit in phpunit.xml the @REQUEST_URI@ and replace with the webserver path to Piwik, eg. '/dev/piwik/'\n\nTry again.\n-> If you still get this message, you can work around it by specifying Host + Request_Uri at the top of this file tests/PHPUnit/bootstrap.php. <-";
        exit(1);
    }
    $baseUrl = \Piwik\Tests\Framework\Fixture::getRootUrl();
    \Piwik\SettingsPiwik::checkPiwikServerWorking($baseUrl, $acceptInvalidSSLCertificates = true);
}
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:9,代码来源:bootstrap.php

示例13: getSegmentsToProcess

 /**
  * @param $idSites
  * @return array
  */
 private static function getSegmentsToProcess($idSites)
 {
     $knownSegmentsToArchiveAllSites = SettingsPiwik::getKnownSegmentsToArchive();
     $segmentsToProcess = $knownSegmentsToArchiveAllSites;
     foreach ($idSites as $idSite) {
         $segmentForThisWebsite = SettingsPiwik::getKnownSegmentsToArchiveForSite($idSite);
         $segmentsToProcess = array_merge($segmentsToProcess, $segmentForThisWebsite);
     }
     $segmentsToProcess = array_unique($segmentsToProcess);
     return $segmentsToProcess;
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:15,代码来源:Rules.php

示例14: addWidgets

 /**
  * Adds Referrer widgets
  */
 function addWidgets()
 {
     WidgetsList::add('Referrers_Referrers', 'Referrers_WidgetKeywords', 'Referrers', 'getKeywords');
     WidgetsList::add('Referrers_Referrers', 'Referrers_WidgetExternalWebsites', 'Referrers', 'getWebsites');
     WidgetsList::add('Referrers_Referrers', 'Referrers_WidgetSocials', 'Referrers', 'getSocials');
     WidgetsList::add('Referrers_Referrers', 'Referrers_SearchEngines', 'Referrers', 'getSearchEngines');
     WidgetsList::add('Referrers_Referrers', 'Referrers_Campaigns', 'Referrers', 'getCampaigns');
     WidgetsList::add('Referrers_Referrers', 'General_Overview', 'Referrers', 'getReferrerType');
     WidgetsList::add('Referrers_Referrers', 'Referrers_WidgetGetAll', 'Referrers', 'getAll');
     if (SettingsPiwik::isSegmentationEnabled()) {
         WidgetsList::add('SEO', 'Referrers_WidgetTopKeywordsForPages', 'Referrers', 'getKeywordsForPage');
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:16,代码来源:Referrers.php

示例15: setFrom

 /**
  * Sets the sender.
  *
  * @param string $email Email address of the sender.
  * @param null|string $name Name of the sender.
  * @return Zend_Mail
  */
 public function setFrom($email, $name = null)
 {
     $hostname = Config::getInstance()->mail['defaultHostnameIfEmpty'];
     $piwikHost = Url::getCurrentHost($hostname);
     // If known Piwik URL, use it instead of "localhost"
     $piwikUrl = SettingsPiwik::getPiwikUrl();
     $url = parse_url($piwikUrl);
     if (isset($url['host']) && $url['host'] != 'localhost' && $url['host'] != '127.0.0.1') {
         $piwikHost = $url['host'];
     }
     $email = str_replace('{DOMAIN}', $piwikHost, $email);
     return parent::setFrom($email, $name);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:20,代码来源:Mail.php


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