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


PHP sfWebResponse::addStylesheet方法代码示例

本文整理汇总了PHP中sfWebResponse::addStylesheet方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebResponse::addStylesheet方法的具体用法?PHP sfWebResponse::addStylesheet怎么用?PHP sfWebResponse::addStylesheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfWebResponse的用法示例。


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

示例1: addAssets

 public static function addAssets(sfWebResponse $response)
 {
     $response->addStylesheet('yui/treeview/assets/skins/qubit/treeview-skin', 'first');
     $response->addJavaScript('/vendor/yui/treeview/treeview-min', 'last');
     $response->addJavaScript('/vendor/yui/dragdrop/dragdrop-min', 'last');
     $response->addJavaScript('treeView', 'last');
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:7,代码来源:QubitTreeView.class.php

示例2: addAssets

 public static function addAssets(sfWebResponse $response)
 {
     if (sfConfig::get('app_show_tooltips')) {
         $response->addJavaScript('description');
     } else {
         $response->addStylesheet('hide_tooltips');
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:8,代码来源:QubitDescription.class.php

示例3: prepareAssetsForNativeApp

 protected function prepareAssetsForNativeApp(sfWebRequest $request, sfWebResponse $response, $buildSettings)
 {
     $this->isInitialRequest = !$request->isXmlHttpRequest();
     foreach ($buildSettings['javascripts'] as $file) {
         list($filename, $position) = $this->extractFilenameAndPositionForAssetResource($file);
         if ($this->isInitialRequest) {
             $response->addJavascript($filename, $position);
         } else {
             $response->removeJavascript($filename, $position);
         }
     }
     foreach ($buildSettings['stylesheets'] as $file) {
         list($filename, $position) = $this->extractFilenameAndPositionForAssetResource($file);
         if ($this->isInitialRequest) {
             $response->addStylesheet($filename, $position);
         } else {
             $response->removeStylesheet($filename, $position);
         }
     }
     $excludeStylesheets = $buildSettings['excludeStylesheets'];
     foreach ($excludeStylesheets as $assetResource) {
         list($filename, $position) = $this->extractFilenameAndPositionForAssetResource($assetResource);
         $response->removeStylesheet($filename, $position);
     }
     $excludeJavascripts = $buildSettings['excludeJavascripts'];
     foreach ($excludeJavascripts as $assetResource) {
         list($filename, $position) = $this->extractFilenameAndPositionForAssetResource($assetResource);
         $response->removeJavascript($filename, $position);
     }
     $context = $this->getContext();
     if (method_exists($context, 'getConfiguration') && method_exists($context->getConfiguration(), 'loadHelpers')) {
         $context->getConfiguration()->loadHelpers('Asset');
     } else {
         if (method_exists('sfLoader', 'loadHelpers')) {
             sfLoader::loadHelpers('Asset');
             //compatibility with symfony 1.0:
         }
     }
     sfConfig::set('symfony.asset.stylesheets_included', true);
     sfConfig::set('symfony.asset.javascripts_included', true);
     $css = '';
     $js = '';
     foreach (array('first', '', 'last') as $position) {
         $stylesheets = $response->getStylesheets($position);
         if (!empty($stylesheets)) {
             $css .= "\n/* position: {$position} */\n";
             $css .= $this->getCombinedAssetsAsString($stylesheets, 'stylesheet_path');
         }
         $javascripts = $response->getJavascripts($position);
         if (!empty($javascripts)) {
             $jsCurrent = $this->getCombinedAssetsAsString($javascripts, 'javascript_path');
             $jsCurrent = str_replace(array("'<script>", "</script>'"), array("'<scr'+'ipt>", "</scr'+'ipt>'"), $jsCurrent);
             //hack to avoid breaking code in jQuery mobile: domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' );
             $js .= "\n/* position: {$position} */\n";
             $js .= $jsCurrent;
         }
     }
     if ($this->isInitialRequest) {
         //embed everything directly into main file
         $css = $this->base64EncodeImages($css);
         $this->cssContent = $css;
         $this->jsContent = $js;
         $this->jsContent2 = 'test';
     } else {
         $this->cssSrc = $this->getContentAsFileSrc($css, 'css');
         if (!$this->cssSrc) {
             $this->cssContent = $css;
         }
         //		    $this->jsSrc = $this->getContentAsFileSrc($js, 'js');
         //		    if (!$this->jsSrc) {
         //		    	$this->jsContent = $js;
         //		    }
         $this->jsContent = $js;
         //we have to load javascripts inline because iOs Safari loads external javascripts asynchronesly and thus we could nomore rely on events like pagecreate, pageshow, pagehide dom.ready etc
     }
 }
开发者ID:muliadi,项目名称:jfportabledevice,代码行数:76,代码来源:BasejfPortableDeviceComponents.class.php

示例4: addAssets

 public static function addAssets(sfWebResponse $response)
 {
     $response->addStylesheet('/vendor/imageflow/imageflow.packed.css', 'first');
     $response->addJavaScript('/vendor/imageflow/imageflow.packed.js', 'last');
     $response->addJavaScript('imageflow', 'last');
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:6,代码来源:QubitImageFlow.class.php

示例5: replaceStylesheets

 /**
  * Replaces response original stylesheets by optimized ones (only if stylesheet 
  * optimization has been enabled by configuration)
  *
  * @param  sfWebresponse  $response
  */
 public function replaceStylesheets(sfWebResponse $response)
 {
     if (is_null($stylesheetOptimizer = $this->getOptimizer('stylesheet'))) {
         return;
     }
     foreach ($stylesheetOptimizer->getAssetFiles() as $file) {
         $response->removeStylesheet($file);
     }
     $response->addStylesheet($stylesheetOptimizer->getOptimizedFileWebPath(), 'first');
 }
开发者ID:pycmam,项目名称:npAssetsOptimizerPlugin,代码行数:16,代码来源:npAssetsOptimizerService.class.php

示例6: catch

    $t->pass('optimizeJavascripts() can optimize js files');
} catch (RuntimeException $e) {
    $t->fail('optimizeJavascripts() can optimize js files');
}
// optimizeStylesheets()
$t->diag('optimizeStylesheets()');
$service = new npAssetsOptimizerService($dispatcher, array('stylesheet' => array('enabled' => true, 'class' => 'npOptimizerStylesheet', 'params' => array('destination' => '/css/my_optimized.css', 'files' => array('foo.css')))), $baseAssetsDir);
try {
    $service->optimizeStylesheets();
    $t->pass('optimizeStylesheets() can optimize css files');
} catch (RuntimeException $e) {
    $t->fail('optimizeStylesheets() can optimize css files');
}
// replaceJavascripts()
$t->diag('replaceJavascripts()');
$service = new npAssetsOptimizerService($dispatcher, array('javascript' => array('enabled' => true, 'class' => 'npOptimizerJavascript', 'params' => array('destination' => '/js/my_optimized.js', 'files' => array('foo.js')))), $baseAssetsDir);
$response = new sfWebResponse($dispatcher, array());
$response->addJavascript('foo.js');
$service->replaceJavascripts($response);
$responseJS = array_keys($response->getJavascripts());
$t->is(count($responseJS), 1, 'replaceJavascripts() replaced javascripts');
$t->is($responseJS[0], '/js/my_optimized.js', 'replaceJavascripts() replaced javascripts');
// replaceStylesheets()
$t->diag('replaceStylesheets()');
$service = new npAssetsOptimizerService($dispatcher, array('stylesheet' => array('enabled' => true, 'class' => 'npOptimizerStylesheet', 'params' => array('destination' => '/css/my_optimized.css', 'files' => array('foo.css')))), $baseAssetsDir);
$response = new sfWebResponse($dispatcher, array());
$response->addStylesheet('foo.css');
$service->replaceStylesheets($response);
$responseCSS = array_keys($response->getStylesheets());
$t->is(count($responseCSS), 1, 'replaceStylesheets() replaced stylesheets');
$t->is($responseCSS[0], '/css/my_optimized.css', 'replaceStylesheets() replaced stylesheets');
开发者ID:n1k0,项目名称:npAssetsOptimizerPlugin,代码行数:31,代码来源:npAssetsOptimizerServiceTest.php


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