Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 73... Línea 73...
73
 
73
 
74
        return false;
74
        return false;
Línea 75... Línea 75...
75
    }
75
    }
76
 
-
 
77
    /**
-
 
78
     * Reset internal textlib caches.
76
 
79
     * @static
-
 
80
     * @deprecated since Moodle 4.0. See MDL-53544.
77
    /**
-
 
78
     * @deprecated since Moodle 4.0. See MDL-53544.
-
 
79
     */
-
 
80
    #[\core\attribute\deprecated(
-
 
81
        'core_text::reset_caches',
-
 
82
        since: '4.0',
-
 
83
        reason:'Typo3 has been removed and caches aren\'t used anymore.',
-
 
84
        mdl: 'MDL-53544',
81
     * @todo To be removed in Moodle 4.4 - MDL-71748
85
        final: true,
82
     */
86
    )]
83
    public static function reset_caches() {
87
    public static function reset_caches(): void {
Línea 84... Línea 88...
84
        debugging("reset_caches() is deprecated. Typo3 has been removed and caches aren't used anymore.", DEBUG_DEVELOPER);
88
        \core\deprecation::emit_deprecation([self::class, __FUNCTION__]);
85
    }
89
    }
86
 
90
 
Línea 444... Línea 448...
444
    /**
448
    /**
445
     * Returns HTML entity transliteration table.
449
     * Returns HTML entity transliteration table.
446
     * @return array with (html entity => utf-8) elements
450
     * @return array with (html entity => utf-8) elements
447
     */
451
     */
448
    protected static function get_entities_table() {
452
    protected static function get_entities_table() {
449
        static $trans_tbl = null;
453
        static $translationtable = null;
Línea 450... Línea 454...
450
 
454
 
451
        // Generate/create $trans_tbl
455
        // Generate/create $trans_tbl
452
        if (!isset($trans_tbl)) {
-
 
453
            if (version_compare(phpversion(), '5.3.4') < 0) {
-
 
454
                $trans_tbl = array();
-
 
455
                foreach (get_html_translation_table(HTML_ENTITIES, ENT_COMPAT) as $val=>$key) {
-
 
456
                    $trans_tbl[$key] = self::convert($val, 'ISO-8859-1', 'utf-8');
-
 
457
                }
-
 
458
 
-
 
459
            } else if (version_compare(phpversion(), '5.4.0') < 0) {
-
 
460
                $trans_tbl = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, 'UTF-8');
-
 
461
                $trans_tbl = array_flip($trans_tbl);
-
 
462
 
-
 
463
            } else {
456
        if (!isset($translationtable)) {
464
                $trans_tbl = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT | ENT_HTML401, 'UTF-8');
457
            $translationtable = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT | ENT_HTML401, 'UTF-8');
465
                $trans_tbl = array_flip($trans_tbl);
-
 
466
            }
458
            $translationtable = array_flip($translationtable);
Línea 467... Línea 459...
467
        }
459
        }
468
 
460
 
Línea 469... Línea 461...
469
        return $trans_tbl;
461
        return $translationtable;
470
    }
462
    }
471
 
463
 
Línea 674... Línea 666...
674
            return $text;
666
            return $text;
675
        }
667
        }
Línea 676... Línea 668...
676
 
668
 
677
        return mb_convert_case($text, MB_CASE_TITLE, 'UTF-8');
669
        return mb_convert_case($text, MB_CASE_TITLE, 'UTF-8');
-
 
670
    }
-
 
671
 
-
 
672
    /**
-
 
673
     * Trims control characters out of a string.
-
 
674
     * Example: (\x00-\x1f) and (\x7f)
-
 
675
     *
-
 
676
     * @param string $text Input string
-
 
677
     * @return string Cleaned string value
-
 
678
     */
-
 
679
    public static function trim_ctrl_chars(string $text): string {
-
 
680
        // Remove control characters text.
-
 
681
        return preg_replace('/[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]/i', '', $text);
678
    }
682
    }