コード例 #1
0
ファイル: Link.php プロジェクト: yakamoz-fang/concrete
 /**
  * Create a new Link
  *
  * @param string $link       The link href
  * @param string $value      The link's text
  * @param array  $attributes
  *
  * @return Link
  */
 public function __construct($link = '#', $value = null, $attributes = array())
 {
     if (static::$urlGenerator) {
         $link = static::$urlGenerator->to($link);
     }
     if (is_null($value)) {
         $value = $link;
     }
     $attributes['href'] = $link;
     $this->setTag('a', $value, $attributes);
 }
コード例 #2
0
ファイル: Image.php プロジェクト: yakamoz-fang/concrete
 /**
  * Create a new image tag
  *
  * @param string $src        Image source
  * @param string $alt        Image alt text
  * @param array  $attributes
  *
  * @return Image
  */
 public function __construct($src = '#', $alt = null, $attributes = array())
 {
     if (static::$urlGenerator) {
         $src = static::$urlGenerator->asset($src);
     }
     if (!$alt) {
         $alt = basename($src);
     }
     $attributes['src'] = $src;
     $attributes['alt'] = $alt;
     $this->attributes = $attributes;
 }
コード例 #3
0
 public function index($characterId)
 {
     if (is_numeric($characterId)) {
         $dataApi = new EQ2DataApi();
         $generator = new UrlGenerator($dataApi);
         $url = $generator->GenerateForPlayerId($characterId);
         if ($url != null) {
             $this->writeJsonResponse($url);
             return;
         }
     }
     throw new RestException(400);
 }
コード例 #4
0
 public function get($file, $all = false)
 {
     $subtitlesUrls = array();
     if (!is_file($file)) {
         return $subtitlesUrls;
     }
     $userToken = $this->logIn();
     $hashGenerator = new HashGenerator($file);
     $fileHash = $hashGenerator->get();
     $subtitles = $this->searchSubtitles($userToken, $fileHash, filesize($file));
     $urlGenerator = new UrlGenerator();
     return $urlGenerator->getSubtitleUrls($subtitles, $all);
 }
コード例 #5
0
 public function post($request_data)
 {
     if (empty($request_data)) {
         throw new RestException(412, "request data is empty");
     }
     $generator = new UrlGenerator(null);
     $url = $generator->GenerateFromData($request_data);
     if ($url != null) {
         $this->writeJsonResponse($url);
         return;
     }
     throw new RestException(400);
 }
コード例 #6
0
ファイル: Form.php プロジェクト: Vrian7ipx/repocas
 /**
  * Change the form's action to a controller method
  *
  * @param  string $name         The controller and method
  * @param  array  $params       Any method parameters
  *
  * @return void
  */
 public function controller($name, $params = array())
 {
     $this->action = $this->url->action($name, $params);
     // Set the proper method
     if ($method = $this->findRouteMethod($name)) {
         $this->method($method);
     }
     return $this;
 }
コード例 #7
0
 public function testGetIframeURL()
 {
     $uri = UrlGenerator::getIframeURL($this->gadget, $this->context);
     $query = parse_url($uri, PHP_URL_QUERY);
     $query = explode('&', $query);
     $args = array();
     foreach ($query as $param) {
         $param = explode('=', $param);
         list($key, $value) = $param;
         $args[$key] = $value ? $value : '';
     }
     $this->assertArrayHasKey('container', $args);
     $this->assertArrayHasKey('lang', $args);
     $this->assertArrayHasKey('country', $args);
     $this->assertArrayHasKey('view', $args);
     $this->assertArrayHasKey('url', $args);
 }
コード例 #8
0
 public function postProcessRun()
 {
     $testerError = null;
     $secure = false;
     $haveLocations = false;
     loadPageRunData($this->testRoot, $this->run, $this->cached);
     $steps = $this->countSteps();
     for ($i = 1; $i <= $steps; $i++) {
         $rootUrls = UrlGenerator::create(true, "", $this->id, $this->run, $this->cached, $i);
         $stepPaths = new TestPaths($this->testRoot, $this->run, $this->cached, $i);
         $requests = getRequestsForStep($stepPaths, $rootUrls, $secure, $haveLocations, true, true);
         if (isset($requests) && is_array($requests) && count($requests)) {
             getBreakdownForStep($stepPaths, $rootUrls, $requests);
         } else {
             $testerError = 'Missing Results';
         }
         if (is_dir(__DIR__ . '/../google') && is_file(__DIR__ . '/../google/google_lib.inc')) {
             require_once __DIR__ . '/../google/google_lib.inc';
             ParseCsiInfoForStep($stepPaths, true);
         }
         GetDevToolsCPUTimeForStep($stepPaths);
     }
     return $testerError;
 }
コード例 #9
0
 public function testVideoFramesThumbnail()
 {
     $expected = "https://test/thumbnail.php?test=160609_a7_b8&fit=1234&file=video_3_cached_2/myframe.png";
     $ug = UrlGenerator::create(false, "https://test/", "160609_a7_b8", 3, true, 2);
     $this->assertEquals($expected, $ug->videoFrameThumbnail("myframe.png", 1234));
 }
コード例 #10
0
ファイル: index.php プロジェクト: bstewart00/eq2aa
<?php

require_once "../api/EQ2DataApi.php";
require_once "../api/UrlGenerator.php";
if ($_GET) {
    $characterId = $_GET['id'];
    if (is_numeric($characterId)) {
        $dataApi = new EQ2DataApi();
        $generator = new UrlGenerator($dataApi);
        $url = $generator->GenerateForPlayerId($characterId);
        if ($url != null) {
            header("Location: {$url}");
        }
    }
    echo "Invalid character ID";
}
コード例 #11
0
ファイル: child_state.php プロジェクト: TheProjecter/skeleton
error_reporting('E_ALL ^ E_NOTICE');
class UrlGenerator
{
    function __construct($state = array())
    {
        $this->base = $_SERVER['PHP_SELF'];
        $this->state = $state;
    }
    function render($base = null, $array = array())
    {
        return ($base ? $base : $this->base) . '?' . http_build_query(array_merge($this->state, $array));
    }
}
// Pretend this is a state object, and the code below is set up by A_Pager_Request
$state = array();
$state['page'] = $_GET['page'] ? $_GET['page'] : 1;
$state['sort_key'] = $_GET['sort_key'] ? $_GET['sort_key'] : 'text';
$state['sort_order'] = $_GET['sort_order'] ? $_GET['sort_order'] : 'asc';
$state['items_per_page'] = $_GET['items_per_page'] ? $_GET['items_per_page'] : 10;
// Optional: if you want link to persist. Maybe this is set up by another component?
// $state['link'] = $_GET['link'] ? $_GET['link'] : 1;
$url = new UrlGenerator($state);
?>

<p>
<a href="<?php 
echo $url->render('parent_state.php', array('link' => 1));
?>
">Back to Parent</a>
</p>
コード例 #12
0
ファイル: Form.php プロジェクト: aleguisf/fvdev1
 /**
  * Change the form's action
  *
  * @param  string $action The new action
  *
  * @return $this
  */
 public function action($action)
 {
     $this->action = $action ? $this->url->to($action, array(), $this->secure) : null;
     return $this;
 }
コード例 #13
0
 private function makeResponse($gadget, $gadgetModuleId, $gadgetUrl, $context)
 {
     $response = array();
     $prefs = array();
     foreach ($gadget->getUserPrefs() as $pref) {
         $prefs[$pref->getName()] = array('displayName' => $pref->getDisplayName(), 'type' => $pref->getDataType(), 'default' => $pref->getDefaultValue(), 'enumValues' => $pref->getEnumValues(), 'required' => $pref->isRequired());
     }
     $features = array();
     foreach ($gadget->getRequires() as $feature) {
         $features[] = $feature->getName();
     }
     $views = array();
     foreach ($gadget->getViews() as $view) {
         // we want to include all information, except for the content
         unset($view->content);
         $views[$view->getName()] = $view;
     }
     $links = array();
     foreach ($gadget->links as $link) {
         $links[] = $link;
     }
     $icons = array();
     foreach ($gadget->getIcons() as $icon) {
         $icons[] = $icon;
     }
     $oauth = array();
     $oauthspec = $gadget->getOAuthSpec();
     if (!empty($oauthspec)) {
         foreach ($oauthspec->getServices() as $oauthservice) {
             $oauth[$oauthservice->getName()] = array("request" => $oauthservice->getRequestUrl(), "access" => $oauthservice->getAccessUrl(), "authorization" => $oauthservice->getAuthorizationUrl());
         }
     }
     $response['author'] = $gadget->getAuthor();
     $response['authorEmail'] = $gadget->getAuthorEmail();
     $response['description'] = $gadget->getDescription();
     $response['directoryTitle'] = $gadget->getDirectoryTitle();
     $response['features'] = $features;
     $response['screenshot'] = $gadget->getScreenShot();
     $response['thumbnail'] = $gadget->getThumbnail();
     $response['title'] = $gadget->getTitle();
     $response['titleUrl'] = $gadget->getTitleUrl();
     $response['authorAffiliation'] = $gadget->getAuthorAffiliation();
     $response['authorLocation'] = $gadget->getAuthorLocation();
     $response['authorPhoto'] = $gadget->getAuthorPhoto();
     $response['authorAboutme'] = $gadget->getAuthorAboutme();
     $response['authorQuote'] = $gadget->getAuthorQuote();
     $response['authorLink'] = $gadget->getAuthorLink();
     $response['showInDirectory'] = $gadget->getShowInDirectory();
     $response['showStats'] = $gadget->getShowStats();
     $response['width'] = $gadget->getWidth();
     $response['height'] = $gadget->getHeight();
     $response['categories'] = array($gadget->getCategory(), $gadget->getCategory2());
     $response['singleton'] = $gadget->getSingleton();
     $response['scaling'] = $gadget->getScaling();
     $response['scrolling'] = $gadget->getScrolling();
     $response['links'] = $links;
     $response['views'] = $views;
     $response['icons'] = $icons;
     $response['moduleId'] = $gadgetModuleId;
     $response['url'] = $gadgetUrl;
     $response['iframeUrl'] = UrlGenerator::getIframeURL($gadget, $context);
     $response['userPrefs'] = $prefs;
     $response['oauth'] = $oauth;
     return $response;
 }
コード例 #14
0
 public function dropLinkedInParams($query)
 {
     return parent::dropLinkedInParams($query);
 }
コード例 #15
0
 /**
  * @param string $baseUrl The base URL to use for the UrlGenerator
  * @param bool $friendly Optional. True for friendly URLS (default), false for standard URLs
  * @return UrlGenerator The created URL generator for this step
  */
 public function createUrlGenerator($baseUrl, $friendly = true)
 {
     return UrlGenerator::create($friendly, $baseUrl, $this->testInfo->getId(), $this->run, $this->cached, $this->step);
 }
コード例 #16
0
ファイル: ResponseProvider.php プロジェクト: ejailesb/repo
 /**
  * Returns a redirect response.
  *
  * @param  string $url
  * @param  array  $parameters
  * @param  int    $status
  * @param  array  $headers
  * @return RedirectResponse
  */
 public function redirect($url, $parameters = array(), $status = 302, $headers = array())
 {
     return new RedirectResponse($this->url->to($url, $parameters), $status, $headers);
 }
コード例 #17
0
        $this->state = $state;
    }
    function render($base = null, $array = array())
    {
        return ($base ? $base : $this->base) . '?' . http_build_query(array_merge($this->state, $array));
    }
}
// Pretend this is a state object, and the code below is set up by A_Pager_Request
$state = array();
$state['page'] = $_GET['page'] ? $_GET['page'] : 1;
$state['sort_key'] = $_GET['sort_key'] ? $_GET['sort_key'] : 'text';
$state['sort_order'] = $_GET['sort_order'] ? $_GET['sort_order'] : 'asc';
$state['items_per_page'] = $_GET['items_per_page'] ? $_GET['items_per_page'] : 10;
// Optional: if you want link to persist. Maybe this is set up by another component?
// $state['link'] = $_GET['link'] ? $_GET['link'] : 1;
$url = new UrlGenerator($state);
?>

<p>
<a href="<?php 
echo $url->render(array('link' => 1));
?>
"><?php 
if ($_GET['link'] == 1) {
    ?>
<strong>Link1</strong><?php 
} else {
    ?>
Link1<?php 
}
?>
コード例 #18
0
 /**
  * @param TestStepResult $testStepResult The test results of this step
  * @param UrlGenerator $urlGenerator For video frame URL generation for this tep
  * @param TestPaths $nameOnlyPaths To get the name of the video dir for this step
  * @return array Array with the additional information about this step
  */
 private function getAdditionalInfoArray($testStepResult, $urlGenerator, $nameOnlyPaths)
 {
     $ret = array();
     $progress = $testStepResult->getVisualProgress();
     if (array_key_exists('frames', $progress) && is_array($progress['frames']) && count($progress['frames'])) {
         $ret['videoFrames'] = array();
         foreach ($progress['frames'] as $ms => $frame) {
             $videoFrame = array('time' => $ms);
             $videoFrame['image'] = $urlGenerator->getFile($frame['file'], $nameOnlyPaths->videoDir());
             $videoFrame['VisuallyComplete'] = $frame['progress'];
             $ret['videoFrames'][] = $videoFrame;
         }
     }
     $requests = $testStepResult->getRequests();
     $ret['domains'] = $testStepResult->getDomainBreakdown();
     $ret['breakdown'] = $testStepResult->getMimeTypeBreakdown();
     // add requests
     if (!$this->hasInfoFlag(self::WITHOUT_REQUESTS)) {
         $ret['requests'] = $requests;
     }
     // Check to see if we're adding the console log
     if (!$this->hasInfoFlag(self::WITHOUT_CONSOLE)) {
         $console_log = $testStepResult->getConsoleLog();
         if (isset($console_log)) {
             $ret['consoleLog'] = $console_log;
         }
     }
     $statusMessages = $testStepResult->getStatusMessages();
     if ($statusMessages) {
         $ret['status'] = $statusMessages;
         return $ret;
     }
     return $ret;
 }
コード例 #19
0
ファイル: compare.php プロジェクト: lucasRolff/webpagetest
/**
* Build a side-by-side table with the captured frames from each test
*
*/
function ScreenShotTable()
{
    global $tests;
    global $thumbSize;
    global $interval;
    global $maxCompare;
    global $color;
    global $bgcolor;
    global $supports60fps;
    $endTime = 'visual';
    if (array_key_exists('end', $_REQUEST) && strlen($_REQUEST['end'])) {
        $endTime = htmlspecialchars(trim($_REQUEST['end']));
    }
    $filmstrip_end_time = 0;
    if (count($tests)) {
        // figure out how many columns there are
        $end = 0;
        foreach ($tests as &$test) {
            if ($test['video']['end'] > $end) {
                $end = $test['video']['end'];
            }
        }
        if (!defined('EMBED')) {
            echo '<br>';
        }
        echo '<form id="createForm" name="create" method="get" action="/video/create.php">';
        echo "<input type=\"hidden\" name=\"end\" value=\"{$endTime}\">";
        echo '<input type="hidden" name="tests" value="' . htmlspecialchars($_REQUEST['tests']) . '">';
        echo "<input type=\"hidden\" name=\"bg\" value=\"{$bgcolor}\">";
        echo "<input type=\"hidden\" name=\"text\" value=\"{$color}\">";
        if (isset($_REQUEST['labelHeight']) && is_numeric($_REQUEST['labelHeight'])) {
            echo '<input type="hidden" name="labelHeight" value="' . htmlspecialchars($_REQUEST['labelHeight']) . '">"';
        }
        if (isset($_REQUEST['timeHeight']) && is_numeric($_REQUEST['timeHeight'])) {
            echo '<input type="hidden" name="timeHeight" value="' . htmlspecialchars($_REQUEST['timeHeight']) . '">"';
        }
        echo '<table id="videoContainer"><tr>';
        // build a table with the labels
        echo '<td id="labelContainer"><table id="videoLabels"><tr><th>&nbsp;</th></tr>';
        foreach ($tests as &$test) {
            // figure out the height of this video
            $height = 100;
            if ($test['video']['width'] && $test['video']['height']) {
                if ($test['video']['width'] > $test['video']['height']) {
                    $height = 22 + (int) ((double) $thumbSize / (double) $test['video']['width'] * (double) $test['video']['height']);
                } else {
                    $height = 22 + $thumbSize;
                }
            }
            $break = '';
            if (!strpos($test['name'], ' ')) {
                $break = ' style="word-break: break-all;"';
            }
            echo "<tr width=10% height={$height}px ><td{$break} class=\"pagelinks\">";
            // Print the index outside of the link tag
            echo $test['index'] . ': ';
            if (!defined('EMBED')) {
                $urlGenerator = UrlGenerator::create(FRIENDLY_URLS, "", $test['id'], $test['run'], $test['cached'], $test['step']);
                $href = $urlGenerator->resultPage("details");
                echo "<a class=\"pagelink\" id=\"label_{$test['id']}\" href=\"{$href}\">" . WrapableString(htmlspecialchars($test['name'])) . '</a>';
            } else {
                echo WrapableString(htmlspecialchars($test['name']));
            }
            // Print out a link to edit the test
            echo '<br/>';
            echo '<a href="#" class="editLabel" data-test-guid="' . $test['id'] . '" data-current-label="' . htmlentities($test['name']) . '">';
            if (class_exists("SQLite3")) {
                echo '(Edit)';
            }
            echo '</a>';
            echo "</td></tr>\n";
        }
        echo '</table></td>';
        // the actual video frames
        echo '<td><div id="videoDiv"><table id="video"><thead><tr>';
        $filmstrip_end_time = ceil($end / $interval) * $interval;
        $decimals = $interval >= 100 ? 1 : 3;
        $frameCount = 0;
        $ms = 0;
        while ($ms < $filmstrip_end_time) {
            $ms = $frameCount * $interval;
            echo '<th>' . number_format((double) $ms / 1000.0, $decimals) . 's</th>';
            $frameCount++;
        }
        echo "</tr></thead><tbody>\n";
        $firstFrame = 0;
        $maxThumbWidth = 0;
        foreach ($tests as &$test) {
            $aft = (int) $test['aft'] / 100;
            // figure out the height of the image
            $height = 0;
            $width = $thumbSize;
            if ($test['video']['width'] && $test['video']['height']) {
                if ($test['video']['width'] > $test['video']['height']) {
                    $width = $thumbSize;
                    $height = (int) ((double) $thumbSize / (double) $test['video']['width'] * (double) $test['video']['height']);
                } else {
                    $height = $thumbSize;
                    $width = (int) ((double) $thumbSize / (double) $test['video']['height'] * (double) $test['video']['width']);
                }
            }
            $maxThumbWidth = max($maxThumbWidth, $width);
            echo "<tr>";
            $testEnd = ceil($test['video']['end'] / $interval) * $interval;
            $lastThumb = null;
            $frameCount = 0;
            $progress = null;
            $ms = 0;
            $localPaths = new TestPaths(GetTestPath($test['id']), $test['run'], $test['cached'], $test['step']);
            $urlGenerator = UrlGenerator::create(false, "", $test['id'], $test['run'], $test['cached'], $test['step']);
            while ($ms < $filmstrip_end_time) {
                $ms = $frameCount * $interval;
                // find the closest video frame <= the target time
                $frame_ms = null;
                foreach ($test['video']['frames'] as $frameTime => $file) {
                    if ($frameTime <= $ms && (!isset($frame_ms) || $frameTime > $frame_ms)) {
                        $frame_ms = $frameTime;
                    }
                }
                $path = null;
                if (isset($frame_ms)) {
                    $path = $test['video']['frames'][$frame_ms];
                }
                if (array_key_exists('frame_progress', $test['video']) && array_key_exists($frame_ms, $test['video']['frame_progress'])) {
                    $progress = $test['video']['frame_progress'][$frame_ms];
                }
                if (!isset($lastThumb)) {
                    $lastThumb = $path;
                }
                echo '<td>';
                if ($ms <= $testEnd) {
                    $imgPath = $localPaths->videoDir() . "/" . $path;
                    echo "<a href=\"/{$imgPath}\">";
                    echo "<img title=\"" . htmlspecialchars($test['name']) . "\"";
                    $class = 'thumb';
                    if ($lastThumb != $path) {
                        if (!$firstFrame || $frameCount < $firstFrame) {
                            $firstFrame = $frameCount;
                        }
                        $class = 'thumbChanged';
                    }
                    echo " class=\"{$class}\"";
                    echo " width=\"{$width}\"";
                    if ($height) {
                        echo " height=\"{$height}\"";
                    }
                    $imgUrl = $urlGenerator->videoFrameThumbnail($path, $thumbSize);
                    echo " src=\"{$imgUrl}\"></a>";
                    if (isset($progress)) {
                        echo "<br>{$progress}%";
                    }
                    $lastThumb = $path;
                }
                $frameCount++;
                echo '</td>';
            }
            echo "</tr>\n";
        }
        echo "</tr>\n";
        // end of the table
        echo "</tbody></table></div>\n";
        // end of the container table
        echo "</td></tr></table>\n";
        echo "<div id=\"image\">";
        echo "<a id=\"export\" class=\"pagelink\" href=\"filmstrip.php?tests=" . htmlspecialchars($_REQUEST['tests']) . "&thumbSize={$thumbSize}&ival={$interval}&end={$endTime}&text={$color}&bg={$bgcolor}\">Export filmstrip as an image...</a>";
        echo "</div>";
        echo '<div id="bottom"><input type="checkbox" name="slow" value="1"> Slow Motion<br><br>';
        echo "<input id=\"SubmitBtn\" type=\"submit\" value=\"Create Video\">";
        echo '<br><br><a class="pagelink" href="javascript:ShowAdvanced()">Advanced customization options...</a>';
        echo "</div></form>";
        if (!defined('EMBED')) {
            ?>
        <div id="layout">
            <form id="layoutForm" name="layout" method="get" action="/video/compare.php">
            <?php 
            echo "<input type=\"hidden\" name=\"tests\" value=\"" . htmlspecialchars($_REQUEST['tests']) . "\">\n";
            ?>
                <table id="layoutTable">
                    <tr><th>Thumbnail Size</th><th>Thumbnail Interval</th><th>Comparison End Point</th></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>";
            if ($supports60fps) {
                $checked = '';
                if ($interval < 100) {
                    $checked = ' checked=checked';
                }
                echo "<input type=\"radio\" name=\"ival\" value=\"16.67\"{$checked} onclick=\"this.form.submit();\"> 60 FPS<br>";
            }
            $checked = '';
            if ($supports60fps && $interval == 100 || !$supports60fps && $interval < 500) {
                $checked = ' checked=checked';
            }
            echo "<input type=\"radio\" name=\"ival\" value=\"100\"{$checked} onclick=\"this.form.submit();\"> 0.1 sec<br>";
            $checked = '';
            if ($interval == 500) {
                $checked = ' checked=checked';
            }
            echo "<input type=\"radio\" name=\"ival\" value=\"500\"{$checked} onclick=\"this.form.submit();\"> 0.5 sec<br>";
            $checked = '';
            if ($interval == 1000) {
                $checked = ' checked=checked';
            }
            echo "<input type=\"radio\" name=\"ival\" value=\"1000\"{$checked} onclick=\"this.form.submit();\"> 1 sec<br>";
            $checked = '';
            if ($interval > 1000) {
                $checked = ' checked=checked';
            }
            echo "<input type=\"radio\" name=\"ival\" value=\"5000\"{$checked} onclick=\"this.form.submit();\"> 5 sec<br>";
            echo "</td>";
            // fill in the end-point selection
            echo "<td>";
            if (!strcasecmp($endTime, 'aft')) {
                $endTime = 'visual';
            }
            $checked = '';
            if (!strcasecmp($endTime, 'visual')) {
                $checked = ' checked=checked';
            }
            echo "<input type=\"radio\" name=\"end\" value=\"visual\"{$checked} onclick=\"this.form.submit();\"> Visually Complete<br>";
            $checked = '';
            if (!strcasecmp($endTime, 'all')) {
                $checked = ' checked=checked';
            }
            echo "<input type=\"radio\" name=\"end\" value=\"all\"{$checked} onclick=\"this.form.submit();\"> Last Change<br>";
            $checked = '';
            if (!strcasecmp($endTime, 'doc')) {
                $checked = ' checked=checked';
            }
            echo "<input type=\"radio\" name=\"end\" value=\"doc\"{$checked} onclick=\"this.form.submit();\"> Document Complete<br>";
            $checked = '';
            if (!strcasecmp($endTime, 'full')) {
                $checked = ' checked=checked';
            }
            echo "<input type=\"radio\" name=\"end\" value=\"full\"{$checked} onclick=\"this.form.submit();\"> Fully Loaded<br>";
            echo "</td></tr>";
            ?>
                </table>
            </form>
        </div>
        <?php 
            // display the waterfall if there is only one test
            $end_seconds = $filmstrip_end_time / 1000;
            if (count($tests) == 1) {
                /* @var TestStepResult $stepResult */
                $stepResult = $tests[0]["stepResult"];
                $requests = $stepResult->getRequestsWithInfo(true, true)->getRequests();
                echo CreateWaterfallHtml('', $requests, $tests[0]['id'], $tests[0]['run'], $tests[0]['cached'], $stepResult->getRawResults(), "&max={$end_seconds}&mime=1&state=1&cpu=1&bw=1", $tests[0]['step']);
                echo '<br><br>';
            } else {
                $waterfalls = array();
                foreach ($tests as &$test) {
                    $waterfalls[] = array('id' => $test['id'], 'label' => $test['name'], 'run' => $test['run'], 'step' => $test['step'], 'cached' => $test['cached']);
                }
                $labels = '';
                if (array_key_exists('hideurls', $_REQUEST) && $_REQUEST['hideurls']) {
                    $labels = '&labels=0';
                }
                InsertMultiWaterfall($waterfalls, "&max={$end_seconds}&mime=1&state=1&cpu=1&bw=1{$labels}");
            }
            ?>

        <div id="advanced" style="display:none;">
            <h3>Advanced Visual Comparison Configuration</h3>
            <p>There are additional customizations that can be done by modifying the <b>tests</b> parameter in the comparison URL directly.</p>
            <p>URL structure: ...compare.php?tests=&lt;Test 1 ID&gt;,&lt;Test 2 ID&gt;...</p>
            <p>The tests are displayed in the order listed and can be customized with options:</p>
            <table>
            <tr><td>Custom label</td><td>-l:&lt;label&gt;</td><td>110606_MJ_RZEY-l:Original</td></tr>
            <tr><td>Specific run</td><td>-r:&lt;run&gt;</td><td>110606_MJ_RZEY-r:3</td></tr>
            <tr><td>Repeat view</td><td>-c:1</td><td>110606_MJ_RZEY-c:1</td></tr>
            <tr><td>Specific step</td><td>-s:3</td><td>110606_MJ_RZEY-s:3</td></tr>
            <tr><td>Specific End Time</td><td>-e:&lt;seconds&gt;</td><td>110606_MJ_RZEY-e:1.1</td></tr>
            </table>
            <br>
            <p>You can also customize the background and text color by passing HTML color values to <b>bg</b> and <b>text</b> query parameters.</p>
            <p>Examples:</p>
            <ul>
            <li><b>Customizing labels:</b>
            http://www.webpagetest.org/video/compare.php?tests=110606_MJ_RZEY-l:Original,110606_AE_RZN5-l:No+JS</li>
            <li><b>Compare First vs. Repeat view:</b>
            http://www.webpagetest.org/video/compare.php?tests=110606_MJ_RZEY, 110606_MJ_RZEY-c:1</li>
            <li><b>Second step of first run vs. Second step of second run:</b>
            http://www.webpagetest.org/video/compare.php?tests=110606_MJ_RZEY-r:1-s:2,110606_MJ_RZEY-r:2-s:2</li>
            <li><b>White background with black text:</b>
            http://www.webpagetest.org/video/compare.php?tests=110606_MJ_RZEY, 110606_MJ_RZEY-c:1&bg=ffffff&text=000000</li>
            </ul>
            <input id="advanced-ok" type=button class="simplemodal-close" value="OK">
        </div>
        <?php 
        }
        // EMBED
        // scroll the table to show the first thumbnail change
        $scrollPos = $firstFrame * ($maxThumbWidth + 6);
        ?>
        <script language="javascript">
            var thumbWidth = <?php 
        echo "{$maxThumbWidth};";
        ?>
            var scrollPos = <?php 
        echo "{$scrollPos};";
        ?>
            document.getElementById("videoDiv").scrollLeft = scrollPos;
        </script>
        <?php 
    }
}
コード例 #20
0
ファイル: config.php プロジェクト: viskri/learnosity-demos
/*
|--------------------------------------------------------------------------
| Environment Details
|--------------------------------------------------------------------------
|
| Setup any path/environment variables required. Handles site loading
| from the root or a subdirectory
|
*/
$rootPath = $_SERVER['DOCUMENT_ROOT'];
$subDir = strpos($_SERVER['REQUEST_URI'], '/www');
$baseWebPath = $subDir !== false ? substr($_SERVER['REQUEST_URI'], 0, $subDir + 4) : '/';
$includePaths = array($rootPath, $rootPath . $baseWebPath, $rootPath . $baseWebPath . '/../src', $rootPath . '/src', get_include_path());
set_include_path(join(PATH_SEPARATOR, $includePaths));
include_once 'utils/UrlGenerator.php';
$UrlGenerator = new UrlGenerator();
// 2 separate statements needed for 5.3 support
$pathArr = explode('/', $_SERVER['REQUEST_URI']);
$section = $pathArr[1];
$env = array('page' => $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'path' => $_SERVER['REQUEST_URI'], 'protocol' => $_SERVER['SERVER_PORT'] === '443' ? 'https://' : 'http://', 'section' => $section, 'www' => $UrlGenerator->getRelativePath($_SERVER['REQUEST_URI'], $baseWebPath), 'mode' => getEnvironmentMode($customMode));
// Make sure we have a trailing slash for the www path
if (substr($env['www'], -1) !== '/') {
    $env['www'] .= '/';
}
/*
|--------------------------------------------------------------------------
| Learnosity URLs
|--------------------------------------------------------------------------
|
| Setup any URLs for external API's to allow them to be conveniently
| changed depending on the regions.   Use protocol relative urls to ensure
コード例 #21
0
ファイル: pageimages.php プロジェクト: lucasRolff/webpagetest
<?php

include __DIR__ . '/common.inc';
require_once __DIR__ . '/object_detail.inc';
require_once __DIR__ . '/page_data.inc';
require_once __DIR__ . '/include/TestInfo.php';
require_once __DIR__ . '/include/TestPaths.php';
require_once __DIR__ . '/include/TestStepResult.php';
require_once __DIR__ . '/include/UrlGenerator.php';
global $testPath, $id, $run, $cached, $step;
// defined in common.inc
$secure = false;
$haveLocations = false;
$testInfo = TestInfo::fromFiles($testPath);
$localPaths = new TestPaths($testPath, $run, $cached, $step);
$urlGenerator = UrlGenerator::create(false, "", $id, $run, $cached, $step);
$requests = getRequestsForStep($localPaths, $urlGenerator, $secure, $haveLocations, true);
$page_keywords = array('Images', 'Webpagetest', 'Website Speed Test', 'Page Speed');
$page_description = "Website speed test images{$testLabel}.";
$userImages = true;
?>
<!DOCTYPE html>
<html>
  <head>
    <title>WebPagetest Page Images<?php 
echo $testLabel;
?>
</title>
    <?php 
$gaTemplate = 'Page Images';
include 'head.inc';
コード例 #22
0
ファイル: Router.php プロジェクト: Orlion/Minor
 public function to($path)
 {
     $urlGenerator = UrlGenerator::getInstance($this->routesConfig);
     return $urlGenerator->generateUrl($path);
 }
コード例 #23
0
 public function actionVasRegister()
 {
     $package_id = Yii::app()->request->getParam('package');
     $phone = yii::app()->user->getState('msisdn');
     $back_link = Yii::app()->request->getParam('back_link', '');
     if ($back_link != '') {
         Yii::app()->session['back_link'] = $back_link;
     }
     if (isset($_GET['link'])) {
         $requestData = $this->aes->decrypt("{$_GET['link']}");
         $composition = explode('&', $requestData);
         $transactionID = $composition[0];
         $msisdnResponse = $composition[1];
         $confirm = $composition[2];
         $transactionVAS = VasGateModel::model()->findByAttributes(array('transaction_id' => $transactionID));
         $package_id = $transactionVAS->package_id;
         if ($confirm == 1) {
             if (Formatter::formatPhone($phone) == Formatter::formatPhone($msisdnResponse)) {
                 $this->_register($phone, $package_id, true);
                 $this->redirect(Yii::app()->session['back_link']);
             }
         } else {
             $this->redirect($this->createUrl("/site"));
         }
     } else {
         $check_promotion = $this->check_promotion($phone);
         $pDetail = PackageModel::model()->findByPk($package_id);
         $price = $pDetail->fee;
         $packageCode = $pDetail->code;
         /*if($check_promotion){
               $price = 0;
           }*/
         if ($check_promotion) {
             $price = 0;
             if ($package_id == 1) {
                 $fee = ' 2000 đồng/1 ngày';
             } else {
                 $fee = ' 7000 đồng/7 ngày';
             }
             $fee .= "|| Khuyến mại 5 ngày";
         } else {
             if ($package_id == 1) {
                 $fee = '1 ngày';
             } else {
                 $fee = '7 ngày';
             }
         }
         $convmap = array(0x80, 0xffff, 0, 0xffff);
         $fee = mb_encode_numericentity($fee, $convmap, 'UTF-8');
         $fee = str_replace("&#", "##", $fee);
         $vasGate = new VasGateModel();
         $vasGate->transaction_id = time() . $phone;
         $vasGate->package_id = $pDetail->id;
         $vasGate->information = $pDetail->code;
         $vasGate->price = $price;
         if ($vasGate->save()) {
             $urlGen = new UrlGenerator($this->spId, $vasGate->transaction_id, $packageCode, $price, 'http://amusic.vn/account/vasRegister', $fee);
             $url = $urlGen->generateUrl($this->aes);
             $this->redirect($url);
         }
         $this->redirect('/');
     }
 }
コード例 #24
0
 /**
  * @param TestStepResult $stepResult Results for the step to be printed
  */
 private function printStepResults($stepResult)
 {
     if (empty($stepResult)) {
         return;
     }
     $run = $stepResult->getRunNumber();
     $cached = $stepResult->isCachedRun() ? 1 : 0;
     $step = $stepResult->getStepNumber();
     $testRoot = $this->testInfo->getRootDirectory();
     $testId = $this->testInfo->getId();
     $localPaths = new TestPaths($testRoot, $run, $cached, $step);
     $nameOnlyPaths = new TestPaths("", $run, $cached, $step);
     $urlPaths = new TestPaths($this->baseUrl . substr($testRoot, 1), $run, $cached, $step);
     echo "<results>\n";
     echo ArrayToXML($stepResult->getRawResults());
     $this->printPageSpeed($stepResult);
     echo "</results>\n";
     // links to the relevant pages
     $urlGenerator = UrlGenerator::create($this->friendlyUrls, $this->baseUrl, $testId, $run, $cached, $step);
     echo "<pages>\n";
     echo "<details>" . htmlspecialchars($urlGenerator->resultPage("details")) . "</details>\n";
     echo "<checklist>" . htmlspecialchars($urlGenerator->resultPage("performance_optimization")) . "</checklist>\n";
     echo "<breakdown>" . htmlspecialchars($urlGenerator->resultPage("breakdown")) . "</breakdown>\n";
     echo "<domains>" . htmlspecialchars($urlGenerator->resultPage("domains")) . "</domains>\n";
     echo "<screenShot>" . htmlspecialchars($urlGenerator->resultPage("screen_shot")) . "</screenShot>\n";
     echo "</pages>\n";
     // urls for the relevant images
     echo "<thumbnails>\n";
     echo "<waterfall>" . htmlspecialchars($urlGenerator->thumbnail("waterfall.png")) . "</waterfall>\n";
     echo "<checklist>" . htmlspecialchars($urlGenerator->thumbnail("optimization.png")) . "</checklist>\n";
     if ($this->fileHandler->fileExists($localPaths->screenShotFile())) {
         echo "<screenShot>" . htmlspecialchars($urlGenerator->thumbnail("screen.jpg")) . "</screenShot>\n";
     }
     echo "</thumbnails>\n";
     echo "<images>\n";
     echo "<waterfall>" . htmlspecialchars($urlGenerator->generatedImage("waterfall")) . "</waterfall>\n";
     echo "<connectionView>" . htmlspecialchars($urlGenerator->generatedImage("connection")) . "</connectionView>\n";
     echo "<checklist>" . htmlspecialchars($urlGenerator->optimizationChecklistImage()) . "</checklist>\n";
     if ($this->fileHandler->fileExists($localPaths->screenShotFile())) {
         echo "<screenShot>" . htmlspecialchars($urlGenerator->getFile($nameOnlyPaths->screenShotFile())) . "</screenShot>\n";
     }
     if ($this->fileHandler->fileExists($localPaths->screenShotPngFile())) {
         echo "<screenShotPng>" . htmlspecialchars($urlGenerator->getFile($nameOnlyPaths->screenShotPngFile())) . "</screenShotPng>\n";
     }
     echo "</images>\n";
     // raw results (files accessed directly on the file system, but via URL)
     echo "<rawData>\n";
     if ($this->fileHandler->gzFileExists($localPaths->devtoolsScriptTimingFile())) {
         echo "<scriptTiming>" . htmlspecialchars($urlGenerator->getGZip($nameOnlyPaths->devtoolsScriptTimingFile())) . "</scriptTiming>\n";
     }
     if ($this->fileHandler->gzFileExists($localPaths->headersFile())) {
         echo "<headers>" . $urlPaths->headersFile() . "</headers>\n";
     }
     if ($this->fileHandler->gzFileExists($localPaths->bodiesFile())) {
         echo "<bodies>" . $urlPaths->bodiesFile() . "</bodies>\n";
     }
     if ($this->fileHandler->gzFileExists($localPaths->pageDataFile())) {
         echo "<pageData>" . $urlPaths->pageDataFile() . "</pageData>\n";
     }
     if ($this->fileHandler->gzFileExists($localPaths->requestDataFile())) {
         echo "<requestsData>" . $urlPaths->requestDataFile() . "</requestsData>\n";
     }
     if ($this->fileHandler->gzFileExists($localPaths->utilizationFile())) {
         echo "<utilization>" . $urlPaths->utilizationFile() . "</utilization>\n";
     }
     $this->printPageSpeedData($stepResult);
     echo "</rawData>\n";
     // video frames
     $progress = $stepResult->getVisualProgress();
     if (array_key_exists('frames', $progress) && is_array($progress['frames']) && count($progress['frames'])) {
         echo "<videoFrames>\n";
         foreach ($progress['frames'] as $ms => $frame) {
             echo "<frame>\n";
             echo "<time>{$ms}</time>\n";
             echo "<image>" . htmlspecialchars($urlGenerator->getFile($frame['file'], $nameOnlyPaths->videoDir())) . "</image>\n";
             echo "<VisuallyComplete>{$frame['progress']}</VisuallyComplete>\n";
             echo "</frame>\n";
         }
         echo "</videoFrames>\n";
     }
     $this->printAdditionalInformation($stepResult, false);
 }