Пример #1
0
 /**
  * Singleton pattern. Get the instance of the latest created object or create a new one.
  * @return CLydia The instance of this class.
  */
 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new CLydia();
     }
     return self::$instance;
 }
Пример #2
0
/**
 * Print debuginformation from the framework.
 */
function get_debug()
{
    $ly = CLydia::Instance();
    $html = "<h2>Debuginformation</h2><hr><p>The content of the config array:</p><pre>" . htmlentities(print_r($ly->config, true)) . "</pre>";
    $html .= "<hr><p>The content of the data array:</p><pre>" . htmlentities(print_r($ly->data, true)) . "</pre>";
    $html .= "<hr><p>The content of the request array:</p><pre>" . htmlentities(print_r($ly->request, true)) . "</pre>";
    return $html;
}
Пример #3
0
 /**
  * Constructor
  *
  * @param string name of the element.
  * @param array attributes to set to the element. Default is an empty array.
  */
 public function __construct($name, $attributes = array())
 {
     $this->attributes = $attributes;
     $this['name'] = $name;
     //$this['key'] = $name;
     //$this['name'] = isset($this['name']) ? $this['name'] : $name;
     if (is_callable('CLydia::Instance()')) {
         $this->characterEncoding = CLydia::Instance()->config['character_encoding'];
     } else {
         $this->characterEncoding = 'UTF-8';
     }
 }
Пример #4
0
 /**
  * Constructor creating a form element.
  *
  * @param string $name       of the element.
  * @param array  $attributes to set to the element. Default is an empty array.
  */
 public function __construct($name, $attributes = [])
 {
     $this->attributes = $attributes;
     $this['name'] = $name;
     //$this['key'] = $name;
     //$this['name'] = isset($this['name']) ? $this['name'] : $name;
     // Use character encoding from lydia if available, else use UTF-8 OBSOLETE, remove this.
     if (is_callable('CLydia::Instance()')) {
         $this->characterEncoding = CLydia::Instance()->config['character_encoding'];
     } else {
         $this->characterEncoding = 'UTF-8';
     }
 }
Пример #5
0
    /**
     * Create a method that shows the menu, same for all methods
     */
    private function Menu()
    {
        $ly = CLydia::Instance();
        $menu = array('developer', 'developer/index', 'developer/links');
        $html = null;
        foreach ($menu as $val) {
            $html .= "<li><a href='" . $ly->request->CreateUrl($val) . "'>{$val}</a>";
        }
        $ly->data['title'] = "The Developer Controller";
        $ly->data['main'] = <<<EOD
<h1>The Developer Controller</h1>
<p>This is what you can do for now:</p>
<ul>
{$html}
</ul>
EOD;
    }
Пример #6
0
<?php

session_start();
session_regenerate_id();
// PHASE: BOOTSTRAP
define('LYDIA_INSTALL_PATH', dirname(__FILE__));
require LYDIA_INSTALL_PATH . '/src/bootstrap.php';
$ly = CLydia::GetInstance();
// PHASE: FRONTCONTROLLER ROUTE
$ly->FrontControllerRoute();
// PHASE: TEMPLATE ENGINGE RENDER
$ly->TemplateEngineRender();
Пример #7
0
<?php

// PHASE: BOOTSTRAP
//
define('LYDIA_INSTALL_PATH', dirname(__FILE__));
define('LYDIA_SITE_PATH', LYDIA_INSTALL_PATH . '/site');
require LYDIA_INSTALL_PATH . '/src/CLydia/bootstrap.php';
$ly = CLydia::Instance();
//
// PHASE: FRONTCONTROLLER ROUTE
//
$ly->FrontControllerRoute();
//
// PHASE: THEME ENGINE RENDER
//
$ly->ThemeEngineRender();
//"bootstrap" är initieringsfasen där de oundvikliga grunderna
//etableras och defineras. Dessa behövs i varje förfrågan.
//"frontController->route" tar hand om förfrågan och tolkar
//ut vilken kontroller och metod som skall anropas.
//Därefter sker all bearbetning i kontrollern.
//"themeEngine->render" skapar själva slutresultatet,
//webbsidan. Allt innehåll finns tillgängligt och med
//hjälp av template-filer överförs innehållet till HTML-filer.