| @@ 391-416 (lines=26) @@ | ||
| 388 | return $out; |
|
| 389 | } |
|
| 390 | ||
| 391 | protected function multiplyMedia($env, $childQueries = null) { |
|
| 392 | if (is_null($env) || |
|
| 393 | !empty($env->block->type) && $env->block->type != "media") |
|
| 394 | { |
|
| 395 | return $childQueries; |
|
| 396 | } |
|
| 397 | ||
| 398 | // plain old block, skip |
|
| 399 | if (empty($env->block->type)) { |
|
| 400 | return $this->multiplyMedia($env->parent, $childQueries); |
|
| 401 | } |
|
| 402 | ||
| 403 | $out = array(); |
|
| 404 | $queries = $env->block->queries; |
|
| 405 | if (is_null($childQueries)) { |
|
| 406 | $out = $queries; |
|
| 407 | } else { |
|
| 408 | foreach ($queries as $parent) { |
|
| 409 | foreach ($childQueries as $child) { |
|
| 410 | $out[] = array_merge($parent, $child); |
|
| 411 | } |
|
| 412 | } |
|
| 413 | } |
|
| 414 | ||
| 415 | return $this->multiplyMedia($env->parent, $out); |
|
| 416 | } |
|
| 417 | ||
| 418 | protected function expandParentSelectors(&$tag, $replace) { |
|
| 419 | $parts = explode("$&$", $tag); |
|
| @@ 1325-1352 (lines=28) @@ | ||
| 1322 | return $setSelf ? $out : array_merge($parent, $child); |
|
| 1323 | } |
|
| 1324 | ||
| 1325 | protected function multiplyMedia($env, $childQueries = null) { |
|
| 1326 | if (is_null($env) || |
|
| 1327 | !empty($env->block->type) && $env->block->type != "media") |
|
| 1328 | { |
|
| 1329 | return $childQueries; |
|
| 1330 | } |
|
| 1331 | ||
| 1332 | // plain old block, skip |
|
| 1333 | if (empty($env->block->type)) { |
|
| 1334 | return $this->multiplyMedia($env->parent, $childQueries); |
|
| 1335 | } |
|
| 1336 | ||
| 1337 | $parentQueries = $env->block->queryList; |
|
| 1338 | if ($childQueries == null) { |
|
| 1339 | $childQueries = $parentQueries; |
|
| 1340 | } else { |
|
| 1341 | $originalQueries = $childQueries; |
|
| 1342 | $childQueries = array(); |
|
| 1343 | ||
| 1344 | foreach ($parentQueries as $parentQuery){ |
|
| 1345 | foreach ($originalQueries as $childQuery) { |
|
| 1346 | $childQueries []= array_merge($parentQuery, $childQuery); |
|
| 1347 | } |
|
| 1348 | } |
|
| 1349 | } |
|
| 1350 | ||
| 1351 | return $this->multiplyMedia($env->parent, $childQueries); |
|
| 1352 | } |
|
| 1353 | ||
| 1354 | // convert something to list |
|
| 1355 | protected function coerceList($item, $delim = ",") { |
|