Lines Matching refs:snippet

32  * A snippet identifier is a {@link Snippet::getLocalUrl() local file}
64 * Not all snippet comes from a component markup
65 * * a menu item may want to add a snippet on a dynamic page
66 * * a snippet may be added just from the head html meta (for anaytics purpose)
76 const CANONICAL = "snippet";
90 public const SNIPPET_BASE = ":snippet"; // quick internal snippet
99 * With a iife, if the javascript snippet is not critical
133 * @var array - the slots that needs this snippet (as key to get only one snippet by scope)
135 * where a snippet is for the whole requested page
154 * @var bool a property to track if a snippet has already been asked in a html output
156 * We use it to not delete the state of {@link ExecutionContext} in order to check the created snippet
159 * The positive side effect is that even if the snippet is used in multiple markup for a page,
195 * The snippet id is the url for external resources (ie external javascript / stylesheet)
197 * @param string $componentId - the component id is a short id that you will found in the class (for internal snippet, it helps also resolve the file)
234 * @param WikiPath $path - a local path of the snippet (if the path does not exist, a remote url should be given)
250 return StyleAttribute::addComboStrapSuffix("snippet-" . $snippetId);
263 * @param Path $localSnippetPath - the path is the snippet identifier (it's not mandatory that the snippet is locally available
278 $snippet = &$snippets[$snippetGuid];
279 if ($snippet === null) {
280 $snippet = self::createSnippet($localSnippetPath);
290 $snippets[$snippetGuid] = $snippet;
299 $executingFetcher->addSnippet($snippet);
307 $snippet->addElement($wikiId);
318 $snippet->addElement($wikiId);
333 $snippet->addElement($executingId);
335 $snippet->addElement(Snippet::REQUEST_SCOPE);
339 return $snippet;
344 * Create a snippet from the ComboDrive
366 * An utility class to create a snippet from a remote url
369 * should create the snippet via the {@link Snippet::getOrCreateFromLibraryNamespace() local path}
380 $messageFormat = "The following url ($url) does not have a file name. To create a snippet from a remote url, the url should have a path where the last is the name of the library file.";
390 $messageFormat = "The url has a file name ($libraryName) that does not have any extension. To create a snippet from a remote url, the url should have a path where the last is the name of the library file. ";
409 * @param $bool - if the snippet is critical, it would not be deferred or preloaded
415 * If a snippet is critical, it should not be deferred
496 $message = "Unknown snippet type ($extension)";
537 * The class for the snippet is just to be able to identify them
539 * The `snippet` prefix was added to be sure that the class
547 return StyleAttribute::addComboStrapSuffix("snippet-" . $this->getComponentId());
549 LogUtility::internalError("A component id was not found for the snippet ($this)", self::CANONICAL);
550 return StyleAttribute::addComboStrapSuffix("snippet");
558 * All snippet with this component id are from the same component
584 throw new ExceptionCompile("The snippet uri property was not found in the json array");
588 $snippet = Snippet::getOrCreateFromContext($wikiPath);
592 $snippet->setComponentId($componentName);
597 $snippet->setCritical($critical);
602 $snippet->setDoesManipulateTheDomOnRun($async);
607 $snippet->setFormat($format);
612 $snippet->setInlineContent($content);
618 $snippet->addHtmlAttribute($name, $value);
624 $snippet->setIntegrity($integrity);
629 $snippet->setRemoteUrl(Url::createFromString($remoteUrl));
632 return $snippet;
696 LogUtility::internalError("The snippet ($this) is not a inline script, it has a path ($this->path) that does not exists and does not have any external url.");
785 LogUtility::internalError("The component id was not set for the snippet ($this)");
825 * Returns if the internal snippet should be incorporated
852 LogUtility::internalError("The snippet ($this) does not have content defined (the path does not exist, no inline content and no remote url)", self::CANONICAL);
877 LogUtility::internalError("Every snippet should have a last name");
946 // it should not happen as the devs are the creator of snippet (not the user)
981 $message = "The snippet ($this) has already been asked. It may have been added twice to the HTML page";
1001 throw new ExceptionBadState("The internal js snippet ($this) has no content. Skipped", self::CANONICAL);
1042 throw new ExceptionNotFound("The internal css snippet ($this) has no content.", self::CANONICAL);
1090 * to prevent having the snippet two times (one in the head and one in the body)
1114 throw new ExceptionRuntimeInternal("We couldn't output the snippet ($this). Error: {$e->getMessage()}", self::CANONICAL, $e);