Exemplo n.º 1
0
  /**
   * wp_load_image() - Load an image which PHP Supports.
   *
   * @package WordPress
   * @internal Missing Long Description
   * @param string $file Filename of the image to load
   * @return resource The resulting image resource on success, Error string on failure.
   */
  public Object wp_load_image(Object fileObj) {
    int image = 0;

    // Modified by Numiton
    String file;

    if (is_numeric(fileObj)) {
      file =
          strval(
              getIncluded(PostPage.class, gVars, gConsts)
                  .get_attached_file(intval(fileObj), false));
    } else {
      file = strval(fileObj);
    }

    if (!FileSystemOrSocket.file_exists(gVars.webEnv, file)) {
      return QStrings.sprintf(
          getIncluded(L10nPage.class, gVars, gConsts).__("File \'%s\' doesn\'t exist?", "default"),
          file);
    }

    if (!true) /*Modified by Numiton*/ {
      return getIncluded(L10nPage.class, gVars, gConsts)
          .__("The GD image library is not installed.", "default");
    }

    // Set artificially high because GD uses uncompressed images in memory
    Options.ini_set(gVars.webEnv, "memory_limit", "256M");
    image =
        Image.imagecreatefromstring(
            gVars.webEnv, FileSystemOrSocket.file_get_contents(gVars.webEnv, file));

    if (!is_resource(image)) {
      return QStrings.sprintf(
          getIncluded(L10nPage.class, gVars, gConsts).__("File \'%s\' is not an image.", "default"),
          file);
    }

    return image;
  }
Exemplo n.º 2
0
  public boolean check_post_keyword(boolean precheck) {
    Object metakeys; /* Do not change type */
    int count = 0;
    StdClass post_meta = null;
    Array<String> post_keys = new Array<String>();
    String keyword = null;

    echo(gVars.webEnv, "<div class=\"narrow\">");
    echo(
        gVars.webEnv,
        "<p><h3>"
            + getIncluded(L10nPage.class, gVars, gConsts)
                .__("Reading Bunny&#8217;s Technorati Tags&#8230;", "default")
            + "</h3></p>");

    // import Bunny's Keywords tags
    metakeys =
        gVars.wpdb.get_results(
            "SELECT post_id, meta_id, meta_key, meta_value FROM "
                + gVars.wpdb.postmeta
                + " WHERE "
                + gVars.wpdb.postmeta
                + ".meta_key = \'tags\'");

    if (!is_array(metakeys)) {
      echo(
          gVars.webEnv,
          "<p>"
              + getIncluded(L10nPage.class, gVars, gConsts).__("No Tags Found!", "default")
              + "</p>");

      return false;
    } else {
      count = Array.count(metakeys);
      echo(
          gVars.webEnv,
          "<p>"
              + QStrings.sprintf(
                  getIncluded(L10nPage.class, gVars, gConsts)
                      .__ngettext(
                          "Done! <strong>%s</strong> post with tags were read.",
                          "Done! <strong>%s</strong> posts with tags were read.", count, "default"),
                  count)
              + "<br /></p>");
      echo(gVars.webEnv, "<ul>");

      for (Map.Entry javaEntry50 : ((Array<?>) metakeys).entrySet()) {
        post_meta = (StdClass) javaEntry50.getValue();

        if (!equal(StdClass.getValue(post_meta, "meta_value"), "")) {
          post_keys = Strings.explode(" ", strval(StdClass.getValue(post_meta, "meta_value")));

          for (Map.Entry javaEntry51 : post_keys.entrySet()) {
            keyword = strval(javaEntry51.getValue());
            keyword =
                Strings.addslashes(
                    gVars.webEnv, Strings.trim(Strings.str_replace("+", " ", keyword)));

            if (!equal("", keyword)) {
              echo(
                  gVars.webEnv,
                  "<li>"
                      + StdClass.getValue(post_meta, "post_id")
                      + "&nbsp;-&nbsp;"
                      + keyword
                      + "</li>");

              if (!precheck) {
                getIncluded(PostPage.class, gVars, gConsts)
                    .wp_add_post_tags(intval(StdClass.getValue(post_meta, "post_id")), keyword);
              }
            }
          }
        }

        if (!precheck) {
          getIncluded(PostPage.class, gVars, gConsts)
              .delete_post_meta(intval(StdClass.getValue(post_meta, "post_id")), "tags", "");
        }
      }

      echo(gVars.webEnv, "</ul>");
    }

    echo(
        gVars.webEnv,
        "<form action=\"admin.php?import=btt&amp;step="
            + strval(precheck ? 2 : 3)
            + "\" method=\"post\">");
    getIncluded(FunctionsPage.class, gVars, gConsts)
        .wp_nonce_field("import-btt", "_wpnonce", true, true);
    echo(
        gVars.webEnv,
        "<p class=\"submit\"><input type=\"submit\" name=\"submit\" value=\""
            + getIncluded(L10nPage.class, gVars, gConsts).__("Next", "default")
            + "\" /></p>");
    echo(gVars.webEnv, "</form>");
    echo(gVars.webEnv, "</div>");

    return false;
  }