Map to entries

@param array $typoScriptUrlEntry
@SuppressWarnings(superglobals)
490509
protected function mapToEntries(array $typoScriptUrlEntry)
    {
        if ($typoScriptUrlEntry['table'] && $typoScriptUrlEntry['active'] == 1) {
            $records = $this->getRecordsFromDatabase($typoScriptUrlEntry);
            if ($this->getDatabaseConnection()->sql_num_rows($records)) {
                while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($records)) {
                    $row = $this->hideRecordIfNotTranslated($typoScriptUrlEntry, $row);
                    if (!empty($row)) {
                        /** @var UrlEntry $urlEntry */
                        $urlEntry = GeneralUtility::makeInstance(UrlEntry::class);
                        $urlEntry->setLoc(
                            $this->fieldValueService->getFieldValue('url', $typoScriptUrlEntry, $row)
                        );
                        if (isset($typoScriptUrlEntry['lastmod'])) {
                            $urlEntry->setLastmod(
                                date(
                                    'Y-m-d',
                                    $this->fieldValueService->getFieldValue('lastmod', $typoScriptUrlEntry, $row)
                                )
                            );
                        }
                        if (isset($typoScriptUrlEntry['changefreq'])) {
                            $urlEntry->setChangefreq(
                                $this->fieldValueService->getFieldValue('changefreq', $typoScriptUrlEntry, $row)
                            );
                        }
                        if (isset($typoScriptUrlEntry['priority'])) {
                            $urlEntry->setPriority(
                                number_format(
                                    $this->fieldValueService->getFieldValue('priority', $typoScriptUrlEntry, $row) / 10,
                                    1,
                                    '.',
                                    ''
                                )
                            );
                        }
                        $this->entryStorage->attach($urlEntry);
                    }
                }
            }
        }
    }
716822
private function _applyInjections()
    {
        foreach ($this->injections as $head)
        {
            $tags = $this->_getInjectionString($head);

        }

        $this->template_markup = str_replace('</head>', $tags, $this->template_markup);
    }
423336
public function generateEntriesFromTypoScript()
    {
        $urlEntries = $this->pluginConfig['urlEntries'];
        foreach ($urlEntries as $urlEntry) {
            if (!empty($urlEntry['active'])) {
                $this->mapToEntries($urlEntry);
            }
        }
    }
861399
public function createMapping($contentType)
    {
        $index = $this->client->getIndex($this->indexName);
        $type = $index->getType(self::INDEX_TYPE . $contentType->getContentTypeId());

        $mappingProperties = array(
            'id' => array('type' => 'string', 'include_in_all' => true),
            'elementId' => array('type' => 'string', 'include_in_all' => true),
            'contentId' => array('type' => 'string', 'include_in_all' => true),
            'name' => array('type' => 'string', 'include_in_all' => true),
            'siteId' => array('type' => 'string', 'include_in_all' => true),
            'linkedToSite' => array('type' => 'boolean', 'include_in_all' => false),
            'language' => array('type' => 'string', 'include_in_all' => true),
            'contentType' => array('type' => 'string', 'include_in_all' => true),
            'keywords' => array('type' => 'string', 'include_in_all' => true),
            'updatedAt' => array('type' => 'long', 'include_in_all' => false),
        );

        /** @var FieldTypeInterface $field */
        foreach ($contentType->getFields() as $field) {
            if ($field->isSearchable()) {
                $mappingProperties['attribute_' . $field->getFieldId()] = array('type' => $this->formMapper->map($field->getType()), 'include_in_all' => false);
                $mappingProperties['attribute_' . $field->getFieldId() . '_stringValue'] = array('type' => 'string', 'include_in_all' => true);
            }
        }

        $mapping = $this->mappingFactory->create($type);
        $mapping->setProperties($mappingProperties);
        $mapping->send();
    }
957751
public function mapContent(VersionInfo $versionInfo, $languageCode)
    {
        $contentInfo = $versionInfo->contentInfo;

        return new Content(
            [
                'id' => $contentInfo->id,
                'mainLocationId' => $contentInfo->mainLocationId,
                'name' => $versionInfo->getName($languageCode),
                'languageCode' => $languageCode,
                'innerVersionInfo' => $versionInfo,
                'site' => $this->site,
                'domainObjectMapper' => $this,
                'repository' => $this->repository,
            ]
        );
    }
803587
public function append( $content )
    {
        if (!is_array( $content )) {
            throw new RuntimeException( 'content for PDOWriter should be an array' );
        }

        try {
            $data   = $this->prepareValuesForInsert( $content );
            $writer = $this->prepareWriter( 1 );

            if (!$writer->execute( $data )) {
                throw new RuntimeException( 'Could not write PDO records' );
            }

            $this->incrementLineCount( $this->writer->rowCount() );
        } catch ( Exception $exception ) {
            if ($this->inTransaction) {
                $this->pdo->rollBack();
                $this->inTransaction = false;
            }

            throw $exception;
        }
    }
626419
protected static function getPagingLinks(UriInterface $originalUri, PaginatedDataInterface $data): array
    {
        $links = [
            DocumentInterface::KEYWORD_PREV => null,
            DocumentInterface::KEYWORD_NEXT => null,
        ];

        if ($data->isCollection() === true && (0 < $data->getOffset() || $data->hasMoreItems() === true)) {
            parse_str($originalUri->getQuery(), $queryParams);

            $pageSize    = $data->getLimit();
            $linkClosure = function (int $offset) use ($originalUri, $pageSize, $queryParams): UriInterface {
                $paramsWithPaging = array_merge($queryParams, [
                    BaseQueryParserInterface::PARAM_PAGE => [
                        JsonApiQueryValidatingParserInterface::PARAM_PAGING_OFFSET => $offset,
                        JsonApiQueryValidatingParserInterface::PARAM_PAGING_LIMIT  => $pageSize,
                    ],
                ]);

                $paginatedUri = $originalUri->withQuery(http_build_query($paramsWithPaging));

                return $paginatedUri;
            };

            if ($data->getOffset() > 0) {
                $prevOffset                             = max(0, $data->getOffset() - $data->getLimit());
                $links[DocumentInterface::KEYWORD_PREV] = $linkClosure($prevOffset);
            }
            if ($data->hasMoreItems() === true) {
                $nextOffset                             = $data->getOffset() + $data->getLimit();
                $links[DocumentInterface::KEYWORD_NEXT] = $linkClosure($nextOffset);
            }
        }

        return $links;
    }
955228
public function mapFields(Content $content, $languageCode)
    {
        $fieldsGrouped = [[]];
        $contentType = $this->contentTypeHandler->load(
            $content->versionInfo->contentInfo->contentTypeId
        );

        foreach ($content->fields as $field) {
            if ($field->languageCode !== $languageCode) {
                continue;
            }

            $fieldsGrouped[] = $this->mapField($contentType, $field);
        }

        return array_merge(...$fieldsGrouped);
    }
965777
private function getNumberOfSitemap(array $urlEntries)
    {
        $total = count($urlEntries);

        if ($total <= $this->maxPerSitemap) {
            return 1;
        }

        return intval(ceil($total / $this->maxPerSitemap));
    }
388588
public function setUrl(PHPCrawlerURLDescriptor $UrlDescriptor)
  {
    $this->UrlDescriptor = $UrlDescriptor;
    
    // Split the URL into its parts
    $this->url_parts = PHPCrawlerUtils::splitURL($UrlDescriptor->url_rebuild);
  }
1243285
public function addSqlResultSetMapping(array $resultMapping)
    {
        if (!isset($resultMapping['name'])) {
            throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->name);
        }

        if (isset($this->sqlResultSetMappings[$resultMapping['name']])) {
            throw MappingException::duplicateResultSetMapping($this->name, $resultMapping['name']);
        }

        if (isset($resultMapping['entities'])) {
            foreach ($resultMapping['entities'] as $key => $entityResult) {
                if (!isset($entityResult['entityClass'])) {
                    throw MappingException::missingResultSetMappingEntity($this->name, $resultMapping['name']);
                }

                $entityResult['isSelfClass'] = false;
                if ($entityResult['entityClass'] === '__CLASS__') {

                    $entityResult['isSelfClass'] = true;
                    $entityResult['entityClass'] = $this->name;

                }

                $entityResult['entityClass'] = $this->fullyQualifiedClassName($entityResult['entityClass']);

                $resultMapping['entities'][$key]['entityClass'] = ltrim($entityResult['entityClass'], '\\');
                $resultMapping['entities'][$key]['isSelfClass'] = $entityResult['isSelfClass'];

                if (isset($entityResult['fields'])) {
                    foreach ($entityResult['fields'] as $k => $field) {
                        if (!isset($field['name'])) {
                            throw MappingException::missingResultSetMappingFieldName($this->name, $resultMapping['name']);
                        }

                        if (!isset($field['column'])) {
                            $fieldName = $field['name'];
                            if (strpos($fieldName, '.')) {
                                list(, $fieldName) = explode('.', $fieldName);
                            }

                            $resultMapping['entities'][$key]['fields'][$k]['column'] = $fieldName;
                        }
                    }
                }
            }
        }

        $this->sqlResultSetMappings[$resultMapping['name']] = $resultMapping;
    }
1123360
public function getForm($pathOrContent, array $vars = array(), $cache = false) {
        $formClass = $this->formClass;

        return $this->inject(new $formClass($pathOrContent, $vars, $cache, $this));
    }
633048
public function renderEntryElementMap(array &$context)
	{
		$map = $this->renderer->getElementMap($context['entry']['id'], $context['site']['id']);
		return $this->renderMap($map);
	}
241944
function() {
	var mappables = ["script" , "style"]
	for(var m in mappables) {
	  var which = mappables[m]
	  if($vars[which+'s']) {//if we have $vars["scripts"] or $vars["styles"]
		var page_scripts = $vars[which+'s'];
		var map_json = JSON.parse(fs.readFileSync($data_dir + "/common/"+which+"-mapping.json"));
		var mapped_scripts = [];
		for(var i in page_scripts) {
			if(page_scripts[i] in map_json) {
				if(typeof map_json[page_scripts[i]] == "string") mapped_scripts.push(map_json[page_scripts[i]])
				else if(typeof map_json[page_scripts[i]] == "object") //two or more scripts should be included for this to work, like dataTables, jQuery UI, etc ...
				{
					for(var m in map_json[page_scripts[i]])
						mapped_scripts.push(map_json[page_scripts[i]][m])
				}
			}
		}
		$vars[which+'s'] = mapped_scripts;

		if(('ie_'+which+'s') in $vars) {
			var ie_scripts = $vars['ie_'+which+'s'];//ie_scripts || ie_styles
			var ie_mapped_scripts = [];
			for(var i in ie_scripts) if(map_json[ie_scripts[i].name])
			{
				ie_mapped_scripts.push({"version" : ie_scripts[i].version , "file_name" : map_json[ie_scripts[i].name]})
			}

			$vars['ie_'+which+'s'] = ie_mapped_scripts
		}
	  }
	}
 }
1287846
protected static <T> T callClosureForMapEntry(Closure<T> closure, Map.Entry entry) {
        if (closure.getMaximumNumberOfParameters() == 2) {
            return closure.call(new Object[]{entry.getKey(), entry.getValue()});
        }
        return closure.call(entry);
    }
1286365
public function frequentlySearchedAction()
    {
        /** @var  $searchResultSet SearchResultSet */
        $searchResultSet = GeneralUtility::makeInstance(SearchResultSet::class);

        $pageId = $this->typoScriptFrontendController->getRequestedId();
        $languageId = $this->typoScriptFrontendController->sys_language_uid;
        $searchRequest = $this->getSearchRequestBuilder()->buildForFrequentSearches($pageId, $languageId);
        $searchResultSet->setUsedSearchRequest($searchRequest);

        $this->controllerContext->setSearchResultSet($searchResultSet);

        $values = [
            'additionalFilters' => $this->getAdditionalFilters(),
            'resultSet' => $searchResultSet
        ];
        $values = $this->emitActionSignal(__CLASS__, __FUNCTION__, [$values]);

        $this->view->assignMultiple($values);
    }
1185987
public function writeUrlElements(QueryResult $entryObjects)
    {
        $urls = new ODataURLCollection();
        if (!empty($entryObjects->results)) {
            $i = 0;
            foreach ($entryObjects->results as $entryObject) {
                if (!$entryObject instanceof QueryResult) {
                    $query = new QueryResult();
                    $query->results = $entryObject;
                } else {
                    $query = $entryObject;
                }
                $urls->urls[$i] = $this->writeUrlElement($query);
                ++$i;
            }

            if ($i > 0 && true === $entryObjects->hasMore) {
                $stackSegment = $this->getRequest()->getTargetResourceSetWrapper()->getName();
                $lastObject = end($entryObjects->results);
                $segment = $this->getNextLinkUri($lastObject);
                $nextLink = new ODataLink();
                $nextLink->name = ODataConstants::ATOM_LINK_NEXT_ATTRIBUTE_STRING;
                $nextLink->url = rtrim($this->absoluteServiceUri, '/') . '/' . $stackSegment . $segment;
                $urls->nextPageLink = $nextLink;
            }
        }

        if ($this->getRequest()->queryType == QueryType::ENTITIES_WITH_COUNT()) {
            $urls->count = $this->getRequest()->getCountValue();
        }

        return $urls;
    }