本文整理汇总了PHP中Piwik::globr方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::globr方法的具体用法?PHP Piwik::globr怎么用?PHP Piwik::globr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik
的用法示例。
在下文中一共展示了Piwik::globr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$test = new GroupTest("Piwik - running '{$this->testGroupType}' tests...");
$intro = '';
if (!$this->databaseRequired) {
$intro .= $this->getTestDatabaseInfoMessage();
}
$intro .= self::$testsHelpLinks . "<hr/>";
$intro .= $this->introAppend;
$toInclude = array();
foreach ($this->dirsToGlob as $dir) {
$toInclude = array_merge($toInclude, Piwik::globr(PIWIK_INCLUDE_PATH . $dir, '*.test.php'));
}
// if present, make sure Database.test.php is first
$idx = array_search(PIWIK_INCLUDE_PATH . '/tests/core/Database.test.php', $toInclude);
if ($idx !== FALSE) {
unset($toInclude[$idx]);
array_unshift($toInclude, PIWIK_INCLUDE_PATH . '/tests/core/Database.test.php');
}
foreach ($toInclude as $file) {
$test->addFile($file);
}
$result = $test->run(new HtmlTimerReporter($intro));
if (SimpleReporter::inCli()) {
exit($result ? 0 : 1);
}
}
示例2: getAdapters
/**
* Get list of adapters
*
* @return array
*/
public static function getAdapters()
{
$path = PIWIK_INCLUDE_PATH . '/core/Db';
$pathLength = strlen($path) + 1;
$adapters = Piwik::globr($path, '*.php');
$adapterNames = array();
foreach ($adapters as $adapter) {
$adapterName = str_replace('/', '_', substr($adapter, $pathLength, -strlen('.php')));
$className = 'Piwik_Db_' . $adapterName;
if (call_user_func(array($className, 'isEnabled'))) {
$adapterNames[strtoupper($adapterName)] = call_user_func(array($className, 'getDefaultPort'));
}
}
return $adapterNames;
}
示例3: test_svnKeywords
function test_svnKeywords()
{
/*
* Piwik's .php files have $Id: $
*/
$contents = file_get_contents($file = PIWIK_DOCUMENT_ROOT . '/index.php');
$this->assertTrue(strpos($contents, '$Id: ' . basename($file) . ' ') !== false, $file);
$contents = file_get_contents($file = PIWIK_DOCUMENT_ROOT . '/piwik.php');
$this->assertTrue(strpos($contents, '$Id: ' . basename($file) . ' ') !== false, $file);
foreach (Piwik::globr(PIWIK_DOCUMENT_ROOT . '/core', '*.php') as $file) {
$contents = file_get_contents($file);
$this->assertTrue(strpos($contents, '$Id: ' . basename($file) . ' ') !== false, $file);
}
foreach (Piwik::globr(PIWIK_DOCUMENT_ROOT . '/plugins', '*.php') as $file) {
if (strpos($file, '/tests/') !== false || strpos($file, '/config/') !== false || strpos($file, '/PhpSecInfo/') !== false || strpos($file, 'tcpdf_config.php') !== false) {
continue;
}
$contents = file_get_contents($file);
$this->assertTrue(strpos($contents, '$Id: ') !== false, $file . " Please add '@version \$Id: \$' in the file header comments");
}
/*
* Piwik's .js files don't have $Id$ (information disclosure)
*/
$contents = file_get_contents($file = PIWIK_DOCUMENT_ROOT . '/piwik.js');
$this->assertTrue(strpos($contents, '$Id') === false, $file);
$contents = file_get_contents($file = PIWIK_DOCUMENT_ROOT . '/js/piwik.js');
$this->assertTrue(strpos($contents, '$Id') === false, $file);
foreach (Piwik::globr(PIWIK_DOCUMENT_ROOT . '/plugins', '*.js') as $file) {
$contents = file_get_contents($file);
$found = strpos($contents, '$Id') !== false;
$this->assertTrue(!$found, $file, "Please Remove the string \$Id from the JS files");
}
foreach (Piwik::globr(PIWIK_DOCUMENT_ROOT . '/themes', '*.js') as $file) {
$contents = file_get_contents($file);
$this->assertTrue(strpos($contents, '$Id') === false, $file);
}
}
示例4: foreach
<?php
require_once 'config_test.php';
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/mock_objects.php';
require_once 'simpletest/collector.php';
require_once 'simpletest/default_reporter.php';
// if SCRIPT_NAME points to benchmark_runner.php, load every benchmark group in benchmarks folder
if (preg_match("/benchmark_runner.php\$/", $_SERVER['SCRIPT_NAME'])) {
foreach (Piwik::globr(PIWIK_INCLUDE_PATH . '/tests/benchmarks', '*.benchmark.php') as $file) {
require_once $file;
}
}
function display_runner($benchmarkGroups)
{
?>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" type="text/css" media="screen"></link>
<title>Benchmarks | Piwik</title>
</head>
<body>
<style>
td.elapsed {
font-weight: bold;
}
td.status {
font-style: italic;
}