This component provides an easy way to retrieve a user's profile image from Gravatar site based on a given email address. If the email address cannot be matched with a Gravatar account, an alternative will be returned based on the Gravatar::$defaultImage setting. Users with gravatars can have a default image if you want to.
Inheritance: implements Phalcon\Avatar\Avatarable
Beispiel #1
1
 public function testShouldSetOptionsThroughConfig()
 {
     $gravatar = new Gravatar(['default_image' => 'retro', 'rating' => 'x', 'size' => 60, 'use_https' => true]);
     $this->assertEquals('retro', $gravatar->getDefaultImage());
     $this->assertEquals(Gravatar::RATING_X, $gravatar->getRating());
     $this->assertEquals(60, $gravatar->getSize());
     $this->assertTrue($gravatar->isUseSecureURL());
 }
Beispiel #2
1
        $frontCache = new \Phalcon\Cache\Frontend\Data(["lifetime" => 86400 * 30]);
        return new \Phalcon\Cache\Backend\File($frontCache, ["cacheDir" => APP_PATH . "/app/cache/data/", "prefix" => "forum-cache-data-"]);
    }
});
/**
 * Markdown renderer
 */
$di->set('markdown', function () {
    $ciconia = new Ciconia();
    $ciconia->addExtension(new \Phosphorum\Markdown\UnderscoredUrlsExtension());
    $ciconia->addExtension(new \Phosphorum\Markdown\TableExtension());
    $ciconia->addExtension(new \Phosphorum\Markdown\MentionExtension());
    $ciconia->addExtension(new \Phosphorum\Markdown\BlockQuoteExtension());
    $ciconia->addExtension(new \Phosphorum\Markdown\UrlAutoLinkExtension());
    $ciconia->addExtension(new \Ciconia\Extension\Gfm\FencedCodeBlockExtension());
    return $ciconia;
}, true);
/**
 * Real-Time notifications checker
 */
$di->set('notifications', function () {
    return new NotificationsChecker();
}, true);
/**
 * Gravatar instance
 */
$di->setShared('gravatar', function () {
    $gravatar = new Gravatar(['default_image' => 'identicon', 'size' => 24, 'rating' => Gravatar::RATING_PG]);
    $gravatar->enableSecureURL();
    return $gravatar;
});