function HandleDefault() { require_once "Http_Cache.php"; Http_Cache::setExpires(4 * 60 * 60); require_once "FileUtils.php"; require_once "TreeUtils.php"; require_once "RubricsData.php"; require_once "Cache/Lite/Function.php"; print " "; $options = array("cacheDir" => "../tmpcache/", "lifeTime" => 4 * 60 * 60); $cache = new Cache_Lite_Function($options); $rubrics = new RubricsData(); $res = $cache->call(array(&$rubrics, "getRootRubrics")); // $res = $rubrics->getRootRubrics(); $treeBuilder = new TreeBuilder(true, true, "TreeSrcData"); ob_start(); $treeBuilder->show($res); $_GLOBAL["Tree"] = ob_get_contents(); ob_end_clean(); $_GLOBAL["RegionsList"] = ""; $res = $rubrics->getRegions(); $_GLOBAL["RegionsList"] .= "<option value=\"0\" selected>Все</option>\n"; foreach ($res as $r) { $_GLOBAL["RegionsList"] .= "<option value=\"" . $r["id"] . "\">" . trim($r["region"]) . "</option>\n"; } $_GLOBAL["UsualStr"] = getUsual("Обычная очередь"); $_GLOBAL["TestStr"] = getTest("Тестовая очередь"); $_GLOBAL["SpecStr"] = getSpec("Специальная очередь"); include "templates/index.html"; }
/** * {@inheritdoc} */ public function getConfigTreeBuilder() { $builder = new TreeBuilder(); $root = $builder->root('innmind_rest_server'); $root->useAttributeAsKey('name')->prototype('array')->children()->arrayNode('children')->info('Recursive directories of resources')->prototype('variable')->end()->defaultValue([])->end()->arrayNode('resources')->useAttributeAsKey('name')->prototype('array')->children()->scalarNode('identity')->isRequired()->end()->scalarNode('gateway')->isRequired()->end()->arrayNode('properties')->useAttributeAsKey('name')->prototype('array')->children()->scalarNode('type')->isRequired()->end()->arrayNode('access')->prototype('scalar')->end()->defaultValue([Access::READ])->end()->arrayNode('variants')->prototype('scalar')->end()->defaultValue([])->end()->booleanNode('optional')->defaultFalse()->end()->arrayNode('options')->prototype('variable')->end()->defaultValue([])->end()->end()->end()->end()->arrayNode('options')->prototype('variable')->end()->defaultValue([])->end()->arrayNode('metas')->prototype('variable')->end()->defaultValue([])->end()->booleanNode('rangeable')->defaultTrue()->end()->arrayNode('linkable_to')->prototype('scalar')->end()->defaultValue([])->end()->end()->end()->end()->end()->end(); return $builder; }
/** * {@inheritdoc} */ public function getAclResources() { $aclResourceConfig = $this->_configReader->read(); if (!empty($aclResourceConfig['config']['acl']['resources'])) { return $this->_resourceTreeBuilder->build($aclResourceConfig['config']['acl']['resources']); } return []; }
/** * {@inheritdoc} */ public function getAclResources() { // TODO: As soon as all acl.xml files are moved to global scope, default ('global') scope should be used $aclResourceConfig = $this->_configReader->read('adminhtml'); if (!empty($aclResourceConfig['config']['acl']['resources'])) { return $this->_resourceTreeBuilder->build($aclResourceConfig['config']['acl']['resources']); } return array(); }
private function createPropertiesNode() : NodeDefinition { $builder = new TreeBuilder(); $node = $builder->root('properties'); $node->canBeUnset()->useAttributeAsKey('name')->requiresAtLeastOneElement()->prototype('array')->prototype('variable')->end()->beforeNormalization()->always()->then(function ($value) { if (is_string($value)) { return ['type' => $value]; } $type = $value['type'] ?? null; if (empty($type)) { throw new InvalidConfigurationException(); } return $value; })->end()->end(); return $node; }
function test() { $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.default.header.html') . file_get_contents(HTML2PS_DIR . 'default.css') . file_get_contents(dirname(__FILE__) . '/test.default.footer.html')); $pipeline = new Pipeline(); $pipeline->scan_styles($tree); $css = $pipeline->get_current_css(); $input_rules = $css->tag_filtered['input']; $this->assertEquals(count($input_rules), 10); }
function test() { $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.class.case.html')); $pipeline = new Pipeline(); $pipeline->configure(array('renderimages' => true)); $pipeline->scan_styles($tree); $css = $pipeline->get_current_css(); $this->assertEquals(count($css->rules), 1); $rule = $css->rules[0]; $this->assertEquals(array(SELECTOR_ID, 'quickSummary'), $rule->selector[1][0]); }
function HandleExpandNode() { require_once "Http_Cache.php"; Http_Cache::setExpires(4 * 60 * 60); if (!isset($_REQUEST["nodeId"])) { return; } header("Content-type: text/html; charset=windows-1251"); print " "; require_once "TreeUtils.php"; require_once "RubricsData.php"; require_once "Cache/Lite/Function.php"; $options = array("cacheDir" => "../tmpcache/", "lifeTime" => 4 * 60 * 60); $cache = new Cache_Lite_Function($options); $rubrics = new RubricsData(); // $res = $cache->call(array(&$rubrics, "getChildrenRubrics"), // (int)$_REQUEST["nodeId"]); $res = $rubrics->getChildrenRubrics((int) $_REQUEST["nodeId"]); $treeBuilder = new TreeBuilder(false, false); $treeBuilder->show($res); }
function test() { $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.2.html')); $pipeline = new Pipeline(); $pipeline->scan_styles($tree); $css = $pipeline->get_current_css(); $this->assertEquals(count($css->rules), 1); $rule = $css->rules[0]; $selector = $rule->selector; $this->assertEquals($selector[1][0][0], SELECTOR_CLASS); $this->assertEquals($selector[1][0][1], 'test'); }
function test() { $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.margin.left.html')); $pipeline = new Pipeline(); $pipeline->configure(array('renderimages' => true)); $pipeline->scan_styles($tree); $css = $pipeline->get_current_css(); $this->assertEquals(count($css->rules), 1); $rule = $css->rules[0]; $margin = $rule->body->_properties[0]->_value; $this->assertEquals(UNIT_PX, $margin->_units->_unit); $this->assertEquals(600, $margin->_units->_number); }
function test() { $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.7.html')); $pipeline = new Pipeline(); $pipeline->configure(array('renderimages' => true)); $pipeline->scan_styles($tree); $css = $pipeline->get_current_css(); $this->assertEquals(count($css->rules), 1); $rule = $css->rules[0]; $this->assertEquals(count($rule->body->_properties), 1); $property = $rule->body->_properties[0]; $this->assertEquals($property->_code, CSS_BACKGROUND); $this->assertEquals($property->_value->_image->_url, 'http://localhost/intl/en_com/images/logo_plain.png'); }
function IFrameBox(&$root, $pipeline) { $this->InlineBlockBox(); // If NO src attribute specified, just return. if (!$root->has_attribute('src') || trim($root->get_attribute('src')) == '') { return; } // Determine the fullly qualified URL of the frame content $src = $root->get_attribute('src'); $url = $pipeline->guess_url($src); $data = $pipeline->fetch($url); /** * If framed page could not be fetched return immediately */ if (is_null($data)) { return; } /** * Render only iframes containing HTML only * * Note that content-type header may contain additional information after the ';' sign */ $content_type = $data->get_additional_data('Content-Type'); $content_type_array = explode(';', $content_type); if ($content_type_array[0] != "text/html") { return; } $html = $data->get_content(); // Remove control symbols if any $html = preg_replace('/[\\x00-\\x07]/', "", $html); $converter = Converter::create(); $html = $converter->to_utf8($html, $data->detect_encoding()); $html = html2xhtml($html); $tree = TreeBuilder::build($html); // Save current stylesheet, as each frame may load its own stylesheets // $pipeline->pushCSS(); $css =& $pipeline->getCurrentCSS(); $css->scan_styles($tree, $pipeline); $frame_root = traverse_dom_tree_pdf($tree); $box_child =& create_pdf_box($frame_root, $pipeline); $this->add_child($box_child); // Restore old stylesheet // $pipeline->popCSS(); $pipeline->pop_base_url(); }
function test() { $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.8.html')); $pipeline = new Pipeline(); $pipeline->configure(array('renderimages' => true)); $pipeline->scan_styles($tree); $css = $pipeline->get_current_css(); $this->assertEquals(count($css->rules), 1); $rule = $css->rules[0]; $this->assertEquals(count($rule->body->_properties), 1); $property = $rule->body->_properties[0]; $this->assertEquals($property->_code, CSS_BACKGROUND_COLOR); $this->assertEquals($property->_value->r, 1); $this->assertEquals($property->_value->g, 1); $this->assertEquals($property->_value->b, 1); $this->assertEquals($property->_value->transparent, false); }
function &process($html, &$pipeline, &$media) { // Run the XML parser on the XHTML we've prepared $dom_tree = TreeBuilder::build($html); // Check if parser returned valid document if (is_null($dom_tree)) { readfile(HTML2PS_DIR . '/templates/cannot_parse.html'); error_log(sprintf("Cannot parse document: %s", $pipeline->get_base_url())); die("HTML2PS Error"); } /** * Detect the base URI for this document. * * According to the HTML 4.01 p. 12.4.1: * User agents must calculate the base URI according to the following precedences (highest priority to lowest): * * 1. The base URI is set by the BASE element. * 2. The base URI is given by meta data discovered during a protocol interaction, such as an HTTP header (see [RFC2616]). * 3. By default, the base URI is that of the current document. Not all HTML documents have a base URI (e.g., a valid HTML document may appear in an email and may not be designated by a URI). Such HTML documents are considered erroneous if they contain relative URIs and rely on a default base URI. */ /** * Check if BASE element present; use its first occurrence */ $this->_scan_base($dom_tree, $pipeline); /** * @todo fall back to the protocol metadata */ /** * Parse STYLE / LINK nodes containing CSS references and definitions * This should be done here, as the document body may include STYLE node * (this violates HTML standard, but is rather often appears in Web) */ $css =& $pipeline->getCurrentCSS(); $css->scan_styles($dom_tree, $pipeline); if (!is_null($media)) { // Setup media size and margins $pipeline->get_page_media(1, $media); $pipeline->output_driver->update_media($media); $pipeline->_setupScales($media); } $body =& traverse_dom_tree_pdf($dom_tree); $box =& create_pdf_box($body, $pipeline); return $box; }
function test() { $tree = TreeBuilder::build(file_get_contents(dirname(__FILE__) . '/test.process.padding.html')); $pipeline = new Pipeline(); $pipeline->configure(array('renderimages' => true)); $pipeline->scan_styles($tree); $css = $pipeline->get_current_css(); $this->assertEquals(count($css->rules), 1); $rule = $css->rules[0]; $padding = $rule->body->_properties[1]->_value; $this->assertEquals(UNIT_PX, $padding->top->_units->_unit); $this->assertEquals(0, $padding->top->_units->_number); $this->assertEquals(UNIT_PX, $padding->right->_units->_unit); $this->assertEquals(175, $padding->right->_units->_number); $this->assertEquals(UNIT_PX, $padding->bottom->_units->_unit); $this->assertEquals(0, $padding->bottom->_units->_number); $this->assertEquals(UNIT_PX, $padding->left->_units->_unit); $this->assertEquals(110, $padding->left->_units->_number); }
function FrameBox(&$root, &$pipeline) { $css_state =& $pipeline->getCurrentCSSState(); // Inherit 'border' CSS value from parent (FRAMESET tag), if current FRAME // has no FRAMEBORDER attribute, and FRAMESET has one $parent = $root->parent(); if (!$root->has_attribute('frameborder') && $parent->has_attribute('frameborder')) { $parent_border = $css_state->getPropertyOnLevel(CSS_BORDER, CSS_PROPERTY_LEVEL_PARENT); $css_state->setProperty(CSS_BORDER, $parent_border->copy()); } $this->GenericContainerBox($root); // If NO src attribute specified, just return. if (!$root->has_attribute('src')) { return; } // Determine the fullly qualified URL of the frame content $src = $root->get_attribute('src'); $url = $pipeline->guess_url($src); $data = $pipeline->fetch($url); /** * If framed page could not be fetched return immediately */ if (is_null($data)) { return; } /** * Render only iframes containing HTML only * * Note that content-type header may contain additional information after the ';' sign */ $content_type = $data->get_additional_data('Content-Type'); $content_type_array = explode(';', $content_type); if ($content_type_array[0] != "text/html") { return; } $html = $data->get_content(); // Remove control symbols if any $html = preg_replace('/[\\x00-\\x07]/', "", $html); $converter = Converter::create(); $html = $converter->to_utf8($html, $data->detect_encoding()); $html = html2xhtml($html); $tree = TreeBuilder::build($html); // Save current stylesheet, as each frame may load its own stylesheets // $pipeline->pushCSS(); $css =& $pipeline->getCurrentCSS(); $css->scan_styles($tree, $pipeline); $frame_root = traverse_dom_tree_pdf($tree); $box_child =& create_pdf_box($frame_root, $pipeline); $this->add_child($box_child); // Restore old stylesheet // $pipeline->popCSS(); $pipeline->pop_base_url(); }
function parse_config_file($filename) { $doc = TreeBuilder::build(file_get_contents($filename)); $root = $doc->document_element(); $child = $root->first_child(); do { if ($child->node_type() == XML_ELEMENT_NODE) { switch ($child->tagname()) { case "fonts": global $g_font_resolver; parse_fonts_node_config_file($child, $g_font_resolver); break; case "fonts-pdf": global $g_font_resolver_pdf; parse_fonts_node_config_file($child, $g_font_resolver_pdf); break; case "media": add_predefined_media($child->get_attribute('name'), (int) $child->get_attribute('height'), (int) $child->get_attribute('width')); break; } } } while ($child = $child->next_sibling()); }
function parse_config_file($filename) { // Save old magic_quotes_runtime value and disable it $mq_runtime = get_magic_quotes_runtime(); set_magic_quotes_runtime(0); $doc = TreeBuilder::build(file_get_contents($filename)); $root = $doc->document_element(); $child = $root->first_child(); do { if ($child->node_type() == XML_ELEMENT_NODE) { switch ($child->tagname()) { case "fonts": global $g_font_resolver; parse_fonts_node_config_file($child, $g_font_resolver); break; case "fonts-pdf": global $g_font_resolver_pdf; parse_fonts_node_config_file($child, $g_font_resolver_pdf); break; case "media": add_predefined_media($child->get_attribute('name'), (double) $child->get_attribute('height'), (double) $child->get_attribute('width')); break; } } } while ($child = $child->next_sibling()); // Restore old magic_quotes_runtime values set_magic_quotes_runtime($mq_runtime); }
function FrameBox(&$root, &$pipeline) { // Inherit 'border' CSS value from parent (FRAMESET tag), if current FRAME // has no FRAMEBORDER attribute, and FRAMESET has one $parent = $root->parent(); if (!$root->has_attribute('frameborder') && $parent->has_attribute('frameborder')) { pop_border(); push_border(get_border()); } $this->GenericContainerBox($root); // If NO src attribute specified, just return. if (!$root->has_attribute('src')) { return; } // Determine the fullly qualified URL of the frame content $src = $root->get_attribute('src'); $url = $pipeline->guess_url($src); $data = $pipeline->fetch($url); /** * If framed page could not be fetched return immediately */ if (is_null($data)) { return; } /** * Render only iframes containing HTML only * * Note that content-type header may contain additional information after the ';' sign */ $content_type = $data->get_additional_data('Content-Type'); $content_type_array = explode(';', $content_type); if ($content_type_array[0] != "text/html") { return; } $html = $data->get_content(); // Remove control symbols if any $html = preg_replace('/[\\x00-\\x07]/', "", $html); $converter = Converter::create(); $html = $converter->to_utf8($html, $data->detect_encoding()); $html = html2xhtml($html); $tree = TreeBuilder::build($html); // Save current stylesheet, as each frame may load its own stylesheets // global $g_css; $old_css = $g_css; global $g_css_obj; $old_obj = $g_css_obj; scan_styles($tree, $pipeline); // Temporary hack: convert CSS rule array to CSS object $g_css_obj = new CSSObject(); foreach ($g_css as $rule) { $g_css_obj->add_rule($rule, $pipeline); } // TODO: stinks. Rewrite // $frame_root = traverse_dom_tree_pdf($tree); $box_child =& create_pdf_box($frame_root, $pipeline); $this->add_child($box_child); // Restore old stylesheet // $g_css = $old_css; $g_css_obj = $old_obj; $pipeline->pop_base_url(); }
foreach ($this->fields as $field) { $select .= "`" . $this->alias('osoby_pozycje', $i) . "`.`" . $field . "` AS '" . $this->alias('osoby_pozycje', $i) . "." . $field . "', "; } if ($isLast) { $select = substr($select, 0, -2) . " "; } if (!$isFirst) { $joins .= "LEFT JOIN `" . $this->name('osoby_pozycje') . "` as `" . $this->alias('osoby_pozycje', $i) . "` ON (`" . $this->alias('osoby_pozycje', $i - 1) . "`.`pozycja_id` = `" . $this->alias('osoby_pozycje', $i) . "`.`pozycja_id` AND `" . $this->alias('osoby_pozycje', $i) . "`.`deleted` = '0') "; $joins .= "LEFT JOIN `" . $this->name('osoby') . "` as `" . $this->alias('osoby', $i) . "` ON (`" . $this->alias('osoby_pozycje', $i) . "`.`osoba_id` = `" . $this->alias('osoby', $i) . "`.`id`) "; } } elseif ($type == 'pozycje') { $select .= "`" . $this->alias('pozycje', $i) . "`.`id` AS '" . $this->alias('pozycje', $i) . ".id', "; $select .= "`" . $this->alias('pozycje', $i) . "`.`nazwa` AS '" . $this->alias('pozycje', $i) . ".nazwa'"; $select .= $isLast ? " " : ", "; $joins .= "LEFT JOIN `" . $this->name('osoby_pozycje') . "` as `" . $this->alias('osoby_pozycje', $i) . "` ON (`" . $this->alias('osoby_pozycje', $i - 1) . "`.`osoba_id` = `" . $this->alias('osoby_pozycje', $i) . "`.`osoba_id` AND `" . $this->alias('osoby_pozycje', $i) . "`.`deleted` = '0') "; $joins .= "LEFT JOIN `" . $this->name('pozycje') . "` as `" . $this->alias('pozycje', $i) . "` ON (`" . $this->alias('osoby_pozycje', $i) . "`.`pozycja_id` = `" . $this->alias('pozycje', $i) . "`.`id`) "; } } $this->query = $select . $from . $joins . $where; } public function getQuery() { return $this->query; } } $depth = 3; $queryBuilder = new QueryBuilder($depth, $id); $query = $queryBuilder->getQuery(); $results = $this->DB->selectAssocs($query); $treeBuilder = new TreeBuilder($results, $id, $depth); return $treeBuilder->getData();
function TreeBuilder($isRoot = true, $printUL = true, $treeId = "", $className = "") { TreeBuilder::__constructor($isRoot, $printUL, $treeId, $className); }
function BoxPageMargin(&$pipeline, $at_rule) { $state =& $pipeline->get_current_css_state(); $state->pushDefaultState(); $root = null; $at_rule->css->apply($root, $state, $pipeline); $this->GenericContainerBox(); $this->readCSS($state); $state->pushDefaultstate(); /** * Check whether 'content' or '-html2ps-html-content' properties had been defined * (if both properties are defined, -html2ps-html-content takes precedence) */ $raw_html_content =& $at_rule->get_css_property(CSS_HTML2PS_HTML_CONTENT); $html_content = $raw_html_content->render($pipeline->get_counters()); if ($html_content !== '') { // We should wrap html_content in DIV tag, // as we treat only the very first box of the resulting DOM tree as margin box content $html_content = html2xhtml("<div>" . $html_content . "</div>"); $tree = TreeBuilder::build($html_content); $tree_root = traverse_dom_tree_pdf($tree); $body_box =& create_pdf_box($tree_root, $pipeline); $box =& $body_box->content[0]; } else { $raw_content =& $at_rule->get_css_property(CSS_CONTENT); $content = $raw_content->render($pipeline->get_counters()); $box =& InlineBox::create_from_text($content, WHITESPACE_PRE_LINE, $pipeline); } $this->add_child($box); $state->popState(); $state->popState(); }
<link href="<?php echo TREEVIEW_SOURCE; ?> css/style.css" rel="stylesheet" type="text/css"/> </head> <body class='<?php echo BODY_CLASS; ?> ;'> <?php //IMPORTANT! To be able to see the changes you have made to the code you have to clean the session. //(By uncomment the line below during one page load). // Be sure to comment the line when publishing the treeview, or else the treeview won´t remember the old state throu page loads. //unset($_SESSION["NodesHasBeenAddedUrl"]); $peerTree = new TreeBuilder($dbConn, $navtable, $tabInterestCount); $peerTree->buildTrees(); //Print the treeview. $peerTree->printTrees(); $tdClass = 'navleft'; $logoutlink = $root_url . '/logout.php'; ?> <div align='center' style='margin:5px 0 5px 0;' class='<?php echo $tdClass; ?> '>Userid <?php echo $_SESSION['peer_id']; ?> ,<?php echo $_SESSION['userCap']; ?>