/**
     *
     * @param HttpResource $asset 
     */
    public function render($asset)
    {
        if (! $asset->is_image())
        {
            return false;
        }
        
        global $THEME;
        $url = $asset->url();
        $title = $asset->title();
        $title = $title ? $title : $asset->name();
        
        $size = (int) $asset->config('size');
        $size = (24 <= $size && $size <= 800) ? $size : 300;
        
        $embed = <<<EOT
        <div style="text-align:center"><a href="$url"><img src="{$url}" width="$size" alt="{$title}" title="{$title}"></a></div>
EOT;

        $result = array();
        $result[self::URL] = $url;
        $result[self::EMBED_SNIPPET] = $embed;
        $result[self::TITLE] = $title;
        $result[self::THUMBNAIL] = $url;
        return $result;
    }
    /**
     *
     * @param HttpResource $asset 
     */
    public function accept($asset)
    {
        $url = $asset->url();
        $url = str_replace('http://', '', $url);
        $url = str_replace('https://', '', $url);

        $domain = reset(split('/', $url));
        return strpos($domain, 'google.com/calendar') !== false;
    }
    /**
     *
     * @param HttpResource $asset 
     */
    public function accept($asset)
    {
        $url = $asset->url();
        $url = str_replace('http://', '', $url);
        $url = str_replace('https://', '', $url);

        $domain = reset(explode('/', $url));
        return strpos($domain, 'maps.google') !== false;
    }
    /**
     *
     * @param HttpResource $asset 
     */
    public function render($asset)
    {
        global $THEME;
        $url = $asset->url();
        $title = $asset->title();
        $title = $title ? $title : $asset->name();
        $description = $asset->get_meta('description');
        $description = $description;

        $keywords = $asset->get_meta('keywords');

        $image_src = $asset->get_link('rel', 'image_src');
        $image_src = $image_src ? $image_src['href'] : false;

        if (empty($image_src))
        {
            $image_src = $this->get_icon($asset);
        }

        $icon = $this->get_icon($asset);
        
        $image_src = $asset->canonic_url($image_src);
        $icon = $asset->canonic_url($icon);

        $embed = <<<EOT
        <a href="$url">
            <img src="{$image_src}" alt="{$title}" title="{$title}" style="float:left; margin-right:5px; margin-bottom:5px; " >
        </a>
        $description
        <span style="clear:both;"></span>
EOT;


        $result = array();
        $result[self::EMBED_SNIPPET] = $embed;
        $result[self::TITLE] = $title;
        $result[self::THUMBNAIL] = $image_src;
        $result[self::DESCRIPTION] = $description;
        $result[self::ICON] = $icon;
        $result[self::TAGS] = $keywords;
        return $result;
    }
    /**
     *
     * @param HttpResource $asset 
     */
    public function render($asset)
    {
        $url = $asset->url();
        $group_id = self::get_group_id($url);
        if (empty($group_id))
        {
            return false;
        }

        $data = get_record('group', 'id', $group_id);

        $result = array();
        safe_require('blocktype', 'ple/group');
        $result[self::EMBED_SNIPPET] = PluginBlocktypeGroup::render_preview($group_id);
        $result[self::THUMBNAIL] = PluginBlocktypeGroup::get_thumbnail($group_id);
        $result[self::TITLE] = $data->name;
        $result[self::DESCRIPTION] = $data->description;

        return $result;
    }
    /**
     *
     * @param HttpResource $asset 
     */
    public function render($asset)
    {
        $url = $asset->url();
        $id = self::get_user_id($url);
        if (empty($id))
        {
            return false;
        }

        $data = get_record('usr', 'id', $id);

        $result = array();
        safe_require('blocktype', 'ple/person');
        $result[self::EMBED_SNIPPET] = PluginBlocktypePerson::render_preview($id);
        $result[self::THUMBNAIL] = PluginBlocktypePerson::get_thumbnail($id);
        $result[self::TITLE] = $data->prefferedname ? $data->prefferedname : $data->firstname . ' ' . $data->lastname;
        $result[self::DESCRIPTION] = isset($data->description) ? $data->description : '';

        return $result;
    }
    /**
     *
     * @param HttpResource $asset 
     */
    public function render($asset)
    {
        
        if ($asset->url_match('gmodules.com/ig/') && $asset->url_param('url') != false)
        {
            $url = $asset->url();
            $title = $asset->url_param('title');
            $title = ($title == '__MSG_title__') ? '' : $title;
            
            $embed = <<<EOT
                <script src="$url"></script>
EOT;
            
            $result = array();
            $result[self::EMBED_SNIPPET] = $embed;
            $result[self::TITLE] = $title;
            return $result;
        }

        if (!$asset->is_gadget())
        {
            $url = $asset->url();

            if (!$asset->url_match('google.com/ig/directory'))
            {
                return false;
            }
            if (!$asset->url_match('type=gadgets'))
            {
                return false;
            }

            $url = $asset->url_param('url');
            if (empty($url))
            {
                return false;
            }
            $asset = new HttpResource($url);
            if (!$asset->is_gadget())
            {
                return false;
            }
        }

        $url = $asset->url();
        if (strpos($url, 'http') !== 0)
        {
            $url = "http://$url";
        }
        $url = urlencode($url);
        $title = $asset->title();
        $title = $title ? $title : $asset->name();
        
        $size = (int) $asset->config('size');
        $size = (24 <= $size && $size <= 800) ? $size : 300;

        $embed = <<<EOT
        <script src="//www.gmodules.com/ig/ifr?url=$url&amp;w=$size&amp;output=js"></script>
EOT;

        $result = array();
        $result[self::EMBED_SNIPPET] = $embed;
        $result[self::TITLE] = $title;
        return $result;
    }
 /**
  *
  * @param HttpResource $asset 
  */
 public function accept($asset)
 {       
     $url = $asset->url();
     
     return strpos($url, 'docs.google.com/document/pub') !== false;
 }
    /**
     *
     * @param HttpResource $asset 
     */
    public function render($asset)
    {
        if (!$asset->is_rss())
        {
            return;
        }

        $url = $asset->url();
        $title = $asset->title();
        $id = 'a' . md5($url);

        $embed = <<<EOT
        <style type="text/css">
            .gfg-root {
                border: none;
                font-family: inherit;
            }
        </style>
        <script type="text/javascript" src="http://www.google.com/jsapi"></script>
        <script src="http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js" type="text/javascript"></script> 
        <script type="text/javascript">
        
            function init()
            {
                if (typeof this.has_run == 'undefined' )
                {
                    this.has_run = true;
                }
                else
                {
                    return;
                }
                var head = document.getElementsByTagName('head')[0];
        
                var element = document.createElement('link');
                element.type = 'text/css';
                element.rel = 'stylesheet';
                element.href = 'http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css';
                head.appendChild(element);
            }

            function load_$id() {
                var feeds = [
                    {
                    title: ' ',
                    url: '$url'
                    }
                ];

                var options = {
                    stacked : false,
                    horizontal : false,
                    title : '',
                    numResults : 10
                };

                new GFdynamicFeedControl(feeds, '$id', options);
                document.getElementById('content').style.width = "500px";
            }
        
        
            init();
            google.load('feeds', '1');
            google.setOnLoadCallback(load_$id);
       </script>        
       <div id="$id" style="min-height:271px;">Loading...</div>
EOT;


        $result = array();
        $result[self::EMBED_SNIPPET] = $embed;
        $result[self::TITLE] = $title;
        return $result;
    }