protected function output_as_xml($res) { $data = array(); if (isset($_GET['parent'])) { $data["parent"] = $this->render->level_id($_GET[$this->parent_name], $this->render->get_level() - 1); } else { $data["parent"] = "0"; } $data["data"] = $this->render_set($res); $out = new OutputWriter(json_encode($data), ""); $out->set_type("json"); $this->event->trigger("beforeOutput", $this, $out); $out->output("", true, $this->encoding); }
function run() { global $classes, $interfaces; $p = new CodeParser(); OutputWriter::Object()->setNativeInterfaces($interfaces); OutputWriter::Object()->setNativeClasses($classes); OutputWriter::Object()->setOutputGran($this->gran); OutputWriter::Object()->setOutputTarget($this->out); //if ($this->gran == OutputWriter::OUTPUT_GRAN_CLASS || $this->gran == OutputWriter::OUTPUT_GRAN_FILE) { if (is_dir($this->tgt)) { $p->parseRecursive($this->tgt); } else { $p->parse($this->tgt); } }
protected function output_as_xml($res) { $result = $this->render_set($res); if ($this->simple) { return $result; } $data = $this->xml_start() . json_encode($result) . $this->xml_end(); if ($this->as_string) { return $data; } $out = new OutputWriter($data, ""); $out->set_type("json"); $this->event->trigger("beforeOutput", $this, $out); $out->output("", true, $this->encoding); }
protected function output_as_xml($res) { $result = $this->render_set($res); if ($this->simple) { return $result; } $data = array(); $data["parent"] = $this->request->get_relation(); $data["data"] = $result; $data = json_encode($data); // return as string if ($this->as_string) { return $data; } // output direct to response $out = new OutputWriter($data, ""); $out->set_type("json"); $this->event->trigger("beforeOutput", $this, $out); $out->output("", true, $this->encoding); }
protected function output($res) { $out = new OutputWriter($res, ""); $out->set_type("json"); $this->event->trigger("beforeOutput", $this, $out); $out->output("", true, $this->encoding); }
function writeConfigFile($settings) { $context = Model_Context::getInstance(); $writer = new OutputWriter(); $database = $context->getAllFromNamespace('database'); $service = $context->getAllFromNamespace('service'); $config = array(); $contents = "<?php" . CRLF . "ini_set('display_errors', 'off');" . CRLF; // Database information. It is not allow to modify. $config['server'] = $database['server']; $config['database'] = $database['database']; $config['username'] = $database['username']; $config['password'] = $database['password']; $config['prefix'] = $database['prefix']; foreach ($config as $item => $value) { $contents .= "\$database['" . $item . "'] = '" . $value . "';" . CRLF; } $config = array(); $config['type'] = $service['type']; $config['domain'] = $service['domain']; $config['path'] = $service['path']; foreach ($config as $item => $value) { $contents .= "\$service['" . $item . "'] = '" . $value . "';" . CRLF; } // Service-specific information. foreach ($settings as $item => $value) { if ($item == 'serviceURL') { $contents .= "\$serviceURL = '" . $value . "';" . CRLF; } else { if ($value === true || $value === false || is_numeric($value)) { if ($value === true) { $value = 'true'; } else { if ($value === false) { $value = 'false'; } } $contents .= "\$service['" . $item . "'] = " . $value . ";" . CRLF; } else { $contents .= "\$service['" . $item . "'] = '" . $value . "';" . CRLF; } } } $contents .= "?>" . CRLF; if (!is_writable(ROOT . "/config.php")) { return _f('파일 쓰기 권한이 없습니다. 웹서버가 %1 파일의 쓰기 권한을 가지고 있는지 확인하세요.', 'config.php'); } $writer->openFile(ROOT . "/config.php"); if ($writer->write($contents) === false) { $writer->close(); return _t('실패했습니다.'); } $writer->close(); return true; }
protected function output_as_xml($res) { $start = "[\n"; $end = substr($this->render_set($res), 0, -2) . "\n]"; $out = new OutputWriter($start, $end); $out->set_type("json"); $this->event->trigger("beforeOutput", $this, $out); $out->output("", true, $this->encoding); }
/** Extract and output a class (or interface) definition from $accum, write the elements name as $tag_name */ private function parseClassDef($accum, $tag_name) { //Step 1 - strip crap from the beginning of $accum for ($i = count($accum) - 1; $i >= 0; $i--) { if ($accum[$i] == ';' || $accum[$i] == '}') { $accum = array_slice($accum, count($accum) - $i); break; } } //Parse forwards! $flag = ''; $name = ''; $ext = ''; $impl = array(); $abstract_flag = false; $commstack = array(); $line_num = 0; $decl = ''; //YO foreach ($accum as $tok) { if (is_array($tok)) { list($tid, $val, $lnum) = $tok; if (!in_array($tid, array(T_COMMENT, T_DOC_COMMENT, T_OPEN_TAG))) { $decl .= $val; } switch ($tid) { case T_CLASS: case T_INTERFACE: $flag = 'class'; break; case T_EXTENDS: $flag = 'ext'; break; case T_IMPLEMENTS: $flag = 'impl'; break; case T_ABSTRACT: $abstract_flag = true; break; case T_COMMENT: case T_DOC_COMMENT: $commstack[] = $tok; break; case T_STRING: if ($flag == 'class') { $name = $val; $line_num = $lnum; } else { if ($flag == 'ext') { $ext = $val; if (OutputWriter::Object()->isNativeClass($val)) { $this->accumulateNative($val); } } else { if ($flag == 'impl') { $impl[] = $val; if (OutputWriter::Object()->isNativeInterface($val)) { $this->accumulateNative($val); } } } } } } else { $decl .= $tok; } } $data = new stdClass(); $data->comments = $commstack; $data->line_number = $line_num; $data->name = $name; $data->is_native = false; $data->abstract_flag = $abstract_flag; $data->ext = $ext; $data->decl = $decl; if ($impl) { $data->impl = $impl; } else { $data->impl = array(); } switch ($tag_name) { case 'class': $this->ow->startClass($data); break; case 'interface': $this->ow->startInterface($data); break; default: throw new Exception("Unknown tag '{$tag_name}'", 967765); } }
protected function output_as_xml($res) { $result = $this->render_set($res); if ($this->simple) { return $result; } $data = array(); if (!$this->rootId || $this->rootId != $this->request->get_relation()) { $data["parent"] = $this->request->get_relation(); } $data["data"] = $result; $this->fill_collections(); if (!empty($this->options)) { $data["collections"] = $this->options; } foreach ($this->attributes as $k => $v) { $data[$k] = $v; } $data = json_encode($data); // return as string if ($this->as_string) { return $data; } // output direct to response $out = new OutputWriter($data, ""); $out->set_type("json"); $this->event->trigger("beforeOutput", $this, $out); $out->output("", true, $this->encoding); }
protected function output_as_xml($res) { $data = array(); $data["parent"] = $this->request->get_relation(); $data["data"] = $this->render_set($res); $out = new OutputWriter(json_encode($data), ""); $out->set_type("json"); $this->event->trigger("beforeOutput", $this, $out); $out->output("", true, $this->encoding); }
<?php /// Copyright (c) 2004-2012, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) $IV = array('GET' => array('includeFileContents' => array(array('true', 'false')))); require ROOT . '/library/preprocessor.php'; set_time_limit(0); $includeFileContents = Validator::getBool(@$_GET['includeFileContents']); $writer = new OutputWriter(); if (defined('__TEXTCUBE_BACKUP__')) { if (!file_exists(__TEXTCUBE_CACHE_DIR__ . '/backup')) { mkdir(__TEXTCUBE_CACHE_DIR__ . '/backup'); @chmod(__TEXTCUBE_CACHE_DIR__ . '/backup', 0777); } if (!is_dir(__TEXTCUBE_CACHE_DIR__ . '/backup')) { exit; } if ($writer->openFile(__TEXTCUBE_CACHE_DIR__ . "/backup/{$blogid}.xml")) { } else { exit; } } else { if ($writer->openStdout()) { header('Content-Disposition: attachment; filename="Textcube-Backup-' . getBlogName($blogid) . "-" . Timestamp::getDate() . '.xml"'); header('Content-Description: Textcube Backup Data'); header('Content-Transfer-Encoding: binary'); header('Content-Type: application/xml'); } else { exit; }
protected function output_as_xml($res) { $data = $this->xml_start(); $data .= $this->render_set($res); $data .= $this->xml_end(); $out = new OutputWriter($data, ""); $out->set_type("json"); $this->event->trigger("beforeOutput", $this, $out); $out->output("", true, $this->encoding); }
function testRecursiveInputClassOutput(&$output) { echo "\n\ttestRecursiveInputClassOutput\n"; $p = new CodeParser(); $tgt = $this->mybase . '/testRecursiveInputClassOutput'; mkdir($tgt); OutputWriter::Object()->setOutputGran(OutputWriter::OUTPUT_GRAN_CLASS); OutputWriter::Object()->setOutputTarget($tgt); $p->parseRecursive($this->recursive_base); }
function getTrackbackRDFView($blogid, $info) { $buf = new OutputWriter(); $buf->buffer('<!--' . CRLF); $buf->buffer('<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' . CRLF); $buf->buffer(' xmlns:dc="http://purl.org/dc/elements/1.1/"' . CRLF); $buf->buffer(' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">' . CRLF); $buf->buffer('<rdf:Description' . CRLF); $buf->buffer(' rdf:about="' . $info['permalink'] . '"' . CRLF); $buf->buffer(' dc:identifier="' . $info['permalink'] . '"' . CRLF); $buf->buffer(' dc:title="' . $info['title'] . '"' . CRLF); $buf->buffer(' trackback:ping="' . $info['trackbackURL'] . '" />' . CRLF); $buf->buffer('</rdf:RDF>' . CRLF); $buf->buffer('-->' . CRLF); return $buf->_buffer; }