Permalink
Browse files

made HTMLPurifier optional, in the case user already have it

  • Loading branch information...
nibsirahsieu committed May 3, 2011
1 parent 7d5e186 commit 89037e26c73e9335824445a5ae790355432ef802
Showing with 26 additions and 11 deletions.
  1. +11 −9 config/app.yml
  2. +7 −1 config/sfNestedCommentPluginConfiguration.class.php
  3. +8 −1 lib/sfNestedCommentConfig.class.php
View
@@ -29,12 +29,14 @@ all:
url_commentable_method: false # static method or function to generate the url to show the commentable object (example: module/action?slug=symfony-is-rock)
# example value: [sfSimpleBlogTools, generatePostUri]
use_packaged_style: true # use plugin's stylesheet
- allowed_tags:
- a: <a>
- blockquote: <blockquote>
- code: <code>
- em: <em>
- i: <i>
- p: <p>
- strong: <strong>
- pre: <pre>
+ purifier:
+ default_package: true # use default plugin's html purifier
+ allowed_tags:
+ a: <a>
+ blockquote: <blockquote>
+ code: <code>
+ em: <em>
+ i: <i>
+ p: <p>
+ strong: <strong>
+ pre: <pre>
@@ -11,12 +11,18 @@ public function initialize()
{
$this->dispatcher->connect('routing.load_configuration', array('sfNestedCommentRouting', 'listenToRoutingLoadConfigurationEvent'));
}
+
if (in_array('sfNestedCommentAdmin', sfConfig::get('sf_enabled_modules', array())))
{
$this->dispatcher->connect('routing.load_configuration', array('sfNestedCommentRouting', 'addRouteForNestedCommentAdmin'));
}
+
sfOutputEscaper::markClassAsSafe('sfNestedCommentsRenderer');
- self::registerHTMLPurifier();
+
+ if (sfNestedCommentConfig::isUsePluginPurifier())
+ {
+ self::registerHTMLPurifier();
+ }
}
}
@@ -78,9 +78,16 @@ static public function getUrlCommentableCallable()
static public function getAllowedTags()
{
- return sfConfig::get('app_sfNestedComment_allowed_tags', array());
+ $purifierConfig = sfConfig::get('app_sfNestedComment_purifier');
+ return $purifierConfig['allowed_tags'];
}
+ static public function isUsePluginPurifier()
+ {
+ $purifierConfig = sfConfig::get('app_sfNestedComment_purifier');
+ return $purifierConfig['default_package'];
+ }
+
static public function isUsePluginStylesheet()
{
return sfConfig::get('app_sfNestedComment_use_packaged_style', true);

0 comments on commit 89037e2

Please sign in to comment.