本文整理汇总了PHP中LoadLocationsIni函数的典型用法代码示例。如果您正苦于以下问题:PHP LoadLocationsIni函数的具体用法?PHP LoadLocationsIni怎么用?PHP LoadLocationsIni使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoadLocationsIni函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoadLocations
/**
* Load the location information
*
*/
function LoadLocations()
{
$locations = LoadLocationsIni();
FilterLocations($locations, 'pss');
// strip out any sensitive information
foreach ($locations as $index => &$loc) {
if (isset($loc['browser'])) {
$testCount = 16;
if (array_key_exists('relayServer', $loc)) {
$loc['backlog'] = 0;
$loc['avgTime'] = 30;
$loc['testers'] = 1;
$loc['wait'] = ceil($testCount * 30 / 60);
} else {
GetPendingTests($index, $count, $avgTime);
if (!$avgTime) {
$avgTime = 30;
}
// default to 30 seconds if we don't have any history
$loc['backlog'] = $count;
$loc['avgTime'] = $avgTime;
$loc['testers'] = GetTesterCount($index);
$loc['wait'] = -1;
if ($loc['testers']) {
if ($loc['testers'] > 1) {
$testCount = 16;
}
$loc['wait'] = ceil(($testCount + $count / $loc['testers']) * $avgTime / 60);
}
}
}
unset($loc['localDir']);
unset($loc['key']);
unset($loc['remoteDir']);
unset($loc['relayKey']);
}
return $locations;
}
示例2: LoadLocationsIni
$error = NULL;
$xml = false;
$usingAPI = false;
if (!strcasecmp($req_f, 'xml')) {
$xml = true;
}
$json = false;
if (!strcasecmp($req_f, 'json')) {
$json = true;
}
$headless = false;
if (array_key_exists('headless', $settings) && $settings['headless']) {
$headless = true;
}
// load the location information
$locations = LoadLocationsIni();
// See if we need to load a subset of the locations
$filter = null;
if (isset($_REQUEST['k']) && preg_match('/^(?P<prefix>[0-9A-Za-z]+)\\.(?P<key>[0-9A-Za-z]+)$/', $_REQUEST['k'], $matches)) {
$filter = $matches['prefix'];
foreach ($locations as $name => $location) {
if (isset($location['browser'])) {
$ok = false;
if (isset($location['allowKeys'])) {
$keys = explode(',', $location['allowKeys']);
foreach ($keys as $k) {
if ($k == $filter) {
$ok = true;
break;
}
}
示例3: GetAllTesters
/**
* Load the location information and extract just the end nodes
*
*/
function GetAllTesters()
{
$locations = array();
$loc = LoadLocationsIni();
if (isset($_REQUEST['location'])) {
$location = $_REQUEST['location'];
$new = array('locations' => array('1' => 'group', 'default' => 'group'), 'group' => array('1' => $location, 'default' => $location, 'label' => 'placeholder'));
if (isset($loc[$_REQUEST['location']])) {
$new[$_REQUEST['location']] = $loc[$_REQUEST['location']];
}
$loc = $new;
}
BuildLocations($loc);
$i = 1;
while (isset($loc['locations'][$i])) {
$group =& $loc[$loc['locations'][$i]];
$j = 1;
while (isset($group[$j])) {
if (array_key_exists('relayServer', $loc[$group[$j]]) && strlen($loc[$group[$j]]['relayServer']) && array_key_exists('relayLocation', $loc[$group[$j]]) && strlen($loc[$group[$j]]['relayLocation'])) {
$locations[$loc[$group[$j]]['location']] = GetRemoteTesters($loc[$group[$j]]['relayServer'], $loc[$group[$j]]['relayLocation']);
} else {
$locations[$loc[$group[$j]]['location']] = GetTesters($loc[$group[$j]]['location']);
}
$j++;
}
$i++;
}
return $locations;
}
示例4: LoadLocations
/**
* Load the location information
*
*/
function LoadLocations()
{
$locations = LoadLocationsIni();
FilterLocations($locations);
// strip out any sensitive information
foreach ($locations as $index => &$loc) {
// count the number of tests at each location
if (isset($loc['localDir'])) {
$loc['backlog'] = CountTests($loc['localDir']);
unset($loc['localDir']);
}
if (isset($loc['key'])) {
unset($loc['key']);
}
if (isset($loc['remoteDir'])) {
unset($loc['remoteDir']);
}
if (isset($loc['notify'])) {
unset($loc['notify']);
}
}
return $locations;
}
示例5: LoadLocations
/**
* Load the location information and extract just the end nodes
*
*/
function LoadLocations()
{
$locations = array();
$loc = LoadLocationsIni();
if (isset($_REQUEST['k']) && preg_match('/^(?P<prefix>[0-9A-Za-z]+)(?P<key>[\\.0-9A-Za-z]*)$/', $_REQUEST['k'], $matches)) {
$filter = $matches['prefix'];
foreach ($loc as $name => $location) {
if (isset($location['browser'])) {
$ok = false;
if (isset($location['allowKeys'])) {
$keys = explode(',', $location['allowKeys']);
foreach ($keys as $k) {
if ($k == $filter) {
$ok = true;
break;
}
}
}
if (!$ok) {
unset($loc[$name]);
}
}
}
}
FilterLocations($loc);
BuildLocations($loc);
if (isset($loc['locations']['default'])) {
$default = $loc['locations']['default'];
} else {
$default = $loc['locations'][1];
}
$i = 1;
while (isset($loc['locations'][$i])) {
$group =& $loc[$loc['locations'][$i]];
if (!isset($group['hidden']) || !$group['hidden'] || $_REQUEST['hidden']) {
$label = $group['label'];
if (isset($group['default'])) {
$def = $group['default'];
} else {
$def = $group[1];
}
$j = 1;
while (isset($group[$j])) {
if (isset($loc[$group[$j]]['location'])) {
$loc_name = $loc[$group[$j]]['location'];
if (!isset($loc[$group[$j]]['hidden']) || !$loc[$group[$j]]['hidden'] || $_REQUEST['hidden']) {
if (isset($locations[$loc_name])) {
$locations[$loc_name]['Browsers'] .= ',' . $loc[$group[$j]]['browser'];
} else {
$locations[$loc_name] = array('Label' => $label, 'location' => $loc[$group[$j]]['location'], 'Browsers' => $loc[$group[$j]]['browser'], 'localDir' => $loc[$group[$j]]['localDir'], 'status' => @$loc[$group[$j]]['status'], 'relayServer' => @$loc[$group[$j]]['relayServer'], 'relayLocation' => @$loc[$group[$j]]['relayLocation'], 'labelShort' => $loc[$loc_name]['label']);
if ($default == $loc['locations'][$i] && $def == $group[$j]) {
$locations[$loc_name]['default'] = true;
}
if (isset($group['group'])) {
$locations[$loc_name]['group'] = $group['group'];
}
}
}
}
$j++;
}
}
$i++;
}
return $locations;
}
示例6: CheckLocations
function CheckLocations()
{
$locations = LoadLocationsIni();
$out = '';
foreach ($locations['locations'] as $id => $location) {
if (is_numeric($id)) {
$info = GetInstallLocationInfo($locations, $location);
$out .= "<li class=\"{$info['state']}\">{$info['label']}";
if (count($info['locations'])) {
$out .= "<ul>";
foreach ($info['locations'] as $loc_name => $loc) {
$out .= "<li class=\"{$loc['state']}\">{$loc['label']}";
$out .= '</li>';
}
$out .= "</ul>";
}
$out .= "</li>";
}
}
echo $out;
}
示例7: CheckLocations
/**
* For any locations that haven't connected in at least 2 hours, go through and delete any tests in the work queue
*
*/
function CheckLocations()
{
$locations = LoadLocationsIni();
BuildLocations($locations);
$deleted = false;
echo "\n";
for ($i = 1; array_key_exists($i, $locations['locations']); $i++) {
$group =& $locations[$locations['locations'][$i]];
for ($j = 1; array_key_exists($j, $group); $j++) {
if (!array_key_exists('relayServer', $loc[$group[$j]])) {
$name = $locations[$group[$j]]['location'];
$location = GetTesters($name);
$workdir = $locations[$name]['localDir'];
$elapsed = -1;
if (isset($location) && array_key_exists('elapsed', $location)) {
$elapsed = $location['elapsed'];
}
if ($elapsed < 0 || $elapsed > 120) {
if (strlen($workdir)) {
if (is_dir($workdir)) {
echo "{$elapsed} minutes : {$name} - {$workdir}\n";
delTree($workdir);
rmdir($workdir);
$deleted = true;
}
}
}
}
}
}
// nuke all of the queue files if we had to delete something
if ($deleted) {
$files = scandir('./tmp');
foreach ($files as $file) {
if (stripos($file, '.queue') !== false) {
unlink("./tmp/{$file}");
}
}
}
}
示例8: EmailKeyInfo
/**
* Email the API key info to the requestor
*
* @param mixed $info
*/
function EmailKeyInfo($info)
{
global $prefix;
$email = $info['email'];
$content = "Your API key is: {$prefix}.{$info['key']}\n\n";
$content .= "The API key is limited to {$info['key_limit']} page loads per day. Each run, first or repeat view counts as a page load (10 runs, first and repeat view would be 20 page loads). If you need to do more testing than that allows then you should consider running a private instance: https://sites.google.com/a/webpagetest.org/docs/private-instances\n";
$l = LoadLocationsIni();
$locations = array();
foreach ($l as $id => $loc) {
$id = trim($id);
if (is_array($loc) && isset($loc['browser']) && isset($loc['allowKeys'])) {
$allowed = false;
$prefixes = explode(',', $loc['allowKeys']);
foreach ($prefixes as $p) {
if ($p == $prefix) {
$allowed = true;
}
}
if ($allowed) {
$browsers = explode(',', $loc['browser']);
if (isset($browsers) && is_array($browsers)) {
if (count($browsers) > 1) {
foreach ($browsers as $browser) {
$browser = trim($browser);
$locations[] = "{$id}:{$browser}";
}
} else {
$locations[] = $id;
}
}
}
}
}
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || isset($_SERVER['HTTP_SSL']) && $_SERVER['HTTP_SSL'] == 'On' ? 'https' : 'http';
$url = "{$protocol}://{$_SERVER['HTTP_HOST']}/getLocations.php?f=html&k={$prefix}";
$content .= "\nYou can see the current list of locations that are available for API testing here: {$url}.\n";
if (count($locations)) {
$content .= "\nThe following browser/location combinations are available:\n\n";
foreach ($locations as $location) {
$content .= "{$location}\n";
}
}
SendMessage($email, 'WebPagetest API Key', $content);
echo 'The API key details were sent to ' . htmlspecialchars($email);
return $content;
}
示例9: GetAllTesters
/**
* Load the location information and extract just the end nodes
*
*/
function GetAllTesters()
{
$locations = array();
$loc = LoadLocationsIni();
BuildLocations($loc);
$i = 1;
while (isset($loc['locations'][$i])) {
$group =& $loc[$loc['locations'][$i]];
$j = 1;
while (isset($group[$j])) {
if (array_key_exists('relayServer', $loc[$group[$j]]) && strlen($loc[$group[$j]]['relayServer']) && array_key_exists('relayLocation', $loc[$group[$j]]) && strlen($loc[$group[$j]]['relayLocation'])) {
$locations[$loc[$group[$j]]['location']] = GetRemoteTesters($loc[$group[$j]]['relayServer'], $loc[$group[$j]]['relayLocation']);
} else {
$locations[$loc[$group[$j]]['location']] = GetTesters($loc[$group[$j]]['location']);
}
$j++;
}
$i++;
}
return $locations;
}
示例10: EC2_GetTesters
function EC2_GetTesters()
{
$locations = array();
$loc = LoadLocationsIni();
$i = 1;
while (isset($loc['locations'][$i])) {
$group =& $loc[$loc['locations'][$i]];
$j = 1;
while (isset($group[$j])) {
$locations[$group[$j]] = GetTesters($group[$j]);
$j++;
}
$i++;
}
return $locations;
}
示例11: EC2_GetAMILocations
/**
* Get a list of locations supported by the given AMI
*
*/
function EC2_GetAMILocations()
{
$locations = array();
$loc = LoadLocationsIni();
foreach ($loc as $location => $locInfo) {
if (isset($locInfo['ami']) && isset($locInfo['region'])) {
if (!isset($locations[$locInfo['ami']])) {
$locations[$locInfo['ami']] = array('ami' => $locInfo['ami'], 'region' => $locInfo['region'], 'locations' => array());
}
$locations[$locInfo['ami']]['locations'][] = $location;
}
}
return $locations;
}
示例12: CheckLocations
function CheckLocations()
{
$locations = LoadLocationsIni();
$out = '';
$video = false;
foreach ($locations['locations'] as $id => $location) {
if (is_numeric($id)) {
$info = GetLocationInfo($locations, $location);
if ($info['video']) {
$video = true;
}
$out .= "<li class=\"{$info['state']}\">{$info['label']}";
if (count($info['locations'])) {
$out .= "<ul>";
foreach ($info['locations'] as $loc_name => $loc) {
$out .= "<li class=\"{$loc['state']}\">{$loc['label']}";
$out .= '</li>';
}
$out .= "</ul>";
}
$out .= "</li>";
}
}
if ($video) {
echo '<li class="pass">Video rendering is supported</li></ul><br><ul>';
} else {
echo '<li class="fail"><span class="fail">No test agents are configured to render video</span></li></ul><br><ul>';
}
echo $out;
}
示例13: LoadLocations
/**
* Load the location information and extract just the end nodes
*
*/
function LoadLocations()
{
$locations = array();
$loc = LoadLocationsIni();
FilterLocations($loc);
BuildLocations($loc);
if (isset($loc['locations']['default'])) {
$default = $loc['locations']['default'];
} else {
$default = $loc['locations'][1];
}
$i = 1;
while (isset($loc['locations'][$i])) {
$group =& $loc[$loc['locations'][$i]];
if (!array_key_exists('hidden', $group) || !$group['hidden'] || $_REQUEST['hidden']) {
$label = $group['label'];
if (isset($group['default'])) {
$def = $group['default'];
} else {
$def = $group[1];
}
$j = 1;
while (isset($group[$j])) {
if (array_key_exists($group[$j], $loc)) {
if (!array_key_exists('hidden', $loc[$group[$j]]) || !$loc[$group[$j]]['hidden'] || $_REQUEST['hidden']) {
$locations[$group[$j]] = array('Label' => $label, 'location' => $loc[$group[$j]]['location'], 'Browser' => $loc[$group[$j]]['browser'], 'localDir' => $loc[$group[$j]]['localDir'], 'relayServer' => @$loc[$group[$j]]['relayServer'], 'relayLocation' => @$loc[$group[$j]]['relayLocation']);
if ($default == $loc['locations'][$i] && $def == $group[$j]) {
$locations[$group[$j]]['default'] = true;
}
}
}
$j++;
}
}
$i++;
}
return $locations;
}