PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/functions.php

https://github.com/achiang/agregado
PHP | 665 lines | 543 code | 95 blank | 27 comment | 81 complexity | f33945372b3461c5a40ed65a1030c695 MD5 | raw file
  1. <?php
  2. $themename = "Agregado Theme";
  3. $shortname = "Agregado Theme";
  4. if ( function_exists('register_sidebar') )
  5. register_sidebar(array('name'=>'sidebar-home',
  6. 'before_widget' => '<div class="widget">',
  7. 'after_widget' => '</div>',
  8. 'before_title' => '<h3 class="widgettitle">',
  9. 'after_title' => '</h3>',
  10. ));
  11. register_sidebar(array('name'=>'sidebar-interior',
  12. 'before_widget' => '<div class="widget">',
  13. 'after_widget' => '</div>',
  14. 'before_title' => '<h3 class="widgettitle">',
  15. 'after_title' => '</h3>',
  16. ));
  17. function wpguy_initial_cap($content){
  18. // Regular Expression, matches a single letter
  19. // * even if it's inside a link tag.
  20. $searchfor = '/>(<a [^>]+>)?([^<\s])/';
  21. // The string we're replacing the letter for
  22. $replacewith = '>$1<span class="drop">$2</span>';
  23. // Replace it, but just once (for the very first letter of the post)
  24. $content = preg_replace($searchfor, $replacewith, $content, 1);
  25. // Return the result
  26. return $content;
  27. }
  28. // Add this function to the WordPress hook
  29. add_filter('the_content', 'wpguy_initial_cap');
  30. add_filter('the_excerpt', 'wpguy_initial_cap');
  31. /* Adapated from Andy Staines' Paged Navigation plugin - http://stuff.yellowswordfish.com/paged-navigation/ */
  32. define('PNSHOW', 10);
  33. function paged_menu()
  34. {
  35. if(!is_page())
  36. {
  37. if(is_single())
  38. {
  39. $npost = get_next_post(false);
  40. if ( $npost )
  41. {
  42. $title = apply_filters('the_title', $npost->post_title);
  43. $string = '<a href="'. get_permalink($npost->ID) .'">';
  44. echo 'Next Item: '.$string.$title.'</a><br />';
  45. }
  46. $ppost = get_previous_post(false);
  47. if ( $ppost )
  48. {
  49. $title = apply_filters('the_title', $ppost->post_title);
  50. $string = '<a href="'. get_permalink($ppost->ID) .'">';
  51. echo 'Previous item: '.$string.$title.'</a>';
  52. }
  53. $title = 'Back to the Front Page';
  54. $string = '<a href="'. get_option('home') .'">';
  55. echo '<br />'.$string.$title.'</a>';
  56. } else {
  57. echo '<div class="pagenavigationbox">';
  58. $nav = pn_navigation();
  59. echo '</div>';
  60. }
  61. }
  62. }
  63. function pn_navigation()
  64. {
  65. global $paged, $wp_query, $max_page;
  66. $nav = array();
  67. if ( !$max_page )
  68. {
  69. $max_page = $wp_query->max_num_pages;
  70. }
  71. if( !$paged )
  72. {
  73. $paged = 1;
  74. }
  75. $nav['next'] = pn_next($paged, $max_page);
  76. echo ('<span class="pagenavcurrent">'.$paged.'</span>');
  77. $nav['previous'] = pn_previous($paged, $max_page);
  78. return $nav;
  79. }
  80. function pn_next($paged, $max_page)
  81. {
  82. $start = ($paged - PNSHOW);
  83. if($start < 1) $start = 1;
  84. $end = ($paged - 1);
  85. if($start > 1)
  86. {
  87. $out.= '<a class="pagelink" href="'.get_pagenum_link(1).'">1</a><span class="pagenav">...</span>';
  88. }
  89. if($end > 0)
  90. {
  91. for($i = $start; $i <= $end; $i++)
  92. {
  93. $out.= '<a class="pagelink" href="'.get_pagenum_link($i).'">'.$i.'</a>';
  94. }
  95. } else {
  96. $end = 0;
  97. }
  98. echo ($out);
  99. return $end;
  100. }
  101. function pn_previous($paged, $max_page)
  102. {
  103. $start = ($paged + 1);
  104. $end = ($paged + PNSHOW);
  105. if($end > $max_page) $end = $max_page;
  106. if($start <= $max_page)
  107. {
  108. for($i = $start; $i <= $end; $i++)
  109. {
  110. $out.= '<a class="pagelink" href="'.get_pagenum_link($i).'">'.$i.'</a>';
  111. }
  112. if($end < $max_page)
  113. {
  114. $out.= '<span class="pagenav">...</span><a class="pagelink" href="'.get_pagenum_link($max_page).'">'.$max_page.'</a>';
  115. }
  116. } else {
  117. $start = 0;
  118. }
  119. echo ($out);
  120. return $start;
  121. }
  122. /* Adapted from Kieran Delaney's SimpleLife plugin - http://kierandelaney.net/blog/projects/simplelife/ */
  123. //create options page
  124. function agregadoOptions() {
  125. if (function_exists('add_theme_page')) {
  126. add_theme_page('', 'Agregado Options', 8, basename(__FILE__), 'agregadoOptionsPage');
  127. }
  128. }
  129. function agregadoOptionsPage() {
  130. if (isset($_POST['info_update'])) { ?>
  131. <div id="message" class="updated fade">
  132. <p><strong>
  133. <?php
  134. if($_POST['l_flickr']){
  135. update_option('l_flickr', $_POST['l_flickr']);
  136. }else{
  137. update_option('l_flickr', '');
  138. }
  139. if ( isset( $_POST['l_flickr_thumbs'] ) ) {
  140. update_option('l_flickr_thumbs', 'true' );
  141. }else{
  142. update_option('l_flickr_thumbs', 'false' );
  143. }
  144. if ( isset( $_POST['l_flickr_title'] ) ) {
  145. update_option('l_flickr_title', 'true' );
  146. }else{
  147. update_option('l_flickr_title', 'false' );
  148. }
  149. if($_POST['l_delicious']){
  150. update_option('l_delicious', $_POST['l_delicious']);
  151. }else{
  152. update_option('l_delicious', '');
  153. }
  154. if($_POST['l_twitter']){
  155. update_option('l_twitter', $_POST['l_twitter']);
  156. }else{
  157. update_option('l_twitter', '');
  158. }
  159. if($_POST['l_pownce']){
  160. update_option('l_pownce', $_POST['l_pownce']);
  161. }else{
  162. update_option('l_pownce', '');
  163. }
  164. if($_POST['l_magnolia']){
  165. update_option('l_magnolia', $_POST['l_magnolia']);
  166. }else{
  167. update_option('l_magnolia', '');
  168. }
  169. if($_POST['l_goodreads']){
  170. update_option('l_goodreads', $_POST['l_goodreads']);
  171. }else{
  172. update_option('l_goodreads', '');
  173. }
  174. if($_POST['l_lastfm']){
  175. update_option('l_lastfm', $_POST['l_lastfm']);
  176. }else{
  177. update_option('l_lastfm', '');
  178. }
  179. if($_POST['l_facebook']){
  180. update_option('l_facebook', $_POST['l_facebook']);
  181. }else{
  182. update_option('l_facebook', '');
  183. }
  184. if($_POST['lifestream_feed1']){
  185. update_option('lifestream_feed1', $_POST['lifestream_feed1']);
  186. if(!$_POST['lifestream_ico1']){
  187. _e('Warning: You\'ve defined an additional feed - but you\'ve not chosen an icon!<br />', 'English');
  188. }
  189. update_option('lifestream_ico1', $_POST['lifestream_ico1']);
  190. }else{
  191. update_option('lifestream_feed1', '');
  192. update_option('lifestream_ico1', $_POST['lifestream_ico1']);
  193. }
  194. if($_POST['lifestream_feed2']){
  195. update_option('lifestream_feed2', $_POST['lifestream_feed2']);
  196. if(!$_POST['lifestream_ico2']){
  197. _e('Warning: You\'ve defined an additional feed - but you\'ve not chosen an icon!<br />', 'English');
  198. }
  199. update_option('lifestream_ico2', $_POST['lifestream_ico2']);
  200. }else{
  201. update_option('lifestream_feed2', '');
  202. update_option('lifestream_ico2', $_POST['lifestream_ico2']);
  203. }
  204. if($_POST['lifestream_feed3']){
  205. update_option('lifestream_feed3', $_POST['lifestream_feed3']);
  206. if(!$_POST['lifestream_ico3']){
  207. _e('Warning: You\'ve defined an additional feed - but you\'ve not chosen an icon!<br />', 'English');
  208. }
  209. update_option('lifestream_ico3', $_POST['lifestream_ico3']);
  210. }else{
  211. update_option('lifestream_feed3', '');
  212. update_option('lifestream_ico3', $_POST['lifestream_ico3']);
  213. }
  214. if($_POST['lifestream_feed4']){
  215. update_option('lifestream_feed4', $_POST['lifestream_feed4']);
  216. if(!$_POST['lifestream_ico4']){
  217. _e('Warning: You\'ve defined an additional feed - but you\'ve not chosen an icon!<br />', 'English');
  218. }
  219. update_option('lifestream_ico4', $_POST['lifestream_ico4']);
  220. }else{
  221. update_option('lifestream_feed4', '');
  222. update_option('lifestream_ico4', $_POST['lifestream_ico4']);
  223. }
  224. if($_POST['lifestream_flimit']){
  225. update_option('lifestream_flimit', $_POST['lifestream_flimit']);
  226. }else{
  227. update_option('lifestream_flimit', '0');
  228. }
  229. if($_POST['lifestream_cache']){
  230. update_option('lifestream_cache', $_POST['lifestream_cache']);
  231. }else{
  232. update_option('lifestream_cache', '0');
  233. }
  234. if($_POST['lifestream_date']){
  235. update_option('lifestream_date', $_POST['lifestream_date']);
  236. }else{
  237. update_option('lifestream_date', 'n/j/y');
  238. }
  239. if($_POST['contact_email']){
  240. update_option('contact_email', $_POST['contact_email']);
  241. }else{
  242. update_option('contact_email', '');
  243. }
  244. if($_POST['contact_subject']){
  245. update_option('contact_subject', $_POST['contact_subject']);
  246. }else{
  247. update_option('contact_subject', '');
  248. }
  249. if($_POST['contact_success']){
  250. update_option('contact_success', $_POST['contact_success']);
  251. }else{
  252. update_option('contact_success', '');
  253. }
  254. ?>OPTIONS UPDATED
  255. </strong></p>
  256. </div>
  257. <?php } ?>
  258. <div class="wrap">
  259. <form method="post">
  260. <h2>Agregado Options</h2>
  261. <h3>General Settings</h3>
  262. <table class="form-table">
  263. <tr>
  264. <td><label for="lifestream_flimit">Max No. Of Items To Show (0 = Unlimited):</label></td>
  265. <td><input type="text" name="lifestream_flimit" id="lifestream_flimit" maxlength="2" size="2" value="<?php if(get_option('lifestream_flimit')){ echo get_option('lifestream_flimit');} else { echo '0';} ?>" /></td>
  266. </tr>
  267. <tr>
  268. <td><label for="lifestream_cache">Cache Feeds For (Mins):</label></td>
  269. <td><input type="text" name="lifestream_cache" id="lifestream_cache" maxlength="2" size="2" value="<?php if(get_option('lifestream_cache')){ echo get_option('lifestream_cache');} else { echo '0';} ?>" /></td>
  270. </tr>
  271. <tr>
  272. <td><label for="lifestream_date">Date Format:</label><br /><a href="http://uk3.php.net/date">Date/Time Format Documentation</a></td>
  273. <td><input type="text" name="lifestream_date" id="lifestream_date" maxlength="10" size="10" value="<?php echo get_option('lifestream_date'); ?>" /><br />Output: <strong><?php echo date(get_option('lifestream_date')); ?></strong></td>
  274. </tr>
  275. </table>
  276. <h3>Flickr Photos</h3>
  277. <table class="form-table">
  278. <tr>
  279. <td><label for="l_flickr">Your Flickr ID (Try <a href="http://idgettr.com/">idgettr</a>):</label></td>
  280. <td><input type="text" name="l_flickr" id="l_flickr" maxlength="20" size="20" value="<?php if(get_option('l_flickr')) echo get_option('l_flickr'); ?>" /></td>
  281. </tr>
  282. <tr>
  283. <td><label><input name="l_flickr_thumbs" id="l_flickr_thumbs" value="true" type="checkbox" <?php if ( get_option('l_flickr_thumbs') == 'true' ) echo ' checked="checked" '; ?> /> Show Flickr Thumbnails</label></td>
  284. </tr>
  285. <tr>
  286. <td><label><input name="l_flickr_title" id="l_flickr_title" value="true" type="checkbox" <?php if ( get_option('l_flickr_title') == 'true' ) echo ' checked="checked" '; ?> /> Show Photo Titles (Sometimes ugly next to thumbnails...)</label></td>
  287. </tr>
  288. </table>
  289. <h3>Delicious Bookmarks</h3>
  290. <table class="form-table">
  291. <tr>
  292. <td><label for="l_delicious">Your Delicious Username:</label></td><td><input type="text" name="l_delicious" id="l_delicious" maxlength="20" size="20" value="<?php echo get_option('l_delicious'); ?>" /></td> </tr>
  293. </table>
  294. <h3>Magnolia Bookmarks</h3>
  295. <table class="form-table">
  296. <tr>
  297. <td><label for="l_magnolia">Your Magnolia Username:</label></td><td><input type="text" name="l_magnolia" id="l_magnolia" size="20" value="<?php echo get_option('l_magnolia'); ?>" /></td> </tr>
  298. </table>
  299. <h3>Twitter Status Updates</h3>
  300. <table class="form-table">
  301. <tr>
  302. <td><label for="l_twitter">Your Twitter Feed:</label></td>
  303. <td><input type="text" name="l_twitter" id="l_twitter" maxlength="60" size="60" value="<?php echo get_option('l_twitter'); ?>" /></td>
  304. </tr>
  305. </table>
  306. <h3>Pownce Public Notes</h3>
  307. <table class="form-table">
  308. <tr>
  309. <td><label for="l_pownce">Your Pownce Username:</label></td><td><input type="text" name="l_pownce" id="l_pownce" size="20" value="<?php echo get_option('l_pownce'); ?>" /></td> </tr>
  310. </table>
  311. <h3>Good Reads Book Reviews</h3>
  312. <table class="form-table">
  313. <tr>
  314. <td><label for="l_goodreads">Your Good Reads Book Reviews Feed:</label></td>
  315. <td><input type="text" name="l_goodreads" id="l_goodreads" size="60" value="<?php echo get_option('l_goodreads'); ?>" /></td>
  316. </tr>
  317. </table>
  318. <h3>Last.fm Music</h3>
  319. <table class="form-table">
  320. <tr>
  321. <td><label for="l_lastfm">Your Last.fm Username:</label></td>
  322. <td><input type="text" name="l_lastfm" id="l_lastfm" maxlength="20" size="20" value="<?php echo get_option('l_lastfm'); ?>" /></td>
  323. </tr>
  324. </table>
  325. <h3>Facebook Status Updates</h3>
  326. <table class="form-table">
  327. <tr>
  328. <td><label for="l_facebook">Facebook Feed Address:</label></td>
  329. <td><input type="text" name="l_facebook" id="l_facebook" size="60" value="<?php echo get_option('l_facebook'); ?>" /></td>
  330. </tr>
  331. <tr>
  332. <td colspan=2>In your facebook profile, go to your mini feed and choose "see all" from the top right. Now choose "Status Stories" from the right hand menu. Finally, bottom of the right hand menu, copy the link location of "My Status."</td>
  333. </tr>
  334. </table>
  335. <h3>Extra Feed 1</h3>
  336. <table class="form-table">
  337. <tr>
  338. <td><label for="lifestream_feed1">Additional feed address:</label></td>
  339. <td><input type="text" name="lifestream_feed1" id="lifestream_feed1" size="60" value="<?php echo get_option('lifestream_feed1'); ?>" /></td>
  340. </tr>
  341. <tr>
  342. <td>Feed Icon Name (including extension):<br />Upload icon to <code>themes/agregado/images</code> directory</td>
  343. <td><input type="text" id="lifestream_ico1" name="lifestream_ico1" size="15" <?php if(get_option('lifestream_ico1')) echo 'style="background: '. get_option('lifestream_ico1') .';"'; ?> value="<?php echo get_option('lifestream_ico1') ?>"></td>
  344. </tr>
  345. </table>
  346. <h3>Extra Feed 2</h3>
  347. <table class="form-table">
  348. <tr>
  349. <td><label for="lifestream_feed2">Additional feed address:</label></td>
  350. <td><input type="text" name="lifestream_feed2" id="lifestream_feed2" size="60" value="<?php echo get_option('lifestream_feed2'); ?>" /></td>
  351. </tr>
  352. <tr>
  353. <td>Feed Icon Name (including extension):<br />Upload icon to <code>themes/agregado/images</code> directory</td>
  354. <td><input type="text" id="lifestream_ico2" name="lifestream_ico2" size="15" <?php if(get_option('lifestream_ico2')) echo 'style="background: '. get_option('lifestream_ico2') .';"'; ?> value="<?php echo get_option('lifestream_ico2') ?>"></td>
  355. </tr>
  356. </table>
  357. <h3>Extra Feed 3</h3>
  358. <table class="form-table">
  359. <tr>
  360. <td><label for="lifestream_feed3">Additional feed address:</label></td>
  361. <td><input type="text" name="lifestream_feed3" id="lifestream_feed3" size="60" value="<?php echo get_option('lifestream_feed3'); ?>" /></td>
  362. </tr>
  363. <tr>
  364. <td>Feed Icon Name (including extension):<br />Upload icon to <code>themes/agregado/images</code> directory</td>
  365. <td><input type="text" id="lifestream_ico3" name="lifestream_ico3" size="15" <?php if(get_option('lifestream_ico3')) echo 'style="background: '. get_option('lifestream_ico3') .';"'; ?> value="<?php echo get_option('lifestream_ico3') ?>"></td>
  366. </tr>
  367. </table>
  368. <h3>Extra Feed 4</h3>
  369. <table class="form-table">
  370. <tr>
  371. <td><label for="lifestream_feed4">Additional feed address:</label></td>
  372. <td><input type="text" name="lifestream_feed4" id="lifestream_feed4" size="60" value="<?php echo get_option('lifestream_feed4'); ?>" /></td>
  373. </tr>
  374. <tr>
  375. <td>Feed Icon Name (including extension):<br />Upload icon to <code>themes/agregado/images</code> directory</td>
  376. <td><input type="text" id="lifestream_ico4" name="lifestream_ico4" size="15" <?php if(get_option('lifestream_ico4')) echo 'style="background: '. get_option('lifestream_ico4') .';"'; ?> value="<?php echo get_option('lifestream_ico4') ?>"></td>
  377. </tr>
  378. </table>
  379. <h3>Contact Form Settings</h3>
  380. <table class="form-table">
  381. <tr>
  382. <td><label for="contact_email">Your email address:</label></td>
  383. <td><input type="text" name="contact_email" id="contact_email" size="60" value="<?php echo get_option('contact_email'); ?>" /></td>
  384. </tr>
  385. <tr>
  386. <td><label for="contact_subject">Contact email subject:</label></td>
  387. <td><input type="text" name="contact_subject" id="contact_subject" size="60" value="<?php echo get_option('contact_subject'); ?>" /></td>
  388. </tr>
  389. <tr>
  390. <td><label for="contact_success">Contact success message:</label></td>
  391. <td><input type="text" name="contact_success" id="contact_success" size="60" value="<?php echo get_option('contact_success'); ?>" /></td>
  392. </tr>
  393. </table>
  394. <div class="submit"><input type="submit" name="info_update" value="<?php _e('Update Options', 'English'); ?> &raquo;" /></div>
  395. </form>
  396. </div>
  397. <?php
  398. }
  399. function lifestream(){
  400. // suppress warnings if curl is not installed
  401. error_reporting(0);
  402. ?>
  403. <!-- Lifestream -->
  404. <ul id="mycarousel" class="jcarousel jcarousel-skin-tango">
  405. <?php
  406. $simplepie_args = array();
  407. $feed_urls = array(
  408. 'l_delicious' => 'http://delicious.com/rss/',
  409. 'l_magnolia' => 'http://ma.gnolia.com/rss/full/people/',
  410. 'l_lastfm' => 'http://ws.audioscrobbler.com/1.0/user/',
  411. 'l_flickr' => 'http://api.flickr.com/services/feeds/photos_public.gne?id=',
  412. 'l_pownce' => 'http://pownce.com/feeds/all/',
  413. 'l_facebook' => '',
  414. 'l_twitter' => '',
  415. 'l_goodreads' => '',
  416. 'lifestream_feed1' => '',
  417. 'lifestream_feed2' => '',
  418. 'lifestream_feed3' => '',
  419. 'lifestream_feed4' => ''
  420. );
  421. foreach ($feed_urls as $option=>$url) {
  422. $option_value = get_option($option);
  423. if (strlen($option_value)) {
  424. $simple_url = $url . $option_value;
  425. if ($option == 'l_lastfm') {
  426. $simple_url .= '/recenttracks.rss';
  427. }
  428. if ($option == 'l_pownce') {
  429. $simple_url .= '.rss';
  430. }
  431. if ($option == 'l_flickr') {
  432. $simple_url .= '&lang=en-us&format=rss_200';
  433. }
  434. $simplepie_args[] = $simple_url;
  435. }
  436. }
  437. $feeds = new SimplePie($simplepie_args, TEMPLATEPATH . '/includes/cache', 60*get_option('lifestream_cache'));
  438. // Set up date variable.
  439. $stored_date = '';
  440. // Initialize a counter for giving unique ids to the items.
  441. $count = 1;
  442. // Go through all of the items in the feed
  443. foreach ($feeds->get_items(0,get_option('lifestream_flimit')) as $item) {
  444. $smpflickimg = '';
  445. // What is the date of the current feed item?
  446. $item_date = $item->get_date(get_option('lifestream_date'));
  447. // Is the item's date the same as what is already stored?
  448. // - Yes? Don't display it again because we've already displayed it for this date.
  449. // - No? So we have something different. We should display that.
  450. if ($stored_date != $item_date) {
  451. // Since they're different, let's replace the old stored date with the new one
  452. $stored_date = $item_date;
  453. // Display it on the page
  454. echo '<li class="date">' . $stored_date . '</li>' . "\r\n";
  455. }
  456. // Retrieve the item's parent feed address so we can assign classes accordingly.
  457. $feed = $item->get_feed();
  458. $address = $feed->subscribe_url();
  459. if(strstr($address, 'flickr')) {
  460. $class = 'flickr';
  461. $description = $item->get_description();
  462. $smpflickimg = preg_match('/img src="(.*)\.jpg"/', $description, $matches);
  463. $smpflickimg = $matches[1].".jpg";
  464. if($smpflickimg == '.jpg'){
  465. $smpflickimg = '';
  466. }
  467. // Hardcode size square "s", thumb "t", small "m", medium "", large "b" or original "o"?
  468. $size = "m";
  469. // Alter the path to point to the required size of the image
  470. if ($size != "") {
  471. $smpflickimg = preg_replace('/_m\.jpg/', '_'.$size.'.jpg', $smpflickimg);
  472. }
  473. else {
  474. $smpflickimg = preg_replace('/_m\.jpg/', '.jpg', $smpflickimg);
  475. }
  476. $smpflickimg = preg_replace('/width="[0-9]+"/', '', $smpflickimg);
  477. $smpflickimg = preg_replace('/height="[0-9]+"/', '', $smpflickimg);
  478. unset($matches);
  479. }
  480. elseif(strstr($address, 'delicious')) {
  481. $class = 'delicious';
  482. }
  483. elseif(strstr($address, 'facebook')) {
  484. $class = 'facebook';
  485. }
  486. elseif(strstr($address, 'flickr')) {
  487. $class = 'flickr';
  488. }
  489. elseif(strstr($address, 'audioscrobbler')) {
  490. $class = 'lastfm';
  491. }
  492. elseif(strstr($address, 'twitter')) {
  493. $class = 'twitter';
  494. }
  495. elseif(strstr($address, 'ma.gnolia')) {
  496. $class = 'magnolia';
  497. }
  498. elseif(strstr($address, 'pownce')) {
  499. $class = 'pownce';
  500. }
  501. elseif(strstr($address, 'goodreads')) {
  502. $class = 'goodreads';
  503. }
  504. elseif(strstr($address, get_option('lifestream_feed1'))) {
  505. $class = 'lifestream_feed1';
  506. }
  507. elseif(strstr($address, get_option('lifestream_feed2'))) {
  508. $class = 'lifestream_feed2';
  509. }
  510. elseif(strstr($address, get_option('lifestream_feed3'))) {
  511. $class = 'lifestream_feed3';
  512. }
  513. elseif(strstr($address, get_option('lifestream_feed4'))) {
  514. $class = 'lifestream_feed4';
  515. }
  516. // Display the feed item
  517. echo '<li class="' . $class . '" id="item-' . $count . '"><a href="' . $item->get_permalink() . '">';
  518. if($smpflickimg !== '' && get_option('l_flickr_thumbs') == 'true'){
  519. echo '<img src="' . $smpflickimg . '" alt="" />';
  520. }
  521. elseif($class !== 'flickr'){
  522. echo $item->get_title();
  523. }
  524. if($class == 'flickr' && get_option('l_flickr_title') == 'true'){
  525. echo $item->get_title();
  526. }
  527. echo '</a></li>' . "\r\n";
  528. $count = ++$count;
  529. }
  530. ?>
  531. </ul>
  532. <?php
  533. }
  534. //set initial defaults for feeds
  535. add_option('l_flickr', '');
  536. add_option('l_flickr_thumbs', 'true');
  537. add_option('l_flickr_title', 'false');
  538. add_option('l_delicious', '');
  539. add_option('l_twitter', '');
  540. add_option('l_magnolia', '');
  541. add_option('l_pownce', '');
  542. add_option('l_goodreads', '');
  543. add_option('l_lastfm', '');
  544. add_option('l_facebook', '');
  545. add_option('lifestream_feed1', '');
  546. add_option('lifestream_ico1', '');
  547. add_option('lifestream_feed2', '');
  548. add_option('lifestream_ico2', '');
  549. add_option('lifestream_feed3', '');
  550. add_option('lifestream_ico3', '');
  551. add_option('lifestream_feed4', '');
  552. add_option('lifestream_ico4', '');
  553. add_option('lifestream_flimit', '0');
  554. add_option('lifestream_cache', '60');
  555. add_option('lifestream_date', 'n/j/y');
  556. add_option('contact_email', '');
  557. add_option('contact_subject', '');
  558. add_option('contact_success', '');
  559. //load simplepie and check for a cache directory
  560. if(!class_exists("SimplePie")){
  561. include_once('includes/simplepie.inc');
  562. if(!file_exists(TEMPLATEPATH . "/includes/cache/")) {
  563. mkdir(TEMPLATEPATH . "/includes/cache/", 0777);
  564. //just in case...
  565. chmod(TEMPLATEPATH . "/includes/cache/", 0777);
  566. }
  567. }
  568. //add menu
  569. add_action('admin_menu', 'agregadoOptions');
  570. ?>