本文整理汇总了PHP中csstidy::parse_string_list方法的典型用法代码示例。如果您正苦于以下问题:PHP csstidy::parse_string_list方法的具体用法?PHP csstidy::parse_string_list怎么用?PHP csstidy::parse_string_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类csstidy
的用法示例。
在下文中一共展示了csstidy::parse_string_list方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quote_font_format
/**
* format() in font-face needs quoted values for somes browser (FF at least)
*
* @param $value
* @return string
*/
function quote_font_format($value)
{
if (strncmp($value, 'format', 6) == 0) {
$p = strrpos($value, ")");
$end = substr($value, $p);
$format_strings = csstidy::parse_string_list(substr($value, 7, $p - 7));
if (!$format_strings) {
$value = "";
} else {
$value = "format(";
foreach ($format_strings as $format_string) {
$value .= '"' . str_replace('"', '\\"', $format_string) . '",';
}
$value = substr($value, 0, -1) . $end;
}
}
return $value;
}
示例2: parse
//.........这里部分代码省略.........
// Quote URLs in imports only if they're not already inside url() and not already quoted.
if (substr($this->sub_value, 0, 4) != 'url(') {
if (!($this->sub_value[0] == substr($this->sub_value, -1) && in_array($this->sub_value[0], array("'", '"')))) {
$this->sub_value = '"' . $this->sub_value . '"';
}
}
}
$this->sub_value_arr[] = $this->sub_value;
$this->import[] = implode(' ', $this->sub_value_arr);
break;
}
$this->sub_value_arr = array();
$this->sub_value = '';
$this->selector = '';
$this->sel_separate = array();
} else {
$this->status = 'ip';
}
} elseif ($string[$i] !== '}') {
$this->sub_value .= $string[$i];
}
if (($string[$i] === '}' || $string[$i] === ';' || $pn) && !empty($this->selector)) {
if ($this->at == '') {
$this->at = $this->css_new_media_section(DEFAULT_AT);
}
// case settings
if ($this->get_cfg('lowercase_s')) {
$this->selector = strtolower($this->selector);
}
$this->property = strtolower($this->property);
$this->optimise->subvalue();
if ($this->sub_value != '') {
if (substr($this->sub_value, 0, 6) == 'format') {
$format_strings = csstidy::parse_string_list(substr($this->sub_value, 7, -1));
if (!$format_strings) {
$this->sub_value = "";
} else {
$this->sub_value = "format(";
foreach ($format_strings as $format_string) {
$this->sub_value .= '"' . str_replace('"', '\\"', $format_string) . '",';
}
$this->sub_value = substr($this->sub_value, 0, -1) . ")";
}
}
if ($this->sub_value != '') {
$this->sub_value_arr[] = $this->sub_value;
}
$this->sub_value = '';
}
$this->value = array_shift($this->sub_value_arr);
while (count($this->sub_value_arr)) {
//$this->value .= (substr($this->value,-1,1)==','?'':' ').array_shift($this->sub_value_arr);
$this->value .= ' ' . array_shift($this->sub_value_arr);
}
$this->optimise->value();
$valid = csstidy::property_is_valid($this->property);
if ((!$this->invalid_at || $this->get_cfg('preserve_css')) && (!$this->get_cfg('discard_invalid_properties') || $valid)) {
$this->css_add_property($this->at, $this->selector, $this->property, $this->value);
$this->_add_token(VALUE, $this->value);
$this->optimise->shorthands();
}
if (!$valid) {
if ($this->get_cfg('discard_invalid_properties')) {
$this->log('Removed invalid property: ' . $this->property, 'Warning');
} else {
$this->log('Invalid property in ' . strtoupper($this->get_cfg('css_level')) . ': ' . $this->property, 'Warning');