Commit 0b79eefd306b45b8418fb8aaaa42d51ff8d77814
- Diff rendering mode:
- inline
- side by side
entry.class.php
(32 / 18)
|   | |||
| 144 | 144 | } | |
| 145 | 145 | ||
| 146 | 146 | class MicroBlog extends Entry{ | |
| 147 | |||
| 148 | #TODO: add link to post ? | ||
| 149 | function getSingleTitle(){ | ||
| 150 | $title = $this->getNeutralTitle(); | ||
| 151 | |||
| 147 | function format($message) { | ||
| 152 | 148 | // Replace URLs with links | |
| 153 | $title = $this->linkify($title); | ||
| 149 | $message = $this->linkify($message); | ||
| 154 | 150 | ||
| 155 | 151 | // Default to Twitter if multiple... | |
| 156 | $domain = count($this->icons) > 1 ? Twitter::$static_domain : $this->domain; | ||
| 157 | $search_path = count($this->icons) > 1 ? Twitter::$static_search_path : $this->search_path; | ||
| 152 | $domain = isset($this->icons) && count($this->icons) > 1 ? Twitter::$static_domain : $this->domain; | ||
| 153 | $search_path = isset($this->icons) && count($this->icons) > 1 ? Twitter::$static_search_path : $this->search_path; | ||
| 158 | 154 | ||
| 159 | 155 | // Link usernames | |
| 160 | $title = preg_replace('/( |\.|^)@([\w_-]+)/i', '$1@<a href="http://'.$domain.'/$2">$2</a>', $title); | ||
| 156 | $message = preg_replace('/( |\.|^)@([\w_-]+)/i', '$1@<a href="http://'.$domain.'/$2">$2</a>', $message); | ||
| 161 | 157 | ||
| 162 | 158 | // Link hash tags | |
| 163 | $title = preg_replace('/( |^)#([\w_-]+)/i', '$1#<a href="http://'.$search_path.'?q=%23$2">$2</a>', $title); | ||
| 159 | $message = preg_replace('/( |^)#([\w_-]+)/i', '$1#<a href="http://'.$search_path.'?q=%23$2">$2</a>', $message); | ||
| 164 | 160 | ||
| 165 | return $title; | ||
| 161 | return $message; | ||
| 162 | } | ||
| 163 | |||
| 164 | #TODO: add link to post ? | ||
| 165 | function getSingleTitle(){ | ||
| 166 | return $this->format( $this->getNeutralTitle() ); | ||
| 166 | 167 | } | |
| 167 | 168 | ||
| 168 | 169 | function getSingleDescription(){ | |
| … | … | ||
| 233 | 233 | return $this->getAuthor()." $this->action " . parent::getSingleTitle(); | |
| 234 | 234 | } | |
| 235 | 235 | ||
| 236 | function getMultipleTitle(){ | ||
| 237 | return parent::getSingleTitle(); | ||
| 238 | } | ||
| 236 | function getMultipleTitle(){ | ||
| 237 | return str_replace($this->getAuthor()." $this->action ",'', $this->getSingleTitle()); | ||
| 238 | } | ||
| 239 | 239 | ||
| 240 | 240 | function multiple($other_entries, $more_threshold=5){ | |
| 241 | 241 | $icon = $this->getIcon(); | |
| … | … | ||
| 568 | 568 | public static $static_domain = 'identi.ca'; | |
| 569 | 569 | public static $static_search_path = 'identi.ca/search/notice'; | |
| 570 | 570 | ||
| 571 | function getSingleTitle(){ | ||
| 572 | $title = parent::getSingleTitle(); | ||
| 571 | // function getSingleTitle(){ | ||
| 572 | // $title = parent::getSingleTitle(); | ||
| 573 | 573 | ||
| 574 | function format($message){ | ||
| 575 | $message = parent::format($message); | ||
| 576 | |||
| 574 | 577 | // Link groups | |
| 575 | $title = preg_replace('/( |^)!([\w_-]+)/i', '$1!<a href="http://'.$this->domain.'/group/$2">$2</a>', $title); | ||
| 578 | $message = preg_replace('/( |^)!([\w_-]+)/i', '$1!<a href="http://'.$this->domain.'/group/$2">$2</a>', $message); | ||
| 576 | 579 | ||
| 577 | return $title; | ||
| 580 | return $message; | ||
| 578 | 581 | } | |
| 579 | 582 | } | |
| 580 | 583 | ||
| … | … | ||
| 618 | 618 | ||
| 619 | 619 | class TwitterFavorites extends Favorites{ | |
| 620 | 620 | var $img = 'http://www.twitter.com/favicon.ico'; | |
| 621 | var $domain = 'twitter.com'; | ||
| 622 | var $search_path = 'search.twitter.com/search'; | ||
| 623 | public static $static_domain = 'twitter.com'; | ||
| 624 | public static $static_search_path = 'search.twitter.com/search'; | ||
| 621 | 625 | ||
| 626 | function getSingleTitle(){ | ||
| 627 | $message = Twitter::format($this->title); | ||
| 628 | $message = preg_replace('/^([\w]+)\: /i', '<a href="'.$this->link.'">$1</a>: ', $message); | ||
| 629 | return $this->getAuthor() ." $this->action ". $message; | ||
| 630 | } | ||
| 631 | |||
| 622 | 632 | function getSingleDescription(){ | |
| 623 | 633 | return ''; | |
| 624 | 634 | } |

