application/modules/g/views/helpers/Social.php
public function tweetButton(array $params = array()) {
        $params = new Garp_Util_Configuration($params);
        $params->setDefault('url', null)
            ->setDefault('text', null)
            ->setDefault('via', null)
            ->setDefault('related', null)
            ->setDefault('lang', null)
            ->setDefault('count', 'horizontal')
            ->setDefault('loadScript', true);

        // set required parameters
        $attributes = array(
            'class'      => 'twitter-share-button',
            'data-count' => $params['count']
        );

        // set optional attributes
        $params['url'] && $attributes['data-url'] = $params['url'];
        $params['text'] && $attributes['data-text'] = $params['text'];
        $params['via'] && $attributes['data-via'] = $params['via'];
        $params['related'] && $attributes['data-related'] = $params['related'];
        $params['lang'] && $attributes['data-lang'] = $params['lang'];

        $html = $this->view->htmlLink(
            'http://twitter.com/share',
            'Tweet',
            $attributes
        );

        if ($params['loadScript']) {
            // Add the Twitter Javascript to the stack
            // Must be rendered in the view using "$this->script()->render()"
            $this->view->script()->src('http://platform.twitter.com/widgets.js');
        }
        return $html;
    }
public function tweetButton(array $params = array()) {
        $params = new Garp_Util_Configuration($params);
        $params->setDefault('url', null)
            ->setDefault('text', null)
            ->setDefault('via', null)
            ->setDefault('related', null)
            ->setDefault('lang', null)
            ->setDefault('count', 'horizontal')
            ->setDefault('loadScript', true);

        // set required parameters
        $attributes = array(
            'class'      => 'twitter-share-button',
            'data-count' => $params['count']
        );

        // set optional attributes
        $params['url'] && $attributes['data-url'] = $params['url'];
        $params['text'] && $attributes['data-text'] = $params['text'];
        $params['via'] && $attributes['data-via'] = $params['via'];
        $params['related'] && $attributes['data-related'] = $params['related'];
        $params['lang'] && $attributes['data-lang'] = $params['lang'];

        $html = $this->view->htmlLink(
            'http://twitter.com/share',
            'Tweet',
            $attributes
        );

        if ($params['loadScript']) {
            // Add the Twitter Javascript to the stack
            // Must be rendered in the view using "$this->script()->render()"
            $this->view->script()->src('http://platform.twitter.com/widgets.js');
        }
        return $html;
    }
public function tweetButton ( array $ params = array ( ) ) { $ params = new Garp_Util_Configuration ( $ params ) ; $ params -> setDefault ( 'url' , null ) -> setDefault ( 'text' , null ) -> setDefault ( 'via' , null ) -> setDefault ( 'related' , null ) -> setDefault ( 'lang' , null ) -> setDefault ( 'count' , 'horizontal' ) -> setDefault ( 'loadScript' , true ) ; // set required parameters $ attributes = array ( 'class' => 'twitter-share-button' , 'data-count' => $ params [ 'count' ] ) ; // set optional attributes $ params [ 'url' ] && $ attributes [ 'data-url' ] = $ params [ 'url' ] ; $ params [ 'text' ] && $ attributes [ 'data-text' ] = $ params [ 'text' ] ; $ params [ 'via' ] && $ attributes [ 'data-via' ] = $ params [ 'via' ] ; $ params [ 'related' ] && $ attributes [ 'data-related' ] = $ params [ 'related' ] ; $ params [ 'lang' ] && $ attributes [ 'data-lang' ] = $ params [ 'lang' ] ; $ html = $ this -> view -> htmlLink ( 'http://twitter.com/share' , 'Tweet' , $ attributes ) ; if ( $ params [ 'loadScript' ] ) { // Add the Twitter Javascript to the stack // Must be rendered in the view using "$this->script()->render()" $ this -> view -> script ( ) -> src ( 'http://platform.twitter.com/widgets.js' ) ; } return $ html ; }
Create a Tweet button.

@param array $params
@return string
@see http://twitter.com/about/resources/tweetbutton
Create a Tweet button .