本文整理汇总了PHP中CSS::find_selectors方法的典型用法代码示例。如果您正苦于以下问题:PHP CSS::find_selectors方法的具体用法?PHP CSS::find_selectors怎么用?PHP CSS::find_selectors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSS
的用法示例。
在下文中一共展示了CSS::find_selectors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
/**
* The main processing function called by Scaffold. MUST return $css!
*
* @author Anthony Short
* @return $css string
*/
public static function parse()
{
global $bases;
# This will store our nicely formated bases array
# This lets us loop through all the of +mixins and just
# pull in the properties of that mixin and then parse it individually
# based on the parameters
$bases = array();
# Finds any selectors starting with =mixin-name
if ($found = CSS::find_selectors('\\=(?P<name>[0-9a-zA-Z_-]*)(\\((?P<args>.*?)\\))?', 5)) {
# Just to make life a little easier
$full_base = $found[0];
$base_names = $found['name'];
$base_args = $found['args'];
$base_props = $found['properties'];
# Clean up memory
unset($found);
# Puts the mixin bases into a more suitable array
foreach ($base_names as $key => $value) {
$bases[$value]['properties'] = $base_props[$key];
# If there are mixin arguments, add them
$bases[$value]['params'] = $base_args[$key] != "" ? explode(',', $base_args[$key]) : array();
}
# Store this away for debugging
self::$mixins = $bases;
# Remove all of the mixin bases
CSS::remove($full_base);
# Clean up memory
unset($full_base, $base_names, $base_args, $base_props);
# Find the mixins
if ($mixins = self::find_mixins(CSS::$css)) {
# Loop through each of the found +mixins
foreach ($mixins[2] as $mixin_key => $mixin_name) {
CSS::replace($mixins[0][$mixin_key], self::build_mixins($mixin_key, $mixins));
}
# Remove all of the +mixins (if they still exist)
CSS::replace($mixins[0], '');
}
# Clean up
unset($bases, $mixins);
}
}