コード例 #1
0
 public function execute($request)
 {
     $file = null;
     foreach ($this->getContext()->getRouting()->getRoutes() as $route) {
         $route_info = $route->getDefaults();
         if ($request->getParameter('namespace') == strtolower($route_info['module'] . $route_info['action'])) {
             $combiner = new combineFiles();
             $file = $combiner->getFileName($request->getParameter('type'), strtolower($route_info['module'] . $route_info['action']));
         }
     }
     $this->content = null;
     if (is_readable($file)) {
         $this->content = file_get_contents($file);
     } else {
         $this->content = sprintf('Couldn\'t read file %s', $file);
     }
     sfConfig::set('sf_web_debug', false);
     $this->getResponse()->setHttpHeader('Content-Type', $request->getParameter('type') === 'css' ? 'text/css' : 'text/javascript');
     $this->getResponse()->setHttpHeader('Cache-Control', 'max-age=86040000, public, must-revalidate');
     $this->setTemplate('output');
     $this->setLayout(false);
 }
コード例 #2
0
<?php

if (strtolower($namespace) != 'sfguardauthsignin') {
    $combiner = new combineFiles();
    echo sprintf('<script src="%s" type="text/javascript"></script>', $combiner->combine('js', $namespace, sfContext::getInstance()->getResponse()));
    unset($combiner);
} else {
    include_javascripts();
}
?>
<script type="text/javascript" id="loadjavascript">
<!--
/* Add Functions that Need to Load after Ready Here */
$(document).ready(function()
{
<?php 
//the load_html5_player partial may load jplayer javascripts using this slot if required
echo get_slot('javascript_player_loader');
$is_secure = isset($_SERVER['HTTPS']) && strlen($_SERVER['HTTPS']) > 0 && $_SERVER['HTTPS'] != 'off' ? true : false;
$protocol = $is_secure ? 'https://' : 'http://';
$hostname = str_replace($_SERVER['SERVER_PORT'], '', $_SERVER['HTTP_HOST']);
if ($is_secure) {
    $port = '';
} else {
    if (substr($hostname, -1) === ':') {
        $port = $music_proxy_port;
    } else {
        $port = ':' . $music_proxy_port;
    }
}
//music url
コード例 #3
0
ファイル: layout.php プロジェクト: Alenpiera/streeme
</title>
  <meta name="description" content="<?php 
echo get_slot('description');
?>
" />
  <link rel="shortcut icon" href="<?php 
echo public_path('favicon.ico', true);
?>
" />
  <link rel="apple-touch-icon" href="<?php 
echo public_path('apple-touch-icon.png', true);
?>
" />
  <?php 
$namespace = $this->getModuleName() . $this->getActionName();
if (strtolower($namespace) != 'sfguardauthsignin' && substr($namespace, 0, 5) != 'setup') {
    $combiner = new combineFiles();
    echo sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $combiner->combine('css', $namespace, sfContext::getInstance()->getResponse()));
    unset($combiner);
} else {
    include_stylesheets();
}
?>
</head>
<body>
  <?php 
echo $sf_content;
?>
</body>
</html>
コード例 #4
0
<?php

include dirname(__FILE__) . '/../bootstrap/unit.php';
include dirname(__FILE__) . '/../../apps/client/lib/combineFiles.class.php';
include dirname(__FILE__) . '/../mock/sfWebResponseMock.class.php';
include dirname(__FILE__) . '/../../apps/client/lib/StreemeUtil.class.php';
// Initialize the test object
$t = new lime_test(6, new lime_output_color());
$combiner = new combineFiles();
$t->comment('->combine()');
// force the asset cache to regenerate
$_GET['clearassetcache'] = 1;
$t->comment('Javascripts');
$js_location = $combiner->combine('js', 'testnamespace', new sfWebResponseMock(new sfEventDispatcher()));
$t->is($js_location, '/service/combine/js/testnamespace', 'File stored correctly');
$t->comment('Stylesheets');
$css_location = $combiner->combine('css', 'testnamespace', new sfWebResponseMock(new sfEventDispatcher()));
$t->is($css_location, '/service/combine/css/testnamespace', 'File stored correctly');
$t->comment('->getFileName()');
$t->comment('Javascripts');
$js_filename = $combiner->getFileName('js', 'testnamespace');
$t->is($js_filename, sfConfig::get('sf_cache_dir') . '/combine/js/testnamespace.js', 'File retrieved correctly');
$js_content_expected = file_get_contents(sfConfig::get('sf_test_dir') . '/files/testnamespaceexample.js');
$js_content = file_get_contents($js_filename);
$t->is($js_content, $js_content_expected, 'File was minified as expected');
$t->comment('Stylesheets');
$css_filename = $combiner->getFileName('css', 'testnamespace');
$t->is($css_filename, sfConfig::get('sf_cache_dir') . '/combine/css/testnamespace.css', 'File retrieved correctly');
$css_content_expected = file_get_contents(sfConfig::get('sf_test_dir') . '/files/testnamespaceexample.css');
$css_content = file_get_contents($css_filename);
$t->is($css_content, $css_content_expected, 'File was minified as expected');