本文整理汇总了PHP中stylesheet_path函数的典型用法代码示例。如果您正苦于以下问题:PHP stylesheet_path函数的具体用法?PHP stylesheet_path怎么用?PHP stylesheet_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stylesheet_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toHTML
/**
* Returns the rich text editor as HTML.
*
* @return string Rich text editor HTML representation
*/
public function toHTML()
{
$options = $this->options;
// we need to know the id for things the rich text editor
// in advance of building the tag
$id = _get_option($options, 'id', $this->name);
// use tinymce's gzipped js?
$tinymce_file = _get_option($options, 'tinymce_gzip') ? '/tiny_mce_gzip.php' : '/tiny_mce.js';
// tinymce installed?
// $js_path = sfConfig::get('sf_rich_text_js_dir') ? '/'.sfConfig::get('sf_rich_text_js_dir').$tinymce_file : '/sf/tinymce/js'.$tinymce_file;
$js_path = sfConfig::get('sf_rich_text_js_dir') ? '/' . sfConfig::get('sf_rich_text_js_dir') . $tinymce_file : '/sf/tinymce/js' . $tinymce_file;
if (!is_readable(sfConfig::get('sf_web_dir') . $js_path)) {
throw new sfConfigurationException('You must install TinyMCE to use this helper (see rich_text_js_dir settings).');
}
sfContext::getInstance()->getResponse()->addJavascript($js_path);
use_helper('Javascript');
$tinymce_options = '';
$style_selector = '';
// custom CSS file?
if ($css_file = _get_option($options, 'css')) {
$css_path = stylesheet_path($css_file);
sfContext::getInstance()->getResponse()->addStylesheet($css_path);
$css = file_get_contents(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $css_path);
$styles = array();
preg_match_all('#^/\\*\\s*user:\\s*(.+?)\\s*\\*/\\s*\\015?\\012\\s*\\.([^\\s]+)#Smi', $css, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$styles[] = $match[1] . '=' . $match[2];
}
$tinymce_options .= ' content_css: "' . $css_path . '",' . "\n";
$tinymce_options .= ' theme_advanced_styles: "' . implode(';', $styles) . '"' . "\n";
$style_selector = 'styleselect,separator,';
}
$culture = sfContext::getInstance()->getUser()->getCulture();
$tinymce_js = '
tinyMCE.init({
mode: "exact",
language: "' . strtolower(substr($culture, 0, 2)) . '",
elements: "' . $id . '",
plugins: "table,advimage,advlink,flash",
theme: "advanced",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_path_location: "bottom",
theme_advanced_buttons1: "' . $style_selector . 'justifyleft,justifycenter,justifyright,justifyfull,separator,bold,italic,strikethrough,separator,sub,sup,separator,charmap",
theme_advanced_buttons2: "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,image,flash,separator,cleanup,removeformat,separator,code",
theme_advanced_buttons3: "tablecontrols",
extended_valid_elements: "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
relative_urls: false,
debug: false
' . ($tinymce_options ? ',' . $tinymce_options : '') . '
' . (isset($options['tinymce_options']) ? ',' . $options['tinymce_options'] : '') . '
});';
if (isset($options['tinymce_options'])) {
unset($options['tinymce_options']);
}
return content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')) . content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => get_id_from_name($id, null)), _convert_options($options)));
}
示例2: stylesheet_link_tag
function stylesheet_link_tag($sources, $options = array())
{
if (!is_array($sources)) {
$sources = array($sources);
}
$html = '';
foreach ($sources as $source) {
$options = array_merge(array('rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen'), $options);
$options['href'] = stylesheet_path($source);
$html .= tag('link', $options) . "\n";
}
return $html;
}
示例3: printJavascript
public function printJavascript()
{
$this->addScriptContent("\n \$('#ohrmTreeViewComponent_Tree').treeview({\n collapsed: false,\n control:'#ohrmTreeViewComponent_TreeController',\n persist: 'location'\n });\n\n \$('#ohrmTreeViewComponent_Tree *').css('list-style', 'none'); // TODO: Move this to a stylesheet. Make sure to test in IE\n\n \$('a[id^=\"treeLink_edit_\"]').click(function() {\n loadNode(parseInt(\$(this).attr('id').replace('treeLink_edit_', '')));\n _clearMessage();\n });\n\n \$('a[id^=\"treeLink_addChild_\"]').click(function() {\n addChildToNode(parseInt(\$(this).attr('id').replace('treeLink_addChild_', '')));\n });\n\n \$('a[id^=\"treeLink_delete_\"]').click(function() {\n deleteNode(parseInt(\$(this).attr('id').replace('treeLink_delete_', '')));\n });\n\n clearForm();\n");
$this->addScriptFunction("\n \$('form[id^=\"ohrmFormComponent_Form\"]').each(function() {\n \$(this).parent().parent().show();\n });\n \$('.requirednotice').show();\n ", 'showForm');
$this->addScriptFunction("\n \$('form[id^=\"ohrmFormComponent_Form\"]').each(function() {\n \$(this).parent().parent().hide();\n });\n \$('.requirednotice').hide();\n ", 'hideForm');
$this->addScriptFunction("\n \$('form[id^=\"ohrmFormComponent_Form\"] :input').filter(':not([type=\"button\"])').val('');\n \$('.idValueLabel').html('');\n \$('#lblParentNotice').remove();\n ", 'clearForm');
$html = '';
$html .= content_tag('script', '', array('type' => 'text/javascript', 'src' => javascript_path('jquery.treeview.min.js')));
if ($this->type == null) {
$html .= tag('link', array('rel' => 'stylesheet', 'href' => stylesheet_path('jquery-treeview/jquery.treeview.css')));
} else {
$html .= tag('link', array('rel' => 'stylesheet', 'href' => stylesheet_path('jquery-treeview/jquery.treeview_1.css')));
}
$this->addScriptContent(array('$(document).ready(function() {', '});'), 'wrap');
$this->addScriptContent($this->getScriptFunctionsString());
$this->addScriptContent(array('//<![CDATA[', '//]]>'), 'wrap');
$html .= content_tag('script', $this->scriptContent, array('type' => 'text/javascript'));
echo $html;
return true;
}
示例4: stylesheet_tag
/**
* Returns a css <link> tag per source given as argument,
* to be included in the <head> section of a HTML document.
*
* <b>Options:</b>
* - rel - defaults to 'stylesheet'
* - type - defaults to 'text/css'
* - media - defaults to 'screen'
*
* <b>Examples:</b>
* <code>
* echo stylesheet_tag('style');
* => <link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />
* echo stylesheet_tag('style', array('media' => 'all'));
* => <link href="/stylesheets/style.css" media="all" rel="stylesheet" type="text/css" />
* echo stylesheet_tag('style', array('raw_name' => true));
* => <link href="style" media="all" rel="stylesheet" type="text/css" />
* echo stylesheet_tag('random.styles', '/css/stylish');
* => <link href="/stylesheets/random.styles" media="screen" rel="stylesheet" type="text/css" />
* <link href="/css/stylish.css" media="screen" rel="stylesheet" type="text/css" />
* </code>
*
* @param string asset names
* @param array additional HTML compliant <link> tag parameters
*
* @return string XHTML compliant <link> tag(s)
* @see stylesheet_path
*/
function stylesheet_tag($source, $options = array())
{
if (!is_array($options)) {
$options = array();
}
$options += array('absolute' => false);
if (empty($options['raw_name'])) {
$source = stylesheet_path($source, $options['absolute']);
}
$tag = tag('link', array_diff_key($options + array('href' => $source, 'media' => 'screen', 'rel' => 'stylesheet', 'type' => 'text/css'), array('absolute' => 'abosolute', 'condition' => 'condition', 'raw_name' => 'raw_name')));
if (isset($options['condition'])) {
$tag = comment_as_conditional($options['condition'], $tag);
}
return $tag . "\n";
}
示例5: stylesheet_link_tag
function stylesheet_link_tag( $sources )
{
$options = ( is_array( $sources[ count( $sources ) - 1 ] ) ? array_pop( $sources ) : array() );
$n_sources = array();
foreach( $sources as $source )
{
$source = stylesheet_path( $source );
array_push( $n_sources, tag( 'link', array_merge( array( 'rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen', 'href' => $source ), $options ) ) );
}
return join( "\n", $n_sources )."\n";
}
示例6: _a_get_assets_body
function _a_get_assets_body($type, $assets)
{
$gzip = sfConfig::get('app_a_minify_gzip', false);
sfConfig::set('symfony.asset.' . $type . '_included', true);
$html = '';
// We need our own copy of the trivial case here because we rewrote the asset list
// for stylesheets after LESS compilation, and there is no way to
// reset the list in the response object
if (!sfConfig::get('app_a_minify', false)) {
// This branch is seen only for CSS, because javascript calls the original Symfony
// functionality when minify is off
foreach ($assets as $file => $options) {
$html .= stylesheet_tag($file, $options);
}
return $html;
}
$sets = array();
foreach ($assets as $file => $options) {
if (preg_match('/^http(s)?:/', $file) || isset($options['data-minify']) && $options['data-minify'] === 0) {
// Nonlocal URL or minify was explicitly shut off.
// Don't get cute with it, otherwise things
// like Addthis and ckeditor don't work
if ($type === 'stylesheets') {
$html .= stylesheet_tag($file, $options);
} else {
$html .= javascript_include_tag($file, $options);
}
continue;
}
/*
*
* Guts borrowed from stylesheet_tag and javascript_tag. We still do a tag if it's
* a conditional stylesheet
*
*/
$absolute = false;
if (isset($options['absolute']) && $options['absolute']) {
unset($options['absolute']);
$absolute = true;
}
$condition = null;
if (isset($options['condition'])) {
$condition = $options['condition'];
unset($options['condition']);
}
if (!isset($options['raw_name'])) {
if ($type === 'stylesheets') {
$file = stylesheet_path($file, $absolute);
} else {
$file = javascript_path($file, $absolute);
}
} else {
unset($options['raw_name']);
}
if (is_null($options)) {
$options = array();
}
if ($type === 'stylesheets') {
$options = array_merge(array('rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'screen', 'href' => $file), $options);
} else {
$options = array_merge(array('type' => 'text/javascript', 'src' => $file), $options);
}
if (null !== $condition) {
$tag = tag('link', $options);
$tag = comment_as_conditional($condition, $tag);
$html .= $tag . "\n";
} else {
unset($options['href'], $options['src']);
$optionGroupKey = json_encode($options);
$set[$optionGroupKey][] = $file;
}
// echo($file);
// $html .= "<style>\n";
// $html .= file_get_contents(sfConfig::get('sf_web_dir') . '/' . $file);
// $html .= "</style>\n";
}
// CSS files with the same options grouped together to be loaded together
foreach ($set as $optionsJson => $files) {
$groupFilename = aAssets::getGroupFilename($files);
$groupFilename .= $type === 'stylesheets' ? '.css' : '.js';
if ($gzip) {
$groupFilename .= 'gz';
}
$dir = aFiles::getUploadFolder(array('asset-cache'));
if (!file_exists($dir . '/' . $groupFilename)) {
$content = '';
foreach ($files as $file) {
$path = null;
if (sfConfig::get('app_a_stylesheet_cache_http', false)) {
$url = sfContext::getRequest()->getUriPrefix() . $file;
$fileContent = file_get_contents($url);
} else {
$path = sfConfig::get('sf_web_dir') . $file;
$fileContent = file_get_contents($path);
}
if ($type === 'stylesheets') {
$options = array();
if (!is_null($path)) {
// Rewrite relative URLs in CSS files.
// This trick is available only when we don't insist on
//.........这里部分代码省略.........
示例7: MyForm
$response = sfContext::getInstance()->getResponse();
$form = new MyForm();
$response->resetAssets();
use_stylesheets_for_form($form);
$t->is_deeply($response->getStylesheets(), array('/path/to/a/foo.css' => array('media' => 'all'), '/path/to/a/bar.css' => array('media' => 'print')), 'use_stylesheets_for_form() adds stylesheets to the response');
$response->resetAssets();
use_javascripts_for_form($form);
$t->is_deeply($response->getJavaScripts(), array('/path/to/a/foo.js' => array(), '/path/to/a/bar.js' => array()), 'use_javascripts_for_form() adds javascripts to the response');
// custom web paths
$t->diag('Custom asset path handling');
sfConfig::set('sf_web_js_dir_name', 'static/js');
$t->is(javascript_path('xmlhr'), '/static/js/xmlhr.js', 'javascript_path() decorates a relative filename with js dir name and extension with custom js dir');
$t->is(javascript_include_tag('xmlhr'),
'<script type="text/javascript" src="/static/js/xmlhr.js"></script>'."\n",
'javascript_include_tag() takes a javascript name as its first argument');
sfConfig::set('sf_web_css_dir_name', 'static/css');
$t->is(stylesheet_path('style'), '/static/css/style.css', 'stylesheet_path() decorates a relative filename with css dir name and extension with custom css dir');
$t->is(stylesheet_tag('style'),
'<link rel="stylesheet" type="text/css" media="screen" href="/static/css/style.css" />'."\n",
'stylesheet_tag() takes a stylesheet name as its first argument');
sfConfig::set('sf_web_images_dir_name', 'static/img');
$t->is(image_path('img'), '/static/img/img.png', 'image_path() decorates a relative filename with images dir name and png extension with custom images dir');
$t->is(image_tag('test'), '<img src="/static/img/test.png" />', 'image_tag() takes an image name as its first argument');
示例8: stylesheet
function stylesheet($file, $options = null)
{
$file = stylesheet_path($file);
$options = html_parse_params($options);
return '<link href="' . $file . '" rel="stylesheet" type="text/css"' . $options . ' />';
}
示例9: sympal_use_jquery
<?php
sympal_use_jquery();
?>
<script type="text/javascript" src="<?php
echo javascript_path('/sfSympalEditorPlugin/js/links.js');
?>
"></script>
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo stylesheet_path('/sfSympalEditorPlugin/css/links.css');
?>
" />
<div id="sympal_links_container">
<h1><?php
echo __('Link Browser');
?>
</h1>
<p>
<?php
echo __('Browse your content below and insert links into the currently focused editor by ' . 'just clicking the page you want to link to.');
?>
<?php
echo __('You can control where the link is inserted by positioning the cursor in the editor.');
?>
</p>
<div id="content_types">
<h2><?php
echo __('Content Types');
示例10: _configureStylist
protected function _configureStylist() {
$cssArray = sfContext::getInstance()->getResponse()->getStylesheets();
$cssArray = $this->getOption('css_files')? array_merge($cssArray, $this->getOption('css_files')): $cssArray;
foreach ($cssArray as $file => $options) {
$this->_additionalConfig .= 'xinha_config.stylistLoadStylesheet("'.stylesheet_path($file).'");'."\n";
}
}
开发者ID:rmed19,项目名称:sfWidgetFormTextareaXinha.class.php,代码行数:7,代码来源:sfWidgetFormTextareaXinha.class.php
示例11: array
$t->is(javascript_include_tag('xmlhr', array('absolute' => true)), '<script type="text/javascript" src="http://localhost/js/xmlhr.js"></script>' . "\n", 'javascript_include_tag() can take an absolute option to output an absolute file name');
$t->is(javascript_include_tag('xmlhr', array('raw_name' => true)), '<script type="text/javascript" src="xmlhr"></script>' . "\n", 'javascript_include_tag() can take a raw_name option to bypass file name decoration');
$t->is(javascript_include_tag('xmlhr', array('defer' => 'defer')), '<script type="text/javascript" src="/js/xmlhr.js" defer="defer"></script>' . "\n", 'javascript_include_tag() can take additional html options like defer');
$t->is(javascript_include_tag('xmlhr', array('condition' => 'IE 6')), '<!--[if IE 6]><script type="text/javascript" src="/js/xmlhr.js"></script><![endif]-->' . "\n", 'javascript_include_tag() can take a condition option');
// javascript_path()
$t->diag('javascript_path()');
$t->is(javascript_path('xmlhr'), '/js/xmlhr.js', 'javascript_path() decorates a relative filename with js dir name and extension');
$t->is(javascript_path('/xmlhr'), '/xmlhr.js', 'javascript_path() does not decorate absolute file names with js dir name');
$t->is(javascript_path('xmlhr.foo'), '/js/xmlhr.foo', 'javascript_path() does not decorate file names with extension with .js');
$t->is(javascript_path('xmlhr.foo', true), 'http://localhost/js/xmlhr.foo', 'javascript_path() accepts a second parameter to output an absolute resource path');
// stylesheet_path()
$t->diag('stylesheet_path()');
$t->is(stylesheet_path('style'), '/css/style.css', 'stylesheet_path() decorates a relative filename with css dir name and extension');
$t->is(stylesheet_path('/style'), '/style.css', 'stylesheet_path() does not decorate absolute file names with css dir name');
$t->is(stylesheet_path('style.foo'), '/css/style.foo', 'stylesheet_path() does not decorate file names with extension with .css');
$t->is(stylesheet_path('style.foo', true), 'http://localhost/css/style.foo', 'stylesheet_path() accepts a second parameter to output an absolute resource path');
// image_path()
$t->diag('image_path()');
$t->is(image_path('img'), '/images/img.png', 'image_path() decorates a relative filename with images dir name and png extension');
$t->is(image_path('/img'), '/img.png', 'image_path() does not decorate absolute file names with images dir name');
$t->is(image_path('img.jpg'), '/images/img.jpg', 'image_path() does not decorate file names with extension with .png');
$t->is(image_path('img.jpg', true), 'http://localhost/images/img.jpg', 'image_path() accepts a second parameter to output an absolute resource path');
// use_javascript() get_javascripts()
$t->diag('use_javascript() get_javascripts()');
use_javascript('xmlhr');
$t->is(get_javascripts(), '<script type="text/javascript" src="/js/xmlhr.js"></script>' . "\n", 'get_javascripts() returns a javascript previously added by use_javascript()');
use_javascript('xmlhr', '', array('raw_name' => true));
$t->is(get_javascripts(), '<script type="text/javascript" src="xmlhr"></script>' . "\n", 'use_javascript() accepts an array of options as a third parameter');
use_javascript('xmlhr', '', array('absolute' => true));
$t->is(get_javascripts(), '<script type="text/javascript" src="http://localhost/js/xmlhr.js"></script>' . "\n", 'use_javascript() accepts an array of options as a third parameter');
use_javascript('xmlhr');
示例12: javascript_path
<script type="text/javascript" src="<?php
echo javascript_path(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/js/links.js'));
?>
"></script>
<link rel="stylesheet" type="text/css" media="screen" href="<?php
echo stylesheet_path(sfSympalConfig::getAssetPath('/sfSympalEditorPlugin/css/links.css'));
?>
" />
<div id="sympal_links_container">
<h1><?php
echo __('Link Browser');
?>
</h1>
<p>
<?php
echo __('Browse your content below and insert links into the currently focused editor by ' . 'just clicking the page you want to link to.');
?>
<?php
echo __('You can control where the link is inserted by positioning the cursor in the editor.');
?>
</p>
<div id="content_types">
<h2><?php
echo __('Content Types');
?>
</h2>
<ul>
<?php
示例13: stylesheet_path
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="<?php
echo stylesheet_path('../sfSqlDesignerPlugin/css/style');
?>
" media="all" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" href="<?php
echo stylesheet_path('../sfSqlDesignerPlugin/css/ie6');
?>
" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" href="<?php
echo stylesheet_path('../sfSqlDesignerPlugin/css/ie7');
?>
" /><![endif]-->
<link rel="stylesheet" href="<?php
echo stylesheet_path('../sfSqlDesignerPlugin/css/print');
?>
" type="text/css" media="print" />
<script type="text/javascript" src="<?php
echo javascript_path('../sfSqlDesignerPlugin/js/oz');
?>
"></script>
<script type="text/javascript" src="<?php
echo javascript_path('../sfSqlDesignerPlugin/js/config');
?>
"></script>
<script type="text/javascript" src="<?php
echo javascript_path('../sfSqlDesignerPlugin/js/wwwsqldesigner');
?>
"></script>
<script type="text/javascript" src="<?php
示例14: 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;
}
示例15: getAssetPath
protected function getAssetPath($file)
{
sfProjectConfiguration::getActive()->loadHelpers('Asset');
return stylesheet_path($file);
}