Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Defines classes used for plugin info.
  19   *
  20   * @package    core
  21   * @copyright  2011 David Mudrak <david@moodle.com>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  namespace core\plugininfo;
  25  
  26  use moodle_url;
  27  
  28  defined('MOODLE_INTERNAL') || die();
  29  
  30  /**
  31   * Class for local plugins
  32   */
  33  class local extends base {
  34  
  35      public function is_uninstall_allowed() {
  36          return true;
  37      }
  38  
  39      /**
  40       * Return URL used for management of plugins of this type.
  41       * @return moodle_url
  42       */
  43      public static function get_manage_url() {
  44          return new moodle_url('/admin/localplugins.php');
  45      }
  46  
  47      /**
  48       * Loads plugin settings to the settings tree
  49       *
  50       * This function usually includes settings.php file in plugins folder.
  51       * Alternatively it can create a link to some settings page (instance of admin_externalpage)
  52       *
  53       * @param \part_of_admin_tree $adminroot
  54       * @param string $parentnodename
  55       * @param bool $hassiteconfig whether the current user has moodle/site:config capability
  56       */
  57      public function load_settings(\part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
  58          global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.
  59          $ADMIN = $adminroot; // May be used in settings.php.
  60          $plugininfo = $this; // Also can be used inside settings.php.
  61  
  62          if (!$this->is_installed_and_upgraded()) {
  63              return;
  64          }
  65  
  66          if (file_exists($this->full_path('settings.php'))) {
  67              include($this->full_path('settings.php'));
  68          }
  69      }
  70  }