/** * @inheritdoc */ public function decorate($content, ViewInterface $view = null) { $registry = $view->getEngine()->getViewFactory()->getResourcesManager(); foreach ($registry->types() as $type) { $content = preg_replace(self::pattern($type), $registry->render($type), $content); } return $content; }
/** * @inheritdoc */ public function decorate($content, ViewInterface $view = null) { $manager = $view->getEngine()->getViewFactory()->getStringsManager(); foreach ($manager->getKeys() as $key) { $pattern = self::pattern($key); $content = preg_replace($pattern, $manager->render($key), $content); } return $content; }
/** * @inheritdoc */ public function decorate($content, ViewInterface $view = null, $element = null, $class = null) { $userManager = $view->getEngine()->getUserManager(); // TODO This 'manager' should be defined somewhere or perhaps passed in as an argument?? if (!$userManager->isLoggedIn() || !$userManager->getStorage()->hasPrivilege($userManager->getLoggedInUserEmail(), 'manager')) { return $content; } return parent::decorate($content, $element, array('class' => $class ?: 'sitegear-editable')); }
/** * @inheritdoc */ public function decorate($content, ViewInterface $view = null, Request $request = null) { $renderTime = $this->formatTime($view->getEngine()->getTimestamp()); $version = $view->getEngine()->getApplicationInfo()->getSitegearVersionIdentifier(); $userManager = $view->getEngine()->getUserManager(); $comment = sprintf('<!-- %s%s :: %s :: %s -->%s<!-- %s :: %s :: %s -->', $request->getUri(), is_null($view->getEngine()->getEnvironmentInfo()->getEnvironment()) ? '' : sprintf(' :: %s environment', $view->getEngine()->getEnvironmentInfo()->getEnvironment()), $userManager->isLoggedIn() ? 'logged in as ' . ($userManager->getLoggedInUserEmail() ?: 'guest') : 'not logged in', $renderTime, PHP_EOL, $view->getEngine()->getApplicationInfo()->getSitegearHomepage(), $version, $this->formatNow()); LoggerRegistry::log($this->logLevel(), '{pathInfo} {renderTime} by {version}', array('pathInfo' => $request->getPathInfo(), 'renderTime' => $renderTime, 'version' => $version)); return $content . $comment . PHP_EOL; }
/** * @inheritdoc */ public function decorate($content, ViewInterface $view = null, $beginMarker = null, $endMarker = null) { $beginMarker = $beginMarker ?: self::DEFAULT_BEGIN_MARKER; $endMarker = $endMarker ?: self::DEFAULT_END_MARKER; // Only output the comments in development environments if (!$view->getEngine()->getEnvironmentInfo()->isDevMode()) { return $content; } // Determine the spec, which is printed at the beginning and end $spec = array('view'); for ($i = 0, $len = $view->getTargetCount(); $i < $len; ++$i) { $spec[] = $view->getTarget($i); } $spec = implode('.', $spec); // Render and return the result return sprintf('<!-- %s [[ %s ]] --> %s%s<!-- %s [[ %s ]] -->%s', $beginMarker, $spec, PHP_EOL, $content, $endMarker, $spec, PHP_EOL); }