Permalink
Browse files

Applied fixes from StyleCI

1 parent ed14ada commit ce3db593f19e4a2bbdf409265a3442d931413cc3 @refringe committed with StyleCIBot Sep 15, 2016
Showing with 19 additions and 22 deletions.
  1. +19 −22 htmlpurifier_helper.php
@@ -1,6 +1,10 @@
-<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
-/**
+if (!defined('BASEPATH')) {
+ exit('No direct script access allowed');
+}
+
+/*
* Codeigniter HTMLPurifier Helper
*
* Purify input using the HTMLPurifier standalone class.
@@ -15,44 +19,37 @@
* @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 (!function_exists('html_purify')) {
+ function html_purify($dirty_html, $config = false)
{
- require_once APPPATH . 'third_party/htmlpurifier-4.8.0-standalone/HTMLPurifier.standalone.php';
+ require_once APPPATH.'third_party/htmlpurifier-4.8.0-standalone/HTMLPurifier.standalone.php';
- if (is_array($dirty_html))
- {
- foreach ($dirty_html as $key => $val)
- {
+ if (is_array($dirty_html)) {
+ foreach ($dirty_html as $key => $val) {
$clean_html[$key] = html_purify($val, $config);
}
- }
-
- else
- {
- $ci =& get_instance();
+ } else {
+ $ci = &get_instance();
- switch ($config)
- {
+ 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);
+ $config->set('AutoFormat.AutoParagraph', true);
+ $config->set('AutoFormat.Linkify', true);
+ $config->set('AutoFormat.RemoveEmpty', true);
break;
- case FALSE:
+ 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.');
+ show_error('The HTMLPurifier configuration labeled "'.htmlspecialchars($config, ENT_QUOTES, $ci->config->item('charset')).'" could not be found.');
}
$purifier = new HTMLPurifier($config);

0 comments on commit ce3db59

Please sign in to comment.