]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/peopletag.php
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / peopletag.php
index 6b1e34f1ab47db2b1c2aa4d2f273171233ed23a2..7287cfbf995aa0bf08d29df44cde7627ff59f87b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Action for showing profiles self-tagged with a given tag
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Action
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @author    Zach Copley <zach@controlyourself.ca>
- * @copyright 2009 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Zach Copley <zach@status.net>
+ * @copyright 2009 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
-require_once INSTALLDIR.'/lib/profilelist.php';
-
 /**
  * This class outputs a paginated list of profiles self-tagged with a given tag
  *
  * @category Output
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
- * @author   Zach Copley <zach@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Zach Copley <zach@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  *
  * @see      Action
  */
@@ -67,7 +65,7 @@ class PeopletagAction extends Action
         $this->tag = $this->trimmed('tag');
 
         if (!common_valid_profile_tag($this->tag)) {
-            $this->clientError(sprintf(_('Not a valid people tag: %s'),
+            $this->clientError(sprintf(_('Not a valid people tag: %s.'),
                 $this->tag));
             return;
         }
@@ -119,13 +117,13 @@ class PeopletagAction extends Action
                 'FROM profile JOIN profile_tag ' .
                 'ON profile.id = profile_tag.tagger ' .
                 'WHERE profile_tag.tagger = profile_tag.tagged ' .
-                'AND tag = "%s" ' .
+                "AND tag = '%s' " .
                 'ORDER BY profile_tag.modified DESC%s';
 
         $profile->query(sprintf($qry, $this->tag, $lim));
 
-        $pl  = new ProfileList($profile, null, $this);
-        $cnt = $pl->show();
+        $ptl = new PeopleTagList($profile, $this); // pass the ammunition
+        $cnt = $ptl->show();
 
         $this->pagination($this->page > 1,
                           $cnt > PROFILES_PER_PAGE,
@@ -141,8 +139,42 @@ class PeopletagAction extends Action
      */
     function title()
     {
-        return sprintf(_('Users self-tagged with %s - page %d'),
+        return sprintf(_('Users self-tagged with %1$s - page %2$d'),
             $this->tag, $this->page);
     }
 
 }
+
+class PeopleTagList extends ProfileList
+{
+    function newListItem($profile)
+    {
+        return new PeopleTagListItem($profile, $this->action);
+    }
+}
+
+class PeopleTagListItem extends ProfileListItem
+{
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'peopletag')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+
+        return $aAttrs;
+    }
+
+    function homepageAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'peopletag')) {
+            $aAttrs['rel'] = 'nofollow';
+        }
+
+        return $aAttrs;
+    }
+}
+