protected function doDisplay(array $context, array $blocks = array()) { // line 1 echo " <!--sidebar start-->\n <aside>\n <div id=\"sidebar\" class=\"nav-collapse \">\n <!-- sidebar menu start-->\n <ul class=\"sidebar-menu\">\n "; // line 6 echo twig_escape_filter($this->env, render_menu(), "html", null, true); echo "\n </ul>\n <!-- sidebar menu end-->\n </div>\n </aside>\n <!--sidebar end-->"; }
function render_menu($items, $parent = NULL) { $html = ''; $ignored = array(); foreach ($items as $item) { $controller_name = 'Controller_Manager_' . $item; if (class_exists($controller_name)) { $reflector = new ReflectionClass($controller_name); if ($reflector->isAbstract()) { continue; } } if (in_array($item, $ignored)) { continue; } $matches = preg_grep('/^' . $item . '_/i', $items); if ($matches and !$parent) { $html .= '<li><a href="#" class="dropdown-toggle" data-toggle="dropdown">'; $html .= __(Inflector::plural($item)) . ' <span class="caret"></span>'; $html .= '</a>'; $html .= '<ul class="dropdown-menu">'; if (Can::show($item, 'index')) { $html .= '<li><a href="./manager/' . strtolower($item) . '">' . __(Inflector::plural($item)) . '</a></li>'; } $html .= render_menu($matches, $item); $html .= '</ul></li>'; $ignored = array_merge($ignored, $matches); } else { if (!Can::show($item, 'index')) { continue; } $prepend = ''; if ($parent) { $underlines = count(explode('_', $item)); if ($underlines >= 3) { for ($i = $underlines; $i > 3; $i--) { $prepend .= '<i class="glyphicon glyphicon-option-horizontal"></i>'; } $prepend .= '<i class="glyphicon glyphicon-triangle-right"></i>'; } } $html .= '<li><a href="./manager/' . strtolower($item) . '">' . $prepend . __(Inflector::plural($item)) . '</a></li>'; } } return $html; }
<?php include "system/core.php"; render_header("Sistema de Acompanhamento Legislativo e Gestão de Gabinete"); ?> <div id="header"> <?php render_menu(); ?> <div id="content"> <?php $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, 'http://www.camara.gov.br/SitCamaraWS/Orgaos.asmx/ObterOrgaos'); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Your application name'); $query = curl_exec($curl_handle); curl_close($curl_handle); $xml = new SimpleXMLElement($query); ?> <legend> Lista todas as proposições presentes nas pautas das Comissões</legend> <table class="table table-striped"> <thead> <tr>
//$friends = $fb->api_client->friends_get(); $user = $_POST['fb_sig_user']; $friends = explode(",", $_POST['fb_sig_friends']); if (isset($_POST['what'])) { $who = $user; $what = $_POST['what']; $description = $_POST['description']; $value = $_POST['value']; $available = (bool) false; if ($_POST['available'] == 1) { $available = (bool) true; } add_shared_item($who, $what, $description, $value, $available); $render_msg = (bool) true; } echo render_menu("my_listings", $user, $friends); echo render_tabs(0); if ($render_msg) { ?> <fb:success> <fb:message>Your shared item has been added.</fb:message> </fb:success> <?php } ?> <div style="background-color: white; border: 1px solid black; margin: 10px"> <table style="width: 100%"> <tr><td style="vertical-align: top; width: 0%" rowspan="5"> <fb:profile-pic uid="<?php echo $user;
header('Location: ' . $_SERVER['REQUEST_URI'] . '/'); } $url = substr($_SERVER['REQUEST_URI'], 1, -1); $file = find_active_file($url); if (!$file) { $file = $_ENV['content_dir'] . '_errors/404.html'; $response_code = 404; } else { $response_code = 200; } $content = file_get_contents($file); $parsedown = Parsedown::instance(); $parsedown->setBreaksEnabled(true); $content = ['body' => $parsedown->text($content)]; if ($response_code != 400) { $content['nav'] = render_menu(get_menu($url)); } $template = file_get_contents(__DIR__ . '/templates/index.html'); foreach ($content as $k => $v) { $template = str_replace('###' . strtoupper($k) . '###', $v, $template); } echo $template; function find_active_file($url) { $content_dir = $_ENV['content_dir']; $path = $content_dir . $url; if (file_exists($path) && file_exists($path . '/' . 'index.html')) { return $path . '/' . 'index.html'; } elseif (file_exists($path . '.html')) { return $path . '.html'; }
function final_render() { global $CUR_TEMPLATE, $PAGE; render_menu(); template_define_text($PAGE); template_gpath_fix(); template_add_css_js(); print $CUR_TEMPLATE[content]; }
/** * Take a stored menu identifier, and return an XHTML menu created from it. * * @param ID_TEXT The type of the menu (determines which templates to use) * @param SHORT_TEXT The menu identifier to use * @param boolean Whether to silently return blank if the menu does not exist * @return tempcode The generated tempcode of the menu */ function build_stored_menu($type, $menu, $silent_failure = false) { if ($menu == 'admin_ocf' && get_forum_type() != 'ocf') { return $silent_failure ? new ocp_tempcode() : make_string_tempcode('NA_EM'); } if ($menu == '_bookmarks') { require_code('menus_bookmarks'); $items = build_bookmarks_menu(); } elseif ($menu == '_management') { $items = build_management_menu(); } elseif ($menu == '_community') { $items = build_community_menu(); if (count($items) == 0) { return new ocp_tempcode(); } } elseif ($menu == '_zone_menu') { $items = build_zone_menu(); } elseif (substr($menu, 0, 3) == '!!!') { require_code('menus_sitemap'); $parts = explode(':', substr($menu, 3)); $items = build_sitetree_menu($parts); } else { $items = persistant_cache_get(array('MENU', $menu)); if (is_null($items)) { $items = $GLOBALS['SITE_DB']->query_select('menu_items', array('id', 'i_caption_long', 'i_new_window', 'i_expanded', 'i_parent', 'i_caption', 'i_url', 'i_check_permissions', 'i_page_only', 'i_theme_img_code'), array('i_menu' => $menu), 'ORDER BY i_order'); foreach ($items as $i => $item) { $items[$i]['cap'] = get_translated_text($item['i_caption']); $items[$i]['i_caption_long'] = get_translated_text($item['i_caption_long']); } persistant_cache_set(array('MENU', $menu), $items); } } if (count($items) == 0 && substr($menu, 0, 1) != '_' && substr($menu, 0, 3) != '!!!') { if ($silent_failure) { return new ocp_tempcode(); } $redirect = get_self_url(true, true); $_add_url = build_url(array('page' => 'admin_menus', 'type' => 'edit', 'id' => $menu, 'redirect' => $redirect, 'wide' => 1), 'adminzone'); $add_url = $_add_url->evaluate(); return do_template('INLINE_WIP_MESSAGE', array('MESSAGE' => do_lang_tempcode('MISSING_MENU', escape_html($menu), escape_html($add_url)))); } $i = 0; $root = array('type' => 'root', 'caption' => $type, 'special' => $menu, 'children' => array(), 'only_on_page' => NULL, 'modifiers' => array()); for ($i = 0; $i < count($items); $i++) { if (array_key_exists($i, $items)) { $item = $items[$i]; // Search for children if (is_null($item['i_parent'])) { $new_kids_on_the_block = build_stored_menu_branch($item, $items); // HACKHACK: Cleaner way preferable, but needs new DB field! if (array_key_exists('i_caption_long', $item) && substr($item['i_caption_long'], 0, 3) == '!!!') { $new_kids_on_the_block['caption_long'] = ''; } // HACKHACK: Cleaner way preferable, but needs new DB field! if (array_key_exists('i_caption_long', $item) && substr($item['i_caption_long'], 0, 2) == '@@') { $new_kids_on_the_block['caption_long'] = ''; } $root['children'][] = $new_kids_on_the_block; } } } $content = render_menu($root, NULL, $type, true); if ($menu[0] != '_' && substr($menu, 0, 3) != '!!!' && has_actual_page_access(get_member(), 'admin_menus')) { $redirect = get_self_url(true, true); $url = build_url(array('page' => 'admin_menus', 'type' => 'edit', 'id' => $root['special'], 'redirect' => $redirect, 'wide' => 1, 'clickable_sections' => $type == 'popup' || $type == 'dropdown' ? 1 : 0), 'adminzone'); $content->attach(do_template('MENU_STAFF_LINK', array('_GUID' => 'a5209ec65425bed1207e2f667d9116f6', 'TYPE' => $type, 'EDIT_URL' => $url, 'NAME' => $menu))); } return $content; }
<?php include_once "header.php"; render_menu(""); ?> <section> <article> <img src="/claire/photos/Travel/tumblr_moqxw1t4I31qhgya9o1_1280.jpg" alt="Test photo" /> </article> </section> <?php include_once "footer.php";
/** * Takes some comcode, and return an XHTML menu created from it. * * @param LONG_TEXT The contents of the comcode menu tag * @param SHORT_TEXT An identifier for this menu (will be used as a unique id by menu javascript code) * @param MEMBER The member the menu is being built as * @param ID_TEXT The menu type (determines what templates get used) * @return tempcode The generated tempcode of the menu */ function build_comcode_menu($comcode, $menu, $source_member, $type) { // Reset $level = -1; $expanded = true; $expander = array(); $expander[0] = -1; // Loop $i = 0; $lines = explode(chr(10), $comcode); $stack = array(); // Stores the previous level(s) if we are jumping down to a further one $root_branch = array('type' => 'root', 'caption' => $type, 'special' => $menu, 'children' => array(), 'only_on_page' => NULL, 'modifiers' => array()); $current_level = $root_branch; if (count($lines) == 0) { return new ocp_tempcode(); } // Fix up if lines aren't indented by one -- Junk code, don't need it /* if ($lines[0][0]!=' ') { for ($j=0;$j<count($lines);$j++) { $lines[$j]=' '.$lines[$j]; } }*/ foreach ($lines as $line) { if (trim($line) == '') { if ($i != 0 && $i < count($lines) - 2) { $current = array('type' => 'blank', 'caption' => NULL, 'special' => '', 'children' => NULL, 'only_on_page' => NULL, 'modifiers' => array()); $current_level[] = $current; } continue; } // Detect which level we are on $last_level = $level; // Only update our parent level if we actually went down a level last time // See what level we are on by counting the spaces for ($levels = 1; $levels < 10; $levels++) { if ($line[$levels - 1] != ' ') { break; } } $level = $levels - 1; if ($level > $last_level + 1) { require_code('comcode_renderer'); comcode_parse_error(false, array('CCP_MENU_JUMPYNESS'), $i, $comcode); } if ($last_level - $level == 0 && $current_level['type'] == 'drawer' && strpos($line, '=') === false) { $last_level++; } for ($x = 0; $x < $last_level - $level; $x++) { if (strpos($line, '=') !== false) { require_code('comcode_renderer'); comcode_parse_error(false, array('CCP_MENU_JUMPYNESS'), $i, $comcode); } $this_level = $current_level; $current_level = array_pop($stack); $current_level['children'][] = $this_level; } // Expansion method if ($line[$level] == '+') { $expanded = true; $expander[$level] = -1; } else { /* $expand_this=get_param_integer('keep_'.$menu.'_expand_'.$i,0); $expanded=($expand_this==1); PROBLEMS WITH CACHE - SO WE'LL USE JAVASCRIPT FOR THIS */ $expanded = false; $expander[$level] = $i; } // Find where the URL starts $pos = strpos($line, '='); // Find the caption if ($pos === false) { $caption = rtrim(substr($line, $line[$level] != '+' && $line[$level] != '-' ? $level : $level + 1)); } else { $caption = rtrim(substr($line, $level, $pos - $level)); } $modifiers = array(); if ($caption[0] == '@') { $caption = substr($caption, 1); } // For childed branches if ($pos === false) { // Are we expanding or contracting? if ($expanded || $expander[$level] == -1) { $modifiers['expanded'] = 1; } array_push($stack, $current_level); $current_level = array('type' => 'drawer', 'caption' => $caption, 'special' => '', 'children' => array(), 'only_on_page' => NULL, 'modifiers' => $modifiers); } else { $url = ltrim(substr($line, $pos + 1)); if ($url[0] == '~') { $url = substr($url, 1); $modifiers['new_window'] = 1; } /*elseif ($url[0]=='?') Cache says no-no { $url=substr($url,1); $modifers['check_perms']=1; }*/ $current_level['children'][] = array('type' => 'link', 'caption' => $caption, 'special' => @html_entity_decode($url, ENT_QUOTES, get_charset()), 'children' => array(), 'only_on_page' => NULL, 'modifiers' => $modifiers); } $i++; } for ($x = 0; $x < count($stack); $x++) { $this_level = $current_level; $current_level = array_pop($stack); $current_level['children'][] = $this_level; } return render_menu($current_level, $source_member, $type); }
function simpl_preprocess_page(&$vars) { if ($vars['is_front']) { // load homepage promoted menu $vars['menus']['promoted'] = render_menu('menu-promoted'); // load populare content $vars['popular'] = get_v('popular'); // pprint($vars['popular']); $vars['nq'] = array(); // load hero nodequeue $nq_hero = nodequeue_load_nodes(1, false, 0, 1); foreach ($nq_hero as $node) { $hero[] = n_load($node->nid); } $vars['nq']['hero'] = $hero; // load promoted nodequeue $nq_featured = nodequeue_load_nodes(2, false, 0, 3); foreach ($nq_featured as $node) { $featured[] = n_load($node->nid); } $vars['nq']['featured'] = $featured; // load latest nodequeue $nq_latest = nodequeue_load_nodes(4, false, 0, 12); foreach ($nq_latest as $node) { $latest[] = n_load($node->nid); } $vars['nq']['latest'] = $latest; // load opinions nodequeue $nq_opinions = nodequeue_load_nodes(5, false, 0, 6); foreach ($nq_opinions as $node) { $opinions[] = $node->nid; } $vars['nq']['opinions'] = array_values(node_load_multiple($opinions)); //$vars['opinions'] = array_values(get_vn('taxonomy_term', array('all', 1,'blog'), 5)); } /* Node page */ if (!empty($vars['node'])) { $GLOBALS['body-class'] = 'node-page'; $vars['n'] = node_load($vars['node']->nid); $section_id = $vars['n']->field_section['und'][0]['tid']; $tags = $vars['n']->field_tags['und']; if (count($tags)) { $tags_ids = []; foreach ($tags as $tag) { $tags_ids[] = $tag['tid']; } } $vars['more'] = array_values(get_vn('taxonomy_term', array(join('+', $tags_ids), 1, 'article', $vars['node']->nid), 3)); $vars['readlist'] = array_values(get_vn('taxonomy_term', array($section_id, 1, 'article+blog+gallery'), 5)); $vars['related'] = array_values(get_vn('taxonomy_term', array($section_id, 1, $vars['n']->type), 5)); $vars['tags'] = get_tags($vars['n']); $vars['popular'] = get_v('popular'); if ($vars['node']->type == 'article') { //create dedicated page for node, f**k the drupal nesting shit $vars['theme_hook_suggestions'][] = '__article'; $vars['r'] = node_view($vars['n'])['body'][0]['#markup']; $vars['author'] = get_author($vars['n']); } else { if ($vars['node']->type == 'blog') { $vars['theme_hook_suggestions'][] = '__blog'; $author = get_author($vars['n']); $vars['blog']['author'] = $author; //pprint($author); $element1 = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => render_image('x585', $author->image_src))); $element2 = array('#tag' => 'link', '#attributes' => array('rel' => 'image_src', 'type' => 'image/jpeg', 'href' => render_image('x585', $author->image_src))); drupal_add_html_head($element1, 'element1'); drupal_add_html_head($element2, 'element2'); // load opinions nodequeue $nq_opinions = nodequeue_load_nodes(5, false, 0, 6); foreach ($nq_opinions as $node) { $opinions[] = $node->nid; } $vars['nq']['opinions'] = array_values(node_load_multiple($opinions)); $vars['readlist'] = array_values(get_vn('opinions_author', array($vars['blog']['author']->nid, $vars['node']->nid), 5)); } else { if ($vars['node']->type == 'author') { $vars['theme_hook_suggestions'][] = '__author'; $vars['author'] = get_author($vars['n']); $element1 = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => render_image('x585', $vars['author']->image_src))); $element2 = array('#tag' => 'link', '#attributes' => array('rel' => 'image_src', 'type' => 'image/jpeg', 'href' => render_image('x585', $vars['author']->image_src))); drupal_add_html_head($element1, 'element1'); drupal_add_html_head($element2, 'element2'); // load opinions nodequeue $nq_opinions = nodequeue_load_nodes(5, false, 0, 6); foreach ($nq_opinions as $node) { $opinions[] = $node->nid; } $vars['nq']['opinions'] = array_values(node_load_multiple($opinions)); $vars['opinions_author'] = array_values(get_vn('opinions_author', array($vars['n']->nid, 0), 10)); //pprint($vars['opinions_author']); } else { if ($vars['node']->type == 'social') { $vars['author'] = get_author($vars['n']); $vars['theme_hook_suggestions'][] = '__social'; } else { if ($vars['node']->type == 'page') { $vars['theme_hook_suggestions'][] = '__static'; } } } } } } /* --- Node page ----- */ /* Taxonomy Term pages */ if (arg(0) == 'taxonomy' && arg(1) == 'term' && arg(4) == 'blog') { // load opinions nodequeue $nq_opinions = nodequeue_load_nodes(5, false, 0, 6); foreach ($nq_opinions as $node) { $opinions[] = $node->nid; } $vars['nq']['opinions'] = array_values(node_load_multiple($opinions)); $vars['theme_hook_suggestions'][] = '__opinions'; } /* --- Taxonomy Term pages ----- */ }
<?php include_once '../client/facebook.php'; include_once 'lib.php'; include_once 'config.php'; // can't use 0 for "no items" because $friend_limits[$friend_uid] // returns nul=0 if $friend_uid does not exist; when friend doesn't // exist, we want drop-down set to default value; use escape-value=-1 // to work-around nul=0. $SHARE_NONE = -1; $limit2text = array("{$SHARE_NONE}" => "no items", "20" => "items under \$20", "50" => "items under \$50", "100" => "items under \$100", "200" => "items under \$200", "500" => "items under \$500", "1000" => "items under \$1000", "{$SHARE_ALL}" => "all items"); global $SHARE_LIMIT_DEFAULT; $user = $_REQUEST['fb_sig_user']; $fb = FB::get($api_key, $secret); echo render_menu("my_listings", $user); echo render_tabs(2); $checked = ""; if (isset($_GET['check']) && $_GET['check'] == "all") { $checked = "checked"; } if (isset($_POST['share_limit'])) { if (isset($_POST['selected_friends'])) { $friends = $_POST['selected_friends']; $share_limit = $_POST['share_limit']; foreach ($friends as $friend) { add_share_limit($user, $friend, $share_limit); } } else { echo '<fb:error message="Must select at least one friend." />'; } }
<?php $gallery_name = $_GET["gallery"]; include_once "header.php"; render_menu($gallery_name); ?> <section> <article> <?php preg_match("([^./]*)", $gallery_name, $output_array); //pour éviter les arnaques qui listeraient des fichiers privés //gestion du pre-fetching des images d'autres catégories if (!empty($output_array)) { $gallery_name = $output_array[0]; $photo_directories = scandir("photos"); if ($photo_directories) { $i = 0; foreach ($photo_directories as $directory) { if ($i > 1 && $directory != $gallery_name) { //pour éviter de lister . et .. $photos = scandir("photos/{$directory}"); if ($photos) { $j = 0; foreach ($photos as $photo) { if ($j > 3) { break; } if (preg_match("(\\.(jpg|png|gif|JPG|PNG)\$)", $photo)) { echo "<img class='caching' src='data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' data-src='/claire/photos/{$directory}/{$photo}' />"; } $j++;
<?php include_once "header.php"; render_menu("bio-contact"); ?> <section> <h2>Bio</h2> <p>Hello, I'm Claire Désérable.</p> <h2>Contact</h2> <p>Feel free to contact me <a href='mail:contact@stymaar.fr'>here</a></p> </section> <?php include_once "footer.php";
<?php include_once 'client/facebook.php'; include_once 'lib.php'; include_once 'config.php'; $user = $_POST['fb_sig_user']; $friends = explode(",", $_POST['fb_sig_friends']); $checked = ""; if (isset($_GET['select_all']) && $_GET['select_all'] == 1) { $checked = "checked"; } $fb = FB::get($api_key, $secret); echo render_menu("invite", $user, $friends); $appUsers = $fb->api_client->friends_getAppUsers(); $invite_friends = array_diff($friends, $appUsers); ?> <div style="background-color:white;padding:0 40px 0 10px"> <h1 style="margin-bottom:5px">Invite Your Friends to Share Their Things</h1> Once your friends have added the app, you will be able to check out the things they are sharing by clicking on the My Friends' Shared Things at the top of the page. </div> <?php /* <fb:explanation> <fb:message> Limits on Invitations<br/> <div style="size:75%"> Facebook enforces a limit on the number of invites you can send. It
<?php include_once 'client/facebook.php'; include_once 'lib.php'; include_once 'config.php'; // initialize facebook app $fb = FB::get($api_key, $secret); $fb->require_frame(); $user = $fb->require_login(); // render menu, 0="My friends' shared things" tab active $friends = $fb->api_client->friends_get(); echo render_menu("index", $user, $friends); // creates default share limits for 1st time users init_share_limits($user, $friends); $appUsers = $fb->api_client->friends_getAppUsers(); ?> <div style="background-color: white; padding: 0 40px 0 10px"> <h1 style="margin-bottom: 5px"><a href="invite.php">Invite your friends</a> to share their things</h1> This page is for sharing things with your friends, but only <?php echo count($appUsers); ?> of your friends have installed the "Share Things" app. Go to the <a href="invite.php">invite page</a> to invite your friends to share things. </div> <?php // iterate through each friend of users's foreach ($friends as $friend) { $shared_items = get_shared_items($friend, $user); if (count($shared_items) > 0) {
function render_menu($arr, $depth = 0) { global $FANNIE_URL, $FANNIE_NAV_POSITION; // $FANNIE_NAV_POSITION = "top"; foreach ($arr as $entry) { if (strlen($entry['url']) != 0 && substr($entry['url'], 0, 1) != '/' && !strstr($entry['url'], '://')) { $entry['url'] = $FANNIE_URL . $entry['url']; } if ($depth == 0) { if (isset($FANNIE_NAV_POSITION) && $FANNIE_NAV_POSITION == "top") { /* 6Oct13 Woodshed comments, will remove when finished. height does not give a uniform height. Does if subhead not below. The li contains all the submenus. The reachability of the submenu is dependent on the offset from the list item, so fixed width important unless the offset can be actual-width-aware. */ echo "<li style='width:140px; height:20px; margin-right:0.8em; float:left; \n border-bottom:1px solid #ccc;' class='menu0' title='{$entry["subheading"]}'>"; //printf('<li style="height:40px; margin-right:0.8em; float:left;" class="menu%d">',$depth); //printf('<li style="width:15%%; height:40px; margin-right:0.8em; float:left;" class="menu%d">',$depth); } else { printf('<li style="width:100%%;" class="menu%d">', $depth); } } else { echo '<li>'; } printf('<a href="%s">%s</a>', $entry['url'], $entry['label']); if (isset($entry['submenu']) && is_array($entry['submenu']) && count($entry['submenu']) != 0) { echo '<div class="menuwrapper">'; printf('<div class="submenu level%d" style="width:155px;top:-38px;left:135px;">', $depth); echo '<ul style="">'; render_menu($entry['submenu'], $depth + 1); echo '</ul></div></div>'; } if (isset($FANNIE_NAV_POSITION) && $FANNIE_NAV_POSITION == "top") { // Subhead inside list element. if (False && isset($entry['subheading']) && $depth == 0) { printf('<div class="sub">%s</div>', $entry['subheading']); } echo '</li>'; } else { // Subhead outside list element. echo '</li>'; if (isset($entry['subheading']) && $depth == 0) { printf('<div class="sub">%s</div>', $entry['subheading']); } } } }