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


PHP PluginManager::instance方法代码示例

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


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

示例1: boot

 public function boot()
 {
     Event::listen('backend.form.extendFields', function ($form) {
         if ($form->model instanceof Backend\Models\BackendPreferences) {
             $form->addFields(['focus_searchfield' => ['label' => 'indikator.backend::lang.settings.search_label', 'type' => 'switch', 'span' => 'left', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.search_comment'], 'sidebar_description' => ['label' => 'indikator.backend::lang.settings.sidebar_label', 'type' => 'switch', 'span' => 'right', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.sidebar_comment'], 'rounded_avatar' => ['label' => 'indikator.backend::lang.settings.avatar_label', 'type' => 'switch', 'span' => 'left', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.avatar_comment'], 'virtual_keyboard' => ['label' => 'indikator.backend::lang.settings.keyboard_label', 'type' => 'switch', 'span' => 'right', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.keyboard_comment'], 'media_menu' => ['label' => 'indikator.backend::lang.settings.media_label', 'type' => 'switch', 'span' => 'left', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.media_comment'], 'more_themes' => ['label' => 'indikator.backend::lang.settings.themes_label', 'type' => 'switch', 'span' => 'right', 'default' => 'false', 'comment' => 'indikator.backend::lang.settings.themes_comment']]);
         }
     });
     BackendController::extend(function ($controller) {
         if (BackendAuth::check()) {
             $preferences = UserPreferences::forUser()->get('backend::backend.preferences');
             if (isset($preferences['focus_searchfield']) && $preferences['focus_searchfield']) {
                 $controller->addJs('/plugins/indikator/backend/assets/js/setting-search.js');
             }
             if (isset($preferences['rounded_avatar']) && $preferences['rounded_avatar']) {
                 $controller->addCss('/plugins/indikator/backend/assets/css/rounded-avatar.css');
             }
             if (isset($preferences['virtual_keyboard']) && $preferences['virtual_keyboard']) {
                 $controller->addCss('/plugins/indikator/backend/assets/css/ml-keyboard.css');
                 $controller->addJs('/plugins/indikator/backend/assets/js/ml-keyboard.js');
             }
             if (isset($preferences['media_menu']) && $preferences['media_menu']) {
                 if (PluginManager::instance()->exists('RainLab.Pages')) {
                     $controller->addCss('/plugins/indikator/backend/assets/css/media-menu-pages.css');
                 } else {
                     $controller->addCss('/plugins/indikator/backend/assets/css/media-menu.css');
                 }
             }
             if (isset($preferences['more_themes']) && $preferences['more_themes']) {
                 $controller->addJs('/plugins/indikator/backend/assets/js/setting-theme.js');
             }
         }
     });
     BackendMenu::registerContextSidenavPartial('October.System', 'system', '~/plugins/indikator/backend/partials/_system_sidebar.htm');
 }
开发者ID:Bernasaurus,项目名称:bernasaurus,代码行数:34,代码来源:Plugin.php

示例2: register

 /**
  * Register our data source and renderer
  */
 public function register()
 {
     /**
      * Set up the data source for the feed
      */
     $this->app->bind('KoderHut\\RssFeedster\\DataSource', function ($app) {
         $config['page'] = Settings::get('post_page');
         $config['comments_anchor'] = Settings::get('comments_anchor');
         $config['controller'] = new Controller();
         return new PostsSource($config);
     });
     /**
      * Set up the adapter interface between the XML renderer and
      * the blog posts data
      */
     $this->app->bind(IAdapter::DI_NAMESPACE, function () {
         return new BlogPostXmlAdapter();
     });
     /**
      * Set up the feed renderer
      */
     $this->app->bind('KoderHut\\RssFeedster\\Renderer', function ($app) {
         $config = ['description' => Settings::get('feed_description'), 'title' => Settings::get('feed_title'), 'category' => Settings::get('feed_category'), 'copyright' => Settings::get('feed_copyright'), 'language' => Settings::get('feed_language'), 'link' => Url::action('KoderHut\\RssFeedster\\Controllers\\Rss@buildRssFeed')];
         $pluginPath = PluginManager::instance()->getPluginPath(Plugin::KODERHUT_RSSFEEDSTER_NS);
         $xmlTemplate = $pluginPath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'feed-template.xml';
         return new XmlRenderer($config, file_get_contents($xmlTemplate), $this->app->make(IAdapter::DI_NAMESPACE));
     });
     return;
 }
开发者ID:rendler-denis,项目名称:rssfeedster,代码行数:32,代码来源:Plugin.php

示例3: fire

 /**
  * Execute the console command.
  * @return void
  */
 public function fire()
 {
     $pluginManager = PluginManager::instance();
     $pluginName = $this->argument('name');
     $pluginName = $pluginManager->normalizeIdentifier($pluginName);
     if (!$pluginManager->hasPlugin($pluginName)) {
         return $this->error(sprintf('Unable to find a registered plugin called "%s"', $pluginName));
     }
     if (!$this->confirmToProceed(sprintf('This will DELETE "%s" from the filesystem and database.', $pluginName))) {
         return;
     }
     /*
      * Rollback plugin
      */
     $manager = UpdateManager::instance()->resetNotes();
     $manager->rollbackPlugin($pluginName);
     foreach ($manager->getNotes() as $note) {
         $this->output->writeln($note);
     }
     /*
      * Delete from file system
      */
     if ($pluginPath = $pluginManager->getPluginPath($pluginName)) {
         File::deleteDirectory($pluginPath);
         $this->output->writeln(sprintf('<info>Deleted: %s</info>', $pluginName));
     }
 }
开发者ID:360weboy,项目名称:october,代码行数:31,代码来源:PluginRemove.php

示例4: down

 public function down()
 {
     if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
         Schema::dropIfExists('bedard_blogtags_post_tag');
         Schema::dropIfExists('bedard_blogtags_tags');
     }
 }
开发者ID:negativa,项目名称:blogtags,代码行数:7,代码来源:create_tags_table.php

示例5: afterFetch

 /**
  * After the model is populated
  */
 public function afterFetch()
 {
     /*
      * Override the database columns with the plugin details
      * found in the plugin registration file.
      */
     $manager = PluginManager::instance();
     $pluginObj = $manager->findByIdentifier($this->code);
     if ($pluginObj) {
         $pluginInfo = $pluginObj->pluginDetails();
         foreach ($pluginInfo as $attribute => $info) {
             $this->{$attribute} = Lang::get($info);
         }
         if ($this->is_disabled) {
             $manager->disablePlugin($this->code, true);
         } else {
             $manager->enablePlugin($this->code, true);
         }
         $this->disabledBySystem = $pluginObj->disabled;
         if (($configDisabled = Config::get('cms.disablePlugins')) && is_array($configDisabled)) {
             $this->disabledByConfig = in_array($this->code, $configDisabled);
         }
     } else {
         $this->name = $this->code;
         $this->description = Lang::get('system::lang.plugins.unknown_plugin');
         $this->orphaned = true;
     }
 }
开发者ID:nnmer,项目名称:october,代码行数:31,代码来源:PluginVersion.php

示例6: afterFetch

 /**
  * After the model is populated
  */
 public function afterFetch()
 {
     /*
      * Override the database columns with the plugin details
      * found in the plugin registration file.
      */
     $manager = PluginManager::instance();
     $pluginObj = $manager->findByIdentifier($this->code);
     if ($pluginObj) {
         $pluginInfo = $pluginObj->pluginDetails();
         foreach ($pluginInfo as $attribute => $info) {
             $this->{$attribute} = $info;
         }
         if ($this->is_disabled) {
             $manager->disablePlugin($this->code, true);
         } else {
             $manager->enablePlugin($this->code, true);
         }
         $this->disabledBySystem = $pluginObj->disabled;
         $this->disabledByConfig = in_array($this->code, Config::get('cms.disablePlugins'));
     } else {
         $this->name = $this->code;
         $this->description = 'Plugin has been removed from the file system.';
         $this->orphaned = true;
     }
 }
开发者ID:tamboer,项目名称:LaravelOctober,代码行数:29,代码来源:PluginVersion.php

示例7: boot

 public function boot()
 {
     $this->manager = PluginManager::instance();
     // Get paths we need
     $theme = Theme::getActiveTheme();
     $themePath = $theme->getPath();
     $pluginPath = dirname(__FILE__);
     $providerPath = $themePath . '/Plugin.php';
     // Load your theme's Theme.php file as a service provider
     if (File::exists($providerPath)) {
         // Use reflection to find out info about Plugin.php
         $info = new Classes\ClassInfo($providerPath);
         if (ltrim($info->extends, '\\') == "NSRosenqvist\\ThemesPlus\\Classes\\ThemesPlusBase") {
             // Activate the theme plugin
             $plugin = $this->manager->loadPlugin($info->namespace, $themePath);
             $identifier = $this->manager->getIdentifier($plugin);
             $definitionsFile = $pluginPath . '/composer/definitions.php';
             $this->manager->registerPlugin($plugin);
             $this->manager->bootPlugin($plugin);
             // See if we need to generate a new composer psr-4 definitions file
             if (Settings::get('definitions_generated_for') != $identifier || !File::exists($definitionsFile)) {
                 File::put($definitionsFile, $this->makeDefinitionFile($info->namespace, $themePath));
                 Settings::set('definitions_generated_for', $identifier);
             }
             // Add theme to autoload through our definitions file
             ComposerManager::instance()->autoload($pluginPath);
         }
     }
     // dd(\Composer\Autoload\ClassLoader::findFile('MyCompany\\MyTheme\\Classes\\Radical'));
     // dd(ComposerManager::instance());
 }
开发者ID:nsrosenqvist,项目名称:october-plugin_themesplus,代码行数:31,代码来源:Plugin.php

示例8: loadActivities

 /**
  * Load the available activities that are defined by plugins
  */
 protected function loadActivities()
 {
     /*  
      * Load module activities
      */
     foreach ($this->callbacks as $callback) {
         $callback($this);
     }
     /*  
      * Load plugin activities
      */
     $pluginManager = PluginManager::instance();
     $plugins = $pluginManager->getPlugins();
     foreach ($plugins as $plugin) {
         if (method_exists($plugin, 'registerFriendsActivities')) {
             $activities = $plugin->registerFriendsActivities();
             if (!is_array($activities)) {
                 continue;
             }
             foreach ($activities as $className => $code) {
                 $this->registerActivity($className, $code, $plugin);
             }
         }
     }
 }
开发者ID:janusnic,项目名称:OctoberFriends,代码行数:28,代码来源:ActivityManager.php

示例9: down

 public function down()
 {
     if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
         Schema::table('rainlab_blog_posts', function ($table) {
             $table->dropColumn('view');
         });
     }
 }
开发者ID:andrijdavid,项目名称:extendblog,代码行数:8,代码来源:create_views_table.php

示例10: register_flynsarmy_menu_item_types

 public function register_flynsarmy_menu_item_types()
 {
     $types = ['Flynsarmy\\Menu\\MenuItemTypes\\Page' => ['label' => 'Page', 'alias' => 'page', 'description' => 'A link to a CMS Page'], 'Flynsarmy\\Menu\\MenuItemTypes\\Partial' => ['label' => 'Partial', 'alias' => 'partial', 'description' => 'Render a CMS Partial'], 'Flynsarmy\\Menu\\MenuItemTypes\\Link' => ['label' => 'Link', 'alias' => 'link', 'description' => 'A given URL']];
     if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
         $types['Flynsarmy\\Menu\\MenuItemTypes\\BlogPost'] = ['label' => 'Blog Post', 'alias' => 'blog_post', 'description' => 'A link to a Blog Post'];
         $types['Flynsarmy\\Menu\\MenuItemTypes\\BlogCategory'] = ['label' => 'Blog Category', 'alias' => 'blog_category', 'description' => 'A link to a Blog Category'];
     }
     return $types;
 }
开发者ID:janusnic,项目名称:OctoberCMS,代码行数:9,代码来源:Plugin.php

示例11: user

 /**
  * Returns the logged in user, if available
  */
 public function user()
 {
     if (!PluginManager::instance()->exists('RainLab.User')) {
         return null;
     }
     if (!Auth::check()) {
         return null;
     }
     return Auth::getUser();
 }
开发者ID:fuunnx,项目名称:loveandzucchini,代码行数:13,代码来源:Post.php

示例12: createFromPluginCode

 public static function createFromPluginCode($pluginCode)
 {
     $pluginCodeObj = new PluginCode($pluginCode);
     $plugins = PluginManager::instance()->getPlugins();
     foreach ($plugins as $code => $plugin) {
         if ($code == $pluginCode) {
             return new PluginVector($plugin, $pluginCodeObj);
         }
     }
     return null;
 }
开发者ID:andytan2624,项目名称:andytan.net,代码行数:11,代码来源:PluginVector.php

示例13: getFeedLanguageOptions

 /**
  * Load and return the feed_language dropdown options
  *
  * @return array
  */
 public function getFeedLanguageOptions()
 {
     $pluginPath = PluginManager::instance()->getPluginPath(Plugin::KODERHUT_RSSFEEDSTER_NS);
     $path = $pluginPath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'language_codes.yaml';
     if (!File::exists($path)) {
         return [];
     }
     $languages = YamlParser::parseFile($path);
     $languages = is_array($languages) ? array_flip($languages) : [];
     return $languages;
 }
开发者ID:rendler-denis,项目名称:rssfeedster,代码行数:16,代码来源:Settings.php

示例14: getDropdownOptions

 public function getDropdownOptions($fieldName = null, $keyValue = null)
 {
     $options = [];
     $manager = PluginManager::instance();
     if ($manager->exists('shahiemseymor.roles')) {
         $permissions = \ShahiemSeymor\Roles\Models\UserPermission::get();
         foreach ($permissions as $permission) {
             $options[$permission->id] = $permission->name;
         }
     }
     return $options;
 }
开发者ID:ribsousa,项目名称:MyCalendar,代码行数:12,代码来源:Category.php

示例15: getUserIdOptions

 public function getUserIdOptions($keyValue = null)
 {
     $manager = PluginManager::instance();
     if ($manager->exists('rainlab.user')) {
         $Users = array();
         foreach (UserModel::orderBy('surname')->orderBy('name')->get() as $user) {
             $Users[$user->id] = $user->surname . ', ' . $user->name;
         }
         return $Users;
     }
     return [0 => 'Rainlab User Model Not Installed'];
 }
开发者ID:ardani,项目名称:MyCalendar,代码行数:12,代码来源:Event.php


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