Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 1... Línea 1...
1
<?php
1
<?php
Línea 2... Línea -...
2
 
-
 
3
declare(strict_types=1);
2
 
4
/**
3
/**
5
 * SimplePie
4
 * SimplePie
6
 *
5
 *
7
 * A PHP-Based RSS and Atom Feed Framework.
6
 * A PHP-Based RSS and Atom Feed Framework.
Línea 131... Línea 130...
131
    public function set_registry(\SimplePie\Registry $registry)/* : void */
130
    public function set_registry(\SimplePie\Registry $registry)/* : void */
132
    {
131
    {
133
        $this->registry = $registry;
132
        $this->registry = $registry;
134
    }
133
    }
Línea 135... Línea 134...
135
 
134
 
136
    public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie\Cache', DataCache $cache = null)
135
    public function pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie\Cache', ?DataCache $cache = null)
137
    {
136
    {
138
        if (isset($enable_cache)) {
137
        if (isset($enable_cache)) {
139
            $this->enable_cache = (bool) $enable_cache;
138
            $this->enable_cache = (bool) $enable_cache;
Línea 140... Línea 139...
140
        }
139
        }
141
 
140
 
142
        if ($cache_location) {
141
        if ($cache_location) {
Línea 143... Línea 142...
143
            $this->cache_location = (string) $cache_location;
142
            $this->cache_location = (string) $cache_location;
144
        }
143
        }
145
 
144
 
146
        if (! is_string($cache_name_function) && ! is_object($cache_name_function) && ! $cache_name_function instanceof NameFilter) {
145
        if (!is_string($cache_name_function) && !is_object($cache_name_function) && !$cache_name_function instanceof NameFilter) {
147
            throw new InvalidArgumentException(sprintf(
146
            throw new InvalidArgumentException(sprintf(
148
                '%s(): Argument #3 ($cache_name_function) must be of type %s',
147
                '%s(): Argument #3 ($cache_name_function) must be of type %s',
Línea 295... Línea 294...
295
    {
294
    {
296
        $this->https_domains = [];
295
        $this->https_domains = [];
297
        foreach ($domains as $domain) {
296
        foreach ($domains as $domain) {
298
            $domain = trim($domain, ". \t\n\r\0\x0B");
297
            $domain = trim($domain, ". \t\n\r\0\x0B");
299
            $segments = array_reverse(explode('.', $domain));
298
            $segments = array_reverse(explode('.', $domain));
300
            $node =& $this->https_domains;
299
            $node = &$this->https_domains;
301
            foreach ($segments as $segment) {//Build a tree
300
            foreach ($segments as $segment) {//Build a tree
302
                if ($node === true) {
301
                if ($node === true) {
303
                    break;
302
                    break;
304
                }
303
                }
305
                if (!isset($node[$segment])) {
304
                if (!isset($node[$segment])) {
306
                    $node[$segment] = [];
305
                    $node[$segment] = [];
307
                }
306
                }
308
                $node =& $node[$segment];
307
                $node = &$node[$segment];
309
            }
308
            }
310
            $node = true;
309
            $node = true;
311
        }
310
        }
312
    }
311
    }
Línea 316... Línea 315...
316
     */
315
     */
317
    protected function is_https_domain($domain)
316
    protected function is_https_domain($domain)
318
    {
317
    {
319
        $domain = trim($domain, '. ');
318
        $domain = trim($domain, '. ');
320
        $segments = array_reverse(explode('.', $domain));
319
        $segments = array_reverse(explode('.', $domain));
321
        $node =& $this->https_domains;
320
        $node = &$this->https_domains;
322
        foreach ($segments as $segment) {//Explore the tree
321
        foreach ($segments as $segment) {//Explore the tree
323
            if (isset($node[$segment])) {
322
            if (isset($node[$segment])) {
324
                $node =& $node[$segment];
323
                $node = &$node[$segment];
325
            } else {
324
            } else {
326
                break;
325
                break;
327
            }
326
            }
328
        }
327
        }
329
        return $node === true;
328
        return $node === true;