]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Add some more events to aside profile blocks and rework a bit
authorZach Copley <zach@status.net>
Fri, 8 Apr 2011 22:45:49 +0000 (15:45 -0700)
committerZach Copley <zach@status.net>
Fri, 8 Apr 2011 22:45:49 +0000 (15:45 -0700)
EVENTS.txt
lib/accountprofileblock.php
lib/groupprofileblock.php
lib/profileblock.php
plugins/ExtendedProfile/ExtendedProfilePlugin.php

index b328785e7b07aac9ad884b925336e543f1645e8d..08a4273ec907537471284d66f2080d3c09860220 100644 (file)
@@ -1147,3 +1147,19 @@ StartDefaultLocalNav: When showing the default local nav
 EndDefaultLocalNav: When showing the default local nav
 - $menu: the menu
 - $user: current user
+
+StartShowAccountProfileBlock: When showing the profile block for an account
+- $out: XMLOutputter to append custom output
+- $profile: the profile being shown
+
+EndShowAccountProfileBlock: After showing the profile block for an account
+- $out: XMLOutputter to append custom output
+- $profile: the profile being shown
+
+StartShowGroupProfileBlock: When showing the profile block for a group
+- $out: XMLOutputter to append custom output
+- $profile: the profile being shown
+
+EndShowGroupProfileBlock: After showing showing the profile block for a group
+- $out: XMLOutputter to append custom output
+- $group: the group being shown
\ No newline at end of file
index 1c3a8dc536267e757552fae89d6b9eb14d795937..e3e657fb1711f784059c27a9455fc036e0852b0b 100644 (file)
@@ -289,4 +289,15 @@ class AccountProfileBlock extends ProfileBlock
                        // TRANS: Link text for link that will subscribe to a remote profile.
                        _m('BUTTON','Subscribe'));
     }
+
+    function show()
+    {
+        common_debug("show");
+        $this->out->elementStart('div', 'account_profile_block section');
+        if (Event::handle('StartShowAccountProfileBlock', array($this->out, $this->profile))) {
+            parent::show();
+            Event::handle('EndShowAccountProfileBlock', array($this->out, $this->profile));
+        }
+        $this->out->elementEnd('div');
+    }
 }
index 819c0fbdcc57ad29f04cd61cb3c05a89d0671daf..30e9a235a291b320beef06edc7d34526e4628acc 100644 (file)
@@ -123,4 +123,14 @@ class GroupProfileBlock extends ProfileBlock
         $this->out->elementEnd('ul');
         $this->out->elementEnd('div');
     }
+
+    function show()
+    {
+        $this->out->elementStart('div', 'group_profile_block section');
+        if (Event::handle('StartShowGroupProfileBlock', array($this->out, $this->group))) {
+            parent::show();
+            Event::handle('EndShowGroupProfileBlock', array($this->out, $this->group));
+        }
+        $this->out->elementEnd('div');
+    }
 }
index 19e5a386ba5b71a3cac60222811804069dc1c603..bf1ffd1443d827ee4053a702784998241760c696 100644 (file)
@@ -56,16 +56,32 @@ abstract class ProfileBlock extends Widget
 
     function show()
     {
-        $this->out->elementStart('div', 'profile_block section');
+        $this->showActions();
+        $this->showAvatar();
+        $this->showName();
+        $this->showLocation();
+        $this->showHomepage();
+        $this->showDescription();
+    }
 
+    function showAvatar()
+    {
         $size = $this->avatarSize();
 
-        $this->out->element('img', array('src' => $this->avatar(),
-                                         'class' => 'profile_block_avatar',
-                                         'alt' => $this->name(),
-                                         'width' => $size,
-                                         'height' => $size));
+        $this->out->element(
+            'img',
+            array(
+                'src'  => $this->avatar(),
+                'class'  => 'ur_face',
+                'alt'    => $this->name(),
+                'width'  => $size,
+                'height' => $size
+            )
+        );
+    }
 
+    function showName()
+    {
         $name = $this->name();
 
         if (!empty($name)) {
@@ -79,30 +95,35 @@ abstract class ProfileBlock extends Widget
             }
             $this->out->elementEnd('p');
         }
+    }
+
+    function showDescription()
+    {
+        $description = $this->description();
+
+        if (!empty($description)) {
+            $this->out->element(
+                'p',
+                'profile_block_description',
+                $description
+            );
+        }
+    }
 
+    function showLocation()
+    {
         $location = $this->location();
 
         if (!empty($location)) {
             $this->out->element('p', 'profile_block_location', $location);
         }
+    }
 
-        $homepage = $this->homepage();
-
+    function showHomepage()
+    {
         if (!empty($homepage)) {
             $this->out->element('a', 'profile_block_homepage', $homepage);
         }
-
-        $description = $this->description();
-
-        if (!empty($description)) {
-            $this->out->element('p',
-                                'profile_block_description',
-                                $description);
-        }
-
-        $this->showActions();
-
-        $this->out->elementEnd('div');
     }
 
     function avatarSize()
index 51584e9f912e70e960ea7646a142f1e3430eaa90..7b2e53c62ad23009dc5a07224a3b882723edd425 100644 (file)
@@ -115,13 +115,12 @@ class ExtendedProfilePlugin extends Plugin
         return true;
     }
 
-    function onStartProfilePageActionsSection(HTMLOutputter $out, Profile $profile) {
+    function onEndShowAccountProfileBlock(HTMLOutputter $out, Profile $profile) {
         $user = User::staticGet('id', $profile->id);
         if ($user) {
             $url = common_local_url('profiledetail', array('nickname' => $user->nickname));
             // TRANS: Link text on user profile page leading to extended profile page.
             $out->element('a', array('href' => $url, 'class' => 'profiledetail'), _m('More details...'));
         }
-        return true;
     }
 }