Skip to content
Snippets Groups Projects
Select Git revision
  • 96e01c1b80d5d96b0acd58ae43c43eb69646cdb0
  • master default protected
  • studip-5
  • studip-5.0
  • studip-4.0
  • studip-3.5
  • 72-merge
  • 72-kategorien-nur-fur-bestimmte-nutzerdomanen-sichtbar-machen
  • v4.6.5
  • v4.6.4
  • v4.6.3
  • v4.6
  • v4.3.2
  • v4.3
  • v4.2.4
  • v4.2.3
  • v4.2.1
  • v4.2
  • v4.1.4
  • v4.1.2
  • v4.1
  • v4.0
  • v3.20.2
  • v3.19
  • v3.18
  • v3.16
  • v3.15.4
  • v3.15.3
28 results

Plugin.php

Blame
  • Forked from Uni Oldenburg / Plugins / SchwarzesBrettPlugin
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Plugin.php 1.03 KiB
    <?php
    namespace SchwarzesBrett;
    
    use NotificationCenter;
    use PageLayout;
    use StudIPPlugin;
    
    abstract class Plugin extends StudIPPlugin
    {
        use \TranslatablePluginTrait;
    
        public function __construct()
        {
            parent::__construct();
    
            foreach (get_class_methods($this) as $method) {
                if (!preg_match('/^on\w+(Did|Will)\w+$/', $method)) {
                    continue;
                }
    
                $trigger = mb_substr($method, 2);
                NotificationCenter::addObserver($this, $method, $trigger);
            }
        }
    
        public static function getTranslationDomain()
        {
            return 'schwarzes-brett';
        }
    
        public function getTranslationPath()
        {
            return $this->getPluginPath() . '/locale';
        }
    
        /**
         * Returns the plugin version from manifest.
         *
         * @return string version
         */
        public function getPluginVersion()
        {
            static $manifest = null;
            if ($manifest === null) {
                $manifest = $this->getMetadata();
            }
            return $manifest['version'];
        }
    }