Example #1
0
<?php

/**
 * Including ServerResponse interface
 */
require_interface('ServerResponse', 'Server');
/**
 * 
 */
class HttpServerResponse implements ServerResponse
{
    /**
     * @var int
     */
    protected $httpCode;
    /**
     * @var string
     */
    protected $body;
    /**
     * @var array
     */
    protected $size;
    /**
     * @param string $body
     * @param int $httpCode 
     * @param int $size
     */
    public function __construct($body, $httpCode, $size)
    {
        $this->body = $body;
Example #2
0
<?php

/**
 * This file contains the MemcachedCache.
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, Matthias Loitsch
 * @package Cache
 */
/**
 * Including the Cache interface
 */
require_interface('Cache');
/**
 * The MemcachedCache is a wrapper for Memcached
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, Matthias Loitsch
 * @package Cache
 */
class MemcachedCache implements Cache
{
    /**
     * @var Memcached
     */
    private $memcached;
    /**
     * @param Memcached $memcached 
     */
    public function __construct(Memcached $memcached = null)
    {
Example #3
0
<?php

/**
 * This file contains the UrlSanitizer definition.
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, Matthias Loitsch
 * @package Sanitizer
 */
/**
 * Including interface
 */
require_interface('Sanitizer');
/**
 * The Url sanitizer removes characters that aren't allowed in url.
 * The difference to the php rawurlencode() function is, that instead of changing
 * the characters to real url characters (like %20), it just replaces them. 
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, Matthias Loitsch
 * @package Sanitizer
 */
class UrlSanitizer implements Sanitizer
{
    /**
     * Replaces all invalid url characters with _
     * @param string $string 
     */
    public function sanitize($string)
    {
        // Get the nearest ascii alternative for foreign chars.
Example #4
0
<?php

/**
 * This file contains the Router definition.
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, I-Netcompany
 * @package Router
 */
/**
 * Including the Router
 */
require_interface('Router');
/**
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2009, Matthias Loitsch
 * @package Utils
 * @package Router
 */
class DefaultRouter implements Router
{
    /**
     * @var string
     */
    protected $currentControllerName;
    /**
     * @var string
     */
    protected $currentAction;
    /**
     * @var string
Example #5
0
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, I-Netcompany
 * @package Controller
 */
/**
 * Including all exceptions
 */
include dirname(__FILE__) . '/ControllerExceptions.php';
/**
 * Including exceptions
 */
require_class('DispatcherException', dirname(__FILE__) . '/DispatcherExceptions.php');
/**
 * Including ContainerAware interface
 */
require_interface('ContainerAware');
/**
 * Including model
 */
require_class('Model', 'Renderer');
/**
 * The Controller is the base class for every Controller type.
 *
 * When a Controller gets initialized, the constructor calls
 * - authorize()
 * - prepare()
 * in that order.
 *
 * You then get the html output from the Controller, by calling getHtml()
 *
 *
Example #6
0
<?php

/**
 * The DefaultDispatcher
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, Matthias Loitsch
 * @package Dispatcher
 */
/**
 * Include the interface
 */
require_interface('Dispatcher');
/**
 * Including exceptions
 */
require_class('Model', 'Renderer');
/**
 * The DefaultDispatcher works with the controllerFactory.
 *
 * It tries to instantiate the appropriate controller, and to call the right action on it.
 * If it works, the dispatcher is very happy about it.
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, Matthias Loitsch
 * @package Dispatcher
 */
class DefaultDispatcher implements Dispatcher
{
    /**
     * @var type
<?php

/**
 * This file contains the DefaultHtmlProfilerPrinterDelegate class.
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, Matthias Loitsch
 * @package Profiler
 */
/**
 * Including ProfilerPrinterDelegate
 */
require_interface('ProfilerPrinterDelegate', 'Profiler');
/**
 * Very simple, very ugly ProfilerPrinter
 * 
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, Matthias Loitsch
 * @package Profiler
 */
class DefaultHtmlProfilerPrinterDelegate implements ProfilerPrinterDelegate
{
    const CONTEXT = 1;
    const SECTION = 2;
    /**
     * @param Profiler $profiler 
     */
    public function printProfiler($profiler)
    {
        echo '<style type="text/css">
      .rincewind-profiler-output {
Example #8
0
<?php

/**
 * The file for the Renderer class
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, I-Netcompany
 * @package Renderer
 */
/**
 * Including Renderer interface
 */
require_interface('Renderer');
/**
 * The base renderer.
 * You should always extend this class unless you really know what you're doing.
 *
 * @author Matthias Loitsch <*****@*****.**>
 * @copyright Copyright (c) 2010, I-Netcompany
 * @package Renderer
 */
abstract class BaseRenderer implements Renderer
{
    /**
     * The file extension the renderer will handle.
     *
     * Set this to null if your renderer does not actually render templates (eg: JSON
     * or XML renderers).
     *
     * @var string
     */