127 lines
3.2 KiB
PHP
127 lines
3.2 KiB
PHP
<?php namespace Zoomyboy\Social;
|
|
|
|
use Backend;
|
|
use System\Classes\PluginBase;
|
|
use Zoomyboy\Social\Console\SocialRefresh;
|
|
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);
|
|
$this->registerConsoleCommand('social-refresh', SocialRefresh::class);
|
|
}
|
|
|
|
/**
|
|
* 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();
|
|
$schedule->command('social:refresh')->monthly();
|
|
}
|
|
|
|
}
|