Search moodle.org's
Developer Documentation

  • 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   * List of 3rd party libs used in moodle and all plugins.
      19   *
      20   * @package   admin
      21   * @copyright 2013 Petr Skoda {@link http://skodak.org}
      22   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
      23   */
      24  
      25  require_once('../config.php');
      26  require_once($CFG->libdir.'/adminlib.php');
      27  require_once($CFG->libdir.'/tablelib.php');
      28  
      29  admin_externalpage_setup('thirdpartylibs');
      30  
      31  echo $OUTPUT->header();
      32  echo $OUTPUT->heading(get_string('thirdpartylibs', 'core_admin'));
      33  
      34  $files = array('core' => "$CFG->libdir/thirdpartylibs.xml");
      35  
      36  $plugintypes = core_component::get_plugin_types();
      37  foreach ($plugintypes as $type => $ignored) {
      38      $plugins = core_component::get_plugin_list_with_file($type, 'thirdpartylibs.xml', false);
      39      foreach ($plugins as $plugin => $path) {
      40          $files[$type.'_'.$plugin] = $path;
      41      }
      42  }
      43  
      44  $table = new html_table();
      45  $table->head = array(
      46      get_string('thirdpartylibrary', 'core_admin'), get_string('version'),
      47      get_string('thirdpartylibrarylocation', 'core_admin'), get_string('license'));
      48  $table->align = array('left', 'left', 'left', 'left');
      49  $table->id = 'thirdpartylibs';
      50  $table->attributes['class'] = 'admintable generaltable';
      51  $table->data  = array();
      52  
      53  foreach ($files as $component => $xmlpath) {
      54      $xml = simplexml_load_file($xmlpath);
      55      foreach ($xml as $lib) {
      56          $base = realpath(dirname($xmlpath));
      57          $location = substr($base, strlen($CFG->dirroot)).'/'.$lib->location;
      58          if (is_dir($CFG->dirroot.$location)) {
      59              $location .= '/';
      60          }
      61          $version = '';
      62          if (!empty($lib->version)) {
      63              $version = $lib->version;
      64          }
      65          $license = $lib->license;
      66          if (!empty($lib->licenseversion)) {
      67              $license .= ' '.$lib->licenseversion;
      68          }
      69  
      70          $table->data[] = new html_table_row(array($lib->name, $version, $location, $license));
      71      }
      72  }
      73  
      74  echo html_writer::table($table);
      75  
      76  echo $OUTPUT->footer();