/** * Add the rtl stylesheets to the page. * * The rtl stylesheets should always be added separately so that they aren't combined with other stylesheets when * a non-rtl language is still being displayed. * * @param Gdn_Controller $Sender */ public function Base_Render_Before(&$Sender) { $currentLocale = substr(Gdn::Locale()->Current(), 0, 2); if (in_array($currentLocale, $this->rtlLocales)) { if (InSection('Dashboard')) { $Sender->AddCssFile('admin_rtl.css', 'plugins/RightToLeft'); } else { $Sender->AddCssFile('style_rtl.css', 'plugins/RightToLeft'); } $Sender->CssClass .= ' rtl'; } }
/** * Insert buttonbar resources * * This method is abstracted because it is invoked by two different * controllers. * * @param Gdn_Controller $Sender */ protected function AttachButtonBarResources($Sender, $Formatter) { $Sender->AddCssFile('buttonbar.css', 'plugins/ButtonBar'); $Sender->AddJsFile('buttonbar.js', 'plugins/ButtonBar'); $Sender->AddJsFile('jquery.hotkeys.js', 'plugins/ButtonBar'); $Sender->AddDefinition('InputFormat', $Formatter); }
/** * 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'); } }
/** * * @param Gdn_Controller $Sender */ private function _Emotify($Sender) { $Sender->AddJsFile('plugins/Emotify/emotify.js'); $Sender->AddCssFile('plugins/Emotify/emotify.css'); $Sender->AddDefinition('FormatEmoticons', C('Plugins.Emotify.FormatEmoticons', TRUE)); }
/** * Add Wysihtml5 resources * * @param Gdn_Controller $Sender */ private function _AddWysihtml5($Sender) { $Sender->AddCssFile('wysihtml5.css', 'plugins/Wysihtml5'); $Sender->AddCssFile('sprites12.css', 'plugins/Wysihtml5'); $Sender->AddJsFile('advanced.js', 'plugins/Wysihtml5'); $Sender->AddJsFile('wysihtml5.js', 'plugins/Wysihtml5'); $Sender->AddJsFile('initialize.js', 'plugins/Wysihtml5'); $Sender->AddJsFile('underscore.js', 'plugins/Wysihtml5'); }
/** * Add global Yaga resources to all dashboard pages * * @param Gdn_Controller $Sender */ public function Base_Render_Before($Sender) { if ($Sender->MasterView == 'admin') { $Sender->AddCssFile('yaga.css', 'yaga'); } }
/** * * @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'); }
/** * * * @param Gdn_Controller $Sender * @param $Args */ public function base_render_before($Sender, $Args) { if (!Gdn::Session()->UserID) { $Sender->AddJSFile('jsconnect.js', 'plugins/jsconnect'); $Sender->AddCssFile('jsconnect.css', 'plugins/jsconnect'); } }