{"id":13524725,"url":"https://github.com/takuy/yourls-replacetext","last_synced_at":"2025-04-01T03:32:23.954Z","repository":{"id":225264648,"uuid":"765509324","full_name":"takuy/yourls-replacetext","owner":"takuy","description":"This plugin for YOURLS allows you to create redirects based on regex patterns, simple text replacements or script. ","archived":false,"fork":false,"pushed_at":"2024-07-26T14:29:12.000Z","size":22,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-02T09:31:50.829Z","etag":null,"topics":["yourls","yourls-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takuy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-01T03:51:33.000Z","updated_at":"2024-07-26T14:29:15.000Z","dependencies_parsed_at":"2024-11-02T09:30:31.191Z","dependency_job_id":"e1fe3560-a62c-4152-add8-15c7396ef50c","html_url":"https://github.com/takuy/yourls-replacetext","commit_stats":null,"previous_names":["takuy/yourls-replacetext"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuy%2Fyourls-replacetext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuy%2Fyourls-replacetext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuy%2Fyourls-replacetext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuy%2Fyourls-replacetext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuy","download_url":"https://codeload.github.com/takuy/yourls-replacetext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246578544,"owners_count":20799849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["yourls","yourls-plugin"],"created_at":"2024-08-01T06:01:12.824Z","updated_at":"2025-04-01T03:32:23.715Z","avatar_url":"https://github.com/takuy.png","language":"PHP","funding_links":[],"categories":["Plugins"],"sub_categories":["R"],"readme":"# Plugin for YOURLS: replacetext\n\n## What for\n\nThis plugin allows you to create dynamic or smart redirects - not 100% sure what to call them, but you can use regex, simple text replacements or a script!\n\n## How to install\n\n* In `/user/plugins`, create a new folder named `replacetext`\n* Drop these files in that directory\n* Go to the Plugins administration page and activate the plugin \n* Have fun\n\n## How to use\n\nA short URL keyword prefixed with `regex/`, followed by a regex pattern will allow you to redirect based on regex pattern, but also do replacements within the Long URL based on the pattern match. You can use numerical tokens like `[[1]]`, `[[2]]`, etc to insert specific match groups from the regex pattern. Prefix the number in the token with ! to force uppercase the replaced text, ie `[[!1]]`.\n\nA short URL keyword in the format `wordone/wordtwo` will allow you to replace the token `[[wordone]]` in the long URL whatever ``wordtwo`` is in your Navigation URL.  \n\nA replacement token may also be provided in a long URL, in which case a short URL navigation with that token as a query parameter will cause a replacement, ie, if a `[[token]]` is provided in a Long URL like `https://example.com/?lookup=[[token]]` with Short URL `https://sho.rt/ex` - then navigating to URL `https://sho.rt/ex?token=12345` will redirect you to `https://example.com/?lookup=12345`.\n\nA short URL keyword in the format `$scriptname/` following by a regex pattern will allow you to call a script with name \"`scriptname.php`\" from the folder `./scripts/`. See [sample.php](scripts/sample.php) as an example for how the YOURLS filter hook should be structured. The requested keyword from the navigation URL, the matched Short URL keyword, the matched Long URL, and an array of the Regex matches are passed to the script. \n\nMost easily described with examples...\n\nBase YOURLS example: `https://sho.rt` \n\n| Short URL | Long URL  | Navigation URL \u003cbr\u003e \u003csub\u003ewhat you would navigate to in your browser\u003c/sub\u003e  | Final Redirect    |\n| ---       | ---           | ---               | ---               |\n| `regex/(REQ[0-9]*)`| `https://example.com/?ticket=%22[[1]]%22` | `https://sho.rt/REQ0000010` | `https://example.com/?ticket=\"REQ0000010\"` |\n| `whatever`| `https://example.com/?ticket=%22[[req]]%22` | `https://sho.rt/whatever?req=REQ0000010` | `https://example.com/?ticket=\"REQ0000010\"` |\n| `regex/(.*)_(.*)` | `https://www.google.com/search?q=[[1]]\u0026tbm=[[2]]` | `https://sho.rt/sample_isch` | `https://www.google.com/search?q=sample\u0026tbm=isch` |\n| `req` | `https://example.com/?ticket=%22[[req]]%22` | `https://sho.rt/req/REQ0000010` | `https://example.com/?ticket=\"REQ0000010\"` | \n| `$sample/google_(.*)` | `anything` \u003cbr\u003e \u003csub\u003epassed to the script for use\u003c/sub\u003e | `https://sho.rt/google_hello%20world` | `https://www.google.com/search?q=hello%20world` | \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuy%2Fyourls-replacetext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuy%2Fyourls-replacetext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuy%2Fyourls-replacetext/lists"}