oc-social-plugin/Plugin.php

127 lines
3.2 KiB
PHP
Raw Normal View History

2021-10-28 22:35:15 +02:00
<?php namespace Zoomyboy\Social;
use Backend;
use System\Classes\PluginBase;
2021-10-30 12:16:27 +02:00
use Zoomyboy\Social\Console\SocialRefresh;
2021-10-28 22:35:15 +02:00
use Zoomyboy\Social\Console\SocialSync;
use Zoomyboy\Social\FormWidgets\FacebookLogin;
use Zoomyboy\Social\FormWidgets\InstagramLogin;
use Zoomyboy\Social\Models\Setting;
/**
* social Plugin Information File
*/
class Plugin extends PluginBase
{
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'social',
'description' => 'No description provided yet...',
'author' => 'zoomyboy',
'icon' => 'icon-leaf'
];
}
/**
* Register method, called when the plugin is first registered.
*
* @return void
*/
public function register()
{
$this->registerConsoleCommand('social-sync', SocialSync::class);
2021-10-30 12:16:27 +02:00
$this->registerConsoleCommand('social-refresh', SocialRefresh::class);
2021-10-28 22:35:15 +02:00
}
/**
* Boot method, called right before the request route.
*
* @return array
*/
public function boot()
{
}
/**
* Registers any front-end components implemented in this plugin.
*
* @return array
*/
public function registerComponents()
{
return [
'Zoomyboy\Social\Components\FacebookPageFeed' => 'facebookpagefeed',
];
}
/**
* Registers any back-end permissions used by this plugin.
*
* @return array
*/
public function registerPermissions()
{
return [
'zoomyboy.social.settings' => [
'tab' => 'social',
'label' => 'Social Settings'
],
];
}
/**
* Registers back-end navigation items for this plugin.
*
* @return array
*/
public function registerNavigation()
{
return []; // Remove this line to activate
return [
'social' => [
'label' => 'social',
'url' => Backend::url('zoomyboy/social/mycontroller'),
'icon' => 'icon-leaf',
'permissions' => ['zoomyboy.social.*'],
'order' => 500,
],
];
}
public function registerSettings() {
return [
'settings' => [
'label' => 'Social Media',
'description' => 'Social media Einstellungen',
'category' => 'Plugins',
'icon' => 'icon-facebook',
'class' => Setting::class,
'order' => 500,
'keywords' => 'facebook twitter social',
'permissions' => ['zoomyboy.social.settings']
]
];
}
public function registerFormWidgets() {
return [
FacebookLogin::class => 'zoomyboy_social_facebook_login',
InstagramLogin::class => 'zoomyboy_social_instagram_login',
];
}
public function registerSchedule($schedule) {
$schedule->command('social:sync')->hourly();
2021-10-30 12:16:27 +02:00
$schedule->command('social:refresh')->monthly();
2021-10-28 22:35:15 +02:00
}
}