示例#1
0
 protected function showRSVP(Notice $stored, HTMLOutputter $out, Profile $scoped = null)
 {
     $rsvp = RSVP::fromNotice($stored);
     if (empty($rsvp)) {
         // TRANS: Content for a deleted RSVP list item (RSVP stands for "please respond").
         $out->element('p', null, _m('Deleted.'));
         return;
     }
     $out->elementStart('div', 'rsvp');
     $out->raw($rsvp->asHTML());
     $out->elementEnd('div');
 }
示例#2
0
 public function onStartShowAttachmentRepresentation(HTMLOutputter $out, File $file)
 {
     $oembed = File_oembed::getKV('file_id', $file->id);
     if (empty($oembed->type)) {
         return true;
     }
     switch ($oembed->type) {
         case 'rich':
         case 'video':
         case 'link':
             if (!empty($oembed->html) && (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {
                 require_once INSTALLDIR . '/extlib/htmLawed/htmLawed.php';
                 $config = array('safe' => 1, 'elements' => '*+object+embed');
                 $out->raw(htmLawed($oembed->html, $config));
             }
             break;
         case 'photo':
             $out->element('img', array('src' => $oembed->url, 'width' => $oembed->width, 'height' => $oembed->height, 'alt' => 'alt'));
             break;
         default:
             Event::handle('ShowUnsupportedAttachmentRepresentation', array($out, $file));
     }
 }
 /**
  * Layout stuff
  */
 protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped = null)
 {
     $out->raw($stored->getRendered());
 }
示例#4
0
 public function onShowUnsupportedAttachmentRepresentation(HTMLOutputter $out, File $file)
 {
     try {
         $oembed = File_oembed::getByFile($file);
     } catch (NoResultException $e) {
         return true;
     }
     // the 'photo' type is shown through ordinary means, using StartShowAttachmentRepresentation!
     switch ($oembed->type) {
         case 'rich':
         case 'video':
         case 'link':
             if (!empty($oembed->html) && (GNUsocial::isAjax() || common_config('attachments', 'show_html'))) {
                 require_once INSTALLDIR . '/extlib/htmLawed/htmLawed.php';
                 $config = array('safe' => 1, 'elements' => '*+object+embed');
                 $out->raw(htmLawed($oembed->html, $config));
             }
             return false;
             break;
     }
     return true;
 }