function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? false : $instance['title']); $sources = new SourceAdmin(); echo $before_widget; if ($title) { echo $before_title, $title, $after_title; } ?> <ul id="myprofiles"> <?php foreach ($sources->legend_types() as $legend) { ?> <li><img src="<?php echo $legend->favicon; ?> " alt="<?php echo $legend->title; ?> " /><a href="<?php echo $legend->profile_url; ?> "><?php echo $legend->title; ?> </a></li> <?php } ?> </ul> <?php echo $after_widget; }
/** * Fetches the latest entry from the source's feed **/ function fetchfeed() { require_once SIMPLEPIEPATH; $feed = $this->select(); if (preg_match('/twitter\\.com/', $feed[0]->feed_url) == true) { $istwitter = 1; } $feed_path = $feed[0]->feed_url; $feed = new SimplePie((string) $feed_path, TEMPLATEPATH . (string) '/app/cache/activity'); SourceAdmin::clean_dir(); $feed->handle_content_type(); if ($feed->data) { foreach ($feed->get_items() as $entry) { $name = $stream->title; $update[]['name'] = (string) $name; $update[]['title'] = $entry->get_title(); $update[]['link'] = $entry->get_permalink(); $update[]['date'] = strtotime(substr($entry->get_date(), 0, 25)); } $return = array_slice($update, 0, 5); // This auto-hyperlinks URLs $return[1]['title'] = preg_replace('((?:\\S)+://\\S+[[:alnum:]]/?)', '<a href="\\0">\\0</a>', $return[1]['title']); /** * If Twitter is the source, then we hyperlink any '@username's * to that user's Twitter address. **/ if ($istwitter == 1) { $return[1]['title'] = preg_replace('/(@)([A-Za-z0-9_-]+)/', '<a href="http://twitter.com/\\2">\\0</a>', $return[1]['title']); } return substr($return[1]['title'], 0, 1000) . ' — <a href="' . $return[2]['link'] . '" title="">' . date('g:ia', $return[3]['date']) . '</a>'; } else { return "Thanks for exploring my world! Can you believe this avatar is talking to you?"; } }
public function display() { require_once 'simplepie.php'; $feed = self::select(); $feed_path = $feed[0]->feed_url; $feed = new SimplePie((string) $feed_path, ABSPATH . (string) 'wp-content/uploads/activity'); SourceAdmin::clean_dir(); $feed->handle_content_type(); if ($feed->data) { foreach ($feed->get_items() as $entry) { $name = $stream->title; $update[]['name'] = (string) $name; $update[]['title'] = $entry->get_title(); $update[]['link'] = $entry->get_permalink(); $update[]['date'] = strtotime(substr($entry->get_date(), 0, 25)); } @($return = array_slice($update, 0, 5)); $return[1]['title'] = preg_replace('((?:\\S)+://\\S+[[:alnum:]]/?)', '<a href="\\0">\\0</a>', $return[1]['title']); return substr($return[1]['title'], 0, 150) . ' — <a href="' . $return[2]['link'] . '" title="">' . date('g:ia', $return[3]['date']) . '</a>'; } else { return 'No source configured.'; } }
/** * The admin page for our sources/activity system. **/ function sourceMenu() { $sources = new SourceAdmin(); if ($_GET['page'] == basename(__FILE__)) { if ('add' == $_REQUEST['action']) { $return = $sources->add($_REQUEST); } if ('gather' == $_REQUEST['action']) { $sources->gather($_REQUEST['id']); } if ('edit' == $_REQUEST['action']) { $sources->edit($_REQUEST); } if ('delete' == $_REQUEST['action']) { $sources->burninate($_REQUEST['id']); } if ('hulk_smash' == $_REQUEST['action']) { $sources->hulk_smash(); } if ('install' == $_REQUEST['action']) { $sources->install(); } if ('flush' == $_REQUEST['action']) { $sources->flush_streams($_REQUEST['flush_name']); } } ?> <?php if (isset($_REQUEST['add'])) { ?> <div id="message" class="updated fade"><p><strong><?php echo __('Social Me Account saved.'); ?> </strong></p></div> <?php } elseif (isset($_REQUEST['edit'])) { ?> <div id="message" class="updated fade"><p><strong><?php echo __('Social Me Account modified.'); ?> </strong></p></div> <?php } elseif (isset($_REQUEST['delete'])) { ?> <div id="message" class="updated fade"><p><strong><?php echo __('Social Me Account removed.'); ?> </strong></p></div> <?php } elseif (isset($_REQUEST['flush'])) { ?> <div id="message" class="updated fade"><p><strong><?php echo __('Social Me Account flushed.'); ?> </strong></p></div> <?php } elseif (isset($_REQUEST['install'])) { ?> <div id="message" class="updated fade"><p><strong><?php echo __('Social Me Manager installed.'); ?> </strong></p></div> <?php } elseif (isset($_REQUEST['hulk_smash'])) { ?> <div id="message" class="updated fade"><p><strong><?php echo __('Social Me database cleared.'); ?> </strong></p></div> <?php } ?> <div class="wrap"> <div id="admin-options"> <h2><?php _e('Manage My "Social Me" Page'); ?> </h2> <p>If you'd like to let your visitors know where else they may find you throughout the Web, you can do it easily through your "Social Me" page. This is an exclusive feature of the WicketPixie theme for WordPress. If you have accounts on other blogs, social networks, forums, Web sites, etc, add them here. For example, you might add your Twitter, YouTube, and Flickr accounts here - making sure you use the corresponding RSS (or Atom) feeds for your profile, so that WicketPixie can display your latest content from them on your Social Me page.<br /><br /> You can also include the list of these accounts in your sidebar - just be sure to enable the <a href="widgets.php">WicketPixie Social Me widget</a> first!</p> <?php if ($sources->check() != 'false' && $sources->count() != '') { ?> <form> <p style="margin-bottom:0;">Sort by: <select name="type" id="type"> <?php foreach ($sources->types() as $type) { ?> <option value="<?php echo $type->type_id; ?> "><?php echo $type->name; ?> </option> <?php } ?> </select> </p> </form> <table class="form-table" style="margin-bottom:20px;"> <tr> <th>Icon</th> <th>Title</th> <th style="text-align:center;">Feed</th> <th style="text-align:center;">Type</th> <th style="text-align:center;">Activity</th> <th style="text-align:center;" colspan="3">Actions</th> </tr> <?php foreach ($sources->collect() as $source) { if ($source->lifestream == 0) { $streamed = 'No'; } else { $streamed = 'Yes'; } $isfeed = $sources->feed_check($source->title); ?> <tr> <td style="width:16px;"><img src="<?php echo $source->favicon; ?> " alt="Favicon" style="width: 16px; height: 16;" /></td> <td><a href="<?php echo $source->profile_url; ?> "><?php echo $source->title; ?> </a></td> <?php if ($isfeed == 1) { ?> <td style="text-align:center;"><a href="<?php echo $source->feed_url; ?> "><img src="<?php bloginfo('template_directory'); ?> /images/icon-feed.gif" alt="View"/></a></td> <?php } elseif ($isfeed == 0) { ?> <td style="text-align:center;">N/A</td> <?php } else { ?> <td style="text-align:center;">?</td> <?php } ?> <td style="text-align:center;"><?php echo $sources->type_name($source->type); ?> </td> <td style="text-align:center;"><?php echo $streamed; ?> </td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=sourcemanager.php&gather=true&id=<?php echo $source->id; ?> "> <input type="submit" value="Edit" /> <input type="hidden" name="action" value="gather" /> </form> </td> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=sourcemanager.php&delete=true&id=<?php echo $source->id; ?> "> <input type="submit" name="action" value="Delete" /> <input type="hidden" name="action" value="delete" /> </form> </td> <?php if ($isfeed == 1) { ?> <td> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=sourcemanager.php&flush=true&id=<?php echo $source->id; ?> "> <input type="submit" value="Flush" /> <input type="hidden" name="action" value="flush" /> <input type="hidden" name="flush_name" value="<?php echo $source->title; ?> " /> </form> </td> <?php } ?> </tr> <?php } ?> </table> <?php } else { ?> <p>You don't have any Social Mes, why not add some?</p> <?php } ?> <?php if (isset($_REQUEST['gather'])) { ?> <?php $data = $sources->gather($_REQUEST['id']); ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=sourcemanager.php&edit=true" class="form-table" style="margin-bottom:30px;"> <h2>Editing "<?php echo $data[0]->title; ?> "</h2> <p><input type="text" name="title" id="title" value="<?php echo $data[0]->title; ?> " /></p> <p><input type="text" name="profile" id="profile" value="<?php echo $data[0]->profile_url; ?> " /></p> <p><input type="text" name="url" id="url" value="<?php echo $data[0]->feed_url; ?> " /></p> <p><input type="checkbox" name="lifestream" id="lifestream" value="1" <?php if ($data[0]->lifestream == '1') { echo 'checked'; } ?> > Add to Activity?</p> <p><input type="checkbox" name="updates" id="updates" value="1" <?php if ($data[0]->updates == '1') { echo 'checked'; } ?> > Use for Status Updates?</p> <p>Type: <select name="type" id="type"> <?php foreach ($sources->types() as $type) { ?> <option value="<?php echo $type->type_id; ?> " <?php if ($type->type_id == $data[0]->type) { echo 'selected'; } ?> ><?php echo $type->name; ?> </option> <?php } ?> </select> </p> <p class="submit"> <input name="save" type="submit" value="Save Social Me" /> <input type="hidden" name="action" value="edit" /> <input type="hidden" name="id" value="<?php echo $data[0]->id; ?> "> </p> </form> <?php } ?> <?php if ($sources->check() != 'false' && !isset($_REQUEST['gather'])) { ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=sourcemanager.php&add=true" class="form-table" style="margin-bottom:30px;"> <h2>Add a New Social Me</h2> <p><input type="text" name="title" id="title" onfocus="if(this.value=='Social Me Title')value=''" onblur="if(this.value=='')value='Social Me Title';" value="Social Me Title" /></p> <p><input type="text" name="profile" id="profile" onfocus="if(this.value=='Profile URL')value=''" onblur="if(this.value=='')value='Profile URL';" value="Profile URL" /></p> <p><input type="text" name="url" id="url" onfocus="if(this.value=='Profile Feed URL')value=''" onblur="if(this.value=='')value='Profile Feed URL';" value="Profile Feed URL" /></p> <p><input type="checkbox" name="lifestream" id="lifestream" value="1" checked="checked"> Add to Activity Stream?</p> <p><input type="checkbox" name="updates" id="updates" value="1"> Use for Status Updates?</p> <p>Type: <select name="type" id="type"> <?php foreach ($sources->types() as $type) { ?> <option value="<?php echo $type->type_id; ?> "><?php echo $type->name; ?> </option> <?php } ?> </select> </p> <p class="submit"> <input name="save" type="submit" value="Save Social Me" /> <input type="hidden" name="action" value="add" /> </p> </form> <form name="hulk_smash" id="hulk_smash" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=sourcemanager.php&hulk_smash=true"> <h2>Delete the Social Mes Table</h2> <p>Please note, this is undoable and will result in the loss of all the data you have stored to date. Only do this if you are having problems with your social mes and you have exhausted every other option.</p> <p class="submit"> <input name="save" type="submit" value="Delete Social Mes" /> <input type="hidden" name="action" value="hulk_smash" /> </p> </form> <?php } else { ?> <p>Table not installed. You should go ahead and run the installer.</p> <form name="install" id="install" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?> ?page=sourcemanager.php&install=true"> <p class="submit"> <input type="hidden" name="action" value="install" /> <input type="submit" value="Install Social Me" /> </p> </form> <?php } ?> </div> <?php include_once 'advert.php'; ?> <?php }
<?php /** * Template Name: Activity Stream * Template for the Activity Stream page **/ require_once ABSPATH . WPINC . '/rss-functions.php'; $activities = new SourceAdmin(); $activities->archive_streams(); get_header(); ?> <!-- content --> <div id="content"> <!-- page --> <div class="page"> <?php if (have_posts()) { ?> <?php while (have_posts()) { the_post(); ?> <h1><?php the_title(); ?> </h1> <?php
$view = 50; $results = array_chunk($data, $view, true); $test = range(1, count($results)); krsort($test); $last = array_slice($test, 0, 1); $get = $_GET; ?> </div> <?php ?> <table> <?php $day = ''; foreach ((array) $results[$page - 1] as $stream) { $source_data = SourceAdmin::source($stream->name); $this_day = date("F jS", $stream->date); if ($day != $this_day) { ?> <tr> <th colspan="3"><?php echo $this_day; ?> </th> </tr> <?php } ?> <tr> <td class="activity-time"><?php echo date('g:i:a', $stream->date);
<!-- myprofiles --> <?php $sources = new SourceAdmin(); ?> <div class="widget"> <h3>My Profiles</h3> <ul id="myprofiles"> <?php foreach ($sources->legend_types() as $legend) { ?> <li><img src="<?php echo $legend->favicon; ?> " alt="<?php echo $legend->title; ?> " /><a href="<?php echo $legend->profile_url; ?> "><?php echo $legend->title; ?> </a></li> <?php } ?> </ul> </div> <!-- /myprofiles -->
function load_widgets() { if (function_exists('register_widget')) { // My Profiles require_once TEMPLATEPATH . '/widgets/my-profiles.php'; add_action('widgets_init', 'MyProfilesInit'); // Social Badges require_once TEMPLATEPATH . '/widgets/social-badges.php'; add_action('widgets_init', 'SocialBadgesInit'); // Ustream require_once TEMPLATEPATH . '/widgets/ustream-widget.php'; add_action('widgets_init', 'UstreamWidgetInit'); // Social Me Feed Widgets include_once TEMPLATEPATH . '/widgets/sources.php'; foreach (SourceAdmin::collect() as $widget) { if (SourceAdmin::feed_check($widget->title) == 1) { $source_title = $widget->title; $t_title = str_replace(' ', '', $source_title); $cleaned = strtolower($source_title); $cleaned = preg_replace('/\\W/', ' ', $cleaned); $cleaned = str_replace(" ", "", $cleaned); if (is_file(TEMPLATEPATH . '/widgets/' . $cleaned . '.php')) { add_action('widgets_init', "{$t_title}Init"); } } } } }