WP Manifestindependent plugin directory
manifest / utilities / pdflinkeditor

PDF Link Marker

Small WordPress widget + shortcode that swaps a tagged placeholder in a PDF with a user-supplied link and returns a downloadable copy.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/tech-adarshjha/pdflinkeditor/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

PDF Link Editor (WordPress)

contains legacy code, update. use as reference only.

Small WordPress widget + shortcode that swaps a tagged placeholder in a PDF with a user-supplied link and returns a downloadable copy. Includes a simple license check hook and a temporary file cleaner.

What this does

  • Expects a base PDF at wp-content/uploads/custom.pdf with a placeholder tag (default [affid]).
  • Replaces that tag with a user-provided link (strips http:// / https://), writes a copy, and serves it for download.
  • Creates a Temp folder inside the plugin directory for generated files and deletes files older than 10 minutes.
  • Provides both a WordPress widget and a [PDFLINKEDIT] shortcode form.

Requirements

  • WordPress with plugin upload rights.
  • PHP 7.0+ and permission to create/write wp-content/plugins/PdfLinkEditor/Temp.
  • A template PDF at wp-content/uploads/custom.pdf containing the placeholder tag you want replaced.

Quick start

  1. Copy the plugin folder to wp-content/plugins/PdfLinkEditor/ and activate PDF Link Marker in wp-admin.
  2. Upload your template PDF to wp-content/uploads/custom.pdf (update the path in includes/Pdfgenerator*.php if you keep it elsewhere).
  3. Set your placeholder tag (e.g., [affid]) inside the PDF.
  4. Choose one of the usage options below.

Usage

Widget (wp-admin > Appearance > Widgets)

  • Drag PDF Link Editor into a sidebar.
  • Configure:
    • License Key: Checked against your license server (see “Licensing notes”).
    • Title: Optional heading above the form.
    • Description above/below: Helper text around the form.
    • Default Tag: Tag that will be replaced in the PDF.

Shortcode

  • Insert [PDFLINKEDIT] into a page or post.
  • The bundled markup posts to includes/Pdfgenerator_Shortcode.php and uses hidden inputs:
[PDFLINKEDIT]

If you want to hand-roll the form, mirror the hidden tag and key fields and POST to Pdfgenerator_Shortcode.php.

What the form does

  • Accepts a link, strips protocol, replaces the placeholder tag in the template PDF, and forces a download of the generated file.

File map (quick reference)

  • PdfLinkEditor.php: Plugin bootstrap, widget registration, shortcode output.
  • includes/PdfLinkEditor-class.php: Widget admin + front-end rendering and license check.
  • includes/Pdfgenerator.php: Handles widget form submission, creates/downloads the PDF copy.
  • includes/Pdfgenerator_Shortcode.php: Same as above but for the shortcode form, with license check.
  • includes/LinkReplacer.php: Simple string replace helper for the PDF content.
  • includes/CleanTempFolder.php: Deletes temp PDFs older than 10 minutes.
  • css/bootstrap.min.css, js/main.js: Enqueued assets.
  • Misc/ShortCode.html: Standalone HTML example of the shortcode form.

Licensing notes

  • The code currently points to a local license server (http://localhost/wordpress) with sample secret keys. Update SECRET_KEY, LICENSE_SERVER_URL, and form hidden key values before production use.
  • License checks are performed via simple GET requests; ensure your license server is reachable over HTTPS and that keys are stored securely.

Security and data handling

  • Generated PDFs are stored in wp-content/plugins/PdfLinkEditor/Temp and deleted after ~10 minutes. If you need longer retention or a different path, adjust $PDF_avail_time and $tempFolderPath in includes/Pdfgenerator*.php.
  • Input is lightly sanitized (protocol stripped). For public deployments consider additional validation (allowed domains, length limits) and HTTPS everywhere.
  • PDF modification is a plain text replace. It assumes the placeholder exists as text in the PDF; it does not rewrite embedded link objects.

Developing

  • Enqueued assets: PdfLinkEditor-scripts.php hooks Bootstrap + js/main.js on the front end.
  • To change the template path or tag, edit includes/Pdfgenerator.php and includes/Pdfgenerator_Shortcode.php.
  • Keep PHP error display off in production; current files set error_reporting(0).

License

This project is provided as it is without warranty. Use at your own risk.