thirdpartylibs.php 2.6 KB

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