function widget_block($options) { $mydirname = empty($options[0]) ? 'xpress' : $options[0]; $this_template = empty($options[1]) ? 'db:' . $mydirname . '_block_widget.html' : trim($options[1]); $title_show = empty($options[2]) ? false : true; $widget_select = empty($options[3]) ? '' : $options[3]; $selected = explode(',', $widget_select); $output = ''; foreach ($selected as $select) { $ex = explode('::', $select); $sidebar_id = $ex[0]; $widget_id = $ex[1]; ob_start(); render_widget($sidebar_id, $widget_id); $output .= ob_get_contents(); ob_end_clean(); } if (count($selected) > 1) { $output = "<ul>\n" . $output . "\n</ul>\n"; } else { if (!$title_show) { $del_pattern = '<[^>]*class\\s*=\\s*[\'|"]widgettitle[\'|"]\\s*>[^<]*<\\/[^>]*>'; $output = preg_replace('/' . $del_pattern . '/', '', $output); } if (preg_match('/^<li[^>]*>.*<\\/li>$/s', $output)) { $output = preg_replace('/^<li[^>]*>/', '', $output); $output = preg_replace('/<\\/li>$/', '', $output); } } $block['widget'] = $output; if (empty($output)) { $block['err_message'] = 'Selected Widget is not active. '; } return $block; }
function render_widget($rows = 5) { $json = apc_fetch(self::$forumKey); if (!$json) { return ""; } $items = json_decode($json, 1); $str = "<ul>"; foreach ($items as $item) { if ($rows-- == 0) { break; } $str .= "<li>" . $item["text"] . " <a href=\"{$item['link']}\"><img src=\"/images/permalink.gif\"></a> " . "<span class=\"forum-when\">(" . prettyDate($item["time"]) . "</span>)</li>"; } $str .= "</ul>"; return render_widget("forum", "YDN: <a href=\"http://developer.yahoo.net/forum/index.php?showforum=90\">Forums</a>", $str); }
function get_blog_widget($max) { $feed = "/var/www/blog/atom.xml"; if (!file_exists($feed)) { return ""; } $atom = file_get_contents($feed); $xml = simplexml_load_string($atom); $s = "<ul>"; foreach ($xml->entry as $item) { if ($max-- == 0) { break; } $link = (string) $item->link['href']; $title = (string) $item->title; $s .= "<li><a href=\"{$link}\">{$title}</a></li>"; } $s .= "</ul>"; return render_widget("blog", "BrowserPlus: <a href=\"/blog/\">Blog</a>", $s); }
<h2><?php echo lang_key('login'); ?> </h2> <div class="clearfix"></div> </div> </div> <div class="container"> <div class="row"> <?php echo $this->session->flashdata('msg'); ?> <div class="col-md-7"> <?php render_widget('login_page_description'); ?> </div> <div class="col-md-5"> <!-- Login starts --> <div class="well login-reg-form"> <!-- Heading --> <h4><?php echo lang_key('login_to_your_account'); ?> </h4> <hr /> <!-- Form --> <form action="<?php echo site_url('account/login'); ?>
<textarea placeholder="Type your message here..." class="form-control" rows="9" name="msg"><?php echo set_value('msg'); ?> </textarea> <?php echo form_error('msg'); ?> </div> </div> <br> <div class="row"> <div class="col-sm-6"> </div> <div class="col-sm-6 text-right"> <input class="btn btn-action" type="submit" value="Send message"> </div> </div> </form> </article> <!-- /Article --> <!-- Sidebar --> <aside class="col-sm-3 sidebar sidebar-right"> <?php echo render_widget('contact_text'); ?> </aside> <!-- /Sidebar --> </div>
function render() { return render_widget(); }
function render_search_widget($search, $rows = 5) { // note that data is stored in apc via a cron job $json = apc_fetch(self::$searchKey . $search); if (!$json) { return ""; } $tweets = json_decode($json); $str = "<ul>"; if ($tweets && $tweets->results) { foreach ($tweets->results as $t) { if ($t->from_user == $search) { continue; } if ($rows-- == 0) { break; } $time = prettyDate(strtotime($t->created_at)); $str .= "<li><a href=\"http://twitter.com/{$t->from_user}\">{$t->from_user}</a>: " . $this->hyperlinkit($t->text) . " <span class=\"tweet-when\">({$time})<span></li>"; } } $str .= "</ul>"; return render_widget("tweet", "Twitter: <a href=\"http://search.twitter.com/search?q={$search}\">Search</a>", $str); }
<div class="container"> <div class="col-md-9 col-sm-9 primary-header"> <!-- Logo section --> <div class="logo"> <h3><a href="<?php echo site_url(); ?> "><img src="<?php echo get_site_logo(); ?> " alt="Logo"></a></h3> </div> </div> <div class="col-md-3 col-sm-3 primary-header"> <?php render_widget('top_bar_social'); ?> </div> <div class="clearfix"></div> </div> </div> <!-- Top bar ends --> <!-- Header two Starts --> <div class="header-2"> <!-- Container --> <div class="container"> <div class="row"> <div class="col-md-12 col-sm-12">
<footer> <!-- Container --> <div class="container"> <!-- Footer Content --> <!-- Paragraph --> <p class="pull-left"><?php echo translate(get_settings('site_settings', 'footer_text', 'copyright@')); ?> </p> <?php render_widget('footer_links'); ?> <!-- Clearfix --> <div class="clearfix"></div> </div> </footer>
function render_issues_widget($num = 5) { $json = apc_fetch(self::$platformIssueKey); if ($json && ($issues = json_decode($json, 1))) { $s = "<ul>"; foreach ($issues as $i) { if ($num-- == 0) { break; } $s .= "<li><a href=\"http://github.com/browserplus/platform/issues/#issue/{$i['id']}\">{$i['title']}</a></li>"; } $s .= "</ul>"; return render_widget("issues", "GitHub: <a href=\"<a href=\"http://github.com/browserplus/platform/issues/\">Issues</a>", $s); } return ""; }
</span></h2> <div class="clearfix"></div> </div> </div> <div class="container"> <div class="row"> <div class="col-md-5"> <?php render_widget('register_page_description'); ?> </div> <div class="col-md-7"> <!-- Login starts --> <div class="well login-reg-form" > <!-- Heading --> <h4><?php echo lang_key('register_your_account'); ?>
function render_widget($num = 5) { $json = $this->get_cached_data(); if ($json && ($issues = json_decode($json, 1))) { $s = "<ul>"; foreach ($issues as $i) { if ($num-- == 0) { break; } $s .= "<li><span class=\"lighthouse-state\">" . $i["state"] . "</span>: " . "<a href=\"{$i['url']}\">{$i['title']}</a> " . "<span class=\"lighthouse-when\">(" . prettyDate($i['updated']) . ")<span></li>"; } $s .= "</ul>"; return render_widget("issues", "Lighthouse: <a href=\"http://browserplus.lighthouseapp.com/\">Tickets</a>", $s); } return ""; }
function render_widget($period) { $body = $this->get_hot_words($period, "/discuss/?search=", 20, 10, 20); return render_widget("irc-tags", "IRC Topics: " . ucfirst($period), $body); }