['onPageContentRaw', 0], 'onPageInitialized' => ['onPageInitialized', -10], ]; } /** * Find inline assets in the following format: * * {assets:inline_css} * h1 {color: red !important;} * {/assets} * * {assets:css order:5} * //cdnjs.cloudflare.com/ajax/libs/1140/2.0/1140.css * //cdnjs.cloudflare.com/ajax/libs/1140/2.0/1141.css * //cdnjs.cloudflare.com/ajax/libs/1140/2.0/1142.css * {/assets} * * {assets:js} * //cdnjs.cloudflare.com/ajax/libs/angularFire/0.5.0/angularfire.min.js * {/assets} * * {assets:inline_js} * function initialize() { * var mapCanvas = document.getElementById('map_canvas'); * var mapOptions = { * center: new google.maps.LatLng(44.5403, -78.5463), * zoom: 8, * mapTypeId: google.maps.MapTypeId.ROADMAP * } * var map = new google.maps.Map(mapCanvas, mapOptions); * } * {/assets} * * @param Event $e */ public function onPageContentRaw(Event $e) { if ($this->isAdmin()) { $this->active = false; return; } $page = $e['page']; $config = $this->mergeConfig($page); if ($config->get('enabled')) { $content = $e['page']->getRawContent(); preg_match_all('/(?:
)?{assets(?:\:(.+?))?(?: order:(.+?))?}\s?(.*?)\s?{\/assets}(?:<\/p>)?(?:\n)?/smi', $content, $matches); $count = count($matches[0]); if ($count) { for ($x=0; $x<$count; $x++) { $action = $matches[1][$x] ?: null; $order = $matches[2][$x] ?: null; $data_string = trim(strip_tags($matches[3][$x], '