예제 #1
0
 function yield_many($row, $url, $key)
 {
     $events = array();
     $string = '<a href="' . $this->get_public_url() . '">' . $this->get_option('username') . '</a> ';
     $description = $this->lifestream->html_entity_decode($row->get_description());
     if (lifestream_str_startswith(strtolower($description), strtolower($string))) {
         $description = substr($description, strlen($string));
     }
     if (lifestream_str_startswith(strtolower($description), 'unlocked')) {
         preg_match_all($this->achievement_regexp, str_replace('</li>', "</li>\n", $description), $matches, PREG_SET_ORDER);
         foreach ($matches as $match) {
             $data = parent::yield($row, $url, $key);
             $data['title'] = $match[1] . ' in ' . $match[3];
             $data['link'] = $match[2];
             $data['key'] = 'achievement';
             unset($data['description']);
             $events[] = $data;
         }
     } elseif (preg_match($this->status_regexp, $description, $match)) {
         $data = parent::yield($row, $url, $key);
         $data['title'] = $match[1];
         $data['link'] = $this->get_public_url();
         $data['key'] = 'status';
         unset($data['description']);
         $events[] = $data;
     } elseif (preg_match($this->played_regexp, $description, $match) || preg_match($this->played_alt_regexp, $description, $match)) {
         $data = parent::yield($row, $url, $key);
         $data['title'] = $match[2];
         $data['link'] = $match[1];
         $data['key'] = 'played';
         unset($data['description']);
         $events[] = $data;
     }
     return $events;
 }
예제 #2
0
 function yield($row, $url, $key)
 {
     $data = parent::yield($row, $url, $key);
     $title = $this->lifestream->html_entity_decode($row->get_title());
     if (lifestream_str_startswith($title, 'Comment on: ')) {
         if (!$this->get_option('show_comments')) {
             return;
         }
         $key = 'comment';
         $title = substr($title, 12);
     } elseif (lifestream_str_startswith($title, 'Submitted: ')) {
         if (!$this->get_option('show_submissions')) {
             return;
         }
         $key = 'submit';
         $title = substr($title, 11);
     } elseif (lifestream_str_startswith($title, 'Favorite: ')) {
         if (!$this->get_option('show_favorites')) {
             return;
         }
         $key = 'favorite';
         $title = substr($title, 10);
     } else {
         return;
     }
     $data['title'] = $title;
     $data['key'] = $key;
     return $data;
 }
예제 #3
0
 function yield($row, $url, $key)
 {
     $string = $this->get_option('username') . ': ';
     $title = $this->lifestream->html_entity_decode($row->get_title());
     if (lifestream_str_startswith($title, $string)) {
         $title = substr($title, strlen($string));
     }
     return array('guid' => $row->get_id(), 'date' => $row->get_date('U'), 'link' => $this->lifestream->html_entity_decode($row->get_link()), 'title' => $title);
 }
예제 #4
0
 function yield($row, $url, $key)
 {
     $data = parent::yield($row, $url, $key);
     if (lifestream_str_startswith(strtolower($data['title']), 'talk:')) {
         return;
     }
     // we dont need huge descriptions stored in the db, its bloat
     unset($data['description']);
     return $data;
 }
예제 #5
0
 function yield($row, $url, $key)
 {
     $data = parent::yield($row, $url, $key);
     $string = $this->get_option('username') . ': ';
     $description = $this->lifestream->html_entity_decode($row->get_description());
     if (lifestream_str_startswith(strtolower($description), strtolower($string))) {
         $description = substr($description, strlen($string));
     }
     if ($this->get_option('hide_replies') && lifestream_str_startswith($description, '@')) {
         return false;
     }
     $data['description'] = $description;
     return $data;
 }
예제 #6
0
 function yield($row, $url, $key)
 {
     $data = parent::yield($row, $url, $key);
     $title = $row->get_title();
     $chunk = sprintf('%s on', $this->get_option('username'));
     if (lifestream_str_startswith($title, $chunk)) {
         $title = substr($title, strlen($chunk));
     }
     $data['title'] = $this->lifestream->html_entity_decode($title);
     $data['description'] = $this->lifestream->html_entity_decode($row->get_description());
     // Submissions are automatically liked, so we'll omit the redundant "liked" entry for posts submitted by the owner
     if ($key == 'liked' && $this->parse_post_author($data['description']) == $this->get_option('username')) {
         return null;
     } else {
         return $data;
     }
 }
예제 #7
0
 function yield($row, $url, $key)
 {
     $data = parent::yield($row, $url, $key);
     $string = $this->get_option('username') . ' ';
     $title = $data['title'];
     if (lifestream_str_startswith(strtolower($title), strtolower($string))) {
         $title = substr($title, strlen($string));
     }
     $bits = explode(' ', $title);
     if ($bits[0] == 'shares') {
         if (preg_match($this->image_match_regexp, $data['description'], $match)) {
             $data['thumbnail'] = $match[1];
             $data['key'] = 'photo';
         }
     } else {
         $data['key'] = 'message';
     }
     $data['title'] = implode(' ', array_slice($bits, 1));
     return $data;
 }
$lifestream->_e('Cron tasks are regularly scheduled events, and are used to update lifestream and make automated posts.');
?>
</p>
		<table class="widefat">
			<thead>
				<tr>
					<th scope="col">Task</th>
					<th scope="col" style="width: 250px;">Next Attempt</th>
				</tr>
			</thead>
			<tbody>
				<?php 
$jobs = _get_cron_array();
foreach ($jobs as $ts => $cron_data) {
    foreach ($cron_data as $name => $data) {
        if (lifestream_str_startswith($name, 'lifestream')) {
            $data = array_values($data);
            ?>
							<tr>
								<td><strong><?php 
            echo htmlspecialchars($name);
            ?>
</strong><br /><small><?php 
            echo htmlspecialchars($lifestream->get_cron_task_description($name));
            ?>
</small></td>
								<td><?php 
            echo date('r', $ts + LIFESTREAM_DATE_OFFSET);
            ?>
<br /><small>Every <?php 
            echo $lifestream->duration($data[0]['interval']);
예제 #9
0
파일: core.php 프로젝트: robv/wp-lifestream
 function init()
 {
     global $wpdb;
     $offset = get_option('gmt_offset') * 3600;
     define('LIFESTREAM_DATE_OFFSET', $offset);
     load_plugin_textdomain('lifestream', false, 'lifestream/locales');
     $page = isset($_GET['page']) ? $_GET['page'] : null;
     if (is_admin() && lifestream_str_startswith($page, 'lifestream')) {
         wp_enqueue_script('jquery');
         wp_enqueue_script('admin-forms');
     }
     add_feed('lifestream-feed', 'lifestream_rss_feed');
     $this->is_buddypress = function_exists('bp_is_blog_page') ? true : false;
     register_post_type('lsevent', array('label' => $this->__('Lifestream Events'), 'singular_label' => $this->__('Lifestream Event'), 'show_ui' => false, 'public' => true, 'exclude_from_search' => true, 'hierarchical' => false, 'capability_type' => 'post', 'rewrite' => array('slug', 'lifestream'), 'query_var' => false, 'can_export' => false, 'show_in_nav_menus' => false, 'supports' => array('title', 'comments')));
     // If this is an update we need to force reactivation
     if (LIFESTREAM_VERSION != $this->get_option('_version')) {
         $this->get_option('_version');
         $this->deactivate();
         $this->activate();
     }
 }
예제 #10
0
 function init()
 {
     global $wpdb;
     $offset = get_option('gmt_offset') * 3600;
     define('LIFESTREAM_DATE_OFFSET', $offset);
     load_plugin_textdomain('lifestream', false, 'lifestream/locales');
     $page = isset($_GET['page']) ? $_GET['page'] : null;
     if (is_admin() && lifestream_str_startswith($page, 'lifestream')) {
         wp_enqueue_script('jquery');
         wp_enqueue_script('admin-forms');
     }
     add_feed('lifestream-feed', 'lifestream_rss_feed');
     $this->is_buddypress = function_exists('bp_is_blog_page') ? true : false;
     // If this is an update we need to force reactivation
     if (LIFESTREAM_VERSION != $this->get_option('_version')) {
         $this->get_option('_version');
         $this->deactivate();
         $this->activate();
     }
 }