12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- class ChooseThemePlugin extends Plugin {
- const PLUGIN_VERSION = '0.1.0';
- public function onRouterInitialized(URLMapper $m) {
- $m->connect('main/choosethemesettings', ['action' => 'choosethemesettings']);
- }
- public function onPluginVersion(array &$versions) {
-
- $versions[] = array('name' => 'ChooseTheme',
- 'version' => self::PLUGIN_VERSION,
- 'author' => 'Knut Erik "abjectio" Hollund',
- 'homepage' => 'https://gitlab.com/kollektivet0x242/gsp-choosetheme',
- 'rawdescription' =>
-
- _m('Allowing user to select the preferred theme.'));
- return true;
- }
-
-
- function onEndAccountSettingsNav(Action $action) {
- $action_name = $action->getActionName();
- $action->menuItem(common_local_url('choosethemesettings'),
-
- _m('MENU', 'Theme'),
-
- _m('Choose Theme'),
- $action_name === 'themesettings');
- return true;
- }
- function onStartShowStylesheets(Action $action) {
-
- if($action->getScoped() instanceof Profile) {
- $site_theme = common_config('site','theme');
- $user_theme = $action->getScoped()->getPref('chosen_theme', 'theme', $site_theme);
- common_config_set('site', 'theme', $user_theme);
- }
- return true;
- }
- }
|