Merge branch 'w42_MDL-42243_m26_filtersettings' of https://github.com/skodak/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 13 Oct 2013 21:19:18 +0000 (23:19 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 13 Oct 2013 21:19:18 +0000 (23:19 +0200)
filter/censor/settings.php [moved from filter/censor/filtersettings.php with 100% similarity]
filter/emoticon/settings.php [moved from filter/emoticon/filtersettings.php with 100% similarity]
filter/multilang/settings.php [moved from filter/multilang/filtersettings.php with 100% similarity]
filter/tex/settings.php [moved from filter/tex/filtersettings.php with 100% similarity]
filter/upgrade.txt
filter/urltolink/settings.php [moved from filter/urltolink/filtersettings.php with 100% similarity]
lib/classes/plugininfo/filter.php
lib/filterlib.php

index 99cffdd..8ece768 100644 (file)
@@ -1,6 +1,10 @@
 This file describes API changes in core filter API and plugins,
 information provided here is intended especially for developers.
 
+=== 2.6 ===
+
+* filtersettings.php is now deprecated, migrate to standard settings.php
+
 === 2.5 ===
 
 * legacy_filter emulation was removed
index 7cf227e..6eb4338 100644 (file)
@@ -71,13 +71,20 @@ class filter extends base {
             return;
         }
 
-        if (!$hassiteconfig or !file_exists($this->full_path('settings.php'))) {
+        if (!$hassiteconfig) {
+            return;
+        }
+        if (file_exists($this->full_path('settings.php'))) {
+            $fullpath = $this->full_path('settings.php');
+        } else if (file_exists($this->full_path('filtersettings.php'))) {
+            $fullpath = $this->full_path('filtersettings.php');
+        } else {
             return;
         }
 
         $section = $this->get_settings_section_name();
         $settings = new admin_settingpage($section, $this->displayname, 'moodle/site:config', $this->is_enabled() === false);
-        include($this->full_path('filtersettings.php')); // This may also set $settings to null.
+        include($fullpath); // This may also set $settings to null.
 
         if ($settings) {
             $ADMIN->add($parentnodename, $settings);
index 0438c21..a93a74b 100644 (file)
@@ -1124,6 +1124,10 @@ function filter_delete_all_for_context($contextid) {
  */
 function filter_has_global_settings($filter) {
     global $CFG;
+    $settingspath = $CFG->dirroot . '/filter/' . $filter . '/settings.php';
+    if (is_readable($settingspath)) {
+        return true;
+    }
     $settingspath = $CFG->dirroot . '/filter/' . $filter . '/filtersettings.php';
     return is_readable($settingspath);
 }