本文整理汇总了PHP中Gdn_Controller类的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Controller类的具体用法?PHP Gdn_Controller怎么用?PHP Gdn_Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Gdn_Controller类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: informNotifications
/**
* Grabs all new notifications and adds them to the sender's inform queue.
*
* This method gets called by dashboard's hooks file to display new
* notifications on every pageload.
*
* @since 2.0.18
* @access public
*
* @param Gdn_Controller $Sender The object calling this method.
*/
public static function informNotifications($Sender)
{
$Session = Gdn::session();
if (!$Session->isValid()) {
return;
}
$ActivityModel = new ActivityModel();
// Get five pending notifications.
$Where = array('NotifyUserID' => Gdn::session()->UserID, 'Notified' => ActivityModel::SENT_PENDING);
// If we're in the middle of a visit only get very recent notifications.
$Where['DateUpdated >'] = Gdn_Format::toDateTime(strtotime('-5 minutes'));
$Activities = $ActivityModel->getWhere($Where, 0, 5)->resultArray();
$ActivityIDs = array_column($Activities, 'ActivityID');
$ActivityModel->setNotified($ActivityIDs);
$Sender->EventArguments['Activities'] =& $Activities;
$Sender->fireEvent('InformNotifications');
foreach ($Activities as $Activity) {
if ($Activity['Photo']) {
$UserPhoto = anchor(img($Activity['Photo'], array('class' => 'ProfilePhotoMedium')), $Activity['Url'], 'Icon');
} else {
$UserPhoto = '';
}
$Excerpt = Gdn_Format::plainText($Activity['Story']);
$ActivityClass = ' Activity-' . $Activity['ActivityType'];
$Sender->informMessage($UserPhoto . Wrap($Activity['Headline'], 'div', array('class' => 'Title')) . Wrap($Excerpt, 'div', array('class' => 'Excerpt')), 'Dismissable AutoDismiss' . $ActivityClass . ($UserPhoto == '' ? '' : ' HasIcon'));
}
}
开发者ID:austins,项目名称:vanilla,代码行数:38,代码来源:class.notificationscontroller.php
示例2: base_render_before
/**
* Add Timeago to all controllers
*
* @since 2.0.0
* @access public
* @param Gdn_Controller $sender
*/
public function base_render_before($sender)
{
// Plugin definitions for use in Javascript
$definitions = array('locale' => array('prefixAgo' => t('timeago.prefixAgo', null), 'prefixFromNow' => t('timeago.prefixFromNow', null), 'suffixAgo' => t('timeago.suffixAgo', 'ago'), 'suffixFromNow' => t('timeago.suffixFromNow', 'from now'), 'seconds' => t('timeago.seconds', 'less than a minute'), 'minute' => t('timeago.minute', 'about a minute'), 'minutes' => t('timeago.minutes', '%d minutes'), 'hour' => t('timeago.hour', 'about an hour'), 'hours' => t('timeago.hours', 'about %d hours'), 'day' => t('timeago.day', 'a day'), 'days' => t('timeago.days', '%d days'), 'month' => t('timeago.month', 'about a month'), 'months' => t('timeago.months', '%d months'), 'year' => t('timeago.year', 'about a year'), 'years' => t('timeago.years', '%d years'), 'wordSeparator' => t('timeago.wordSeparator', ' '), 'numbers' => array()));
$sender->addDefinition('Timeago', json_encode($definitions));
// Add required assets
$sender->addJsFile('timeago.min.js', 'plugins/timeago');
}
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:15,代码来源:class.timeago.plugin.php
示例3: AttachButtonBar
/**
* Attach button bar in place
*
* This method is abstracted because it is called from multiple places, due
* to the way that the comment.php view is invoked both by the DiscussionController
* and the PostController.
*
* @param Gdn_Controller $Sender
*/
protected function AttachButtonBar($Sender, $Wrap = FALSE)
{
$View = $Sender->FetchView('buttonbar', '', 'plugins/ButtonBar');
if ($Wrap) {
echo Wrap($View, 'div', array('class' => 'P'));
} else {
echo $View;
}
}
开发者ID:seedbank,项目名称:old-repo,代码行数:18,代码来源:class.buttonbar.plugin.php
示例4: render
/**
* Wrapper for captcha rendering.
*
* Allows conditional ignoring of captcha rendering if skipped in the config.
*
* @param Gdn_Controller $controller
* @return null;
*/
public static function render($controller)
{
if (!Captcha::enabled()) {
return null;
}
// Hook to allow rendering of captcha form
$controller->fireAs('captcha')->fireEvent('render');
return null;
}
开发者ID:R-J,项目名称:vanilla,代码行数:17,代码来源:class.captcha.php
示例5: settingsController_vanillicon_create
/**
* The settings page for vanillicon.
*
* @param Gdn_Controller $sender
*/
public function settingsController_vanillicon_create($sender)
{
$sender->permission('Garden.Settings.Manage');
$cf = new ConfigurationModule($sender);
$items = array('v1' => 'Vanillicon 1', 'v2' => 'Vanillicon 2');
$cf->initialize(array('Plugins.Vanillicon.Type' => array('LabelCode' => 'Vanillicon Set', 'Control' => 'radiolist', 'Description' => 'Which vanillicon set do you want to use?', 'Items' => $items, 'Options' => array('display' => 'after'), 'Default' => 'v1')));
$sender->setData('Title', sprintf(t('%s Settings'), 'Vanillicon'));
$cf->renderAll();
}
开发者ID:vanilla,项目名称:vanilla,代码行数:14,代码来源:class.vanillicon.plugin.php
示例6: 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
示例7: Base_Render_Before
/**
* 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';
}
}
开发者ID:SatiricMan,项目名称:addons,代码行数:20,代码来源:class.righttoleft.plugin.php
示例8: EntryController_Render_Before
/**
* @param Gdn_Controller $Sender
* @param array $Args
*/
public function EntryController_Render_Before($Sender, $Args)
{
if ($Sender->RequestMethod != 'passwordreset') {
return;
}
if (isset($Sender->Data['User'])) {
// Get all of the users with the same email.
$Email = $Sender->Data('User.Email');
$Users = Gdn::SQL()->Select('Name')->From('User')->Where('Email', $Email)->Get()->ResultArray();
$Names = array_column($Users, 'Name');
SetValue('Name', $Sender->Data['User'], implode(', ', $Names));
}
}
开发者ID:vanilla,项目名称:addons,代码行数:17,代码来源:class.emailpasswordsync.plugin.php
示例9: initialize
/**
* Adds JS, CSS, & modules. Automatically run on every use.
*
* @since 2.0.0
* @access public
*/
public function initialize()
{
$this->ModuleSortContainer = 'Profile';
$this->Head = new HeadModule($this);
$this->addJsFile('jquery.js');
$this->addJsFile('jquery.form.js');
$this->addJsFile('jquery.popup.js');
$this->addJsFile('jquery.gardenhandleajaxform.js');
$this->addJsFile('jquery.autosize.min.js');
$this->addJsFile('global.js');
$this->addCssFile('style.css');
$this->addCssFile('vanillicon.css', 'static');
$this->addModule('GuestModule');
parent::initialize();
Gdn_Theme::section('Profile');
if ($this->EditMode) {
$this->CssClass .= 'EditMode';
}
/**
* The default Cache-Control header does not include no-store, which can cause issues with outdated session
* information (e.g. message button missing). The same check is performed here as in Gdn_Controller before the
* Cache-Control header is added, but this value includes the no-store specifier.
*/
if (Gdn::session()->isValid()) {
$this->setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');
}
$this->setData('Breadcrumbs', array());
$this->CanEditPhotos = Gdn::session()->checkRankedPermission(c('Garden.Profile.EditPhotos', true)) || Gdn::session()->checkPermission('Garden.Users.Edit');
}
开发者ID:R-J,项目名称:vanilla,代码行数:35,代码来源:class.profilecontroller.php
示例10: attachButtonBarResources
/**
* Insert buttonbar resources
*
* This method is abstracted because it is invoked by multiple controllers.
*
* @param Gdn_Controller $Sender
*/
protected function attachButtonBarResources($Sender, $Formatter)
{
if (!in_array($Formatter, $this->Formats)) {
return;
}
$Sender->addJsFile('buttonbar.js', 'plugins/ButtonBar');
$Sender->addJsFile('jquery.hotkeys.js', 'plugins/ButtonBar');
$Sender->addDefinition('ButtonBarLinkUrl', t('ButtonBar.LinkUrlText', 'Enter your URL:'));
$Sender->addDefinition('ButtonBarImageUrl', t('ButtonBar.ImageUrlText', 'Enter image URL:'));
$Sender->addDefinition('ButtonBarBBCodeHelpText', t('ButtonBar.BBCodeHelp', 'You can use <b><a href="http://en.wikipedia.org/wiki/BBCode" target="_new">BBCode</a></b> in your post.'));
$Sender->addDefinition('ButtonBarHtmlHelpText', t('ButtonBar.HtmlHelp', 'You can use <b><a href="http://htmlguide.drgrog.com/cheatsheet.php" target="_new">Simple Html</a></b> in your post.'));
$Sender->addDefinition('ButtonBarMarkdownHelpText', t('ButtonBar.MarkdownHelp', 'You can use <b><a href="http://en.wikipedia.org/wiki/Markdown" target="_new">Markdown</a></b> in your post.'));
$Sender->addDefinition('InputFormat', $Formatter);
}
开发者ID:adlerj,项目名称:vanilla,代码行数:21,代码来源:class.buttonbar.plugin.php
示例11: Initialize
/**
* This is a good place to include JS, CSS, and modules used by all methods of this controller.
*
* Always called by dispatcher before controller's requested method.
*
* @since 1.0
* @access public
*/
public function Initialize() {
// There are 4 delivery types used by Render().
// DELIVERY_TYPE_ALL is the default and indicates an entire page view.
if ($this->DeliveryType() == DELIVERY_TYPE_ALL)
$this->Head = new HeadModule($this);
// Call Gdn_Controller's Initialize() as well.
parent::Initialize();
}
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:17,代码来源:class.skeletoncontroller.php
示例12: Error
public function Error()
{
$this->RemoveCssFile('admin.css');
$this->AddCssFile('style.css');
$this->MasterView = 'default';
$this->CssClass = 'SplashMessage NoPanel';
$this->SetData('_NoMessages', TRUE);
$Code = $this->Data('Code', 400);
header("HTTP/1.0 {$Code} " . Gdn_Controller::GetStatusMessage($Code), TRUE, $Code);
$this->Render();
}
开发者ID:bishopb,项目名称:vanilla,代码行数:11,代码来源:class.homecontroller.php
示例13: utilityController_teamworkTaskCompleted_create
/**
* Webhook for Teamwork.
*
* POST data looks like this:
* [ 'event' => 'TASK.COMPLETED',
* 'objectId' => '000',
* 'accountId' => '000',
* 'userId' => '000',
* ]
*
* @see http://developer.teamwork.com/todolistitems
*
* @param Gdn_Controller $sender
* @param $secret
* @throws Exception
*/
public function utilityController_teamworkTaskCompleted_create($sender, $secret)
{
if ($secret != c('SprintNotifier.Teamwork.Secret')) {
throw new Exception('Invalid token.');
}
// Get data
$data = Gdn::request()->post();
// Sanity check we set up webhooks right.
if (val('event', $data) != 'TASK.COMPLETED') {
return;
}
// Cheat by storing some data in the config.
$users = c('SprintNotifier.Teamwork.Users', []);
$projects = c('SprintNotifier.Teamwork.Projects', []);
// Get full task data via Teamwork's *ahem* "API".
$task = self::teamworkTask(val('objectId', $data));
// DEBUG
UserModel::setMeta(0, array('TaskAPI' => var_export($task, true)), 'SprintNotifier.Debug.');
// Respect project whitelist if we're using one.
if (count($projects) && !in_array($task['project-name'], $projects)) {
return;
}
// Build data for the chat message.
$teamworkUserID = val('userId', $data);
$userName = val($teamworkUserID, $users, 'User ' . val('userId', $data));
$taskUrl = sprintf('https://%1$s.teamwork.com/tasks/%2$s', c('Teamwork.Account'), val('objectId', $data));
$message = sprintf('%1$s completed %2$s task: <a href="%3$s">%4$s</a>', $userName, strtolower($task['project-name']), $taskUrl, $task['content']);
// Override HipChat plugin's default token & room.
saveToConfig('HipChat.Room', c('SprintNotifier.HipChat.RoomID'), false);
saveToConfig('HipChat.Token', c('SprintNotifier.HipChat.Token'), false);
// DEBUG
UserModel::setMeta(0, array('Message' => var_export($message, true)), 'SprintNotifier.Debug.');
// Say it! Bust it!
if (class_exists('HipChat')) {
HipChat::say($message);
}
self::bustCache();
// 200 OK
$sender->render('blank', 'utility', 'dashboard');
}
开发者ID:vanilla,项目名称:vanilla-sprint,代码行数:56,代码来源:class.sprintnotifier.plugin.php
示例14: error
/**
* Display error page.
*/
public function error()
{
$this->removeCssFile('admin.css');
$this->addCssFile('style.css');
$this->addCssFile('vanillicon.css', 'static');
$this->MasterView = 'default';
$this->CssClass = 'SplashMessage NoPanel';
$this->setData('_NoMessages', true);
$Code = $this->data('Code', 400);
safeheader("HTTP/1.0 {$Code} " . Gdn_Controller::GetStatusMessage($Code), true, $Code);
Gdn_Theme::section('Error');
$this->render();
}
开发者ID:bryanjamesmiller,项目名称:p4,代码行数:16,代码来源:class.homecontroller.php
示例15: FetchViewLocation
public function FetchViewLocation($View = '', $ControllerName = FALSE, $ApplicationFolder = FALSE, $ThrowError = TRUE)
{
if (!$ControllerName) {
$ControllerName = '';
}
return parent::FetchViewLocation($View, $ControllerName, $ApplicationFolder, $ThrowError);
}
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:7,代码来源:class.rootcontroller.php
示例16: fetchViewLocation
/**
* Get the file location of a view.
*
* @param string $view
* @param bool $controllerName
* @param bool $applicationFolder
* @param bool $throwError
* @param bool $useController
* @return bool|mixed
* @throws Exception
*/
public function fetchViewLocation($view = '', $controllerName = false, $applicationFolder = false, $throwError = true, $useController = true)
{
if (!$controllerName) {
$controllerName = '';
}
return parent::fetchViewLocation($view, $controllerName, $applicationFolder, $throwError, $useController);
}
开发者ID:vanilla,项目名称:vanilla,代码行数:18,代码来源:class.rootcontroller.php
示例17: Initialize
public function Initialize()
{
if ($this->DeliveryType() == DELIVERY_TYPE_ALL) {
$this->Head = new HeadModule($this);
}
parent::Initialize();
}
开发者ID:kidmax,项目名称:Garden,代码行数:7,代码来源:appcontroller.php
示例18: fetchViewLocation
/**
* Get the file location of a view.
*
* @param string $View
* @param bool $ControllerName
* @param bool $ApplicationFolder
* @param bool $ThrowError
* @return bool|mixed
* @throws Exception
*/
public function fetchViewLocation($View = '', $ControllerName = false, $ApplicationFolder = false, $ThrowError = true)
{
if (!$ControllerName) {
$ControllerName = '';
}
return parent::fetchViewLocation($View, $ControllerName, $ApplicationFolder, $ThrowError);
}
开发者ID:caidongyun,项目名称:vanilla,代码行数:17,代码来源:class.rootcontroller.php
示例19: Initialize
public function Initialize()
{
parent::Initialize();
$this->_DeliveryMethod = DELIVERY_METHOD_JSON;
//$this->SetHeader("Content-Type", "application/json; charset=utf-8");
$this->SetHeader("Content-Type", "text/plain; charset=utf-8");
$this->MasterView = 'json';
}
开发者ID:gregroiusairlangga,项目名称:vanilla-api-addon,代码行数:8,代码来源:class.apicontroller.php
示例20: Initialize
/**
* All requests to this controller must be made via JS.
*
* @throws PermissionException
*/
public function Initialize()
{
parent::Initialize();
$this->Application = 'Yaga';
if (!$this->Request->IsPostBack()) {
throw PermissionException('Javascript');
}
}
开发者ID:hxii,项目名称:Application-Yaga,代码行数:13,代码来源:class.reactcontroller.php
注:本文中的Gdn_Controller类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论