/** * setUp method * * @return void */ public function setUp() { parent::setUp(); $this->View = $this->getMock('View', array('append'), array(new Controller())); $this->Purifier = new HtmlPurifierHelper($this->View); Purifier::config('default', array('HTML.AllowedElements' => 'a, em, blockquote, p, strong, pre, code, span,ul,ol,li,img', 'HTML.AllowedAttributes' => 'a.href, a.title, img.src, img.alt', 'HTML.AllowedAttributes' => "*.style", 'CSS.AllowedProperties' => 'text-decoration', 'HTML.TidyLevel' => 'heavy', 'HTML.Doctype' => 'XHTML 1.0 Transitional')); }
/** * Gets a HtmlPurifier instance based on a configuration name. * * @param string $config * @return \HtmlPurifier */ public function getHtmlPurifier($config = 'default') { return Purifier::config($config); }
/** * Configures default file logging options */ App::uses('CakeLog', 'Log'); CakeLog::config('debug', array('engine' => 'FileLog', 'types' => array('notice', 'info', 'debug'), 'file' => 'debug')); CakeLog::config('error', array('engine' => 'FileLog', 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), 'file' => 'error')); CakePlugin::load('HtmlPurifier', array('bootstrap' => true)); $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.AllowedElements', 'a, br, em, blockquote, p, strong, pre, code, span, ul, ol, li, img, sup, sub, h1, h2, h3, h4, h5, h6, u, i, div'); $config->set('HTML.AllowedAttributes', 'a.target, a.href, a.title, img.src, img.alt, span.style, div.style'); $config->set('Attr.AllowedFrameTargets', array('_blank', '_self', '_parent', '_top')); $config->set('CSS.Trusted', true); $config->set('HTML.TidyLevel', 'heavy'); $config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); Purifier::config('UserPageInfo', $config); $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.SafeIframe', true); $config->set('HTML.AllowedElements', 'iframe'); $config->set('HTML.AllowedAttributes', 'iframe.src, iframe.style, iframe.width, iframe.height, iframe.frameborder, iframe.scrolling'); $config->set('URI.SafeIframeRegexp', '%^(https?:)?//www.google.com%'); $config->set('CSS.AllowedProperties', 'text-decoration'); $config->set('HTML.TidyLevel', 'heavy'); $config->set('HTML.Doctype', 'XHTML 1.0 Transitional'); Purifier::config('UserPageCalendar', $config); // Load Composer autoload. require APP . 'Vendor/autoload.php'; // Remove and re-prepend CakePHP's autoloader as Composer thinks it is the // most important. // See: http://goo.gl/kKVJO7 spl_autoload_unregister(array('App', 'load')); spl_autoload_register(array('App', 'load'), true, true);