Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 18... Línea 18...
18
 
18
 
19
use renderable;
19
use renderable;
20
use renderer_base;
20
use renderer_base;
21
use templatable;
21
use templatable;
-
 
22
use custom_menu;
Línea 22... Línea 23...
22
use custom_menu;
23
use filter_manager;
23
 
24
 
24
/**
25
/**
25
 * Primary navigation renderable
26
 * Primary navigation renderable
Línea 117... Línea 118...
117
        if (empty($CFG->custommenuitems)) {
118
        if (empty($CFG->custommenuitems)) {
118
            return [];
119
            return [];
119
        }
120
        }
Línea 120... Línea 121...
120
 
121
 
-
 
122
        $custommenuitems = $CFG->custommenuitems;
-
 
123
 
-
 
124
        // If filtering of the primary custom menu is enabled, apply only the string filters.
-
 
125
        if (!empty($CFG->navfilter && !empty($CFG->stringfilters))) {
-
 
126
            // Apply filters that are enabled for Content and Headings.
-
 
127
            $filtermanager = \filter_manager::instance();
-
 
128
            $custommenuitems = $filtermanager->filter_string($custommenuitems, \context_system::instance());
-
 
129
        }
121
        $custommenuitems = $CFG->custommenuitems;
130
 
122
        $currentlang = current_language();
131
        $currentlang = current_language();
123
        $custommenunodes = custom_menu::convert_text_to_menu_nodes($custommenuitems, $currentlang);
132
        $custommenunodes = custom_menu::convert_text_to_menu_nodes($custommenuitems, $currentlang);
124
        $nodes = [];
133
        $nodes = [];
125
        foreach ($custommenunodes as $node) {
134
        foreach ($custommenunodes as $node) {
Línea 206... Línea 215...
206
        $nodeurl = parse_url($node->url);
215
        $nodeurl = parse_url($node->url);
207
        $current = parse_url($FULLME ?? '');
216
        $current = parse_url($FULLME ?? '');
Línea 208... Línea 217...
208
 
217
 
Línea -... Línea 218...
-
 
218
        $pathmatches = false;
-
 
219
 
-
 
220
        // Check for same host names before comparing the path.
-
 
221
        $currenthost = array_key_exists('host', $current) ? strtolower($current['host']) : '';
-
 
222
        $nodehost = array_key_exists('host', $nodeurl) ? strtolower($nodeurl['host']) : '';
-
 
223
        if ($currenthost !== $nodehost) {
209
        $pathmatches = false;
224
            return false;
210
 
225
        }
211
        // Exact match of the path of node and current url.
226
        // Exact match of the path of node and current url.
212
        $nodepath = $nodeurl['path'] ?? '/';
227
        $nodepath = $nodeurl['path'] ?? '/';
213
        $currentpath = $current['path'] ?? '/';
228
        $currentpath = $current['path'] ?? '/';