Changeset 2324
- Timestamp:
- 12/21/10 16:14:40 (17 months ago)
- Location:
- branches/1.5
- Files:
-
- 2 added
- 4 modified
-
content/admin_themes/admin_default/admin_header.php (modified) (1 diff)
-
content/admin_themes/admin_default/admin_home.php (modified) (1 diff)
-
content/admin_themes/admin_default/css/zrssfeed.css (added)
-
content/admin_themes/admin_default/javascript/jquery.zrssfeed.min.js (added)
-
content/themes/default/settings.php (modified) (1 diff)
-
libs/Feeds.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/content/admin_themes/admin_default/admin_header.php
r2290 r2324 41 41 <link rel="stylesheet" href="<?php echo ADMIN_THEME_URL ?>css/style.css" type="text/css"> 42 42 <!-- <link rel="shortcut icon" href="<?php echo SITEURL; ?>favicon.ico"> --> 43 <?php if($h->pageName == 'admin_home') { ?> 44 <link rel="stylesheet" href="<?php echo ADMIN_THEME_URL ?>css/zrssfeed.css" type="text/css" /> 45 <script type="text/javascript" src="<?php echo ADMIN_THEME_URL?>javascript/jquery.zrssfeed.min.js"></script> 46 <script type="text/javascript"> 47 $(document).ready(function () { 48 $("#admin_news").rssfeed('http://feeds2.feedburner.com/hotarucms', { 49 showerror: false, 50 header: false, 51 limit: 5 52 }); 53 }); 54 </script> 55 <?php } ?> 43 56 <?php $h->pluginHook('admin_header_include_raw'); ?> 44 57 </head> -
branches/1.5/content/admin_themes/admin_default/admin_home.php
r2307 r2324 36 36 <h3><?php echo $h->lang["admin_theme_main_help"]; ?></h3> 37 37 <!-- Feed items, number to show content for, max characters for content --> 38 <?php 39 $feeds = new Feeds(); 40 $feeds->adminNews($h->lang, 10, 3, 300); //lang, max_items, items_with_content, max_chars 41 ?> 38 <div id="admin_news"></div> 42 39 <br/> 43 40 <h2><?php echo $h->lang["admin_theme_main_join_us"]; ?></h2> -
branches/1.5/content/themes/default/settings.php
r2274 r2324 33 33 ?> 34 34 <form name="theme_settings_form" action="<?php echo BASEURL; ?>admin_index.php?page=theme_settings&theme=<?php echo $theme_name; ?>" method="post"> 35 <label>Tagline: <input type="text" size="70" name="tagline" value="<?php echo html entities($theme_settings['tagline'], ENT_QUOTES, 'UTF-8'); ?>"></label>35 <label>Tagline: <input type="text" size="70" name="tagline" value="<?php echo htmlspecialchars($theme_settings['tagline'], ENT_QUOTES, 'UTF-8',FALSE); ?>"></label> 36 36 <input type="submit" value="<?php echo $h->lang['main_form_save']; ?>" /> 37 37 <input type="hidden" name="submitted" value="true" /><input type="hidden" name="csrf" value="<?php echo $h->csrfToken; ?>" /> -
branches/1.5/libs/Feeds.php
r2323 r2324 25 25 * @link http://www.hotarucms.org/ 26 26 */ 27 class Feeds { 27 class Feeds 28 { 28 29 29 /**30 /** 30 31 * Create an RSS Feed 31 32 * … … 36 37 * @param string $content_type e.g. 'application/xml' or 'text/plain' 37 38 */ 38 public function rss($h, $title = '', $link = '', $description = '', $items = array(), $content_type = 'application/xml') { 39 require_once(LIBS.'RSS.php'); 40 41 $feed = new RSS($h->url(array('page'=>'rss'))); 39 public function rss($h, $title = '', $link = '', $description = '', $items = array(), $content_type = 'application/xml') 40 { 41 $feed = new RSS($h->url(array('page' => 'rss'))); 42 42 $feed->title = htmlspecialchars_decode($title, ENT_QUOTES); 43 43 $feed->link = htmlspecialchars_decode($link, ENT_QUOTES); 44 44 $feed->description = $description; 45 45 46 46 if ($items) { 47 47 $feed->addItem($items); 48 48 } 49 49 50 $r = $feed->out($content_type); 51 echo $r; 50 echo $feed->out($content_type); 52 51 } 53 54 55 /**56 * Includes the SimplePie RSS file and sets the cache57 *58 * @param string $feed59 * @param bool $cache60 * @param int $cache_duration61 *62 * @return object|false $sp63 */64 public function newSimplePie($feed='', $cache=RSS_CACHE, $cache_duration=RSS_CACHE_DURATION) {65 if ($feed != '') {66 $sp = new SimplePie();67 $sp->set_feed_url($feed);68 $sp->set_cache_location(CACHE."rss_cache/");69 $sp->set_cache_duration($cache_duration);70 $sp->enable_cache(($cache === 'true'));71 $sp->handle_content_type();72 return $sp;73 }74 return FALSE;75 }76 77 /**78 * Display Hotaru forums feed on Admin front page79 *80 * @param int $max_items81 * @param int $items_with_content82 * @param int $max_chars83 */84 public function adminNews($lang, $max_items = 10, $items_with_content = 3, $max_chars = 300) {85 $feedurl = 'http://feeds2.feedburner.com/hotarucms';86 $feed = $this->newSimplePie($feedurl);87 $feed->init();88 89 $output = "";90 $item_count = 0;91 92 if ($feed->data) {93 foreach ($feed->get_items() as $item) {94 $output .= "<div class='admin_news'>";95 96 // Title97 $output .= "<a href='".$item->get_permalink()."'>".sanitize($item->get_title(), 'tags')."</a><br />";98 99 if ($item_count < $items_with_content) {100 // Posted by101 $output .= "<small>".$lang["admin_news_posted_by"]." ";102 103 foreach ($item->get_authors() as $author) {104 $output .= $author->get_name();105 }106 107 // Date108 $output .= " ".$lang["admin_news_on"]." ".$item->get_date('j F Y')."</small><br />";109 110 // Content111 $output .= truncate(sanitize($item->get_content(), 'tags'), $max_chars, TRUE);112 113 // Read more114 $output .= "<small><a href='".$item->get_permalink()."' title='".sanitize($item->get_title(), 'tags')."'>[".$lang["admin_news_read_more"]."]</a></small>";115 }116 117 $output .= "</div>";118 if ($item_count < $items_with_content) {119 $output .="<br />";120 }121 122 if ($item_count == ($items_with_content - 1)) {123 $output .= "<h3>".$lang["admin_news_more_threads"]."</h3>";124 }125 126 $item_count++;127 if ($item_count >= $max_items) {128 break;129 }130 }131 }132 133 echo $output;134 }135 136 52 }