AIXF Batch Phrase Replace

AIXF Batch Phrase Replace 2.0.5

No permission to download
Just had a typo in a file. Thanks @Matt C. for reporting.
Quick Notes: I had to setup a dev rig for 2.1.7 for something. So I installed this on that setup and it tested out very well.

## Highlights
  • Preview → Confirm flow with CSV logging of changes
  • Variable/placeholder protection modes:
  • Auto (default): protects everything inside {...} — both {$vars} and {placeholders}
  • List: protects only the names you specify (one per line, without $)
  • Printf token protection: %s, %1$s, %02d, %.2f, %%, etc.
  • Find options: plain replace (case‑sensitive or insensitive) or regex

## Configuration
Options (ACP → Options → [AIXF] Batch Phrase Replace):
  • Variable protection mode
  • Auto: protects anything matching {...} where the name starts with $ or a letter. Examples protected: {forumTitle}, {$forumTitle}, {$user.name}, {count}.
  • List: protects only names you enter (one per line). Enter the base name, e.g. forumTitle, username, user.
  • Entering user protects {$user}, {$user.name}, {$user['name']} and {user}.
  • Protected variables (one per line) — used only when the mode is List.

Tip: To disable protection for a run, switch to List mode and leave the list empty.

## Usage
1. Open Batch Phrase Replace in the ACP (search for it or use your admin navigation).
2. Enter Find / Replace. For regex, include delimiters (e.g. /\bTitle\b/iu).
3. Pick language, add-on, or scope (admin/public/all) to narrow targets.
4. Click Preview to see per-phrase diffs.
5. Click Confirm to apply changes. A CSV log of updates is saved and can be downloaded.

### Example
Phrase text (before):
Code:
Hello {$forumTitle}, welcome to {forumTitle}. You have %1$d new alerts.
Find: TitleReplace: Name (case-insensitive)
After: Only the word “Title” outside braces changes. {forumTitle}, {$forumTitle}, and %1$d remain intact.

## What’s protected
  • {$variables} in templates
  • {placeholders} in phrases (including dotted or indexed forms)
  • Printf tokens: %s, %1$s, %02d, %.2f, %%, etc.

## Known limits
  • Nested { ... { ... } ... } is not supported; the inner } ends the match.
  • Protection is brace-based; if a value is not inside {...}, it can be replaced.
  • Regex: invalid patterns are auto-wrapped as UTF‑8 (/pattern/u). Provide full delimiters if you need flags.

## Troubleshooting
“Please enter a valid option ID.” during upgrade
Ensure _data/options.xml is present and addon.json lists:
Code:
aixfBprVarProtectMode
aixfBprSkipVars
Then run Tools → Rebuild caches → Rebuild add‑on data for this add‑on and retry the upgrade.

Nothing changed in Preview/Confirm
  • The word is probably inside {...} and protected. Switch to List mode and leave the list empty for that run, or adjust your target.
  • If using regex, verify your pattern matches outside braces (tokenization already guards inside braces).

CSV log location
A CSV is written under XenForo’s internal data path. The UI shows the file name and provides a download action after Confirm.image25.webp
  • Scope filtering option in the form to choose between All phrases, Public phrases, and Admin phrases. @Matt C. Thanks!
  • Improved warning message styling in preview page.
  • Adjusted background and text colors in preview table for better readability.
image17.webp

Attachments

  • image16.webp
    image16.webp
    164.4 KB · Views: 9
  • image155.webp
    image155.webp
    5 KB · Views: 9
  • Like
Reactions: Matt C. and Alpha1
Back
Top Bottom