function onStartShowSections(Action $action)
 {
     $name = $action->trimmed('action');
     if ($name == 'tag') {
         $taginput = $action->trimmed('tag');
         $tag = common_canonical_tag($taginput);
         if (!empty($tag)) {
             $url = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=render', urlencode($tag));
             $editurl = sprintf('http://hashtags.wikia.com/index.php?title=%s&action=edit', urlencode($tag));
             $request = HTTPClient::start();
             $response = $request->get($url);
             $html = $response->getBody();
             $action->elementStart('div', array('id' => 'wikihashtags', 'class' => 'section'));
             if ($response->isOk() && !empty($html)) {
                 $action->element('style', null, "span.editsection { display: none }\n" . "table.toc { display: none }");
                 $action->raw($html);
                 $action->elementStart('p');
                 $action->element('a', array('href' => $editurl, 'title' => sprintf(_m('Edit the article for #%s on WikiHashtags'), $tag)), _m('Edit'));
                 $action->element('a', array('href' => 'http://www.gnu.org/copyleft/fdl.html', 'title' => _m('Shared under the terms of the GNU Free Documentation License'), 'rel' => 'license'), _m('GNU FDL'));
                 $action->elementEnd('p');
             } else {
                 $action->element('a', array('href' => $editurl), sprintf(_m('Start the article for #%s on WikiHashtags'), $tag));
             }
             $action->elementEnd('div');
         }
     }
     return true;
 }
    /**
     * Add the conrnify button
     *
     * @param Action $action the current action
     *
     * @return void
     */
    function onEndShowSections(Action $action)
    {
        $action->elementStart('div', array('id' => 'cornify_section', 'class' => 'section'));
        $action->raw(<<<EOT
                <a href="http://www.cornify.com" onclick="cornify_add();return false;">
                <img src="http://www.cornify.com/assets/cornify.gif" width="61" height="16" border="0" alt="Cornify" />
                </a>
        <script type="text/javascript">(function() {
        var js = document.createElement('script');
        js.type = 'text/javascript';
        js.async = true;
        js.src = 'http://www.cornify.com/js/cornify.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(js);
})();</script>
EOT
);
        $action->elementEnd('div');
    }
 public function onEndEmailFormData(Action $action, Profile $scoped)
 {
     $emailfave = $scoped->getConfigPref('email', 'notify_fave') ? 1 : 0;
     $action->elementStart('li');
     $action->checkbox('email-notify_fave', _('Send me email when someone adds my notice as a favorite.'), $emailfave);
     $action->elementEnd('li');
     return true;
 }
 function onEndShowSections(Action $action)
 {
     $actionName = $action->trimmed('action');
     // These are the ones that have maps on 'em
     if (!in_array($actionName, array('showstream', 'all'))) {
         return true;
     }
     $action->elementStart('div', array('id' => 'entity_map', 'class' => 'section'));
     // TRANS: Header for Map widget that displays a map with geodata for notices.
     $action->element('h2', null, _m('Map'));
     $action->element('div', array('id' => 'map_canvas', 'class' => 'gray smallmap', 'style' => "width: 100%; height: 240px"));
     $mapAct = $actionName == 'showstream' ? 'usermap' : 'allmap';
     $mapUrl = common_local_url($mapAct, array('nickname' => $action->trimmed('nickname')));
     $action->element('a', array('href' => $mapUrl), _m('Full size'));
     $action->elementEnd('div');
 }
Exemple #5
0
 /**
  * Add a wide skyscraper after the aside
  *
  * @param Action $action Action being shown
  *
  * @return boolean hook flag
  */
 function onEndShowAside($action)
 {
     if (!is_null($this->wideSkyscraper)) {
         $action->elementStart('div', array('id' => 'ad_wide-skyscraper', 'class' => 'ad'));
         $this->showWideSkyscraper($action);
         $action->elementEnd('div');
     }
     return true;
 }
 /**
  * Show a checkbox on the profile form to ask whether to follow everyone
  *
  * @param Action $action The action being executed
  *
  * @return boolean hook value
  */
 function onEndProfileFormData($action)
 {
     $user = common_current_user();
     $action->elementStart('li');
     // TRANS: Checkbox label in form for profile settings.
     $action->checkbox('followeveryone', _('Follow everyone'), $action->arg('followeveryone') ? $action->arg('followeveryone') : User_followeveryone_prefs::followEveryone($user->id));
     $action->elementEnd('li');
     return true;
 }
Exemple #7
0
 /**
  * Actually output a flag button. If the target profile has already been
  * flagged by the current user, a null-action faux button is shown.
  *
  * @param Action $action
  * @param Profile $profile
  * @param array $returnToArgs
  */
 protected function showFlagButton($action, $profile, $returnToArgs)
 {
     $user = common_current_user();
     if (!empty($user) && $user->id != $profile->id) {
         $action->elementStart('li', 'entity_flag');
         if (User_flag_profile::exists($profile->id, $user->id)) {
             // @todo FIXME: Add a title explaining what 'flagged' means?
             // TRANS: Message added to a profile if it has been flagged for review.
             $action->element('p', 'flagged', _m('Flagged'));
         } else {
             $form = new FlagProfileForm($action, $profile, $returnToArgs);
             $form->show();
         }
         $action->elementEnd('li');
     }
 }
 /**
  * Show some extra instructions for using Yubikey
  *
  * @param Action $action Action being executed
  *
  * @return boolean hook value
  */
 function onEndLoginFormData($action)
 {
     $action->elementStart('li');
     $action->password('otp', _('Yubikey OTP'));
     $action->elementEnd('li');
 }
 function onEndShowSections(Action $action)
 {
     if ($action->arg('action') != 'showstream') {
         return true;
     }
     $cur = common_current_user();
     if (empty($cur) || !$cur->hasRight(self::VIEWMODLOG)) {
         return true;
     }
     $profile = $action->profile;
     $ml = new ModLog();
     $ml->profile_id = $profile->id;
     $ml->orderBy("created");
     $cnt = $ml->find();
     if ($cnt > 0) {
         $action->elementStart('div', array('id' => 'entity_mod_log', 'class' => 'section'));
         $action->element('h2', null, _('Moderation'));
         $action->elementStart('table');
         while ($ml->fetch()) {
             $action->elementStart('tr');
             $action->element('td', null, strftime('%y-%m-%d', strtotime($ml->created)));
             $action->element('td', null, sprintf($ml->is_grant ? _('+%s') : _('-%s'), $ml->role));
             $action->elementStart('td');
             if ($ml->moderator_id) {
                 $mod = Profile::getKV('id', $ml->moderator_id);
                 if (empty($mod)) {
                     $action->text(_('[unknown]'));
                 } else {
                     $action->element('a', array('href' => $mod->profileurl, 'title' => $mod->fullname), $mod->nickname);
                 }
             } else {
                 $action->text(_('[unknown]'));
             }
             $action->elementEnd('td');
             $action->elementEnd('tr');
         }
         $action->elementEnd('table');
         $action->elementEnd('div');
     }
 }
 /**
  * Add a checkbox to turn off email summaries
  * 
  * @param Action $action Action being executed (emailsettings)
  * 
  * @return boolean hook value
  */
 function onEndEmailFormData($action)
 {
     $user = common_current_user();
     $action->elementStart('li');
     $action->checkbox('emailsummary', _('Send me a periodic summary of updates from my network.'), Email_summary_status::getSendSummary($user->id));
     $action->elementEnd('li');
     return true;
 }
 /**
  * Show a link to our delicious import page on profile settings form
  *
  * @param Action $action Profile settings action being shown
  *
  * @return boolean hook value
  */
 function onEndProfileSettingsActions($action)
 {
     $user = common_current_user();
     if (!empty($user) && $user->hasRight(self::IMPORTDELICIOUS)) {
         $action->elementStart('li');
         $action->element('a', array('href' => common_local_url('importdelicious')), _m('Import del.icio.us bookmarks'));
         $action->elementEnd('li');
     }
     return true;
 }
Exemple #12
0
 /**
  * Add in a Facebook Connect avatar to the primary nav menu
  *
  * @param Action $action the current action
  *
  * @return void
  *
  */
 function onStartPrimaryNav($action)
 {
     if (self::hasKeys()) {
         $user = common_current_user();
         if (!empty($user)) {
             $fbuid = $this->loggedIn();
             if (!empty($fbuid)) {
                 /* Default FB silhouette pic for FB users who haven't
                    uploaded a profile pic yet. */
                 $silhouetteUrl = 'http://static.ak.fbcdn.net/pics/q_silhouette.gif';
                 $url = $this->getProfilePicURL($fbuid);
                 $action->elementStart('li', array('id' => 'nav_fb'));
                 $action->element('img', array('id' => 'fbc_profile-pic', 'src' => !empty($url) ? $url : $silhouetteUrl, 'alt' => 'Facebook Connect User', 'width' => '16'), '');
                 $iconurl = common_path('plugins/Facebook/fbfavicon.ico');
                 $action->element('img', array('id' => 'fb_favicon', 'src' => $iconurl));
                 $action->elementEnd('li');
             }
         }
     }
     return true;
 }
 /**
  * To add a "Message" button to the group profile page
  *
  * @param Action     $action The showgroup action being shown
  * @param User_group $group  The current group
  * 
  * @return boolean hook value
  */
 function onEndGroupActionsList($action, $group)
 {
     $cur = common_current_user();
     if (empty($cur)) {
         return true;
     }
     try {
         Group_privacy_settings::ensurePost($cur, $group);
     } catch (Exception $e) {
         return true;
     }
     $action->elementStart('li', 'entity_send-a-message');
     $action->element('a', array('href' => common_local_url('newgroupmessage', array('nickname' => $group->nickname)), 'title' => _('Send a direct message to this group')), _('Message'));
     // $form = new GroupMessageForm($action, $group);
     // $form->hidden = true;
     // $form->show();
     $action->elementEnd('li');
     return true;
 }
 function onEndShowSections(Action $action)
 {
     if (!$action instanceof ShowstreamAction) {
         // early return for actions we're not interested in
         return true;
     }
     $scoped = $action->getScoped();
     if (!$scoped instanceof Profile || !$scoped->hasRight(self::VIEWMODLOG)) {
         // only continue if we are allowed to VIEWMODLOG
         return true;
     }
     $profile = $action->getTarget();
     $ml = new ModLog();
     $ml->profile_id = $profile->getID();
     $ml->orderBy("created");
     $cnt = $ml->find();
     if ($cnt > 0) {
         $action->elementStart('div', array('id' => 'entity_mod_log', 'class' => 'section'));
         $action->element('h2', null, _('Moderation'));
         $action->elementStart('table');
         while ($ml->fetch()) {
             $action->elementStart('tr');
             $action->element('td', null, strftime('%y-%m-%d', strtotime($ml->created)));
             $action->element('td', null, sprintf($ml->is_grant ? _('+%s') : _('-%s'), $ml->role));
             $action->elementStart('td');
             if ($ml->moderator_id) {
                 $mod = Profile::getByID($ml->moderator_id);
                 if (empty($mod)) {
                     $action->text(_('[unknown]'));
                 } else {
                     $action->element('a', array('href' => $mod->getUrl(), 'title' => $mod->getFullname()), $mod->getNickname());
                 }
             } else {
                 $action->text(_('[unknown]'));
             }
             $action->elementEnd('td');
             $action->elementEnd('tr');
         }
         $action->elementEnd('table');
         $action->elementEnd('div');
     }
 }
 /**
  * Add a checkbox to turn off email summaries
  *
  * @param Action $action Action being executed (emailsettings)
  * @param Profile $scoped Profile for whom settings are configured (current user)
  *
  * @return boolean hook value
  */
 public function onEndEmailFormData(Action $action, Profile $scoped)
 {
     $action->elementStart('li');
     $action->checkbox('emailsummary', _m('Send me a periodic summary of updates from my network'), Email_summary_status::getSendSummary($scoped->id));
     $action->elementEnd('li');
     return true;
 }
 public function onEndShowInsideFooter(Action $action)
 {
     if ($this->serveMobile) {
         // TRANS: Link to switch site layout from mobile to desktop mode. Appears at very bottom of page.
         $linkText = _m('Switch to desktop site layout.');
         $key = 'mobile-toggle-disable';
     } else {
         // TRANS: Link to switch site layout from desktop to mobile mode. Appears at very bottom of page.
         $linkText = _m('Switch to mobile site layout.');
         $key = 'mobile-toggle-enable';
     }
     $action->elementStart('p');
     $action->element('a', array('href' => '#', 'id' => $key), $linkText);
     $action->elementEnd('p');
     return true;
 }