Example #1
0
  @Override
  public Object onExec() {
    String key = getToString(0);
    if (key == null) return "";

    String value = getToString(1);
    if (StringUtils.isNotBlank(value)) {
      String setting = Option.findValue(key);
      if (value.equals(setting)) {
        return "checked=\"checked\"";
      } else {
        return "";
      }
    }

    if (key.startsWith("!")) {
      Boolean bool = tryToGetBool(key.substring(1));
      if (bool != null && !bool) {
        return "checked=\"checked\"";
      }
    } else {
      Boolean bool = tryToGetBool(key);
      if (bool != null && bool) {
        return "checked=\"checked\"";
      }
    }

    return "";
  }
Example #2
0
  private Boolean tryToGetBool(String key) {
    String value = Option.findValue(key);
    Boolean ret = null;
    try {
      ret = Boolean.parseBoolean(value);
    } catch (Exception e) {
    }

    return ret;
  }
 public SimplerEmailSender() {
   this.host = Option.findValue("email_host"); // "smtp.qq.com";
   this.name = Option.findValue("email_username"); // "*****@*****.**";
   this.password = Option.findValue("email_password");
   this.useSSL = Boolean.parseBoolean(Option.findValue("email_usessl"));
 }