View/Helper/Gravatar.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_View  
Subpackage
Helper  
Version
$Id: Doctype.php 16971 2009-07-22 18:05:45Z mikaelkael $  

\Zend_View_Helper_Gravatar

Package: Zend\View\Helper
Helper for retrieving avatars from gravatar.com
Parent(s)
\Zend_View_Helper_HtmlElement < \Zend_View_Helper_Abstract
Copyright
Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Link
http://pl.gravatar.com/site/implement/url  

Constants

>VConstant  GRAVATAR_URL = 'http://www.gravatar.com/avatar'
URL to gravatar service
>VConstant  GRAVATAR_URL_SECURE = 'https://secure.gravatar.com/avatar'
Secure URL to gravatar service
>VConstant  RATING_G = 'g'
Gravatar rating
>VConstant  RATING_PG = 'pg'
>VConstant  RATING_R = 'r'
>VConstant  RATING_X = 'x'
>VConstant  DEFAULT_404 = '404'
Default gravatar image value constants
>VConstant  DEFAULT_MM = 'mm'
>VConstant  DEFAULT_IDENTICON = 'identicon'
>VConstant  DEFAULT_MONSTERID = 'monsterid'
>VConstant  DEFAULT_WAVATAR = 'wavatar'
>VConstant  EOL = "\n"
inherited
EOL character
Inherited from: \Zend_View_Helper_HtmlElement::EOL

Properties

>VPropertyprotectedarray $_attribs
Attributes for HTML image tag
Details
Type
array
>VPropertyprotectedstring $_closingBracket = null
inherited
The tag closing bracket
Inherited from: \Zend_View_Helper_HtmlElement::$$_closingBracket
Default valuenullDetails
Type
string
Inherited_from
\Zend_View_Helper_HtmlElement::$$_closingBracket  
>VPropertyprotectedstring $_email
Email Adress
Details
Type
string
>VPropertyprotectedarray $_options = array('img_size' => 80, 'default_img' => self::DEFAULT_MM, 'rating' => self::RATING_G, 'secure' => null)
Options
Default valuearray('img_size' => 80, 'default_img' => self::DEFAULT_MM, 'rating' => self::RATING_G, 'secure' => null)Details
Type
array
>VPropertypublic\Zend_View_Interface $view = null
Default valuenullDetails
Type
\Zend_View_Interface
Inherited_from
\Zend_View_Helper_Abstract::$$view  
Inherited_from
\Zend_View_Helper_HtmlElement::$$view  

Methods

methodpublic__toString() : string

Return valid image tag

Returns
TypeDescription
string
methodprotected_getAvatarUrl() : string

Get avatar url (including size, rating and default image oprions)

Returns
TypeDescription
string
methodprotected_getGravatarUrl() : string

Get URL to gravatar's service.

Returns
TypeDescription
stringURL
methodprotected_htmlAttribs(array $attribs) : string
inherited

Converts an associative array to a string of tag attributes.

Inherited from: \Zend_View_Helper_HtmlElement::_htmlAttribs()
Parameters
NameTypeDescription
$attribsarray

From this array, each key-value pair is converted to an attribute name and value.

Returns
TypeDescription
stringThe XHTML for the attributes.
Details
Access
public  
methodprotected_isStrictDoctype() : boolean
inherited

Is doctype strict?

Inherited from: \Zend_View_Helper_HtmlElement::_isStrictDoctype()
Returns
TypeDescription
boolean
methodprotected_isXhtml() : boolean
inherited

Is doctype XHTML?

Inherited from: \Zend_View_Helper_HtmlElement::_isXhtml()
Returns
TypeDescription
boolean
methodprotected_normalizeId(string $value) : string
inherited

Normalize an ID

Inherited from: \Zend_View_Helper_HtmlElement::_normalizeId()
Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
string
methodprotected_setSrcAttribForImg() : void

Set src attrib for image.

You shouldn't set a own url value! It sets value, uses protected method _getAvatarUrl.

If already exsist overwritten.

methodpublicdirect() : void
inherited

Strategy pattern: currently unutilized

Inherited from: \Zend_View_Helper_Abstract::direct()\Zend_View_Helper_HtmlElement::direct()
methodpublicgetAttribs() : array

Get attribs of image

Warning! If you set src attrib, you get it, but this value will be overwritten in protected method _setSrcAttribForImg(). And finally your get other src value!

Returns
TypeDescription
array
methodpublicgetClosingBracket() : string
inherited

Get the tag closing bracket

Inherited from: \Zend_View_Helper_HtmlElement::getClosingBracket()
Returns
TypeDescription
string
methodpublicgetDefaultImg() : string

Get default img

Returns
TypeDescription
string
methodpublicgetEmail() : string

Get email adress

Returns
TypeDescription
string
methodpublicgetImgSize() : int

Get img size

Returns
TypeDescription
intThe img size
methodpublicgetImgTag() : string

Return valid image tag

Returns
TypeDescription
string
methodpublicgetRating() : string

Get rating value

Returns
TypeDescription
string
methodpublicgetSecure() : bool

Get an SSL or a No-SSL location

Returns
TypeDescription
bool
methodpublicgravatar(string | null $email = "", null | array $options = array(), array $attribs = array()) : \Zend_View_Helper_Gravatar

Returns an avatar from gravatar's service.

$options may include the following: - 'img_size' int height of img to return - 'default_img' string img to return if email adress has not found - 'rating' string rating parameter for avatar - 'secure' bool load from the SSL or Non-SSL location

Parameters
NameTypeDescription
$emailstring | null

Email adress.

$optionsnull | array

Options

$attribsarray

Attributes for image tag (title, alt etc.)

Returns
TypeDescription
\Zend_View_Helper_Gravatar
Details
See
\http://pl.gravatar.com/site/implement/url  
See
More information about gravatar's service.  
methodpublicsetAttribs(array $attribs) : \Zend_View_Helper_Gravatar

Set attribs for image tag

Warning! You shouldn't set src attrib for image tag. This attrib is overwritten in protected method _setSrcAttribForImg(). This method(_setSrcAttribForImg) is called in public method getImgTag().

Parameters
NameTypeDescription
$attribsarray
Returns
TypeDescription
\Zend_View_Helper_Gravatar
methodpublicsetDefaultImg(string $defaultImg) : \Zend_View_Helper_Gravatar

Set default img

Can be either an absolute URL to an image, or one of the DEFAULT_* constants

Parameters
NameTypeDescription
$defaultImgstring
Returns
TypeDescription
\Zend_View_Helper_Gravatar
Details
Link
More information about default image.  
methodpublicsetEmail(string $email) : \Zend_View_Helper_Gravatar

Set email adress

Parameters
NameTypeDescription
$emailstring
Returns
TypeDescription
\Zend_View_Helper_Gravatar
methodpublicsetImgSize(int $imgSize) : \Zend_View_Helper_Gravatar

Set img size in pixels

Parameters
NameTypeDescription
$imgSizeint

Size of img must be between 1 and 512

Returns
TypeDescription
\Zend_View_Helper_Gravatar
methodpublicsetOptions(array $options) : \Zend_View_Helper_Gravatar

Configure state

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
\Zend_View_Helper_Gravatar
methodpublicsetRating(string $rating) : void

Set rating value

Must be one of the RATING_* constants

Parameters
NameTypeDescription
$ratingstring

Value for rating. Allowed values are: g, px, r,x

Throws
ExceptionDescription
\Zend_View_Exception
Details
Link
More information about rating.  
methodpublicsetSecure(bool $flag) : \Zend_View_Helper_Gravatar

Load from an SSL or No-SSL location?

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_View_Helper_Gravatar
methodpublicsetView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract
Parameters
NameTypeDescription
$view\Zend_View_Interface
Returns
TypeDescription
\Zend_View_Helper_Abstract
Documentation was generated by phpDocumentor 2.0.0a12.