PageRenderTime 64ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/htdocs/nmox/main/classes/NMOX.class.php

http://nmox.googlecode.com/
PHP | 1 lines | 1 code | 0 blank | 0 comment | 0 complexity | 3c53ff2871730bd11cdf07b84e63fcb4 MD5 | raw file
Possible License(s): MPL-2.0, LGPL-2.1, GPL-2.0, AGPL-1.0, MPL-2.0-no-copyleft-exception
  1. <?php /** * /nmox/main/classes/NMOX.class.php * * @author David Christian Liedle <david.liedle@gmail.com> * @link http://nmox.org/ * */ class NMOX implements iNMOX { ############################################################################ # Public properties # public $NMOX_CFG; public $NMOX_MOD; public $NMOX_ANX; ######################################################################## # Protected properties # protected $manna; // what is it? #################################################################### # Private properties # // None... ############################################################################ # Constructor # public function __construct(){ // Globalize relevant resources: global $NMOX_CFG; // Configuration (in config.php) global $myXHTML, $myCSS; // module objects (deprecated) global $myANX; // ANX objects (under /annex) // AUTO-INSTANTIATE (according to config): foreach( $NMOX_CFG['AUTO'] as $key=>$value ){ switch( $key ){ case "Database": $this->database_on(); case "Foxpaws": $this->errors_on(); case "Security": $this->styles_on(); } } } ############################################################################ # NMOX Class Methods # public function become( $constant ){ // become an object type if( !$this->check_manna() ){ switch( $constant ){ case "page": $this->manna = new Page; break; case "text": $this->manna = new Text; break; default: $this->manna = "error"; echo xER( "Unknown NMOX Server Object Type: " . $constant ); } } else { // REPLACE WITH FOXPAWS ERROR, when FoxPaws is ready for that: echo xER( "I can't become a " . $constant . " object; I'm already set." ); } } protected function check_manna(){ // See what state it is in: if( is_object($this->manna) ){ return TRUE; } else { return FALSE; } } public function export_object(){ // use to hand-off the become()-triggered object instance outside here return $this->manna; } #### # NMOX Server Housekeeping Methods # public function xbreak(){ // breakpoints with exit() (find LINE) die("$X->xbreak() has been called..."); } public function chain($clink=FALSE){ // view the chain, or arg BOOL if on chain if( $clink ){ // test for $clink on chain } else { // show chain } } public function dump( $filepath=FALSE ){ // like status, but writes to file if( $filepath ){ // write to filepath } else { // force download } } public function forward(){ // use junction to alert user that forward will now occur } public function help(){ // like python module help } public function info(){ // like PHPINFO } public function powers(){ // list all we can do } public function probe(){ // see if we're up and ok // check the following: // - ? // - ? } public function redirect($target=FALSE){ // instant redirect if( !$target ) $target = 'http://nmox.org/'; // change this to pref header('Location: '.$target); } public function status(){ // snapshot of models // note: some form of ascii-art tree layout might be useful } public function trace(){ // like Emacs backtrace; probably needs to be wired in throughout } public function yelp(){ // alias to FoxPaws (in body?) } ############################################################################ # Universal Tactics Methods # public function bake(){ $this->manna->bake(); // assemble for output } public function burn(){ $this->manna->burn(); // so-far instant output } public function commit(){ $this->manna->commit(); // lock output } ############################################################################ # Deprecated Methods # public function database_on(){ // } public function doCoolStuff(){ // example function for testing oneShot("Class NMOX is doing cool stuff."); } public function errors_on(){ // } public function flow(){ // pre-bake actions } public function go_class($classname){ $my_classname = "my".$classname; global $$my_classname; } public function styles_on(){ global $NMOX_CFG; global $myCSS; if( $NMOX_CFG['MUSE']['CSS'] ){ // We have a valid module if( !isset($myCSS) ) $myCSS = new CSS; } else { // error - don't have CSS module! } } public function security_on($level){ // } public function session_on($name){ // } ############################################################################ # Page object functions # public function body( $body ){ $this->manna->add_body( $body ); } public function cssl( $css_link ){ $this->manna->set_cssl( $css_link ); } public function jsl( $js_link ){ $this->manna->set_jsl( $js_link ); } public function meta( $tag, $section='c' ){ $this->manna->add_meta( $tag, $section ); } public function postburn(){ $this->manna->postburn(); } public function preburn(){ $this->manna->preburn(); } public function title( $title ){ $this->manna->set_title( $title ); } ############################################################################ # NMOX object utils # public function obgo(){ ob_start(); } public function obend(){ ob_end_flush(); } public function __destruct(){ // handle final tasks as object is destroyed // if( !in_array('bake', $this->flog) ){ // $this->bake(); // } // if( !in_array('commit', $this->flog) ){ // $this->commit(); // } } } locateMe('/nmox/main/classes/NMOX.class.php');