From c4eb64d45d8b7b796ae2deecab26292261bf2dc0 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 16 May 2012 08:29:52 -0400 Subject: [PATCH] Rework output and page classes --- app/modules/welcome/controllers/welcome.php | 2 +- docs/classes.svg | 90 +++--- docs/classes/DB.html | 2 +- docs/classes/MM.html | 2 +- docs/classes/MM_Controller.html | 36 ++- docs/classes/MM_Data_Store.html | 2 +- docs/classes/MM_Model.html | 40 ++- docs/classes/MM_Output.html | 2 +- docs/classes/MM_Page.html | 209 +++++++++++++- docs/classes/MM_Session.html | 2 +- docs/classes/Welcome.html | 36 +-- docs/classes/Welcome_Model.html | 40 +-- docs/classes/miniMVC.html | 30 +- docs/deprecated.html | 2 +- docs/errors.html | 2 +- docs/graph_class.html | 2 +- docs/index.html | 2 +- docs/markers.html | 2 +- docs/namespaces/default.html | 2 +- docs/packages/.html | 2 +- docs/packages/Default.html | 2 +- docs/packages/miniMVC.App.html | 2 +- docs/packages/miniMVC.Libraries.html | 2 +- docs/packages/miniMVC.System.html | 2 +- docs/packages/miniMVC.html | 2 +- docs/structure.xml | 299 +++++++++----------- sys/core/controller.php | 2 +- sys/core/miniMVC.php | 43 --- sys/core/page.php | 21 +- 29 files changed, 481 insertions(+), 401 deletions(-) diff --git a/app/modules/welcome/controllers/welcome.php b/app/modules/welcome/controllers/welcome.php index ff78d82..dfcd6dd 100644 --- a/app/modules/welcome/controllers/welcome.php +++ b/app/modules/welcome/controllers/welcome.php @@ -55,7 +55,7 @@ class Welcome extends MM_Controller { $output = ob_get_contents(); ob_end_clean(); - $this->output->set_output($output); + $this->page->set_output($output); } } // End of welcome.php \ No newline at end of file diff --git a/docs/classes.svg b/docs/classes.svg index a8d3bca..b0688b2 100644 --- a/docs/classes.svg +++ b/docs/classes.svg @@ -22,21 +22,21 @@ \\MM_Model - -MM_Model + +MM_Model \\miniMVC - -miniMVC + +miniMVC \\MM_Model->\\miniMVC - - + + \\DB @@ -58,60 +58,60 @@ \\MM - -MM + +MM \\ArrayObject - -\ArrayObject + +\ArrayObject \\MM->\\ArrayObject - - + + \\miniMVC->\\MM - - + + \\MM_Page - -MM_Page + +MM_Page - -\\MM_Page->\\MM - - - - -\\MM_Controller - - -MM_Controller - - - -\\MM_Controller->\\miniMVC - - - \\MM_Output - -MM_Output + +MM_Output + +\\MM_Page->\\MM_Output + + + + +\\MM_Controller + + +MM_Controller + + + +\\MM_Controller->\\miniMVC + + + \\MM_Output->\\MM - - + + \\MM_Data_Store @@ -130,26 +130,26 @@ \\Welcome_Model - -Welcome_Model + +Welcome_Model \\Welcome_Model->\\MM_Model - - + + \\Welcome - -Welcome + +Welcome \\Welcome->\\MM_Controller - - + + diff --git a/docs/classes/DB.html b/docs/classes/DB.html index a1ef97f..c94302b 100644 --- a/docs/classes/DB.html +++ b/docs/classes/DB.html @@ -159,7 +159,7 @@
+ generated on 2012-05-16T08:29:32-04:00.
diff --git a/docs/classes/MM.html b/docs/classes/MM.html index 6b7bc4f..3a8c7dc 100644 --- a/docs/classes/MM.html +++ b/docs/classes/MM.html @@ -433,7 +433,7 @@ dynamic methods
+ generated on 2012-05-16T08:29:32-04:00.
diff --git a/docs/classes/MM_Controller.html b/docs/classes/MM_Controller.html index a994d56..6c86653 100644 --- a/docs/classes/MM_Controller.html +++ b/docs/classes/MM_Controller.html @@ -56,7 +56,9 @@ @@ -130,22 +131,29 @@

 Methods

-

PHP magic method to facilitate dynamic methods

-
__call(string $name, array $args) : mixed
+

Allow calling of array methods on the object and +dynamic methods

+
__call(string $name, array $params) : mixed
Inherited

- +
+ + + + + -
inherited_from\MM::__call()
inherited_from \miniMVC::__call()
+ +

Parameters

$name

string
-

$args

+

$params

array

Returns

@@ -736,18 +744,6 @@

 Properties

- 
-

Reference to output class

-
$output : \MM_Output
-
Inherited
-
-

- - - -
inherited_from\miniMVC::$$output
-
-
 

Instance of Page class

$page : \Page
@@ -761,7 +757,7 @@
+ generated on 2012-05-16T08:29:32-04:00.
diff --git a/docs/classes/MM_Data_Store.html b/docs/classes/MM_Data_Store.html index 52bc82d..9e84936 100644 --- a/docs/classes/MM_Data_Store.html +++ b/docs/classes/MM_Data_Store.html @@ -199,7 +199,7 @@ of the singleton
+ generated on 2012-05-16T08:29:32-04:00.
diff --git a/docs/classes/MM_Model.html b/docs/classes/MM_Model.html index 536ce09..73e1d39 100644 --- a/docs/classes/MM_Model.html +++ b/docs/classes/MM_Model.html @@ -56,7 +56,9 @@
@@ -126,22 +125,29 @@

 Methods

-

PHP magic method to facilitate dynamic methods

-
__call(string $name, array $args) : mixed
+

Allow calling of array methods on the object and +dynamic methods

+
__call(string $name, array $params) : mixed
Inherited

- +
+ + + + + -
inherited_from\MM::__call()
inherited_from \miniMVC::__call()
+ +

Parameters

$name

string
-

$args

+

$params

array

Returns

@@ -697,20 +703,6 @@
-

- Properties

- 
-

Reference to output class

-
$output : \MM_Output
-
Inherited
-
-

- - - -
inherited_from\miniMVC::$$output
-
-
@@ -718,7 +710,7 @@
+ generated on 2012-05-16T08:29:32-04:00.
diff --git a/docs/classes/MM_Output.html b/docs/classes/MM_Output.html index 81d4966..55140c1 100644 --- a/docs/classes/MM_Output.html +++ b/docs/classes/MM_Output.html @@ -639,7 +639,7 @@ Used for outputing HTML
+ generated on 2012-05-16T08:29:32-04:00.
diff --git a/docs/classes/MM_Page.html b/docs/classes/MM_Page.html index 8937794..209fc2f 100644 --- a/docs/classes/MM_Page.html +++ b/docs/classes/MM_Page.html @@ -60,8 +60,12 @@ dynamic methods">Allow calling of array methods on the object and dynamic methods
__call()
  • Set up the page class
    __construct()
  • +
  • PHP magic method called when ending the script +Used for outputing HTML
    __destruct()
  • append()
    append()
  • +
  • Adds text to the output buffer
    append_output()
  • asort()
    asort()
  • Builds common footer with any additional js
    build_footer()
  • @@ -70,6 +74,7 @@ dynamic methods
    __call()
    count()
  • exchangeArray()
    exchangeArray()
  • +
  • Sends headers and then removes them
    flush_headers()
  • getArrayCopy()
    getArrayCopy()
  • getFlags() @@ -109,8 +114,10 @@ dynamic methods
    __call()
  • Sets a minified javascript group for the page footer
    set_foot_js_group()
  • Sets minified javascript group in header
    set_head_js_group()
  • Sets a custom tag in the header
    set_head_tag()
  • +
  • Sets a header for later output
    set_header()
  • Set Message
    set_message()
  • Set Meta
    set_meta()
  • +
  • Sets the output buffer
    set_output()
  • Sets html title string
    set_title()
  • uasort()
    uasort()
  • @@ -129,10 +136,12 @@ dynamic methods
    __call()
  • Base tag
    $base
  • Class(es) to apply to the main body tag
    $body_class
  • Id to apply to the body tag
    $body_id
  • +
  • Content for outputting
    $buffer
  • CSS tags for the page
    $css
  • JS tags for the footer
    $foot_js
  • JS tags for the header
    $head_js
  • Additional header tags
    $head_tags
  • +
  • HTTP headers to send
    $headers
  • Meta tags
    $meta
  • Page title
    $title
  • @@ -162,10 +171,16 @@ dynamic methods
    Inherited

    - +
    + -
    inherited_from \MM::__call()
    + + +inherited_from +\MM_Output::__call() + +

    Parameters

    $name

    @@ -191,6 +206,19 @@ dynamic methods

    object

    +
    +

    PHP magic method called when ending the script +Used for outputing HTML

    +
    __destruct() : void
    +
    Inherited
    +
    +

    + + + +
    inherited_from\MM_Output::__destruct()
    +
    +

    append()

    @@ -207,9 +235,30 @@ dynamic methods inherited_from \MM::append() + +inherited_from +\MM_Output::append() +
    +
    +

    Adds text to the output buffer

    +
    append_output(string $string) 
    +
    Inherited
    +
    +

    + + + +
    inherited_from\MM_Output::append_output()
    +

    Parameters

    +
    +

    $string

    +string +
    +
    +

    asort()

    @@ -226,6 +275,10 @@ dynamic methods inherited_from \MM::asort() + +inherited_from +\MM_Output::asort() +
    @@ -266,6 +319,10 @@ dynamic methods inherited_from \MM::count() + +inherited_from +\MM_Output::count() + @@ -285,9 +342,25 @@ dynamic methods inherited_from \MM::exchangeArray() + +inherited_from +\MM_Output::exchangeArray() + +
    +

    Sends headers and then removes them

    +
    flush_headers() 
    +
    Inherited
    +
    +

    + + + +
    inherited_from\MM_Output::flush_headers()
    +
    +

    getArrayCopy()

    @@ -304,6 +377,10 @@ dynamic methods inherited_from \MM::getArrayCopy() + +inherited_from +\MM_Output::getArrayCopy() +
    @@ -323,6 +400,10 @@ dynamic methods inherited_from \MM::getFlags() + +inherited_from +\MM_Output::getFlags() + @@ -342,6 +423,10 @@ dynamic methods inherited_from \MM::getIterator() + +inherited_from +\MM_Output::getIterator() + @@ -361,6 +446,10 @@ dynamic methods inherited_from \MM::getIteratorClass() + +inherited_from +\MM_Output::getIteratorClass() + @@ -380,6 +469,10 @@ dynamic methods inherited_from \MM::ksort() + +inherited_from +\MM_Output::ksort() + @@ -399,6 +492,10 @@ dynamic methods inherited_from \MM::natcasesort() + +inherited_from +\MM_Output::natcasesort() + @@ -418,6 +515,10 @@ dynamic methods inherited_from \MM::natsort() + +inherited_from +\MM_Output::natsort() + @@ -437,6 +538,10 @@ dynamic methods inherited_from \MM::offsetExists() + +inherited_from +\MM_Output::offsetExists() + @@ -456,6 +561,10 @@ dynamic methods inherited_from \MM::offsetGet() + +inherited_from +\MM_Output::offsetGet() + @@ -475,6 +584,10 @@ dynamic methods inherited_from \MM::offsetSet() + +inherited_from +\MM_Output::offsetSet() + @@ -494,6 +607,10 @@ dynamic methods inherited_from \MM::offsetUnset() + +inherited_from +\MM_Output::offsetUnset() + @@ -558,6 +675,10 @@ page.

    inherited_from \MM::serialize() + +inherited_from +\MM_Output::serialize() + @@ -577,6 +698,10 @@ page.

    inherited_from \MM::setFlags() + +inherited_from +\MM_Output::setFlags() + @@ -596,6 +721,10 @@ page.

    inherited_from \MM::setIteratorClass() + +inherited_from +\MM_Output::setIteratorClass() + @@ -734,6 +863,27 @@ page.

    \Page
    +
    +

    Sets a header for later output

    +
    set_header(string $key, string $val) 
    +
    Inherited
    +
    +

    + + + +
    inherited_from\MM_Output::set_header()
    +

    Parameters

    +
    +

    $key

    +string +
    +
    +

    $val

    +string +
    +
    +

    Set Message

    set_message(string $type, string $message, bool $return) : void
    @@ -770,6 +920,23 @@ page.

    \Page
    +
    +

    Sets the output buffer

    +
    set_output(string $string) 
    +
    Inherited
    +
    +

    + + + +
    inherited_from\MM_Output::set_output()
    +

    Parameters

    +
    +

    $string

    +string +
    +
    +

    Sets html title string

    set_title(string $title) : \Page
    @@ -801,6 +968,10 @@ page.

    inherited_from \MM::uasort() + +inherited_from +\MM_Output::uasort() +
    @@ -820,6 +991,10 @@ page.

    inherited_from \MM::uksort() + +inherited_from +\MM_Output::uksort() + @@ -839,6 +1014,10 @@ page.

    inherited_from \MM::unserialize() + +inherited_from +\MM_Output::unserialize() + @@ -928,6 +1107,18 @@ supports

    + 
    +

    Content for outputting

    +
    $buffer : string
    +
    Inherited
    +
    +

    + + + +
    inherited_from\MM_Output::$$buffer
    +
    +
     

    CSS tags for the page

    $css : string
    @@ -952,6 +1143,18 @@ supports

    + 
    +

    HTTP headers to send

    +
    $headers : array
    +
    Inherited
    +
    +

    + + + +
    inherited_from\MM_Output::$$headers
    +
    +
     

    Meta tags

    $meta : string
    @@ -971,7 +1174,7 @@ supports

    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/classes/MM_Session.html b/docs/classes/MM_Session.html index b2b1da5..b7c8d62 100644 --- a/docs/classes/MM_Session.html +++ b/docs/classes/MM_Session.html @@ -143,7 +143,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/classes/Welcome.html b/docs/classes/Welcome.html index 2594ad8..6773382 100644 --- a/docs/classes/Welcome.html +++ b/docs/classes/Welcome.html @@ -56,7 +56,9 @@ @@ -132,14 +133,19 @@

     Methods

    -

    PHP magic method to facilitate dynamic methods

    -
    __call(string $name, array $args) : mixed
    +

    Allow calling of array methods on the object and +dynamic methods

    +
    __call(string $name, array $params) : mixed
    Inherited

    + + + + @@ -153,7 +159,7 @@ string
    -

    $args

    +

    $params

    array

    Returns

    @@ -866,24 +872,6 @@

     Properties

    - 
    -

    Reference to output class

    -
    $output : \MM_Output
    -
    Inherited
    -
    -

    -
    inherited_from\MM::__call()
    inherited_from \miniMVC::__call()
    - - - - - - - - -
    inherited_from\miniMVC::$$output
    inherited_from\MM_Controller::$$output
    -
    -
     

    Instance of Page class

    $page : \Page
    @@ -903,7 +891,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/classes/Welcome_Model.html b/docs/classes/Welcome_Model.html index 773c793..7037396 100644 --- a/docs/classes/Welcome_Model.html +++ b/docs/classes/Welcome_Model.html @@ -56,7 +56,9 @@
    @@ -126,14 +125,19 @@

     Methods

    -

    PHP magic method to facilitate dynamic methods

    -
    __call(string $name, array $args) : mixed
    +

    Allow calling of array methods on the object and +dynamic methods

    +
    __call(string $name, array $params) : mixed
    Inherited

    + + + + @@ -147,7 +151,7 @@ string
    -

    $args

    +

    $params

    array

    Returns

    @@ -798,26 +802,6 @@
    inherited_from\MM::__call()
    inherited_from \miniMVC::__call()
    -

    - Properties

    - 
    -

    Reference to output class

    -
    $output : \MM_Output
    -
    Inherited
    -
    -

    - - - - - - - - - -
    inherited_from\miniMVC::$$output
    inherited_from\MM_Model::$$output
    -
    -
    @@ -825,7 +809,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/classes/miniMVC.html b/docs/classes/miniMVC.html index e259247..1559cff 100644 --- a/docs/classes/miniMVC.html +++ b/docs/classes/miniMVC.html @@ -56,7 +56,9 @@
    @@ -126,18 +125,23 @@

     Methods

    -

    PHP magic method to facilitate dynamic methods

    -
    __call(string $name, array $args) : mixed
    -
    +

    Allow calling of array methods on the object and +dynamic methods

    +
    __call(string $name, array $params) : mixed
    +
    Inherited

    + + + +
    inherited_from\MM::__call()

    Parameters

    $name

    string
    -

    $args

    +

    $params

    array

    Returns

    @@ -597,14 +601,6 @@
    -

    - Properties

    - 
    -

    Reference to output class

    -
    $output : \MM_Output
    -
    -

    -
    @@ -612,7 +608,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/deprecated.html b/docs/deprecated.html index d492219..f9d1d5c 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -66,7 +66,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/errors.html b/docs/errors.html index 37d2314..0055951 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -84,7 +84,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/graph_class.html b/docs/graph_class.html index 983ee85..7a34deb 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -63,7 +63,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/index.html b/docs/index.html index 86ee527..0254f9d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -78,7 +78,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/markers.html b/docs/markers.html index 83eb960..625b288 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -68,7 +68,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index 66fd140..17a8cf4 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -513,7 +513,7 @@ display them cleanly
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/packages/.html b/docs/packages/.html index 0310f31..a381aa7 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -66,7 +66,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/packages/Default.html b/docs/packages/Default.html index 147bea9..b4d51b4 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -177,7 +177,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/packages/miniMVC.App.html b/docs/packages/miniMVC.App.html index 3e2cfde..6360cbc 100644 --- a/docs/packages/miniMVC.App.html +++ b/docs/packages/miniMVC.App.html @@ -138,7 +138,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/packages/miniMVC.Libraries.html b/docs/packages/miniMVC.Libraries.html index 7a8613a..427bf82 100644 --- a/docs/packages/miniMVC.Libraries.html +++ b/docs/packages/miniMVC.Libraries.html @@ -96,7 +96,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/packages/miniMVC.System.html b/docs/packages/miniMVC.System.html index afcc4e4..2c7304d 100644 --- a/docs/packages/miniMVC.System.html +++ b/docs/packages/miniMVC.System.html @@ -136,7 +136,7 @@
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/packages/miniMVC.html b/docs/packages/miniMVC.html index 1ec758b..28eace1 100644 --- a/docs/packages/miniMVC.html +++ b/docs/packages/miniMVC.html @@ -494,7 +494,7 @@ display them cleanly
    + generated on 2012-05-16T08:29:32-04:00.
    diff --git a/docs/structure.xml b/docs/structure.xml index 6ea9eba..a06b95f 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -155,7 +155,7 @@ - + Convention-based micro-framework for PHP

    ]]>
    @@ -309,103 +309,68 @@ dynamic methods]]>
    - - $output - - - - - - \MM_Output - - - - + __construct function - + - + array - + $members - - __call - function - - - - - string - - - array - - - - $name - - - - - $args - - - - - + load_class function - + - + string - + object - + $name - + unload function - + - + string - + $name - + load_config function - + - + string - + $name @@ -413,7 +378,7 @@ dynamic methods]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -426,7 +391,7 @@ dynamic methods]]> MM_Page \MM_Page - \MM + \MM_Output All methods are chainable, with the exception of the constructor, @@ -550,429 +515,429 @@ build_header(), build_footer(), and _headers() methods.

    ]]>
    - + _headers function - + Also sets page mime type, based on if sent as html or xhtml, and what the target browser supports

    ]]>
    - + bool - + \Page
    - + $html5
    - + set_meta function - + Sets meta tags, with codeigniter native meta tag helper

    ]]>
    - + array - + \Page
    - + $meta
    - + set_head_js_group function - + - + string - + bool - + \Page - + $group - + $debug - + set_css_group function - + - + string - + \Page - + $group - + set_foot_js_group function - + - + string - + bool - + \Page - + $group - + $debug - + set_title function - + - + string - + \Page - + $title - + set_body_class function - + - + string - + \Page - + $class - + set_body_id function - + - + string - + \Page - + $id - + set_base function - + - + string - + \Page - + $href - + set_css_tag function - + - + string - + bool - + string - + \Page - + $name - + $domain - + $media - + set_head_tag function - + - + string - + \Page - + $tag - + build_header function - + - + bool - + \Page - + $html5 - + build_footer function - + - + script_tag function - + Helper function for making script tags

    ]]>
    - + string - + bool - + string
    - + $js - + $domain
    - + set_message function - + Adds a message to the page

    ]]>
    - + string - + string - + bool - + void
    - + $type - + $message - + $return
    - + redirect_303 function - + Shortcut function for 303 redirect

    ]]>
    - + string
    - + $url
    - + render function - + Shortcut function for building a page

    ]]>
    - + string - + array
    - + $view - + $data
    - + output_string function - + Similar to render(), this is a shortcut to output a string in the body of the page.

    ]]>
    - + string
    - + $string
    - + _meta function - + - + array - + string - + $params - + _link_tag function - + - + array - + string - + $params @@ -980,7 +945,7 @@ page.

    ]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -1890,7 +1855,7 @@ display them cleanly]]>
    - + Convention-based micro-framework for PHP

    ]]>
    diff --git a/sys/core/controller.php b/sys/core/controller.php index fd96cac..4367bde 100644 --- a/sys/core/controller.php +++ b/sys/core/controller.php @@ -115,7 +115,7 @@ class MM_Controller extends miniMVC { } else { - $this->output->append_output($buffer); + $this->page->append_output($buffer); } } } diff --git a/sys/core/miniMVC.php b/sys/core/miniMVC.php index 0033caa..53e249e 100644 --- a/sys/core/miniMVC.php +++ b/sys/core/miniMVC.php @@ -252,13 +252,6 @@ class MM extends ArrayObject { class miniMVC extends MM { use Singleton; - - /** - * Reference to output class - * - * @var MM_Output - */ - public $output; /** * Constructor - Any classes loaded here become subclasses of miniMVC @@ -269,42 +262,6 @@ class miniMVC extends MM { { // Allow the class to be used like an array parent::__construct($members); - - $this->output = new MM_Output(); - } - - // -------------------------------------------------------------------------- - - /** - * PHP magic method to facilitate dynamic methods - * - * @param string $name - * @param array $args - */ - public function __call($name, $args = []) - { - // Allow array operations on the object - if (substr($name, 0, 6) === 'array_' && is_callable($name)) - { - $args = array_merge($this->getArrayCopy(), $args); - return call_user_func_array($name, $args); - } - - // Call dynamic methods - if (is_callable(self::$instance->$name)) - { - // Add $this object to args - array_push($args, $this); - - // Call the dynamic function - return call_user_func_array(self::$instance->$name, $args); - } - - // Indirectly call output methods - if (is_callable(self::$instance->output->$name)) - { - return call_user_func_array(self::$instance->output->$name, $args); - } } // -------------------------------------------------------------------------- diff --git a/sys/core/page.php b/sys/core/page.php index 72e12c2..9238824 100644 --- a/sys/core/page.php +++ b/sys/core/page.php @@ -22,7 +22,7 @@ * @package miniMVC * @subpackage System */ -class MM_Page extends MM { +class MM_Page extends MM_Output { /** * Meta tags @@ -106,7 +106,6 @@ class MM_Page extends MM { $this->base = ""; $this->mm = $controller; - $this->output = $this->mm->output; } // -------------------------------------------------------------------------- @@ -123,7 +122,7 @@ class MM_Page extends MM { */ private function _headers($html5) { - $this->output->set_header("Cache-Control", "must-revalidate, public"); + $this->set_header("Cache-Control", "must-revalidate, public"); $mime = ""; //Variable for accept keyword @@ -145,9 +144,9 @@ class MM_Page extends MM { $doctype_string .= ""; // finally, output the mime type and prolog type - $this->output->set_header("Content-Type", "{$mime};charset={$charset}"); - $this->output->set_header("X-UA-Compatible", "chrome=1, IE=edge"); - $this->output->set_output($doctype_string); + $this->set_header("Content-Type", "{$mime};charset={$charset}"); + $this->set_header("X-UA-Compatible", "chrome=1, IE=edge"); + $this->set_output($doctype_string); return $this; } @@ -298,7 +297,7 @@ class MM_Page extends MM { public function set_css_tag($name, $domain = TRUE, $media = "all") { $path = CONTENT_DOMAIN; - $css_file = $path . "/css/" . $name . ".css"; + $css_file = "{$path}/css/{$name}.css"; if ($domain == FALSE) { @@ -418,7 +417,7 @@ class MM_Page extends MM { private function script_tag($js, $domain = TRUE) { $path = CONTENT_DOMAIN; - $js_file = $path . "/js/" . $js . ".js"; + $js_file = "{$path}/js/{$js}.js"; if ($domain == FALSE) $js_file = $js; @@ -457,8 +456,8 @@ class MM_Page extends MM { */ function redirect_303($url) { - $this->output->set_header("HTTP/1.1 303 See Other"); - $this->output->set_header("Location:" . $url); + $this->set_header("HTTP/1.1 303 See Other"); + $this->set_header("Location:" . $url); } // -------------------------------------------------------------------------- @@ -490,7 +489,7 @@ class MM_Page extends MM { function output_string($string) { $this->build_header(); - $this->output->append_output($string); + $this->append_output($string); $this->build_footer(); }