function __construct($data = '', $options = array()) { if (!$options['classes'] && !is_array($options['classes'])) { $options['classes'] = array('xoxo'); } $data = $this->xoxo2array($data, $options['classes']); parent::__construct($data); foreach ($this->_fields as $name => $val) { if (substr(trim($val), 0, 3) == '<ul' || substr(trim($val), 0, 3) == '<ol') { $this->_fields[$name] = new OutlineFromXOXO($val); } } //end foreach }
function __construct($data = '', $options = array()) { $theParser = xml_parser_create(); if (!xml_parse_into_struct($theParser, $data, $vals)) { $errorcode = xml_get_error_code($theParser); if ($errorcode != XML_ERROR_NONE && $errorcode != 27) { $this->_errorcode = $errorcode; } } //end if ! parse xml_parser_free($theParser); $flattento = ''; $flattendat = ''; $flattentag = ''; $flattenattr = array(); $subflatten = 0; $options['rootel'] = $options['rootel'] ? strtoupper($options['rootel']) : ''; $options['itemel'] = $options['itemel'] ? strtolower($options['itemel']) : ''; $options['collapsels'] = $options['collapsels'] ? $options['collapsels'] : array(); foreach ($vals as $el) { if (!$options['rootel']) { $options['rootel'] = $el['tag']; } $isopen = $el['type'] == 'open' || $el['type'] == 'complete'; //for readability $isclose = $el['type'] == 'close' || $el['type'] == 'complete'; if ($options['rootel'] == $el['tag'] && $isclose) { continue; } if ($flattento) { //if flattening tags if ($isopen && $flattentag == $el['tag']) { $subflatten++; } if ($isclose && $flattentag == $el['tag']) { if ($subflatten) { $subflatten--; } else { if (!in_array($flattento, $options['collapsels'])) { $flattendat = '<OutlineFromXML>' . $flattendat . '</OutlineFromXML>'; $tmp = explode('>', $options['itemel']); if ($tmp[1]) { $flattendat = new OutlineFromXML($flattendat, array('rootel' => 'OutlineFromXML', 'itemel' => $tmp[1], 'collapsels' => $options['collapsels'])); } else { $flattendat = new OutlineFromXML($flattendat, array('rootel' => 'OutlineFromXML', 'itemel' => $options['itemel'], 'collapsels' => $options['collapsels'])); } foreach ($flattenattr as $name => $val) { $flattendat->addField($name, $val); } } //end if ! in_array if (!$this->getField($flattento)) { $this->addField($flattento, $flattendat); } else { $oldfield = $this->getField(strtolower($el['tag'])); if (!is_a($oldfield, 'Outline')) { $oldfield = new Outline(array(array('text' => $oldfield))); } if (count($oldfield->getFields())) { $oldfield = new Outline(array($oldfield)); } if (!is_a($flattendat, 'Outline')) { $flattendat = new Outline(array(array('text' => $flattendat))); } $oldfield->addNode($flattendat); $this->setField(strtolower($el['tag']), $oldfield); } //end if-else ! getField $flattendat = ''; $flattentag = ''; $subflatten = 0; $flattento = ''; $flattenattr = array(); continue; } //end if-else subflatten } //end if isclose && $emptytag = false; //assume not an empty tag if ($isopen) { //if opening tag $flattendat .= '<' . strtolower($el['tag']); //add open tag if ($el['attributes']) { //if attributes foreach ($el['attributes'] as $id => $val) { //loop through and add $flattendat .= ' ' . strtolower($id) . '="' . htmlspecialchars($val) . '"'; } //end foreach } //end if attributes $emptytag = $el['type'] == 'complete' && !$el['value']; //is emptytag? $flattendat .= $emptytag ? ' />' : '>'; //end tag if ($el['value']) { $flattendat .= htmlspecialchars($el['value']); } //add contents, if any } //end if isopen if ($el['type'] == 'cdata') { //if cdata $flattendat .= htmlspecialchars($el['value']); //add data } //end if cdata if ($isclose) { //if closing tag if (!$emptytag) { $flattendat .= '</' . strtolower($el['tag']) . '>'; } //if not emptytag, write out end tag } //end if isclose continue; } //end if flattento if ($el['type'] == 'complete') { if (!in_array(strtolower($el['tag']), $options['collapsels'])) { if ($el['attributes']) { if ($el['value']) { $el['value'] = new Outline(array('text' => $el['value'])); } else { $el['value'] = new Outline(); } foreach ($el['attributes'] as $id => $val) { $el['value']->addField(strtolower($id), $val); } //end foreach attributes } //end if attributes } //end if ! collapsels if (!$this->getField(strtolower($el['tag']))) { $this->addField(strtolower($el['tag']), $el['value']); } else { $oldfield = $this->getField(strtolower($el['tag'])); if (!is_a($oldfield, 'Outline')) { $oldfield = new Outline(array(array('text' => $oldfield))); } if (count($oldfield->getFields())) { $oldfield = new Outline(array($oldfield)); } if (!is_a($el['value'], 'Outline')) { $el['value'] = new Outline(array('text' => $el['value'])); } $oldfield->addNode($el['value']); $this->setField(strtolower($el['tag']), $oldfield); } //end if-else getField continue; } //end if type == complete if ($el['type'] == 'cdata') { if ($options['rootel'] == 'OUTLINEFROMXML') { $el['tag'] = 'TEXT'; } if (!$this->getField(strtolower($el['tag']))) { if (trim($el['value'])) { $this->addField(strtolower($el['tag']), $el['value']); } } else { $this->setField(strtolower($el['tag']), $this->getField(strtolower($el['tag'])) . $el['value']); } continue; } //end if type == complete if ($el['type'] == 'open') { if ($options['rootel'] == $el['tag']) { if ($options['rootel'] == 'OUTLINEFROMXML') { $el['tag'] = 'TEXT'; } if ($el['attributes']) { foreach ($el['attributes'] as $id => $val) { $this->addField(strtolower($id), $val); } } //end if attributes if (trim($el['value'])) { $this->addField(strtolower($el['tag']), $el['value']); } continue; } //end if rootel if ($el['attributes']) { foreach ($el['attributes'] as $id => $val) { $flattenattr[strtolower($id)] = $val; } } //end if attributes $flattento = strtolower($el['tag']); $flattentag = $el['tag']; $flattendat = $el['value']; continue; } //end if open } //end foreach vals $tmp = explode('>', $options['itemel']); if ($options['itemel'] !== false) { $this->nodesFromField($tmp[0]); } }
<?php if (!$_GET['url']) { ?> Turns a feed into <a href="http://blogxoxo.blogspot.com/2006/01/xoxo-blog-format.html">XOXO Blog Format</a> - compatible <a href="http://microformats.org/wiki/hatom">hAtom</a> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?> "><div> <input type="hidden" name="xn_auth" value="no" /> Feed URL: <input type="text" name="url" value="" /> <input type="submit" value="Go" /> </div></form> <?php exit; } //end if ! url header('Content-Type: application/xml; charset=utf-8'); require_once 'feed2hatom.inc.php'; require_once 'OutlineClasses/Outline.php'; $outline = new Outline(feed2hatom($_GET['url'])); $outline->fieldsFromFirstNode(array()); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' . "\n"; echo $outline->toXOXO(array('xoxo', 'posts', 'hfeed'), true, array('hentry'));
function encode() { if (empty($this->points)) { return parent::encode(); } return $this->size = $this->encodePoints($this->points); }
if ($isclose) { $flattento .= '</' . strtolower($flattentag) . '>'; $rtrn[] = $flattento; $flattentag = ''; unset($flattento); $flattento = false; $subflatten = 0; } //end if isclose } //end if theclass } //end foreach vals as el return $rtrn; } //end function extract_by_id if (isset($_REQUEST['_json'])) { header('Content-type: text/javascript'); require_once 'OutlineClasses/Outline.php'; require_once 'xn-app://singpolymaplay/getTidy.php'; if ($_REQUEST['callback']) { echo $_REQUEST['callback'] . '('; } $tmp = extract_by_id(getTidy($_REQUEST['url']), $_REQUEST['id']); $tmp = new Outline($tmp[0]); echo $tmp->toJSON(); if ($_REQUEST['callback']) { echo ')'; } } //end if _json
<?php XN_Application::includeFile('xoxotools', '/OutlineClasses/Outline.php'); function yubnubcmd($cmd) { if ($cmd[0] == '"') { return substr($cmd, 1, strlen($cmd) - 2); } $curl = curl_init('http://yubnub.org/parser/parse?command=' . urlencode($cmd)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); $rtrn = curl_exec($curl); curl_close($curl); return $rtrn; } //end function yubnubcmd header('Content-Type: text/javascript;charset=utf-8'); $struct = new Outline(); $struct->addField('cmd', $_REQUEST['cmd']); if (!isset($_REQUEST['nodata'])) { $struct->addField('data', yubnubcmd($_REQUEST['cmd'])); } $struct->addField('url', yubnubcmd('url ' . $_REQUEST['cmd'])); if ($_REQUEST['callback']) { echo $_REQUEST['callback'] . '('; } echo $struct->toJSON(); if ($_REQUEST['callback']) { echo ')'; }
$xoxo = new OutlineFromHATOM($pagedata); } if (!$xoxo->getNumNodes()) { $xoxo = new OutlineFromXOXO($pagedata, array('classes' => array())); } if (!$xoxo->getNumNodes()) { //error if no data die('No valid XOXO data found!'); } $tmp = $xoxo->getNode(0); //strip rel=home, not needed for this dataset if ($tmp->getField('rel') == 'home') { $xoxo->unsetNode(0); } $xoxo->reindexNodes(); $final = new Outline(); //the outline we're pushing to for ($i = 0; $i < $xoxo->getNumNodes(); $i++) { //loop through nodes and get data $node =& $xoxo->getNode($i); foreach ($node->getFields() as $name => $val) { $name = explode('#', $name); if ($name[0] != 'rel') { continue; } $dt = $node->getField('href#' . $name[1]); if (in_array('external', explode(' ', $val))) { $final->addNode(array('link' => $dt)); } } //end foreach getFields
exit; } //end if ! auot && format echo '<ul>'; foreach ($items as $item) { echo '<li><a href="/view.php?id=' . $item->id . '">' . $item->h('title') . '</a><br />' . substr($item->h('description'), 0, 90) . '...<br /><b>Group Tags:</b> ' . substr($item->my->h('grouptags'), 0, 60) . '...</li>'; } echo '</ul>'; } else { if (!$_REQUEST['format']) { echo '<p>No such group(s) exist. We reccomend you <a href="/addGroup.php">create one</a>.</p>'; } if (!class_exists('Outline')) { XN_Application::includeFile('xoxotools', '/OutlineClasses/Outline.php'); } $struct = new Outline(); if ($_REQUEST['format'] == 'xoxo') { header('Content-Type: application/xml;charset=utf-8'); echo $struct->toXOXO(); } //end if format == xoxo if ($_REQUEST['format'] == 'json') { header('Content-Type: text/javascript;charset=utf-8'); if (!isset($_REQUEST['raw'])) { if ($_REQUEST['callback']) { echo $_REQUEST['callback'] . '('; } else { echo 'if(typeof(Tagging) != "object") var Tagging = {};' . "\n" . 'Tagging.groups = ['; } } //end if ! isset raw
header('Content-Type: text/html;charset=utf-8'); echo '<h1><a href="' . $feed['link'] . '">' . $feed['title'] . '</a></h1>' . "\n"; echo '<i>' . $feed['description'] . '</i><br /><br />' . "\n"; echo '<ol>' . "\n"; foreach ($feed['items'] as $item) { echo ' <li><a href="' . $item['link'] . '">' . $item['title'] . '</a> - ' . $item['description'] . ' - <i>' . date('Y-m-d', $item['pubDate']) . '</i></li>' . "\n"; $count++; } //end foreach echo '</ol>' . "\n"; exit; } //end if xhtml if ($_REQUEST['format'] == 'json') { header('Content-Type: text/javascript;charset=utf-8'); $obj = new Outline($feed); if ($_REQUEST['callback']) { echo $_REQUEST['callback'] . '('; } echo $obj->toJSON(); if ($_REQUEST['callback']) { echo ')'; } exit; } //enf if json if ($_REQUEST['format'] == 'rss') { header('Content-Type: application/xml;charset=utf-8'); echo std_rss_out($feed); exit; }
<?php function errhandle() { } set_error_handler(errhandle); require_once 'xn-app://xoxotools/OutlineClasses/Outline.php'; header('Content-Type: text/javascript;charset=utf-8'); $page = file_get_contents($_REQUEST['url']); preg_match('/alt="Visual verification"[^<>]*src="([^<>]*)">/', $page, $result); $final['captcha'] = 'https://beta.blogger.com' . html_entity_decode($result[1]); preg_match('/name="securityToken"[^<>]*value="([^<>]*)">/', $page, $result); $final['securitytoken'] = html_entity_decode($result[1]); if ($_REQUEST['callback']) { echo $_REQUEST['callback'] . '('; } $final = new Outline($final); echo $final->toJSON(); if ($_REQUEST['callback']) { echo ')'; }
if (!$archivedone) { echo "\n" . ' <a rel="archive" class="published updated">' . htmlentities($design_pattern_stamp) . '</a>'; } if ($node->getField('body')) { echo "\n" . ' <dl>' . "\n"; echo ' <dt>body</dt>' . "\n"; echo ' <dd class="entry-content">' . str_replace("\n", ' ', str_replace("\r", ' ', $node->getField('body'))); if (!preg_match('/rel="?[^\\f]*?tag[^\\f]*?"?/', $node->getField('body')) && $node->getField('tags')) { echo ' <ul class="tags">'; $tags = $node->getField('tags'); $tags = $tags->toArray(); foreach ($tags as $tag) { echo ' <li><a rel="tag" href="http://www.technorati.com/tag/' . urlencode($tag['text']) . '">' . htmlentities($tag['text']) . '</a></li> '; } echo '</ul> '; } //end if ! rel=tag in body echo '</dd>' . "\n"; echo ' </dl>'; } //end if body if ($node->getNumNodes()) { $comments = new Outline($node->getNodes()); echo "\n" . $comments->toXOXO(array('classes' => array('xoxo', 'comments'))); } echo "\n" . ' </li>' . "\n\n"; } //end foreach echo '</ul>' . "\n\n"; echo '</body>' . "\n\n"; echo '</html>';
$error = array('number' => $errno, 'message' => $errmsg); } //end function handlerr set_error_handler("handlerr"); header('Content-Type: text/javascript;charset=utf-8'); XN_Application::includeFile('xoxotools', '/OutlineClasses/Outline.php'); XN_Application::includeFile('xoxotools', '/OutlineClasses/OutlineFromXOXO.php'); require_once 'getBloggerProfile.php'; try { $bloggerdata = getBloggerProfile($_REQUEST['url']); $bloggerdata = new Outline($bloggerdata); if ($bloggerdata->getField('contact')) { $bloggerdata->setField('contact', new OutlineFromXOXO($bloggerdata->getField('contact'), array('classes' => array()))); } } catch (Exception $e) { $bloggerdata = new Outline(array('error' => array('message' => $e->getMessage()))); } //end try-catch $bloggerdata->addField('url', $_REQUEST['url']); if ($error) { $bloggerdata->addField('error', new Outline($error)); } if (!isset($_REQUEST['raw']) && !$_REQUEST['callback']) { echo 'if(typeof(BloggerProfiles) == "undefined") var BloggerProfiles = {};' . "\n" . 'BloggerProfiles.profile = '; } if (!isset($_REQUEST['raw']) && $_REQUEST['callback']) { echo $_REQUEST['callback'] . '('; } echo $bloggerdata->toJSON(); if (!isset($_REQUEST['raw']) && $_REQUEST['callback']) { echo ')';
function __construct($data = '', $options = array()) { $data = $this->hatom2array($data, $options['resolve']); parent::__construct($data); }
public function get() { /* Returns the path to the compiled (and/or cached) template. With no caching, usage is simple: require $outline->get(); With caching enabled, two passes are required when the template output is first cached - this is because insert-commands can not be executed in the first pass, since they can not be cached. So usage is slightly more complicated: if ($outline->cached()) { // already cached - only one pass required require $outline->get(); } else { // first pass captures to cache and generates code for insert commands: $outline->capture(); require $outline->get(); $outline->stop(); // second pass generates the actual template output: require $outline->get(); } */ self::$engine_stack[] =& $this; if (count(self::$engine_stack) == 1 && $this->config['quiet']) { self::$error_level = error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING | E_STRICT ^ E_STRICT); } if ($this->caching && !empty($this->cache) && $this->cache->valid()) { return $this->cache->get(); } else { return $this->compiled; } }
function __construct($data = '', $options = array()) { $data = $this->opml2array($data); parent::__construct($data); }
//end if ! link $blogtitle = $struct->getField('title'); $bloglink = $struct->getField('link'); if (is_a($bloglink, 'Outline')) { foreach ($bloglink->getNodes() as $links) { if ($links->getField('rel') == 'alternate') { $bloglink = $links->getField('href'); break; } //end if alternate } //end foreach } //end if is_a $bloglink if (isset($_REQUEST['all'])) { $struct = new Outline(array_reverse($struct->toArray())); foreach ($struct->getNodes() as $item) { $author = $item->getField('author'); $author = is_a($author, 'Outline') ? $author->getField('name') : $author; if (stristr($author, 'noemail') || stristr($author, 'noone') || stristr($author, 'example.com')) { $author = ''; } xanga_post_action('post', $item->getField('title'), $item->getField('description') ? $item->getField('description') : $item->getField('content'), $item->getField('link'), $author, $bloglink, $blogtitle); } //end foreach nodes } else { $item = $struct->getNode(0); $author = $item->getField('author'); $author = is_a($author, 'Outline') ? $author->getField('name') : $author; if (stristr($author, 'noemail') || stristr($author, 'noone') || stristr($author, 'example.com')) { $author = '';
public function activateOutline() { $db = new Outline($this->_config); $result = $db->saveOutline(array('status'), array(1), $this->_data['outline_id']); $encodedResult = $this->utf8_converter($result); echo json_encode($encodedResult); }
function parseData() { parent::parseData(); $font = $this->getFont(); do { $flags = $font->readUInt16(); $glyphIndex = $font->readUInt16(); $a = 1.0; $b = 0.0; $c = 0.0; $d = 1.0; $e = 0.0; $f = 0.0; $point_compound = null; $point_component = null; $instructions = null; if ($flags & self::ARG_1_AND_2_ARE_WORDS) { if ($flags & self::ARGS_ARE_XY_VALUES) { $e = $font->readInt16(); $f = $font->readInt16(); } else { $point_compound = $font->readUInt16(); $point_component = $font->readUInt16(); } } else { if ($flags & self::ARGS_ARE_XY_VALUES) { $e = $font->readInt8(); $f = $font->readInt8(); } else { $point_compound = $font->readUInt8(); $point_component = $font->readUInt8(); } } if ($flags & self::WE_HAVE_A_SCALE) { $a = $d = $font->readInt16(); } elseif ($flags & self::WE_HAVE_AN_X_AND_Y_SCALE) { $a = $font->readInt16(); $d = $font->readInt16(); } elseif ($flags & self::WE_HAVE_A_TWO_BY_TWO) { $a = $font->readInt16(); $b = $font->readInt16(); $c = $font->readInt16(); $d = $font->readInt16(); } //if ($flags & self::WE_HAVE_INSTRUCTIONS) { // //} $component = new OutlineComponent(); $component->flags = $flags; $component->glyphIndex = $glyphIndex; $component->a = $a; $component->b = $b; $component->c = $c; $component->d = $d; $component->e = $e; $component->f = $f; $component->point_compound = $point_compound; $component->point_component = $point_component; $component->instructions = $instructions; $this->components[] = $component; } while ($flags & self::MORE_COMPONENTS); }
if (!$_REQUEST['id']) { die('NO ID SPECIFIED'); } require_once 'tagFunctions.php'; require_once 'XNC/Ajax.php'; $group = XN_Content::load(intval($_REQUEST['id'])); $grouptags = explode(' ', $group->my->grouptags); foreach ($grouptags as $id => $tag) { $grouptags[$id] = str_replace('+', ' ', $tag); } if ($_REQUEST['format']) { if (!class_exists('Outline')) { XN_Application::includeFile('xoxotools', '/OutlineClasses/Outline.php'); } $struct = new Outline(); $struct->addNode($grouptags); $struct->getNode(0)->setField('title', $group->title); $struct->getNode(0)->setField('relatedtags', new Outline(fetchTags($group))); if ($_REQUEST['format'] == 'xoxo') { header('Content-Type: application/xml;charset=utf-8'); $struct->getNode(0)->setField('text', $group->title); if ($_ITEMONLY) { echo $struct->getNode(0)->toXOXO('item'); } else { echo $struct->toXOXO(); } } //end if format == xoxo if ($_REQUEST['format'] == 'json') { header('Content-Type: text/javascript;charset=utf-8');