' . PHP_EOL; } /** * Prints a html div close tag * @param string $class * @since 8.0.0 */ public static function div_close($class = '') { // Print the class name as comment in debug mode $c = (TEACHPRESS_DEBUG === true && $class !== '') ? '' : ''; echo '' . $c . PHP_EOL; } /** * Prepares a title string for normal html output. Works like htmlspecialchars_decode, but with a white list * @param string $input The input string * @param string $mode decode or replace * @return string * @since 5.0.10 * @access public */ public static function prepare_title ($input, $mode = 'decode') { $search = array('<sub>', '</sub>', '<sup>', '</sup>', '<small>', '</small>', '<i>', '</i>', '<b>', '</b>', '<s>', '</s>', '<del>', '</del>', '<em>', '</em>', '<u>', '</u>'); if ( $mode === 'decode' ) { $replace = array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '' ); } else { $replace = array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); } $output = str_replace($search, $replace, $input); return stripslashes($output); } /** * Prepares a text for normal html output. Works like htmlspecialchars_decode, but with a white list * @param string $input * @return string * @since 5.0.10 * @access public */ public static function prepare_text ($input) { $search = array('<sub>', '</sub>', '<sup>', '</sup>', '<i>', '</i>', '<b>', '</b>', '<s>', '</s>', '<em>', '</em>', '<u>', '</u>', '<ul>', '</ul>', '<li>', '</li>', '<ol>', '</ol>' ); $replace = array('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '
  • ', '
  • ', '
      ', '
    ' ); $output = str_replace($search, $replace, $input); return nl2br(stripslashes($output)); } /** * Converts some HTML special chars with the UTF-8 versions * @param string $input * @return string * @since 6.0.0 */ public static function convert_special_chars ($input) { $array_1 = array('Ü','ü', 'Ö','ö','ò','ó','Ò','Ó', 'Ä','ä','á','à','À','Á', 'é','è','È','É', '§','©','®','£','¥', 'ß','µ','&', ' ','–','”','“','»','«','­','"'); $array_2 = array('Ü','ü', 'Ö','ö','ò','ó','Ò','Ó', 'Ä','ä','á','à','À','Á', 'é','è','È','É', '§','©','®','£','¥', 'ß','µ','&', ' ','-','”','“','»','«','­','"'); $input = str_replace($array_1, $array_2, $input); return $input; } }