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


PHP getRequests函数代码示例

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


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

示例1: testGetRequests

 public function testGetRequests()
 {
     global $SINGLESTEP_REQUESTS;
     $this->tempDir = TestUtil::extractToTemp(__DIR__ . "/data/singlestepResults.zip");
     if (!$this->tempDir) {
         $this->fail("Failed to extract results to temp dir");
     }
     $testPath = $this->tempDir . "/singlestepResults";
     $actualRequests = getRequests("testId", $testPath, 1, 0, $hasSecure, $hasLocations, false, false);
     $this->assertEquals($SINGLESTEP_REQUESTS, $actualRequests);
 }
开发者ID:lucasRolff,项目名称:webpagetest,代码行数:11,代码来源:objectDetailTest.php

示例2: getWelcome

function getWelcome()
{
    global $wgUser, $wgOut, $wgLang;
    // Add CSS
    $wgOut->addModuleStyles('ext.socialprofile.userwelcome.css');
    // Get stats and user level
    $stats = new UserStats($wgUser->getID(), $wgUser->getName());
    $stats_data = $stats->getUserStats();
    $user_level = new UserLevel($stats_data['points']);
    // Safe links
    $level_link = Title::makeTitle(NS_HELP, wfMessage('mp-userlevels-link')->inContentLanguage()->plain());
    $avatar_link = SpecialPage::getTitleFor('UploadAvatar');
    // Make an avatar
    $avatar = new wAvatar($wgUser->getID(), 'l');
    // Profile top images/points
    $output = '<div class="mp-welcome-logged-in">
	<h2>' . wfMessage('mp-welcome-logged-in', $wgUser->getName())->parse() . '</h2>
	<div class="mp-welcome-image">
	<a href="' . htmlspecialchars($wgUser->getUserPage()->getFullURL()) . '" rel="nofollow">' . $avatar->getAvatarURL() . '</a>';
    if (strpos($avatar->getAvatarImage(), 'default_') !== false) {
        $uploadOrEditMsg = 'mp-welcome-upload';
    } else {
        $uploadOrEditMsg = 'mp-welcome-edit';
    }
    $output .= '<div><a href="' . htmlspecialchars($avatar_link->getFullURL()) . '" rel="nofollow">' . wfMessage($uploadOrEditMsg)->plain() . '</a></div>';
    $output .= '</div>';
    global $wgUserLevels;
    if ($wgUserLevels) {
        $output .= '<div class="mp-welcome-points">
			<div class="points-and-level">
				<div class="total-points">' . wfMessage('mp-welcome-points', $wgLang->formatNum($stats_data['points']))->parse() . '</div>
				<div class="honorific-level"><a href="' . htmlspecialchars($level_link->getFullURL()) . '">(' . $user_level->getLevelName() . ')</a></div>
			</div>
			<div class="cleared"></div>
			<div class="needed-points">
				<br />' . wfMessage('mp-welcome-needed-points', htmlspecialchars($level_link->getFullURL()), $user_level->getNextLevelName(), $user_level->getPointsNeededToAdvance())->text() . '</div>
		</div>';
    }
    $output .= '<div class="cleared"></div>';
    $output .= getRequests();
    $output .= '</div>';
    return $output;
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:43,代码来源:UserWelcome.php

示例3: getWelcome

function getWelcome()
{
    global $wgUser, $wgOut, $wgScriptPath, $wgUploadPath;
    // Add CSS
    $wgOut->addExtensionStyle($wgScriptPath . '/extensions/SocialProfile/UserWelcome/UserWelcome.css');
    // Get stats and user level
    $stats = new UserStats($wgUser->getID(), $wgUser->getName());
    $stats_data = $stats->getUserStats();
    $user_level = new UserLevel($stats_data['points']);
    // Safe links
    $level_link = Title::makeTitle(NS_HELP, wfMsgForContent('mp-userlevels-link'));
    $avatar_link = SpecialPage::getTitleFor('UploadAvatar');
    // Make an avatar
    $avatar = new wAvatar($wgUser->getID(), 'l');
    // Profile top images/points
    $output = '<div class="mp-welcome-logged-in">
	<h2>' . wfMsg('mp-welcome-logged-in', $wgUser->getName()) . '</h2>
	<div class="mp-welcome-image">
	<a href="' . $wgUser->getUserPage()->escapeFullURL() . '" rel="nofollow"><img src="' . $wgUploadPath . '/avatars/' . $avatar->getAvatarImage() . '" alt="" border="0"/></a>';
    if (strpos($avatar->getAvatarImage(), 'default_') !== false) {
        $output .= '<div><a href="' . $avatar_link->escapeFullURL() . '" rel="nofollow">' . wfMsg('mp-welcome-upload') . '</a></div>';
    } else {
        $output .= '<div><a href="' . $avatar_link->escapeFullURL() . '" rel="nofollow">' . wfMsg('mp-welcome-edit') . '</a></div>';
    }
    $output .= '</div>';
    global $wgUserLevels;
    if ($wgUserLevels) {
        $output .= '<div class="mp-welcome-points">
			<div class="points-and-level">
				<div class="total-points">' . wfMsgExt('mp-welcome-points', 'parsemag', $stats_data['points']) . '</div>
				<div class="honorific-level"><a href="' . $level_link->escapeFullURL() . '">(' . $user_level->getLevelName() . ')</a></div>
			</div>
			<div class="cleared"></div>
			<div class="needed-points">
				<br />' . wfMsgExt('mp-welcome-needed-points', 'parsemag', $level_link->escapeFullURL(), $user_level->getNextLevelName(), $user_level->getPointsNeededToAdvance()) . '</div>
		</div>';
    }
    $output .= '<div class="cleared"></div>';
    $output .= getRequests();
    $output .= '</div>';
    return $output;
}
开发者ID:kghbln,项目名称:semantic-social-profile,代码行数:42,代码来源:UserWelcome.php

示例4: CheckForSpam

/**
* Check the given test against our block list to see if the test bypassed our blocks.
* If it did, add the domain to the automatic blocked domains list
* 
*/
function CheckForSpam()
{
    global $testPath;
    global $id;
    global $runNumber;
    global $cacheWarmed;
    global $testInfo;
    global $testInfo_dirty;
    if (isset($testInfo) && !array_key_exists('spam', $testInfo) && strpos($id, '.') == false && !strlen($testInfo['user']) && !strlen($testInfo['key']) && is_file('./settings/blockurl.txt')) {
        $blocked = false;
        $blockUrls = file('./settings/blockurl.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        if (count($blockUrls)) {
            if (!isset($runNumber)) {
                $runNumber = 1;
            }
            if (!isset($cacheWarmed)) {
                $cacheWarmed = 0;
            }
            $secure = false;
            $haveLocations = false;
            $requests = getRequests($id, $testPath, $runNumber, $cacheWarmed, $secure, $haveLocations, false);
            if (isset($requests) && is_array($requests) && count($requests)) {
                foreach ($requests as &$request) {
                    if (array_key_exists('full_url', $request)) {
                        $url = $request['full_url'];
                        foreach ($blockUrls as $block) {
                            $block = trim($block);
                            if (strlen($block) && preg_match("/{$block}/i", $url)) {
                                $date = gmdate("Ymd");
                                // add the top-level page domain to the block list
                                $pageUrl = $requests[0]['full_url'];
                                $host = '';
                                if (strlen($pageUrl)) {
                                    $parts = parse_url($pageUrl);
                                    $host = trim($parts['host']);
                                    if (strlen($host) && strcasecmp($host, 'www.google.com') && strcasecmp($host, 'google.com') && strcasecmp($host, 'www.youtube.com') && strcasecmp($host, 'youtube.com')) {
                                        // add it to the auto-block list if it isn't already there
                                        if (is_file('./settings/blockdomainsauto.txt')) {
                                            $autoBlock = file('./settings/blockdomainsauto.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
                                        }
                                        if (!isset($autoBlock) || !is_array($autoBlock)) {
                                            $autoBlock = array();
                                        }
                                        $found = false;
                                        foreach ($autoBlock as $entry) {
                                            if (!strcasecmp($entry, $host)) {
                                                $found = true;
                                                break;
                                            }
                                        }
                                        if (!$found) {
                                            $autoBlock[] = $host;
                                            file_put_contents('./settings/blockdomainsauto.txt', implode("\r\n", $autoBlock));
                                        }
                                    }
                                }
                                logMsg("[{$id}] {$host}: {$pageUrl} referenced {$url} which matched {$block}", "./log/{$date}-auto_blocked.log", true);
                                $blocked = true;
                                break 2;
                            }
                        }
                    }
                }
            }
        }
        if ($blocked) {
            $testInfo['spam'] = $blocked;
            $testInfo_dirty = true;
        }
    }
}
开发者ID:krishnakanthpps,项目名称:webpagetest,代码行数:76,代码来源:workdone.php

示例5: BuildHAR

/**
* Build the data set
* 
* @param mixed $pageData
*/
function BuildHAR(&$pageData, $id, $testPath, $options)
{
    $result = array();
    $entries = array();
    $result['log'] = array();
    $result['log']['version'] = '1.1';
    $result['log']['creator'] = array('name' => 'WebPagetest', 'version' => VER_WEBPAGETEST);
    $result['log']['pages'] = array();
    foreach ($pageData as $run => $pageRun) {
        foreach ($pageRun as $cached => $data) {
            $cached_text = '';
            if ($cached) {
                $cached_text = '_Cached';
            }
            if (!array_key_exists('browser', $result['log'])) {
                $result['log']['browser'] = array('name' => $data['browser_name'], 'version' => $data['browser_version']);
            }
            $pd = array();
            $pd['startedDateTime'] = msdate($data['date']);
            $pd['title'] = "Run {$run}, ";
            if ($cached) {
                $pd['title'] .= "Repeat View";
            } else {
                $pd['title'] .= "First View";
            }
            $pd['title'] .= " for " . $data['URL'];
            $pd['id'] = "page_{$run}_{$cached}";
            $pd['pageTimings'] = array('onLoad' => $data['docTime'], 'onContentLoad' => -1, '_startRender' => $data['render']);
            // dump all of our metrics into the har data as custom fields
            foreach ($data as $name => $value) {
                if (!is_array($value)) {
                    $pd["_{$name}"] = $value;
                }
            }
            // add the page-level ldata to the result
            $result['log']['pages'][] = $pd;
            // now add the object-level data to the result
            $secure = false;
            $haveLocations = false;
            $requests = getRequests($id, $testPath, $run, $cached, $secure, $haveLocations, false, true);
            foreach ($requests as &$r) {
                $entry = array();
                $entry['pageref'] = $pd['id'];
                $entry['startedDateTime'] = msdate((double) $data['date'] + $r['load_start'] / 1000.0);
                $entry['time'] = $r['all_ms'];
                $request = array();
                $request['method'] = $r['method'];
                $protocol = $r['is_secure'] ? 'https://' : 'http://';
                $request['url'] = $protocol . $r['host'] . $r['url'];
                $request['headersSize'] = -1;
                $request['bodySize'] = -1;
                $request['cookies'] = array();
                $request['headers'] = array();
                $ver = '';
                $headersSize = 0;
                if (isset($r['headers']) && isset($r['headers']['request'])) {
                    foreach ($r['headers']['request'] as &$header) {
                        $headersSize += strlen($header) + 2;
                        // add 2 for the \r\n that is on the raw headers
                        $pos = strpos($header, ':');
                        if ($pos > 0) {
                            $name = trim(substr($header, 0, $pos));
                            $val = trim(substr($header, $pos + 1));
                            if (strlen($name)) {
                                $request['headers'][] = array('name' => $name, 'value' => $val);
                            }
                            // parse out any cookies
                            if (!strcasecmp($name, 'cookie')) {
                                $cookies = explode(';', $val);
                                foreach ($cookies as &$cookie) {
                                    $pos = strpos($cookie, '=');
                                    if ($pos > 0) {
                                        $name = (string) trim(substr($cookie, 0, $pos));
                                        $val = (string) trim(substr($cookie, $pos + 1));
                                        if (strlen($name)) {
                                            $request['cookies'][] = array('name' => $name, 'value' => $val);
                                        }
                                    }
                                }
                            }
                        } else {
                            $pos = strpos($header, 'HTTP/');
                            if ($pos >= 0) {
                                $ver = (string) trim(substr($header, $pos + 5, 3));
                            }
                        }
                    }
                }
                if ($headersSize) {
                    $request['headersSize'] = $headersSize;
                }
                $request['httpVersion'] = $ver;
                $request['queryString'] = array();
                $parts = parse_url($request['url']);
                if (isset($parts['query'])) {
//.........这里部分代码省略.........
开发者ID:Pankajchandan,项目名称:WPT-server,代码行数:101,代码来源:har.inc.php

示例6: header

<?php

header("Content-type: image/png");
include 'common.inc';
include 'object_detail.inc';
include 'contentColors.inc';
include 'connectionView.inc';
include 'page_data.inc';
$pageData = loadPageRunData($testPath, $run, $cached);
$mime = $_GET['mime'];
// get all of the requests
$secure = false;
$haveLocations = false;
$requests = getRequests($id, $testPath, $run, $cached, $secure, $haveLocations, false);
$mimeColors = requestColors($requests);
$summary = array();
$connections = getConnections($requests, $summary);
$options = array('id' => $id, 'path' => $testPath, 'run' => $run, 'cached' => $cached, 'cpu' => true, 'bw' => true);
$im = drawImage($connections, $summary, $url, $mime, $mimeColors, false, $pageData, $options);
// spit the image out to the browser
imagepng($im);
imagedestroy($im);
开发者ID:kondrats,项目名称:Pagetest,代码行数:22,代码来源:connectionView.php

示例7: xmlRequests

/**
* Dump information about all of the requests
*/
function xmlRequests($id, $testPath, $run, $cached)
{
    if (array_key_exists('requests', $_REQUEST) && $_REQUEST['requests']) {
        echo "<requests>\n";
        $secure = false;
        $haveLocations = false;
        $requests = getRequests($id, $testPath, $run, $cached, $secure, $haveLocations, false, true);
        foreach ($requests as &$request) {
            echo "<request number=\"{$request['number']}\">\n";
            foreach ($request as $field => $value) {
                if (!is_array($value)) {
                    echo "<{$field}>" . xml_entities($value) . "</{$field}>\n";
                }
            }
            if (array_key_exists('headers', $request) && is_array($request['headers'])) {
                echo "<headers>\n";
                if (array_key_exists('request', $request['headers']) && is_array($request['headers']['request'])) {
                    echo "<request>\n";
                    foreach ($request['headers']['request'] as $value) {
                        echo "<header>" . xml_entities($value) . "</header>\n";
                    }
                    echo "</request>\n";
                }
                if (array_key_exists('response', $request['headers']) && is_array($request['headers']['response'])) {
                    echo "<response>\n";
                    foreach ($request['headers']['response'] as $value) {
                        echo "<header>" . xml_entities($value) . "</header>\n";
                    }
                    echo "</response>\n";
                }
                echo "</headers>\n";
            }
            echo "</request>\n";
        }
        echo "</requests>\n";
    }
}
开发者ID:sethblanchard,项目名称:webpagetest,代码行数:40,代码来源:xmlResult.php

示例8: header

header("Content-disposition: attachment; filename={$id}_headersMatch.csv");
header("Content-type: text/csv");
// list of metrics that will be produced
// for each of these, the median, average and std dev. will be calculated
echo "\"Test ID\",\"Found\"\r\n";
// and now the actual data
foreach ($testIds as &$testId) {
    $cached = 0;
    RestoreTest($testId);
    GetTestStatus($testId);
    $testPath = './' . GetTestPath($testId);
    $pageData = loadAllPageData($testPath);
    $medianRun = GetMedianRun($pageData, $cached);
    $secured = 0;
    $haveLocations = 1;
    $requests = getRequests($testId, $testPath, $medianRun, $cached, $secure, $haveLocations, false, true);
    // Flag indicating if we matched
    $matched = array();
    $nSearches = count($searches);
    $nRecords = count($requests);
    if ($nRecords > $maxReqs && $maxReqs != 0) {
        $nRecords = $maxReqs;
    }
    for ($rec = 0; $rec < $nRecords; $rec++) {
        $r = $requests[$rec];
        if (isset($r['headers']) && isset($r['headers']['response'])) {
            foreach ($r['headers']['response'] as &$header) {
                // Loop through the search conditions we received
                for ($i = 0; $i < $nSearches; $i++) {
                    // Skip already matched items
                    if ($matched[$i]) {
开发者ID:it114,项目名称:webpagetest,代码行数:31,代码来源:headersMatch.php

示例9: getTargetTTFB

/**
* Determine the target TTFB for the given test
*
* @param mixed $pageData
* @param mixed $test
* @param mixed $id
* @param mixed $run
*/
function getTargetTTFB(&$pageData, &$test, $id, $run, $cached)
{
    $target = NULL;
    $rtt = null;
    if (isset($test['testinfo']['latency'])) {
        $rtt = (int) $test['testinfo']['latency'];
    }
    // load the object data (unavoidable, we need the socket connect time to the first host)
    require_once 'object_detail.inc';
    $testPath = './' . GetTestPath($id);
    $secure = false;
    $haveLocations;
    $requests = getRequests($id, $testPath, $run, $cached, $secure, $haveLocations, false);
    if (count($requests)) {
        // figure out what the RTT is to the server (take the connect time from the first request unless it is over 3 seconds)
        $connect_ms = $requests[0]['connect_ms'];
        if (isset($rtt) && (!isset($connect_ms) || $connect_ms > 3000)) {
            $rtt += 100;
        } else {
            $rtt = $connect_ms;
        }
        if (isset($rtt)) {
            $ssl_ms = 0;
            if ($requests[0]['is_secure'] && (int) $requests[0]['ssl_ms'] > 0) {
                $ssl_ms = $requests[0]['ssl_ms'];
            }
            // RTT's: DNS + Socket Connect + HTTP Request
            $target = $rtt * 3 + $ssl_ms;
        }
    }
    return $target;
}
开发者ID:ceeaspb,项目名称:webpagetest,代码行数:40,代码来源:optimization_detail.inc.php

示例10: number_format

        }
    }
    if ($navTiming) {
        echo "<td{$borderClass}>";
        if ($data['firstPaint'] > 0) {
            echo number_format($data['firstPaint'] / 1000.0, 3) . 's</td><td>';
        }
        echo number_format($data['domContentLoadedEventStart'] / 1000.0, 3) . 's - ' . number_format($data['domContentLoadedEventEnd'] / 1000.0, 3) . 's (' . number_format(($data['domContentLoadedEventEnd'] - $data['domContentLoadedEventStart']) / 1000.0, 3) . 's)' . '</td>';
        echo '<td>' . number_format($data['loadEventStart'] / 1000.0, 3) . 's - ' . number_format($data['loadEventEnd'] / 1000.0, 3) . 's (' . number_format(($data['loadEventEnd'] - $data['loadEventStart']) / 1000.0, 3) . 's)' . '</td>';
    }
    echo '</tr>';
    echo '</table><br>';
}
$secure = false;
$haveLocations = false;
$requests = getRequests($id, $testPath, $run, @$_GET['cached'], $secure, $haveLocations, true, true);
?>
                <script type="text/javascript">
                  markUserTime('aft.Detail Table');
                </script>

                <div style="text-align:center;">
                <h3 name="waterfall_view">Waterfall View</h3>
                <table border="1" bordercolor="silver" cellpadding="2px" cellspacing="0" style="width:auto; font-size:11px; margin-left:auto; margin-right:auto;">
                    <tr>
                        <td><table><tr><td><div class="bar" style="width:15px; background-color:#1f7c83"></div></td><td>DNS Lookup</td></tr></table></td>
                        <td><table><tr><td><div class="bar" style="width:15px; background-color:#e58226"></div></td><td>Initial Connection</td></tr></table></td>
                        <?php 
if ($secure) {
    ?>
                        <td><table><tr><td><div class="bar" style="width:15px; background-color:#c141cd"></div></td><td>SSL Negotiation</td></tr></table></td>
开发者ID:JHand93,项目名称:WebPerformanceTestSuite,代码行数:31,代码来源:details.php

示例11: writeUsers

                }
            }
        }
    }
    writeUsers($users);
}
?>

<div class="wrapper">
	<div class="left"> 
		<h3>Pending Requests</h3>
		<?php 
if (!empty($message)) {
    echo "<p>{$message}</p>";
}
$requests = getRequests($_SESSION['username']);
if (empty($requests)) {
    echo "<p>You have no new friend requests at this time.</p>";
} else {
    echo "<table>";
    foreach ($requests as $request) {
        // loop through pending requests
        $requestImg = getUser($request)->pic;
        echo "<tr><td><img class=\"smallpic\" src=\"{$requestImg}\" alt=\"Photo of {$request}\"/></td>";
        echo "<td><label>{$request}</label></td>";
        ?>
				<td>
				<form method="post" action="requests.php">
					<input type="hidden" name="decision" value="accept" />
					<input type="hidden" name="uname" value=<?php 
        echo '"' . $request . '"';
开发者ID:HKMOpen,项目名称:project3_webdev,代码行数:31,代码来源:requests.php

示例12: tbnDrawChecklist

/**
* Draw the checklist image
* 
* @param resource $img
*/
function tbnDrawChecklist(&$img)
{
    global $id;
    global $testPath;
    global $run;
    global $cached;
    global $url;
    include 'optimizationChecklist.inc';
    $is_secure = false;
    $has_locations = false;
    $requests = getRequests($id, $testPath, $run, $cached, $is_secure, $has_locations, false);
    $page_data = loadPageRunData($testPath, $run, $cached);
    $img = drawChecklist($url, $requests, $page_data);
    if (!$requests || !$page_data) {
        $failed = true;
    }
}
开发者ID:ceeaspb,项目名称:webpagetest,代码行数:22,代码来源:thumbnail.php

示例13: ScreenShotTable


//.........这里部分代码省略.........
        echo "Select up to {$maxCompare} tests and <input id=\"SubmitBtn\" type=\"submit\" value=\"Create Video\"></div>";
        echo "</form>";
        ?>
        <div id="layout">
            <form id="layoutForm" name="layout" method="get" action="/video/compare.php">
            <?php 
        echo "<input type=\"hidden\" name=\"tests\" value=\"{$_REQUEST['tests']}\" />\n";
        ?>
                <table id="layoutTable">
                    <tr><th>Thumbnail Size</th><th>Thumbnail Interval</th></tr>
                    <?php 
        // fill in the thumbnail size selection
        echo "<tr><td>";
        $checked = '';
        if ($thumbSize <= 100) {
            $checked = ' checked=checked';
        }
        echo "<input type=\"radio\" name=\"thumbSize\" value=\"100\"{$checked} onclick=\"this.form.submit();\"> Small<br>";
        $checked = '';
        if ($thumbSize <= 150 && $thumbSize > 100) {
            $checked = ' checked=checked';
        }
        echo "<input type=\"radio\" name=\"thumbSize\" value=\"150\"{$checked} onclick=\"this.form.submit();\"> Medium<br>";
        $checked = '';
        if ($thumbSize > 150) {
            $checked = ' checked=checked';
        }
        echo "<input type=\"radio\" name=\"thumbSize\" value=\"200\"{$checked} onclick=\"this.form.submit();\"> Large";
        echo "</td>";
        // fill in the interval selection
        echo "<td>";
        $checked = '';
        if ($interval <= 1) {
            $checked = ' checked=checked';
        }
        echo "<input type=\"radio\" name=\"ival\" value=\"100\"{$checked} onclick=\"this.form.submit();\"> 0.1 sec<br>";
        $checked = '';
        if ($interval == 5) {
            $checked = ' checked=checked';
        }
        echo "<input type=\"radio\" name=\"ival\" value=\"500\"{$checked} onclick=\"this.form.submit();\"> 0.5 sec<br>";
        $checked = '';
        if ($interval == 10) {
            $checked = ' checked=checked';
        }
        echo "<input type=\"radio\" name=\"ival\" value=\"1000\"{$checked} onclick=\"this.form.submit();\"> 1 sec<br>";
        $checked = '';
        if ($interval == 50) {
            $checked = ' checked=checked';
        }
        echo "<input type=\"radio\" name=\"ival\" value=\"5000\"{$checked} onclick=\"this.form.submit();\"> 5 sec<br>";
        echo "</td></tr>";
        ?>
                </table>
            </form>
        </div>
        <?php 
        // scroll the table to show the first thumbnail change
        $scrollPos = $firstFrame * ($thumbSize + 8);
        ?>
        <script language="javascript">
            var scrollPos = <?php 
        echo "{$scrollPos};";
        ?>
            document.getElementById("videoDiv").scrollLeft = scrollPos;
        </script>
        <?php 
        // display the waterfall if there is only one test
        if (count($tests) == 1) {
            ?>
        <div id="waterfall">
            <map name="waterfall_map">
            <?php 
            $data = loadPageRunData($tests[0]['path'], $tests[0]['run'], $tests[0]['cached']);
            $secure = false;
            $haveLocations = false;
            $requests = getRequests($tests[0]['id'], $tests[0]['path'], $tests[0]['run'], $tests[0]['cached'], $secure, $haveLocations, false);
            $options = array('id' => $tests[0]['id'], 'path' => $tests[0]['path'], 'run' => $tests[0]['run'], 'cached' => $tests[0]['cached'], 'cpu' => false);
            $map = drawWaterfall($tests[0]['url'], $requests, $data, true, $options);
            foreach ($map as $entry) {
                if ($entry['request'] !== NULL) {
                    $index = $entry['request'] + 1;
                    $title = $index . ': ' . $entry['url'];
                    echo '<area alt="' . $title . '" title="' . $title . '" shape=RECT coords="' . $entry['left'] . ',' . $entry['top'] . ',' . $entry['right'] . ',' . $entry['bottom'] . '">' . "\n";
                } else {
                    echo '<area alt="' . $entry['url'] . '" title="' . $entry['url'] . '" shape=RECT coords="' . $entry['left'] . ',' . $entry['top'] . ',' . $entry['right'] . ',' . $entry['bottom'] . '">' . "\n";
                }
            }
            ?>
            </map>
            
            <?php 
            echo "<img id=\"waterfallImage\" usemap=\"#waterfall_map\" border=\"0\" alt=\"Waterfall\" src=\"/waterfall.php?test={$tests[0]['id']}&run={$tests[0]['run']}&cached={$tests[0]['cached']}&cpu=0&bw=0\">";
            ?>
        </div>
        <?php 
        }
        echo '<br/><br/>';
    }
}
开发者ID:kondrats,项目名称:Pagetest,代码行数:101,代码来源:compare.php

示例14: foreach

\t\t\t\t<th>Departure
\t\t\t\t<th>Arrival
\t\t\t\t<th>Departure date
\t\t\t\t<th>Requests<br><small>pending/accepted</small>
\t\t\t\t<td>
\t\t\t</tr>
\t\t</thead>
\t\t<tbody>
EOF;
$i = 0;
foreach ($travel_plans->find(array("user" => $_SESSION['user']))->sort(array("date" => 1)) as $k => $v) {
    $i++;
    $v['date'] = convertDate($v['date'], false);
    $accepted = 0;
    $pending = 0;
    $list = getRequests(array("travel" => "" . $v['_id']));
    foreach ($list as $_k => $_v) {
        if ($_v['status'] == 0) {
            $pending++;
        } else {
            if ($_v['status'] == 1) {
                $accepted++;
            }
        }
    }
    $HTML[] = <<<EOF
\t\t<tr>
\t\t\t<td>{$i}
\t\t\t\t<a href="?travel_plan/edit/{$v['_id']}"><span class="glyphicon glyphicon-edit"></span></a>
\t\t\t<td><a href="?travel_plan/view/{$v['_id']}">{$v['from']}</a> 
\t\t\t\t&nbsp;&nbsp;
开发者ID:oinas,项目名称:garage48_tartu2016,代码行数:31,代码来源:travel_plan.php

示例15: BuildResult

/**
* Build the data set
* 
* @param mixed $pageData
*/
function BuildResult(&$pageData)
{
    global $id;
    global $testPath;
    $result = array();
    $entries = array();
    $result['log'] = array();
    $result['log']['version'] = '1.1';
    $result['log']['creator'] = array('name' => 'WebPagetest', 'version' => '1.8');
    $result['log']['browser'] = array('name' => 'Internet Explorer', 'version' => '');
    $result['log']['pages'] = array();
    foreach ($pageData as $run => &$pageRun) {
        foreach ($pageRun as $cached => &$data) {
            $pd = array();
            $pd['startedDateTime'] = msdate($data['date']);
            $pd['title'] = "Run {$run}, ";
            if ($cached) {
                $pd['title'] .= "Repeat View";
            } else {
                $pd['title'] .= "First View";
            }
            $pd['title'] .= " for " . $data['URL'];
            $pd['id'] = "page_{$run}_{$cached}";
            $pd['pageTimings'] = array('onLoad' => $data['docTime'], 'onContentLoad' => -1);
            // add the page-level ldata to the result
            $result['log']['pages'][] = $pd;
            // now add the object-level data to the result
            $secure = false;
            $haveLocations = false;
            $requests = getRequests($id, $testPath, $run, $cached, $secure, $haveLocations, false, true);
            foreach ($requests as &$r) {
                $entry = array();
                $entry['pageref'] = $pd['id'];
                $entry['startedDateTime'] = msdate((double) $data['date'] + $r['offset'] / 1000.0);
                $entry['time'] = $r['totalTime'];
                $request = array();
                $request['method'] = $r['method'];
                $protocol = 'http://';
                if ($r['secure']) {
                    $protocol = 'https://';
                }
                $request['url'] = $protocol . $r['host'] . $r['url'];
                $request['headersSize'] = -1;
                $request['bodySize'] = -1;
                $request['cookies'] = array();
                $request['headers'] = array();
                $ver = '';
                if (isset($r['headers']) && isset($r['headers']['request'])) {
                    foreach ($r['headers']['request'] as &$header) {
                        $pos = strpos($header, ':');
                        if ($pos > 0) {
                            $name = trim(substr($header, 0, $pos));
                            $val = trim(substr($header, $pos + 1));
                            if (strlen($name)) {
                                $request['headers'][] = array('name' => $name, 'value' => $val);
                            }
                            // parse out any cookies
                            if (!strcasecmp($name, 'cookie')) {
                                $cookies = explode(';', $val);
                                foreach ($cookies as &$cookie) {
                                    $pos = strpos($cookie, '=');
                                    if ($pos > 0) {
                                        $name = (string) trim(substr($cookie, 0, $pos));
                                        $val = (string) trim(substr($cookie, $pos + 1));
                                        if (strlen($name)) {
                                            $request['cookies'][] = array('name' => $name, 'value' => $val);
                                        }
                                    }
                                }
                            }
                        } else {
                            $pos = strpos($header, 'HTTP/');
                            if ($pos >= 0) {
                                $ver = (string) trim(substr($header, $pos + 5, 3));
                            }
                        }
                    }
                }
                $request['httpVersion'] = $ver;
                $request['queryString'] = array();
                $parts = parse_url($request['url']);
                if (isset($parts['query'])) {
                    $qs = array();
                    parse_str($parts['query'], $qs);
                    foreach ($qs as $name => $val) {
                        $request['queryString'][] = array('name' => (string) $name, 'value' => (string) $val);
                    }
                }
                if (!strcasecmp(trim($request['method']), 'post')) {
                    $request['postData'] = array();
                    $request['postData']['mimeType'] = '';
                    $request['postData']['text'] = '';
                }
                $entry['request'] = $request;
                $response = array();
//.........这里部分代码省略.........
开发者ID:kondrats,项目名称:Pagetest,代码行数:101,代码来源:export.php


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