示例#1
0
 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
0
 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
0
 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;
 }
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
0
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
0
 /**
  * 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
0
 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
0
 /**
  * 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], '');
     }
 }
 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
0
 function &create()
 {
     $box =& new NullBox();
     $css_state = new CSSState(CSS::get());
     $css_state->pushState();
     $box->readCSS($css_state);
     return $box;
 }
示例#11
0
 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!!");
 }
 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
0
 /**
  * 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
0
 /**
  * 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;
 }
 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);
     }
 }
示例#16
0
 /**
  * Initialize requires CSS and JS files.
  */
 public static function initDisplay()
 {
     static $inited = false;
     if (!$inited) {
         JS::add('/js/video-js.min.js', false);
         JS::startup('videojs.options.flash.swf = "/swf/video-js.swf"');
         CSS::add('/css/video-js.min.css');
         $inited = true;
     }
 }
示例#17
0
 function parse($string)
 {
     list($value, $rest) = CSS::parse_string($string);
     if (!is_null($value)) {
         $item =& new ValueContentItemString();
         $item->set_value(substr($value, 1, strlen($value) - 2));
         return array('item' => &$item, 'rest' => $rest);
     }
     $null = null;
     return array('item' => &$null, 'rest' => $string);
 }
示例#18
0
文件: css.php 项目: pihizi/qf
 function index()
 {
     $content = CSS::cache_content($_GET['f']);
     header('Expires: Thu, 15 Apr 2100 20:00:00 GMT');
     header('Pragma: public');
     header('Cache-Control: max-age=604800');
     header('Content-Type: text/css; charset:utf-8');
     ob_start('ob_gzhandler');
     echo $content;
     ob_end_flush();
     exit;
 }
function parse_css_properties_property($string, &$code)
{
    $identifier_regexp = CSS::get_identifier_regexp();
    if (!preg_match(sprintf('/^\\s*(%s)(.*)/s', $identifier_regexp), $string, $matches)) {
        $code = null;
        return '';
    }
    $name = strtolower(trim($matches[1]));
    $rest = $matches[2];
    $code = CSS::word2code($name);
    return $rest;
}
 function &create(&$root, &$pipeline)
 {
     $box =& new TableBox();
     $box->readCSS($pipeline->getCurrentCSSState());
     // This row should not inherit any table specific properties!
     // 'overflow' for example
     //
     $css_state =& $pipeline->getCurrentCSSState();
     $css_state->pushDefaultState();
     $row =& new TableRowBox($root);
     $row->readCSS($css_state);
     $box->add_child($row);
     $css_state->popState();
     // Setup cellspacing / cellpadding values
     if ($box->getCSSProperty(CSS_BORDER_COLLAPSE) == BORDER_COLLAPSE) {
         $handler =& CSS::get_handler(CSS_PADDING);
         $box->setCSSProperty(CSS_PADDING, $handler->default_value());
     }
     // Set text-align to 'left'; all browsers I've ever seen prevent inheriting of
     // 'text-align' property by the tables.
     // Say, in the following example the text inside the table cell will be aligned left,
     // instead of inheriting 'center' value.
     //
     // <div style="text-align: center; background-color: green;">
     // <table width="100" bgcolor="red">
     // <tr><td>TEST
     // </table>
     // </div>
     $handler =& CSS::get_handler(CSS_TEXT_ALIGN);
     $handler->css('left', $pipeline);
     // Parse table contents
     $child = $root->first_child();
     $col_index = 0;
     while ($child) {
         if ($child->node_type() === XML_ELEMENT_NODE) {
             if ($child->tagname() === 'colgroup') {
                 // COLGROUP tags do not generate boxes; they contain information on the columns
                 //
                 $col_index = $box->parse_colgroup_tag($child, $col_index);
             } else {
                 $child_box =& create_pdf_box($child, $pipeline);
                 $box->add_child($child_box);
             }
         }
         $child = $child->next_sibling();
     }
     $box->normalize($pipeline);
     $box->normalize_cwc();
     $box->normalize_rhc();
     $box->normalize_parent();
     return $box;
 }
示例#21
0
 /**
  * Imports css via @import statements
  * 
  * @author Anthony Short
  * @param $css
  */
 public static function server_import($css, $previous = "")
 {
     # If they want to override the CSS syntax
     if (CSScaffold::config('core.override_import') === true) {
         $import = 'import';
     } else {
         $import = 'include';
     }
     if (preg_match_all('/\\@' . $import . '\\s+(?:\'|\\")([^\'\\"]+)(?:\'|\\")\\;/', $css, $matches)) {
         $unique = array_unique($matches[1]);
         $include = str_replace("\\", "/", unquote($unique[0]));
         # If they're getting an absolute file
         if ($include[0] == "/") {
             $include = DOCROOT . ltrim($include, "/");
         }
         # Make sure recursion isn't happening
         if ($include == $previous) {
             throw new Scaffold_Exception("Recursion occurring with CSS @includes in {$include}");
         }
         # If they haven't supplied an extension, we'll assume its a css file
         if (pathinfo($include, PATHINFO_EXTENSION) == "") {
             $include .= '.css';
         }
         # Make sure it's a CSS file
         if (!is_css($include)) {
             throw new Scaffold_Exception("Included file isn't a CSS file ({$include})");
         }
         # If the url starts with ~, we'll assume it's from the root of the css directory
         if ($include[0] == "~") {
             $include = ltrim($include, '~/');
             $include = CSScaffold::config('core.path.css') . $include;
         }
         if (file_exists($include)) {
             # Make sure it hasn't already been included
             if (!in_array($include, self::$loaded)) {
                 self::$loaded[] = $include;
                 $css = str_replace($matches[0][0], file_get_contents($include), $css);
             } else {
                 $css = str_replace($matches[0][0], '', $css);
             }
             # Compress it which removes any commented out @imports
             CSS::compress($css);
             # Check the file again for more imports
             $css = self::server_import($css, $include);
         } else {
             throw new Scaffold_Exception("Included CSS file doesn't exist ({$include})");
         }
     }
     return $css;
 }
示例#22
0
 public static function check()
 {
     if (!IN_PRODUCTION) {
         # Clean it up so we can use the line numbers
         CSS::pretty();
         # Get the validator options from the config
         $validator_options = CSScaffold::config('Validate');
         # Add our options
         $validator_options['text'] = CSS::$css;
         $validator_options['output'] = 'soap12';
         # Encode them
         $validator_options = http_build_query($validator_options);
         $url = "http://jigsaw.w3.org/css-validator/validator?{$validator_options}";
         # The Curl options
         $options = array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => 1);
         # Start CURL
         $handle = curl_init();
         # Set the CURL options
         curl_setopt_array($handle, $options);
         # Store the response in a buffer
         $buffer = curl_exec($handle);
         # Close it
         curl_close($handle);
         # If something was returned
         if (!empty($buffer)) {
             # Simplexml doesn't like colons
             $buffer = preg_replace("/(<\\/?)(\\w+):([^>]*>)/", "\$1\$2\$3", $buffer);
             # Let it be xml!
             $results = simplexml_load_string($buffer);
             # Is it valid?
             $is_valid = (string) $results->envBody->mcssvalidationresponse->mvalidity;
             # Oh noes! Display the errors
             if ($is_valid == "false") {
                 # Lets get the errors into a nice array
                 $errors = $results->envBody->mcssvalidationresponse->mresult->merrors;
                 # Number of errors
                 $count = (int) $errors->merrorcount;
                 # Start creating the output message
                 $message = "<ol>";
                 foreach ($errors->merrorlist->merror as $key => $error) {
                     $message .= "<li><strong>" . trim((string) $error->mmessage) . "</strong> line " . (string) $error->mline . " near " . (string) $error->mcontext . "</li>";
                 }
                 $message .= "</ol>";
                 # Throw an error
                 throw new Scaffold_User_Exception("CSS is not valid - {$count} errors", $message);
             }
         }
     }
 }
示例#23
0
 /**
  * Parses @fors within the css
  *
  * @author Anthony Short
  * @param $string
  * @return string
  */
 public static function parse_fors($string)
 {
     if ($found = self::find_fors($string)) {
         foreach ($found[0] as $key => $value) {
             $s = "";
             $from = $found[2][$key];
             $to = $found[3][$key];
             $var = $found[1][$key];
             for ($i = $from; $i <= $to; $i++) {
                 $s .= str_replace("!{$var}", $i, $found[5][$key]);
             }
             CSS::replace($found[0][$key], $s);
         }
     }
 }
 function testCSSParseMarginBoxesTopLeftSize()
 {
     parse_config_file('../html2ps.config');
     $media =& Media::predefined('A4');
     $media->set_margins(array('left' => 10, 'top' => 10, 'right' => 10, 'bottom' => 10));
     $pipeline =& PipelineFactory::create_default_pipeline('utf-8', 'test.pdf');
     $pipeline->_prepare($media);
     $pipeline->_cssState = array(new CSSState(CSS::get()));
     parse_css_atpage_rules('@page { @top-left { content: "TEXT"; } }', $pipeline);
     $boxes = $pipeline->reflow_margin_boxes(1, $media);
     $box =& $boxes[CSS_MARGIN_BOX_SELECTOR_TOP_LEFT];
     $this->assertNotEqual($box->get_width(), 0);
     $expected_width = $pipeline->output_driver->stringwidth('TEXT', 'Times-Roman', 'iso-8859-1', 12);
     $this->assertTrue($box->get_width() >= $expected_width);
     $this->assertEqual($box->get_height(), mm2pt(10));
 }
 public function find($css, $index = null)
 {
     $xpath = CSS::xpath_for($css);
     if (!isset($this->doc) || !isset($this->doc->xpath)) {
         return null;
     }
     if (null === $index) {
         return new AHTMLNodeList($this->doc->xpath->query($xpath, $this->node), $this->doc);
     } else {
         $nl = $this->doc->xpath->query($xpath, $this->node);
         if ($index < 0) {
             $index = $nl->length + $index;
         }
         $node = $nl->item($index);
         return $node ? new AHTMLNode($node, $this->doc) : null;
     }
 }
 function &create($code, $value, $pipeline)
 {
     $handler =& CSS::get_handler($code);
     if (is_null($handler)) {
         $null = null;
         return $null;
     }
     $declaration =& new CSSPropertyDeclaration();
     $declaration->_code = $code;
     if (preg_match("/^(.*)!\\s*important\\s*\$/", $value, $matches)) {
         $value = $matches[1];
         $declaration->_important = true;
     } else {
         $declaration->_important = false;
     }
     $declaration->_value = $handler->parse($value, $pipeline);
     return $declaration;
 }
示例#27
0
 static function __classLoaded($className)
 {
     self::set_title(null);
     self::set_description(null);
     self::set_keywords(null);
     PageData::instance()->set("/page/headers/indexing_tags", array(Block::MARKER_KEY => "head/indexing_tags"));
     PageData::instance()->set("/page/headers/content_type", array(Block::MARKER_KEY => "head/content_type"));
     PageData::instance()->set("/page/headers/meta_tags", array(Block::MARKER_KEY => "head/meta_tags_list"));
     PageData::instance()->set("/page/headers/meta_tags/list", array());
     PageData::instance()->set("/page/headers/page_author", array(Block::MARKER_KEY => "head/author"));
     PageData::instance()->set("/page/headers/comment_tags", array(Block::MARKER_KEY => "head/comment_list"));
     PageData::instance()->set("/page/headers/comment_tags/list", array());
     $year = date("Y");
     $copyright_string = "Copyright " . $year . " (c) MBCRAFT";
     PageData::instance()->set("/page/headers/page_copyright", array(Block::MARKER_KEY => "head/copyright", "copyright_string" => $copyright_string, "year" => $year));
     self::set_layout("ajax");
     CSS::clean();
     JS::clean();
 }
 function fake_box(&$box)
 {
     // Create the fake box object
     $fake_state = new CSSState(CSS::get());
     $fake_state->pushState();
     $fake = null;
     $fake_box = new BlockBox($fake);
     $fake_box->readCSS($fake_state);
     // Setup fake box size
     $fake_box->put_left($this->left);
     $fake_box->put_width($this->right - $this->left);
     $fake_box->put_top($this->top - $box->baseline);
     $fake_box->put_height($this->top - $this->bottom);
     // Setup padding value
     $fake_box->setCSSProperty(CSS_PADDING, $box->getCSSProperty(CSS_PADDING));
     // Setup fake box border and background
     $fake_box->setCSSProperty(CSS_BACKGROUND, $box->getCSSProperty(CSS_BACKGROUND));
     $fake_box->setCSSProperty(CSS_BORDER, $box->getCSSProperty(CSS_BORDER));
     return $fake_box;
 }
示例#29
0
 /**
  * Registers script
  * 
  * @param  object $hook_name JS Hook instance
  * @return object            Current object
  */
 protected function handleAction($hook_name, $action)
 {
     if ($hook = CSS::getInstance()->getHook($hook_name)) {
         if ($action == 'register') {
             // Get dependencies
             $deps = $this->config->get('deps') ?: [];
             // Enqueue dependencies
             if ($deps) {
                 foreach ($deps as $dep_handle) {
                     // Publish event
                     $this->getEventEmitter()->publish("cms.config.styles.{$dep_handle}", ['action' => 'enqueue_as_dependency', 'hooks' => [$hook_name]]);
                 }
             }
             // Register script
             $hook->register($this->config->get('handle'), $this->config->get('src'), $deps, $this->config->get('version') ?: null, $this->config->get('in_footer') ?: null);
         } else {
             $hook->{$action}($this->config->get('handle'));
         }
     }
     return $this;
 }
示例#30
0
<?php

class CSSOrphans extends CSSPropertyHandler
{
    function CSSOrphans()
    {
        $this->CSSPropertyHandler(true, false);
    }
    function default_value()
    {
        return 2;
    }
    function parse($value)
    {
        return (int) $value;
    }
    function getPropertyCode()
    {
        return CSS_ORPHANS;
    }
    function getPropertyName()
    {
        return 'orphans';
    }
}
CSS::register_css_property(new CSSOrphans());