コード例 #1
0
ファイル: GravatarTest.php プロジェクト: predominant/goodies
 /**
  * testForceDefault
  *
  * @return void
  */
 public function testForceDefault()
 {
     $result = $this->Gravatar->url('*****@*****.**', array('forcedefault' => true));
     $this->assertPattern('/\\?/', $result);
     list($url, $params) = explode('?', $result);
     $this->assertPattern('/f=y/', $params);
 }
コード例 #2
0
    function testOverCleaning()
    {
        $tagsArray = array('br', 'p', 'strong', 'em', 'ul', 'ol', 'li', 'dl', 'dd', 'dt', 'a', 'img', 'i', 'u', 'b');
        $attributesArray = array('src', 'href', 'title');
        $replaceImgThumb = false;
        $this->Cleaner->configure(compact('tagsArray', 'attributesArray', 'replaceImgThumb'));
        //$result = $this->Cleaner->clean('<p>4pm � 8pm Mountain of One</p>');
        //$this->assertEqual($result, '<p>4pm � 8pm Mountain of One</p>');
        $text = 'Single line spacing:
 
Noon-3pm Trojan Soundsystem  (LIVE)
3pm � 4pm Har Mar Superstar�s Desert Island Disco (pre rec)
4pm � 8pm Mountain of One
8pm � 11pm Shortwave Set (pre rec)
11pm � Midnight Inflagranti (pre rec in the mix)
Double line spacing:
Noon-3pm Trojan Soundsystem  (LIVE)
3pm � 4pm Har Mar Superstar�s Desert Island Disco (pre rec)
4pm � 8pm Mountain of One
8pm � 11pm Shortwave Set (pre rec)
11pm � Midnight Inflagranti (pre rec in the mix)';
        $result = $this->Cleaner->clean('<p>4pm - 8pm Mountain of One</p>');
        $this->assertEqual($result, '<p>4pm - 8pm Mountain of One</p>');
        $result = $this->Cleaner->clean($text);
        $this->assertEqual($result, $text);
        $text2 = '<p>Noon-3pm Trojan Soundsystem&nbsp; (LIVE)<br />3pm &ndash; 4pm Har Mar Superstar&rsquo;s Desert Island Disco (pre rec)<br />4pm &ndash; 8pm Mountain of One<br />8pm &ndash; 11pm Shortwave Set (pre rec)<br />11pm &ndash; Midnight Inflagranti (pre rec in the mix)<br />Double line spacing:<br />Noon-3pm Trojan Soundsystem&nbsp; (LIVE)<br />3pm &ndash; 4pm Har Mar Superstar&rsquo;s Desert Island Disco (pre rec)<br />4pm &ndash; 8pm Mountain of One<br />8pm &ndash; 11pm Shortwave Set (pre rec)</p>
';
        $result = $this->Cleaner->clean($text2);
        $this->assertEqual($result, $text2);
        return;
    }
コード例 #3
0
ファイル: avatar.php プロジェクト: Galvanio/Kinspir
 /**
  * Show avatar for the supplied user (email address or facebook_id)
  */
 public function image($user, $options = array())
 {
     if (!empty($user['User'])) {
         $user = $user['User'];
     }
     if (!empty($user['facebook_id'])) {
         return $this->__facebookImage($user, $options);
     }
     unset($options['fb_size'], $options['linked'], $options['facebook-logo']);
     return parent::image($user['email'], $options);
 }
コード例 #4
0
 /**
  * testSecureUrl
  *
  * @return void
  * @access public
  */
 public function testSecureUrl()
 {
     $expected = 'https://secure.gravatar.com/avatar/' . Security::hash('*****@*****.**', 'md5');
     $result = $this->Gravatar->url('*****@*****.**', array('ext' => false, 'secure' => true));
     $this->assertEqual($expected, $result);
     $_SERVER['HTTPS'] = true;
     $expected = 'https://secure.gravatar.com/avatar/' . Security::hash('*****@*****.**', 'md5');
     $result = $this->Gravatar->url('*****@*****.**', array('ext' => false));
     $this->assertEqual($expected, $result);
     $expected = 'https://secure.gravatar.com/avatar/' . Security::hash('*****@*****.**', 'md5');
     $result = $this->Gravatar->url('*****@*****.**', array('ext' => false, 'secure' => true));
     $this->assertEqual($expected, $result);
 }
コード例 #5
0
ファイル: FriendController.php プロジェクト: sh1nu11bi/CloMa
 public function getMessages()
 {
     $user_id = Auth::user()->id;
     $requests = Friend::where('user_id', $user_id)->where('type', Friend::REQUESTING)->get();
     $count = count($requests);
     $content = array();
     foreach ($requests as $request) {
         $friend = User::find($request->friend_id);
         $user['id'] = $friend->id;
         $user['username'] = $friend->username;
         $user['fullname'] = $friend->full_name;
         $user['avatar'] = $friend->image ? $friend->image : GravatarHelper::avatar($friend->email);
         $content[] = $user;
     }
     $htmlContent = View::make('friends.messages')->with('data', $content)->render();
     $response = array('count' => $count, 'content' => $htmlContent);
     return Response::json($response);
 }