public function ToString() { $Session = Gdn::Session(); $Controller = Gdn::Controller(); $UserID = $Controller->User->UserID; $MemberOptions = array(); $ProfileOptions = array(); $Controller->EventArguments['UserID'] = $UserID; $Controller->EventArguments['ProfileOptions'] =& $ProfileOptions; $Controller->EventArguments['MemberOptions'] =& $MemberOptions; if ($Controller->EditMode) { return '<div class="ProfileOptions">' . Anchor(T('Back to Profile'), UserUrl($Controller->User), array('class' => 'ProfileButtons')) . '</div>'; // $ProfileOptions[] = array('Text' => T('Back to Profile'), 'Url' => UserUrl($Controller->User), 'CssClass' => 'BackToProfile'); } else { // Profile Editing if (hasEditProfile($Controller->User->UserID)) { $ProfileOptions[] = array('Text' => Sprite('SpEditProfile') . ' ' . T('Edit Profile'), 'Url' => UserUrl($Controller->User, '', 'edit')); } // Ban/Unban $MayBan = CheckPermission('Garden.Moderation.Manage') || CheckPermission('Garden.Users.Edit') || CheckPermission('Moderation.Users.Ban'); if ($MayBan && $UserID != $Session->UserID) { if ($Controller->User->Banned) { $ProfileOptions[] = array('Text' => Sprite('SpBan') . ' ' . T('Unban'), 'Url' => "/user/ban?userid={$UserID}&unban=1", 'CssClass' => 'Popup'); } elseif (!$Controller->User->Admin) { $ProfileOptions[] = array('Text' => Sprite('SpBan') . ' ' . T('Ban'), 'Url' => "/user/ban?userid={$UserID}", 'CssClass' => 'Popup'); } } // Delete content. if (CheckPermission('Garden.Moderation.Manage')) { $ProfileOptions[] = array('Text' => Sprite('SpDelete') . ' ' . T('Delete Content'), 'Url' => "/user/deletecontent?userid={$UserID}", 'CssClass' => 'Popup'); } } return parent::ToString(); }
/** * Add "Signature Settings" to Profile Edit button group. * Only do this if they cannot edit profiles because otherwise they can't navigate there. * * @param $Sender */ public function profileController_beforeProfileOptions_handler($Sender, $Args) { $CanEditProfiles = CheckPermission('Garden.Users.Edit') || CheckPermission('Moderation.Profiles.Edit'); if (CheckPermission('Moderation.Signatures.Edit') && !$CanEditProfiles) { $Args['ProfileOptions'][] = array('Text' => Sprite('SpSignatures') . ' ' . T('Signature Settings'), 'Url' => UserUrl($Sender->User, '', 'signature')); } }
function WriteHomepageOption($Title, $Url, $CssClass, $Current, $Description = '') { $SpriteClass = $CssClass; if ($Current == $Url) { $CssClass .= ' Current'; } echo Anchor(T($Title) . Wrap(Sprite($SpriteClass), 'span', array('class' => 'Wrap')), $Url, array('class' => $CssClass, 'title' => $Description)); }
/** * Add 'Unanswered' option to discussion filters. */ public function Base_AfterDiscussionFilters_Handler($Sender, $Args) { if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage')) { $DiscussionModel = new DiscussionModel(); $Active = $Controller->RequestMethod == 'unanswered' ? ' Active' : ''; $Unanswered = Sprite('SpUnansweredQuestionsSpUnansweredQuestions') . ' ' . T('Unanswered') . FilterCountString($DiscussionModel->UnansweredCount()); echo '<li class="Unanswered ' . $Active . '">' . Anchor($Unanswered, 'discussions/unanswered') . '</li>'; } }
/** * Adds "Mark All Viewed" and (conditionally) "Mark Category Viewed" to MeModule menu. * * @since 2.0 * @access public */ public function MeModule_FlyoutMenu_Handler($Sender) { // Add "Mark All Viewed" to menu if (Gdn::Session()->IsValid()) { echo Wrap(Anchor(Sprite('SpMarkAllViewed') . ' ' . T('Mark All Viewed'), '/discussions/markallviewed'), 'li', array('class' => 'MarkAllViewed')); $CategoryID = (int) (empty(Gdn::Controller()->CategoryID) ? 0 : Gdn::Controller()->CategoryID); if ($CategoryID > 0) { echo Wrap(Anchor(Sprite('SpMarkCategoryViewed') . ' ' . T('Mark Category Viewed'), "/discussions/markcategoryviewed/{$CategoryID}"), 'li', array('class' => 'MarkCategoryViewed')); } } }
/** * General "post" form, allows posting of any kind of form. Attach to PostController_AfterFormCollection_Handler. * * @since 2.0.0 * @access public */ public function Index($CurrentFormName = 'discussion') { $this->AddJsFile('jquery.autosize.min.js'); $this->AddJsFile('post.js'); $this->AddJsFile('autosave.js'); $this->SetData('CurrentFormName', $CurrentFormName); $Forms = array(); $Forms[] = array('Name' => 'Discussion', 'Label' => Sprite('SpNewDiscussion') . T('New Discussion'), 'Url' => 'vanilla/post/discussion'); /* $Forms[] = array('Name' => 'Question', 'Label' => Sprite('SpAskQuestion').T('Ask Question'), 'Url' => 'vanilla/post/discussion'); $Forms[] = array('Name' => 'Poll', 'Label' => Sprite('SpNewPoll').T('New Poll'), 'Url' => 'activity'); */ $this->SetData('Forms', $Forms); $this->FireEvent('AfterForms'); $this->SetData('Breadcrumbs', array(array('Name' => T('Post'), 'Url' => '/post'))); $this->Render(); }
/** * Output Send Message link. */ protected function AddSendMessageButton($Sender, $Args) { if (!Gdn::Session()->UserID) { return; } if (isset($Args['Comment'])) { $Object = $Args['Comment']; $ObjectID = 'Comment_' . $Args['Comment']->CommentID; } else { if (isset($Args['Discussion'])) { $Object = $Args['Discussion']; $ObjectID = 'Discussion_' . $Args['Discussion']->DiscussionID; } else { return; } } echo Anchor(Sprite('ReactMessage', 'ReactSprite') . T('Send Message'), Url("/messages/add/{$Object->InsertName}", TRUE), 'ReactButton Visible SendMessage') . ' '; }
public function ToString() { $Session = Gdn::Session(); $Controller = Gdn::Controller(); $UserID = $Controller->User->UserID; $MemberOptions = array(); $ProfileOptions = array(); $Controller->EventArguments['UserID'] = $UserID; $Controller->EventArguments['ProfileOptions'] =& $ProfileOptions; $Controller->EventArguments['MemberOptions'] =& $MemberOptions; if ($Controller->EditMode) { $ProfileOptions[] = array('Text' => T('Back to Profile'), 'Url' => UserUrl($Controller->User), 'CssClass' => 'BackToProfile'); } else { if ($Controller->User->UserID != $Session->UserID) { if ($Session->CheckPermission('Garden.Users.Edit')) { $ProfileOptions[] = array('Text' => Sprite('SpEditProfile') . T('Edit Profile'), 'Url' => UserUrl($Controller->User, '', 'edit')); } } else { if (C('Garden.UserAccount.AllowEdit')) { $ProfileOptions[] = array('Text' => Sprite('SpEditProfile') . T('Edit Profile'), 'Url' => '/profile/edit'); } } if ($Session->CheckPermission('Garden.Moderation.Manage') && $UserID != $Session->UserID) { // Ban/Unban if ($Controller->User->Banned) { $ProfileOptions[] = array('Text' => Sprite('SpBan') . T('Unban'), 'Url' => "/user/ban?userid={$UserID}&unban=1", 'CssClass' => 'Popup'); } else { $ProfileOptions[] = array('Text' => Sprite('SpBan') . T('Ban'), 'Url' => "/user/ban?userid={$UserID}", 'CssClass' => 'Popup'); } // Delete content. if (!$Controller->User->Banned) { $ProfileOptions[] = array('Text' => Sprite('SpDelete') . T('Delete Content'), 'Url' => "/user/deletecontent?userid={$UserID}", 'CssClass' => 'Popup'); } } } return parent::ToString(); }
</div> </li> <?php } ?> </ul> <div class="P PagerContainer"> <?php echo Anchor(Sprite('SpNewConversation SpAdd') . T('New Message'), '/messages/add'); ?> <span class="Pager"><?php echo Anchor(T('More…'), '/messages/inbox'); ?> </span> </div> <?php } else { ?> <?php echo Wrap(T('Your private conversations with other members.'), 'div', array('class' => 'P')); ?> <div class="P PagerContainer"> <?php echo Anchor(Sprite('SpNewConversation SpAdd') . T('New Message'), '/messages/add'); ?> </div> <?php } ?> </div>
<h1 class="H"><?php echo $this->Data('Title'); ?> </h1> <?php // Pager setup $PagerOptions = array('CurrentRecords' => count($this->Data('Conversations'))); if ($this->Data('_PagerUrl')) { $PagerOptions['Url'] = $this->Data('_PagerUrl'); } // Pre Pager echo '<div class="PageControls Top">'; PagerModule::Write($PagerOptions); if (CheckPermission('Conversations.Conversations.Add')) { echo '<div class="BoxButtons BoxNewConversation">'; echo Anchor(Sprite('SpMessage') . ' ' . T('New Message'), '/messages/add', 'Button NewConversation Primary'); echo '</div>'; } echo '</div>'; ?> <div class="DataListWrap"> <h2 class="Hidden"><?php echo $this->Data('Title'); ?> </h2> <ul class="Condensed DataList Conversations"> <?php if (count($this->Data('Conversations') > 0)) { $ViewLocation = $this->FetchViewLocation('conversations'); include $ViewLocation; } else {
public function MenuOptions(&$Options, $UserID, $Key = NULL, $Label = NULL) { if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage')) { $Options[$Key] = array('Label' => Sprite('WarningSprite') . ' ' . ($Label ? $Label : T('Warning.GiveWarning', 'Give Warning')), 'Text' => Sprite('WarningSprite') . ' ' . ($Label ? $Label : T('Warning.GiveWarning', 'Give Warning')), 'Url' => '/user/Warning/' . intval($UserID), 'CssClass' => 'Popup', 'Class' => 'Popup'); } }
/** * Add "Ignore" option to profile options. */ public function ProfileController_BeforeProfileOptions_Handler($Sender, $Args) { if (!$Sender->EditMode && Gdn::Session()->IsValid()) { // Only show option if allowed $IgnoreRestricted = $this->IgnoreRestricted($Sender->User->UserID); if ($IgnoreRestricted && $IgnoreRestricted != self::IGNORE_LIMIT) { return; } // Add to dropdown $UserIgnored = $this->Ignored($Sender->User->UserID); $Label = $UserIgnored ? Sprite('SpUnignore') . ' ' . T('Unignore') : Sprite('SpIgnore') . ' ' . T('Ignore'); $Args['ProfileOptions'][] = array('Text' => $Label, 'Url' => "/user/ignore/toggle/{$Sender->User->UserID}/" . Gdn_Format::Url($Sender->User->Name), 'CssClass' => 'Popup'); } }
/** * Add "Message" option to profile options. */ public function ProfileController_BeforeProfileOptions_Handler($Sender, $Args) { if (!$Sender->EditMode && Gdn::Session()->IsValid() && Gdn::Session()->UserID != $Sender->User->UserID) { $Sender->EventArguments['MemberOptions'][] = array('Text' => Sprite('SpMessage') . T('Message'), 'Url' => '/messages/add/' . $Sender->User->Name, 'CssClass' => 'MessageUser'); } }
/** * This is the asynchronous callback * * This method is triggerd on every page request via a callback AJAX request * so that it may execute asychronously and reduce lag for users. It tracks * views, handles registration for new installations, and sends stats every * day as needed. * * @return void; */ public function Tick() { // If we're local and not allowed, or just directly disabled, gtfo if (!self::CheckIsEnabled()) { return; } if (Gdn::Session()->CheckPermission('Garden.Settings.Manage')) { if (Gdn::Get('Garden.Analytics.Notify', FALSE) !== FALSE) { $CallMessage = Sprite('Bandaid', 'InformSprite'); $CallMessage .= sprintf(T("There's a problem with Vanilla Analytics that needs your attention.<br/> Handle it <a href=\"%s\">here »</a>"), Url('dashboard/statistics')); Gdn::Controller()->InformMessage($CallMessage, array('CssClass' => 'HasSprite')); } } // If the config file is not writable, gtfo $ConfFile = PATH_CONF . '/config.php'; if (!is_writable($ConfFile)) { return; } $InstallationID = Gdn::InstallationID(); // Check if we're registered with the central server already. If not, this request is // hijacked and used to perform that task instead of sending stats or recording a tick. if (is_null($InstallationID)) { $AttemptedRegistration = Gdn::Get('Garden.Analytics.Registering', FALSE); // If we last attempted to register less than 60 seconds ago, do nothing. Could still be working. if ($AttemptedRegistration !== FALSE && time() - $AttemptedRegistration < 60) { return; } return $this->Register(); } // Store the view, using denormalization if enabled $ViewType = 'normal'; if (preg_match('`discussion/embed`', Gdn::Request()->Post('ResolvedPath', ''))) { $ViewType = 'embed'; } $this->AddView($ViewType); // Fire an event for plugins to track their own stats. // TODO: Make this analyze the path and throw a specific event (this event will change in future versions). $this->EventArguments['Path'] = Gdn::Request()->Post('Path'); $this->FireEvent('Tick'); // If we get here, the installation is registered and we can decide on whether or not to send stats now. $LastSentDate = self::LastSentDate(); if (empty($LastSentDate) || $LastSentDate < date('Ymd', strtotime('-1 day'))) { return $this->Stats(); } }
public function DiscussionsController_AfterDiscussionFilters_Handler($Sender) { echo '<li class="PopularDiscussions ' . ($Sender->RequestMethod == 'popular' ? ' Active' : '') . '">' . Anchor(Sprite('SpPopularDiscussions') . ' ' . T('Popular'), '/discussions/popular', 'PopularDiscussions') . '</li>'; }
/** * Add the question form to vanilla's post page. */ public function PostController_AfterForms_Handler($Sender) { $Forms = $Sender->Data('Forms'); $Forms[] = array('Name' => 'Question', 'Label' => Sprite('SpQuestion') . T('Ask a Question'), 'Url' => 'post/question'); $Sender->SetData('Forms', $Forms); }
function WriteCommentOptions($Comment) { $Controller = Gdn::Controller(); $Session = Gdn::Session(); $Id = $Comment->CommentID; $Options = GetCommentOptions($Comment); if (empty($Options)) { return; } echo '<span class="ToggleFlyout OptionsMenu">'; echo '<span class="OptionsTitle" title="' . T('Options') . '">' . T('Options') . '</span>'; echo Sprite('SpFlyoutHandle', 'Arrow'); echo '<ul class="Flyout MenuItems">'; foreach ($Options as $Code => $Option) { echo Wrap(Anchor($Option['Label'], $Option['Url'], GetValue('Class', $Option, $Code)), 'li'); } echo '</ul>'; echo '</span>'; if (C('Vanilla.AdminCheckboxes.Use')) { // Only show the checkbox if the user has permission to affect multiple items $Discussion = Gdn::Controller()->Data('Discussion'); $PermissionCategoryID = GetValue('PermissionCategoryID', $Discussion); if ($Session->CheckPermission('Vanilla.Comments.Delete', TRUE, 'Category', $PermissionCategoryID)) { if (!property_exists($Controller, 'CheckedComments')) { $Controller->CheckedComments = $Session->GetAttribute('CheckedComments', array()); } $ItemSelected = InSubArray($Id, $Controller->CheckedComments); echo '<span class="AdminCheck"><input type="checkbox" name="' . 'Comment' . 'ID[]" value="' . $Id . '"' . ($ItemSelected ? ' checked="checked"' : '') . ' /></span>'; } } }
// echo Wrap(Wrap(T('My Account'), 'strong'), 'li'); // echo Wrap('<hr />', 'li'); echo Wrap(Anchor(Sprite('SpEditProfile') . ' ' . T('Edit Profile'), 'profile/edit'), 'li'); if ($Session->CheckPermission('Garden.Settings.Manage') || $Session->CheckPermission('Garden.Moderation.Manage')) { echo Wrap('<hr />', 'li'); $CApplicant = $ApplicantCount > 0 ? ' ' . Wrap($ApplicantCount, 'span class="Alert"') : ''; $CSpam = $SpamCount > 0 ? ' ' . Wrap($SpamCount, 'span class="Alert"') : ''; $CModeration = $ModerationCount > 0 ? ' ' . Wrap($ModerationCount, 'span class="Alert"') : ''; echo Wrap(Anchor(Sprite('SpApplicants') . ' ' . T('Applicants') . $CApplicant, '/dashboard/user/applicants'), 'li'); echo Wrap(Anchor(Sprite('SpSpam') . ' ' . T('Spam Queue') . $CSpam, '/dashboard/log/spam'), 'li'); echo Wrap(Anchor(Sprite('SpMod') . ' ' . T('Moderation Queue') . $CModeration, '/dashboard/log/moderation'), 'li'); echo Wrap(Anchor(Sprite('SpDashboard') . ' ' . T('Dashboard'), '/dashboard/settings'), 'li'); } $this->FireEvent('FlyoutMenu'); echo Wrap('<hr />', 'li'); echo Wrap(Anchor(Sprite('SpSignOut') . ' ' . T('Sign Out'), SignOutUrl()), 'li'); echo '</div>'; echo '</span>'; // Sign Out // echo Anchor(Sprite('SpSignOut', 'Sprite16').Wrap(T('Sign Out'), 'em'), SignOutUrl(), 'MeButton', array('title' => T('Sign Out'))); echo '</div>'; echo '</div>'; echo '</div>'; } else { echo '<div class="MeBox MeBox-SignIn' . $CssClass . '">'; echo '<div class="SignInLinks">'; echo Anchor(T('Sign In'), SignInUrl($this->_Sender->SelfUrl), SignInPopup() ? ' SignInPopup' : '', array('rel' => 'nofollow')); $Url = RegisterUrl($this->_Sender->SelfUrl); if (!empty($Url)) { echo ' <span class="Bullet">•</span> ' . Anchor(T('Register'), $Url, 'ApplyButton', array('rel' => 'nofollow')) . ' '; }
protected function OutputButton($ButtonType, $Context, $Sender) { // Signed in users only. No guest reporting! if (!Gdn::Session()->UserID) { return; } // Reporting permission checks if (!is_object($Sender->EventArguments['Author'])) { $ElementAuthorID = 0; $ElementAuthor = 'Unknown'; } else { $ElementAuthorID = $Sender->EventArguments['Author']->UserID; $ElementAuthor = $Sender->EventArguments['Author']->Name; } switch ($Context) { case 'comment': $ElementID = $Sender->EventArguments['Comment']->CommentID; $URL = "/discussion/comment/{$ElementID}/#Comment_{$ElementID}"; break; case 'discussion': $ElementID = $Sender->EventArguments['Discussion']->DiscussionID; $URL = "/discussion/{$ElementID}/" . Gdn_Format::Url($Sender->EventArguments['Discussion']->Name); break; case 'conversation': break; default: return; } $ButtonTitle = T(ucfirst($ButtonType)); $ContainerCSS = $ButtonTitle . 'Post'; $EncodedURL = str_replace('=', '-', base64_encode($URL)); $EventUrl = "plugin/reporting/{$ButtonType}/{$Context}/{$ElementID}/{$EncodedURL}"; //$Sender->EventArguments['CommentOptions'][$ButtonTitle] = array('Label' => $ButtonTitle, 'Url' => "plugin/reporting/{$ButtonType}/{$Context}/{$ElementID}/{$EncodedURL}", $ContainerCSS.' ReportContent Popup'); $SpriteType = "React" . ucfirst($ButtonType); $Text = Anchor(Sprite($SpriteType, 'ReactSprite') . $ButtonTitle, $EventUrl, "ReactButton React {$ContainerCSS} Popup"); echo Bullet(); echo $Text; }
if ($ModPermission) { ?> <li <?php if ($Controller->Data('Filter') == 'mods') { echo 'class="Active"'; } ?> > <?php echo Anchor(Sprite('SpModeratorActivities') . T('Moderator Activity'), '/activity/mods'); ?> </li> <?php } if ($AdminPermission) { ?> <li <?php if ($Controller->Data('Filter') == 'admins') { echo 'class="Active"'; } ?> > <?php echo Anchor(Sprite('SpAdminActivities') . T('Administrator Activity'), '/activity/admins'); ?> </li> <?php } ?> </ul> </div>
/** * This is the asynchronous callback. * * This method is triggerd on every page request via a callback AJAX request * so that it may execute asychronously and reduce lag for users. It tracks * views, handles registration for new installations, and sends stats every day as needed. * * @return void */ public function tick() { // Fire an event for plugins to track their own stats. // TODO: Make this analyze the path and throw a specific event (this event will change in future versions). $this->EventArguments['Path'] = Gdn::Request()->Post('Path'); $this->fireEvent('Tick'); // Store the view, using denormalization if enabled $ViewType = 'normal'; if (preg_match('`discussion/embed`', Gdn::request()->post('ResolvedPath', ''))) { $ViewType = 'embed'; } $this->addView($ViewType); if (Gdn::session()->isValid()) { Gdn::userModel()->updateVisit(Gdn::session()->UserID); } if (!self::checkIsEnabled()) { return; } if (Gdn::session()->checkPermission('Garden.Settings.Manage')) { if (Gdn::get('Garden.Analytics.Notify', false) !== false) { $CallMessage = Sprite('Bandaid', 'InformSprite'); $CallMessage .= sprintf(T("There's a problem with Vanilla Analytics that needs your attention.<br/> Handle it <a href=\"%s\">here »</a>"), Url('dashboard/statistics')); Gdn::controller()->informMessage($CallMessage, array('CssClass' => 'HasSprite')); } } $InstallationID = Gdn::installationID(); // Check if we're registered with the central server already. If not, this request is // hijacked and used to perform that task instead of sending stats or recording a tick. if (is_null($InstallationID)) { // If the config file is not writable, gtfo $ConfFile = PATH_CONF . '/config.php'; if (!is_writable($ConfFile)) { // Admins see a helpful notice if (Gdn::session()->checkPermission('Garden.Settings.Manage')) { $Warning = sprite('Sliders', 'InformSprite'); $Warning .= T('Your config.php file is not writable.<br/> Find out <a href="http://vanillaforums.org/docs/vanillastatistics">how to fix this »</a>'); Gdn::controller()->informMessage($Warning, array('CssClass' => 'HasSprite')); } return; } $AttemptedRegistration = Gdn::get('Garden.Analytics.Registering', false); // If we last attempted to register less than 60 seconds ago, do nothing. Could still be working. if ($AttemptedRegistration !== false && time() - $AttemptedRegistration < 60) { return; } return $this->register(); } // If we get here, the installation is registered and we can decide on whether or not to send stats now. $LastSentDate = self::lastSentDate(); if (empty($LastSentDate) || $LastSentDate < date('Ymd', strtotime('-1 day'))) { return $this->stats(); } }
function writeDiscussionSorter($Selected = null, $Options = null) { if ($Selected === null) { $Selected = Gdn::session()->GetPreference('Discussions.SortField', 'DateLastComment'); } $Selected = stringBeginsWith($Selected, 'd.', TRUE, true); $Options = array('DateLastComment' => t('Sort by Last Comment', 'by Last Comment'), 'DateInserted' => t('Sort by Start Date', 'by Start Date')); ?> <span class="ToggleFlyout SelectFlyout"> <?php if (isset($Options[$Selected])) { $Text = $Options[$Selected]; } else { $Text = reset($Options); } echo wrap($Text . ' ' . Sprite('', 'DropHandle'), 'span', array('class' => 'Selected')); ?> <div class="Flyout MenuItems"> <ul> <?php foreach ($Options as $SortField => $SortText) { echo wrap(Anchor($SortText, '#', array('class' => 'SortDiscussions', 'data-field' => $SortField)), 'li'); } ?> </ul> </div> </span> <?php }
function writeReactions($Row) { $Attributes = GetValue('Attributes', $Row); if (is_string($Attributes)) { $Attributes = @unserialize($Attributes); SetValue('Attributes', $Row, $Attributes); } Gdn::Controller()->EventArguments['ReactionTypes'] = array(); if ($ID = GetValue('CommentID', $Row)) { $RecordType = 'comment'; } elseif ($ID = GetValue('ActivityID', $Row)) { $RecordType = 'activity'; } else { $RecordType = 'discussion'; $ID = GetValue('DiscussionID', $Row); } Gdn::Controller()->EventArguments['RecordType'] = $RecordType; Gdn::Controller()->EventArguments['RecordID'] = $ID; echo '<div class="Reactions">'; Gdn_Theme::BulletRow(); // Write the flags. static $Flags = null; if ($Flags === null) { Gdn::Controller()->EventArguments['Flags'] =& $Flags; Gdn::Controller()->FireEvent('Flags'); } // Allow addons to work with flags Gdn::Controller()->EventArguments['Flags'] =& $Flags; Gdn::Controller()->FireEvent('BeforeFlag'); if (!empty($Flags) && is_array($Flags)) { echo Gdn_Theme::BulletItem('Flags'); echo ' <span class="FlagMenu ToggleFlyout">'; // Write the handle. echo Anchor(Sprite('ReactFlag', 'ReactSprite') . ' ' . Wrap(T('Flag'), 'span', array('class' => 'ReactLabel')), '', 'Hijack ReactButton-Flag FlyoutButton', array('title' => 'Flag'), true); echo Sprite('SpFlyoutHandle', 'Arrow'); echo '<ul class="Flyout MenuItems Flags" style="display: none;">'; foreach ($Flags as $Flag) { if (is_callable($Flag)) { echo '<li>' . call_user_func($Flag, $Row, $RecordType, $ID) . '</li>'; } else { echo '<li>' . ReactionButton($Row, $Flag['UrlCode']) . '</li>'; } } Gdn::Controller()->FireEvent('AfterFlagOptions'); echo '</ul>'; echo '</span> '; } Gdn::Controller()->FireEvent('AfterFlag'); Gdn::Controller()->FireEvent('AfterReactions'); echo '</div>'; Gdn::Controller()->FireEvent('Replies'); }
$CSpam = ''; //$SpamCount > 0 ? ' '.Wrap($SpamCount, 'span class="Alert"') : ''; $CModeration = $ModerationCount > 0 ? ' ' . Wrap($ModerationCount, 'span class="Alert"') : ''; echo Wrap(Anchor(Sprite('SpApplicants') . ' ' . T('Applicants') . $CApplicant, '/dashboard/user/applicants'), 'li'); if ($Session->CheckPermission(array('Garden.Settings.Manage', 'Garden.Moderation.Manage', 'Moderation.ModerationQueue.Manage'), FALSE)) { echo Wrap(Anchor(Sprite('SpSpam') . ' ' . T('Spam Queue') . $CSpam, '/dashboard/log/spam'), 'li'); } if ($Session->CheckPermission(array('Garden.Settings.Manage', 'Garden.Moderation.Manage', 'Moderation.ModerationQueue.Manage'), FALSE)) { echo Wrap(Anchor(Sprite('SpMod') . ' ' . T('Moderation Queue') . $CModeration, '/dashboard/log/moderation'), 'li'); } if ($Session->CheckPermission(array('Garden.Settings.View', 'Garden.Settings.Manage'), FALSE)) { echo Wrap(Anchor(Sprite('SpDashboard') . ' ' . T('Dashboard'), '/dashboard/settings'), 'li'); } } $this->FireEvent('FlyoutMenu'); echo Wrap('<hr />' . Anchor(Sprite('SpSignOut') . ' ' . T('Sign Out'), SignOutUrl()), 'li', array('class' => 'SignInOutWrap SignOutWrap')); echo '</ul>'; echo '</div>'; echo '</span>'; // Sign Out // echo Anchor(Sprite('SpSignOut', 'Sprite16').Wrap(T('Sign Out'), 'em'), SignOutUrl(), 'MeButton', array('title' => T('Sign Out'))); echo '</div>'; echo '</div>'; echo '</div>'; } else { echo '<div class="MeBox MeBox-SignIn' . $CssClass . '">'; echo '<div class="SignInLinks">'; echo Anchor(T('Sign In'), SignInUrl($this->_Sender->SelfUrl), SignInPopup() ? ' SignInPopup' : '', array('rel' => 'nofollow')); $Url = RegisterUrl($this->_Sender->SelfUrl); if (!empty($Url)) { echo Bullet(' ') . Anchor(T('Register'), $Url, 'ApplyButton', array('rel' => 'nofollow')) . ' ';
<?php if (!defined('APPLICATION')) { exit; } /** Displays the "Edit My Profile" or "Back to Profile" buttons on the top of the profile page. */ ?> <div class="ProfileOptions"> <?php $Controller = Gdn::Controller(); $Controller->FireEvent('BeforeProfileOptions'); echo ButtonGroup($Controller->EventArguments['MemberOptions'], 'NavButton MemberButtons'); echo ' '; echo ButtonDropDown($Controller->EventArguments['ProfileOptions'], 'NavButton ProfileButtons', Sprite('SpEditProfile', 'Sprite16') . ' <span class="Hidden">' . T('Edit Profile') . '</span>'); ?> </div>
$this->FireEvent('BeforePageOptions'); ?> <?php if ($Session->CheckPermission('Garden.Settings.Manage')) { ?> <div class="Options"> <span class="ToggleFlyout OptionsMenu"> <span class="OptionsTitle" title="<?php echo T('Options'); ?> "><?php echo T('Options'); ?> </span> <?php echo Sprite('SpFlyoutHandle', 'Arrow'); ?> <ul class="Flyout MenuItems" style="display: none;"> <?php echo Wrap(Anchor(T('BasicPages.Settings.EditPage', 'Edit Page'), 'pagessettings/editpage/' . $this->Page->PageID, 'EditPage'), 'li'); ?> </ul> </span> </div> <?php } ?> <h1 id="PageTitle" class="H"><?php echo $this->Page->Name; ?> </h1>
/** * * * @param $Sender * @param $Args */ public function discussionController_afterBodyField_handler($Sender, $Args) { if (!$this->socialSharing()) { return; } if (!$this->accessToken()) { return; } echo ' ' . $Sender->Form->checkBox('ShareFacebook', '@' . Sprite('ReactFacebook', 'ReactSprite'), array('value' => '1', 'title' => sprintf(t('Share to %s.'), 'Facebook'))) . ' '; }
/** * Build the user profile. * * Set the page title, add data to page modules, add modules to assets, * add tabs to tab menu. $this->User must be defined, or this method will throw an exception. * * @since 2.0.0 * @access public * @return bool Always true. */ public function BuildProfile() { if (!is_object($this->User)) { throw new Exception(T('Cannot build profile information if user is not defined.')); } $Session = Gdn::Session(); if (strpos($this->CssClass, 'Profile') === FALSE) { $this->CssClass .= ' Profile'; } $this->Title(Gdn_Format::Text($this->User->Name)); if ($this->_DeliveryType != DELIVERY_TYPE_VIEW) { // Javascript needed // see note above about jcrop $this->AddJsFile('jquery.jcrop.min.js'); $this->AddJsFile('profile.js'); $this->AddJsFile('jquery.gardenmorepager.js'); $this->AddJsFile('activity.js'); // Build activity URL $ActivityUrl = 'profile/activity/'; if ($this->User->UserID != $Session->UserID) { $ActivityUrl = UserUrl($this->User, '', 'activity'); } // Show activity? if (C('Garden.Profile.ShowActivities', TRUE)) { $this->AddProfileTab(T('Activity'), $ActivityUrl, 'Activity', Sprite('SpActivity') . ' ' . T('Activity')); } // Show notifications? if ($this->User->UserID == $Session->UserID) { $Notifications = T('Notifications'); $NotificationsHtml = Sprite('SpNotifications') . ' ' . $Notifications; $CountNotifications = $Session->User->CountNotifications; if (is_numeric($CountNotifications) && $CountNotifications > 0) { $NotificationsHtml .= ' <span class="Aside"><span class="Count">' . $CountNotifications . '</span></span>'; } $this->AddProfileTab($Notifications, 'profile/notifications', 'Notifications', $NotificationsHtml); } // Show invitations? if (C('Garden.Registration.Method') == 'Invitation') { $this->AddProfileTab(T('Invitations'), 'profile/invitations', 'InvitationsLink'); } $this->FireEvent('AddProfileTabs'); } return TRUE; }
/** * Adds 'Discussions' tab to profiles and adds CSS & JS files to their head. * * @since 2.0.0 * @package Vanilla * * @param object $Sender ProfileController. */ public function ProfileController_AddProfileTabs_Handler($Sender) { if (is_object($Sender->User) && $Sender->User->UserID > 0) { $UserID = $Sender->User->UserID; // Add the discussion tab $DiscussionsLabel = Sprite('SpDiscussions') . ' ' . T('Discussions'); $CommentsLabel = Sprite('SpComments') . ' ' . T('Comments'); if (C('Vanilla.Profile.ShowCounts', TRUE)) { $DiscussionsLabel .= '<span class="Aside">' . CountString(GetValueR('User.CountDiscussions', $Sender, NULL), "/profile/count/discussions?userid={$UserID}") . '</span>'; $CommentsLabel .= '<span class="Aside">' . CountString(GetValueR('User.CountComments', $Sender, NULL), "/profile/count/comments?userid={$UserID}") . '</span>'; } $Sender->AddProfileTab(T('Discussions'), 'profile/discussions/' . $Sender->User->UserID . '/' . rawurlencode($Sender->User->Name), 'Discussions', $DiscussionsLabel); $Sender->AddProfileTab(T('Comments'), 'profile/comments/' . $Sender->User->UserID . '/' . rawurlencode($Sender->User->Name), 'Comments', $CommentsLabel); // Add the discussion tab's CSS and Javascript. $Sender->AddJsFile('jquery.gardenmorepager.js'); $Sender->AddJsFile('discussions.js'); } }
/** * Output Quote link. */ protected function AddReactButton($Sender, $Args) { if ($this->AccessToken()) { $Url = Url("post/twitter/{$Args['RecordType']}?id={$Args['RecordID']}", TRUE); $CssClass = 'ReactButton Hijack'; } else { $Url = Url("post/twitter/{$Args['RecordType']}?id={$Args['RecordID']}", TRUE); $CssClass = 'ReactButton PopupWindow'; } echo Anchor(Sprite('ReactTwitter', 'ReactSprite'), $Url, $CssClass); }