本文整理汇总了PHP中csstidy::property_is_valid方法的典型用法代码示例。如果您正苦于以下问题:PHP csstidy::property_is_valid方法的具体用法?PHP csstidy::property_is_valid怎么用?PHP csstidy::property_is_valid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类csstidy
的用法示例。
在下文中一共展示了csstidy::property_is_valid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
//.........这里部分代码省略.........
$this->at = $this->css_new_media_section(DEFAULT_AT);
}
$this->selector = $this->css_new_selector($this->at, $this->selector);
$this->_add_token(SEL_START, $this->selector);
$this->added = false;
} elseif ($string[$i] === '}') {
$this->_add_token(AT_END, $this->at);
$this->at = '';
$this->selector = '';
$this->sel_separate = array();
} elseif ($string[$i] === ',') {
$this->selector = trim($this->selector) . ',';
$this->sel_separate[] = strlen($this->selector);
} elseif ($string[$i] === '\\') {
$this->selector .= $this->_unicode($string, $i);
} elseif ($string[$i] === '*' && @in_array($string[$i + 1], array('.', '#', '[', ':'))) {
// remove unnecessary universal selector, FS#147
} else {
$this->selector .= $string[$i];
}
} else {
$lastpos = strlen($this->selector) - 1;
if ($lastpos == -1 || !((ctype_space($this->selector[$lastpos]) || csstidy::is_token($this->selector, $lastpos) && $this->selector[$lastpos] === ',') && ctype_space($string[$i]))) {
$this->selector .= $string[$i];
}
}
break;
/* Case in-property */
/* Case in-property */
case 'ip':
if (csstidy::is_token($string, $i)) {
if (($string[$i] === ':' || $string[$i] === '=') && $this->property != '') {
$this->status = 'iv';
if (!$this->get_cfg('discard_invalid_properties') || csstidy::property_is_valid($this->property)) {
$this->property = $this->css_new_property($this->at, $this->selector, $this->property);
$this->_add_token(PROPERTY, $this->property);
}
} elseif ($string[$i] === '/' && @$string[$i + 1] === '*' && $this->property == '') {
$this->status = 'ic';
++$i;
$this->from[] = 'ip';
} elseif ($string[$i] === '}') {
$this->explode_selectors();
$this->status = 'is';
$this->invalid_at = false;
$this->_add_token(SEL_END, $this->selector);
$this->selector = '';
$this->property = '';
if ($this->next_selector_at) {
$this->at = $this->css_new_media_section($this->next_selector_at);
$this->next_selector_at = '';
}
} elseif ($string[$i] === ';') {
$this->property = '';
} elseif ($string[$i] === '\\') {
$this->property .= $this->_unicode($string, $i);
} elseif ($this->property == '' and !ctype_space($string[$i]) or ($this->property == '/' or $string[$i] == "/")) {
$this->property .= $string[$i];
}
} elseif (!ctype_space($string[$i])) {
$this->property .= $string[$i];
}
break;
/* Case in-value */
/* Case in-value */
case 'iv':
示例2: parse
//.........这里部分代码省略.........
$this->status = 'is';
} elseif ($string[$i] == '{') {
$this->status = 'ip';
$this->_add_token(SEL_START, $this->selector);
$this->added = false;
} elseif ($string[$i] == '}') {
$this->_add_token(AT_END, $this->at);
$this->at = '';
$this->selector = '';
$this->sel_separate = array();
} elseif ($string[$i] == ',') {
$this->selector = trim($this->selector) . ',';
$this->sel_separate[] = strlen($this->selector);
} elseif ($string[$i] == '\\') {
$this->selector .= $this->_unicode($string, $i);
} else {
if (!($string[$i] == '*' && @in_array($string[$i + 1], array('.', '#', '[', ':')))) {
$this->selector .= $string[$i];
}
}
} else {
$lastpos = strlen($this->selector) - 1;
if ($lastpos == -1 || !((ctype_space($this->selector[$lastpos]) || csstidy::is_token($this->selector, $lastpos) && $this->selector[$lastpos] == ',') && ctype_space($string[$i]))) {
$this->selector .= $string[$i];
}
}
break;
/* Case in-property */
/* Case in-property */
case 'ip':
if (csstidy::is_token($string, $i)) {
if (($string[$i] == ':' || $string[$i] == '=') && $this->property != '') {
$this->status = 'iv';
if (!$this->get_cfg('discard_invalid_properties') || csstidy::property_is_valid($this->property)) {
$this->_add_token(PROPERTY, $this->property);
}
} elseif ($string[$i] == '/' && @$string[$i + 1] == '*' && $this->property == '') {
$this->status = 'ic';
++$i;
$this->from = 'ip';
} elseif ($string[$i] == '}') {
$this->explode_selectors();
$this->status = 'is';
$this->invalid_at = false;
$this->_add_token(SEL_END, $this->selector);
$this->selector = '';
$this->property = '';
} elseif ($string[$i] == ';') {
$this->property = '';
} elseif ($string[$i] == '\\') {
$this->property .= $this->_unicode($string, $i);
}
} elseif (!ctype_space($string[$i])) {
$this->property .= $string[$i];
}
break;
/* Case in-value */
/* Case in-value */
case 'iv':
$pn = ($string[$i] == "\n" || $string[$i] == "\r") && $this->property_is_next($string, $i + 1) || $i == strlen($string) - 1;
if (csstidy::is_token($string, $i) || $pn) {
if ($string[$i] == '/' && @$string[$i + 1] == '*') {
$this->status = 'ic';
++$i;
$this->from = 'iv';
} elseif ($string[$i] == '"' || $string[$i] == "'" || $string[$i] == '(') {
示例3: parse
//.........这里部分代码省略.........
$this->at = $this->css_new_media_section(DEFAULT_AT);
}
$this->selector = $this->css_new_selector($this->at, $this->selector);
$this->_add_token(SEL_START, $this->selector);
$this->added = false;
} elseif ($string[$i] === '}') {
$this->_add_token(AT_END, $this->at);
$this->at = '';
$this->selector = '';
$this->sel_separate = array();
} elseif ($string[$i] === ',') {
$this->selector = trim($this->selector) . ',';
$this->sel_separate[] = strlen($this->selector);
} elseif ($string[$i] === '\\') {
$this->selector .= $this->_unicode($string, $i);
} elseif ($string[$i] === '*' && @in_array($string[$i + 1], array('.', '#', '[', ':'))) {
// remove unnecessary universal selector, FS#147
} else {
$this->selector .= $string[$i];
}
} else {
$lastpos = strlen($this->selector) - 1;
if ($lastpos == -1 || !((ctype_space($this->selector[$lastpos]) || csstidy::is_token($this->selector, $lastpos) && $this->selector[$lastpos] === ',') && ctype_space($string[$i]))) {
$this->selector .= $string[$i];
}
}
break;
/* Case in-property */
/* Case in-property */
case 'ip':
if (csstidy::is_token($string, $i)) {
if (($string[$i] === ':' || $string[$i] === '=') && $this->property != '') {
$this->status = 'iv';
if (!$this->get_cfg('discard_invalid_properties') || csstidy::property_is_valid($this->property)) {
$this->property = $this->css_new_property($this->at, $this->selector, $this->property);
$this->_add_token(PROPERTY, $this->property);
}
} elseif ($string[$i] === '/' && @$string[$i + 1] === '*' && $this->property == '') {
$this->status = 'ic';
++$i;
$this->from = 'ip';
} elseif ($string[$i] === '}') {
$this->explode_selectors();
$this->status = 'is';
$this->invalid_at = false;
$this->_add_token(SEL_END, $this->selector);
$this->selector = '';
$this->property = '';
} elseif ($string[$i] === ';') {
$this->property = '';
} elseif ($string[$i] === '\\') {
$this->property .= $this->_unicode($string, $i);
} elseif ($this->property == '' and !ctype_space($string[$i])) {
$this->property .= $string[$i];
}
} elseif (!ctype_space($string[$i])) {
$this->property .= $string[$i];
}
break;
/* Case in-value */
/* Case in-value */
case 'iv':
$pn = ($string[$i] === "\n" || $string[$i] === "\r") && $this->property_is_next($string, $i + 1) || $i == strlen($string) - 1;
if (csstidy::is_token($string, $i) || $pn) {
if ($string[$i] === '/' && @$string[$i + 1] === '*') {
$this->status = 'ic';