本文整理汇总了PHP中Gdn::ApplicationManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn::ApplicationManager方法的具体用法?PHP Gdn::ApplicationManager怎么用?PHP Gdn::ApplicationManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn
的用法示例。
在下文中一共展示了Gdn::ApplicationManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* Emulate a call to index.php?p=$vanilla_module_path
* Much of this ripped out of Vanilla's index.php
*/
public function view($segments)
{
// if a static asset, return it outright
$asset = $this->is_static_asset($segments);
if ($asset) {
return \Response::make(\File::get($asset))->header('Content-Type', $this->get_content_type($asset));
}
// otherwise, dispatch into vanilla
$user = $this->user;
$bootstrap = new VanillaBootstrap();
$bootstrap->call(function () use($user, $segments) {
// Create the session and stuff the user in
\Gdn::Authenticator()->SetIdentity($user->getKey(), false);
\Gdn::Session()->Start(false, false);
\Gdn::Session()->SetPreference('Authenticator', 'Gdn_Authenticator');
// Create and configure the dispatcher.
$Dispatcher = \Gdn::Dispatcher();
$EnabledApplications = \Gdn::ApplicationManager()->EnabledApplicationFolders();
$Dispatcher->EnabledApplicationFolders($EnabledApplications);
$Dispatcher->PassProperty('EnabledApplications', $EnabledApplications);
// Process the request.
$Dispatcher->Start();
$Dispatcher->Dispatch(implode('/', $segments));
});
}
示例2: Gdn_Dispatcher_AfterAnalyzeRequest_Handler
/**
* Set user's preferred locale.
*
* Moved event from AppStart to AfterAnalyzeRequest to allow Embed to set P3P header first.
*/
public function Gdn_Dispatcher_AfterAnalyzeRequest_Handler($Sender)
{
// Set user preference
if ($TempLocale = $this->GetAlternateLocale()) {
Gdn::Locale()->Set($TempLocale, Gdn::ApplicationManager()->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders());
}
}
示例3: Attach
/**
* Attach mappings for vanilla extension folders
*
* @param string $ExtensionType type of extension to map. one of: CONTEXT_THEME, CONTEXT_PLUGIN, CONTEXT_APPLICATION
*/
public static function Attach($ExtensionType)
{
switch ($ExtensionType) {
case self::CONTEXT_APPLICATION:
if (Gdn::ApplicationManager() instanceof Gdn_ApplicationManager) {
$EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders();
foreach ($EnabledApplications as $EnabledApplication) {
self::AttachApplication($EnabledApplication);
}
}
break;
case self::CONTEXT_PLUGIN:
if (Gdn::PluginManager() instanceof Gdn_PluginManager) {
foreach (Gdn::PluginManager()->SearchPaths() as $SearchPath => $SearchPathName) {
if ($SearchPathName === TRUE || $SearchPathName == 1) {
$SearchPathName = md5($SearchPath);
}
// If we have already loaded the plugin manager, use its internal folder list
if (Gdn::PluginManager()->Started()) {
$Folders = Gdn::PluginManager()->EnabledPluginFolders($SearchPath);
foreach ($Folders as $PluginFolder) {
$FullPluginPath = CombinePaths(array($SearchPath, $PluginFolder));
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_PLUGIN, $FullPluginPath, array('SearchSubfolders' => TRUE, 'Extension' => $SearchPathName, 'Structure' => Gdn_Autoloader_Map::STRUCTURE_SPLIT, 'SplitTopic' => strtolower($PluginFolder)));
}
}
}
}
break;
case self::CONTEXT_THEME:
break;
}
}
示例4: Refresh
/**
* Reload the locale system
*/
public function Refresh()
{
$LocalName = $this->Current();
$ApplicationWhiteList = Gdn::ApplicationManager()->EnabledApplicationFolders();
$PluginWhiteList = Gdn::PluginManager()->EnabledPluginFolders();
$ForceRemapping = TRUE;
$this->Set($LocalName, $ApplicationWhiteList, $PluginWhiteList, $ForceRemapping);
}
示例5: __construct
public function __construct()
{
parent::__construct();
if (Gdn::PluginManager()->CheckPlugin('Reactions') && C('Plugins.QnA.Reactions', TRUE)) {
$this->Reactions = TRUE;
}
if (Gdn::ApplicationManager()->CheckApplication('Reputation') && C('Plugins.QnA.Badges', TRUE)) {
$this->Badges = TRUE;
}
}
示例6: EnabledApplication
/**
* Returns the name of the enabled application based on $ApplicationFolder.
*
* @param string The application folder related to the application name you want to return.
*/
public function EnabledApplication($ApplicationFolder = '')
{
if ($ApplicationFolder == '') {
$ApplicationFolder = $this->_ApplicationFolder;
}
foreach (Gdn::ApplicationManager()->AvailableApplications() as $ApplicationName => $ApplicationInfo) {
if (GetValue('Folder', $ApplicationInfo, FALSE) === $ApplicationFolder) {
$EnabledApplication = $ApplicationName;
$this->EventArguments['EnabledApplication'] = $EnabledApplication;
$this->FireEvent('AfterEnabledApplication');
return $EnabledApplication;
}
}
return FALSE;
}
示例7: is_numeric
$CNotifications = is_numeric($CountNotifications) && $CountNotifications > 0 ? '<span class="Alert">' . $CountNotifications . '</span>' : '';
echo '<span class="ToggleFlyout" rel="/profile/notificationspopin">';
echo Anchor(Sprite('SpNotifications', 'Sprite Sprite16') . Wrap(T('Notifications'), 'em') . $CNotifications, UserUrl($User), 'MeButton FlyoutButton', array('title' => T('Notifications')));
echo Sprite('SpFlyoutHandle', 'Arrow');
echo '<div class="Flyout FlyoutMenu"></div></span>';
// Inbox
if (Gdn::ApplicationManager()->CheckApplication('Conversations')) {
$CountInbox = GetValue('CountUnreadConversations', Gdn::Session()->User);
$CInbox = is_numeric($CountInbox) && $CountInbox > 0 ? ' <span class="Alert">' . $CountInbox . '</span>' : '';
echo '<span class="ToggleFlyout" rel="/messages/popin">';
echo Anchor(Sprite('SpInbox', 'Sprite Sprite16') . Wrap(T('Inbox'), 'em') . $CInbox, '/messages/all', 'MeButton FlyoutButton', array('title' => T('Inbox')));
echo Sprite('SpFlyoutHandle', 'Arrow');
echo '<div class="Flyout FlyoutMenu"></div></span>';
}
// Bookmarks
if (Gdn::ApplicationManager()->CheckApplication('Vanilla')) {
echo '<span class="ToggleFlyout" rel="/discussions/bookmarkedpopin">';
echo Anchor(Sprite('SpBookmarks', 'Sprite Sprite16') . Wrap(T('Bookmarks'), 'em'), '/discussions/bookmarked', 'MeButton FlyoutButton', array('title' => T('Bookmarks')));
echo Sprite('SpFlyoutHandle', 'Arrow');
echo '<div class="Flyout FlyoutMenu"></div></span>';
}
// Profile Settings & Logout
echo '<span class="ToggleFlyout">';
$CDashboard = $DashboardCount > 0 ? Wrap($DashboardCount, 'span class="Alert"') : '';
echo Anchor(Sprite('SpOptions', 'Sprite Sprite16') . Wrap(T('Account Options'), 'em') . $CDashboard, '/profile/edit', 'MeButton FlyoutButton', array('title' => T('Account Options')));
echo Sprite('SpFlyoutHandle', 'Arrow');
echo '<div class="Flyout MenuItems">';
echo '<ul>';
// echo Wrap(Wrap(T('My Account'), 'strong'), 'li');
// echo Wrap('<hr />', 'li');
echo Wrap(Anchor(Sprite('SpEditProfile') . ' ' . T('Edit Profile'), 'profile/edit'), 'li');
示例8: Link
public static function Link($Path, $Text = FALSE, $Format = NULL, $Options = array())
{
$Session = Gdn::Session();
$Class = GetValue('class', $Options, '');
$WithDomain = GetValue('WithDomain', $Options);
$Target = GetValue('Target', $Options, '');
if ($Target == 'current') {
$Target = trim(Url('', TRUE), '/ ');
}
if (is_null($Format)) {
$Format = '<a href="%url" class="%class">%text</a>';
}
switch ($Path) {
case 'activity':
TouchValue('Permissions', $Options, 'Garden.Activity.View');
break;
case 'category':
$Breadcrumbs = Gdn::Controller()->Data('Breadcrumbs');
if (is_array($Breadcrumbs) && count($Breadcrumbs) > 0) {
$Last = array_pop($Breadcrumbs);
$Path = GetValue('Url', $Last);
$DefaultText = GetValue('Name', $Last, T('Back'));
} else {
$Path = '/';
$DefaultText = C('Garden.Title', T('Back'));
}
if (!$Text) {
$Text = $DefaultText;
}
break;
case 'dashboard':
$Path = 'dashboard/settings';
TouchValue('Permissions', $Options, array('Garden.Settings.Manage', 'Garden.Settings.View'));
if (!$Text) {
$Text = T('Dashboard');
}
break;
case 'home':
$Path = '/';
if (!$Text) {
$Text = T('Home');
}
break;
case 'inbox':
$Path = 'messages/inbox';
TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
if (!$Text) {
$Text = T('Inbox');
}
if ($Session->IsValid() && $Session->User->CountUnreadConversations) {
$Class = trim($Class . ' HasCount');
$Text .= ' <span class="Alert">' . $Session->User->CountUnreadConversations . '</span>';
}
if (!$Session->IsValid() || !Gdn::ApplicationManager()->CheckApplication('Conversations')) {
$Text = FALSE;
}
break;
case 'forumroot':
$Route = Gdn::Router()->GetDestination('DefaultForumRoot');
if (is_null($Route)) {
$Path = '/';
} else {
$Path = CombinePaths(array('/', $Route));
}
break;
case 'profile':
TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
if (!$Text && $Session->IsValid()) {
$Text = $Session->User->Name;
}
if ($Session->IsValid() && $Session->User->CountNotifications) {
$Class = trim($Class . ' HasCount');
$Text .= ' <span class="Alert">' . $Session->User->CountNotifications . '</span>';
}
break;
case 'user':
$Path = 'profile';
TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
if (!$Text && $Session->IsValid()) {
$Text = $Session->User->Name;
}
break;
case 'photo':
$Path = 'profile';
TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
if (!$Text && $Session->IsValid()) {
$IsFullPath = strtolower(substr($Session->User->Photo, 0, 7)) == 'http://' || strtolower(substr($Session->User->Photo, 0, 8)) == 'https://';
$PhotoUrl = $IsFullPath ? $Session->User->Photo : Gdn_Upload::Url(ChangeBasename($Session->User->Photo, 'n%s'));
$Text = Img($PhotoUrl, array('alt' => htmlspecialchars($Session->User->Name)));
}
break;
case 'drafts':
TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
if (!$Text) {
$Text = T('My Drafts');
}
if ($Session->IsValid() && $Session->User->CountDrafts) {
$Class = trim($Class . ' HasCount');
$Text .= ' <span class="Alert">' . $Session->User->CountDrafts . '</span>';
}
//.........这里部分代码省略.........
示例9: ETag
/** Generate an e-tag for the application from the versions of all of its enabled applications/plugins. **/
public static function ETag()
{
$Data = array();
$Data['vanilla-core-' . APPLICATION_VERSION] = TRUE;
$Plugins = Gdn::PluginManager()->EnabledPlugins();
foreach ($Plugins as $Info) {
$Data[strtolower("{$Info['Index']}-plugin-{$Info['Version']}")] = TRUE;
}
// echo(Gdn_Upload::FormatFileSize(strlen(serialize($Plugins))));
// decho($Plugins);
$Applications = Gdn::ApplicationManager()->EnabledApplications();
foreach ($Applications as $Info) {
$Data[strtolower("{$Info['Index']}-app-{$Info['Version']}")] = TRUE;
}
// Add the desktop theme version.
$Info = Gdn::ThemeManager()->GetThemeInfo(Gdn::ThemeManager()->DesktopTheme());
if (!empty($Info)) {
$Version = GetValue('Version', $Info, 'v0');
$Data[strtolower("{$Info['Index']}-theme-{$Version}")] = TRUE;
if (Gdn::Controller()->Theme && Gdn::Controller()->ThemeOptions) {
$Filenames = GetValueR('Styles.Value', Gdn::Controller()->ThemeOptions);
$Data[$Filenames] = TRUE;
}
}
// Add the mobile theme version.
$Info = Gdn::ThemeManager()->GetThemeInfo(Gdn::ThemeManager()->MobileTheme());
if (!empty($Info)) {
$Version = GetValue('Version', $Info, 'v0');
$Data[strtolower("{$Info['Index']}-theme-{$Version}")] = TRUE;
}
Gdn::PluginManager()->EventArguments['ETagData'] =& $Data;
$Suffix = '';
Gdn::PluginManager()->EventArguments['Suffix'] =& $Suffix;
Gdn::PluginManager()->FireAs('AssetModel')->FireEvent('GenerateETag');
unset(Gdn::PluginManager()->EventArguments['ETagData']);
ksort($Data);
$Result = substr(md5(implode(',', array_keys($Data))), 0, 8) . $Suffix;
// decho($Data);
// die();
return $Result;
}
示例10: asset
/**
* Takes the path to an asset (image, js file, css file, etc) and prepends the webroot.
*
* @param string $Destination
* @param boolean $WithDomain
* @param boolean $AddVersion
* @param string $Version Forced version, skips auto-lookup.
* @return string
*/
function asset($Destination = '', $WithDomain = false, $AddVersion = false, $Version = null)
{
$Destination = str_replace('\\', '/', $Destination);
if (IsUrl($Destination)) {
$Result = $Destination;
} else {
$Result = Gdn::Request()->UrlDomain($WithDomain) . Gdn::Request()->AssetRoot() . '/' . ltrim($Destination, '/');
}
if ($AddVersion) {
if (strpos($Result, '?') === false) {
$Result .= '?';
} else {
$Result .= '&';
}
// Figure out which version to put after the asset.
if (is_null($Version)) {
$Version = APPLICATION_VERSION;
if (preg_match('`^/([^/]+)/([^/]+)/`', $Destination, $Matches)) {
$Type = $Matches[1];
$Key = $Matches[2];
static $ThemeVersion = null;
switch ($Type) {
case 'plugins':
$PluginInfo = Gdn::PluginManager()->GetPluginInfo($Key);
$Version = val('Version', $PluginInfo, $Version);
break;
case 'applications':
$AppInfo = Gdn::ApplicationManager()->GetApplicationInfo(ucfirst($Key));
$Version = val('Version', $AppInfo, $Version);
break;
case 'themes':
if ($ThemeVersion === null) {
$ThemeInfo = Gdn::ThemeManager()->GetThemeInfo(Theme());
if ($ThemeInfo !== false) {
$ThemeVersion = val('Version', $ThemeInfo, $Version);
} else {
$ThemeVersion = $Version;
}
}
$Version = $ThemeVersion;
break;
}
}
}
$Result .= 'v=' . urlencode($Version);
}
return $Result;
}
示例11: Attach
/**
* Attach mappings for vanilla extension folders
*
* @param string $ExtensionType type of extension to map. one of: CONTEXT_THEME, CONTEXT_PLUGIN, CONTEXT_APPLICATION
*/
public static function Attach($ExtensionType) {
switch ($ExtensionType) {
case self::CONTEXT_APPLICATION:
if (Gdn::ApplicationManager() instanceof Gdn_ApplicationManager) {
$EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders();
foreach ($EnabledApplications as $EnabledApplication) {
$ApplicationPath = CombinePaths(array(PATH_APPLICATIONS."/{$EnabledApplication}"));
$AppControllers = CombinePaths(array($ApplicationPath."/controllers"));
self::RegisterMap(self::MAP_CONTROLLER, self::CONTEXT_APPLICATION, $AppControllers, array(
'SearchSubfolders' => FALSE,
'Extension' => $EnabledApplication
));
$AppModels = CombinePaths(array($ApplicationPath."/models"));
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_APPLICATION, $AppModels, array(
'SearchSubfolders' => FALSE,
'Extension' => $EnabledApplication,
'ClassFilter' => '*model'
));
$AppModules = CombinePaths(array($ApplicationPath."/modules"));
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_APPLICATION, $AppModules, array(
'SearchSubfolders' => FALSE,
'Extension' => $EnabledApplication,
'ClassFilter' => '*module'
));
$AppLibrary = CombinePaths(array($ApplicationPath."/library"));
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_APPLICATION, $AppLibrary, array(
'SearchSubfolders' => FALSE,
'Extension' => $EnabledApplication,
'ClassFilter' => '*'
));
}
}
break;
case self::CONTEXT_PLUGIN:
if (Gdn::PluginManager() instanceof Gdn_PluginManager) {
foreach (Gdn::PluginManager()->SearchPaths() as $SearchPath => $SearchPathName) {
if ($SearchPathName === TRUE || $SearchPathName == 1)
$SearchPathName = md5($SearchPath);
// If we have already loaded the plugin manager, use its internal folder list
if (Gdn::PluginManager()->Started()) {
$Folders = Gdn::PluginManager()->EnabledPluginFolders($SearchPath);
foreach ($Folders as $PluginFolder) {
$FullPluginPath = CombinePaths(array($SearchPath, $PluginFolder));
self::RegisterMap(self::MAP_LIBRARY, self::CONTEXT_PLUGIN, $FullPluginPath, array(
'SearchSubfolders' => TRUE,
'Extension' => $SearchPathName
));
}
}
}
}
break;
case self::CONTEXT_THEME:
break;
}
}
示例12: Gdn_Validation
// To run queries.
$Construct = $Database->Structure();
// To modify and add database tables.
$Validation = new Gdn_Validation();
// To validate permissions (if necessary).
include_once PATH_APPLICATIONS . '/candy/models/class.sectionmodel.php';
include_once PATH_APPLICATIONS . '/candy/settings/bootstrap.php';
Gdn::Structure()->Table('Chunk')->PrimaryKey('ChunkID', 'usmallint')->Column('Name', 'varchar(80)')->Column('Body', 'text', True)->Column('Format', 'varchar(20)', True)->Column('Url', 'varchar(80)', True)->Column('InsertUserID', 'int', False)->Column('DateInserted', 'datetime')->Column('UpdateUserID', 'int', True)->Column('DateUpdated', 'datetime', True)->Engine('MyISAM')->Set($Explicit, $Drop);
Gdn::Structure()->Table('Route')->Column('URI', 'char(80)', False, 'primary')->Column('RequestUri', 'char(120)')->Engine('MyISAM')->Set($Explicit, $Drop);
$SectionModel = Gdn::Factory('SectionModel');
$HasRoot = False;
Gdn::Structure()->Table($SectionModel->Name)->PrimaryKey('SectionID', 'usmallint')->Column('TreeLeft', 'usmallint', 0)->Column('TreeRight', 'usmallint', 0)->Column('Depth', 'utinyint', 0)->Column('ParentID', 'usmallint', 0)->Column('Name', 'varchar(120)')->Column('InTopMenu', 'tinyint(1)', 0)->Column('Url', 'varchar(80)', True)->Column('URI', 'varchar(80)', True)->Column('RequestUri', 'char(120)', True)->Column('Mask', 'uint', True)->Engine('InnoDB')->Set($Explicit, $Drop);
try {
$HasRoot = $SQL->GetCount($SectionModel->Name, array('SectionID' => 1)) > 0;
} catch (Exception $Ex) {
}
if (!$HasRoot) {
$SQL->Insert($SectionModel->Name, array('SectionID' => 1, 'TreeLeft' => 1, 'TreeRight' => 2, 'Depth' => 0, 'Name' => T('Home')));
}
Gdn::Structure()->Table('Page')->PrimaryKey('PageID', 'usmallint')->Column('SectionID', 'usmallint', True, 'index')->Column('Title', 'varchar(200)')->Column('Body', 'text', True)->Column('Format', 'varchar(20)', 'xHtml')->Column('Visible', 'tinyint(1)', 0)->Column('URI', 'varchar(80)', True)->Column('Tags', 'varchar(250)', True)->Column('MasterView', 'varchar(30)', True)->Column('View', 'varchar(30)', True)->Column('Sort', 'smallint', 0)->Column('InsertUserID', 'int')->Column('DateInserted', 'datetime')->Column('UpdateUserID', 'int', True)->Column('DateUpdated', 'datetime', True)->Column('MetaDescription', 'varchar(500)', True)->Column('MetaKeywords', 'varchar(250)', True)->Column('MetaRobots', 'varchar(150)', True)->Column('MetaTitle', 'varchar(255)', True)->Column('CustomCss', 'text', True)->Column('CustomJs', 'text', True)->Engine('MyISAM')->Set($Explicit, $Drop);
// Set route
if (!Gdn::Router()->GetRoute('map')) {
Gdn::Router()->SetRoute('map', 'candy/content/map', 'Internal');
}
$PermissionModel = Gdn::PermissionModel();
$PermissionModel->Define(array('Candy.Settings.View', 'Candy.Sections.Edit', 'Candy.Sections.Add', 'Candy.Sections.Delete', 'Candy.Sections.Move', 'Candy.Sections.Swap', 'Candy.Pages.Add', 'Candy.Pages.Edit', 'Candy.Pages.Delete', 'Candy.Pages.Raw', 'Candy.Pages.Meta', 'Candy.Chunks.Edit', 'Candy.Chunks.Delete', 'Candy.Routes.Manage'));
$PermissionModel->Save(array('RoleID' => 16, 'Candy.Settings.View' => 1));
if (!isset($CaptureOnly) || $CaptureOnly == False) {
$Version = Gdn::ApplicationManager()->GetApplicationInfo('Candy', 'Version');
SaveToConfig('Candy.Version', $Version);
}
示例13: die
/**
* Application Gateway.
*
* @copyright 2009-2015 Vanilla Forums Inc.
* @license http://www.opensource.org/licenses/gpl-2.0.php GNU GPL v2
* @package Core
* @since 2.0
*/
if (PHP_VERSION_ID < 50400) {
die("Vanilla requires PHP 5.4 or greater.");
}
define('APPLICATION', 'Vanilla');
define('APPLICATION_VERSION', '2.2.100.8');
// Report and track all errors.
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR);
ini_set('display_errors', 0);
ini_set('track_errors', 1);
ob_start();
// Define the constants we need to get going.
define('DS', '/');
define('PATH_ROOT', getcwd());
// Include the bootstrap to configure the framework.
require_once PATH_ROOT . '/bootstrap.php';
// Create and configure the dispatcher.
$Dispatcher = Gdn::dispatcher();
$EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders();
$Dispatcher->EnabledApplicationFolders($EnabledApplications);
$Dispatcher->PassProperty('EnabledApplications', $EnabledApplications);
// Process the request.
$Dispatcher->start();
$Dispatcher->dispatch();
示例14: runStructure
/**
*
*
* @param null $AddonCode
* @param bool $Explicit
* @param bool $Drop
* @throws Exception
*/
public function runStructure($AddonCode = null, $Explicit = false, $Drop = false)
{
// Get the structure files for all of the enabled applications.
$ApplicationManager = new Gdn_ApplicationManager();
$Apps = $ApplicationManager->EnabledApplications();
$AppNames = consolidateArrayValuesByKey($Apps, 'Folder');
$Paths = array();
foreach ($Apps as $Key => $AppInfo) {
$Path = PATH_APPLICATIONS . "/{$AppInfo['Folder']}/settings/structure.php";
if (file_exists($Path)) {
$Paths[] = $Path;
}
Gdn::ApplicationManager()->RegisterPermissions($Key, $this->Validation);
}
// Execute the structures.
$Database = Gdn::database();
$SQL = Gdn::sql();
$Structure = Gdn::structure();
foreach ($Paths as $Path) {
include $Path;
}
// Execute the structures for all of the plugins.
$PluginManager = Gdn::pluginManager();
$Registered = $PluginManager->RegisteredPlugins();
foreach ($Registered as $ClassName => $Enabled) {
if (!$Enabled) {
continue;
}
try {
$Plugin = $PluginManager->GetPluginInstance($ClassName, Gdn_PluginManager::ACCESS_CLASSNAME);
if (method_exists($Plugin, 'Structure')) {
trace("{$ClassName}->Structure()");
$Plugin->Structure();
}
} catch (Exception $Ex) {
// Do nothing, plugin wouldn't load/structure.
if (Debug()) {
throw $Ex;
}
}
}
$this->fireEvent('AfterStructure');
}
示例15: unset
unset($Gdn_EnabledApplications);
unset($Gdn_Path);
unset($Hooks_Path);
Gdn::ThemeManager()->Start();
Gdn_Autoloader::Attach(Gdn_Autoloader::CONTEXT_THEME);
Gdn::PluginManager()->Start();
Gdn_Autoloader::Attach(Gdn_Autoloader::CONTEXT_PLUGIN);
if (!Gdn::FactoryExists(Gdn::AliasLocale)) {
$Codeset = Gdn::Config('Garden.LocaleCodeset', 'UTF8');
$CurrentLocale = Gdn::Config('Garden.Locale', 'en-CA');
$SetLocale = str_replace('-', '_', $CurrentLocale).'.'.$Codeset;
setlocale(LC_ALL, $SetLocale);
$Gdn_Locale = new Gdn_Locale($CurrentLocale, Gdn::ApplicationManager()->EnabledApplicationFolders(), Gdn::PluginManager()->EnabledPluginFolders());
Gdn::FactoryInstall(Gdn::AliasLocale, 'Gdn_Locale', NULL, Gdn::FactorySingleton, $Gdn_Locale);
unset($Gdn_Locale);
}
require_once(PATH_LIBRARY_CORE.'/functions.validation.php');
Gdn::Authenticator()->StartAuthenticator();
// Include a user-defined bootstrap.
if (file_exists(PATH_ROOT.'/conf/bootstrap.after.php'))
require_once(PATH_ROOT.'/conf/bootstrap.after.php');
// Include "Render" functions now - this way pluggables and custom confs can override them.
require_once(PATH_LIBRARY_CORE.'/functions.render.php');