lib/components/helpers/Gravatar.php
public function fetch($email, $hash_email = true)
    {
        $url = $this->get($email, $hash_email);
        $cacheKey = md5('gravatar-' . $url);
        $cache = Yii::$app->fileCache->get($cacheKey);
        if ($cache) {
            return unserialize($cache);
        }
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        $data = curl_exec($curl);
        $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
        curl_close($curl);
        if (!$data || $httpCode !== 200) {
            $data = false;
        }
        Yii::$app->fileCache->set($cacheKey, serialize($data), 3600);

        return $data;
    }
public function fetch($email, $hash_email = true)
    {
        $url = $this->get($email, $hash_email);
        $cacheKey = md5('gravatar-' . $url);
        $cache = Yii::$app->fileCache->get($cacheKey);
        if ($cache) {
            return unserialize($cache);
        }
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
        $data = curl_exec($curl);
        $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
        curl_close($curl);
        if (!$data || $httpCode !== 200) {
            $data = false;
        }
        Yii::$app->fileCache->set($cacheKey, serialize($data), 3600);

        return $data;
    }
public function fetch ( $ email , $ hash_email = true ) { $ url = $ this -> get ( $ email , $ hash_email ) ; $ cacheKey = md5 ( 'gravatar-' . $ url ) ; $ cache = Yii :: $ app -> fileCache -> get ( $ cacheKey ) ; if ( $ cache ) { return unserialize ( $ cache ) ; } $ curl = curl_init ( ) ; curl_setopt ( $ curl , CURLOPT_URL , $ url ) ; curl_setopt ( $ curl , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ curl , CURLOPT_HEADER , false ) ; curl_setopt ( $ curl , CURLOPT_CONNECTTIMEOUT , 5 ) ; $ data = curl_exec ( $ curl ) ; $ httpCode = curl_getinfo ( $ handle , CURLINFO_HTTP_CODE ) ; curl_close ( $ curl ) ; if ( ! $ data || $ httpCode !== 200 ) { $ data = false ; } Yii :: $ app -> fileCache -> set ( $ cacheKey , serialize ( $ data ) , 3600 ) ; return $ data ; }
[[@doctodo method_description:fetch]].

@param [[@doctodo param_type:email]] $email      [[@doctodo param_description:email]]
@param boolean                       $hash_email [[@doctodo param_description:hash_email]] [optional]

@return [[@doctodo return_type:fetch]] [[@doctodo return_description:fetch]]
[[ @doctodo method_description : fetch ]] .