Esempio n. 1
0
 public function registerBundles()
 {
     $bundles = array(new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle($this), new Nelmio\ApiDocBundle\NelmioApiDocBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new Oneup\UploaderBundle\OneupUploaderBundle(), new Liip\ImagineBundle\LiipImagineBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new FOS\ElasticaBundle\FOSElasticaBundle(), new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(), new Problematic\AclManagerBundle\ProblematicAclManagerBundle(), new JMS\DiExtraBundle\JMSDiExtraBundle($this), new JMS\AopBundle\JMSAopBundle(), new APY\DataGridBundle\APYDataGridBundle(), new PUGX\AutocompleterBundle\PUGXAutocompleterBundle(), new SC\DatetimepickerBundle\SCDatetimepickerBundle(), new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(), new Prezent\Doctrine\TranslatableBundle\PrezentDoctrineTranslatableBundle(), new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new Norzechowicz\AceEditorBundle\NorzechowiczAceEditorBundle(), new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), new Jb\Bundle\FileUploaderBundle\JbFileUploaderBundle(), new Okulbilisim\OjsToolsBundle\OkulbilisimOjsToolsBundle(), new Okulbilisim\FeedbackBundle\OkulbilisimFeedbackBundle(), new Ojs\CoreBundle\OjsCoreBundle(), new Ojs\SiteBundle\OjsSiteBundle(), new Ojs\AdminBundle\OjsAdminBundle(), new Ojs\SearchBundle\OjsSearchBundle(), new Ojs\ApiBundle\OjsApiBundle(), new Ojs\CliBundle\OjsCliBundle(), new Ojs\JournalBundle\OjsJournalBundle(), new Ojs\UserBundle\OjsUserBundle(), new Ojs\OAIBundle\OjsOAIBundle(), new Ojs\LocationBundle\OjsLocationBundle(), new Ojs\InstallerBundle\OjsInstallerBundle(), new Ojs\CmsBundle\OjsCmsBundle(), new FOS\UserBundle\FOSUserBundle(), new Ojs\AnalyticsBundle\OjsAnalyticsBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new JMS\TranslationBundle\JMSTranslationBundle());
     if (in_array($this->getEnvironment(), array('dev', 'test'))) {
         $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
         $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
         $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
         $bundles[] = new h4cc\AliceFixturesBundle\h4ccAliceFixturesBundle();
     }
     $thirdPartyDir = __DIR__ . '/../thirdparty';
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     if ($fs->exists($thirdPartyDir)) {
         $finder = new \Symfony\Component\Finder\Finder();
         $finder->files()->in($thirdPartyDir);
         foreach ($finder as $file) {
             /** @var \Symfony\Component\Finder\SplFileInfo $file */
             $bundleConfig = json_decode(file_get_contents($file->getRealpath()), true);
             if ($bundleConfig) {
                 if (isset($bundleConfig['extra']) && isset($bundleConfig['extra']['bundle-class'])) {
                     if (class_exists($bundleConfig['extra']['bundle-class'])) {
                         $bundles[] = new $bundleConfig['extra']['bundle-class']();
                     }
                 }
             }
         }
     }
     return $bundles;
 }
 /**
  * @see Command
  * @codeCoverageIgnore
  *
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $themeName = $input->getArgument('theme');
     $kernel = $this->getContainer()->get('kernel');
     $themePath = $kernel->locateResource('@' . $themeName);
     $slots = array();
     $finder = new \Symfony\Component\Finder\Finder();
     $templateFiles = $finder->files('*.twig')->in($themePath . '/Resources/views/Theme');
     foreach ($templateFiles as $template) {
         $template = (string) $template;
         $templateContents = file_get_contents($template);
         $currentTemplateContents = $templateContents;
         preg_match_all('/([^%]+)[^\\w]+BEGIN-SLOT.*?\\{% endblock[^%\\}]+%\\}/si', $templateContents, $matches, PREG_SET_ORDER);
         foreach ($matches as $match) {
             $block = '{%' . $match[0];
             $blockName = trim(str_replace('block ', '', $match[1]));
             $currentTemplateContents = str_replace($block, "{{ block('{$blockName}') }}", $currentTemplateContents);
             preg_match('/([\\r\\n][\\s]+)\\{# BEGIN-SLOT/', $block, $spacesMatch);
             if (array_key_exists(1, $spacesMatch)) {
                 $block = str_replace($spacesMatch[1], "\n    ", $block);
                 $block = preg_replace('/([\\r\\n][\\s]+)\\{% endblock/', "\n{% endblock", $block);
             }
             $slots[] = $block;
         }
         $useStatement = "{% use '{$themeName}:Slots:slots.html.twig' %}\n";
         preg_match('/\\{% extend[^\\}]+\\}/', $currentTemplateContents, $m);
         $currentTemplateContents = array_key_exists(0, $m) ? str_replace($m[0], $m[0] . "\n\n" . $useStatement, $currentTemplateContents) : ($currentTemplateContents = $useStatement . $currentTemplateContents);
         file_put_contents($template, $currentTemplateContents);
     }
     $slotsDir = $themePath . '/Resources/views/Slots';
     @mkdir($slotsDir);
     file_put_contents($slotsDir . '/slots.html.twig', implode("\n\n", $slots));
     $message = sprintf('The theme <info>%s</info> has been migrated', $themeName);
     $output->writeln($message);
 }
Esempio n. 3
0
 public static function getRoutes($path)
 {
     $routes = new \Symfony\Component\Routing\RouteCollection();
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->name('*.php');
     $finder->files()->in($path);
     if (!$finder->count()) {
         throw new Exception('No routes found in ' . $path);
     }
     foreach ($finder as $entry) {
         $route_path = $entry->getRelativePath();
         $basename = $entry->getBasename('.php');
         $cleaned = str_replace('/', '_', str_replace('-', '_', $route_path . $basename));
         $route = $route_path . ($basename === 'index' ? '' : '/' . $basename);
         /*
                    if (strrchr($route, '-')) {
                        $sluglen = strlen(strrchr($route, '-'));
                        $route2 = substr($route, 0, strlen($route) - $sluglen + 1) . '{slug}';
                        $basename2 = substr($basename, 0, $basename - $sluglen + 1);
                    } else {
                        $route2 = $route;
                        $basename2 = $basename;
                    }
         */
         $routes->add($cleaned, new \Symfony\Component\Routing\Route($route, ['_controller' => 'build', 'php_file' => $entry->getRealPath(), 'file_root' => $route_path . '/' . $basename, 'name' => '.+']));
         $routes->add('slash' . $cleaned, new \Symfony\Component\Routing\Route($route . '/', ['_controller' => 'build', 'php_file' => $entry->getRealPath(), 'file_root' => $route_path . '/' . $basename, 'name' => '.+']));
     }
     return $routes;
 }
Esempio n. 4
0
 /**
  * Creates release zip
  *
  * @param string $version
  */
 public function makeRelease($version = '')
 {
     if (empty($version)) {
         $version = $this->versionGet();
     }
     $name = basename(__DIR__);
     $this->taskFileSystemStack()->mkdir('release')->run();
     $this->taskCleanDir('release')->run();
     $this->taskExec('composer')->dir(__DIR__ . '/release')->arg("create-project rarst/{$name} {$name} " . $version)->arg('--prefer-dist --no-dev')->run();
     $this->taskExec('composer')->dir(__DIR__ . "/release/{$name}")->arg('dump-autoload --optimize')->run();
     $zipFile = "release/{$name}-{$version}.zip";
     $zipArchive = new ZipArchive();
     if (!$zipArchive->open($zipFile, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE)) {
         die("Failed to create archive\n");
     }
     $finder = new Symfony\Component\Finder\Finder();
     $finder->files()->in("release/{$name}")->ignoreDotFiles(false);
     /** @var \Symfony\Component\Finder\SplFileInfo $file */
     foreach ($finder as $file) {
         $zipArchive->addFile($file->getRealPath(), "{$name}/" . $file->getRelativePathname());
     }
     if (!$zipArchive->status === ZIPARCHIVE::ER_OK) {
         echo "Failed to write files to zip\n";
     }
     $zipArchive->close();
     $this->taskDeleteDir("release/{$name}")->run();
 }
Esempio n. 5
0
 public function testCreateMapFinderSupport()
 {
     if (!class_exists('Symfony\\Component\\Finder\\Finder')) {
         $this->markTestSkipped('Finder component is not available');
     }
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->in(__DIR__ . '/Fixtures/beta/NamespaceCollision');
     $this->assertEqualsNormalized(array('NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__) . '/Fixtures/beta/NamespaceCollision/A/B/Bar.php', 'NamespaceCollision\\A\\B\\Foo' => realpath(__DIR__) . '/Fixtures/beta/NamespaceCollision/A/B/Foo.php'), ClassMapGenerator::createMap($finder));
 }
Esempio n. 6
0
 /**
  * @return array
  */
 public function dataProvider()
 {
     $data = [];
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->name('*.md')->in(__DIR__ . self::DIRECTORY);
     foreach ($finder as $file) {
         $data[] = [$file->getFilename(), str_replace('.md', '.html', $file->getFilename())];
     }
     return $data;
 }
 /**
  * {@inheritdoc}
  */
 public function find($directories)
 {
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->in($directories);
     $return = [];
     foreach ($finder as $file) {
         $return[] = $file;
     }
     return $return;
 }
Esempio n. 8
0
 public function prepare(\Silex\Application $app, $locale)
 {
     $templatesPath = APP_DIR . '/templates';
     $untranslatedMessagesFile = APP_DIR . '/locales/' . $locale . '_untranslated.yml';
     $extractor = new \Symfony\Bridge\Twig\Translation\TwigExtractor($app['twig']);
     /***** All translations *****/
     $catalogueAll = new \Symfony\Component\Translation\MessageCatalogue($locale);
     $extractor->extract($templatesPath, $catalogueAll);
     $allMessages = $catalogueAll->all('messages');
     // String from controller, controller provider, etc.
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->in(ROOT_DIR . '/src');
     foreach ($finder as $file) {
         $fileMessageStrings = array();
         $filePath = $file->getRealpath();
         $fileContent = file_get_contents($filePath);
         $pregMatch = "#->trans.*\\(\\s*'(.+?)(?=')#m";
         preg_match_all($pregMatch, $fileContent, $matches);
         $matches = $matches[1];
         if ($matches) {
             foreach ($matches as $match) {
                 $fileMessageStrings[] = $match;
             }
         }
         if ($fileMessageStrings) {
             foreach ($fileMessageStrings as $fileMessageString) {
                 if (!isset($allMessages[$fileMessageString])) {
                     $allMessages[$fileMessageString] = $fileMessageString;
                 }
             }
         }
     }
     /***** Already translated *****/
     $app['application.translator']->setLocale($locale, $ignoreUntranslated = true);
     $translatedMessages = $app['translator']->getMessages($locale);
     $translatedMessages = $translatedMessages['messages'];
     /***** Untranslated *****/
     $untranslatedMessages = array();
     if ($allMessages) {
         foreach ($allMessages as $singleMessageKey => $singleMessage) {
             if (!isset($translatedMessages[$singleMessageKey])) {
                 $untranslatedMessages[$singleMessageKey] = $singleMessage;
             }
         }
     }
     if (!empty($untranslatedMessages)) {
         $dumper = new \Symfony\Component\Yaml\Dumper();
         $yaml = $dumper->dump($untranslatedMessages, 1);
         if (file_exists($untranslatedMessagesFile)) {
             unlink($untranslatedMessagesFile);
         }
         file_put_contents($untranslatedMessagesFile, $yaml);
     }
     return array('allMessages' => $allMessages, 'translatedMessages' => $translatedMessages, 'untranslatedMessages' => $untranslatedMessages);
 }
 /**
  * @return $this
  */
 public function clearTheReportsDir()
 {
     $reportsDir = codecept_data_dir('actual');
     if (is_dir($reportsDir)) {
         $finder = new \Symfony\Component\Finder\Finder();
         $finder->in($reportsDir);
         foreach ($finder->files() as $file) {
             unlink($file->getPathname());
         }
     }
     return $this;
 }
Esempio n. 10
0
 /**
  * @\Nucleus\IService\EventDispatcher\Listen("ServiceContainer.warmUp")
  */
 public function warmUp()
 {
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->name('*.twig')->in($this->fileSystemLoader->getPaths());
     foreach ($finder as $file) {
         $fileName = $file->getRelativePathname();
         $this->generateCacheFile($fileName);
         if (strpos($fileName, DIRECTORY_SEPARATOR) !== 0) {
             $this->generateCacheFile(DIRECTORY_SEPARATOR . $fileName);
         }
     }
 }
Esempio n. 11
0
 /**
  * Tests that the solver doesn't come to false conclusions
  *
  * Verifies only that all cells marked by the solver correspond to the actual solution
  * Does *not* check that the solver solved all cells (unknown cells are skipped)
  * @test
  */
 public function testSolverAllDataProvider()
 {
     $rootDir = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..') . DIRECTORY_SEPARATOR;
     $filePathFull = $rootDir . 'data' . DIRECTORY_SEPARATOR . 'Levels' . DIRECTORY_SEPARATOR;
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->in($filePathFull)->name('*.dat')->notName('sunflower_25x25.dat');
     $levelList = array();
     foreach ($finder as $file) {
         $levelFullPath = $file->getRealpath();
         $levelList[] = array(substr_replace($levelFullPath, '', strrpos($levelFullPath, '.')));
     }
     return $levelList;
 }
 protected function _compareTemplateFiles()
 {
     $themeTemplateDirectory = $this->_magentoInstanceRootDirectory . '/app/design/frontend/' . $this->_currentTheme . '/template';
     $finder = new \Symfony\Component\Finder\Finder();
     $iterator = $finder->files()->name('*.phtml')->in($themeTemplateDirectory);
     foreach ($iterator as $file) {
         $comparisonItem = new \KJ\Magento\Util\ThemeComparison\TemplateItem($file);
         $comparisonItem->setComparison($this);
         if ($comparisonItem->fileToCompareAgainstExists()) {
             $this->_changedTemplateFiles[] = $comparisonItem;
         }
     }
     return $this;
 }
Esempio n. 13
0
 protected function getPluginsBundlesClassNames()
 {
     $list = array();
     $path = __DIR__ . '/../plugins';
     if (!file_exists($path)) {
         return [];
     }
     $finder = new \Symfony\Component\Finder\Finder();
     $files = $finder->files()->in($path)->name('*Bundle.php');
     foreach ($files as $file) {
         $relativePathName = $file->getRelativePathName();
         $classPath = str_replace('.php', '', $relativePathName);
         $classPath = str_replace('/', '\\', $classPath);
         $list[] = $classPath;
     }
     return $list;
 }
Esempio n. 14
0
 public static function convert(GinnyInput $input)
 {
     $path = $input->getOption('schema_path');
     $parser = new \Symfony\Component\Yaml\Parser();
     if (is_dir($path)) {
         $data['name'] = $input->getOption('bundle');
         $data['namespace'] = $input->getOption('namespace');
         $data['models'] = [];
         $data['associations'] = [];
         $data['manyToManys'] = [];
         $schema_filename = $input->getOption('schema_filename');
         if (empty($schema_filename)) {
             $filenames = [];
             $finder = new \Symfony\Component\Finder\Finder();
             $finder->files()->in($input->getFullSchemaPath());
             foreach ($finder as $file) {
                 if ($file->getFilename() != 'ginny.yml') {
                     $filenames[] = $file->getFilename();
                 }
             }
         } else {
             $filenames = explode(',', $schema_filename);
         }
         foreach ($filenames as $filename) {
             $file = $parser->parse(file_get_contents($path . $filename));
             if (!empty($file['model'])) {
                 $defaults = ['name' => '', 'description' => ''];
                 $model = array_merge($defaults, $file['model']);
                 $defaults = ['name' => '', 'type' => '', 'size' => '', 'default' => false, 'required' => false, 'unique' => false, 'primary' => false, 'autoIncrement' => false];
                 foreach ($model['fields'] as $n => $field) {
                     $model['fields'][$n] = array_merge($defaults, $field);
                 }
                 $data['models'][] = $model;
             }
             if (!empty($file['associations'])) {
                 $data['associations'] = array_merge($data['associations'], $file['associations']);
             }
             if (!empty($file['manyToManys'])) {
                 $data['manyToManys'] = array_merge($data['manyToManys'], $file['manyToManys']);
             }
         }
         return ['bundles' => [$data]];
     }
     echo 'booger!';
     exit;
 }
 /**
  * @param       $directory
  * @param array $exclude
  * @param array $pattern
  *
  * @return Translations
  */
 public function fromDirectory($directory, $translations = null, $exclude = ['languages'], $pattern = ['*.php', '*.phtml'])
 {
     if (!$translations) {
         $translations = new Translations();
     }
     // fetch strings
     $sourcesFinder = new \Symfony\Component\Finder\Finder();
     $sourcesFinder->files()->in($directory)->exclude($exclude);
     foreach ($pattern as $filePattern) {
         $sourcesFinder->name($filePattern);
     }
     $sourcesList = iterator_to_array($sourcesFinder->getIterator());
     $sourcesList = array_map('strval', $sourcesList);
     foreach ($sourcesList as $sourceFile) {
         $this->fromFile($sourceFile, $translations);
     }
     return $translations;
 }
Esempio n. 16
0
 public function __construct(array $values = [])
 {
     parent::__construct($values);
     // $this['debug'] = TRUE;
     // Default values
     $values += ['templates' => 'templates', 'data' => 'data', 'content' => 'content', 'twig.options' => ['strict_variables' => FALSE]];
     if ($values['debug']) {
         $this['debug'] = TRUE;
         $values['twig.options']['debug'] = TRUE;
     }
     $this->register(new \Silex\Provider\TwigServiceProvider(), array('twig.path' => $values['templates'], 'twig.options' => $values['twig.options']));
     if ($this['debug']) {
         $this['twig']->addExtension(new \Twig_Extension_Debug());
     }
     $yaml = new \Symfony\Component\Yaml\Parser();
     // Load all data files
     if (file_exists($values['data'])) {
         $finder = new \Symfony\Component\Finder\Finder();
         $finder->files()->in($values['data'])->name('*.yml');
         foreach ($finder as $file) {
             $data = $yaml->parse($file->getContents());
             $this['twig']->addGlobal($file->getBasename('.yml'), $data);
         }
     }
     // Load all sample content
     $content = [];
     if (file_exists($values['content'])) {
         $finder = new \Symfony\Component\Finder\Finder();
         $finder->files()->in($values['content'] . '/*')->name('*.md');
         foreach ($finder as $file) {
             list(, $data, $body) = explode("---\n", $file->getContents());
             $data = $yaml->parse($data);
             $data['content'] = \Michelf\Markdown::defaultTransform($body);
             $content[basename(dirname($file->getPathname()))][] = $data;
             $content[basename(dirname($file->getPathname()))][$file->getBasename('.md')] = $data;
         }
     }
     $this['twig']->addGlobal('content', $content);
     // Setup the front controller
     $this->get('/{page}', function ($page) {
         $this['twig']->addGlobal('current_page', '/' . ($page == 'index' ? '' : $page));
         return $this->render($page . '.html');
     })->value('page', 'index');
 }
Esempio n. 17
0
 public function registerBundles()
 {
     $bundles = array(new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle($this), new Nelmio\ApiDocBundle\NelmioApiDocBundle(), new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), new Oneup\UploaderBundle\OneupUploaderBundle(), new Liip\ImagineBundle\LiipImagineBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new FOS\ElasticaBundle\FOSElasticaBundle(), new Braincrafted\Bundle\BootstrapBundle\BraincraftedBootstrapBundle(), new Problematic\AclManagerBundle\ProblematicAclManagerBundle(), new JMS\AopBundle\JMSAopBundle(), new JMS\DiExtraBundle\JMSDiExtraBundle($this), new APY\DataGridBundle\APYDataGridBundle(), new SC\DatetimepickerBundle\SCDatetimepickerBundle(), new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(), new Prezent\Doctrine\TranslatableBundle\PrezentDoctrineTranslatableBundle(), new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new Norzechowicz\AceEditorBundle\NorzechowiczAceEditorBundle(), new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), new Jb\Bundle\FileUploaderBundle\JbFileUploaderBundle(), new Tetranz\Select2EntityBundle\TetranzSelect2EntityBundle(), new Presta\SitemapBundle\PrestaSitemapBundle(), new HWI\Bundle\OAuthBundle\HWIOAuthBundle(), new Baskin\HistoryBundle\BaskinHistoryBundle(), new Ojs\CoreBundle\OjsCoreBundle(), new Ojs\SiteBundle\OjsSiteBundle(), new Ojs\AdminBundle\OjsAdminBundle(), new Ojs\ApiBundle\OjsApiBundle(), new Ojs\JournalBundle\OjsJournalBundle(), new Ojs\UserBundle\OjsUserBundle(), new Ojs\OAIBundle\OjsOAIBundle(), new Ojs\ExportBundle\OjsExportBundle(), new BulutYazilim\LocationBundle\BulutYazilimLocationBundle(), new FOS\UserBundle\FOSUserBundle(), new Ojs\AnalyticsBundle\OjsAnalyticsBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new JMS\TranslationBundle\JMSTranslationBundle(), new Ojs\ImportBundle\ImportBundle(), new \OpenJournalSoftware\BibtexBundle\OpenJournalSoftwareBibtexBundle(), new Exercise\HTMLPurifierBundle\ExerciseHTMLPurifierBundle(), new h4cc\AliceFixturesBundle\h4ccAliceFixturesBundle(), new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle());
     if (in_array($this->getEnvironment(), array('dev', 'test'))) {
         $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
         $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
         $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
         $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
         $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
     }
     $accessor = PropertyAccess::createPropertyAccessor();
     $thirdPartyDir = __DIR__ . '/../thirdparty';
     $fs = new \Symfony\Component\Filesystem\Filesystem();
     if ($fs->exists($thirdPartyDir)) {
         $finder = new \Symfony\Component\Finder\Finder();
         $finder->files()->in($thirdPartyDir);
         foreach ($finder as $file) {
             /** @var \Symfony\Component\Finder\SplFileInfo $file */
             $bundleConfig = json_decode(file_get_contents($file->getRealpath()), true);
             if ($bundleConfig) {
                 $class = $accessor->getValue($bundleConfig, '[extra][bundle-class]');
                 if ($class && class_exists($class)) {
                     $bundles[] = new $class();
                 }
                 $otherClasses = $accessor->getValue($bundleConfig, '[extra][other-bundle-classes]');
                 if (is_array($otherClasses)) {
                     foreach ($otherClasses as $otherClass) {
                         $otherClassInstance = new $otherClass();
                         if (!in_array($otherClassInstance, $bundles)) {
                             $bundles[] = $otherClassInstance;
                         }
                     }
                 }
             }
         }
     }
     return $bundles;
 }
Esempio n. 18
0
/**
 * Upload file or directory to current server.
 * @param string $local
 * @param string $remote
 * @throws \RuntimeException
 */
function upload($local, $remote)
{
    $server = Context::get()->getServer();
    $local = env()->parse($local);
    $remote = env()->parse($remote);
    if (is_file($local)) {
        writeln("Upload file <info>{$local}</info> to <info>{$remote}</info>");
        $server->upload($local, $remote);
    } elseif (is_dir($local)) {
        writeln("Upload from <info>{$local}</info> to <info>{$remote}</info>");
        $finder = new Symfony\Component\Finder\Finder();
        $files = $finder->files()->ignoreUnreadableDirs()->ignoreVCS(true)->ignoreDotFiles(false)->in($local);
        /** @var $file \Symfony\Component\Finder\SplFileInfo */
        foreach ($files as $file) {
            $server->upload($file->getRealPath(), $remote . '/' . $file->getRelativePathname());
        }
    } else {
        throw new \RuntimeException("Uploading path '{$local}' does not exist.");
    }
}
Esempio n. 19
0
 public function testCreateMapFinderSupport()
 {
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->in(__DIR__ . '/Fixtures/beta/NamespaceCollision');
     $this->assertEqualsNormalized(array('NamespaceCollision\\A\\B\\Bar' => realpath(__DIR__) . '/Fixtures/beta/NamespaceCollision/A/B/Bar.php', 'NamespaceCollision\\A\\B\\Foo' => realpath(__DIR__) . '/Fixtures/beta/NamespaceCollision/A/B/Foo.php', 'NamespaceCollision\\C\\B\\Bar' => realpath(__DIR__) . '/Fixtures/beta/NamespaceCollision/C/B/Bar.php', 'NamespaceCollision\\C\\B\\Foo' => realpath(__DIR__) . '/Fixtures/beta/NamespaceCollision/C/B/Foo.php'), ClassMapGenerator::createMap($finder));
 }
Esempio n. 20
0
 /**
  * {@inheritdoc}
  */
 public function registerBundles()
 {
     $bundles = array(new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new FOS\OAuthServerBundle\FOSOAuthServerBundle(), new Bazinga\OAuthServerBundle\BazingaOAuthServerBundle(), new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle(), new Oneup\UploaderBundle\OneupUploaderBundle());
     //dynamically register Mautic Bundles
     $searchPath = __DIR__ . '/bundles';
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->followLinks()->in($searchPath)->depth('1')->name('*Bundle.php');
     foreach ($finder as $file) {
         $dirname = basename($file->getRelativePath());
         $filename = substr($file->getFilename(), 0, -4);
         $class = '\\Mautic' . '\\' . $dirname . '\\' . $filename;
         if (class_exists($class)) {
             $bundleInstance = new $class();
             $bundles[] = $bundleInstance;
             unset($bundleInstance);
         }
     }
     //dynamically register Mautic Plugin Bundles
     $searchPath = dirname(__DIR__) . '/plugins';
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->followLinks()->depth('1')->in($searchPath)->name('*Bundle.php');
     foreach ($finder as $file) {
         $dirname = basename($file->getRelativePath());
         $filename = substr($file->getFilename(), 0, -4);
         $class = '\\MauticPlugin' . '\\' . $dirname . '\\' . $filename;
         if (class_exists($class)) {
             $plugin = new $class();
             if ($plugin instanceof \Symfony\Component\HttpKernel\Bundle\Bundle) {
                 $bundles[] = $plugin;
             }
             unset($plugin);
         }
     }
     // @deprecated 1.1.4; bc support for MauticAddon namespace; to be removed in 2.0
     $searchPath = dirname(__DIR__) . '/addons';
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->followLinks()->depth('1')->in($searchPath)->name('*Bundle.php');
     foreach ($finder as $file) {
         $dirname = basename($file->getRelativePath());
         $filename = substr($file->getFilename(), 0, -4);
         $class = '\\MauticAddon' . '\\' . $dirname . '\\' . $filename;
         if (class_exists($class)) {
             $addon = new $class();
             if ($addon instanceof \Symfony\Component\HttpKernel\Bundle\Bundle) {
                 $bundles[] = $addon;
             }
             unset($addon);
         }
     }
     if (in_array($this->getEnvironment(), array('dev', 'test'))) {
         $bundles[] = new Symfony\Bundle\TwigBundle\TwigBundle();
         $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
         $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
         $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
         $bundles[] = new Webfactory\Bundle\ExceptionsBundle\WebfactoryExceptionsBundle();
     }
     if (in_array($this->getEnvironment(), array('test'))) {
         $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
     }
     // Check for local bundle inclusion
     if (file_exists(__DIR__ . '/config/bundles_local.php')) {
         include __DIR__ . '/config/bundles_local.php';
     }
     return $bundles;
 }
Esempio n. 21
0
 /**
  * {@inheritdoc}
  */
 public function registerBundles()
 {
     $bundles = [new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new FOS\OAuthServerBundle\FOSOAuthServerBundle(), new Bazinga\OAuthServerBundle\BazingaOAuthServerBundle(), new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle(), new Oneup\UploaderBundle\OneupUploaderBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Debril\RssAtomBundle\DebrilRssAtomBundle(), new Mautic\ApiBundle\MauticApiBundle(), new Mautic\AssetBundle\MauticAssetBundle(), new Mautic\CalendarBundle\MauticCalendarBundle(), new Mautic\CampaignBundle\MauticCampaignBundle(), new Mautic\CategoryBundle\MauticCategoryBundle(), new Mautic\ConfigBundle\MauticConfigBundle(), new Mautic\CoreBundle\MauticCoreBundle(), new Mautic\DashboardBundle\MauticDashboardBundle(), new Mautic\DynamicContentBundle\MauticDynamicContentBundle(), new Mautic\EmailBundle\MauticEmailBundle(), new Mautic\FormBundle\MauticFormBundle(), new Mautic\InstallBundle\MauticInstallBundle(), new Mautic\LeadBundle\MauticLeadBundle(), new Mautic\NotificationBundle\MauticNotificationBundle(), new Mautic\PageBundle\MauticPageBundle(), new Mautic\PluginBundle\MauticPluginBundle(), new Mautic\PointBundle\MauticPointBundle(), new Mautic\ReportBundle\MauticReportBundle(), new Mautic\SmsBundle\MauticSmsBundle(), new Mautic\StageBundle\MauticStageBundle(), new Mautic\UserBundle\MauticUserBundle(), new Mautic\WebhookBundle\MauticWebhookBundle()];
     //dynamically register Mautic Plugin Bundles
     $searchPath = dirname(__DIR__) . '/plugins';
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->followLinks()->depth('1')->in($searchPath)->name('*Bundle.php');
     foreach ($finder as $file) {
         $dirname = basename($file->getRelativePath());
         $filename = substr($file->getFilename(), 0, -4);
         $class = '\\MauticPlugin' . '\\' . $dirname . '\\' . $filename;
         if (class_exists($class)) {
             $plugin = new $class();
             if ($plugin instanceof \Symfony\Component\HttpKernel\Bundle\Bundle) {
                 $bundles[] = $plugin;
             }
             unset($plugin);
         }
     }
     if (in_array($this->getEnvironment(), ['dev', 'test'])) {
         $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
         $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
         $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
         $bundles[] = new Webfactory\Bundle\ExceptionsBundle\WebfactoryExceptionsBundle();
     }
     if (in_array($this->getEnvironment(), ['test'])) {
         $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
     }
     // Check for local bundle inclusion
     if (file_exists(__DIR__ . '/config/bundles_local.php')) {
         include __DIR__ . '/config/bundles_local.php';
     }
     return $bundles;
 }
Esempio n. 22
0
#!/usr/bin/env php
<?php 
//Bootstrap our Silex application
$app = (require __DIR__ . '/app/app.php');
// The console app
$console = new Symfony\Component\Console\Application('Sailthru Awesomeness', '0.2');
$finder = new Symfony\Component\Finder\Finder();
$finder->files()->in(__DIR__ . '/src')->name('*Command.php');
foreach ($finder as $file) {
    $class = sprintf('SailthruToolkit\\Command\\%s', $file->getBasename('.php'));
    $r = new \ReflectionClass($class);
    if ($r->isSubclassOf('SailthruToolkit\\Command\\AbstractSailThruCommand') && !$r->isAbstract()) {
        $console->add($r->newInstance($app));
    }
}
$console->run();
Esempio n. 23
0
<?php

require_once __DIR__ . '/bootstrap.php';
require_once ABSPATH . '/wp-admin/includes/plugin.php';
$data = get_plugin_data(COMFORT_FILE);
$versions = \Sami\Version\GitVersionCollection::create(dirname(__DIR__))->addFromTags('v1.*.*')->add('master');
$iterator = new \Symfony\Component\Finder\Finder();
$iterator->files()->in(COMFORT_DIR . '/includes')->name('*.php')->append(\Symfony\Component\Finder\Finder::create()->in(COMFORT_DIR)->name('*.php')->depth(0));
$config = new Sami\Sami($iterator, ['versions' => $versions, 'title' => 'Comfort', 'build_dir' => COMFORT_DIR . '/var/sami/%version%', 'cache_dir' => COMFORT_DIR . '/var/sami/cache/%version%']);
return $config;
Esempio n. 24
0
 /**
  * {@inheritdoc}
  */
 public function registerBundles()
 {
     $bundles = array(new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new FOS\OAuthServerBundle\FOSOAuthServerBundle(), new Bazinga\OAuthServerBundle\BazingaOAuthServerBundle(), new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle(), new Oneup\UploaderBundle\OneupUploaderBundle());
     //dynamically register Mautic Bundles
     $searchPath = __DIR__ . '/bundles';
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->followLinks()->in($searchPath)->depth('1')->name('*Bundle.php');
     foreach ($finder as $file) {
         $dirname = basename($file->getRelativePath());
         $filename = substr($file->getFilename(), 0, -4);
         $class = '\\Mautic' . '\\' . $dirname . '\\' . $filename;
         if (class_exists($class)) {
             $bundleInstance = new $class();
             if (method_exists($bundleInstance, 'isEnabled')) {
                 if ($bundleInstance->isEnabled()) {
                     $bundles[] = $bundleInstance;
                 }
             } else {
                 $bundles[] = $bundleInstance;
             }
         }
     }
     //dynamically register Mautic Addon Bundles
     $searchPath = dirname(__DIR__) . '/addons';
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->followLinks()->depth('1')->in($searchPath)->name('*Bundle.php');
     foreach ($finder as $file) {
         $dirname = basename($file->getRelativePath());
         $filename = substr($file->getFilename(), 0, -4);
         $class = '\\MauticAddon' . '\\' . $dirname . '\\' . $filename;
         if (class_exists($class)) {
             $bundles[] = new $class();
         }
     }
     if (in_array($this->getEnvironment(), array('dev', 'test'))) {
         $bundles[] = new Symfony\Bundle\TwigBundle\TwigBundle();
         $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
         $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
         $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
         $bundles[] = new Webfactory\Bundle\ExceptionsBundle\WebfactoryExceptionsBundle();
     }
     if (in_array($this->getEnvironment(), array('test'))) {
         $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
     }
     return $bundles;
 }
Esempio n. 25
0
 private function getInFajas($cualTipo = 'all')
 {
     $_dir = realpath($this->getParameter('kernel.root_dir') . '/../web/data/');
     $fnd = new \Symfony\Component\Finder\Finder();
     if ($cualTipo == 'all') {
         //Guardar en la sesion el numero total de Fajas Registradas
         if (!$this->get('session')->has('totalFajas')) {
             $this->get('session')->set('totalFajas', $fnd->files()->notName('/\\_\\_rec\\_\\_/')->name('*')->in($_dir)->count());
         }
         return;
     } else {
         return $fnd->files()->name('*' . $cualTipo . '*')->in($_dir);
     }
 }
Esempio n. 26
0
<?php

$location = __DIR__ . '/../tests/temp';
define('VENDOR_PATH', realpath(__DIR__ . '/../vendor'));
set_include_path(implode(PATH_SEPARATOR, array(VENDOR_PATH, get_include_path())));
$classLoaderFile = VENDOR_PATH . '/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
if (!file_exists($classLoaderFile)) {
    die('cannot find vendor, run: php bin/vendors.php');
}
require_once $classLoaderFile;
$classLoader = new Doctrine\Common\ClassLoader('Symfony');
$classLoader->register();
$finder = new Symfony\Component\Finder\Finder();
$finder->files()->name('*')->in(__DIR__ . '/../tests/temp');
foreach ($finder as $fileInfo) {
    if (!$fileInfo->isWritable()) {
        continue;
    }
    echo 'removing: ' . $fileInfo->getRealPath() . PHP_EOL;
    @unlink($fileInfo->getRealPath());
}
<?php

if (PHP_SAPI !== 'cli') {
    die('This script can only be executed from command line!');
}
require __DIR__ . '/../../../vendor/autoload.php';
$final = (require __DIR__ . '/../../../Migrations/Code/LegacyClassMap.php');
$finder = new \Symfony\Component\Finder\Finder();
$files = $finder->files()->ignoreDotFiles(true)->in(__DIR__ . '/../../../src/');
$files = iterator_to_array($files->getIterator());
$files[] = __DIR__ . '/../../../README.md';
foreach ($files as $file) {
    $fileContent = file_get_contents($file);
    foreach ($final as $identifier => $className) {
        $fileContent = str_ireplace($identifier, str_replace('\\', '\\\\', $className), $fileContent);
    }
    file_put_contents($file, $fileContent);
}
Esempio n. 28
0
 /**
  * returns a multi-dimensional array with list of file details within a given path
  * (by using Symfony/Finder package)
  *
  * @param  string $pathAnalised
  * @return array
  */
 protected function getListOfFiles($pathAnalised)
 {
     if (realpath($pathAnalised) === false) {
         return ['error' => sprintf($this->lclMsgCmn('i18n_Error_GivenPathIsNotValid'), $pathAnalised)];
     } elseif (!is_dir($pathAnalised)) {
         return ['error' => $this->lclMsgCmn('i18n_Error_GivenPathIsNotFolder')];
     }
     $finder = new \Symfony\Component\Finder\Finder();
     $iterator = $finder->files()->sortByName()->in($pathAnalised);
     $aFiles = null;
     foreach ($iterator as $file) {
         $aFiles[$file->getRealPath()] = $this->getFileDetails($file);
     }
     return $aFiles;
 }
 public static function exist($libraryName, $includeDirs = [])
 {
     $finder = new \Symfony\Component\Finder\Finder();
     $finder->files()->name($libraryName)->in($includeDirs);
     return 0 != $finder->count();
 }
Esempio n. 30
0
 protected function retrieveFilesOlderThanGivenRule($inputArray)
 {
     $proceedRetrieving = $this->removeFilesDecision($inputArray);
     if ($proceedRetrieving === true) {
         $finder = new \Symfony\Component\Finder\Finder();
         $iterator = $finder->files()->ignoreUnreadableDirs(true)->followLinks()->in($inputArray['path']);
         $aFiles = [];
         foreach ($iterator as $file) {
             if ($file->getATime() <= strtotime($inputArray['dateRule'])) {
                 $aFiles[] = $file->getRealPath();
             }
         }
         return $aFiles;
     }
     return $proceedRetrieving;
 }