function make($inner = NULL, $a = NULL, $tag = null) { if ($tag == NULL) { $tag = $this->t; } if (is_array($this->in)) { foreach ($this->in as $obj) { // json decoded objects dont retain their classnames and become std object makking this statement not possible... // solution only store the values that are contained in whatever is passed into a new _a or new _whatever statement if (is_a($obj, 'stdClass')) { $obj = json_core::std_to_tag($obj); } $inner .= $obj->make(); } } else { if (is_a($obj, 'stdClass')) { $obj = json_core::std_to_tag($obj); } if ($inner == NULL && $this->in) { $inner = $this->in; } // theres a problem with inner processing and the html attributes $inner = is_object($this->in) ? $this->in->make($this->in->inner, $this->in->at, $this->in->t) : ($inner != NULL ? $inner : $this->in); } if ($a == NULL) { if ($this->at) { $a = $this->at; } $this->a = $this->a ? array_merge($this->a, html5_globals::$a) : html5_globals::$a; // storing the a attributes in every tag is ineeficent ... } if (is_array($a)) { foreach ($a as $key => $value) { unset($to_quote); if ($value && $this->validate_param($key, $value)) { // quoting is tricky.. but the ATT_QUOTES definition is a step in the right // direction .. if (AT_QUOTE_CHECK == true) { foreach (array(' ', '=', '>', '"', "'") as $char) { if (strrpos($value, $char) !== false) { $to_quote = true; break; } } } else { $to_quote = true; } $q = AT_DOUBLE ? '"' : "'"; $attr .= trim($to_quote && $key != 'charset' ? " {$key}={$q}{$value}{$q}" : " {$key}={$value} "); } } } if (!class_exists('json_core')) { foreach ($this as $key => $item) { unset($this->{$key}); } } else { unset($this->o); unset($this->a); } // delimiter... for tabs/new lines $d = !in_array($tag, array('body', 'head', 'html')) ? " " : " "; return "\n{$d}<" . $tag . ($attr ? " {$attr}" : NULL) . (in_array($tag, array('br', 'hr', 'link', 'meta', 'img')) ? ">\n{$d}" : ">{$inner}</{$tag}>\n{$d}"); }
new _footer( new _h4("Ronaldo Barbachano 2011 <a href='http://www.linkedin.com/in/ronaldob' title=Linkedin>Linked In</a> <a href='https://launchpad.net/%7Eronaldo-barbachano' title=Launchpad>Launchpad</a> <a href='https://github.com/redcap3000' title=github>Github</a>") ) ),array('id'=>'container') ))); // create html object with page above $the_page = new _html($page); // make it echo $the_page->make(); // Clean up the page for json storage.. $a= json_core::json_clean($the_page); // Echo's out the string echo json_encode($a,true); // Read in 'clean' structure to json page // Can also pass json as string to core.. $c = json_core::json_to_page($a); // Make it again from json! echo $c->make();