Returns l'objet stockee dans le cache si i l existe sinon instancie
un nouveau objet dashboard_feed

@param Application $app
@param integer     $sbasid
@param string      $sbas_coll
@param mixed       $dmin
@param mixed       $dmax
186111
public static function getInstance(Application $app, $sbasid, $sbas_coll, $dmin, $dmax)
    {
        $cache_id = 'feed_' . md5($sbasid . '_' . $sbas_coll . '_' . $dmin . '_' . $dmax);

        try {
            $result = $app->getApplicationBox()->get_data_from_cache($cache_id);
            $result->setApplication($app);

            return $result;
        } catch (\Exception $e) {

        }
        $tmp = new self($app, $sbasid, $sbas_coll, $dmin, $dmax);

        $app->getApplicationBox()->set_data_to_cache($tmp, $cache_id);

        return $tmp;
    }
278255
public function recordsAction(Request $request, $sbasId)
    {
        if(!($extension = $request->get('format'))) {
            $extension = 'csv';
        }
        if(!array_key_exists($extension, self::$mapFromExtension)) {
            throw new \InvalidArgumentException(sprintf("bad format \"%s\" for report", $extension));
        }
        $this->extension = $extension;

        /** @var ReportRecords $report */
        $report = $this->reportFactory->createReport(
            ReportFactory::RECORDS,
            $sbasId,
            [
                'dmin'  => $request->get('dmin'),
                'dmax'  => $request->get('dmax'),
                'group' => $request->get('group'),
                'base'  => $request->get('base'),
                'meta'  => $request->get('meta'),
            ]
        );

        $report->setFormat(self::$mapFromExtension[$this->extension]['format']);

set_time_limit(600);
        $response = new StreamedResponse();

        $this->setHeadersFromFormat($response, $report);

        $response->setCallback(function() use($report) {
            $report->render();
        });

        return $response;
    }
163984
public function GetSolutionDirectoryList(\Puzzlout\Framework\Core\Application $app) {
        $Cacher = \Puzzlout\Framework\Core\Cache\BaseCache::Init($app->config);
        //$Cacher->Remove(CacheKeys::SOLUTION_FOLDERS);
        if (!$Cacher->KeyExists(CacheKeys::SOLUTION_FOLDERS)) {
            $SolutionPathListArray = ArrayFilterDirectorySearch::Init($app)->RecursiveScanOf(
                    "APP_ROOT_DIR", \Puzzlout\Framework\Core\DirectoryManager\Algorithms\ArrayListAlgorithm::ExcludeList());
            $Cacher->Create(CacheKeys::SOLUTION_FOLDERS, $SolutionPathListArray);
        } else {
            $SolutionPathListArray = $Cacher->Read(CacheKeys::SOLUTION_FOLDERS, array());
        }
        return $SolutionPathListArray;
    }
1302449
public function bootstrap(Application $app): void
    {
        if ($app->bound('config') && $app->environment('testing')) {
            return;
        }

        $items = [];
        $loader = new FileLoader(new Filesystem(), $app->configPath());

        // First we will see if we have a cache configuration file. If we do, we'll load
        // the configuration items from that file so that it is very quick. Otherwise
        // we will need to spin through every configuration file and load them all.
        if (\file_exists($cached = $app->getCachedConfigPath())) {
            $items = require $cached;
        }

        $this->setEnvironment($app, $items['*::app']['env'] ?? null);

        \tap(new Repository($loader, $app->environment()), function ($config) use ($app, $items) {
            $app->instance('config', $config);
            $config->setFromCache($items);

            \date_default_timezone_set($config->get('app.timezone', 'UTC'));
        });

        \mb_internal_encoding('UTF-8');
    }
1357493
public function register(Application $app)
    {
        $app['migrations.create-proxy'] = $app->share(function ($app) {
            $command = new CreateMigrationCommandProxy('migrations:create');
            $command->setFactory($app->raw('migrations.create'))
                ->setApp($app);
            return $command;
        });

        $app['migrations.create'] = $app->share(function ($app) {
            $view = new CreateMigrationView($app['mustache']);

            $command = new CreateMigrationCommand($view);

            $config = $app['config']->load('init');

            if (isset($config['migrations_namespace'])) {
                $command->setMigrationNamespace($config['migrations_namespace']);
            }

            return $command;
        });

        $app['migrations.run-proxy'] = $app->share(function ($app) {
            $command = new RunMigrationsCommandProxy('migrations:run');
            $command->setFactory($app->raw('migrations.run'))
                ->setApp($app);
            return $command;
        });

        $app['migrations.run'] = $app->share(function ($app) {
            $command = new RunMigrationsCommand();

            $command->setDatabaseAdapter($app['db']);

            $config = $app['config']->load('init');

            if (isset($config['migrations_namespace'])) {
                $command->setMigrationNamespace($config['migrations_namespace']);
            }

            return $command;
        });
    }
648336
public function recordsAction(Request $request, $sbasId)
    {
        /** @var ReportRecords $report */
        $report = $this->reportFactory->createReport(
            ReportFactory::RECORDS,
            $sbasId,
            [
                'dmin'  => $request->get('dmin'),
                'dmax'  => $request->get('dmax'),
                'group' => $request->get('group'),
                'base'  => $request->get('base'),
                'meta'  => $request->get('meta'),
            ]
        );

        $result = Result::create($request, $report->getContent());

        return $result->createResponse();
    }
875671
public function add(Application $application)
    {
        $this->doPost('/apps/add', $application->toArray());

        /** @var \Fnayou\InstapushPHP\Model\Applications $applications */
        $applications = $this->list();

        return $applications->last();
    }
1273730
private function loadMiddlewares($app, $container)
    {
        # Tracy debugbar
        $debugbar_enabled = filter_var(app_env('DEBUG_BAR_ON', false), FILTER_VALIDATE_BOOLEAN);
        if (is_dev() && $debugbar_enabled && PHP_SAPI !== "cli")
        {
            $app->add(new TracyMiddleware($app));
        }

        # Determine Route Before Application middleware
        $app->add(new AppMiddleware($container));

        # Global Error middleware
        $app->add(new GlobalErrorsMiddleware($container));

        # Old Input middleware
        $app->add(new OldInputMiddleware($container));

        # Global Csrf middleware
        $app->add(new GlobalCsrfMiddleware($container));
        $app->add($container->get('csrf'));

        # Shared Server middleware
        $app->add(new SharedServerMiddleware($container));

        # Application Mode middleware
        $app->add(new AppModeMiddleware($container));

        # Remove Trailing Slash middleware
        $app->add(new RemoveTrailingSlashMiddleware($container));
    }
1060905
public static function create(Application $app, array $feed_ids)
    {
        $feeds = $app['repo.feeds']->findByIds($feed_ids);

        return new static($app, $feeds);
    }
1170116
function massNews($appmsgid){
		$send_snoopy = new Snoopy;
		$post = array();
		$post['type'] = 10;
		$post['token'] = $this->_token;
		$post['appmsgid'] = $appmsgid;
		$post['ajax'] = 1;
		$post['city']='';
		$post['country']='';
		$post['f']='json';
		$post['groupid']='-1';
		$post['imgcode']='';
		$post['lang']='zh_CN';
		$post['province']='';
		$post['random']=  rand(0, 1);
		$post['sex']=0;
		$post['synctxnews']=0;
		$post['synctxweibo']=0;
		$post['t']='ajax-response';
		$send_snoopy->referer = "https://mp.weixin.qq.com/cgi-bin/masssendpage?t=mass/send&token={$this->_token}&lang=zh_CN";
		$send_snoopy->rawheaders['Cookie']= $this->cookie;
		$submit = "https://mp.weixin.qq.com/cgi-bin/masssend";
		$send_snoopy->submit($submit,$post);
		$this->log($send_snoopy->results);
		return $send_snoopy->results;
	}
410161
function cacheApplication() {
        $this->log("Downloading application...");
        $app = Config::instance()->application->apiClient()->get("application", array("definition" => "true"));
        $this->cache(Application::cacheKey(), json_encode($app));
        $this->log("Application has been cached.");
        return $app;
    }
996253
public static function isSupported(Application $app)
    {
        $result = false;
        if (PHP_VERSION_ID >= 50601) { // we need the $nowait parameter of sem_acquire, available since PHP 5.6.1
            $fi = $app->make(FunctionInspector::class);
            $result = $fi->functionAvailable('sem_get') && $fi->functionAvailable('sem_acquire') && $fi->functionAvailable('sem_release') & $fi->functionAvailable('ftok');
        }

        return $result;
    }
466791
public function register(Application $app)
    {
        $prefix = $this->prefix;

        foreach(array('.server', '.options', '.attributes') as $key) {
            if (!(isset($app[$prefix . $key]))) {
                $app[$prefix. $key] = array();
            }
        }

        $app[$prefix] = $this->getPdo($app, $prefix);
    }
1021582
public static function endpointsInfo(Application $app)
    {
        $app->boot();

        /** @var ControllerCollection $controllers */
        $controllers = $app['controllers'];
        $rControllers = new ReflectionObject($controllers);
        $pControllers = $rControllers->getProperty('controllers');
        $pControllers->setAccessible(true);

        /** @var Controller $ctrl */
        foreach ($pControllers->getValue($controllers) as $ctrl) {
            if ($ctrl instanceof Controller) {
                $route = $ctrl->getRoute();

                foreach ($route->getMethods() as $method) {
                    echo '- ' . str_pad($method, 7) . ' ' . str_pad($route->getPath(), 70);

                    if ($service = $route->getDefault('_controller')) {
                        if (is_scalar($service)) {
                            echo 'Handler: ' . $service;
                        }
                    }

                    echo "\n";
                }
            }
        }
    }
1337843
final protected function createAppProcess()
    {
        $appname = $this->params['appname'];
        Output::outputAsReadLine("Processing to create app : $appname", "none");
        sleep(1);
        $temp = $this->params['template'];
        $temdirbase = __DIR__."/AppTemplate";
        $tempdir = ($temp == "no")? $temdirbase.'/notemplate/{appname}/' : $temdirbase.'/template/{appname}/';
        Server::copy($tempdir, FEnvFcm::get("framework.apps").$appname, 'directory');
        $napp = FEnvFcm::get("framework.apps").$appname;

        // APP
        $file = file_get_contents($napp."/{appname}.php.local");
        $str = str_replace("{appname}", $appname, $file);
        file_put_contents($napp."/{appname}.php.local", $str);
        rename($napp."/{appname}.php.local", $napp."/$appname.php");

        // Mercure
        $file = file_get_contents($napp."/Routing/default.merc");
        $str = str_replace("{appname}", $appname, $file);
        file_put_contents($napp."/Routing/default.merc", $str);

        // MASTER
        $file = file_get_contents($napp."/Masters/DefaultMaster.php.local");
        $str = str_replace("{appname}", $appname, $file);
        file_put_contents($napp."/Masters/DefaultMaster.php.local", $str);
        rename($napp."/Masters/DefaultMaster.php.local", $napp."/Masters/DefaultMaster.php");

        // REGISTER TO APP CORE
        $file = JsonListener::open(FEnvFcm::get("framework.config.core.apps.file"));
        if (empty($file)) {
            $file = new \stdClass();
        }

        $lastapp = count((array) $file);

        $file->$lastapp = new \stdClass();
        $file->$lastapp->name = $this->params['appname'];
        $file->$lastapp->enabled = (($this->params['enabled'] != "")? $this->params['enabled'] : "yes");
        $file->$lastapp->prefix = trim(stripslashes($this->params['prefix']));
        $file->$lastapp->class = "\\".$this->params['appname']."\\".$this->params['appname'];
        $ndate = new \DateTime('UTC');
        $file->$lastapp->creation = $ndate;
        $file->$lastapp->update = $ndate;
        $file = json_encode($file, JSON_PRETTY_PRINT);
        file_put_contents(FEnvFcm::get("framework.config.core.apps.file"), $file);
        $this->initialJSON();
        if ($this->params['template'] == "yes") {
            $asm = new AssetsManager();
            $asm->__render(["commands" => ["assets:copy"], "options" => ["--symlink", "--noexit", "--appname=".
                $this->params['appname']]]);
        }

        // $this->addComposerApp($this->params['appname']);
        Output::displayAsGreen("Your app is ready to use. To test your app,
         go to project location on your browser with parameter ".(($this->params['prefix'] != "")?
                "/".trim(stripslashes($this->params['prefix'])) : "")."/index. Enjoy !", "none", false);
    }
52430
protected function registerMapperInitializer(Application $app)
    {
        $initializer = function ($mapper, $app) {
            $mapper->setSqlFactory(new SqlFactory);
        };

        $app->initializer('Synapse\Mapper\AbstractMapper', $initializer);
    }
199278
public function isRecordInPublicFeed($sbas_id, $record_id)
    {
        $dql = 'SELECT COUNT(i)
            FROM Phraseanet:FeedItem i
            JOIN i.entry e
            JOIN e.feed f
            WHERE i.sbasId = :sbas_id
                AND i.recordId = :record_id
                AND f.public = true';

        $query = $this->_em->createQuery($dql);
        $query->setParameters(['sbas_id' => $sbas_id, 'record_id' => $record_id]);

        return $query->getSingleScalarResult() > 0;
    }