/** * 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); }
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 (LIVE)<br />3pm – 4pm Har Mar Superstar’s Desert Island Disco (pre rec)<br />4pm – 8pm Mountain of One<br />8pm – 11pm Shortwave Set (pre rec)<br />11pm – Midnight Inflagranti (pre rec in the mix)<br />Double line spacing:<br />Noon-3pm Trojan Soundsystem (LIVE)<br />3pm – 4pm Har Mar Superstar’s Desert Island Disco (pre rec)<br />4pm – 8pm Mountain of One<br />8pm – 11pm Shortwave Set (pre rec)</p> '; $result = $this->Cleaner->clean($text2); $this->assertEqual($result, $text2); return; }
/** * 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); }
/** * 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); }
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); }