| Server IP : 188.114.97.2 / Your IP : 104.23.197.231 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/nicolasj/www/sms.formationlangues.be/application/helpers/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
* Codeigniter HTMLPurifier Helper
*
* Purify input using the HTMLPurifier standalone class.
* Easily use multiple purifier configurations.
*
* @author Tyler Brownell <[email protected]>
* @copyright Public Domain
*
* @access public
* @param string or array $dirty_html A string (or array of strings) to be cleaned.
* @param string $config The name of the configuration (switch case) to use.
* @return string or array The cleaned string (or array of strings).
*/
if (!function_exists('html_purify')) {
function html_purify($dirty_html, $config = false)
{
if (is_array($dirty_html)) {
foreach ($dirty_html as $key => $val) {
$clean_html[$key] = html_purify($val, $config);
}
} else {
$ci = &get_instance();
switch ($config) {
case 'comment':
$config = \HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', $ci->config->item('charset'));
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
$config->set('HTML.Allowed', 'p,a[href|title],abbr[title],acronym[title],b,strong,blockquote[cite],code,em,i,strike');
$config->set('AutoFormat.AutoParagraph', true);
$config->set('AutoFormat.Linkify', true);
$config->set('AutoFormat.RemoveEmpty', true);
break;
case false:
$config = \HTMLPurifier_Config::createDefault();
$config->set('Core.Encoding', $ci->config->item('charset'));
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
break;
default:
show_error('The HTMLPurifier configuration labeled "'.htmlspecialchars($config, ENT_QUOTES, $ci->config->item('charset')).'" could not be found.');
}
$purifier = new \HTMLPurifier($config);
$clean_html = $purifier->purify($dirty_html);
}
return $clean_html;
}
}