Examples of PluginProperties


Examples of net.sourceforge.pebble.PluginProperties

   *
   * @param context   the context in which the decoration is running
   * @param blogEntry the blog entry to be decorated
   */
  public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {
    PluginProperties props = blogEntry.getBlog().getPluginProperties();
    int maxLength = StringUtils.MAX_CONTENT_LENGTH;
    if (props.hasProperty(MAX_LENGTH_KEY)) {
      try {
        maxLength = Integer.parseInt(props.getProperty(MAX_LENGTH_KEY));
      } catch (NumberFormatException nfe) {
        log.error(nfe.getMessage());
        // do nothing, the value has already been defaulted
      }
    }
View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

   * Called when a comment or TrackBack has been added.
   *
   * @param response a Response
   */
  protected void blogEntryResponseAdded(Response response) {
    PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();

    if (isListed(response, props.getProperty(BLACKLIST_KEY))) {
      log.info(response.getTitle() + " marked as pending : IP address " + response.getIpAddress() + " is on blacklist");
      response.setPending();
      response.incrementSpamScore();
    } else if (isListed(response, props.getProperty(WHITELIST_KEY))) {
      // do nothing
    } else {
      log.info(response.getTitle() + " marked as pending : IP address " + response.getIpAddress() + " not on blacklist or whitelist");
      response.setPending();
    }
View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

   * Called when a comment or TrackBack has been approved.
   *
   * @param response a Response
   */
  protected void blogEntryResponseApproved(Response response) {
    PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();

    if (response.getIpAddress() == null || response.getIpAddress().trim().length() == 0) {
      return;
    }

    synchronized (props) {
      String whitelist = props.getProperty(WHITELIST_KEY);
      String blacklist = props.getProperty(BLACKLIST_KEY);
      whitelist = addIpAddress(response, whitelist);
      blacklist = removeIpAddress(response, blacklist);
      props.setProperty(WHITELIST_KEY, whitelist);
      props.setProperty(BLACKLIST_KEY, blacklist);
      props.store();
    }
  }
View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

   * Called when a comment or TrackBack has been rejected.
   *
   * @param response a Response
   */
  protected void blogEntryResponseRejected(Response response) {
    PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();

    if (response.getIpAddress() == null || response.getIpAddress().trim().length() == 0) {
      return;
    }

    synchronized (props) {
      String blacklist = props.getProperty(BLACKLIST_KEY);
      String whitelist = props.getProperty(WHITELIST_KEY);
      blacklist = addIpAddress(response, blacklist);
      whitelist = removeIpAddress(response, whitelist);
      props.setProperty(BLACKLIST_KEY, blacklist);
      props.setProperty(WHITELIST_KEY, whitelist);
      props.store();
    }
  }
View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

      int count = 0;
      while (m.find()) {
        count++;
      }

      PluginProperties props = response.getBlogEntry().getBlog().getPluginProperties();
      String propertyName = "";
      if (response instanceof Comment) {
        propertyName = COMMENT_THRESHOLD_KEY;
      } else {
        propertyName = TRACKBACK_THRESHOLD_KEY;
      }
      int threshold = DEFAULT_THRESHOLD;
      if (props.hasProperty(propertyName)) {
        try {
          threshold = Integer.parseInt(props.getProperty(propertyName));
        } catch (NumberFormatException nfe) {
          log.error(nfe.getMessage());
          // do nothing, the value has already been defaulted
        }
      }
View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

     * @param context the context in which the decoration is running
     * @param blogEntry the blog entry to be decorated
     */
    public void decorate(ContentDecoratorContext context, BlogEntry blogEntry) {
        Blog blog = blogEntry.getBlog();
        PluginProperties props = blog.getPluginProperties();
        String suffix;
        synchronized(props) {
            suffix = props.getProperty(SUFFIX);
        }

        if (suffix != null && suffix.trim().length() > 0) {
            Map<String,String> map = new HashMap();
            map.put("blogEntry.title", blogEntry.getTitle());
View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

      * @param request the HttpServletRequest used in the confirmation
      */
     public void setupConfirmation(HttpServletRequest request) {
          
           Blog blog = (Blog)request.getAttribute(Constants.BLOG_KEY);
           PluginProperties props = blog.getPluginProperties();
          
           boolean keySuccess = true;
          
           if (!props.hasProperty(RECAPTCHA_PUBLIC_KEY)) {
               keySuccess = false;
               log.error("failed to retrieve reCAPTCHA public API key");
           }
           if (!props.hasProperty(RECAPTCHA_PRIVATE_KEY)) {
               keySuccess = false;
               log.error("failed to retrieve reCAPTCHA private API key");
           }
          
           if (keySuccess) {
               String publicKey = props.getProperty(RECAPTCHA_PUBLIC_KEY);
               String privateKey = props.getProperty(RECAPTCHA_PRIVATE_KEY);
        
               ReCaptcha c = ReCaptchaFactory.newReCaptcha(publicKey, privateKey, false);
          
               request.getSession().setAttribute(CHALLENGE, c.createRecaptchaHtml(null, null));
           } else {
View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

     public boolean isConfirmed(HttpServletRequest request) {
        
           String remoteAddr = request.getRemoteAddr();
          
           Blog blog = (Blog)request.getAttribute(Constants.BLOG_KEY);
           PluginProperties props = blog.getPluginProperties();
          
           if (!props.hasProperty(RECAPTCHA_PRIVATE_KEY)) {
               log.error("failed to retrieve reCAPTCHA private API key");
               return false;
           }
          
           String privateKey = props.getProperty(RECAPTCHA_PRIVATE_KEY);
            
           ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
           reCaptcha.setPrivateKey(privateKey);

           String challenge = request.getParameter("recaptcha_challenge_field");
View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

  /**
   *
   */
  public void run() {
    try {
      PluginProperties props = blog.getPluginProperties();
      XmlRpcClient xmlrpc = new XmlRpcClient(props.getProperty(getPropertyPrefix() + XMLRPC_URL_KEY));
      Vector<Object> params = new Vector<Object>();
      params.add(props.getProperty(getPropertyPrefix() + BLOG_KEY));
      params.add(props.getProperty(getPropertyPrefix() + USERNAME_KEY));
      params.add(props.getProperty(getPropertyPrefix() + PASSWORD_KEY));

      int numberOfBlogEntries = 10;
      try {
        numberOfBlogEntries = Integer.parseInt(props.getProperty(getPropertyPrefix() + BLOG_ENTRIES_KEY));
      } catch (NumberFormatException nfe) {
        // do nothing, the value has already been defaulted
      }
      params.add(numberOfBlogEntries);

View Full Code Here

Examples of net.sourceforge.pebble.PluginProperties

   *
   * @param comment the Comment being confirmed
   * @return true if the comment should be confirmed, false otherwise
   */
  public boolean confirmationRequired(Comment comment) {
    PluginProperties props = comment.getBlogEntry().getBlog().getPluginProperties();
    String required = props.getProperty(REQUIRED_KEY);

    Blog blog = comment.getBlogEntry().getBlog();
    if (SecurityUtils.isUserAuthorisedForBlog(blog)) {
      return false;
    } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.