Gets page application configuration array for UI

@param PageApplicationInterface $application
@return array
337457
protected function getPageApplicationData(PageApplicationInterface $application)
	{
		return array(
			'id'		=> $application->getId(),
			'title'		=> $application->getTitle(),
			'icon'		=> $application->getIcon(),
			'isDropTarget' => $application->getAllowChildren(),
			'childInsertPolicy' => $application->getNewChildInsertPolicy(),
		);
	}
280320
private function getAppConfig($apps)
    {
        $pathinfo = trim($this->env->getPathinfo(), '/');
        $pathinfos = explode('/', $pathinfo);
        $group = isset($pathinfos[0]) ? $pathinfos[0] : '';
        $_apps = null;
        if (isset($apps[$group])) {
            $_apps = $apps[$group];
            array_shift($pathinfos);
            $this->env->setPathinfo(implode('/', $pathinfos));
        } elseif (isset($apps['vitex.default'])) {
            $_apps = $apps['vitex.default'];
        }
        return $_apps;
    }
673357
public static function castApplication(Application $app)
    {
        $results = [];

        foreach (self::$appProperties as $property) {
            try {
                $val = $app->$property();

                $results[Caster::PREFIX_VIRTUAL.lcfirst(preg_replace('/^get/', '', $property))] = $val;
            } catch (Exception $e) {
            }
        }

        return $results;
    }
938512
public static function setApplicationPHPCRSession(Application $application, string $sessionName = null, bool $admin = false)
    {
        $registry = $application->getKernel()->getContainer()->get('doctrine_phpcr');
        $session = $admin ? $registry->getAdminConnection($sessionName) : $registry->getConnection($sessionName);

        $helperSet = $application->getHelperSet();
        if (class_exists(Version::class)) {
            $helperSet->set(new DocumentManagerHelper($session));
        } else {
            $helperSet->set(new PhpcrHelper($session));
        }

        if ($session instanceof JackalopeSession
            && ($session->getTransport() instanceof DbalClient
                || $session->getTransport() instanceof DbalLoggingClient
            )
        ) {
            $helperSet->set(new DoctrineDBALHelper($session->getTransport()->getConnection()));
        }
    }
1064673
public function initialize(ApplicationInterface $application)
    {

        // load the servlet manager with the session settings configured in web.xml
        /** @var \AppserverIo\Psr\Servlet\ServletContextInterface|\AppserverIo\Psr\Application\ManagerInterface $servletManager */
        $servletManager = $application->search(ServletContextInterface::IDENTIFIER);

        // load the settings, set the default session save path
        $sessionSettings = $this->getSessionSettings();
        $sessionSettings->setSessionSavePath($application->getSessionDir());

        // if we've session parameters defined in our servlet context
        if ($servletManager->hasSessionParameters()) {
            // we want to merge the session settings from the servlet context
            $sessionSettings->mergeServletContext($servletManager);
        }
    }
310069
public function getItemsPerPageOptions()
    {
        $app = Application::getFacadeApplication();
        $config = $app->make('config');
        $options = $config->get('concrete.file_manager.items_per_page_options');
        if (!empty($options)) {
            return $options;
        }

        return parent::getItemsPerPageOptions();
    }
1317946
private function initializeConfig(Application $app)
    {
        $config_provider = $app->make('Concrete\Core\Config\ConfigServiceProvider');
        $config_provider->register();

        /*
         * @var \Concrete\Core\Config\Repository\Repository
         */
        $config = $app->make('config');

        return $config;
    }
584862
private function getOptions(MethodInterface $method)
    {
        if ($method->getMethod() == $method::GET) {
            return [
                'query' => $method->getAttributes(),
            ];
        }

        return [
            'headers' => [
                'Content-Type' => 'application/json',
            ],
            'body' => json_encode(
                $this->prepareAttributes($method->getAttributes()),
                JSON_FORCE_OBJECT
            )
        ];
    }
467220
public static function getApplication($application)
    {
        return isset(self::$_applications[$application]) ? self::$_applications[$application] : null;
    }
36784
public function registerAspectXml(ApplicationInterface $application)
    {

        /** @var \AppserverIo\Appserver\Core\Api\ConfigurationService $configurationService */
        $configurationService = $application->newService('AppserverIo\Appserver\Core\Api\ConfigurationService');

        // check if we even have a XMl file to read from
        $xmlPaths = $configurationService->globDir(
            AppEnvironmentHelper::getEnvironmentAwareGlobPattern($this->getWebappPath(), '{WEB-INF,META-INF,common}' . DIRECTORY_SEPARATOR . self::CONFIG_FILE_GLOB, GLOB_BRACE),
            GLOB_BRACE
        );
        foreach ($xmlPaths as $xmlPath) {
            // iterate all XML configuration files we found
            if (is_readable($xmlPath)) {
                // validate the file here, if it is not valid we can skip further steps
                try {
                    $configurationService->validateFile($xmlPath, null, true);
                } catch (InvalidConfigurationException $e) {
                    /** @var \Psr\Log\LoggerInterface $systemLogger */
                    $systemLogger = $this->getApplication()->getInitialContext()->getSystemLogger();
                    $systemLogger->error($e->getMessage());
                    $systemLogger->critical(
                        sprintf(
                            'Pointcuts configuration file %s is invalid, AOP functionality might not work as expected.',
                            $xmlPath
                        )
                    );
                    continue;
                }

                // load the aop config
                $config = new \SimpleXMLElement(file_get_contents($xmlPath));
                $config->registerXPathNamespace('a', 'http://www.appserver.io/appserver');

                // create us an aspect
                // name of the aspect will be the application name
                $aspect = new Aspect();
                $aspect->setName($xmlPath);

                // check if we got some pointcuts
                foreach ($config->xpath('/a:pointcuts/a:pointcut') as $pointcutConfiguration) {
                    // build up the pointcut and add it to the collection
                    $pointcut = new Pointcut();
                    $pointcut->setAspectName($aspect->getName());
                    $pointcut->setName((string)$pointcutConfiguration->{'pointcut-name'});
                    $pointcut->setPointcutExpression(
                        new PointcutExpression((string)$pointcutConfiguration->{'pointcut-pattern'})
                    );
                    $aspect->getPointcuts()->add($pointcut);
                }

                // check if we got some advices
                foreach ($config->xpath('/a:pointcuts/a:advice') as $adviceConfiguration) {
                    // build up the advice and add it to the aspect
                    $advice = new Advice();
                    $advice->setAspectName((string)$adviceConfiguration->{'advice-aspect'});
                    $advice->setName($advice->getAspectName() . '->' . (string)$adviceConfiguration->{'advice-name'});
                    $advice->setCodeHook((string)$adviceConfiguration->{'advice-type'});

                    $pointcutPointcut = $this->generatePointcutPointcut((array) $adviceConfiguration->{'advice-pointcuts'}->{'pointcut-name'}, $aspect);
                    $advice->getPointcuts()->add($pointcutPointcut);

                    // finally add the advice to our aspect (we will also add it without pointcuts of its own)
                    $aspect->getAdvices()->add($advice);
                }

                // if the aspect contains pointcuts or advices it can be used
                if ($aspect->getPointcuts()->count() > 0 || $aspect->getAdvices()->count() > 0) {
                    $this->getAspectRegister()->set($aspect->getName(), $aspect);
                }
            }
        }
    }
1089366
public function postStartup(ApplicationInterface $application)
    {

        // register the annotation registries
        $application->registerAnnotationRegistries();

        // load the object manager
        /** @var \AppserverIo\Psr\Di\ObjectManagerInterface $objectManager */
        $objectManager = $application->search(ObjectManagerInterface::IDENTIFIER);

        // register the beans found by annotations and the XML configuration
        /** \AppserverIo\Psr\Deployment\DescriptorInterface $objectDescriptor */
        foreach ($objectManager->getObjectDescriptors() as $descriptor) {
            // if we found a singleton session bean with a startup callback instanciate it
            if ($descriptor instanceof ServletDescriptorInterface) {
                // instantiate the servlet
                $instance = $this->get($servletName = $descriptor->getName());

                // initialize the servlet configuration
                $servletConfig = new ServletConfiguration();
                $servletConfig->injectServletContext($this);
                $servletConfig->injectServletName($servletName);

                // append the init params to the servlet configuration
                foreach ($descriptor->getInitParams() as $paramName => $paramValue) {
                    $servletConfig->addInitParameter($paramName, $paramValue);
                }

                // initialize the servlet
                $instance->init($servletConfig);

                // the servlet is added to the dictionary using the complete request path as the key
                $this->addServlet($servletName, $instance);
            }
        }
    }
156050
public function addApplication(ApplicationInterface $application)
    {

        // register the application in this instance
        $this->applications[$application->getName()] = $application;

        // adds the application to the system configuration
        $this->addApplicationToSystemConfiguration($application);
    }
179783
protected function obtainAppSystemList(): array
    {
        $appSystemNS = '\BFW\Core\AppSystems\\';
        
        return [
            'options'        => $appSystemNS.'Options',
            'constants'      => $appSystemNS.'Constants',
            'composerLoader' => $appSystemNS.'ComposerLoader',
            'subjectList'    => $appSystemNS.'SubjectList',
            'config'         => $appSystemNS.'Config',
            'monolog'        => $appSystemNS.'Monolog',
            'request'        => $appSystemNS.'Request',
            'session'        => $appSystemNS.'Session',
            'errors'         => $appSystemNS.'Errors',
            'memcached'      => $appSystemNS.'Memcached',
            'moduleList'     => $appSystemNS.'ModuleList',
            'ctrlRouterLink' => $appSystemNS.'CtrlRouterLink'
        ];
    }
891087
public function getPreset($application, $version, array $options = null)
    {
        $presets = [];
        foreach ($this->presets as $preset) {
            if ($preset['application'] === $application
                && $this->matchVersion($version, $preset)
                && $this->matchOptions($options, $preset)
            ) {
                $presets[] = $preset['backup'];
            }
        }

        if (0 === count($presets)) {
            return [];
        }
        if (1 === count($presets)) {
            return $presets[0];
        }

        return call_user_func_array('array_merge', $presets);
    }
1042317
protected function getThemeConfigurationFiles(Container $app)
    {
        $files = [];
        $config_path = $app->make('config')->get('theme.config_path', realpath($app->make('wp.theme')->getRoot()) . '/config');
        
        if (file_exists($config_path) && is_dir($config_path)) {
            foreach (Finder::create()->files()->name('*.php')->in($config_path) as $file) {
                $nesting = $this->getThemeConfigurationNesting($file, $config_path);
                
                $files[$nesting . basename($file->getRealPath(), '.php')] = $file->getRealPath();
            }
        }
        
        return $files;
    }
121109
public function getGroupedTargets(?Application $application = null): array
    {
        $environments = $this->getEntityManager()
            ->getRepository(Environment::class)
            ->findAll();

        if ($application) {
            $findBy = ['application' => $application];
        } else {
            $findBy = [];
        }

        $targets = $this->findBy($findBy);

        usort($environments, $this->environmentSorter());
        usort($targets, $this->targetSorter());

        $sorted = [];
        foreach ($environments as $environment) {
            $sorted[$environment->id()] = [
                'environment' => $environment,
                'targets' => [],
            ];
        }

        foreach ($targets as $target) {
            $id = $target->environment()->id();
            $sorted[$id]['targets'][] = $target;
        }

        return array_filter($sorted, function ($e) {
            return count($e['targets']) !== 0;
        });
    }
416537
public function initFromApplication(ApplicationInterface $application)
    {
        $this->setNodeName(self::NODE_NAME);
        $this->name = $application->getName();
        $this->webappPath = $application->getWebappPath();
        $this->setUuid($this->newUuid());
    }