17 $def = $config->getCSSDefinition();
18 $this->info[
'background-color'] = $def->info[
'background-color'];
19 $this->info[
'background-image'] = $def->info[
'background-image'];
20 $this->info[
'background-repeat'] = $def->info[
'background-repeat'];
21 $this->info[
'background-attachment'] = $def->info[
'background-attachment'];
22 $this->info[
'background-position'] = $def->info[
'background-position'];
25 public function validate($string, $config, $context) {
29 if ($string ===
'')
return false;
35 $bits = explode(
' ', strtolower($string));
38 $caught[
'color'] =
false;
39 $caught[
'image'] =
false;
40 $caught[
'repeat'] =
false;
41 $caught[
'attachment'] =
false;
42 $caught[
'position'] =
false;
47 foreach ($bits as $bit) {
48 if ($bit ===
'')
continue;
49 foreach ($caught as $key => $status) {
50 if ($key !=
'position') {
51 if ($status !==
false)
continue;
52 $r = $this->info[
'background-' . $key]->validate($bit, $config, $context);
56 if ($r ===
false)
continue;
57 if ($key ==
'position') {
58 if ($caught[$key] ===
false) $caught[$key] =
'';
59 $caught[$key] .= $r .
' ';
68 if (!$i)
return false;
69 if ($caught[
'position'] !==
false) {
70 $caught[
'position'] = $this->info[
'background-position']->
71 validate($caught[
'position'], $config, $context);
75 foreach ($caught as $value) {
76 if ($value ===
false)
continue;
80 if (empty(
$ret))
return false;
81 return implode(
' ',
$ret);