tags:

views:

61

answers:

1

NOTE: This question has been asked on the kohana forums at: http://forum.kohanaframework.org/comments.php?DiscussionID=6451

Hey everyone!

I am attempting to use HTML Purifier - I have it installed and working correctly. I have two helper functions, clean_all and clean_whitelist.

/config/purifier.php
<?php defined('SYSPATH') or die('No direct access allowed.'); return array( 'settings' => array( 'HTML.Allowed' =>'b,i,p,ul,ol,li' ), ); ?>

Clean_whitelist -
public static function clean_whitelist($dirty_data) { //Whitelist is defined at APPPATH/config/purifier.php return Security::xss_clean($dirty_data); }
This works as intended, as I have setup the htmlpurifier config file with the HTML.Allowed directive configured for my needs.

Clean_all should work similarly, except I want my configuration to set the HTML.Allowed to none.

QUESTION: Is there a way for me to change the configuration file at runtime?

Thanks, all!

+3  A: 

I'm the guy who answered you on the message board (Colonel-Rosa).

Straightforward

$config->set($key, $new_value);

OR ...

Pass the config data as an argument or store it as a class member then merge this data with the config file data.

The Pixel Developer
Fantastic! Thank you, I had looked in to doing this, but I was curious: do I need to specify which config I am talking about? Is this call enough to change the config on its own? Thanks!
PaleAilment
$config would be $config = Kohana::config('file'); I believe. Not tested it out.
The Pixel Developer

related questions