本文整理汇总了PHP中CSS::find_at_group方法的典型用法代码示例。如果您正苦于以下问题:PHP CSS::find_at_group方法的具体用法?PHP CSS::find_at_group怎么用?PHP CSS::find_at_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSS
的用法示例。
在下文中一共展示了CSS::find_at_group方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_grid
/**
* The pre-processing function occurs after the importing,
* but before any real processing. This is usually the stage
* where we set variables and the like, getting the css ready
* for processing.
*
* @author Anthony Short
* @param $css
*/
public static function parse_grid()
{
# Find the @grid - this returns an array of 'groups' and 'values'
if ($settings = CSS::find_at_group('grid')) {
# All the @grids
$groups = $settings['groups'];
# Store it so it's easier to grab
$settings = $settings['values'];
# Make sure none of the required options are missing
foreach (array('column-count', 'column-width') as $option) {
if (!isset($settings[$option])) {
throw new Scaffold_Exception('Layout.missing_option', $option);
}
}
# Remove it from the css
CSS::replace($groups, array());
# The number of columns, baseline and unit
$cc = $settings['column-count'];
$unit = isset($settings['unit']) ? $settings['unit'] : 'px';
$bl = isset($settings['baseline']) ? $settings['baseline'] : 18;
$cw = $settings['column-width'];
# Get the gutters
$lgw = isset($settings['left-gutter-width']) ? $settings['left-gutter-width'] : 0;
$rgw = isset($settings['right-gutter-width']) ? $settings['right-gutter-width'] : 0;
# Get the total gutter width
$gw = $settings['gutter-width'] = $lgw + $rgw;
# The total grid width
$grid = ($cw + $gw) * $cc;
$grid_settings = array('column-count' => $cc, 'column-width' => $cw . $unit, 'gutter-width' => $gw . $unit, 'left-gutter-width' => $lgw . $unit, 'right-gutter-width' => $rgw . $unit, 'grid-width' => $grid . $unit, 'baseline' => $bl . $unit);
# Set them as constants we can use in the css
foreach ($grid_settings as $key => $value) {
Constants::set($key, $value);
}
# Make a directory in the cache just for this plugin
if (!is_readable(CACHEPATH . 'Layout')) {
mkdir(CACHEPATH . 'Layout');
}
# Path to the image
$img = CACHEPATH . "Layout/{$lgw}_{$cw}_{$rgw}_{$bl}_grid.png";
# Generate the grid.png
self::create_grid_image($cw, $bl, $lgw, $rgw, $img);
$img = str_replace(DOCROOT, '/', $img);
CSS::append(".showgrid{background:url('" . $img . "');}");
# Round to baselines
self::round_to_baseline($bl);
# Make each of the column variables a member variable
self::$column_count = $cc;
self::$column_width = $cw;
self::$gutter_width = $gw;
self::$left_gutter_width = $lgw;
self::$right_gutter_width = $rgw;
self::$grid_width = $grid;
self::$baseline = $bl;
}
}
示例2: parse
/**
* The pre-processing function occurs after the importing,
* but before any real processing. This is usually the stage
* where we set variables and the like, getting the css ready
* for processing.
*
* @author Anthony Short
* @param $css
*/
public static function parse()
{
# Find the constants group and values
$found = CSS::find_at_group('constants');
# Set the global constants
foreach (CSScaffold::config('core.constants') as $key => $value) {
self::set($key, $value);
}
# If there are some constants, let do it.
if ($found !== false) {
# Sort the constants by length
uksort($found['values'], array('self', 'sortByLength'));
# Create our template style constants
foreach ($found['values'] as $key => $value) {
unset(self::$constants[$key]);
self::set($key, $value);
}
# Remove the @constants groups
CSS::replace($found['groups'], array());
}
}