Show
Ignore:
Timestamp:
10/01/08 07:41:06 (3 months ago)
Author:
anatoo
Message:

メール周り追加

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/plain_php/trunk/model/phwittr/StatusService.php

    r20036 r20338  
    44{ 
    55    protected $pdo; 
    6     function __construct(PDO $pdo) 
     6    function __construct(PDO $pdo, $base_url) 
    77    { 
    88        $this->pdo = $pdo; 
     9        $this->baseUrl = $base_url; 
    910    } 
    1011    function reply($user_id, $comment, $reply_user_id) 
     
    4849        $smt->execute(); 
    4950         
    50         return $smt->fetch(PDO::FETCH_ASSOC); 
     51        $s = $smt->fetch(PDO::FETCH_ASSOC); 
     52         
     53        if ($s) $s = $this->processStatus($s); 
     54        return $s; 
    5155    } 
    52          
     56    protected function processStatus($status) 
     57    { 
     58        $status['title_comment'] = h($status['comment']); 
     59        $status['comment'] = preg_replace('#(https?://[[:alnum:]+$;?.%,!\#~*/:@&=_-]+)#', '<a href="$1">$1</a>' , h($status['comment'])); 
     60        $status['comment'] = preg_replace('#@([[:word:]]{1,30})#',  
     61                                '@<a href="' . $this->baseUrl . '/$1">$1</a>',  
     62                                $status['comment']); 
     63        return $status; 
     64    } 
    5365} 
    5466