]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
code done on debugging in bookmarks
authorEvan Prodromou <evan@status.net>
Sat, 18 Dec 2010 22:21:40 +0000 (17:21 -0500)
committerEvan Prodromou <evan@status.net>
Sat, 18 Dec 2010 22:21:40 +0000 (17:21 -0500)
plugins/Bookmark/BookmarkPlugin.php
plugins/Bookmark/newbookmark.php

index 2137d0c22541fea405d1de95d4b83b11ba9dd53d..e50e45cadeeb3befbd18c7189aa35c8a6f5f7d61 100644 (file)
@@ -87,6 +87,12 @@ class BookmarkPlugin extends Plugin
                return true;
        }
 
+       function onEndShowStyles($action)
+       {
+               $action->style('.bookmark_tags li { display: inline; }');
+               return true;
+       }
+
        /**
         * Load related modules when needed
         *
@@ -132,6 +138,52 @@ class BookmarkPlugin extends Plugin
                return true;
        }
 
+       function onStartShowNoticeItem($nli)
+       {
+               $nb = Notice_bookmark::staticGet('notice_id',
+                                                                                $nli->notice->id);
+
+               if (!empty($nb)) {
+                       $att = $nli->notice->attachments();
+                       $nli->out->elementStart('h3');
+                       $nli->out->element('a',
+                                                          array('href' => $att[0]->url),
+                                                          $nb->title);
+                       $nli->out->elementEnd('h3');
+                       $nli->out->element('p',
+                                                          array('class' => 'bookmark_description'),
+                                                          $nb->description);
+                       $nli->out->elementStart('p');
+                       $nli->out->element('a', array('href' => $nli->profile->profileurl,
+                                                                                 'class' => 'bookmark_author',
+                                                                                 'title' => $nli->profile->getBestName()),
+                                                          $nli->profile->getBestName());
+                       $nli->out->elementEnd('p');
+                       $tags = $nli->notice->getTags();
+                       $nli->out->elementStart('ul', array('class' => 'bookmark_tags'));
+                       foreach ($tags as $tag) {
+                               if (common_config('singleuser', 'enabled')) {
+                                       // regular TagAction isn't set up in 1user mode
+                                       $nickname = User::singleUserNickname();
+                                       $url = common_local_url('showstream',
+                                                                                       array('nickname' => $nickname,
+                                                                                                 'tag' => $tag));
+                               } else {
+                                       $url = common_local_url('tag', array('tag' => $tag));
+                               }
+                               $nli->out->elementStart('li');
+                               $nli->out->element('a', array('rel' => 'tag',
+                                                                                         'href' => $url),
+                                                                  $tag);
+                               $nli->out->elementEnd('li');
+                               $nli->out->text(' ');
+                       }
+                       $nli->out->elementEnd('ul');
+                       return false;
+               }
+               return true;
+       }
+
        function onPluginVersion(&$versions)
        {
                $versions[] = array('name' => 'Sample',
index 7352b1b952789695364da5ec88b7452bf8db5f68..466785de8d2642151df38fd881aef7d01492fbcf 100644 (file)
@@ -128,15 +128,25 @@ class NewbookmarkAction extends Action
                                throw new ClientException(_('Bookmark must have an URL.'));
                        }
 
-                       // XXX: filter "for:nickname" tags
+                       $rawtags = preg_split('/[\s,]+/', $this->_tags);
 
-            $tags = array_map('common_canonical_tag',
-                              preg_split('/[\s,]+/', $this->_tags));
+                       $tags = array();
+
+                       // filter "for:nickname" tags
+
+                       foreach ($rawtags as $tag) {
+                               if (0 == mb_stricmp($tag, 'for:', 4)) {
+                                       
+                               } else {
+                                       $tags[] = common_canonical_tag($tag);
+                               }
+                       }
 
                        $hashtags = array();
                        $taglinks = array();
 
                        foreach ($tags as $tag) {
+                               
                                $hashtags[] = '#'.$tag;
                                if (common_config('singleuser', 'enabled')) {
                                        // regular TagAction isn't set up in 1user mode