Build sitemap builder.

@param string      $basepath Base path
@param string|null $language Language

@return string Generated data
194296
public function build($basepath, $language = null)
    {
        $sitemapElements = [];

        foreach ($this->sitemapElementGenerators as $sitemapElementGenerator) {
            $sitemapElements = array_merge(
                $sitemapElements,
                $sitemapElementGenerator->generateElements($language)
            );
        }

        $data = $this
            ->sitemapRenderer
            ->render($sitemapElements, $basepath);

        return $data;
    }
1023230
protected function getTranslationPathBaseDirectory($base, $lang = null)
    {
        if (empty($lang)) {
            $lang = $this->getLanguage();
        }

        if (!empty($this->pluginName)) {

            if ($base == 'tmp') {
                return sprintf('%s/plugins/%s/lang/%s.json', StaticContainer::get('path.tmp'), $this->pluginName, $lang);
            } else {
                return sprintf('%s/lang/%s.json', Manager::getPluginDirectory($this->pluginName), $lang);
            }
        }

        if ($base == 'tmp') {
            return sprintf('%s/%s.json', StaticContainer::get('path.tmp'), $lang);
        }

        return sprintf('%s/%s/%s.json', PIWIK_INCLUDE_PATH, $base, $lang);
    }
622816
public function generateElements($language = null)
    {
        $sitemapElements = [];
        $transformer = $this->transformer;

        $entities = $this
            ->entitySitemapElementProvider
            ->getEntities();

        if (is_array($entities)) {
            foreach ($entities as $entity) {
                $sitemapElements[] = $this
                    ->sitemapElementFactory
                    ->create(
                        $transformer->getLoc($entity, $language),
                        $transformer->getLastMod($entity, $language),
                        $this->changeFrequency,
                        $this->priority
                    );
            }
        }

        return $sitemapElements;
    }
288727
public function render(array $sitemapElements, $basepath)
    {
        $data = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
        $data .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . PHP_EOL;

        foreach ($sitemapElements as $sitemapElement) {
            $data .= '    <url>' . PHP_EOL;
            $data .= '        <loc>' . $basepath . $sitemapElement->getLocation() . '</loc>' . PHP_EOL;

            $lastModification = $sitemapElement->getLastModification();
            if (null !== $lastModification) {
                $data .= '        <lastmod>' . $lastModification . '</lastmod>' . PHP_EOL;
            }

            $changeFrequency = $sitemapElement->getChangeFrequency();
            if (null !== $changeFrequency) {
                $data .= '        <changefreq>' . $changeFrequency . '</changefreq>' . PHP_EOL;
            }

            $priority = $sitemapElement->getPriority();
            if (null !== $priority) {
                $data .= '        <priority>' . $priority . '</priority>' . PHP_EOL;
            }

            $data .= '    </url>' . PHP_EOL;
        }

        $data .= '</urlset>' . PHP_EOL;

        return $data;
    }
193679
public function basePath($basePath = null)
    {
        if (null === $basePath) {
            return $this->basePath;
        }

        $this->basePath = $basePath;
        return $this;
    }
497206
protected function initBaseDir($basePath)
    {
        if ($basePath) {
            $this->setBaseDir($basePath);
        } elseif (defined('BASE_PATH')) {
            $this->setBaseDir(BASE_PATH);
        } else {
            throw new BadMethodCallException("No BASE_PATH defined");
        }
    }
149983
protected function generateLangEn($namespace, $basePath, ClassMetadata $metadata)
    {
        $entityName = $this->getEntityNameFromMetadata($metadata);
        $entityNamePlural = $entityName.'s';
        $entityNameCamelized = $this->camelize($entityName);
        $yamlFile = $basePath.'/Resources/translations/'.$this->getBundleName().$entityName.'.en.yml';
        $trans = $this->getTrans($yamlFile);

        if (!array_key_exists($entityName, $trans)) {
            $trans[$entityName] = $entityName;
        }
        if (!array_key_exists($entityNamePlural, $trans)) {
            $trans[$entityNamePlural] = $entityNamePlural;
        }

        if (!array_key_exists('link_'.$entityNameCamelized.'_list', $trans['breadcrumb'])) {
            $trans['breadcrumb']['link_'.$entityNameCamelized.'_list'] = $entityName.' List';
        }
        if (!array_key_exists('link_'.$entityNameCamelized.'_show', $trans['breadcrumb'])) {
            $trans['breadcrumb']['link_'.$entityNameCamelized.'_show'] = 'Show '.$entityName;
        }
        if (!array_key_exists('link_'.$entityNameCamelized.'_create', $trans['breadcrumb'])) {
            $trans['breadcrumb']['link_'.$entityNameCamelized.'_create'] = 'Create '.$entityName;
        }
        if (!array_key_exists('link_'.$entityNameCamelized.'_edit', $trans['breadcrumb'])) {
            $trans['breadcrumb']['link_'.$entityNameCamelized.'_edit'] = 'Edit '.$entityName;
        }
        if (!array_key_exists('link_'.$entityNameCamelized.'_delete', $trans['breadcrumb'])) {
            $trans['breadcrumb']['link_'.$entityNameCamelized.'_delete'] = 'Delete '.$entityName;
        }
        if (!array_key_exists('link_'.$entityNameCamelized.'_history', $trans['breadcrumb'])) {
            $trans['breadcrumb']['link_'.$entityNameCamelized.'_history'] = $entityName.' History';
        }

        $fields = array_merge($metadata->fieldMappings, $metadata->associationMappings);
        foreach ($fields as $field) {
            $fieldName = $field['fieldName'];
            $key = $this->camelize($fieldName);
            if (!array_key_exists('label_'.$key, $trans['list'])) {
                $trans['list']['label_'.$key] = $this->toText($fieldName);
            }
            if (!array_key_exists('label_'.$key, $trans['filter'])) {
                $trans['filter']['label_'.$key] = $this->toText($fieldName);
            }
            if (!array_key_exists('label_'.$key, $trans['show'])) {
                $trans['show']['label_'.$key] = $this->toText($fieldName);
            }
            if (!array_key_exists('label_'.$key, $trans['form'])) {
                $trans['form']['label_'.$key] = $this->toText($fieldName);
            }
        }
        $trans['list']['label__action'] = 'Actions';

        $out = Yaml::dump($trans, 4);
        if (file_put_contents($yamlFile, $out) !== false) {
            return sprintf('<info>Update %s</info>', $this->getRelativeFilePath($yamlFile));
        } else {
            return sprintf('<error>Unable to update %s</error>', $this->getRelativeFilePath($yamlFile));
        }
    }
328299
public function findPath($classname, $basepath = null)
    {
        $path = false;

        if (strpos($classname, $this->_prefix) === 0) {
            $word = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $classname));
            $parts = explode('_', $word);

            if (array_shift($parts) == 'tmpl') {
                $name = array_shift($parts);

                $file = array_pop($parts);

                if (!empty($parts)) {
                    if ($parts[0] != 'view') {
                        foreach ($parts as $key => $value) {
                            $parts[$key] = AnInflector::pluralize($value);
                        }
                    } else {
                        $parts[0] = AnInflector::pluralize($parts[0]);
                    }

                    $path = implode('/', $parts).'/'.$file;
                } else {
                    $path = $file;
                }

                $path = $this->_basepath.'/templates/'.$name.'/'.$path.'.php';
            }
        }

        return $path;
    }
1308464
public function basePath(?string $basePath = null) {
        if ($basePath != null) {
            $this->basePath = $basePath;
        }
        return $this->basePath;
    }
681204
public function baseUrl($targetPath = null)
    {
        if (!isset($this->baseUrl)) {
            throw new RuntimeException(sprintf(
                'The base URI is not defined for [%s]',
                get_class($this)
            ));
        }

        if ($targetPath !== null) {
            return $this->createAbsoluteUrl($this->baseUrl, $targetPath);
        }

        return rtrim($this->baseUrl, '/').'/';
    }
1092566
public static function getList($rootPid, $languageId = null)
    {
        $sitemapList = array();
        $pageList    = array();

        $typo3Pids = array();

        $query = 'SELECT ts.*
                    FROM tx_metaseo_sitemap ts
                            INNER JOIN pages p
                              ON    p.uid = ts.page_uid
                                AND p.deleted = 0
                                AND p.hidden = 0
                                AND p.tx_metaseo_is_exclude = 0
                                AND ' . DatabaseUtility::conditionNotIn('p.doktype', self::getDoktypeBlacklist()) . '
                   WHERE ts.page_rootpid = ' . (int)$rootPid . '
                     AND ts.is_blacklisted = 0';

        if ($languageId !== null) {
            $query .= ' AND ts.page_language = ' . (int)$languageId;
        }
        $query .= ' ORDER BY
                        ts.page_depth ASC,
                        p.pid ASC,
                        p.sorting ASC';
        $resultRows = DatabaseUtility::getAll($query);

        if (!$resultRows) {

            return self::getListArray(); //empty
        }

        foreach ($resultRows as $row) {
            $sitemapList[] = $row;

            $sitemapPageId             = $row['page_uid'];
            $typo3Pids[$sitemapPageId] = (int)$sitemapPageId;
        }

        if (!empty($typo3Pids)) {
            $query    = 'SELECT *
                           FROM pages
                          WHERE ' . DatabaseUtility::conditionIn('uid', $typo3Pids);
            $pageList = DatabaseUtility::getAllWithIndex($query, 'uid');

            if (empty($pageList)) {

                return self::getListArray(); //empty
            }
        }

        return self::getListArray($sitemapList, $pageList);
    }
1245723
protected function getMessageFilePath($category, $language)
    {
        $messageFile = $this->aliases->get($this->basePath) . "/$language/";
        if (isset($this->fileMap[$category])) {
            $messageFile .= $this->fileMap[$category];
        } else {
            $messageFile .= str_replace('\\', '/', $category) . '.php';
        }

        return $messageFile;
    }
1295239
protected function getContextBackend( $templatePath = 'admin/jqadm/templates', $withView = true )
	{
		if( !isset( $this->contextBE ) )
		{
			$lang = 'en';
			$site = 'default';

			if( isset( $GLOBALS['BE_USER']->uc['lang'] ) && $GLOBALS['BE_USER']->uc['lang'] != '' ) {
				$lang = $GLOBALS['BE_USER']->uc['lang'];
			}

			if( $this->request->hasArgument( 'lang' )
				&& ( $value = $this->request->getArgument( 'lang' ) ) != ''
			) {
				$lang = $value;
			}

			if( $this->request->hasArgument( 'site' )
				&& ( $value = $this->request->getArgument( 'site' ) ) != ''
			) {
				$site = $value;
			}

			$config = Base::getConfig( (array) $this->settings );
			$context = Base::getContext( $config );

			$locale = Base::getLocaleBackend( $context, $site );
			$context->setLocale( $locale );

			$i18n = Base::getI18n( array( $lang, 'en' ), $config->get( 'i18n', array() ) );
			$context->setI18n( $i18n );

			if( $withView )
			{
				$paths = self::$aimeos->getCustomPaths( $templatePath );
				$view = Base::getView( $context, $this->uriBuilder, $paths, $this->request, $lang, false );
				$context->setView( $view );
			}

			$this->contextBE = $context;
		}

		return $this->contextBE;
	}
295055
public function getRoutesPath($basePath = null)
    {
        $routes = $this->get('routes');
        if (empty($routes)) {
            // Fallback to default
            return $basePath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'routes' . DIRECTORY_SEPARATOR . 'main.php';
        }

        return $basePath . DIRECTORY_SEPARATOR . $routes['base_dir'] . DIRECTORY_SEPARATOR . $routes['base_file'];
    }
1106557
public function language($extension, $basePath = PATH_CORE)
	{
		return App::get('language')->load(strtolower($extension), $basePath);
	}
132434
private function createPackageDefinition($basePath, array $baseUrls, Reference $version)
    {
        if ($basePath && $baseUrls) {
            throw new \LogicException('An asset package cannot have base URLs and base paths.');
        }

        $package = new ChildDefinition($baseUrls ? 'assets.url_package' : 'assets.path_package');
        $package
            ->setPublic(false)
            ->replaceArgument(0, $baseUrls ?: $basePath)
            ->replaceArgument(1, $version)
        ;

        return $package;
    }
18640
protected function createLanguageList($selected, $basePath = JPATH_ROOT)
	{
		$list = array();

		// Cache activation
		$langs = Language::getKnownLanguages($basePath);

		foreach ($langs as $lang => $metadata)
		{
			$option = array();

			$option['text'] = $metadata['name'];
			$option['value'] = $lang;

			if ($lang == $selected)
			{
				$option['selected'] = 'selected="selected"';
			}

			$list[] = $option;
		}

		return $list;
	}