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


PHP Gdn_Controller::AddAsset方法代码示例

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


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

示例1: SettingsController_Render_Before

 /**
  *
  * @param Gdn_Controller $Sender
  * @param array $Args
  */
 public function SettingsController_Render_Before($Sender, $Args)
 {
     if (strcasecmp($Sender->RequestMethod, 'locales') != 0) {
         return;
     }
     // Add a little pointer to the settings.
     $Text = '<div class="Info">' . sprintf(T('Locale Developer Settings %s.'), Anchor(T('here'), '/dashboard/settings/localedeveloper')) . '</div>';
     $Sender->AddAsset('Content', $Text, 'LocaleDeveloperLink');
 }
开发者ID:TiGR,项目名称:Addons,代码行数:14,代码来源:class.localedeveloper.plugin.php

示例2: ProfileController_AddProfileTabs_Handler

 /**
  * Handling the event fired at the end of the BuildProfile method of the Profile controller
  * If a valid Steam ID is found, load the profile and add it to the profile sidebar.
  * If no valid Steam ID is found, do nothing.
  *
  * @param Gdn_Controller $Sender
  */
 public function ProfileController_AddProfileTabs_Handler(&$Sender)
 {
     // Instantiating our SteamProfile model and attempting to retrieve the profile data
     $this->SteamProfileModel = new SteamProfileModel();
     // Rustling up the SteamID64 data associated with the user, if available
     $UserMetaSteamID64 = $this->GetUserMeta($Sender->User->UserID, 'SteamID64');
     $SteamID64 = GetValue('Plugin.steamprofile.SteamID64', $UserMetaSteamID64, '');
     // Attempting to retrieve the profile data associated with the SteamID64 field
     $Sender->SetData('SteamProfile', $this->SteamProfileModel->GetByID($SteamID64));
     // Did we get back a valid profile?
     if ($Sender->Data('SteamProfile', FALSE)) {
         // Is there a record(s) for this user's "Most Played Games"?
         if (isset($Sender->Data('SteamProfile')->mostPlayedGames->mostPlayedGame)) {
             // If there are several results, there will be an array of elements.  Is there an array of elements?
             if (is_array($Sender->Data('SteamProfile')->mostPlayedGames->mostPlayedGame)) {
                 //  ...if so, grab the first one.
                 $Sender->SetData('MostPlayedGame', $Sender->Data('SteamProfile')->mostPlayedGames->mostPlayedGame[0]);
             } else {
                 // ...if not, grab the single element.
                 $Sender->SetData('MostPlayedGame', $Sender->Data('SteamProfile')->mostPlayedGames->mostPlayedGame);
             }
         }
         // Attach the style sheet, load up the view, attach it all to the panel
         $Sender->AddCssFile('style.css', 'plugins/steamprofile');
         $Sender->AddAsset('Panel', $Sender->FetchView($this->GetView('panel.php')), 'Steam');
     }
 }
开发者ID:29th,项目名称:VanillaAddons,代码行数:34,代码来源:class.steamprofile.plugin.php

示例3: Base_Render_Before

   /**
    *
    * @param Gdn_Controller $Sender
    */
   public function Base_Render_Before(&$Sender) {
      $Session = Gdn::Session();

      // Enable theme previewing
      if ($Session->IsValid()) {
         $PreviewThemeName = $Session->GetPreference('PreviewThemeName', '');
         if ($PreviewThemeName != '') {
            $Sender->Theme = $PreviewThemeName;
            $Sender->AddAsset('Foot', $Sender->FetchView('previewtheme', 'settingscontroller', 'dashboard'));
            $Sender->AddCssFile('previewtheme.css');
         }
      }

      if ($Session->IsValid() && $EmailKey = Gdn::Session()->GetAttribute('EmailKey')) {
         $NotifyEmailConfirm = TRUE;
         
         // If this user was manually moved out of the confirmation role, get rid of their 'awaiting confirmation' flag
         $ConfirmEmailRole = C('Garden.Registration.ConfirmEmailRole', FALSE);
         
         $UserRoles = array();
         $RoleData = Gdn::UserModel()->GetRoles($Session->UserID);
         if ($RoleData !== FALSE && $RoleData->NumRows() > 0) 
            $UserRoles = ConsolidateArrayValuesByKey($RoleData->Result(DATASET_TYPE_ARRAY), 'RoleID','Name');
         
         if ($ConfirmEmailRole !== FALSE && !array_key_exists($ConfirmEmailRole, $UserRoles)) {
            Gdn::UserModel()->SaveAttribute($Session->UserID, "EmailKey", NULL);
            $NotifyEmailConfirm = FALSE;
         }
         
         if ($NotifyEmailConfirm) {
            $Message = FormatString(T('You need to confirm your email address.', 'You need to confirm your email address. Click <a href="{/entry/emailconfirmrequest,url}">here</a> to resend the confirmation email.'));
            $Sender->InformMessage($Message, '');
         }
      }

      // Add Message Modules (if necessary)
      $MessageCache = Gdn::Config('Garden.Messages.Cache', array());
      $Location = $Sender->Application.'/'.substr($Sender->ControllerName, 0, -10).'/'.$Sender->RequestMethod;
		$Exceptions = array('[Base]');
		if ($Sender->MasterView == 'admin')
			$Exceptions[] = '[Admin]';
		else if (in_array($Sender->MasterView, array('', 'default')))
			$Exceptions[] = '[NonAdmin]';
			
      if (GetValue('MessagesLoaded', $Sender) != '1' && $Sender->MasterView != 'empty' && ArrayInArray($Exceptions, $MessageCache, FALSE) || InArrayI($Location, $MessageCache)) {
         $MessageModel = new MessageModel();
         $MessageData = $MessageModel->GetMessagesForLocation($Location, $Exceptions);
         foreach ($MessageData as $Message) {
            $MessageModule = new MessageModule($Sender, $Message);
            $Sender->AddModule($MessageModule);
         }
			$Sender->MessagesLoaded = '1'; // Fixes a bug where render gets called more than once and messages are loaded/displayed redundantly.
      }
		// If there are applicants, alert admins by showing in the main menu
		if (in_array($Sender->MasterView, array('', 'default')) && $Sender->Menu && C('Garden.Registration.Method') == 'Approval') {
			$CountApplicants = Gdn::UserModel()->GetApplicantCount();
			if ($CountApplicants > 0)
				$Sender->Menu->AddLink('Applicants', T('Applicants').' <span class="Alert">'.$CountApplicants.'</span>', '/dashboard/user/applicants', array('Garden.Applicants.Manage'));
		}
		
      if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
         $Gdn_Statistics = Gdn::Factory('Statistics');
         $Gdn_Statistics->Check($Sender);
      }
		
		// Allow forum embedding
		$Sender->AddJsFile('js/embed_local.js');
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:72,代码来源:class.hooks.php


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