-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bugs with tinyurl.com and URLs inside HTML links, bump to 0.2.3
Plaintext URLs were working fine.
- Loading branch information
Showing
6 changed files
with
196 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
release-svn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
ZIPNAME="unwrap-shortlinks" | ||
|
||
echo "Removing old build folder and zip if present" | ||
if test -d "build/$ZIPNAME"; then | ||
rm -rf "build/$ZIPNAME" | ||
fi | ||
if test -f "build/$ZIPNAME.zip"; then | ||
rm "build/$ZIPNAME.zip" | ||
fi | ||
|
||
echo "Copying files to build folder" | ||
if [ ! -d build ]; then | ||
mkdir build | ||
fi | ||
|
||
mkdir build/$ZIPNAME | ||
cp -p *.php *.txt *.md LICENSE "build/$ZIPNAME" | ||
rm "build/$ZIPNAME/readme.md" | ||
|
||
echo "Building $ZIPNAME" | ||
cd build && zip -r "$ZIPNAME.zip" "$ZIPNAME" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
=== Unwrap Shortlinks === | ||
|
||
Stable tag: 0.2.3 | ||
Tags: urls, links, classicpress | ||
Requires at least: 3.0 | ||
Tested up to: 6.0 | ||
Requires PHP: 7.0 | ||
Contributors: Kelson | ||
License: GPLv2 or later | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
For ClassicPress | ||
Requires: 1.0 | ||
Tested: 1.4.1 | ||
|
||
Follow shortened links (t.co, bit.ly, etc) and expand them so that your blog post will point directly to the destination. | ||
|
||
== Description == | ||
|
||
Automatically expands URLs at the following known link shorteners when you save a post: | ||
* t.co | ||
* bit.ly | ||
* ow.ly | ||
* j.mp | ||
* is.gd | ||
* trib.al | ||
* buff.ly | ||
* wp.me | ||
* tmblr.co | ||
* tinyurl.com | ||
* goo.gl | ||
* dlvr.it | ||
* fb.me | ||
* qr.ae | ||
|
||
== Installation == | ||
|
||
Install the plugin and activate it. The next time you paste a supported short URL into a post, it will be updated when the post is saved. | ||
|
||
== Frequently Asked Questions == | ||
|
||
= What if the destination redirects to another link? = | ||
|
||
At the moment it'll stop at the first one to avoid infinite redirect loops. But if the destination is another known shortener (say you had a t.co link that redirected to a bit.ly link), the next time you save the post, it will follow that one to its destination. TODO: I plan to make it follow a limited chain of known shorteners. | ||
|
||
= How do I add a shortener to the list? = | ||
|
||
It's not supported yet, but I plan on adding an options page for it. | ||
|
||
= I'm running on a local server and this doesn't do anything! = | ||
|
||
Most likely your system is configured to block your local webserver | ||
from making outgoing connections. This is a sensible default for security! | ||
Depending on your system, it may be blocked by a local or network firewall. | ||
If you're running Fedora Workstation with SELinux (like I am), this will enable it: | ||
``` | ||
sudo setsebool -P httpd_can_network_connect true | ||
``` | ||
|
||
Thanks to [igienger's post](https://wordpress.org/support/topic/error-curl-error-7-3/#post-12637512) on the WordPress support forums! | ||
|
||
= What about compatibility? = | ||
|
||
It should work going back to the classic editor and forward to the block editor. It even works on [ClassicPress](https://www.classicpress.net/). | ||
|
||
== Changelog == | ||
|
||
= [0.2.3] - 2022-06-10 = | ||
* Fix bugs with tinyurl.com and URLs inside HTML links. (Plaintext URLs were working fine.) | ||
|
||
= [0.2.2] - 2022-01-29 = | ||
|
||
* Initial release based on the code I've been running locally for years, plus changes requested by the WordPress plugin review team. | ||
|
||
[Source on Codeberg](https://codeberg.org/kvibber/unwrap-shortlinks). | ||
[Plugin page at WordPress](https://wordpress.org/plugins/unwrap-shortlinks/). | ||
|
||
(c) 2016-2022 [Kelson Vibber](https://kvibber.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
# https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/ | ||
|
||
VERSION=$1 | ||
ACTION="" | ||
MESSAGE=$2 | ||
|
||
echo "Updating files in trunk." | ||
cp -p *.php *.md release-svn/trunk | ||
|
||
|
||
|
||
if [[ $VERSION == "trunk" ]]; then | ||
if [[ "x$MESSAGE" == "x" ]]; then | ||
echo "Message?" | ||
read MESSAGE | ||
fi | ||
if [[ "x$MESSAGE" == "x" ]]; then | ||
echo "Sorry, a message is required" | ||
exit -1 | ||
fi | ||
|
||
echo "Checking in the updated trunk" | ||
cd release-svn/trunk | ||
svn ci -m "$MESSAGE" | ||
exit 0 | ||
fi | ||
|
||
|
||
|
||
if [[ "x$VERSION" == "x" ]]; then | ||
echo "No release version specified, stopping here." | ||
exit 0 | ||
fi | ||
|
||
|
||
|
||
|
||
if [ ! -f ".git/refs/tags/v$VERSION" ]; then | ||
echo "Error: v$VERSION not found in git tags." | ||
exit -1 | ||
fi | ||
|
||
cd release-svn | ||
|
||
if [ -d "tags/$VERSION" ]; then | ||
echo "Warning: Release $VERSION already exists in local svn." | ||
echo "(r)eplace, (u)pload as-is, or (c)ancel?" | ||
read ACTION | ||
if [[ $ACTION == "r" ]]; then | ||
echo "removing old tag $VERSION" | ||
svn rm --force "tags/$VERSION" | ||
elif [[ ! $ACTION == "u" ]]; then | ||
echo "Cancelling" | ||
exit -1 | ||
fi | ||
fi | ||
|
||
if [[ $ACTION == "u" ]]; then | ||
echo "Leaving release tag unchanged." | ||
else | ||
echo "Tagging release $VERSION in svn." | ||
svn cp trunk "tags/$VERSION" | ||
fi | ||
|
||
echo "Checking in updated version $VERSION" | ||
svn ci -m "tagging version $VERSION" | ||
|
||
|