本文整理汇总了PHP中CSS类的典型用法代码示例。如果您正苦于以下问题:PHP CSS类的具体用法?PHP CSS怎么用?PHP CSS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Execute
public function Execute(Template $template, Session $session, $request)
{
if ($session['user'] instanceof Member && $session['user']['perms'] & ADMIN) {
$css = new CSS();
if ($css->Revert(intval($request['id']))) {
header("Location: admin.php?act=css");
}
}
return TRUE;
}
示例2: _addCSS
function _addCSS($order, $resource, $is_file, $minify)
{
$order = intval($order);
$resources = array();
if (array_key_exists($order, $this->css_resources)) {
$resources = $this->css_resources[$order];
}
$css = new CSS($resource, $is_file);
$css->setMinified($minify);
$resources[] = $css;
$this->css_resources[$order] = $resources;
}
示例3: parse
function parse($value)
{
if ($value == 'inherit') {
return CSS_PROPERTY_INHERIT;
}
// Remove spaces between color values in rgb() color definition; this will allow us to tread
// this declaration as a single value
$value = preg_replace("/\\s*,\\s*/", ",", $value);
// Remove spaces before and after parens in rgb color definition
$value = preg_replace("/rgb\\s*\\(\\s*(.*?)\\s*\\)/", 'rgb(\\1)', $value);
$subvalues = explode(" ", $value);
$border = CSS::getDefaultValue(CSS_BORDER);
foreach ($subvalues as $subvalue) {
$subvalue = trim(strtolower($subvalue));
switch (CSSBorder::detect_border_value_type($subvalue)) {
case BORDER_VALUE_COLOR:
$color_handler = CSS::get_handler(CSS_BORDER_COLOR);
$border_color = $color_handler->parse($subvalue);
$color_handler->setValue($border, $border_color);
break;
case BORDER_VALUE_WIDTH:
$width_handler = CSS::get_handler(CSS_BORDER_WIDTH);
$border_width = $width_handler->parse($subvalue);
$width_handler->setValue($border, $border_width);
break;
case BORDER_VALUE_STYLE:
$style_handler = CSS::get_handler(CSS_BORDER_STYLE);
$border_style = $style_handler->parse($subvalue);
$style_handler->setValue($border, $border_style);
break;
}
}
return $border;
}
示例4: parse_css_properties_value
function parse_css_properties_value($string, &$value)
{
$string1_regexp = CSS_STRING1_REGEXP;
$string2_regexp = CSS_STRING2_REGEXP;
$value = '';
do {
$matched = false;
list($new_value, $string) = CSS::parse_string($string);
if (!is_null($new_value)) {
$value .= $new_value;
$matched = true;
}
if (preg_match('/^(' . CSS_FUNCTION_REGEXP . CSS_IDENT_REGEXP . '\\))\\s*(.*)$/si', $string, $matches)) {
$value .= $matches[1];
$string = $matches[2];
$matched = true;
}
} while ($matched);
$value_regexp = '[^;]*?';
if (preg_match(sprintf('/^(%s)(\\s*;.*)/si', $value_regexp), $string, $matches)) {
$value .= trim($matches[1]);
$rest = $matches[2];
return $rest;
}
$value = $value . trim($string);
return '';
}
示例5: _fix_tag_display
function _fix_tag_display($default_display, &$state, &$pipeline)
{
// In some cases 'display' CSS property should be ignored for element-generated boxes
// Here we will use the $default_display stored above
// Note that "display: none" should _never_ be changed
//
$handler =& CSS::get_handler(CSS_DISPLAY);
if ($handler->get($state->getState()) === "none") {
return;
}
switch ($default_display) {
case 'table-cell':
// TD will always have 'display: table-cell'
$handler->css('table-cell', $pipeline);
break;
case '-button':
// INPUT buttons will always have 'display: -button' (in latter case if display = 'block', we'll use a wrapper box)
$css_state =& $pipeline->getCurrentCSSState();
if ($handler->get($css_state->getState()) === 'block') {
$need_block_wrapper = true;
}
$handler->css('-button', $pipeline);
break;
}
}
示例6: __construct
/**
* Checks environment and build defaults
*
*/
protected function __construct()
{
// Instantiate Feature Manager
FeatureManager::getInstance();
// Instantiate Context Manager
ContextManager::getInstance();
// Instantiate URLs Manager
UrlManager::getInstance();
// Instantiate Paths Manager & set Bebop root directory
PathManager::getInstance()->set('bebop', __DIR__);
// Set default Media Mvc Model modifications on the Bebop HTTP API
Media::onContext('api', function ($media) {
$media->cacheAllImageSizes();
});
// Set default views directory
View::setViewsDir(PathManager::getInstance()->get('theme', 'views'));
// Instantiate CSS Manager
CSS::getInstance();
// Instantiate JS Manager
JS::getInstance();
// Instantiate UI
UI::getInstance();
// Instantiate Api
self::Api();
// Instantiate Config
Config::getInstance();
// Shortcode support for in editor use
add_shortcode('Bebop', array($this, '__bebopShortcodes'));
}
示例7: apply
function apply(&$root, &$state, &$pipeline)
{
$local_css = array();
if (isset($this->tag_filtered[strtolower($root->tagname())])) {
$local_css = $this->tag_filtered[strtolower($root->tagname())];
}
if (isset($this->tag_filtered['*'])) {
$local_css = array_merge($local_css, $this->tag_filtered['*']);
}
$applicable = array();
foreach ($local_css as $rule) {
if ($rule->match($root)) {
$applicable[] = $rule;
}
}
usort($applicable, 'cmp_rule_objs');
foreach ($applicable as $rule) {
switch ($rule->get_pseudoelement()) {
case SELECTOR_PSEUDOELEMENT_BEFORE:
$handler =& CSS::get_handler(CSS_HTML2PS_PSEUDOELEMENTS);
$handler->replace($handler->get($state->getState()) | CSS_HTML2PS_PSEUDOELEMENTS_BEFORE, $state);
break;
case SELECTOR_PSEUDOELEMENT_AFTER:
$handler =& CSS::get_handler(CSS_HTML2PS_PSEUDOELEMENTS);
$handler->replace($handler->get($state->getState()) | CSS_HTML2PS_PSEUDOELEMENTS_AFTER, $state);
break;
default:
$rule->apply($root, $state, $pipeline);
break;
}
}
}
示例8: post_process
/**
* The second last process, should only be getting everything
* syntaxically correct, rather than doing any heavy processing
*
* @author Anthony Short
* @return $css string
*/
public static function post_process()
{
if ($found = CSS::find_properties_with_value('image-replace', 'url\\([\'\\"]?([^)]+)[\'\\"]?\\)')) {
foreach ($found[4] as $key => $value) {
$path = $url = str_replace("\\", "/", unquote($value));
# If they're getting an absolute file
if ($path[0] == "/") {
$path = DOCROOT . ltrim($path, "/");
}
# Check if it exists
if (!file_exists($path)) {
FB::log("ImageReplace - Image doesn't exist " . $path);
}
# Make sure it's an image
if (!is_image($path)) {
FB::log("ImageReplace - File is not an image: {$path}");
}
// Get the size of the image file
$size = GetImageSize($path);
$width = $size[0];
$height = $size[1];
// Make sure theres a value so it doesn't break the css
if (!$width && !$height) {
$width = $height = 0;
}
// Build the selector
$properties = "\n\t\t\t\t\tbackground:url({$url}) no-repeat 0 0;\n\t\t\t\t\theight:{$height}px;\n\t\t\t\t\twidth:{$width}px;\n\t\t\t\t\tdisplay:block;\n\t\t\t\t\ttext-indent:-9999px;\n\t\t\t\t\toverflow:hidden;\n\t\t\t\t";
CSS::replace($found[2][$key], $properties);
}
# Remove any left overs
CSS::replace($found[1], '');
}
}
示例9: BoxNoteCall
function BoxNoteCall(&$content, &$pipeline)
{
$this->GenericInlineBox();
$this->_note_content =& $content;
$this->copy_style($content);
$this->put_height_constraint(new HCConstraint(null, null, null));
/**
* Prepare ::note-call box
*/
$this->_note_call_box = InlineBox::create_from_text(CSSListStyleType::format_number(LST_DECIMAL, 99), WHITESPACE_NORMAL, $pipeline);
$this->_note_call_box->copy_style($content);
$this->_note_call_box->content[0]->copy_style($content);
$font = $this->_note_call_box->content[0]->getCSSProperty(CSS_FONT);
$font = $font->copy();
$font->size->scale(0.75);
$this->_note_call_box->content[0]->setCSSProperty(CSS_FONT, $font);
$this->_note_call_box->content[0]->setCSSProperty(CSS_VERTICAL_ALIGN, VA_SUPER);
$this->_note_call_box->content[0]->setCSSProperty(CSS_LINE_HEIGHT, CSS::getDefaultValue(CSS_LINE_HEIGHT));
/**
* Prepare ::marker box
*/
$this->_note_marker_box = InlineBox::create_from_text(CSSListStyleType::format_number(LST_DECIMAL, 99), WHITESPACE_NORMAL, $pipeline);
$this->_note_marker_box->copy_style($content);
$this->_note_marker_box->content[0]->copy_style($content);
$font = $this->_note_marker_box->content[0]->getCSSProperty(CSS_FONT);
$font = $font->copy();
$font->size->scale(0.5);
$this->_note_marker_box->content[0]->setCSSProperty(CSS_FONT, $font);
$margin = $this->_note_marker_box->content[0]->getCSSProperty(CSS_MARGIN);
$margin = $margin->copy();
$margin->right = Value::fromData(FOOTNOTE_MARKER_MARGIN, UNIT_PT);
$this->_note_marker_box->content[0]->setCSSProperty(CSS_MARGIN, $margin);
$this->_note_marker_box->content[0]->setCSSProperty(CSS_VERTICAL_ALIGN, VA_SUPER);
$this->_note_marker_box->content[0]->setCSSProperty(CSS_LINE_HEIGHT, CSS::getDefaultValue(CSS_LINE_HEIGHT));
}
示例10: NullBox
function &create()
{
$box =& new NullBox();
$css_state = new CSSState(CSS::get());
$css_state->pushState();
$box->readCSS($css_state);
return $box;
}
示例11: testCssAddIntoResult
function testCssAddIntoResult()
{
CSS::clean();
CSS::require_css_file("/" . FRAMEWORK_CORE_PATH . "tests/html/example_css/my_css_file.css");
$this->assertEqual(1, CSS::get_loaded_css(), "Il numero di css caricati non corrisponde!!");
$this->assertTrue(PageData::instance()->is_set("/page/headers/required_css_files"));
$this->assertEqual(1, count(PageData::instance()->get("/page/headers/required_css_files/css_file_list")), "Il numero di css caricati non corrisponde!!");
}
示例12: parse
function parse($value)
{
if ($value == 'inherit') {
return CSS_PROPERTY_INHERIT;
}
$width_handler = CSS::get_handler(CSS_BORDER_WIDTH);
$width = $width_handler->parse_value($value);
return $width;
}
示例13: parse
/**
* The main processing function called by Scaffold. MUST return $css!
*
* @author Anthony Short
* @return $css string
*/
public static function parse()
{
$xml = CSS::to_xml();
$css = "";
foreach ($xml->rule as $key => $value) {
$css .= self::parse_rule($value);
}
CSS::$css = CSS::convert_entities('decode', $css);
}
示例14: array
/**
* Optimization: this function is called very often,
* so even a slight overhead for CSS::get_handler call
* accumulates in a significiant processing delay.
*/
function &getCSSProperty($code)
{
static $cache = array();
if (!isset($cache[$code])) {
$cache[$code] =& CSS::get_handler($code);
}
$value =& $cache[$code]->get($this->_css);
return $value;
}
示例15: apply
function apply(&$state)
{
$properties = $this->getPropertiesRaw();
foreach ($properties as $property) {
$key = $property->getCode();
$value = $property->getValue();
$handler =& CSS::get_handler($key);
$handler->replace($value, $state);
}
}