作者:nsrosenqvis
项目:october-plugin_themesplu
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());
}
作者:Bernasauru
项目:bernasauru
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');
}
作者:360webo
项目:octobe
/**
* 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));
}
}
作者:rendler-deni
项目:rssfeedste
/**
* 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;
}
作者:nnme
项目:octobe
/**
* 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;
}
}
作者:janusni
项目:OctoberFriend
/**
* 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);
}
}
}
}
作者:negativ
项目:blogtag
public function down()
{
if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
Schema::dropIfExists('bedard_blogtags_post_tag');
Schema::dropIfExists('bedard_blogtags_tags');
}
}
作者:tamboe
项目:LaravelOctobe
/**
* 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;
}
}
作者:andrijdavi
项目:extendblo
public function down()
{
if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
Schema::table('rainlab_blog_posts', function ($table) {
$table->dropColumn('view');
});
}
}
作者:janusni
项目:OctoberCM
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;
}
作者:fuunn
项目:loveandzucchin
/**
* 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();
}
作者:rendler-deni
项目:rssfeedste
/**
* 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;
}
作者:andytan262
项目:andytan.ne
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;
}
作者:quami
项目:PriceMonito
public function boot()
{
Event::listen('backend.form.extendFields', function ($form) {
$editors = ['richeditor', 'codeeditor', 'Eein\\Wysiwyg\\FormWidgets\\Trumbowyg'];
if ($form->model instanceof \ShahiemSeymor\Ckeditor\Models\Settings) {
if (PluginManager::instance()->hasPlugin('Radiantweb.Problog')) {
$form->addFields(['show_radiantweb_problog_as_wysiwyg' => ['label' => 'shahiemseymor.ckeditor::lang.show.radiantweb_problog', 'type' => 'switch', 'span' => 'auto', 'default' => 'false', 'comment' => 'shahiemseymor.ckeditor::lang.plugins.comment', 'tab' => 'shahiemseymor.ckeditor::lang.plugins.tab']], 'primary');
}
if (PluginManager::instance()->hasPlugin('Radiantweb.Proevents')) {
$form->addFields(['show_radiantweb_proevents_as_wysiwyg' => ['label' => 'shahiemseymor.ckeditor::lang.show.radiantweb_proevents', 'type' => 'switch', 'span' => 'auto', 'default' => 'false', 'comment' => 'shahiemseymor.ckeditor::lang.plugins.comment', 'tab' => 'shahiemseymor.ckeditor::lang.plugins.tab']], 'primary');
}
if (PluginManager::instance()->hasPlugin('RainLab.Pages')) {
$form->addFields(['show_rainlab_pages_as_wysiwyg' => ['label' => 'shahiemseymor.ckeditor::lang.show.rainlab_static_pages', 'type' => 'switch', 'span' => 'auto', 'default' => 'false', 'comment' => 'shahiemseymor.ckeditor::lang.plugins.comment', 'tab' => 'shahiemseymor.ckeditor::lang.plugins.tab']], 'primary');
}
if (PluginManager::instance()->hasPlugin('RainLab.Editable')) {
$form->addFields(['show_rainlab_editable_as_wysiwyg' => ['label' => 'shahiemseymor.ckeditor::lang.show.rainlab_editable', 'type' => 'switch', 'span' => 'auto', 'default' => 'false', 'comment' => 'shahiemseymor.ckeditor::lang.plugins.comment', 'tab' => 'shahiemseymor.ckeditor::lang.plugins.tab']], 'primary');
}
if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
$form->addFields(['show_rainlab_blog_as_wysiwyg' => ['label' => 'shahiemseymor.ckeditor::lang.show.rainlab_blog', 'type' => 'switch', 'span' => 'auto', 'default' => 'false', 'comment' => 'shahiemseymor.ckeditor::lang.plugins.comment', 'tab' => 'shahiemseymor.ckeditor::lang.plugins.tab']], 'primary');
}
if (PluginManager::instance()->hasPlugin('ShahiemSeymor.Maintenance')) {
$form->addFields(['show_shahiem_maintenance_as_wysiwyg' => ['label' => 'shahiemseymor.ckeditor::lang.show.shahiemseymor_maintenance', 'type' => 'switch', 'span' => 'auto', 'default' => 'false', 'comment' => 'shahiemseymor.ckeditor::lang.plugins.comment', 'tab' => 'shahiemseymor.ckeditor::lang.plugins.tab']], 'primary');
}
}
if (Settings::get('show_cms_pages_as_wysiwyg', false) && get_class($form->config->model) == 'Cms\\Classes\\Page') {
return static::useEditor($form, $editors);
}
if (Settings::get('show_cms_content_as_wysiwyg', false) && get_class($form->config->model) == 'Cms\\Classes\\Content') {
return static::useEditor($form, $editors);
}
if (Settings::get('show_cms_partial_as_wysiwyg', false) && get_class($form->config->model) == 'Cms\\Classes\\Partial') {
return static::useEditor($form, $editors);
}
if (Settings::get('show_cms_layouts_as_wysiwyg', false) && get_class($form->config->model) == 'Cms\\Classes\\Layout') {
return static::useEditor($form, $editors);
}
if (Settings::get('show_rainlab_blog_as_wysiwyg', false) && $form->model instanceof \RainLab\Blog\Models\Post) {
return static::useEditor($form, $editors);
}
if (Settings::get('show_shahiem_maintenance_as_wysiwyg', false) && $form->model instanceof \ShahiemSeymor\Maintenance\Models\Settings) {
return static::useEditor($form, ['richeditor', 'Eein\\Wysiwyg\\FormWidgets\\Trumbowyg']);
}
if (Settings::get('show_rainlab_pages_as_wysiwyg', false) && get_class($form->config->model) == 'RainLab\\Pages\\Classes\\Page') {
return static::useEditor($form, $editors);
}
if (Settings::get('show_radiantweb_problog_as_wysiwyg', false) && $form->model instanceof \Radiantweb\Problog\Models\Post) {
return static::useEditor($form, $editors);
}
if (Settings::get('show_radiantweb_proevents_as_wysiwyg', false) && $form->model instanceof \Radiantweb\Proevents\Models\Event) {
return static::useEditor($form, $editors);
}
});
}
作者:ribsous
项目:MyCalenda
public function run()
{
$manager = PluginManager::instance();
if ($manager->exists('shahiemseymor.roles')) {
if (!\ShahiemSeymor\Roles\Models\UserPermission::where('name', '=', 'calendar_public')->first()) {
\ShahiemSeymor\Roles\Models\UserPermission::create(['name' => 'calendar_public']);
}
if (!\ShahiemSeymor\Roles\Models\UserPermission::where('name', '=', 'calendar_deny_all')->first()) {
\ShahiemSeymor\Roles\Models\UserPermission::create(['name' => 'calendar_deny_all']);
}
}
}
作者:ribsous
项目:MyCalenda
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;
}
作者:ardan
项目:MyCalenda
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'];
}
作者:janusni
项目:oc-plugin-data-managemen
/**
* Index action.
* @return null
*/
public function index()
{
$this->pageTitle = trans('axc.datamanagement::lang.settings.label');
$this->addJs('/plugins/axc/datamanagement/assets/dist/home.js', 'core');
$this->addCss('/plugins/axc/datamanagement/assets/dist/home.css', 'core');
$navigation = \System\Classes\PluginManager::instance()->findByIdentifier('AxC.DataManagement')->registerNavigation();
array_shift($navigation['data-management']['sideMenu']);
$this->vars['tile_bg'] = ['', 'cyan', 'darkRed', 'green', 'orange', 'darkPink', 'amber', 'darkCobalt', 'lightGreen', 'darkCyan'];
$this->vars['tile_size'] = ['', 'double-vertical', 'quadro', 'double', '', 'double', '', 'double', '', ''];
$this->vars['parts'] = $navigation['data-management']['sideMenu'];
$this->vars['index'] = 1;
}
作者:firemankur
项目:authnotic
public function Retrieve()
{
$serviceUrls = [];
$manager = PluginManager::instance();
$plugins = $manager->getPlugins();
foreach ($plugins as $authPlug => $plugin) {
if (method_exists($plugin, 'messageURL')) {
$serviceUrls[$authPlug] = $plugin->messageURL();
}
}
$this->doRequests($serviceUrls);
return null;
}
作者:mechik
项目:staff-octobe
public function down()
{
if (PluginManager::instance()->hasPlugin('RainLab.Blog')) {
Schema::table('rainlab_blog_posts', function ($table) {
$table->dropColumn('seo_title');
$table->dropColumn('seo_description');
$table->dropColumn('seo_keywords');
$table->dropColumn('canonical_url');
$table->dropColumn('redirect_url');
$table->dropColumn('robot_index');
$table->dropColumn('robot_follow');
});
}
}