/** * Sets a property for the parser */ function parse_set($property, $value) { PARSER::setProperty($property, $value); }
function event_InitSkinParse($data) { global $blogid, $CONF, $manager; $feedurl = array('rss1.xml', 'index.rdf', 'rss2.xml', 'atom.xml'); $reqPaths = explode('/', serverVar('PATH_INFO')); $reqPath = end($reqPaths); $feeds = in_array($reqPath, $feedurl, true); if (!$feeds) { return; } else { $p_info = trim(serverVar('PATH_INFO'), '/'); $path_arr = explode('/', $p_info); switch (end($path_arr)) { case 'rss1.xml': case 'index.rdf': $skinName = 'feeds/rss10'; break; case 'rss2.xml': $skinName = 'feeds/rss20'; break; case 'atom.xml': $skinName = 'feeds/atom'; break; } if (SKIN::exists($skinName)) { $skin =& SKIN::createFromName($skinName); $data['skin']->SKIN($skin->getID()); $skinData =& $data['skin']; $pageType = $data['type']; if (!$CONF['DisableSite']) { ob_start(); $skinID = $skinData->id; $contents = $this->getSkinContent($pageType, $skinID); $actions = SKIN::getAllowedActionsForType($pageType); $dataArray = array('skin' => &$skinData, 'type' => $pageType, 'contents' => &$contents); $manager->notify('PreSkinParse', $dataArray); PARSER::setProperty('IncludeMode', SKIN::getIncludeMode()); PARSER::setProperty('IncludePrefix', SKIN::getIncludePrefix()); $handler = new ACTIONS($pageType, $skinData); $parser = new PARSER($actions, $handler); $handler->setParser($parser); $handler->setSkin($skinData); $parser->parse($contents); $dataArray = array('skin' => &$skinData, 'type' => $pageType); $manager->notify('PostSkinParse', $dataArray); $feed = ob_get_contents(); ob_end_clean(); $eTag = '"' . md5($feed) . '"'; header('Etag: ' . $eTag); if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) { header('HTTP/1.0 304 Not Modified'); header('Content-Length: 0'); } else { if (extension_loaded('mbstring')) { $feed = mb_convert_encoding($feed, 'UTF-8', _CHARSET); $charset = 'UTF-8'; } else { $charset = _CHARSET; } header('Content-Type: application/xml; charset=' . $charset); header('Generator: Nucleus CMS ' . $nucleus['version']); // dump feed echo $feed; } } else { echo '<' . '?xml version="1.0" encoding="ISO-8859-1"?' . '>'; ?> <rss version="2.0"> <channel> <title><?php echo $this->hsc($CONF['SiteName'], ENT_QUOTES); ?> </title> <link><?php echo $this->hsc($CONF['IndexURL'], ENT_QUOTES); ?> </link> <description></description> <docs>http://backend.userland.com/rss</docs> </channel> </rss> <?php } } exit; } }
function parse($type) { global $manager, $CONF, $skinid; $manager->notify('InitSkinParse', array('skin' => &$this, 'type' => $type)); $skinid = $this->id; // set output type sendContentType($this->getContentType(), 'skin', _CHARSET); // set skin name as global var (so plugins can access it) global $currentSkinName; $currentSkinName = $this->getName(); $contents = $this->getContent($type); if (!$contents) { // use base skin if this skin does not have contents $defskin =& new SKIN($CONF['BaseSkin']); $contents = $defskin->getContent($type); if (!$contents) { echo _ERROR_SKIN; return; } } $actions = $this->getAllowedActionsForType($type); $manager->notify('PreSkinParse', array('skin' => &$this, 'type' => $type, 'contents' => &$contents)); $skinid = $this->id; // set IncludeMode properties of parser PARSER::setProperty('IncludeMode', $this->getIncludeMode()); PARSER::setProperty('IncludePrefix', $this->getIncludePrefix()); $handler =& new ACTIONS($type, $this); $parser =& new PARSER($actions, $handler); $handler->setParser($parser); $handler->setSkin($this); $parser->parse($contents); $manager->notify('PostSkinParse', array('skin' => &$this, 'type' => $type)); $skinid = $this->id; }
function parseFile($filename, $includeMode = 'normal', $includePrefix = '') { $handler = new ACTIONS('fileparser'); $parser = new PARSER(SKIN::getAllowedActionsForType('fileparser'), $handler); $handler->parser =& $parser; // set IncludeMode properties of parser PARSER::setProperty('IncludeMode', $includeMode); PARSER::setProperty('IncludePrefix', $includePrefix); if (!file_exists($filename)) { doError(_GFUNCTIONS_PARSEFILE_FILEMISSING); } $fsize = filesize($filename); if ($fsize <= 0) { return; } // read file $fd = fopen($filename, 'r'); $contents = fread($fd, $fsize); fclose($fd); // parse file contents $parser->parse($contents); }
/** * Parse skinvar nucleusbutton */ function parse_nucleusbutton($imgurl = '', $imgwidth = '85', $imgheight = '31') { global $CONF; if ($imgurl == '') { $imgurl = $CONF['AdminURL'] . 'nucleus.gif'; } else { if (PARSER::getProperty('IncludeMode') == 'skindir') { // when skindit IncludeMode is used: start from skindir $imgurl = $CONF['SkinsURL'] . PARSER::getProperty('IncludePrefix') . $imgurl; } } $this->formdata = array('imgurl' => $imgurl, 'imgwidth' => $imgwidth, 'imgheight' => $imgheight); $this->doForm('nucleusbutton'); }
* Documentation System for Fuzuli Programming Language * Copyright (C) 2014 A.Gokhan Satman <*****@*****.**> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ set_time_limit(0); ini_set('display_errors', FALSE); require "parser.php"; $parser = new PARSER(); $array = $parser->getFiles(); if ($_REQUEST["process"] == "clearAll") { $parser->clearAll(); } else { foreach ($array as $arr) { system(touch(trim($arr))); system(chmod(trim($arr), 0777)); $parser->getContent(trim($arr)); } //$parser->getContent( "random.nfl" ); //test }