Exemplo n.º 1
0
 public function avatar($size = 50, $default = null)
 {
     if (!$default) {
         $default = "http://" . $_SERVER['HTTP_HOST'] . "/zest/images/icon_user.gif";
     }
     return gravatar::render($this->email, $size, $default, $this->username . '\'s avatar');
 }
Exemplo n.º 2
0
 public function render($options = null)
 {
     if (!$options) {
         $config = Kohana::config_load('zest');
         $options = $config['comment'];
     }
     $array = array("date_format" => 'D jS M Y', "image" => array(50, 50), "html" => '{AVATAR}{DATE} by {AUTHOR}<br/><p>{TEXT}</p><a href="{DELETE_LINK}" title="delete comment"></a><div class="spacer">&nbsp;</div>', "default_image" => 'http://' . $_SERVER['HTTP_HOST'] . '/zest/images/user_icon.gif', "template" => '');
     $array = arr::overwrite($array, $options);
     if (isset($array['template']) && $array['template'] != "") {
         $html = zest::template_to_html('snippets/' . $array['template']);
     } else {
         $html = $array['html'];
     }
     $html = str_replace('{DATE}', date($array['date_format'], strtotime($this->date)), $html);
     $html = str_replace('{AVATAR}', gravatar::render($this->email, $array['image'][0], $array['default_image']), $html);
     if ($this->fl_deleted == 1) {
         $html = str_replace('{TEXT}', '<i>This comment has been deleted.</i>', $html);
     } else {
         $html = str_replace('{TEXT}', $this->title, $html);
     }
     $html = str_replace('{AUTHOR}', $this->display_name, $html);
     if ($this->can_modify()) {
         $html = str_replace('{DELETE_LINK}', $this->delete_url(), $html);
     }
     return $html;
 }