53 'showmicrodata' =>
'ShowMicrodata' 63 $registerRTEinJavascriptString =
'';
66 'properties' => array()
69 if (is_array($this->thisConfig[
'schema.']) && is_array($this->thisConfig[
'schema.'][
'sources.'])) {
70 foreach ($this->thisConfig[
'schema.'][
'sources.'] as $source) {
71 $fileName = trim($source);
74 if (!$fileName || !file_exists($absolutePath) || !filesize($absolutePath)) {
75 $fileName =
'EXT:' . $this->ID .
'/extensions/MicrodataSchema/res/schemaOrgAll.rdf';
77 $fileName = $this->htmlAreaRTE->getFullFileName($fileName);
84 uasort($schema[
'types'], array($this,
'compareLabels'));
85 uasort($schema[
'properties'], array($this,
'compareLabels'));
87 if ($this->htmlAreaRTE->is_FE()) {
88 $noSchema =
$GLOBALS[
'TSFE']->getLLL(
'No type', $this->LOCAL_LANG);
89 $noProperty =
$GLOBALS[
'TSFE']->getLLL(
'No property', $this->LOCAL_LANG);
91 $noSchema =
$GLOBALS[
'LANG']->getLL(
'No type');
92 $noProperty =
$GLOBALS[
'LANG']->getLL(
'No property');
94 array_unshift($schema[
'types'], array(
'name' =>
'none',
'label' => $noSchema));
95 array_unshift($schema[
'properties'], array(
'name' =>
'none',
'label' => $noProperty));
97 if ($this->htmlAreaRTE->is_FE()) {
98 $GLOBALS[
'TSFE']->csConvObj->convArray($schema, $this->htmlAreaRTE->outputCharset,
'utf-8');
101 $registerRTEinJavascriptString = LF . TAB .
'RTEarea[editornumber].schemaUrl = "' . ($this->htmlAreaRTE->is_FE() &&
$GLOBALS[
'TSFE']->absRefPrefix ?
$GLOBALS[
'TSFE']->absRefPrefix :
'') . $this->htmlAreaRTE->writeTemporaryFile(
'', (
'schema_' . $this->htmlAreaRTE->language),
'js', json_encode($schema), TRUE) .
'";';
102 return $registerRTEinJavascriptString;
113 return strcoll($a[
'label'], $b[
'label']);
124 $resources = array();
126 $properties = array();
128 $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
130 $document = new \DOMDocument();
131 $document->loadXML($string);
132 libxml_disable_entity_loader($previousValueOfEntityLoader);
135 $items = $document->getElementsByTagName(
'Description');
136 $itemsCount = $items->length;
137 foreach ($items as $item) {
138 $name = $item->getAttribute(
'rdf:about');
139 $type = $item->getElementsByTagName(
'type');
140 if ($name && $type->length) {
141 $type = $type->item(0)->getAttribute(
'rdf:resource');
143 $resource[
'name'] = $name;
144 $labels = $item->getElementsByTagName(
'label');
145 if ($labels->length) {
146 foreach ($labels as $label) {
147 $language = $label->getAttribute(
'xml:lang');
148 if ($language === $this->
language) {
149 $resource[
'label'] = $label->nodeValue;
150 } elseif ($language ===
'en') {
151 $defaultLabel = $label->nodeValue;
154 if (!$resource[
'label']) {
155 $resource[
'label'] = $defaultLabel;
158 $comments = $item->getElementsByTagName(
'comment');
159 if ($comments->length) {
160 foreach ($comments as $comment) {
161 $language = $comment->getAttribute(
'xml:lang');
162 if ($language === $this->
language) {
163 $resource[
'comment'] = $comment->nodeValue;
164 } elseif ($language ===
'en') {
165 $defaultComment = $comment->nodeValue;
168 if (!$resource[
'comment']) {
169 $resource[
'comment'] = $defaultComment;
173 case 'http://www.w3.org/2000/01/rdf-schema#Class':
174 $subClassOfs = $item->getElementsByTagName(
'subClassOf');
175 if ($subClassOfs->length) {
176 foreach ($subClassOfs as $subClassOf) {
177 $resource[
'subClassOf'] = $subClassOf->getAttribute(
'rdf:resource');
181 if (!in_array($resource[
'name'], $types)) {
182 $schema[
'types'][] = $resource;
183 $types[] = $resource[
'name'];
186 case 'http://www.w3.org/1999/02/22-rdf-syntax-ns#Property':
189 $pos = strrpos($resource[
'name'],
'/');
191 $resource[
'name'] = substr($resource[
'name'], $pos + 1);
193 $domains = $item->getElementsByTagName(
'domain');
194 if ($domains->length) {
195 foreach ($domains as $domain) {
196 $resource[
'domain'] = $domain->getAttribute(
'rdf:resource');
199 $ranges = $item->getElementsByTagName(
'range');
200 if ($ranges->length) {
201 foreach ($ranges as $range) {
202 $resource[
'range'] = $range->getAttribute(
'rdf:resource');
206 if (!in_array($resource[
'name'], $properties)) {
207 $schema[
'properties'][] = $resource;
208 $properties[] = $resource[
'name'];
$convertToolbarForHtmlAreaArray
$relativePathToLocallangFile
parseSchema($string, &$schema)
buildJavascriptConfiguration($RTEcounter)
static getUrl($url, $includeHeader=0, $requestHeaders=FALSE, &$report=NULL)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static getFileAbsFileName($filename, $onlyRelative=TRUE, $relToTYPO3_mainDir=FALSE)