Ejemplo n.º 1
0
 private function _findUserManifestPaths($userPath)
 {
     $userContentDir = $this->_bootSettings->getUserContentDirectory();
     $userContributablesDir = $userContentDir . $userPath;
     $userContributables = $this->__findManifestPathsInDirectory($userContributablesDir);
     return $userContributables;
 }
Ejemplo n.º 2
0
 private function _findUserLegacyThemes(tubepress_api_boot_BootSettingsInterface $bootSettings, tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     $userThemeDir = $bootSettings->getUserContentDirectory() . '/themes';
     if (!is_dir($userThemeDir)) {
         return array();
     }
     /**
      * @var tubepress_internal_finder_FinderFactory
      */
     $finderFactory = $containerBuilder->get('finder_factory');
     $finder = $finderFactory->createFinder()->directories()->in($userThemeDir)->depth('< 1');
     $toReturn = array();
     /**
      * @var SplFileInfo
      */
     foreach ($finder as $candidateLegacyThemeDir) {
         $themeRoot = "{$candidateLegacyThemeDir}";
         $baseName = basename($themeRoot);
         if ($baseName === 'starter') {
             /*
              * Ignore the starter theme.
              */
             continue;
         }
         if (is_file("{$themeRoot}/theme.json")) {
             continue;
         }
         /**
          * @var tubepress_internal_boot_helper_uncached_contrib_ThemeFactory
          */
         $themeFactory = $containerBuilder->get('tubepress_internal_boot_helper_uncached_contrib_ThemeFactory');
         $templateMap = $this->_getTemplateMapForLegacyDirectory($containerBuilder, $themeRoot);
         $manifestPath = $bootSettings->getPathToSystemCacheDirectory() . DIRECTORY_SEPARATOR . 'foobar';
         $manifestData = array('name' => "unknown/legacy-{$baseName}", 'version' => '1.0.0', 'title' => "{$baseName} (legacy)", 'authors' => array(array('name' => 'Unknown')), 'license' => array('type' => 'MPL-2.0', 'urls' => array('http://www.mozilla.org/MPL/2.0/')), 'description' => "TubePress 3.x.x theme auto-generated from {$themeRoot}");
         $theme = $themeFactory->fromManifestData($manifestPath, $manifestData);
         if (!$theme instanceof tubepress_internal_theme_FilesystemTheme) {
             continue;
         }
         $theme->setParentThemeName('tubepress/legacy-default');
         $theme->setTemplateNamesToAbsPathsMap($templateMap);
         $theme->setManifestPath($manifestPath);
         $toReturn[] = $theme;
     }
     return $toReturn;
 }