Changeset 196389
- Timestamp:
- 01/21/2010 08:38:42 PM (16 years ago)
- Location:
- lifestream/trunk
- Files:
-
- 7 edited
-
CHANGES (modified) (1 diff)
-
extensions/README (modified) (1 diff)
-
extensions/github/extension.inc.php (modified) (1 diff)
-
inc/core.php (modified) (16 diffs)
-
inc/widget.php (modified) (4 diffs)
-
lifestream.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lifestream/trunk/CHANGES
r193355 r196389 1 0.99.9.7 2 3 * Added WoW Armory extension by gizzmo. 4 * Events can now be grouped by any value, not just the event key (but still are date-based). 5 * Installation should now work on installs that do not use MyISAM. 6 1 7 0.99.9.6 2 8 -
lifestream/trunk/extensions/README
r120013 r196389 12 12 13 13 $lifestream->register_feed('ClassName'); 14 15 Also, please fill out the AUTHOR constant in your plugin. It will be modified as changes are submitted: 16 17 class LifeStream_WoWArmoryFeed extends LifeStream_Feed { 18 const ID = 'wowarmory'; 19 const NAME = 'WoW Armory'; 20 const URL = 'http://www.wowarmory.com/'; 21 const DESCRIPTION = 'Display your character\'s Activity feed. (Achievement, Boss Kills, Loot)'; 22 const AUTHOR = '<Put your name in here, as well as any names who committed to this extension>' 23 } 24 25 The easiest way to contribute your extension back to the main project is by using GitHub. 26 27 1. Create an account on GitHub.com 28 2. Visit http://github.com/dcramer/wp-lifestream and "Fork". 29 3. On your new Fork, do a clone of your repository: `git clone git://github.com/<your username>/wp-lifestream.git` 30 4. Add your extension in extensions/ 31 5. TEST, TEST, TEST! 32 6. Visit http://github.com/dcramer/wp-lifestream and click "Pull Request" and write a brief description of your changes. 33 7. Wait for the authors of wp-lifestream to accept your contributions. -
lifestream/trunk/extensions/github/extension.inc.php
r195894 r196389 44 44 $data['branch'] = $repo[0]; 45 45 $data['repository'] = $repo[1]; 46 $data['group id'] = $data['repository'];46 $data['group_key'] = $data['repository']; 47 47 return $data; 48 48 } -
lifestream/trunk/inc/core.php
r195894 r196389 18 18 } 19 19 20 function lifestream_array_key_pop($array, $key )20 function lifestream_array_key_pop($array, $key, $default=null) 21 21 { 22 22 $value = @$array[$key]; 23 23 unset($array[$key]); 24 if (!$value) $value = $default; 24 25 return $value; 25 26 } … … 1071 1072 $values['feed_label'] = $_POST['feed_label']; 1072 1073 $values['icon_url'] = $_POST['icon_url']; 1073 $values['auto_icon'] = $_POST['auto_icon'];1074 $values['auto_icon'] = @$_POST['auto_icon']; 1074 1075 if ($_POST['owner'] != $instance->owner_id && current_user_can('manage_options')) 1075 1076 { … … 1681 1682 `version` int(11) default 0 NOT NULL, 1682 1683 `key` char(16) NOT NULL, 1684 `group_key` char(32) NOT NULL, 1683 1685 `owner` varchar(128) NOT NULL, 1684 1686 `owner_id` int(11) NOT NULL, 1685 1687 PRIMARY KEY (`id`), 1686 1688 INDEX `feed` (`feed`), 1687 UNIQUE `feed_id` (`feed_id`, ` key`, `owner_id`, `link`)1688 ) ENGINE=MyISAM;");1689 UNIQUE `feed_id` (`feed_id`, `group_key`, `owner_id`, `link`) 1690 );"); 1689 1691 1690 1692 $this->safe_query("CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."lifestream_event_group` ( … … 1700 1702 `version` int(11) default 0 NOT NULL, 1701 1703 `key` char(16) NOT NULL, 1704 `group_key` char(32) NOT NULL, 1702 1705 `owner` varchar(128) NOT NULL, 1703 1706 `owner_id` int(11) NOT NULL, 1704 1707 PRIMARY KEY (`id`), 1705 1708 INDEX `feed` (`feed`), 1706 INDEX `feed_id` (`feed_id`, ` key`, `owner_id`, `timestamp`)1707 ) ENGINE=MyISAM;");1709 INDEX `feed_id` (`feed_id`, `group_key`, `owner_id`, `timestamp`) 1710 );"); 1708 1711 1709 1712 $this->safe_query("CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."lifestream_feeds` ( … … 1718 1721 INDEX `owner_id` (`owner_id`), 1719 1722 PRIMARY KEY (`id`) 1720 ) ENGINE=MyISAM;");1723 );"); 1721 1724 1722 1725 $this->safe_query("CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."lifestream_error_log` ( … … 1730 1733 INDEX `has_viewed` (`has_viewed`), 1731 1734 PRIMARY KEY (`id`) 1732 ) ENGINE=MyISAM;");1735 );"); 1733 1736 1734 1737 if (!$version) return; … … 1778 1781 { 1779 1782 $wpdb->query("UPDATE `".$wpdb->prefix."lifestream_feeds` SET `active` = 1"); 1783 } 1784 if (version_compare($version, '0.99.9.7', '<')) 1785 { 1786 $wpdb->query("ALTER IGNORE TABLE `".$wpdb->prefix."lifestream_event` ADD `group_key` char(32) NOT NULL AFTER `key`, DROP KEY `feed_id`, ADD UNIQUE `feed_id` (`feed_id`, `group_key`, `owner_id`, `link`)"); 1787 $wpdb->query("ALTER IGNORE TABLE `".$wpdb->prefix."lifestream_event_group` ADD `group_key` char(32) NOT NULL AFTER `key`, DROP KEY `feed_id`, ADD UNIQUE `feed_id` (`feed_id`, `group_key`, `owner_id`, `timestamp`)"); 1788 $wpdb->query("UPDATE `".$wpdb->prefix."lifestream_event` SET `group_key` = md5(`key`)"); 1789 $wpdb->query("UPDATE `".$wpdb->prefix."lifestream_event_group` SET `group_key` = md5(`key`)"); 1780 1790 } 1781 1791 } … … 2296 2306 $date = lifestream_array_key_pop($item, 'date'); 2297 2307 $key = lifestream_array_key_pop($item, 'key'); 2308 $group_key = md5(lifestream_array_key_pop($item, 'group_key', $key)); 2309 2298 2310 if (!($date > 0)) $date = $default_timestamp; 2299 2311 … … 2312 2324 } 2313 2325 2314 $affected = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `".$wpdb->prefix."lifestream_event` (`feed_id`, `feed`, `link`, `data`, `timestamp`, `version`, `key`, ` owner`, `owner_id`) VALUES (%d, %s, %s, %s, %d, %d, %s, %s, %d)", $this->id, $this->get_constant('ID'), $link_key, serialize($item), $date, $this->get_constant('VERSION'), $key, $this->owner, $this->owner_id));2326 $affected = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `".$wpdb->prefix."lifestream_event` (`feed_id`, `feed`, `link`, `data`, `timestamp`, `version`, `key`, `group_key`, `owner`, `owner_id`) VALUES (%d, %s, %s, %s, %d, %d, %s, %s, %s, %d)", $this->id, $this->get_constant('ID'), $link_key, serialize($item), $date, $this->get_constant('VERSION'), $key, $group_key, $this->owner, $this->owner_id)); 2315 2327 if ($affected) 2316 2328 { … … 2318 2330 $item['date'] = $date; 2319 2331 $item['key'] = $key; 2320 2332 $item['group_key'] = $group_key; 2321 2333 $total += 1; 2322 2334 … … 2324 2336 if ($this->get_option('grouped') && $this->get_constant('CAN_GROUP') && constant(sprintf('%s::%s', $label, 'CAN_GROUP'))) 2325 2337 { 2326 if (!array_key_exists($ key, $grouped)) $grouped[$key] = array();2327 $grouped[$ key][date('m d Y', $date)] = $date;2338 if (!array_key_exists($group_key, $grouped)) $grouped[$group_key] = array(); 2339 $grouped[$group_key][date('m d Y', $date)] = $date; 2328 2340 } 2329 2341 else … … 2338 2350 } 2339 2351 // Grouping them by key 2340 foreach ($grouped as $ key=>$dates)2352 foreach ($grouped as $group_key=>$dates) 2341 2353 { 2342 2354 // Grouping them by date … … 2345 2357 // Get all of the current events for this date 2346 2358 // (including the one we affected just now) 2347 $results =& $wpdb->get_results($wpdb->prepare("SELECT `data`, `link` FROM `".$wpdb->prefix."lifestream_event` WHERE `feed_id` = %d AND `visible` = 1 AND DATE(FROM_UNIXTIME(`timestamp`)) = DATE(FROM_UNIXTIME(%d)) AND ` key` = %s", $this->id, $date, $key));2359 $results =& $wpdb->get_results($wpdb->prepare("SELECT `data`, `link` FROM `".$wpdb->prefix."lifestream_event` WHERE `feed_id` = %d AND `visible` = 1 AND DATE(FROM_UNIXTIME(`timestamp`)) = DATE(FROM_UNIXTIME(%d)) AND `group_key` = %s", $this->id, $date, $group_key)); 2348 2360 $events = array(); 2349 2361 foreach ($results as &$result) … … 2355 2367 2356 2368 // First let's see if the group already exists in the database 2357 $group =& $wpdb->get_results($wpdb->prepare("SELECT `id` FROM `".$wpdb->prefix."lifestream_event_group` WHERE `feed_id` = %d AND DATE(FROM_UNIXTIME(`timestamp`)) = DATE(FROM_UNIXTIME(%d)) AND ` key` = %s LIMIT 0, 1", $this->id, $date, $key));2369 $group =& $wpdb->get_results($wpdb->prepare("SELECT `id` FROM `".$wpdb->prefix."lifestream_event_group` WHERE `feed_id` = %d AND DATE(FROM_UNIXTIME(`timestamp`)) = DATE(FROM_UNIXTIME(%d)) AND `group_key` = %s LIMIT 0, 1", $this->id, $date, $group_key)); 2358 2370 if (count($group) == 1) 2359 2371 { … … 2363 2375 else 2364 2376 { 2365 $wpdb->query($wpdb->prepare("INSERT INTO `".$wpdb->prefix."lifestream_event_group` (`feed_id`, `feed`, `data`, `total`, `timestamp`, `version`, `key`, ` owner`, `owner_id`) VALUES(%d, %s, %s, %d, %d, %d, %s, %s, %d)", $this->id, $this->get_constant('ID'), serialize($events), count($events), $date, $this->get_constant('VERSION'), $key, $this->owner, $this->owner_id));2377 $wpdb->query($wpdb->prepare("INSERT INTO `".$wpdb->prefix."lifestream_event_group` (`feed_id`, `feed`, `data`, `total`, `timestamp`, `version`, `key`, `group_key`, `owner`, `owner_id`) VALUES(%d, %s, %s, %d, %d, %d, %s, %s, %s, %d)", $this->id, $this->get_constant('ID'), serialize($events), count($events), $date, $this->get_constant('VERSION'), $key, $group_key, $this->owner, $this->owner_id)); 2366 2378 } 2367 2379 } … … 2371 2383 $date = lifestream_array_key_pop($item, 'date'); 2372 2384 $key = lifestream_array_key_pop($item, 'key'); 2373 $wpdb->query($wpdb->prepare("INSERT INTO `".$wpdb->prefix."lifestream_event_group` (`feed_id`, `feed`, `event_id`, `data`, `timestamp`, `total`, `version`, `key`, `owner`, `owner_id`) VALUES(%d, %s, %d, %s, %d, 1, %d, %s, %s, %d)", $this->id, $this->get_constant('ID'), $item['id'], serialize(array($item)), $date, $this->get_constant('VERSION'), $key, $this->owner, $this->owner_id)); 2385 $group_key = lifestream_array_key_pop($item, 'group_key'); 2386 2387 $wpdb->query($wpdb->prepare("INSERT INTO `".$wpdb->prefix."lifestream_event_group` (`feed_id`, `feed`, `event_id`, `data`, `timestamp`, `total`, `version`, `key`, `group_key`, `owner`, `owner_id`) VALUES(%d, %s, %d, %s, %d, 1, %d, %s, %s, %s, %d)", $this->id, $this->get_constant('ID'), $item['id'], serialize(array($item)), $date, $this->get_constant('VERSION'), $key, $group_key, $this->owner, $this->owner_id)); 2374 2388 } 2375 2389 $wpdb->query($wpdb->prepare("UPDATE `".$wpdb->prefix."lifestream_feeds` SET `timestamp` = UNIX_TIMESTAMP() WHERE `id` = %d", $this->id)); -
lifestream/trunk/inc/widget.php
r194062 r196389 30 30 $args = array( 31 31 'limit'=>$options['amount'], 32 'feed_ids'=> $options['feeds'],33 'hide_metadata'=> $options['hide_metadata'],34 'break_groups'=> $options['break_groups'] ? true : false,32 'feed_ids'=>@$options['feeds'], 33 'hide_metadata'=>@$options['hide_metadata'], 34 'break_groups'=>@$options['break_groups'] ? true : false, 35 35 'event_total_max'=>-1, 36 36 'date_interval'=>-1, … … 158 158 <p> 159 159 <label> 160 <input type="checkbox" name="lifestream[<?php echo $number; ?>][break_groups]" value="1"<?php if ( $current_options['break_groups']) echo ' checked = "checked"'; ?>/>160 <input type="checkbox" name="lifestream[<?php echo $number; ?>][break_groups]" value="1"<?php if (@$current_options['break_groups']) echo ' checked = "checked"'; ?>/> 161 161 <?php $lifestream->_e('Break up grouped events.'); ?> 162 162 </label><br /> … … 164 164 <p> 165 165 <label> 166 <input type="checkbox" name="lifestream[<?php echo $number; ?>][hide_metadata]" value="1"<?php if ( $current_options['hide_metadata']) echo ' checked = "checked"'; ?>/>166 <input type="checkbox" name="lifestream[<?php echo $number; ?>][hide_metadata]" value="1"<?php if (@$current_options['hide_metadata']) echo ' checked = "checked"'; ?>/> 167 167 <?php $lifestream->_e('Hide meta data, such as the time.'); ?> 168 168 </label><br /> … … 172 172 <select multiple="multiple" style="width: 92%; height: 80px;" name="lifestream[<?php echo $number; ?>][feeds][]"> 173 173 <?php foreach ($feeds as &$feed) { ?> 174 <option value="<?php echo $feed->id; ?>"<?php if (in_array((string)$feed->id, (array)$current_options['feeds'])) echo ' selected="selected"'; ?>><?php echo $feed->get_public_name(); ?> (<?php echo $feed->get_feed_display(); ?>)</option>174 <option value="<?php echo $feed->id; ?>"<?php if (in_array((string)$feed->id, @(array)$current_options['feeds'])) echo ' selected="selected"'; ?>><?php echo $feed->get_public_name(); ?> (<?php echo $feed->get_feed_display(); ?>)</option> 175 175 <?php } ?> 176 176 </select> -
lifestream/trunk/lifestream.php
r194062 r196389 4 4 Plugin URI: http://www.enthropia.com/labs/wp-lifestream/ 5 5 Description: Displays your activity from various social networks. (Requires PHP 5 and MySQL 5) 6 Version: 0.99.9. 66 Version: 0.99.9.7-PRE 7 7 Author: David Cramer <dcramer@gmail.com> 8 8 Author URI: http://www.davidcramer.net … … 18 18 } 19 19 20 define('LIFESTREAM_VERSION', '0.99.9. 6');20 define('LIFESTREAM_VERSION', '0.99.9.7'); 21 21 define('LIFESTREAM_PLUGIN_FILE', plugin_basename(__FILE__)); 22 22 define('LIFESTREAM_PATH', dirname(__FILE__)); -
lifestream/trunk/readme.txt
r193745 r196389 166 166 * Foursquare 167 167 * Ustream 168 * World of Warcraft Armory 169 170 Want to add your own? See extensions/README for more information. 168 171 169 172 == Localization ==
Note: See TracChangeset
for help on using the changeset viewer.