本文整理匯總了PHP中Sprite函數的典型用法代碼示例。如果您正苦於以下問題:PHP Sprite函數的具體用法?PHP Sprite怎麽用?PHP Sprite使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Sprite函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ToString
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();
}
示例2: profileController_beforeProfileOptions_handler
/**
* 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'));
}
}
示例3: WriteHomepageOption
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));
}
示例4: Base_AfterDiscussionFilters_Handler
/**
* 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>';
}
}
示例5: MeModule_FlyoutMenu_Handler
/**
* 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'));
}
}
}
示例6: Index
/**
* 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();
}
示例7: AddSendMessageButton
/**
* 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') . ' ';
}
示例8: ToString
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();
}
示例9: Anchor
</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>
示例10: array
<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 {
示例11: MenuOptions
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');
}
}
示例12: ProfileController_BeforeProfileOptions_Handler
/**
* 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');
}
}
示例13: ProfileController_BeforeProfileOptions_Handler
/**
* 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');
}
}
示例14: Tick
/**
* 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();
}
}
示例15: DiscussionsController_AfterDiscussionFilters_Handler
public function DiscussionsController_AfterDiscussionFilters_Handler($Sender)
{
echo '<li class="PopularDiscussions ' . ($Sender->RequestMethod == 'popular' ? ' Active' : '') . '">' . Anchor(Sprite('SpPopularDiscussions') . ' ' . T('Popular'), '/discussions/popular', 'PopularDiscussions') . '</li>';
}