本文整理汇总了PHP中Stylesheet类的典型用法代码示例。如果您正苦于以下问题:PHP Stylesheet类的具体用法?PHP Stylesheet怎么用?PHP Stylesheet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stylesheet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newResponse
/**
* Creates a new response object
*
* @return scriptlet.xml.XMLScriptletResponse
*/
protected function newResponse(Stylesheet $stylesheet)
{
$res = new XMLScriptletResponse();
$res->setProcessor(new DOMXSLProcessor());
$stylesheet->addParam('__state');
$stylesheet->addParam('__page');
$stylesheet->addParam('__lang');
$stylesheet->addParam('__product');
$stylesheet->addParam('__sess');
$stylesheet->addParam('__query');
$res->setStylesheet($stylesheet, XSLT_TREE);
return $res;
}
示例2: list
if (strpos($ruri, '?') === false) {
$params = '';
$path = $ruri;
} else {
list($path, $params) = preg_split('/\\?/', $ruri, 2);
}
$special = array('css/icinga.css', 'css/icinga.min.css', 'js/icinga.dev.js', 'js/icinga.ie8.js', 'js/icinga.min.js');
if (in_array($path, $special)) {
include_once __DIR__ . '/EmbeddedWeb.php';
EmbeddedWeb::start();
switch ($path) {
case 'css/icinga.css':
Stylesheet::send();
exit;
case 'css/icinga.min.css':
Stylesheet::send(true);
exit;
case 'js/icinga.dev.js':
JavaScript::send();
exit;
case 'js/icinga.min.js':
JavaScript::sendMinified();
break;
case 'js/icinga.ie8.js':
JavaScript::sendForIe8();
break;
default:
return false;
}
} elseif ($path === 'svg/chart.php') {
if (!array_key_exists('data', $_GET)) {
示例3: lang
$result = $db->Execute($query);
if ($result && $result->RecordCount() > 0) {
$error .= "<li>" . lang('cssalreadyused') . "</li>";
$validinfo = false;
}
}
# now checking the content of the CSS
if ("" == $css_text) {
$error .= "<li>" . lang('nofieldgiven', array(lang('content'))) . "</li>";
$validinfo = false;
}
#******************************************************************************
# everythings seems to be ok, we can try to save the form
#******************************************************************************
if ($validinfo) {
$newstylesheet = new Stylesheet();
$newstylesheet->name = $css_name;
$newstylesheet->value = $css_text;
$types = "";
#generate comma separated list
foreach ($media_type as $onetype) {
$types .= "{$onetype}, ";
}
if ($types != '') {
$types = substr($types, 0, -2);
#strip last space and comma
} else {
$types = '';
}
$newstylesheet->media_type = $types;
Events::SendEvent('Core', 'AddStylesheetPre', array('stylesheet' => &$newstylesheet));
示例4: load
/**
* Minify, combine and load site stylesheet
*/
public static function load()
{
$backend_site_css_path = MINIFY . DS . 'backend_site.minify.css';
$frontend_site_css_path = MINIFY . DS . 'frontend_site.minify.css';
// Load stylesheets
if (count(Stylesheet::$stylesheets) > 0) {
$backend_buffer = '';
$backend_regenerate = false;
$frontend_buffer = '';
$frontend_regenerate = false;
// Sort stylesheets by priority
$stylesheets = Arr::subvalSort(Stylesheet::$stylesheets, 'priority');
if (BACKEND) {
// Build backend site stylesheets
foreach ($stylesheets as $stylesheet) {
if (file_exists(ROOT . DS . $stylesheet['file']) and ($stylesheet['load'] == 'backend' or $stylesheet['load'] == 'both')) {
if (!file_exists($backend_site_css_path) or filemtime(ROOT . DS . $stylesheet['file']) > filemtime($backend_site_css_path)) {
$backend_regenerate = true;
break;
}
}
}
// Regenerate site stylesheet
if ($backend_regenerate) {
foreach ($stylesheets as $stylesheet) {
if (file_exists(ROOT . DS . $stylesheet['file']) and ($stylesheet['load'] == 'backend' or $stylesheet['load'] == 'both')) {
$backend_buffer .= file_get_contents(ROOT . DS . $stylesheet['file']);
}
}
$backend_buffer = Stylesheet::parseVariables($backend_buffer);
file_put_contents($backend_site_css_path, MinifyCSS::process($backend_buffer));
$backend_regenerate = false;
}
} else {
// Build frontend site stylesheets
foreach ($stylesheets as $stylesheet) {
if (file_exists(ROOT . DS . $stylesheet['file']) and ($stylesheet['load'] == 'frontend' or $stylesheet['load'] == 'both')) {
if (!file_exists($frontend_site_css_path) or filemtime(ROOT . DS . $stylesheet['file']) > filemtime($frontend_site_css_path)) {
$frontend_regenerate = true;
break;
}
}
}
// Regenerate site stylesheet
if ($frontend_regenerate) {
foreach ($stylesheets as $stylesheet) {
if (file_exists(ROOT . DS . $stylesheet['file']) and ($stylesheet['load'] == 'frontend' or $stylesheet['load'] == 'both')) {
$frontend_buffer .= file_get_contents(ROOT . DS . $stylesheet['file']);
}
}
$frontend_buffer = Stylesheet::parseVariables($frontend_buffer);
file_put_contents($frontend_site_css_path, MinifyCSS::process($frontend_buffer));
$frontend_regenerate = false;
}
}
// Render
if (BACKEND) {
echo '<link rel="stylesheet" href="' . Option::get('siteurl') . '/tmp/minify/backend_site.minify.css?' . Option::get('styles_version') . '" type="text/css" />';
} else {
echo '<link rel="stylesheet" href="' . Option::get('siteurl') . '/tmp/minify/frontend_site.minify.css?' . Option::get('styles_version') . '" type="text/css" />' . "\n";
}
}
}
示例5: readCss
private static function readCss($pdf, $view)
{
$css = "";
$files = $view->getCssFiles();
foreach ($files as $file) {
$css = Stylesheet::minify($file);
$pdf->WriteHtml($css, 1);
}
return $css;
}
示例6: css
/**
* Outputs concatenated CSS for the specified view
* @param string view | the view - optional
*/
public function css()
{
$this->setContentType('text/css; charset=utf-8;');
$this->setCache(Date::SPAN_MONTH);
require_once Pimple::instance()->getBaseDir() . 'lib/Stylesheet.php';
$cacheDir = Pimple::instance()->getSiteDir() . 'cache/css/';
Dir::ensure($cacheDir);
$templates = array();
if (!Request::get('skipLayout', false)) {
$templates[] = 'application';
}
$view = Request::get('view', false);
if ($view) {
$templates[] = $view;
}
$used = array();
$isDebug = Settings::get(Settings::DEBUG, false);
foreach ($templates as $template) {
$cacheFile = $cacheDir . $template . '.css';
echo "/* {$template} */\n";
if ($isDebug) {
$view = new View($template);
$files = $view->getInternalCssFiles();
echo "/*FILES:\n\t" . implode("\n\t", $files) . '*/' . chr(10);
foreach ($files as $file) {
if (in_array($file, $used) || String::StartsWith($file, "http://") || String::StartsWith($file, "https://")) {
continue;
}
$used[] = $file;
echo "/*FILE:" . basename($file) . '*/' . chr(10) . Stylesheet::minify($file) . chr(10);
}
} else {
Dir::ensure(dirname($cacheFile));
if (!is_file($cacheFile)) {
File::truncate($cacheFile);
$view = new View($template);
$files = $view->getInternalCssFiles();
File::append($cacheFile, "/*FILES:\n\t" . implode("\n\t", $files) . '*/' . chr(10));
foreach ($files as $file) {
if (in_array($file, $used) || String::StartsWith($file, "http://") || String::StartsWith($file, "https://")) {
continue;
}
$used[] = $file;
File::append($cacheFile, "/*FILE:" . basename($file) . '*/' . chr(10) . Stylesheet::minify($file) . chr(10));
}
}
echo file_get_contents($cacheFile);
}
}
Pimple::end();
}
示例7: _process_html
/**
* Builds the {@link Frame_Tree}, loads any CSS and applies the styles to
* the {@link Frame_Tree}
*/
protected function _process_html()
{
$this->_tree->build_tree();
$this->_css->load_css_file(Stylesheet::DEFAULT_STYLESHEET, Stylesheet::ORIG_UA);
$acceptedmedia = Stylesheet::$ACCEPTED_GENERIC_MEDIA_TYPES;
$acceptedmedia[] = $this->get_option("default_media_type");
// <base href="" />
$base_nodes = $this->_xml->getElementsByTagName("base");
if ($base_nodes->length && ($href = $base_nodes->item(0)->getAttribute("href"))) {
list($this->_protocol, $this->_base_host, $this->_base_path) = explode_url($href);
}
// Set the base path of the Stylesheet to that of the file being processed
$this->_css->set_protocol($this->_protocol);
$this->_css->set_host($this->_base_host);
$this->_css->set_base_path($this->_base_path);
// Get all the stylesheets so that they are processed in document order
$xpath = new DOMXPath($this->_xml);
$stylesheets = $xpath->query("//*[name() = 'link' or name() = 'style']");
foreach ($stylesheets as $tag) {
switch (strtolower($tag->nodeName)) {
// load <link rel="STYLESHEET" ... /> tags
case "link":
if (mb_strtolower(stripos($tag->getAttribute("rel"), "stylesheet") !== false) || mb_strtolower($tag->getAttribute("type")) === "text/css") {
//Check if the css file is for an accepted media type
//media not given then always valid
$formedialist = preg_split("/[\\s\n,]/", $tag->getAttribute("media"), -1, PREG_SPLIT_NO_EMPTY);
if (count($formedialist) > 0) {
$accept = false;
foreach ($formedialist as $type) {
if (in_array(mb_strtolower(trim($type)), $acceptedmedia)) {
$accept = true;
break;
}
}
if (!$accept) {
//found at least one mediatype, but none of the accepted ones
//Skip this css file.
continue;
}
}
$url = $tag->getAttribute("href");
$url = build_url($this->_protocol, $this->_base_host, $this->_base_path, $url);
$this->_css->load_css_file($url, Stylesheet::ORIG_AUTHOR);
}
break;
// load <style> tags
// load <style> tags
case "style":
// Accept all <style> tags by default (note this is contrary to W3C
// HTML 4.0 spec:
// http://www.w3.org/TR/REC-html40/present/styles.html#adef-media
// which states that the default media type is 'screen'
if ($tag->hasAttributes() && ($media = $tag->getAttribute("media")) && !in_array($media, $acceptedmedia)) {
continue;
}
$css = "";
if ($tag->hasChildNodes()) {
$child = $tag->firstChild;
while ($child) {
$css .= $child->nodeValue;
// Handle <style><!-- blah --></style>
$child = $child->nextSibling;
}
} else {
$css = $tag->nodeValue;
}
$this->_css->load_css($css);
break;
}
}
}
示例8: main
<?php
// Add Plugin Javascript
Stylesheet::add('plugins/box/filesmanager/css/style.css', 'backend', 11);
Javascript::add('plugins/box/filesmanager/js/fileuploader.js', 'backend', 11);
Javascript::add('plugins/box/filesmanager/js/filesmanager.js', 'backend', 11);
// Add plugin navigation link
Navigation::add(__('Files', 'filesmanager'), 'content', 'filesmanager', 3);
/**
* Filesmanager Admin Class
*/
class FilesmanagerAdmin extends Backend
{
/**
* Main function
*/
public static function main()
{
// Array of forbidden types
$forbidden_types = array('html', 'htm', 'js', 'jsb', 'mhtml', 'mht', 'php', 'phtml', 'php3', 'php4', 'php5', 'phps', 'shtml', 'jhtml', 'pl', 'py', 'cgi', 'sh', 'ksh', 'bsh', 'c', 'htaccess', 'htpasswd', 'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl', 'empty');
// Array of image types
$image_types = array('jpg', 'png', 'bmp', 'gif', 'tif');
// Get Site url
$site_url = Option::get('siteurl');
// Init vars
if (Request::get('path')) {
$path = Request::get('path');
} else {
$path = 'uploads/';
}
// Add slash if not exists
示例9: main
/**
* Themes plugin admin
*/
public static function main()
{
// Get current themes
$current_site_theme = Option::get('theme_site_name');
$current_admin_theme = Option::get('theme_admin_name');
// Init vars
$themes_site = Themes::getSiteThemes();
$themes_admin = Themes::getAdminThemes();
$templates = Themes::getTemplates();
$chunks = Themes::getChunks();
$styles = Themes::getStyles();
$scripts = Themes::getScripts();
$errors = array();
$chunk_path = THEMES_SITE . DS . $current_site_theme . DS;
$template_path = THEMES_SITE . DS . $current_site_theme . DS;
$style_path = THEMES_SITE . DS . $current_site_theme . DS . 'css' . DS;
$script_path = THEMES_SITE . DS . $current_site_theme . DS . 'js' . DS;
// Save site theme
if (Request::post('save_site_theme')) {
if (Security::check(Request::post('csrf'))) {
Option::update('theme_site_name', Request::post('themes'));
// Clean Monstra TMP folder.
Monstra::cleanTmp();
// Increment Styles and Javascript version
Stylesheet::stylesVersionIncrement();
Javascript::javascriptVersionIncrement();
Request::redirect('index.php?id=themes');
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
// Save site theme
if (Request::post('save_admin_theme')) {
if (Security::check(Request::post('csrf'))) {
Option::update('theme_admin_name', Request::post('themes'));
// Clean Monstra TMP folder.
Monstra::cleanTmp();
Request::redirect('index.php?id=themes');
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
// Its mean that you can add your own actions for this plugin
Action::run('admin_themes_extra_actions');
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
// Add chunk
// -------------------------------------
case "add_chunk":
if (Request::post('add_file') || Request::post('add_file_and_exit')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('name')) == '') {
$errors['file_empty_name'] = __('Required field', 'themes');
}
if (file_exists($chunk_path . Security::safeName(Request::post('name'), null, false) . '.chunk.php')) {
$errors['file_exists'] = __('This chunk already exists', 'themes');
}
if (count($errors) == 0) {
// Save chunk
File::setContent($chunk_path . Security::safeName(Request::post('name'), null, false) . '.chunk.php', Request::post('content'));
Notification::set('success', __('Your changes to the chunk <i>:name</i> have been saved.', 'themes', array(':name' => Security::safeName(Request::post('name'), null, false))));
if (Request::post('add_file_and_exit')) {
Request::redirect('index.php?id=themes');
} else {
Request::redirect('index.php?id=themes&action=edit_chunk&filename=' . Security::safeName(Request::post('name'), null, false));
}
}
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}
}
// Save fields
if (Request::post('name')) {
$name = Request::post('name');
} else {
$name = '';
}
if (Request::post('content')) {
$content = Request::post('content');
} else {
$content = '';
}
// Display view
View::factory('box/themes/views/backend/add')->assign('name', $name)->assign('content', $content)->assign('errors', $errors)->assign('action', 'chunk')->display();
break;
// Add template
// -------------------------------------
// Add template
// -------------------------------------
case "add_template":
if (Request::post('add_file') || Request::post('add_file_and_exit')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('name')) == '') {
//.........这里部分代码省略.........
示例10:
* Events plugin admin
*
* Provides CRUD for events and different output possibilities for event lists
*
* @package Monstra
* @subpackage Plugins
* @author Andreas Müller | devmount <mail@devmount.de>
* @license MIT
* @link https://github.com/devmount-monstra/events
*
*/
// Add plugin styles and scripts
Stylesheet::add('plugins/events/css/events.admin.css', 'backend', 11);
Javascript::add('plugins/events/js/events.admin.js', 'backend', 11);
// lib: Image Picker http://rvera.github.io/image-picker/
Stylesheet::add('plugins/events/lib/image-picker/image-picker.css', 'backend', 11);
Javascript::add('plugins/events/lib/image-picker/image-picker.js', 'backend', 11);
// Admin Navigation: add new item
Navigation::add(__('Events', 'events'), 'content', 'events', 10);
// Add action on admin_pre_render hook
Action::add('admin_pre_render', 'EventsAdmin::_getAjaxData');
// register repository classes
require_once 'repositories/repository.events.php';
require_once 'repositories/repository.categories.php';
require_once 'repositories/repository.locations.php';
/**
* Events class
*
*/
class EventsAdmin extends Backend
{
示例11: list
if (strpos($ruri, '?') === false) {
$params = '';
$path = $ruri;
} else {
list($path, $params) = preg_split('/\\?/', $ruri, 2);
}
$special = array('css/icinga.css', 'css/icinga.min.css', 'js/icinga.dev.js', 'js/icinga.min.js');
if (in_array($path, $special)) {
include_once __DIR__ . '/EmbeddedWeb.php';
EmbeddedWeb::start();
switch ($path) {
case 'css/icinga.css':
Stylesheet::send();
exit;
case 'css/icinga.min.css':
Stylesheet::sendMinified();
exit;
case 'js/icinga.dev.js':
JavaScript::send();
exit;
case 'js/icinga.min.js':
JavaScript::sendMinified();
break;
default:
return false;
}
} elseif ($path === 'svg/chart.php') {
if (!array_key_exists('data', $_GET)) {
return false;
}
include __DIR__ . '/EmbeddedWeb.php';
示例12: main
<?php
// Add Plugin Javascript
Stylesheet::add('public/assets/css/daterangepicker-bs3.css', 'backend', 11);
Javascript::add('public/assets/js/moment.min.js', 'backend', 11);
Javascript::add('public/assets/js/daterangepicker.js', 'backend', 12);
Javascript::add('plugins/box/dashboard/js/ganalytics.js', 'backend', 13);
/**
* Dashboard admin class
*/
class DashboardAdmin extends Backend
{
/**
* Main Dashboard admin function
*/
public static function main()
{
// set/update google analytics settings
if (Request::post('ga_settings_update')) {
if (Security::check(Request::post('csrf'))) {
// client id
$ga_client_id = trim(Request::post('ga_client_id'));
if (!empty($ga_client_id)) {
$opt_client_id = Option::get('ga_client_id');
if (empty($opt_client_id)) {
Option::add('ga_client_id', $ga_client_id);
} else {
Option::update('ga_client_id', $ga_client_id);
}
}
// API key
示例13:
/public/assets/css/messenger.css" type="text/css" />
<link rel="stylesheet" href="<?php
echo Site::url();
?>
/public/assets/css/messenger-theme-flat.css" type="text/css" />
<?php
Stylesheet::add('public/assets/css/bootstrap-lightbox.css', 'backend', 2);
?>
<?php
Stylesheet::add('public/assets/css/bootstrap-fileupload.css', 'backend', 3);
?>
<?php
Stylesheet::add('admin/themes/default/css/default.css', 'backend', 5);
?>
<?php
Stylesheet::load();
?>
<!-- JavaScripts -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="<?php
echo Site::url();
?>
/public/assets/js/bootstrap.min.js"></script>
<script src="<?php
echo Site::url();
?>
/public/assets/js/messenger.min.js"></script>
<script src="<?php
echo Site::url();
?>
示例14: _parse_schemes_css_code
protected function _parse_schemes_css_code()
{
foreach (Plugin::instance()->widgets_manager->get_widget_types() as $widget) {
foreach ($widget->get_scheme_controls() as $control) {
$scheme_value = Plugin::instance()->schemes_manager->get_scheme_value($control['scheme']['type'], $control['scheme']['value']);
if (empty($scheme_value)) {
continue;
}
if (!empty($control['scheme']['key'])) {
$scheme_value = $scheme_value[$control['scheme']['key']];
}
if (empty($scheme_value)) {
continue;
}
$element_unique_class = 'elementor-widget-' . $widget->get_name();
$control_obj = Plugin::instance()->controls_manager->get_control($control['type']);
if (Controls_Manager::FONT === $control_obj->get_type()) {
$this->add_enqueue_font($scheme_value);
}
foreach ($control['selectors'] as $selector => $css_property) {
$output_selector = str_replace('{{WRAPPER}}', '.' . $element_unique_class, $selector);
$output_css_property = $control_obj->get_replaced_style_values($css_property, $scheme_value);
$this->stylesheet->add_rules($output_selector, $output_css_property);
}
}
}
}
示例15: __construct
public function __construct($node, $parent)
{
parent::__construct($node, $parent);
self::$possible_attributes = array_merge(parent::$possible_attributes, self::$possible_attributes);
self::$required_attributes = array_merge(parent::$required_attributes, self::$required_attributes);
self::$possible_children = array_merge(parent::$possible_children, self::$possible_children);
self::$required_children = array_merge(parent::$required_children, self::$required_children);
}