Author: fizyk
Date: 2010-04-13 22:09:31 +0200 (Tue, 13 Apr 2010)
New Revision: 29126

Added:
   plugins/vjCommentPlugin/TRUNK/lib/vjComment.class.php
Log:
added class with static method to handle common check conditions

Added: plugins/vjCommentPlugin/TRUNK/lib/vjComment.class.php
===================================================================
--- plugins/vjCommentPlugin/TRUNK/lib/vjComment.class.php                       
        (rev 0)
+++ plugins/vjCommentPlugin/TRUNK/lib/vjComment.class.php       2010-04-13 
20:09:31 UTC (rev 29126)
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Library that holds all helping methods for coding
+ *
+ * @author fizyk
+ */
+class vjComment
+{
+  /**
+   * Checks wheter user is authenticated, and the sfGuardPlugin bound to 
commentable
+   * @return boolean
+   * @author fizyk
+   */
+  static function isUserBoundAndAuthenticated()
+  {
+      return sfContext::getInstance()->getUser()->isAuthenticated() && 
sfConfig::get( 'app_vjCommentPlugin_guardbind', false );
+  }
+
+  /**
+   * Check wheter or not the comment form can be accessed
+   * @return boolean
+   */
+  static function checkAccessToForm()
+  {
+      if( sfConfig::get( 'app_vjCommentPlugin_restricted' ) )
+      {
+          return vjComment::isUserBoundAndAuthenticated();
+      }
+      else
+      {
+          return true;
+      }
+  }
+
+  /**
+   *
+   * @return boolean
+   * @author jp_morvan
+   */
+  static function isCaptchaEnabled()
+  {
+    return sfConfig::get('app_recaptcha_enabled');
+  }
+}
+?>

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to