Main function called by Fluid.

@return string
487851
public function render()
    {
        $result = $this->arguments['result'];
        $this->conf = $this->arguments['conf'];

        $domImplementation = new \DOMImplementation();

        $this->doc = $domImplementation->createDocument();
        $li = $this->doc->createElement('li');
        $this->doc->appendChild($li);
        $li->setAttribute('class', 'pz2-detailsVisible');

        $iconElement = $this->doc->createElement('span');
        $li->appendChild($iconElement);
        $mediaClass = 'other';
        if (count($result['md-medium']) == 1) {
            $mediaClass = $result['md-medium'][0]['values'][0];
        } elseif (count($result['md-medium']) > 1) {
            $mediaClass = 'multiple';
        }

        $iconElement->setAttribute('class', 'pz2-mediaIcon ' . $mediaClass);
        $iconElement->setAttribute('title', LocalizationUtility::translate('media-type-' . $mediaClass, 'Pazpar2'));

        // basic title/author information
        $this->appendInfoToContainer($this->titleInfo($result), $li);
        $authors = $this->authorInfo($result);
        $this->appendInfoToContainer($authors, $li);

        // year or journal + year information
        $journal = $this->journalInfo($result);
        $this->appendInfoToContainer($journal, $li);

        if (!$journal) {
            $spaceBefore = ' ';
            if ($authors) {
                $spaceBefore = ', ';
            }
            $this->appendMarkupForFieldToContainer('date', $result, $li, $spaceBefore, '.');
        }

        if ($this->conf['provideCOinSExport'] == 1) {
            // Insert COinS information
            $this->appendCOinSSpansToContainer($result, $li);
        }

        // detailed information about the publication
        $this->appendInfoToContainer($this->renderDetails($result), $li);

        return $this->doc->saveHTML();
    }
1273454
public function run()
    {
        Debug::enable();

        // make whatever is necessary to disable all stuff that could buffer output
        ini_set('zlib.output_compression', 0);
        ini_set('output_buffering', 0);
        ini_set('implicit_flush', 1);
        ob_implicit_flush(1);

        $this->loop = Factory::create();
        $this->controller = new UnixServer($this->getControllerSocketPath(), $this->loop);
        $this->controller->on('connection', [$this, 'onSlaveConnection']);

        $this->web = new Server(sprintf('%s:%d', $this->host, $this->port), $this->loop);
        $this->web->on('connection', [$this, 'onRequest']);

        $this->loop->addSignal(SIGTERM, [$this, 'shutdown']);
        $this->loop->addSignal(SIGINT, [$this, 'shutdown']);
        $this->loop->addSignal(SIGCHLD, [$this, 'handleSigchld']);
        $this->loop->addSignal(SIGUSR1, [$this, 'restartSlaves']);
        $this->loop->addSignal(SIGUSR2, [$this, 'reloadSlaves']);

        if ($this->isDebug()) {
            $this->loop->addPeriodicTimer(0.5, function () {
                $this->checkChangedFiles();
            });
        }

        $loopClass = (new \ReflectionClass($this->loop))->getShortName();

        $this->output->writeln("<info>Starting PHP-PM with {$this->slaveCount} workers, using {$loopClass} ...</info>");
        $this->writePid();

        $this->createSlaves();

        $this->loop->run();
    }
131306
public function main()
    {
        $this->validate();
        $this->datetimeTaskStart = new \DateTimeImmutable();

        if ($this->describeMainStack()) {
            $this->updateStacks();
        } else {
            $this->creationStacks();
        }

        while (!$this->stackIsReady()) {
            sleep(3);
            if (empty($this->events)) {
                $this->log("Waiting for stack provisioning...");
            }
        }

        $stacks = $this->describeMainStack($e);

        if (null === $stacks) {
            throw $e;
        }

        $outputLog = '';

        if ($stacks[0]['Outputs']) {
            foreach ($stacks[0]['Outputs'] as $row) {
                $outputLog .= PHP_EOL . $row['OutputKey'] . ': ' . $row['OutputValue'];
                if ($output = $this->getOutput($row['OutputKey'])) {
                    /** @var StackOutput $output */
                    $this->project->setProperty($output->getProperty(), $row['OutputValue']);
                }
            }
        }

        $this->log($outputLog);
    }
1010485
public function main()
    {
        if (!empty($this->params['exclude'])) {
            $this->_exclude = explode(',', $this->params['exclude']);
        }
        if (isset($this->params['files']) && !is_array($this->params['files'])) {
            $this->_files = explode(',', $this->params['files']);
        }
        if (isset($this->params['paths'])) {
            $this->_paths = explode(',', $this->params['paths']);
        } elseif (isset($this->params['plugin'])) {
            $plugin = Inflector::camelize($this->params['plugin']);
            if (!Plugin::isLoaded($plugin)) {
                throw new MissingPluginException(['plugin' => $plugin]);
            }
            $this->_paths = [Plugin::classPath($plugin)];
            $this->params['plugin'] = $plugin;
        } else {
            $this->_getPaths();
        }

        if (isset($this->params['extract-core'])) {
            $this->_extractCore = !(strtolower($this->params['extract-core']) === 'no');
        } else {
            $response = $this->in('Would you like to extract the messages from the CakePHP core?', ['y', 'n'], 'n');
            $this->_extractCore = strtolower($response) === 'y';
        }

        if (!empty($this->params['exclude-plugins']) && $this->_isExtractingApp()) {
            $this->_exclude = array_merge($this->_exclude, App::path('Plugin'));
        }

        if (!empty($this->params['validation-domain'])) {
            $this->_validationDomain = $this->params['validation-domain'];
        }

        if ($this->_extractCore) {
            $this->_paths[] = CAKE;
        }

        if (isset($this->params['output'])) {
            $this->_output = $this->params['output'];
        } elseif (isset($this->params['plugin'])) {
            $this->_output = $this->_paths[0] . 'Locale';
        } else {
            $message = "What is the path you would like to output?\n[Q]uit";
            while (true) {
                $response = $this->in($message, null, rtrim($this->_paths[0], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'Locale');
                if (strtoupper($response) === 'Q') {
                    $this->err('Extract Aborted');
                    $this->_stop();

                    return;
                }
                if ($this->_isPathUsable($response)) {
                    $this->_output = $response . DIRECTORY_SEPARATOR;
                    break;
                }

                $this->err('');
                $this->err(
                    '<error>The directory path you supplied was ' .
                    'not found. Please try again.</error>'
                );
                $this->out();
            }
        }

        if (isset($this->params['merge'])) {
            $this->_merge = !(strtolower($this->params['merge']) === 'no');
        } else {
            $this->out();
            $response = $this->in('Would you like to merge all domain strings into the default.pot file?', ['y', 'n'], 'n');
            $this->_merge = strtolower($response) === 'y';
        }

        $this->_markerError = $this->param('marker-error');
        $this->_relativePaths = $this->param('relative-paths');

        if (empty($this->_files)) {
            $this->_searchFiles();
        }

        $this->_output = rtrim($this->_output, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
        if (!$this->_isPathUsable($this->_output)) {
            $this->err(sprintf('The output directory %s was not found or writable.', $this->_output));
            $this->_stop();

            return;
        }

        $this->_extract();
    }
640258
public function main()
	{
		ob_start();
		$exectimeStart = microtime( true );

		if( ( $result = $this->checkEnvironment() ) !== null ) {
			return $result;
		}

		try
		{
			\Aimeos\Aimeos\Setup::execute();
			$output = ob_get_contents();
		}
		catch( Exception $e )
		{
			$output = ob_get_contents();
			$output .= PHP_EOL . $e->getMessage();
			$output .= PHP_EOL . $e->getTraceAsString();
		}

		ob_end_clean();


		return '<pre>' . $output . '</pre>' . PHP_EOL .
			sprintf( "Setup process lasted %1\$f sec</br>\n", (microtime( true ) - $exectimeStart) );
	}
945487
public function main()
    {
        $logger = Log::engine($this->params['logger']);
        $engine = $this->getEngine($logger);
        $worker = $this->getWorker($engine, $logger);
        $worker->work();
    }
329160
public function main()
    {
        // Check if all required data is present.
        $this->checkRequirements();

        $document               = new \DOMDocument('1.0', 'UTF-8');
        $document->formatOutput = true;

        // Create the root 'ruleset' element.
        $root_element = $document->createElement('ruleset');
        $root_element->setAttribute('name', 'NextEuropa_default');
        $document->appendChild($root_element);

        // Add the description.
        $element = $document->createElement(
            'description',
            'Default PHP CodeSniffer configuration for NextEuropa subsites.'
        );
        $root_element->appendChild($element);

        // Add the coding standards.
        foreach ($this->_standards as $standard) {
            if (substr($standard, -4) === '.xml') {
                if (file_exists($standard)) {
                    $element = $document->createElement('rule');
                    $element->setAttribute('ref', $standard);
                    $root_element->appendChild($element);
                }
            }
            else {
                $element = $document->createElement('rule');
                $element->setAttribute('ref', $standard);
                $root_element->appendChild($element);
            }
        }

        // Add the files to check.
        foreach ($this->_files as $file) {
            $element = $document->createElement('file', $file);
            $root_element->appendChild($element);
        }

        // Add file extensions.
        if (!empty($this->_extensions)) {
            $extensions = implode(',', $this->_extensions);
            $this->appendArgument(
                $document,
                $root_element,
                $extensions,
                'extensions'
            );
        }

        // Add ignore patterns.
        foreach ($this->_ignorePatterns as $pattern) {
            $element = $document->createElement('exclude-pattern', $pattern);
            $root_element->appendChild($element);
        }

        // Add the requested Reports..
        foreach ($this->_reports as $report) {
            // Add the report type.
            $this->appendArgument($document, $root_element, $report, 'report');
        }

        // Add the shorthand options.
        $shorthand_options = array(
            'p' => '_showProgress',
            's' => '_showSniffCodes',
        );

        $options = array_filter(
            $shorthand_options,
            function ($value) {
                return $this->$value;
            }
        );

        if (!empty($options)) {
            $this->appendArgument(
                $document,
                $root_element,
                implode('', array_flip($options))
            );
        }

        // Save the file.
        $configSaved = file_put_contents(
            $this->_configFile,
            $document->saveXML()
        );

    }
1285125
public function run()
    {
        $this->registerClientScript();
        if ($this->hasModel()) {
            $input = Html::activeTextInput($this->model, $this->attribute, $this->options);
            $fileInput = Html::fileInput(Html::getInputName($this->model, $this->attribute), null, $this->fileInputOptions);
        } else {
            $input = Html::textInput($this->name, $this->value, $this->options);
            $fileInput = Html::fileInput($this->name, $this->value, $this->fileInputOptions);
        }

        $button = Html::tag('div', $fileInput . '<span>' . $this->buttonText . '</span>', $this->buttonOptions);
        return strtr($this->template, [
            '{id}' => $this->getId(),
            '{input}' => $input,
            '{button}' => $button,
            '{fields}' => $this->fields
        ]);
    }
29671
public function main()
    {
        # The theme is activated.
        # Location: Resources/Themes/Default/
        Theme::active('Default');
        
        # The current settings are being configured.
        Masterpage::headPage('Sections/head')
                  ->bodyPage('Sections/body')
                  ->browserIcon(FILES_DIR . 'favicon.ico')
                  ->backgroundImage(FILES_DIR . 'background.jpg');
    }
102034
public function main()
    {
        try {
            // Log
            $this->log('Started ', $this->loglevel);
            // Initialize //
            $this->prepare();
            $haveExecuted = false;
            // Validate O.S. applicability
            if ($this->isValidOs()) {
                // Build the command //
                $this->buildCommand();
                // Process //
                $totalFiles = 0;
                $totalDirs = 0;
                $fileNames = [];
                // - FileSets
                foreach ($this->filesets as $fs) {
                    $currentType = $this->type;
                    if ($fs instanceof DirSet) {
                        if ($this->type !== self::$types['DIR']) {
                            $this->log(
                                "Found a nested dirset but type is $this->type . "
                                . "Temporarily switching to type=\"dir\" on the"
                                . " assumption that you really did mean"
                                . " <dirset> not <fileset>.",
                                Project::MSG_DEBUG
                            );
                            $currentType = 'dir';
                        }
                    }
                    $base = $fs->getDir($this->project);
                    $ds = $fs->getDirectoryScanner($this->project);
                    if ($currentType !== self::$types['DIR']) {
                        $s = $this->getFiles($base, $ds);
                        foreach ($s as $fileName) {
                            $totalFiles++;
                            $fileNames[] = $fileName;
                            $baseDirs[] = $base;
                        }
                    }
                    if ($currentType !== self::$types['FILE']) {
                        $s = $this->getDirs($base, $ds);
                        foreach ($s as $fileName) {
                            $totalDirs++;
                            $fileNames[] = $fileName;
                            $baseDirs[] = $base;
                        }
                    }
                    if (count($fileNames) === 0 && $this->skipEmpty) {
                        $this->logSkippingFileset($currentType, $ds, $base);
                        continue;
                    }
                    $this->process(
                        $fs->getDirectoryScanner($this->project)->getIncludedFiles(),
                        $fs->getDir($this->project)
                    );
                    $haveExecuted = true;
                }
                unset($this->filesets);
                // - FileLists
                /**
                 * @var FileList $fl
                 */
                foreach ($this->filelists as $fl) {
                    $totalFiles++;
                    $this->process($fl->getFiles($this->project), $fl->getDir($this->project));
                    $haveExecuted = true;
                }
                unset($this->filelists);
            }
            if ($haveExecuted) {
                $this->log(
                    "Applied " . $this->commandline->getExecutable() . " to "
                    . $totalFiles . " file"
                    . ($totalFiles !== 1 ? "s" : "") . " and "
                    . $totalDirs . " director"
                    . ($totalDirs !== 1 ? "ies" : "y") . ".",
                    $this->loglevel
                );
            }
            /// Cleanup //
            $this->cleanup();
            // Log
            $this->log('End ', $this->loglevel);
        } catch (IOException | NullPointerException | UnexpectedValueException $e) {
            throw new BuildException('Execute failed: ' . $e, $e, $this->getLocation());
        }
    }
1304382
public function execute()
    {
        $pipeline = array_reduce(
            array_reverse($this->pipes), $this->carry(), function ($passable) {
            return $passable;
        }
        );

        return $pipeline($this->passable);
    }
845582
public function autoStop():string
    {
        $src = '';
        $this->status === self::STATUS_IN_CELL      && $src .= $this->endCell();
        $this->status === self::STATUS_IN_ROW       && $src .= $this->endRow();
        $this->status === self::STATUS_IN_CONTAINER && $src .= $this->endContainer($this->autoContainer);
        $this->autoCols = self::DEFAULT_COLS;
        $this->autoFluid = self::DEFAULT_FLUID;
        $this->autoCurrentCol = 0;
        $this->autoStarted = false;
        return $src;
    }
159169
public function main()
    {
        $this->log("Doing XSLT transformation using stylesheet " . $this->xsltFilter->getStyle(), Project::MSG_VERBOSE);
        $this->xsltFilter->setParams($this->parameters);
        parent::main();
    }
288925
public function main()
    {
        $projectFilter = [
            'provider'   => $this->provider,
            'repository' => $this->repository,
            'result'     => ['success', 'warning']
        ];
        
        $projectFilter['state'] = $this->state ? : ['complete'];

        if ($this->reference) {
            $projectFilter['ref'] = $this->reference;
        }

        // Get the build list
        $builds = $this->getClient()->getBuilds($projectFilter);
        
        if (empty($builds['_embedded']['builds'])) {
            $message = 'No build found for the project "' . $this->provider . '/' . $this->repository . '"';
            if ($this->reference) {
                $message.= ' on the reference  "' . $this->reference . '"';
            }
            throw new \BuildException($message);
        }

        if ($this->destination) {
            // Get the package download url of the last build
            $package = $this->getClient()->downloadPackage([
                'provider' => $this->provider,
                'repository' => $this->repository,
                'buildId' => $builds['_embedded']['builds'][0]['buildId'],
                'packageType' => 'deploy',
                'destination' => $this->destination
            ]);
        } else {
            // Get the package download url of the last build
            $package = $this->getClient()->getPackage([
                'provider' => $this->provider,
                'repository' => $this->repository,
                'buildId' => $builds['_embedded']['builds'][0]['buildId'],
                'packageType' => 'deploy'
            ]);
        }
        
        if ($this->property) {
            $this->getProject()->setProperty($this->property, $package[$this->destination ? 'path' : 'url']);
        }
    }
930909
public function main()
    {

        // register the default autoloader
        require SERVER_AUTOLOADER;

        // initialize the container state
        $this->containerState = ContainerStateKeys::get(ContainerStateKeys::WAITING_FOR_INITIALIZATION);

        // create a new API app service instance
        $this->service = $this->newService('AppserverIo\Appserver\Core\Api\AppService');

        // initialize the container for the configured class laoders
        $classLoaders = new GenericStackable();

        // register the configured class loaders
        $this->registerClassLoaders($classLoaders);

        // register shutdown handler
        register_shutdown_function(array(&$this, "shutdown"));

        // query whether the container's directories exists and are readable
        $this->validateDirectories();

        // initialize the naming directory with the environment data
        $this->namingDirectory->createSubdirectory(sprintf('php:env/%s', $this->getName()));
        $this->namingDirectory->createSubdirectory(sprintf('php:global/%s', $this->getName()));
        $this->namingDirectory->createSubdirectory(sprintf('php:global/log/%s', $this->getName()));
        $this->namingDirectory->bind(sprintf('php:env/%s/appBase', $this->getName()), $this->getAppBase());
        $this->namingDirectory->bind(sprintf('php:global/%s/runlevel', $this->getName()), $this->getRunlevel());

        // initialize the container state
        $this->containerState = ContainerStateKeys::get(ContainerStateKeys::INITIALIZATION_SUCCESSFUL);

        // initialize instance that contains the applications
        $this->applications = new GenericStackable();

        // initialize the profile logger and the thread context
        if ($profileLogger = $this->getInitialContext()->getLogger(LoggerUtils::PROFILE)) {
            $profileLogger->appendThreadContext($this->getContainerNode()->getName());
        }

        // initialize the array for the server configurations
        $serverConfigurations = array();

        // load the server configurations and query whether a server signatures has been set
        /** @var \AppserverIo\Appserver\Core\Api\Node\ServerNodeInterface $serverNode */
        foreach ($this->getContainerNode()->getServers() as $serverNode) {
            $serverConfigurations[] = $this->getServerNodeConfiguration($serverNode);
        }

        // init upstreams
        $upstreams = array();
        if ($this->getContainerNode()->getUpstreams()) {
            $upstreams = $this->getContainerNode()->getUpstreams();
            foreach ($this->getContainerNode()->getUpstreams() as $upstreamNode) {
                // get upstream type
                $upstreamType = $upstreamNode->getType();
                // init upstream instance
                $upstream = new $upstreamType();
                // init upstream servers
                $servers = array();
                // get upstream servers from upstream
                foreach ($upstreamNode->getUpstreamServers() as $upstreamServerNode) {
                    $upstreamServerType = $upstreamServerNode->getType();
                    $upstreamServerParams = $upstreamServerNode->getParamsAsArray();
                    $servers[$upstreamServerNode->getName()] = new $upstreamServerType($upstreamServerParams);
                }
                // inject server instances to upstream
                $upstream->injectServers($servers);
                // set upstream by name
                $upstreams[$upstreamNode->getName()] = $upstream;
            }
        }

        // init server array
        $this->servers = new GenericStackable();

        // start servers by given configurations
        /** @var \AppserverIo\Server\Interfaces\ServerConfigurationInterface $serverConfig */
        foreach ($serverConfigurations as $serverConfig) {
            // get type definitions
            $serverType = $serverConfig->getType();
            $serverContextType = $serverConfig->getServerContextType();

            // create a new instance server context
            /** @var \AppserverIo\Server\Interfaces\ServerContextInterface $serverContext */
            $serverContext = new $serverContextType();

            // inject container to be available in specific mods etc. and initialize the module
            $serverContext->injectContainer($this);

            // init server context by config
            $serverContext->init($serverConfig);

            // inject upstreams
            $serverContext->injectUpstreams($upstreams);

            // inject loggers
            $serverContext->injectLoggers($this->getInitialContext()->getLoggers());

            // create the server (which should start it automatically)
            /** @var \AppserverIo\Server\Interfaces\ServerInterface $server */
            $server = new $serverType($serverContext);
            // collect the servers we started
            $this->servers[$serverConfig->getName()] = $server;
        }

        // wait for all servers to be started
        $waitForServers = true;
        while ($waitForServers === true) {
            // iterate over all servers to check the state
            foreach ($this->servers as $server) {
                if ($server->serverState === ServerStateKeys::WORKERS_INITIALIZED) {
                    $waitForServers = false;
                } else {
                    $waitForServers = true;
                }
            }
            usleep(10000);
        }

        // the container has successfully been initialized
        $this->synchronized(function ($self) {
            $self->containerState = ContainerStateKeys::get(ContainerStateKeys::SERVERS_STARTED_SUCCESSFUL);
        }, $this);

        // initialize the flag to keep the application running
        $keepRunning = true;

        // wait till container will be shutdown
        while ($keepRunning) {
            // query whether we've a profile logger, log resource usage
            if ($profileLogger) {
                $profileLogger->debug(sprintf('Container %s still waiting for shutdown', $this->getContainerNode()->getName()));
            }

            // wait a second to lower system load
            $keepRunning = $this->synchronized(function ($self) {
                $self->wait(1000000 * AbstractContainerThread::TIME_TO_LIVE);
                return $self->containerState->equals(ContainerStateKeys::get(ContainerStateKeys::SERVERS_STARTED_SUCCESSFUL));
            }, $this);
        }

        // we need to stop all servers before we can shutdown the container
        /** @var \AppserverIo\Server\Interfaces\ServerInterface $server */
        foreach ($this->servers as $server) {
            $server->stop();
        }

        // mark the container as successfully shutdown
        $this->synchronized(function ($self) {
            $self->containerState = ContainerStateKeys::get(ContainerStateKeys::SHUTDOWN);
        }, $this);

        // send log message that the container has been shutdown
        $this->getInitialContext()->getSystemLogger()->info(
            sprintf('Successfully shutdown container %s', $this->getContainerNode()->getName())
        );
    }
1049304
public function main()
  {
    // Get base info about project.
    $this->prepareProjectData();

    // Get all info about source files.
    $this->getInfoSourceFiles();

    // Get all info about resource files.
    $this->getInfoResourceFiles();

    // Prepare all place holders.
    $this->preparePlaceHolders();

    // Replace references to resource files with references to optimized/minimized resource files.
    $this->processingSourceFiles();

    // Compress and rename files with hash.
    $this->processResourceFiles();

    // Create pre-compressed versions of the optimized/minimized resource files.
    if ($this->gzipFlag) $this->gzipCompressOptimizedResourceFiles();

    // Remove original resource files that are optimized/minimized.
    $this->unlinkResourceFiles();
  }
719597
public function main() {
		$this->out(__d('cake_notify', 'Cron task Shell'));
		$this->hr();
		$this->out(__d('cake_notify', 'This shell is used to execute task scheduled.'));
		$this->out(__d('cake_notify', 'Available tasks: %s.', CakeText::toList(constsVals('CAKE_NOTIFY_CRON_TASK_'), __d('cake_notify', 'and'))));
	}