当前位置: 首页>>代码示例>>PHP>>正文


PHP Gdn::Translate方法代码示例

本文整理汇总了PHP中Gdn::Translate方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn::Translate方法的具体用法?PHP Gdn::Translate怎么用?PHP Gdn::Translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdn的用法示例。


在下文中一共展示了Gdn::Translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SettingsController_Render_Before

    public function SettingsController_Render_Before(&$Sender)
    {
        // Save the action if editing registration settings
        if (strcasecmp($Sender->RequestMethod, 'registration') == 0 && $Sender->Form->AuthenticatedPostBack() === TRUE) {
            $this->SaveStep('Plugins.GettingStarted.Registration');
        }
        // Save the action if they reviewed plugins
        if (strcasecmp($Sender->RequestMethod, 'plugins') == 0) {
            $this->SaveStep('Plugins.GettingStarted.Plugins');
        }
        // Save the action if they reviewed plugins
        if (strcasecmp($Sender->RequestMethod, 'managecategories') == 0) {
            $this->SaveStep('Plugins.GettingStarted.Categories');
        }
        // Add messages & their css on dashboard
        if (strcasecmp($Sender->RequestMethod, 'index') == 0) {
            $Sender->AddCssFile(DS . 'plugins' . DS . 'GettingStarted' . DS . 'style.css');
            $Session = Gdn::Session();
            $WelcomeMessage = '<div class="GettingStarted">' . Anchor('×', '/garden/plugin/dismissgettingstarted/' . $Session->TransientKey(), 'Dismiss') . "<p>Here's how to get started:</p>" . '<ul>
      <li class="One' . (Gdn::Config('Plugins.GettingStarted.Registration', '0') == '1' ? ' Done' : '') . '">' . Anchor(Gdn::Translate('Define how users register for your forum'), '/settings/registration') . '</li>
      <li class="Two' . (Gdn::Config('Plugins.GettingStarted.Plugins', '0') == '1' ? ' Done' : '') . '">' . Anchor(Gdn::Translate('Manage your plugins'), 'settings/plugins') . '</li>
      <li class="Three' . (Gdn::Config('Plugins.GettingStarted.Categories', '0') == '1' ? ' Done' : '') . '">' . Anchor(Gdn::Translate('Organize your discussion categories'), 'vanilla/settings/managecategories') . '</li>
      <li class="Four' . (Gdn::Config('Plugins.GettingStarted.Profile', '0') == '1' ? ' Done' : '') . '">' . Anchor(Gdn::Translate('Customize your profile'), 'profile') . '</li>
      <li class="Five' . (Gdn::Config('Plugins.GettingStarted.Discussion', '0') == '1' ? ' Done' : '') . '">' . Anchor(Gdn::Translate('Start your first discussion'), 'post/discussion') . '</li>
   </ul>
</div>';
            $Sender->AddAsset('Messages', $WelcomeMessage, 'WelcomeMessage');
        }
    }
开发者ID:Aetasiric,项目名称:Garden,代码行数:29,代码来源:default.php

示例2: Base_Render_Before

 public function Base_Render_Before(&$Sender)
 {
     // Add menu items.
     $Session = Gdn::Session();
     if ($Sender->Menu) {
         $Sender->Menu->AddLink('Dashboard', 'Dashboard', '/garden/settings', array('Garden.Settings.Manage'));
         $Sender->Menu->AddLink('Dashboard', 'Users', '/user/browse', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'));
         $Sender->Menu->AddLink('Activity', 'Activity', '/activity');
         $Authenticator = Gdn::Authenticator();
         if ($Session->IsValid()) {
             $Sender->Menu->AddLink('SignOut', 'Sign Out', '/entry/leave/{Session_TransientKey}', FALSE, array('class' => 'NonTab'));
             $Notifications = Gdn::Translate('Notifications');
             $CountNotifications = $Session->User->CountNotifications;
             if (is_numeric($CountNotifications) && $CountNotifications > 0) {
                 $Notifications .= '<span>' . $CountNotifications . '</span>';
             }
             $Sender->Menu->AddLink('User', '{Username}', '/profile/{Username}', array('Garden.SignIn.Allow'));
             $Sender->Menu->AddLink('User', '\\' . $Notifications, 'profile/notifications/{Username}');
         } else {
             $Sender->Menu->AddLink('Entry', 'Sign In', $Authenticator->SignInUrl());
         }
     }
     // Enable theme previewing
     if ($Session->IsValid()) {
         $PreviewTheme = $Session->GetPreference('PreviewTheme', '');
         if ($PreviewTheme != '') {
             $Sender->Theme = $PreviewTheme;
         }
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:30,代码来源:hooks.php

示例3: Edit

 public function Edit($MessageID = '')
 {
     $this->AddJsFile('js/library/jquery.autogrow.js');
     $this->AddJsFile('messages.js');
     $this->Permission('Garden.Messages.Manage');
     $this->AddSideMenu('garden/message');
     // Generate some Controller & Asset data arrays
     $this->LocationData = $this->_GetLocationData();
     $this->AssetData = $this->_GetAssetData();
     // Set the model on the form.
     $this->Form->SetModel($this->MessageModel);
     $this->Message = $this->MessageModel->GetID($MessageID);
     // Make sure the form knows which item we are editing.
     if (is_numeric($MessageID) && $MessageID > 0) {
         $this->Form->AddHidden('MessageID', $MessageID);
     }
     // If seeing the form for the first time...
     if ($this->Form->AuthenticatedPostBack() === FALSE) {
         $this->Form->SetData($this->Message);
     } else {
         if ($MessageID = $this->Form->Save()) {
             // Reset the message cache
             $this->MessageModel->SetMessageCache();
             // Redirect
             $this->StatusMessage = Gdn::Translate('Your changes have been saved.');
             $this->RedirectUrl = Url('garden/message');
         }
     }
     $this->Render();
 }
开发者ID:jeastwood,项目名称:Garden,代码行数:30,代码来源:message.php

示例4: ToString

    public function ToString()
    {
        $String = '';
        ob_start();
        ?>
      <div class="Box">
         <h4><?php 
        echo Gdn::Translate('In this Discussion');
        ?>
</h4>
         <ul class="PanelInfo">
         <?php 
        foreach ($this->_UserData->Result() as $User) {
            ?>
            <li>
               <strong><?php 
            echo Anchor($User->Name, '/profile/' . urlencode($User->Name), 'UserLink');
            ?>
</strong>
               <?php 
            echo Format::Date($User->DateLastActive);
            ?>
            </li>
            <?php 
        }
        ?>
         </ul>
      </div>
      <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
开发者ID:jhampha,项目名称:Garden,代码行数:33,代码来源:class.inthisdiscussionmodule.php

示例5: __construct

 public function __construct(&$Sender = '')
 {
     $Session = Gdn::Session();
     if (property_exists($Sender, 'Conversation')) {
         $this->Conversation = $Sender->Conversation;
     }
     $this->Form = Gdn::Factory('Form', 'AddPeople');
     // $this->Form->Action = $Sender->SelfUrl;
     // If the form was posted back, check for people to add to the conversation
     if ($this->Form->AuthenticatedPostBack()) {
         $NewRecipientUserIDs = array();
         $NewRecipients = explode(',', $this->Form->GetFormValue('AddPeople', ''));
         $UserModel = Gdn::Factory("UserModel");
         foreach ($NewRecipients as $Name) {
             if (trim($Name) != '') {
                 $User = $UserModel->Get(trim($Name));
                 if (is_object($User)) {
                     $NewRecipientUserIDs[] = $User->UserID;
                 }
             }
         }
         $Sender->ConversationModel->AddUserToConversation($this->Conversation->ConversationID, $NewRecipientUserIDs);
         // if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL)
         //    Redirect('/messages/'.$this->Conversation->ConversationID);
         $Sender->StatusMessage = Gdn::Translate('Your changes were saved.');
         $Sender->RedirectUrl = Url('/messages/' . $this->Conversation->ConversationID);
     }
     $this->_ApplicationFolder = $Sender->Application;
     $this->_ThemeFolder = $Sender->Theme;
 }
开发者ID:Aetasiric,项目名称:Garden,代码行数:30,代码来源:class.addpeoplemodule.php

示例6: CheckForSpam

 /**
  * Checks to see if the user is spamming. Returns TRUE if the user is spamming.
  */
 public function CheckForSpam($Type)
 {
     $Spam = FALSE;
     if (!in_array($Type, array('Comment', 'Discussion'))) {
         trigger_error(ErrorMessage(sprintf('Spam check type unknown: %s', $Type), 'VanillaModel', 'CheckForSpam'), E_USER_ERROR);
     }
     $Session = Gdn::Session();
     $CountSpamCheck = $Session->GetAttribute('Count' . $Type . 'SpamCheck', 0);
     $DateSpamCheck = $Session->GetAttribute('Date' . $Type . 'SpamCheck', 0);
     $SecondsSinceSpamCheck = time() - Format::ToTimestamp($DateSpamCheck);
     $SpamCount = Gdn::Config('Vanilla.' . $Type . '.SpamCount');
     if (!is_numeric($SpamCount) || $SpamCount < 2) {
         $SpamCount = 2;
     }
     // 2 spam minimum
     $SpamTime = Gdn::Config('Vanilla.' . $Type . '.SpamTime');
     if (!is_numeric($SpamTime) || $SpamTime < 0) {
         $SpamTime = 30;
     }
     // 30 second minimum spam span
     $SpamLock = Gdn::Config('Vanilla.' . $Type . '.SpamLock');
     if (!is_numeric($SpamLock) || $SpamLock < 30) {
         $SpamLock = 30;
     }
     // 30 second minimum lockout
     // Definition:
     // Users cannot post more than $SpamCount comments within $SpamTime
     // seconds or their account will be locked for $SpamLock seconds.
     // Apply a spam lock if necessary
     $Attributes = array();
     if ($SecondsSinceSpamCheck < $SpamLock && $CountSpamCheck >= $SpamCount && $DateSpamCheck !== FALSE) {
         // TODO: REMOVE DEBUGGING INFO AFTER THIS IS WORKING PROPERLY
         /*
         echo '<div>SecondsSinceSpamCheck: '.$SecondsSinceSpamCheck.'</div>';
         echo '<div>SpamLock: '.$SpamLock.'</div>';
         echo '<div>CountSpamCheck: '.$CountSpamCheck.'</div>';
         echo '<div>SpamCount: '.$SpamCount.'</div>';
         echo '<div>DateSpamCheck: '.$DateSpamCheck.'</div>';
         echo '<div>SpamTime: '.$SpamTime.'</div>';
         */
         $Spam = TRUE;
         $this->Validation->AddValidationResult('Body', sprintf(Gdn::Translate('You have posted %1$s times within %2$s seconds. A spam block is now in effect on your account. You must wait at least %3$s seconds before attempting to post again.'), $SpamCount, $SpamTime, $SpamLock));
         // Update the 'waiting period' every time they try to post again
         $Attributes['Date' . $Type . 'SpamCheck'] = Format::ToDateTime();
     } else {
         if ($SecondsSinceSpamCheck > $SpamTime) {
             $Attributes['Count' . $Type . 'SpamCheck'] = 1;
             $Attributes['Date' . $Type . 'SpamCheck'] = Format::ToDateTime();
         } else {
             $Attributes['Count' . $Type . 'SpamCheck'] = $CountSpamCheck + 1;
         }
     }
     // Update the user profile after every comment
     $UserModel = Gdn::UserModel();
     $UserModel->SaveAttribute($Session->UserID, $Attributes);
     return $Spam;
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:60,代码来源:class.vanillamodel.php

示例7: ToString

    public function ToString()
    {
        $String = '';
        $Session = Gdn::Session();
        ob_start();
        //Hide the top poster box id there's no post greater than 0
        if ($this->_TopPosters->NumRows() > 0) {
            ?>
		
			<div id="TopPosters" class="Box">
				<h4><?php 
            echo Gdn::Translate("Top Posters");
            ?>
</h4>
				<ul class="PanelInfo">
				<?php 
            $i = 1;
            foreach ($this->_TopPosters->Result() as $User) {
                ?>
					<li>
						<?php 
                echo $User->AllPosted;
                ?>
						<?php 
                if (Gdn::Config('TopPosters.Show.Medal') == "both" || Gdn::Config('TopPosters.Show.Medal') == "side") {
                    ?>
						<img src="<?php 
                    echo str_replace("index.php?p=", "", Url('/plugins/TopPosters/badges/' . (file_exists('plugins/TopPosters/badges/' . $i . '.png') ? $i . '.png' : 'medal-icon.png')));
                    ?>
">
						<?php 
                }
                ?>
		 				<strong>
		    				<?php 
                echo UserAnchor($User);
                ?>
		 				</strong>
		 				
					</li>
				<?php 
                $i++;
            }
            ?>
			</ul>
		</div>
		<?php 
        }
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
开发者ID:ru4,项目名称:arabbnota,代码行数:52,代码来源:class.toppostersmodule.php

示例8: ProfileController_AddProfileTabs_Handler

 public function ProfileController_AddProfileTabs_Handler(&$Sender)
 {
     if (is_object($Sender->User) && $Sender->User->UserID > 0 && $Sender->User->CountDiscussions > 0) {
         // Add the discussion tab
         $Sender->AddProfileTab(Gdn::Translate('Discussions'));
         // Add the discussion tab's css
         $Sender->AddCssFile('vanillaprofile.css', 'vanilla');
         if ($Sender->Head) {
             $Sender->Head->AddScript('/js/library/jquery.gardenmorepager.js');
             $Sender->Head->AddScript('/applications/vanilla/js/discussions.js');
         }
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:13,代码来源:hooks.php

示例9: Check

 public function Check($Type = '', $Name = '')
 {
     if ($Type != '' && $Name != '') {
         $this->AddItem($Type, $Name);
     }
     if (count($this->_Items) > 0) {
         // TODO: Use garden update check url instead of this:
         $UpdateUrl = Url('/lussumo/update', TRUE, TRUE);
         $Host = Gdn_Url::Host();
         $Path = CombinePaths(array(Gdn_Url::WebRoot(), 'lussumo', 'update'), '/');
         $Port = 80;
         /*
         $UpdateUrl = Gdn::Config('Garden.UpdateCheckUrl', '');
         $UpdateUrl = parse_url($UpdateUrl);
         $Host = ArrayValue('host', $UpdateUrl, 'www.lussumo.com');
         $Path = ArrayValue('path', $UpdateUrl, '/');
         $Port = ArrayValue('port', $UpdateUrl, '80');
         */
         $Path .= '?Check=' . urlencode(Format::Serialize($this->_Items));
         $Locale = Gdn::Config('Garden.Locale', 'Undefined');
         $Referer = Gdn_Url::WebRoot(TRUE);
         if ($Referer === FALSE) {
             $Referer = 'Undefined';
         }
         $Timeout = 10;
         $Response = '';
         // Connect to the update server.
         $Pointer = @fsockopen($Host, '80', $ErrorNumber, $Error, $Timeout);
         if (!$Pointer) {
             throw new Exception(sprintf(Gdn::Translate('Encountered an error when attempting to connect to the update server (%1$s): [%2$s] %3$s'), $UpdateUrl, $ErrorNumber, $Error));
         } else {
             // send the necessary headers to get the file
             fputs($Pointer, "GET {$Path} HTTP/1.0\r\n" . "Host: {$Host}\r\n" . "User-Agent: Lussumo Garden/1.0\r\n" . "Accept: */*\r\n" . "Accept-Language: " . $Locale . "\r\n" . "Accept-Charset: utf-8;\r\n" . "Keep-Alive: 300\r\n" . "Connection: keep-alive\r\n" . "Referer: {$Referer}\r\n\r\n");
             // Retrieve the response from the remote server
             while ($Line = fread($Pointer, 4096)) {
                 $Response .= $Line;
             }
             fclose($Pointer);
             // Remove response headers
             $Response = substr($Response, strpos($Response, "\r\n\r\n") + 4);
         }
         $Result = Format::Unserialize($Response);
         // print_r($Result);
         if (is_array($Result)) {
             $this->_Items = $Result;
         } else {
             $Result = FALSE;
         }
         return $Result;
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:51,代码来源:class.updatemanager.php

示例10: Base_Render_Before

 public function Base_Render_Before(&$Sender)
 {
     // Add the menu options for conversations
     $Session = Gdn::Session();
     if ($Sender->Menu && $Session->IsValid()) {
         $Inbox = Gdn::Translate('Inbox');
         $CountUnreadConversations = $Session->User->CountUnreadConversations;
         if (is_numeric($CountUnreadConversations) && $CountUnreadConversations > 0) {
             $Inbox .= '<span>' . $CountUnreadConversations . '</span>';
         }
         $Sender->Menu->AddLink('Conversations', $Inbox, '/messages/all', FALSE);
         $Sender->Menu->AddLink('Conversations', Gdn::Translate('New Conversation'), '/messages/add', FALSE);
     }
 }
开发者ID:Aetasiric,项目名称:Garden,代码行数:14,代码来源:hooks.php

示例11: ErrorHandler

 public static function ErrorHandler($Error, $Message = '', $File = '', $Line = '')
 {
     if (error_reporting() == 0) {
         return False;
     }
     $Object = 'PHP';
     $Method = 'Function';
     if (is_object($Error)) {
         $Info = False;
         foreach ($Error->GetTrace() as $Info) {
             break;
         }
         $Method = ArrayValue('function', $Info, $Method);
         $Object = ArrayValue('class', $Info, $Object);
         $Message = $Error->GetMessage();
         $File = $Error->GetFile();
         $Line = $Error->GetLine();
         $Error = -1;
     }
     $File = str_replace(PATH_ROOT . DS, '', $File);
     switch ($Error) {
         case E_NOTICE:
             $Code = 'NOTICE';
             break;
         case E_WARNING:
             $Code = 'WARNING';
             break;
         case -1:
             $Code = 'UNCAUGHT EXCEPTION';
             break;
         default:
             $Code = 'ERROR';
     }
     $Message = strip_tags($Message);
     self::Message('%s: %s in %s on line %s', $Code, $Message, $File, $Line);
     self::Message($Message);
     LogMessage($File, $Line, $Object, $Method, $Message, $Code);
     // send error to email
     $To = Gdn::Config('Plugins.UsefulFunctions.Console.ErrorsEmailToAddress');
     if (self::Check() && $To != False) {
         $Text = sprintf(Gdn::Translate('Error in console script %1$s %2$s %3$s %4$s'), $Code, $Message, $File, $Line);
         if (!class_exists('Gdn_Email')) {
             return error_log("Error ({$Code})", 1, $To, $Text);
         }
         $Email = new Gdn_Email();
         $Email->To($To)->Message($Text)->Subject("Error ({$Code})")->Send('ErrorInConsoleScript');
     }
     exit;
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:49,代码来源:class.console.php

示例12: ToString

    public function ToString()
    {
        $String = '';
        $Session = Gdn::Session();
        ob_start();
        $LatestOrMost = Gdn::Config('LatestComment.Show.LatestComment');
        //Hide the top poster box id there's no post greater than 0
        if ($this->_LatestComments->NumRows() > 0) {
            ?>
		
			<div id="LatestComment" class="Box BoxLatestComment">
				<h4><?php 
            if ($LatestOrMost == "YES") {
                echo Gdn::Translate("Latest Commented");
            } else {
                echo Gdn::Translate("Most Commented");
            }
            ?>
</h4>
				<ul class="PanelInfo PanelLatestComment">
				<?php 
            $i = 1;
            foreach ($this->_LatestComments->Result() as $Discussion) {
                ?>
					<li><span><strong>
		    			<a href="/Discussion/<?php 
                echo $Discussion->DiscussionID;
                ?>
/<?php 
                echo str_replace(" ", "-", $Discussion->Name);
                ?>
"><?php 
                echo $Discussion->Name;
                ?>
</a>
					</span></strong></li>
				<?php 
                $i++;
            }
            ?>
			</ul>
		</div>
		<?php 
        }
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
开发者ID:ru4,项目名称:arabbnota,代码行数:48,代码来源:class.latestcommentmodule.php

示例13: Delete

 public function Delete($Category, $ReplacementCategoryID)
 {
     // Don't do anything if the required category object & properties are not defined.
     if (!is_object($Category) || !property_exists($Category, 'CategoryID') || !property_exists($Category, 'ParentCategoryID') || !property_exists($Category, 'AllowDiscussions') || !property_exists($Category, 'Name') || $Category->CategoryID <= 0) {
         throw new Exception(Gdn::Translate('Invalid category for deletion.'));
     } else {
         // Remove permissions.
         $PermissionModel = Gdn::PermissionModel();
         $PermissionModel->Delete(NULL, 'Category', 'CategoryID', $Category->CategoryID);
         // If there is a replacement category...
         if ($ReplacementCategoryID > 0) {
             // Update children categories
             $this->SQL->Update('Category')->Set('ParentCategoryID', $ReplacementCategoryID)->Where('ParentCategoryID', $Category->CategoryID)->Put();
             // Update discussions
             $this->SQL->Update('Discussion')->Set('CategoryID', $ReplacementCategoryID)->Where('CategoryID', $Category->CategoryID)->Put();
             // Update the discussion count
             $Count = $this->SQL->Select('DiscussionID', 'count', 'DiscussionCount')->From('Discussion')->Where('CategoryID', $ReplacementCategoryID)->Get()->FirstRow()->DiscussionCount;
             if (!is_numeric($Count)) {
                 $Count = 0;
             }
             $this->SQL->Update('Category')->Set('CountDiscussions', $Count)->Where('CategoryID', $ReplacementCategoryID)->Put();
         } else {
             // Delete comments in this category
             $this->SQL->From('Comment')->Join('Discussion d', 'c.DiscussionID = d.DiscussionID')->Delete('Comment c', array('d.CategoryID' => $Category->CategoryID));
             // Delete discussions in this category
             $this->SQL->Delete('Discussion', array('CategoryID' => $Category->CategoryID));
         }
         // Delete the category
         $this->SQL->Delete('Category', array('CategoryID' => $Category->CategoryID));
         // If there are no parent categories left, make sure that all other
         // categories are not assigned
         if ($this->SQL->Select('CategoryID')->From('Category')->Where('AllowDiscussions', '0')->Get()->NumRows() == 0) {
             $this->SQL->Update('Category')->Set('ParentCategoryID', 'null', FALSE)->Put();
         }
         // If there is only one category, make sure that Categories are not used
         $CountCategories = $this->Get()->NumRows();
         $Config = Gdn::Factory(Gdn::AliasConfig);
         $Config->Load(PATH_CONF . DS . 'config.php', 'Save');
         $Config->Set('Vanilla.Categories.Use', $CountCategories > 1, TRUE, 'ForSave');
         $Config->Save();
     }
     // Make sure to reorganize the categories after deletes
     $this->Organize();
 }
开发者ID:Valooo,项目名称:Garden,代码行数:44,代码来源:class.categorymodel.php

示例14: Base_Render_Before

 public function Base_Render_Before(&$Sender)
 {
     // Add menu items.
     $Session = Gdn::Session();
     if ($Sender->Menu) {
         $Sender->Menu->AddLink('Dashboard', 'Dashboard', '/garden/settings', array('Garden.Settings.Manage'));
         $Sender->Menu->AddLink('Dashboard', 'Users', '/user/browse', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'));
         $Sender->Menu->AddLink('Activity', 'Activity', '/activity');
         $Authenticator = Gdn::Authenticator();
         if ($Session->IsValid()) {
             $Sender->Menu->AddLink('SignOut', 'Sign Out', '/entry/leave/{Session_TransientKey}', FALSE, array('class' => 'NonTab'));
             $Notifications = Gdn::Translate('Notifications');
             $CountNotifications = $Session->User->CountNotifications;
             if (is_numeric($CountNotifications) && $CountNotifications > 0) {
                 $Notifications .= '<span>' . $CountNotifications . '</span>';
             }
             $Sender->Menu->AddLink('User', '{Username}', '/profile/{Username}', array('Garden.SignIn.Allow'));
             $Sender->Menu->AddLink('User', '\\' . $Notifications, 'profile/notifications/{Username}');
         } else {
             $Sender->Menu->AddLink('Entry', 'Sign In', $Authenticator->SignInUrl());
         }
     }
     // Enable theme previewing
     if ($Session->IsValid()) {
         $PreviewTheme = $Session->GetPreference('PreviewTheme', '');
         if ($PreviewTheme != '') {
             $Sender->Theme = $PreviewTheme;
         }
     }
     // Add Message Modules (if necessary)
     $MessageCache = Gdn::Config('Garden.Messages.Cache', array());
     $Location = $Sender->Application . '/' . substr($Sender->ControllerName, 0, -10) . '/' . $Sender->RequestMethod;
     if (in_array('Base', $MessageCache) || InArrayI($Location, $MessageCache)) {
         $MessageModel = new Gdn_MessageModel();
         $MessageData = $MessageModel->GetMessagesForLocation($Location);
         foreach ($MessageData as $Message) {
             $MessageModule = new Gdn_MessageModule($Sender, $Message);
             $Sender->AddModule($MessageModule);
         }
     }
 }
开发者ID:Valooo,项目名称:Garden,代码行数:41,代码来源:hooks.php

示例15: Base_GetAppSettingsMenuItems_Handler

 public function Base_GetAppSettingsMenuItems_Handler(&$Sender)
 {
     $Menu =& $Sender->EventArguments['SideMenu'];
     $Menu->AddItem('Dashboard', Gdn::Translate('Dashboard'));
     $Menu->AddLink('Dashboard', Gdn::Translate('Dashboard'), 'garden/settings', 'Garden.Settings.Manage');
     $Menu->AddItem('Site Settings', Gdn::Translate('Site Settings'));
     $Menu->AddLink('Site Settings', Gdn::Translate('General'), 'garden/settings/configure', 'Garden.Settings.Manage');
     $Menu->AddLink('Site Settings', Gdn::Translate('Routes'), 'garden/routes', 'Garden.Routes.Manage');
     $Menu->AddLink('Site Settings', Gdn::Translate('Messages'), 'garden/message', 'Garden.Messages.Manage');
     $Menu->AddItem('Add-ons', Gdn::Translate('Add-ons'));
     $Menu->AddLink('Add-ons', Gdn::Translate('Applications'), 'garden/settings/applications', 'Garden.Applications.Manage');
     $Menu->AddLink('Add-ons', Gdn::Translate('Plugins'), 'garden/settings/plugins', 'Garden.Applications.Manage');
     $Menu->AddLink('Add-ons', Gdn::Translate('Themes'), 'garden/settings/themes', 'Garden.Themes.Manage');
     $Menu->AddItem('Users', Gdn::Translate('Users'));
     $Menu->AddLink('Users', Gdn::Translate('Users'), 'garden/user', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'));
     $Menu->AddLink('Users', Gdn::Translate('Roles & Permissions'), 'garden/role', 'Garden.Roles.Manage');
     $Menu->AddLink('Users', Gdn::Translate('Registration'), 'garden/settings/registration', 'Garden.Registration.Manage');
     if (Gdn::Config('Garden.Registration.Method') == 'Approval') {
         $Menu->AddLink('Users', Gdn::Translate('Applicants'), 'garden/user/applicants', 'Garden.Applicants.Manage');
     }
 }
开发者ID:stinie,项目名称:Garden,代码行数:21,代码来源:hooks.php


注:本文中的Gdn::Translate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。