Plugin Directory

Changeset 191702


Ignore:
Timestamp:
01/08/2010 11:48:08 PM (16 years ago)
Author:
zeeg
Message:

Sexifying the GitHub extension. Some strict syntax errors cleaned up.

Location:
lifestream/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • lifestream/trunk/CHANGES

    r191672 r191702  
    77* Updated SimplePie to 1.2.
    88* Upon activating the plugin the default feed is now owned by the user performing the activation.
     9* Added much needed "less suck" to the GitHub extension.
    910
    10110.99.9.5
  • lifestream/trunk/extensions/github/extension.inc.php

    r153349 r191702  
    1313        return $match[1];
    1414    }
    15 
     15    function parse_repo($text)
     16    {
     17        preg_match('/pushed to (.+) at (.+\/.+)/', $text, $match);
     18        return array($match[1], $match[2]);
     19    }
     20   
     21    function get_repository_name(&$event, &$bit)
     22    {
     23        return $bit['repository'];
     24    }
     25   
     26    function get_repository_link(&$event, &$bit)
     27    {
     28        $name = $this->get_repository_name($event, $bit);
     29        if (!$name) return;
     30        return $this->lifestream->get_anchor_html($this->get_repository_name($event, $bit), sprintf('http://www.github.com/%s/', $name));
     31    }
     32   
     33   
    1634    function yield($row, $url, $key)
    1735    {
     
    2341            $message = $this->parse_message($description);
    2442            $data['title'] = $message;
     43            $repo = $this->parse_repo($row->get_title());
     44            $data['branch'] = $repo[0];
     45            $data['repository'] = $repo[1];
    2546            return $data;
    2647        }
  • lifestream/trunk/inc/core.php

    r191676 r191702  
    6868        $this->owner_id = $row->owner_id;
    6969        $this->visible = $row->visible;
    70         $this->link = (!empty($this->data['link']) ? $this->data['link'] : $row->link);
     70        $this->link = @(!empty($this->data['link']) ? $this->data['link'] : $row->link);
    7171        $cls = $this->lifestream->get_feed($row->feed);
    7272        $this->feed = new $cls($this->lifestream, unserialize($row->options), $row->feed_id);
     
    20002000            $this->_owner_id = $row->owner_id;
    20012001            $this->version = $row->version;
    2002             $this->events = $row->events;
     2002            $this->events = 'n/a';
     2003            //$this->events = $row->events;
    20032004            $this->feed = $row->feed;
    20042005        }
  • lifestream/trunk/inc/labels.php

    r181924 r191702  
    365365    function get_label_single()
    366366    {
    367         return $this->lifestream->__('Committed code.', $this->get_feed_label());
    368     }
    369    
    370     function get_label_plural()
    371     {
    372         return $this->lifestream->__('Made %s commits.', $this->_get_show_details_link(), $this->get_feed_label());
    373     }
    374    
    375     function get_label_single_user()
    376     {
    377         return $this->lifestream->__('%s committed code.', $this->get_user_label(), $this->get_feed_label());
    378     }
    379    
    380     function get_label_plural_user()
    381     {
    382         return $this->lifestream->__('%s made %s commits.', $this->get_user_label(), $this->_get_show_details_link(), $this->get_feed_label());
     367        $repo = $this->feed->get_repository_link($this->event, $this->event->data[0]);
     368        if ($repo)
     369        {
     370            return $this->lifestream->__('Committed %2$s to %3$s.', $this->get_feed_label(), $this->get_single_link(), $repo);
     371        }
     372        return $this->lifestream->__('Committed %2$s.', $this->get_feed_label(), $this->get_single_link());
     373    }
     374   
     375    function get_label_plural()
     376    {
     377        $repo = $this->feed->get_repository_link($this->event, $this->event->data[0]);
     378        if ($repo)
     379        {
     380            return $this->lifestream->__('Made %s commits to %3$s.', $this->_get_show_details_link(), $this->get_feed_label(), $repo);
     381        }
     382        return $this->lifestream->__('Made %s commits to %s.', $this->_get_show_details_link(), $this->get_feed_label());
     383    }
     384   
     385    function get_label_single_user()
     386    {
     387        $repo = $this->feed->get_repository_link($this->event, $this->event->data[0]);
     388        if ($repo)
     389        {
     390            return $this->lifestream->__('%1$s committed %3$s to %4$s.', $this->get_user_label(), $this->get_feed_label(), $this->get_single_link(), $repo);
     391        }
     392        return $this->lifestream->__('%1$s committed %3$s', $this->get_user_label(), $this->get_feed_label(), $this->get_single_link());
     393    }
     394   
     395    function get_label_plural_user()
     396    {
     397        $repo = $this->feed->get_repository_link($this->event, $this->event->data[0]);
     398        if ($repo)
     399        {
     400            return $this->lifestream->__('%s made %s commits to %3$s.', $this->get_user_label(), $this->_get_show_details_link(), $this->get_feed_label(), $repo);
     401        }
     402        return $this->lifestream->__('%s made %s commits to %s.', $this->get_user_label(), $this->_get_show_details_link(), $this->get_feed_label());
    383403    }
    384404}
  • lifestream/trunk/inc/widget.php

    r124986 r191702  
    105105            'amount' => 10,
    106106            'title' => 'Lifestream',
     107            'break_groups' => false,
     108            'feeds' => array(),
     109            'hide_metadata' => false,
    107110        );
    108111        $number = '%i%';
  • lifestream/trunk/pages/add-feed.inc.php

    r149363 r191702  
    7979                <th>&nbsp;</th>
    8080                <td>
    81                     <label><input type="checkbox" name="grouped" id="id_grouped" value="1"<?php if ($_POST['grouped'] == '1') echo ' checked="checked"'; ?>/> <?php $lifestream->_e('Group events from the same day together.'); ?></label>
     81                    <label><input type="checkbox" name="grouped" id="id_grouped" value="1"<?php if (isset($_POST['grouped']) && $_POST['grouped'] == '1') echo ' checked="checked"'; ?>/> <?php $lifestream->_e('Group events from the same day together.'); ?></label>
    8282                </td>
    8383            </tr>
Note: See TracChangeset for help on using the changeset viewer.