本文整理汇总了PHP中Style::important_set方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::important_set方法的具体用法?PHP Style::important_set怎么用?PHP Style::important_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Style
的用法示例。
在下文中一共展示了Style::important_set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _parse_properties
/**
* parse regular CSS blocks
*
* _parse_properties() creates a new Style object based on the provided
* CSS rules.
*
* @param string $str CSS rules
* @return Style
*/
private function _parse_properties($str)
{
$properties = preg_split("/;(?=(?:[^\\(]*\\([^\\)]*\\))*(?![^\\)]*\\)))/", $str);
if (DEBUGCSS) {
print '[_parse_properties';
}
// Create the style
$style = new Style($this);
foreach ($properties as $prop) {
// If the $prop contains an url, the regex may be wrong
// @todo: fix the regex so that it works everytime
/*if (strpos($prop, "url(") === false) {
if (preg_match("/([a-z-]+)\s*:\s*[^:]+$/i", $prop, $m))
$prop = $m[0];
}*/
//A css property can have " ! important" appended (whitespace optional)
//strip this off to decode core of the property correctly.
//Pass on in the style to allow proper handling:
//!important properties can only be overridden by other !important ones.
//$style->$prop_name = is a shortcut of $style->__set($prop_name,$value);.
//If no specific set function available, set _props["prop_name"]
//style is always copied completely, or $_props handled separately
//Therefore set a _important_props["prop_name"]=true to indicate the modifier
/* Instead of short code, prefer the typical case with fast code
$important = preg_match("/(.*?)!\s*important/",$prop,$match);
if ( $important ) {
$prop = $match[1];
}
$prop = trim($prop);
*/
if (DEBUGCSS) {
print '(';
}
$important = false;
$prop = trim($prop);
if (substr($prop, -9) === 'important') {
$prop_tmp = rtrim(substr($prop, 0, -9));
if (substr($prop_tmp, -1) === '!') {
$prop = rtrim(substr($prop_tmp, 0, -1));
$important = true;
}
}
if ($prop == "") {
if (DEBUGCSS) {
print 'empty)';
}
continue;
}
$i = mb_strpos($prop, ":");
if ($i === false) {
if (DEBUGCSS) {
print 'novalue' . $prop . ')';
}
continue;
}
$prop_name = rtrim(mb_strtolower(mb_substr($prop, 0, $i)));
$value = ltrim(mb_substr($prop, $i + 1));
if (DEBUGCSS) {
print $prop_name . ':=' . $value . ($important ? '!IMPORTANT' : '') . ')';
}
//New style, anyway empty
//if ($important || !$style->important_get($prop_name) ) {
//$style->$prop_name = array($value,$important);
//assignment might be replaced by overloading through __set,
//and overloaded functions might check _important_props,
//therefore set _important_props first.
if ($important) {
$style->important_set($prop_name);
}
//For easier debugging, don't use overloading of assignments with __set
$style->{$prop_name} = $value;
//$style->props_set($prop_name, $value);
}
if (DEBUGCSS) {
print '_parse_properties]';
}
return $style;
}
示例2: _parse_properties
private function _parse_properties($str)
{
$properties = preg_split("/;(?=(?:[^\\(]*\\([^\\)]*\\))*(?![^\\)]*\\)))/", $str);
if (DEBUGCSS) {
print '[_parse_properties';
}
$style = new Style($this);
foreach ($properties as $prop) {
if (DEBUGCSS) {
print '(';
}
$important = false;
$prop = trim($prop);
if (substr($prop, -9) === 'important') {
$prop_tmp = rtrim(substr($prop, 0, -9));
if (substr($prop_tmp, -1) === '!') {
$prop = rtrim(substr($prop_tmp, 0, -1));
$important = true;
}
}
if ($prop === "") {
if (DEBUGCSS) {
print 'empty)';
}
continue;
}
$i = mb_strpos($prop, ":");
if ($i === false) {
if (DEBUGCSS) {
print 'novalue' . $prop . ')';
}
continue;
}
$prop_name = rtrim(mb_strtolower(m_mb_substr($prop, 0, $i)));
$value = ltrim(m_mb_substr($prop, $i + 1));
if (DEBUGCSS) {
print $prop_name . ':=' . $value . ($important ? '!IMPORTANT' : '') . ')';
}
if ($important) {
$style->important_set($prop_name);
}
$style->{$prop_name} = $value;
}
if (DEBUGCSS) {
print '_parse_properties]';
}
return $style;
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:48,代码来源:stylesheet.cls.php