Esempio n. 1
0
 /**
  * event method
  *
  * @param string $eventKey
  * @param mixed $data
  *
  * @return mixed
  */
 public function on($eventKey, $data = null)
 {
     switch ($eventKey) {
         case "request_uri":
             // we need to intercept and store the current page
             $p = new \Phile\Repository\Page();
             $this->pagelist_snippet->currentPage = $p->findByPath($data['uri']);
             break;
         case "template_engine_registered":
             // Here we inject the result of the pagelist into the template variables.
             $data['data']['pagelist'] = $this->pagelist_snippet->pagelist;
             if ($data['data']['current_page'] instanceof DummyPage) {
                 // we're rendering the pagelist snippet, and the user didn't
                 // specify a template
                 // -> we force Twig to accept our default template
                 if ($this->pagelist_snippet->templateDir) {
                     // TODO: Twig only :-(
                     $twig = $data['engine'];
                     $loader = $twig->getLoader();
                     $loader->addPath($this->pagelist_snippet->templateDir);
                     $data['data']['theme_dir'] = $this->pagelist_snippet->templateDir;
                 }
             }
             break;
         case "plugins_loaded":
             // Here we register the (pagelist) snippet with the Snippets class
             $plugins = \Phile\Bootstrap::getInstance()->getPlugins();
             if (array_key_exists('infostreams\\snippets', $plugins)) {
                 $snippets = $plugins['infostreams\\snippets'];
                 $snippets->add($this->pagelist_snippet);
             }
             break;
     }
 }
Esempio n. 2
0
<?php

use Phile\Bootstrap;
use Phile\Core\Utility;
/**
 * @author PhileCMS
 * @link https://philecms.com
 * @license http://opensource.org/licenses/MIT
 * @package Phile
 * @deprecated since 2015-05-01, file will be removed
 */
require_once __DIR__ . '/lib/Phile/Bootstrap.php';
Bootstrap::getInstance()->initializeBasics();
echo Utility::generateSecureToken(64);
echo "<br><br><br>(Please note: this file is deprecated and will be removed in an upcoming Phile release.)";