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


PHP get_stylesheets函数代码示例

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


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

示例1: get_less_stylesheets

/**
 * Returns <link> tags for all stylesheets configured in view.yml or added to the response object.
 *
 * You can use this helper to decide the location of stylesheets in pages.
 * By default, if you don't call this helper, symfony will automatically include stylesheets before </head>.
 * Calling this helper disables this behavior.
 *
 * @return string <link> tags
 */
function get_less_stylesheets()
{
    $response = sfContext::getInstance()->getResponse();
    $dispatcher = sfContext::getInstance()->getEventDispatcher();
    $dispatcher->notify(new sfEvent($response, 'less_js.compile'));
    return get_stylesheets();
}
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:16,代码来源:LESSHelper.php

示例2: get_combined_stylesheets

/**
 * Returns <link> tags with the url toward all stylesheets configured in view.yml or added to the response object.
 *
 * You can use this helper to decide the location of stylesheets in pages.
 * By default, if you don't call this helper, symfony will automatically include stylesheets before </head>.
 * Calling this helper disables this behavior.
 *
 * @return string <link> tags
 */
function get_combined_stylesheets()
{
    if (!sfConfig::get('app_sfCombinePlugin_enabled', false)) {
        return get_stylesheets();
    }
    $response = sfContext::getInstance()->getResponse();
    sfConfig::set('symfony.asset.stylesheets_included', true);
    $configSfCombinePlugin['css'] = sfConfig::get('app_sfCombinePlugin_css', array());
    $html = '';
    $cssFiles = $include_tags = array();
    foreach (array('first', '', 'last') as $position) {
        foreach ($response->getStylesheets($position) as $files => $options) {
            if (!in_array($files, $configSfCombinePlugin['css']['online']) && !in_array($files, $configSfCombinePlugin['css']['offline'])) {
                if (!is_array($files)) {
                    $files = array($files);
                }
                $cssFiles = array_merge($cssFiles, $files);
            } else {
                $include_tags[] = stylesheet_tag(url_for($files));
            }
        }
    }
    $key = _get_key($cssFiles);
    $include_tags[] = str_replace('.css', '', stylesheet_tag(url_for('sfCombine/css?key=' . $key)));
    return implode("", $include_tags);
}
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:35,代码来源:sfCombineHelper.php

示例3: execute

  /**
   * Executes this filter.
   *
   * @param sfFilterChain $filterChain A sfFilterChain instance
   */
  public function execute($filterChain)
  {
    // execute next filter
    $filterChain->execute();

    // execute this filter only once
    $response = $this->context->getResponse();

    // include javascripts and stylesheets
    $content = $response->getContent();
    if (false !== ($pos = strpos($content, '</head>')))
    {
      $this->context->getConfiguration()->loadHelpers(array('Tag', 'Asset'));
      $html = '';
      if (!sfConfig::get('symfony.asset.javascripts_included', false))
      {
        $html .= get_javascripts($response);
      }
      if (!sfConfig::get('symfony.asset.stylesheets_included', false))
      {
        $html .= get_stylesheets($response);
      }

      if ($html)
      {
        $response->setContent(substr($content, 0, $pos).$html.substr($content, $pos));
      }
    }

    sfConfig::set('symfony.asset.javascripts_included', false);
    sfConfig::set('symfony.asset.stylesheets_included', false);
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:37,代码来源:sfCommonFilter.class.php

示例4: stylesheet_assets

/**
 * Retrieves the stylesheets tags from the response or the tmp css tag 
 * @return string
 */
function stylesheet_assets()
{
    sfContext::getInstance()->getConfiguration()->loadHelpers('Asset');
    // Update response after it gets totally loaded
    if (sfConfig::get('app_sf_assets_manager_plugin_alter_response', false)) {
        return sfConfig::get('app_sf_assets_manager_plugin_alter_response_tempcsstag');
    } else {
        return get_stylesheets();
    }
}
开发者ID:vinyll,项目名称:sfAssetsManagerPlugin,代码行数:14,代码来源:sfAssetsManagerHelper.php

示例5: get_combined_stylesheets

/**
 * Returns <link> tags with the url toward all stylesheets configured in view.yml or added to the response object.
 *
 * You can use this helper to decide the location of stylesheets in pages.
 * By default, if you don't call this helper, symfony will automatically include stylesheets before </head>.
 * Calling this helper disables this behavior.
 *
 * @return string <link> tags
 */
function get_combined_stylesheets()
{
    if (!sfConfig::get('app_sfCombinePlugin_enabled', false)) {
        return get_stylesheets();
    }
    sfConfig::set('symfony.asset.stylesheets_included', true);
    $html = '';
    $cssFiles = array();
    $response = sfContext::getInstance()->getResponse();
    foreach ($response->getStylesheets() as $files => $options) {
        if (!is_array($files)) {
            $files = array($files);
        }
        $cssFiles = array_merge($cssFiles, $files);
    }
    if (!empty($cssFiles)) {
        $html .= str_replace(array('.css', '.pcss'), '', stylesheet_tag(url_for('sfCombine/css?key=' . _get_key($cssFiles))));
    }
    return $html;
}
开发者ID:robinkanters,项目名称:dnsleergemeenschap,代码行数:29,代码来源:sfCombineHelper.php

示例6: execute

 /**
  * Executes this filter.
  *
  * @param sfFilterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     // execute next filter
     $filterChain->execute();
     // execute this filter only once
     $response = $this->getContext()->getResponse();
     // include javascripts and stylesheets
     $content = $response->getContent();
     if (false !== ($pos = strpos($content, '</head>'))) {
         sfLoader::loadHelpers(array('Tag', 'Asset'));
         $html = '';
         if (!$response->getParameter('javascripts_included', false, 'symfony/view/asset')) {
             $html .= get_javascripts($response);
         }
         if (!$response->getParameter('stylesheets_included', false, 'symfony/view/asset')) {
             $html .= get_stylesheets($response);
         }
         if ($html) {
             $response->setContent(substr($content, 0, $pos) . $html . substr($content, $pos));
         }
     }
     $response->setParameter('javascripts_included', false, 'symfony/view/asset');
     $response->setParameter('stylesheets_included', false, 'symfony/view/asset');
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:29,代码来源:sfCommonFilter.class.php

示例7: include_stylesheets

/**
 * Prints <link> tags for all stylesheets configured in view.yml or added to the response object.
 *
 * @see get_stylesheets()
 */
function include_stylesheets()
{
    echo get_stylesheets();
}
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:9,代码来源:AssetHelper.php

示例8: array

$t->is(dynamic_javascript_include_tag('module/action', true, array('class' => 'foo')), '<script type="text/javascript" src="/module/action?sf_format=js" class="foo"></script>'."\n", 'dynamic_javascript_include_tag() takes an array of HTML attributes as its third argument');

$context->response = new myResponse($context->getEventDispatcher());

// use_dynamic_javascript()
$t->diag('use_dynamic_javascript()');
use_dynamic_javascript('module/action');
$t->is(get_javascripts(),
  '<script type="text/javascript" src="module/action?sf_format=js"></script>'."\n",
  'use_dynamic_javascript() register a dynamic javascript in the response'
);

// use_dynamic_stylesheet()
$t->diag('use_dynamic_stylesheet()');
use_dynamic_stylesheet('module/action');
$t->is(get_stylesheets(),
  '<link rel="stylesheet" type="text/css" media="screen" href="module/action?sf_format=css" />'."\n",
  'use_dynamic_stylesheet() register a dynamic stylesheet in the response'
);

class MyForm extends sfForm
{
  public function getStylesheets()
  {
    return array('/path/to/a/foo.css' => 'all', '/path/to/a/bar.css' => 'print');
  }

  public function getJavaScripts()
  {
    return array('/path/to/a/foo.js', '/path/to/a/bar.js');
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:31,代码来源:AssetHelperTest.php

示例9: array

$t->is(_dynamic_path('module/action?key=value', 'js'), 'module/action?key=value&sf_format=js', '_dynamic_path() converts an internal URI to a URL');
$t->is(_dynamic_path('module/action', 'js', true), '/module/action?sf_format=js', '_dynamic_path() converts an internal URI to a URL');
// dynamic_javascript_include_tag()
$t->diag('dynamic_javascript_include_tag()');
$t->is(dynamic_javascript_include_tag('module/action'), '<script type="text/javascript" src="module/action?sf_format=js"></script>' . "\n", 'dynamic_javascript_include_tag() returns a tag relative to the given action');
$t->is(dynamic_javascript_include_tag('module/action', true), '<script type="text/javascript" src="/module/action?sf_format=js"></script>' . "\n", 'dynamic_javascript_include_tag() takes an absolute boolean as its second argument');
$t->is(dynamic_javascript_include_tag('module/action', true, array('class' => 'foo')), '<script type="text/javascript" src="/module/action?sf_format=js" class="foo"></script>' . "\n", 'dynamic_javascript_include_tag() takes an array of HTML attributes as its third argument');
$context->response = new myResponse($context->getEventDispatcher());
// use_dynamic_javascript()
$t->diag('use_dynamic_javascript()');
use_dynamic_javascript('module/action');
$t->is(get_javascripts(), '<script type="text/javascript" src="module/action?sf_format=js"></script>' . "\n", 'use_dynamic_javascript() register a dynamic javascript in the response');
// use_dynamic_stylesheet()
$t->diag('use_dynamic_stylesheet()');
use_dynamic_stylesheet('module/action');
$t->is(get_stylesheets(), '<link rel="stylesheet" type="text/css" media="screen" href="module/action?sf_format=css" />' . "\n", 'use_dynamic_stylesheet() register a dynamic stylesheet in the response');
class MyForm extends sfForm
{
    public function getStylesheets()
    {
        return array('/path/to/a/foo.css' => 'all', '/path/to/a/bar.css' => 'print');
    }
    public function getJavaScripts()
    {
        return array('/path/to/a/foo.js', '/path/to/a/bar.js');
    }
}
// get_javascripts_for_form() get_stylesheets_for_form()
$t->diag('get_javascripts_for_form() get_stylesheets_for_form()');
$form = new MyForm();
$output = <<<EOF
开发者ID:sensorsix,项目名称:app,代码行数:31,代码来源:AssetHelperTest.php

示例10: use_stylesheet

    <?php 
use_stylesheet('../smintplayer/css/custom.css');
?>
	<?php 
use_javascript('../smintplayer/js/smintplayer.js');
?>
	<?php 
use_javascript('../smintplayer/js/slider.js');
?>
	<?php 
use_javascript('../smintplayer/js/jquery.ui.touch-punch.min.js');
?>

<!-- css should be before js for performance reasons -->
    <?php 
echo get_stylesheets();
?>

<!-- other js : should be at the end of all use_javascript calls -->
    <?php 
echo get_javascripts();
?>
    
    
   
    <link rel="icon" type="image/png" href="<?php 
echo image_path("favicon.png");
?>
" />

开发者ID:EQ4,项目名称:smint,代码行数:29,代码来源:layout.php

示例11: get_combined_stylesheets

/**
 * @see get_combined_javascripts
 */
function get_combined_stylesheets($groups = null, $groupType = sfCombinePlusManager::GROUP_INCLUDE, $onlyUnusedGroups = true, $markGroupsUsed = true)
{
    if (!sfConfig::get('app_sfCombinePlusPlugin_enabled', false)) {
        return get_stylesheets();
    }
    $manager = sfCombinePlusManager::getCssManager();
    sfConfig::set('symfony.asset.stylesheets_included', true);
    $response = sfContext::getInstance()->getResponse();
    $config = sfConfig::get('app_sfCombinePlusPlugin_css', array());
    $doNotCombine = isset($config['combine_skip']) ? $config['combine_skip'] : array();
    $manager->setSkips(array_merge($manager->getSkips(), $doNotCombine));
    $groupedFiles = $manager->getAssetsByGroup($response->getStylesheets(), $config['combine'], $groups, $groupType, $onlyUnusedGroups, $markGroupsUsed);
    $html = '';
    foreach ($groupedFiles as $fileDetails) {
        if (!$fileDetails['combinable']) {
            $html .= stylesheet_tag(stylesheet_path($fileDetails['files']), $fileDetails['options']);
        } else {
            $route = isset($config['route']) ? $config['route'] : 'sfCombinePlus';
            $html .= stylesheet_tag(url_for('@' . $route . '?module=sfCombinePlus&action=js&' . sfCombinePlusUrl::getUrlString($fileDetails['files'])), $fileDetails['options']);
        }
    }
    return $html;
}
开发者ID:kevindew,项目名称:sfCombinePlusPlugin,代码行数:26,代码来源:sfCombinePlusHelper.php


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