function fof_render_item($item) { $items = true; $feed_link = $item['feed_link']; $feed_title = $item['feed_title']; $feed_image = $item['feed_image']; $feed_description = $item['feed_description']; $item_link = $item['item_link']; $item_id = $item['item_id']; $item_title = $item['item_title']; $item_content = $item['item_content']; $item_read = $item['item_read']; $prefs = fof_prefs(); $offset = $prefs['tzoffset']; $item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset * 60 * 60); $item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset * 60 * 60); $item_updated = gmdate("Y-n-d g:ia", $item['item_updated'] + $offset * 60 * 60); if (!$item_title) { $item_title = "[no title]"; } if ($_GET['search']) { $item_content = do_highlight("<span>{$item_content}</span>", $_GET['search'], "highlight"); $item_title = do_highlight("<span>{$item_title}</span>", $_GET['search'], "highlight"); } $tags = $item['tags']; $star = in_array("star", $tags) ? true : false; $star_image = $star ? "image/star-on.gif" : "image/star-off.gif"; $unread = in_array("unread", $tags) ? true : false; ?> <div class="header"> <span class="controls"> <a class='uparrow' href='javascript:hide_body("<?php echo $item_id; ?> ")'>↑</a> <a class='downarrow' href='javascript:show_body("<?php echo $item_id; ?> ")'>↓</a> <input type="checkbox" name="c<?php echo $item_id; ?> " id="c<?php echo $item_id; ?> " value="checked" ondblclick='flag_upto("c<?php echo $item_id; ?> ");' onclick='return checkbox(event);' title='shift-click or double-click to flag all items up to this one' /> </span> <h1 <?php if ($unread) { echo "class='unread-item'"; } ?> > <img height="16" width="16" src="<?php echo $star_image; ?> " id="fav<?php echo $item_id; ?> " onclick="return toggle_favorite('<?php echo $item_id; ?> ')" /> <script> document.getElementById('fav<?php echo $item_id; ?> ').star = <?php if ($star) { echo 'true'; } else { echo 'false'; } ?> ; </script> <a href="<?php echo $item_link; ?> "> <?php echo $item_title; ?> </a> </h1> <span class="tags"> <?php if ($tags) { foreach ($tags as $tag) { if ($tag == "unread" || $tag == "star") { continue; } ?> <a href='?what=<?php echo $tag; ?> '><?php echo $tag; ?> </a> <a href='<?php echo $tag; ?> ' onclick='return remove_tag("<?php echo $item_id; ?> ", "<?php echo $tag; ?> ");'>[x]</a> <?php } } ?> <a href="" onclick="document.getElementById('addtag<?php echo $item_id; ?> ').style.display = ''; this.style.display = 'none'; return false;"> add tag </a> <div id="addtag<?php echo $item_id; ?> " style="display: none !important"> <input onfocus="this.value=''" onkeypress="if(event.keyCode == 13) add_tag('<?php echo $item_id; ?> ', document.getElementById('tag<?php echo $item_id; ?> ').value);" type="text" id="tag<?php echo $item_id; ?> " size="12" value="enter tag here" > <input type="button" name="add tag" value="tag" onclick="add_tag('<?php echo $item_id; ?> ', document.getElementById('tag<?php echo $item_id; ?> ').value);" > </div> </span> <span class='dash'> - </span> <h2> <?php $prefs = fof_prefs(); if ($feed_image && $prefs['favicons']) { ?> <a href="<?php echo $feed_link; ?> " title='<?php echo $feed_description; ?> '><img src="<?php echo $feed_image; ?> " height="16" width="16" border="0" /></a> <?php } ?> <a href="<?php echo $feed_link; ?> " title='<?php echo $feed_description; ?> '><?php echo $feed_title; ?> </a> </h2> <span class="meta">on <?php echo $item_published; ?> </span> </div> <div class="body"><?php echo $item_content; ?> </div> <?php $widgets = fof_get_widgets($item); if ($widgets) { ?> <div class="clearer"></div> <div class="widgets"> <?php foreach ($widgets as $widget) { echo "<span class='widget'>{$widget}</span> "; } ?> </div> <?php } ?> <?php }
function fof_render_item($item, $include_div = true) { global $fof_asset; global $fof_render_filters; $feed_link = fof_render_get_key_($item, 'feed_link'); if ($feed_link == "[no link]") { $feed_link = $item['feed_url']; } $feed_title = fof_render_get_key_($item, 'display_title'); if ($feed_title == "[no title]") { $feed_title = $feed_link; } $feed_image = fof_render_get_key_($item, 'display_image', $fof_asset['feed_icon']); $feed_description = fof_render_get_key_($item, 'feed_description'); $item_link = fof_render_get_key_($item, 'item_link'); $item_id = fof_render_get_key_($item, 'item_id'); $item_title = fof_render_get_key_($item, 'item_title', '[no title]'); $item_author = fof_render_get_key_($item, 'item_author', ''); $item_content = fof_render_get_key_($item, 'item_content'); $item_read = fof_render_get_key_($item, 'item_read'); foreach ($fof_render_filters as $filter) { $item_content = $filter($item_content); } $prefs = fof_prefs(); $offset = fof_render_get_key_($prefs, 'tzoffset') * 60 * 60; $item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset); $item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset); $item_updated = gmdate("Y-n-d g:ia", $item['item_updated'] + $offset); if (!empty($_GET['search'])) { $item_content = do_highlight("<span>{$item_content}</span>", $_GET['search'], "highlight"); $item_title = do_highlight("<span>{$item_title}</span>", $_GET['search'], "highlight"); } $tags = fof_render_get_key_($item, 'tags', array()); $star = in_array("star", $tags) ? true : false; $star_image = $star ? $fof_asset['star_on_image'] : $fof_asset['star_off_image']; $unread = in_array("unread", $tags) ? true : false; $folded = in_array('folded', $tags) ? true : false; if ($include_div) { echo '<div class="item ' . ($folded ? 'hidden' : 'shown') . '" id="i' . $item_id . '" onclick="return itemClicked(event)">' . "\n"; } ?> <div class="header"> <span class="controls"> <a class="uparrow" href="#" onclick="hide_body('<?php echo $item_id; ?> ');return false;">fold ↑</a> <a class="downarrow" href="#" onclick="show_body('<?php echo $item_id; ?> ');return false;">unfold ↓</a> <a href="#" onclick="ajax_mark_read('<?php echo $item_id; ?> '); return false;">mark read</a> </span> <h1 <?php if ($unread) { echo "class='unread-item'"; } ?> > <input type="checkbox" name="c<?php echo $item_id; ?> " id="c<?php echo $item_id; ?> " value="checked" ondblclick="flag_upto('c<?php echo $item_id; ?> ');" onclick="return checkbox(event);" title="shift-click or double-click to flag all items up to this one" /> <?php echo ' <img id="fav' . $item_id . '" class="' . ($star ? '' : 'un') . 'starred" src="' . $star_image . '" onclick="return toggle_favorite(' . $item_id . ')" />' . "\n"; ?> <script> document.getElementById('fav<?php echo $item_id; ?> ').star = <?php if ($star) { echo 'true'; } else { echo 'false'; } ?> ; </script> <?php echo "\t\t<a href=\"{$item_link}\"" . (fof_render_get_key_($prefs, 'item_target') ? ' target="_blank"' : '') . ">{$item_title}</a>\n"; if ($item_author) { echo '<span class="author">' . htmlentities($item_author) . '</span>'; } ?> </h1> <span class="tags"> <?php /* show non-system tags */ foreach (array_diff($tags, array('unread', 'star', 'folded')) as $tag) { echo ' <a href="' . fof_url('.', array('what' => $tag)) . '">' . htmlentities($tag) . '</a>'; echo ' <a href="#" class="untag" title="remove ' . htmlentities('"' . $tag . '"') . ' tag" onclick="return remove_tag(' . $item_id . ',' . htmlentities(json_encode($tag), ENT_QUOTES) . ');">[x]</a>' . "\n"; } ?> <a href="#" onclick="return itemTagAddShow('<?php echo $item_id; ?> ', this);">add tag</a> <div id="addtag<?php echo $item_id; ?> " style="display: none !important"> <input onfocus="this.value=''" onkeypress="itemTagAdd('<?php echo $item_id; ?> ', event.keyCode);" type="text" id="tag<?php echo $item_id; ?> " size="12" value="enter tag here" /> <input type="button" name="add tag" value="tag" onclick="itemTagAdd('<?php echo $item_id; ?> ');" /> </div> </span> <span class="dash"> - </span> <h2> <?php if ($feed_image && $prefs['favicons']) { echo ' <img class="feed-icon" src="' . $feed_image . '" />' . "\n"; } ?> <a href="<?php echo $feed_link; ?> " title="<?php echo htmlspecialchars($feed_description); ?> "><?php echo $feed_title; ?> </a> </h2> <span class="meta published">on <?php echo $item_published; ?> </span> </div> <div class="body"><?php echo $item_content; ?> </div> <?php $widgets = fof_get_widgets($item); $widgets[] = '<a href="#" onclick="return ajax_mark_read(\'' . $item_id . '\');">mark read</a>'; if (!empty($widgets)) { echo '<div class="clearer"></div>' . "\n"; echo '<div class="widgets">'; foreach ($widgets as $widget) { echo '<span class="widget">' . $widget . "</span>"; } echo "</div>\n"; } if ($include_div) { echo "</div>\n"; } }