本文整理汇总了PHP中System\Classes\SettingsManager::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP SettingsManager::instance方法的具体用法?PHP SettingsManager::instance怎么用?PHP SettingsManager::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System\Classes\SettingsManager
的用法示例。
在下文中一共展示了SettingsManager::instance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
parent::register('cms');
/*
* Register navigation
*/
BackendMenu::registerCallback(function ($manager) {
$manager->registerMenuItems('October.Cms', ['cms' => ['label' => 'cms::lang.cms.menu_label', 'icon' => 'icon-magic', 'url' => Backend::url('cms'), 'permissions' => ['cms.*'], 'order' => 10, 'sideMenu' => ['pages' => ['label' => 'cms::lang.page.menu_label', 'icon' => 'icon-copy', 'url' => 'javascript:;', 'attributes' => ['data-menu-item' => 'pages'], 'permissions' => ['cms.manage_pages'], 'counterLabel' => 'cms::lang.page.unsaved_label'], 'partials' => ['label' => 'cms::lang.partial.menu_label', 'icon' => 'icon-tags', 'url' => 'javascript:;', 'attributes' => ['data-menu-item' => 'partials'], 'permissions' => ['cms.manage_partials'], 'counterLabel' => 'cms::lang.partial.unsaved_label'], 'layouts' => ['label' => 'cms::lang.layout.menu_label', 'icon' => 'icon-th-large', 'url' => 'javascript:;', 'attributes' => ['data-menu-item' => 'layouts'], 'permissions' => ['cms.manage_layouts'], 'counterLabel' => 'cms::lang.layout.unsaved_label'], 'content' => ['label' => 'cms::lang.content.menu_label', 'icon' => 'icon-file-text-o', 'url' => 'javascript:;', 'attributes' => ['data-menu-item' => 'content'], 'permissions' => ['cms.manage_content'], 'counterLabel' => 'cms::lang.content.unsaved_label'], 'assets' => ['label' => 'cms::lang.asset.menu_label', 'icon' => 'icon-picture-o', 'url' => 'javascript:;', 'attributes' => ['data-menu-item' => 'assets'], 'permissions' => ['cms.manage_assets'], 'counterLabel' => 'cms::lang.asset.unsaved_label'], 'components' => ['label' => 'cms::lang.component.menu_label', 'icon' => 'icon-puzzle-piece', 'url' => 'javascript:;', 'attributes' => ['data-menu-item' => 'components'], 'permissions' => ['cms.manage_pages', 'cms.manage_layouts', 'cms.manage_partials']]]]]);
});
/*
* Register permissions
*/
BackendAuth::registerCallback(function ($manager) {
$manager->registerPermissions('October.Cms', ['cms.manage_content' => ['label' => 'cms::lang.permissions.manage_content', 'tab' => 'Cms'], 'cms.manage_assets' => ['label' => 'cms::lang.permissions.manage_assets', 'tab' => 'Cms'], 'cms.manage_pages' => ['label' => 'cms::lang.permissions.manage_pages', 'tab' => 'Cms'], 'cms.manage_layouts' => ['label' => 'cms::lang.permissions.manage_layouts', 'tab' => 'Cms'], 'cms.manage_partials' => ['label' => 'cms::lang.permissions.manage_partials', 'tab' => 'Cms'], 'cms.manage_themes' => ['label' => 'cms::lang.permissions.manage_themes', 'tab' => 'Cms']]);
});
/*
* Register widgets
*/
WidgetManager::instance()->registerFormWidgets(function ($manager) {
$manager->registerFormWidget('Cms\\FormWidgets\\Components');
});
/*
* Register settings
*/
SettingsManager::instance()->registerCallback(function ($manager) {
$manager->registerSettingItems('October.Cms', ['theme' => ['label' => 'cms::lang.theme.settings_menu', 'description' => 'cms::lang.theme.settings_menu_description', 'category' => SettingsManager::CATEGORY_CMS, 'icon' => 'icon-picture-o', 'url' => Backend::URL('cms/themes'), 'order' => 200], 'maintenance_settings' => ['label' => 'cms::lang.maintenance.settings_menu', 'description' => 'cms::lang.maintenance.settings_menu_description', 'category' => SettingsManager::CATEGORY_CMS, 'icon' => 'icon-plug', 'class' => 'Cms\\Models\\MaintenanceSettings', 'order' => 400]]);
});
/*
* Register components
*/
ComponentManager::instance()->registerComponents(function ($manager) {
$manager->registerComponent('Cms\\Classes\\ViewBag', 'viewBag');
});
}
示例2: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
parent::register('backend');
/*
* Register widgets
*/
WidgetManager::instance()->registerFormWidgets(function ($manager) {
$manager->registerFormWidget('Backend\\FormWidgets\\CodeEditor', ['label' => 'Code editor', 'code' => 'codeeditor']);
$manager->registerFormWidget('Backend\\FormWidgets\\RichEditor', ['label' => 'Rich editor', 'code' => 'richeditor']);
$manager->registerFormWidget('Backend\\FormWidgets\\FileUpload', ['label' => 'File uploader', 'code' => 'fileupload']);
$manager->registerFormWidget('Backend\\FormWidgets\\Relation', ['label' => 'Relationship', 'code' => 'relation']);
$manager->registerFormWidget('Backend\\FormWidgets\\DatePicker', ['label' => 'Date picker', 'code' => 'datepicker']);
$manager->registerFormWidget('Backend\\FormWidgets\\TimePicker', ['label' => 'Time picker', 'code' => 'timepicker']);
$manager->registerFormWidget('Backend\\FormWidgets\\ColorPicker', ['label' => 'Color picker', 'code' => 'colorpicker']);
$manager->registerFormWidget('Backend\\FormWidgets\\DataGrid', ['label' => 'Data Grid', 'code' => 'datagrid']);
// @deprecated if year >= 2016
$manager->registerFormWidget('Backend\\FormWidgets\\DataTable', ['label' => 'Data Table', 'code' => 'datatable']);
$manager->registerFormWidget('Backend\\FormWidgets\\RecordFinder', ['label' => 'Record Finder', 'code' => 'recordfinder']);
$manager->registerFormWidget('Backend\\FormWidgets\\Repeater', ['label' => 'Repeater', 'code' => 'repeater']);
});
/*
* Register navigation
*/
BackendMenu::registerCallback(function ($manager) {
$manager->registerMenuItems('October.Backend', ['dashboard' => ['label' => 'backend::lang.dashboard.menu_label', 'icon' => 'icon-dashboard', 'url' => Backend::url('backend'), 'permissions' => ['backend.access_dashboard'], 'order' => 1]]);
});
/*
* Register settings
*/
SettingsManager::instance()->registerCallback(function ($manager) {
$manager->registerSettingItems('October.Backend', ['branding' => ['label' => 'backend::lang.branding.menu_label', 'description' => 'backend::lang.branding.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-paint-brush', 'class' => 'Backend\\Models\\BrandSettings', 'order' => 500], 'editor' => ['label' => 'backend::lang.editor.menu_label', 'description' => 'backend::lang.editor.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-code', 'url' => Backend::URL('backend/editorpreferences'), 'order' => 600, 'context' => 'mysettings'], 'backend_preferences' => ['label' => 'backend::lang.backend_preferences.menu_label', 'description' => 'backend::lang.backend_preferences.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-laptop', 'class' => 'Backend\\Models\\BackendPreferences', 'order' => 500, 'context' => 'mysettings'], 'myaccount' => ['label' => 'backend::lang.myaccount.menu_label', 'description' => 'backend::lang.myaccount.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-user', 'url' => Backend::URL('backend/users/myaccount'), 'order' => 400, 'context' => 'mysettings', 'keywords' => 'backend::lang.myaccount.menu_keywords'], 'access_logs' => ['label' => 'backend::lang.access_log.menu_label', 'description' => 'backend::lang.access_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-lock', 'url' => Backend::url('backend/accesslogs'), 'permissions' => ['backend.access_admin_logs'], 'order' => 800]]);
});
/*
* Register permissions
*/
BackendAuth::registerCallback(function ($manager) {
$manager->registerPermissions('October.Backend', ['backend.access_dashboard' => ['label' => 'system::lang.permissions.view_the_dashboard', 'tab' => 'system::lang.permissions.name'], 'backend.manage_users' => ['label' => 'system::lang.permissions.manage_other_administrators', 'tab' => 'system::lang.permissions.name']]);
});
/*
* Register mail templates
*/
MailTemplate::registerCallback(function ($template) {
$template->registerMailTemplates(['backend::mail.invite' => 'Invitation for newly created administrators.', 'backend::mail.restore' => 'Password reset instructions for backend-end administrators.']);
});
/*
* Register asset bundles
*/
CombineAssets::registerCallback(function ($combiner) {
$combiner->registerBundle('~/modules/backend/assets/less/controls.less');
$combiner->registerBundle('~/modules/backend/assets/less/october.less');
$combiner->registerBundle('~/modules/backend/assets/js/october.js');
$combiner->registerBundle('~/modules/backend/assets/js/vendor/vendor.js');
$combiner->registerBundle('~/modules/backend/widgets/table/assets/js/build.js');
$combiner->registerBundle('~/modules/backend/formwidgets/datepicker/assets/js/build.js');
$combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/less/richeditor.less');
$combiner->registerBundle('~/modules/backend/formwidgets/richeditor/assets/js/build.js');
});
}
示例3: findSettingItem
/**
* Locates a setting item for a module or plugin
*/
protected function findSettingItem($author, $plugin, $code)
{
$manager = SettingsManager::instance();
$moduleOwner = $author;
$moduleCode = $plugin;
$item = $manager->findSettingItem($moduleOwner, $moduleCode);
if (!$item) {
$pluginOwner = $author . '.' . $plugin;
$pluginCode = $code;
$item = $manager->findSettingItem($pluginOwner, $pluginCode);
}
return $item;
}
示例4: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
parent::register('backend');
/*
* Register widgets
*/
WidgetManager::instance()->registerFormWidgets(function ($manager) {
$manager->registerFormWidget('Backend\\FormWidgets\\CodeEditor', ['label' => 'Code editor', 'alias' => 'codeeditor']);
$manager->registerFormWidget('Backend\\FormWidgets\\RichEditor', ['label' => 'Rich editor', 'alias' => 'richeditor']);
$manager->registerFormWidget('Backend\\FormWidgets\\FileUpload', ['label' => 'File uploader', 'alias' => 'fileupload']);
$manager->registerFormWidget('Backend\\FormWidgets\\Relation', ['label' => 'Relationship', 'alias' => 'relation']);
$manager->registerFormWidget('Backend\\FormWidgets\\Datepicker', ['label' => 'Date picker', 'alias' => 'datepicker']);
$manager->registerFormWidget('Backend\\FormWidgets\\DataGrid', ['label' => 'Data Grid', 'alias' => 'datagrid']);
$manager->registerFormWidget('Backend\\FormWidgets\\RecordFinder', ['label' => 'Record Finder', 'alias' => 'recordfinder']);
});
/*
* Register navigation
*/
BackendMenu::registerCallback(function ($manager) {
$manager->registerMenuItems('October.Backend', ['dashboard' => ['label' => 'backend::lang.dashboard.menu_label', 'icon' => 'icon-home', 'url' => Backend::url('backend'), 'permissions' => ['backend.access_dashboard'], 'order' => 1]]);
});
/*
* Register settings
*/
SettingsManager::instance()->registerCallback(function ($manager) {
$manager->registerSettingItems('October.Backend', ['editor' => ['label' => 'backend::lang.editor.menu_label', 'description' => 'backend::lang.editor.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-code', 'url' => Backend::URL('backend/editorpreferences'), 'order' => 600, 'context' => 'mysettings'], 'backend_preferences' => ['label' => 'backend::lang.backend_preferences.menu_label', 'description' => 'backend::lang.backend_preferences.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-laptop', 'class' => 'Backend\\Models\\BackendPreferences', 'order' => 500, 'context' => 'mysettings'], 'myaccount' => ['label' => 'backend::lang.myaccount.menu_label', 'description' => 'backend::lang.myaccount.menu_description', 'category' => SettingsManager::CATEGORY_MYSETTINGS, 'icon' => 'icon-user', 'url' => Backend::URL('backend/users/myaccount'), 'order' => 400, 'context' => 'mysettings', 'keywords' => 'backend::lang.myaccount.menu_keywords'], 'access_logs' => ['label' => 'backend::lang.access_log.menu_label', 'description' => 'backend::lang.access_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-lock', 'url' => Backend::url('backend/accesslogs'), 'permissions' => ['backend.access_admin_logs'], 'order' => 800]]);
});
/*
* Register permissions
*/
BackendAuth::registerCallback(function ($manager) {
$manager->registerPermissions('October.Backend', ['backend.access_dashboard' => ['label' => 'system::lang.permissions.view_the_dashboard', 'tab' => 'System'], 'backend.manage_users' => ['label' => 'system::lang.permissions.manage_other_administrators', 'tab' => 'System']]);
});
/*
* Register mail templates
*/
MailTemplate::registerCallback(function ($template) {
$template->registerMailTemplates(['backend::mail.invite' => 'Invitation for newly created administrators.', 'backend::mail.restore' => 'Password reset instructions for backend-end administrators.']);
});
}
示例5: registerBackendSettings
protected function registerBackendSettings()
{
SettingsManager::instance()->registerCallback(function ($manager) {
$manager->registerSettingItems('October.System', ['updates' => ['label' => 'system::lang.updates.menu_label', 'description' => 'system::lang.updates.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-cloud-download', 'url' => Backend::url('system/updates'), 'permissions' => ['system.manage_updates'], 'order' => 300], 'administrators' => ['label' => 'backend::lang.user.menu_label', 'description' => 'backend::lang.user.menu_description', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-users', 'url' => Backend::url('backend/users'), 'permissions' => ['backend.manage_users'], 'order' => 400], 'mail_settings' => ['label' => 'system::lang.mail.menu_label', 'description' => 'system::lang.mail.menu_description', 'category' => SettingsManager::CATEGORY_MAIL, 'icon' => 'icon-envelope', 'class' => 'System\\Models\\MailSettings', 'permissions' => ['system.manage_mail_settings'], 'order' => 600], 'mail_templates' => ['label' => 'system::lang.mail_templates.menu_label', 'description' => 'system::lang.mail_templates.menu_description', 'category' => SettingsManager::CATEGORY_MAIL, 'icon' => 'icon-envelope-square', 'url' => Backend::url('system/mailtemplates'), 'permissions' => ['system.manage_mail_templates'], 'order' => 610], 'event_logs' => ['label' => 'system::lang.event_log.menu_label', 'description' => 'system::lang.event_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-exclamation-triangle', 'url' => Backend::url('system/eventlogs'), 'permissions' => ['system.access_logs'], 'order' => 900], 'request_logs' => ['label' => 'system::lang.request_log.menu_label', 'description' => 'system::lang.request_log.menu_description', 'category' => SettingsManager::CATEGORY_LOGS, 'icon' => 'icon-file-o', 'url' => Backend::url('system/requestlogs'), 'permissions' => ['system.access_logs'], 'order' => 910]]);
});
}
示例6: registerBackendSettings
protected function registerBackendSettings()
{
SettingsManager::instance()->registerCallback(function ($manager) {
$manager->registerSettingItems('October.Cms', ['theme' => ['label' => 'cms::lang.theme.settings_menu', 'description' => 'cms::lang.theme.settings_menu_description', 'category' => SettingsManager::CATEGORY_CMS, 'icon' => 'icon-picture-o', 'url' => Backend::URL('cms/themes'), 'permissions' => ['cms.manage_themes'], 'order' => 200], 'maintenance_settings' => ['label' => 'cms::lang.maintenance.settings_menu', 'description' => 'cms::lang.maintenance.settings_menu_description', 'category' => SettingsManager::CATEGORY_CMS, 'icon' => 'icon-plug', 'class' => 'Cms\\Models\\MaintenanceSettings', 'permissions' => ['cms.manage_themes'], 'order' => 300]]);
});
}
示例7: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
/*
* Register self
*/
parent::register('system');
/*
* Register core providers
*/
App::register('October\\Rain\\Config\\ConfigServiceProvider');
App::register('October\\Rain\\Translation\\TranslationServiceProvider');
/*
* Define path constants
*/
if (!defined('PATH_APP')) {
define('PATH_APP', app_path());
}
if (!defined('PATH_BASE')) {
define('PATH_BASE', base_path());
}
if (!defined('PATH_PUBLIC')) {
define('PATH_PUBLIC', public_path());
}
if (!defined('PATH_STORAGE')) {
define('PATH_STORAGE', storage_path());
}
if (!defined('PATH_PLUGINS')) {
define('PATH_PLUGINS', base_path() . Config::get('cms.pluginsDir'));
}
/*
* Register singletons
*/
App::singleton('string', function () {
return new \October\Rain\Support\Str();
});
App::singleton('backend.helper', function () {
return new \Backend\Classes\BackendHelper();
});
App::singleton('backend.menu', function () {
return \Backend\Classes\NavigationManager::instance();
});
App::singleton('backend.auth', function () {
return \Backend\Classes\AuthManager::instance();
});
/*
* Register all plugins
*/
$pluginManager = PluginManager::instance();
$pluginManager->registerAll();
/*
* Error handling for uncaught Exceptions
*/
App::error(function (\Exception $exception, $httpCode, $isConsole) {
$handler = new ErrorHandler();
return $handler->handleException($exception, $httpCode, $isConsole);
});
/*
* Register basic twig
*/
App::bindShared('twig', function ($app) {
return new Twig_Environment(new TwigLoader(), ['auto_reload' => true]);
});
/*
* Register .htm extension for Twig views
*/
App::make('view')->addExtension('htm', 'twig', function () {
return new TwigEngine(App::make('twig'));
});
/*
* Override system email with email settings
*/
Event::listen('mailer.beforeRegister', function () {
if (EmailSettings::isConfigured()) {
EmailSettings::applyConfigValues();
}
});
/*
* Override standard Mailer content with template
*/
Event::listen('mailer.register', function () {
App::make('mailer')->bindEvent('content.beforeAdd', function ($message, $view, $plain, $data) {
if (EmailTemplate::addContentToMailer($message, $view, $data)) {
return false;
}
});
});
/*
* Register other module providers
*/
foreach (Config::get('cms.loadModules', []) as $module) {
if (strtolower(trim($module)) == 'system') {
continue;
}
App::register('\\' . $module . '\\ServiceProvider');
}
//.........这里部分代码省略.........
示例8: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
/*
* Register self
*/
parent::register('system');
/*
* Register singletons
*/
App::singleton('backend.helper', function () {
return new \Backend\Helpers\Backend();
});
App::singleton('backend.menu', function () {
return \Backend\Classes\NavigationManager::instance();
});
App::singleton('backend.auth', function () {
return \Backend\Classes\AuthManager::instance();
});
/*
* Check for CLI or system/updates route and disable any plugin initialization
* @todo This should be moved to middleware
*/
$requestPath = \October\Rain\Router\Helper::normalizeUrl(\Request::path());
$systemPath = \October\Rain\Router\Helper::normalizeUrl(Config::get('cms.backendUri') . '/system/updates');
if (stripos($requestPath, $systemPath) === 0) {
PluginManager::$noInit = true;
}
$updateCommands = ['october:up', 'october:update'];
if (App::runningInConsole() && count(array_intersect($updateCommands, Request::server('argv'))) > 0) {
PluginManager::$noInit = true;
}
/*
* Register all plugins
*/
$pluginManager = PluginManager::instance();
$pluginManager->registerAll();
/*
* Allow plugins to use the scheduler
*/
Event::listen('console.schedule', function ($schedule) use($pluginManager) {
foreach ($pluginManager->getPlugins() as $plugin) {
if (method_exists($plugin, 'registerSchedule')) {
$plugin->registerSchedule($schedule);
}
}
});
/*
* Error handling for uncaught Exceptions
*/
Event::listen('exception.beforeRender', function ($exception, $httpCode, $request) {
$handler = new ErrorHandler();
return $handler->handleException($exception);
});
/*
* Write all log events to the database
*/
Event::listen('illuminate.log', function ($level, $message, $context) {
if (DbDongle::hasDatabase() && !defined('OCTOBER_NO_EVENT_LOGGING')) {
EventLog::add($message, $level);
}
});
/*
* Register basic Twig
*/
App::singleton('twig', function ($app) {
$twig = new Twig_Environment(new TwigLoader(), ['auto_reload' => true]);
$twig->addExtension(new TwigExtension());
return $twig;
});
/*
* Register .htm extension for Twig views
*/
App::make('view')->addExtension('htm', 'twig', function () {
return new TwigEngine(App::make('twig'));
});
/*
* Register Twig that will parse strings
*/
App::singleton('twig.string', function ($app) {
$twig = $app['twig'];
$twig->setLoader(new Twig_Loader_String());
return $twig;
});
/*
* Override system mailer with mail settings
*/
Event::listen('mailer.beforeRegister', function () {
if (MailSettings::isConfigured()) {
MailSettings::applyConfigValues();
}
});
/*
* Override standard Mailer content with template
*/
Event::listen('mailer.beforeAddContent', function ($mailer, $message, $view, $data) {
//.........这里部分代码省略.........
示例9: registerBackendSettings
public function registerBackendSettings()
{
SettingsManager::instance()->registerCallback(function ($manager) {
$manager->registerSettingItems('Huying.Wechat', ['account' => ['label' => '微信账号设置', 'description' => '在这里设置企业号的相关信息', 'category' => SettingsManager::CATEGORY_SYSTEM, 'icon' => 'icon-cloud-download', 'class' => 'Wechat\\Models\\AccountSettings', 'permissions' => ['wechat.manage_account'], 'order' => 300]]);
});
}