Overview

Packages

  • Pinoco
    • PAL

Classes

  • Pinoco
  • Pinoco_Delegate
  • Pinoco_DynamicVars
  • Pinoco_HttpRequestVars
  • Pinoco_List
  • Pinoco_MIMEType
  • Pinoco_NativeRenderer
  • Pinoco_NothingVars
  • Pinoco_NullRenderer
  • Pinoco_OptionalParam
  • Pinoco_Pagination
  • Pinoco_PDOStatementWrapper
  • Pinoco_PDOWrapper
  • Pinoco_Renderer
  • Pinoco_Router
  • Pinoco_TALRenderer
  • Pinoco_TestEnvironment
  • Pinoco_Validator
  • Pinoco_ValidatorContext
  • Pinoco_Vars

Interfaces

  • Pinoco_ArrayConvertible

Functions

  • __pinoco_autoload_impl
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Pinoco: makes existing static web site dynamic transparently.
  4:  * Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
  5:  *
  6:  * Licensed under The MIT License
  7:  * Redistributions of files must retain the above copyright notice.
  8:  *
  9:  * PHP Version 5
 10:  *
 11:  * @author     Hisateru Tanaka <tanakahisateru@gmail.com>
 12:  * @copyright  Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
 13:  * @license    MIT License (http://www.opensource.org/licenses/mit-license.php)
 14:  * @package    Pinoco
 15:  */
 16: 
 17: /**
 18:  * Abstract HTML page renderer.
 19:  *
 20:  * @package Pinoco
 21:  * @property Pinoco_Vars $cfg
 22:  * @property callable $before_rendering
 23:  */
 24: abstract class Pinoco_Renderer
 25: {
 26:     /**
 27:      * @var Pinoco
 28:      */
 29:     protected $_sysref;
 30: 
 31:     /**
 32:      * @var Pinoco_Vars
 33:      */
 34:     protected $_cfg;
 35: 
 36:     /**
 37:      * @var callable
 38:      */
 39:     protected $_before_rendering;
 40: 
 41:     /**
 42:      * Constructor
 43:      *
 44:      * @param Pinoco $sys
 45:      */
 46:     public function __construct(&$sys)
 47:     {
 48:         $this->_sysref = &$sys;
 49:         $this->_cfg = new Pinoco_Vars();
 50:         $this->_before_rendering = null;
 51:     }
 52: 
 53:     public function __toString() { return __CLASS__; }
 54: 
 55:     /**
 56:      * Properties reader.
 57:      *
 58:      * @param string $name
 59:      * @return mixed
 60:      */
 61:     public function __get($name)
 62:     {
 63:         if ($name == 'cfg') { return $this->_cfg; }
 64:         if ($name == 'before_rendering') { return $this->_before_rendering; }
 65:         return null;
 66:     }
 67: 
 68:     /**
 69:      * Properties writer.
 70:      * This protects read only property "cfg".
 71:      *
 72:      * @param string $name
 73:      * @param mixed $value
 74:      * @return mixed
 75:      */
 76:     public function __set($name, $value)
 77:     {
 78:         if ($name == 'before_rendering') { $this->_before_rendering = $value; }
 79:     }
 80: 
 81:     /**
 82:      * HTML page rendering implementation.
 83:      *
 84:      * @param string $page
 85:      * @param array $extravars
 86:      * @return void
 87:      */
 88:      protected function render($page, $extravars=array()) {
 89:          // implement rendering process
 90:      }
 91: 
 92:     /**
 93:      * Executes rendering with calling before_rendering handler.
 94:      *
 95:      * @param string $page
 96:      * @param array $extravars
 97:      * @return void
 98:      */
 99:      public function prepareAndRender($page, $extravars=array()) {
100:          if ($this->_before_rendering) {
101:              call_user_func($this->_before_rendering, $this);
102:          }
103:          $this->render($page, $extravars);
104:      }
105: }
106: 
107: 
Pinoco 0.8.0 Documentation API documentation generated by ApiGen 2.8.0