Version Description
- Fix a PHP notice
- Use JS to open links in an external window, even outside of nav menus
- Completely revamped UI
- Several translations
Download this release
Release Info
| Developer | markjaquith |
| Plugin | |
| Version | 2.7 |
| Comparing to | |
| See all releases | |
Code changes from version 2.6 to 2.7
- js/page-links-to.dev.js +12 -0
- languages/page-links-to-ja.mo +0 -0
- languages/page-links-to-ja.po +56 -0
- languages/page-links-to-nb_NO.mo +0 -0
- languages/page-links-to-nb_NO.po +56 -0
- languages/page-links-to-pt-BR.mo +0 -0
- languages/page-links-to-pt-BR.po +54 -0
- languages/page-links-to.pot +58 -0
- page-links-to.php +48 -7
- readme.txt +17 -11
- screenshot-1.png +0 -0
js/page-links-to.dev.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(function($){
|
| 2 |
+
$('input[type=radio]', '#page-links-to').change(function(){
|
| 3 |
+
if ( 'wp' == $(this).val() ) {
|
| 4 |
+
$('#txfx-links-to-alternate-section').fadeOut();
|
| 5 |
+
} else {
|
| 6 |
+
$('#txfx-links-to-alternate-section').fadeIn(function(){
|
| 7 |
+
i = $('#txfx-links-to');
|
| 8 |
+
i.focus().val(i.val());
|
| 9 |
+
});
|
| 10 |
+
}
|
| 11 |
+
});
|
| 12 |
+
})(jQuery);
|
languages/page-links-to-ja.mo
ADDED
|
Binary file
|
languages/page-links-to-ja.po
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2012 Page Links To
|
| 2 |
+
# This file is distributed under the same license as the Page Links To package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Page Links To 2.7-beta\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/page-links-to\n"
|
| 7 |
+
"POT-Creation-Date: 2012-01-05 22:58:34+00:00\n"
|
| 8 |
+
"MIME-Version: 1.0\n"
|
| 9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
+
"PO-Revision-Date: 2012-01-06 10:07+0900\n"
|
| 12 |
+
"Last-Translator: JOTAKI, Taisuke <jotaki@digitalcube.jp>\n"
|
| 13 |
+
"Language-Team: ja <tekapo@gmail.com>\n"
|
| 14 |
+
"X-Poedit-Language: ja\n"
|
| 15 |
+
"X-Poedit-Country: JP\n"
|
| 16 |
+
|
| 17 |
+
#: page-links-to.php:153
|
| 18 |
+
msgid "Point this content to:"
|
| 19 |
+
msgstr "このコンテンツを向ける先:"
|
| 20 |
+
|
| 21 |
+
#: page-links-to.php:154
|
| 22 |
+
msgid "Its normal WordPress URL"
|
| 23 |
+
msgstr "通常の WordPress の URL"
|
| 24 |
+
|
| 25 |
+
#: page-links-to.php:155
|
| 26 |
+
msgid "An alternate URL"
|
| 27 |
+
msgstr "代替の URL"
|
| 28 |
+
|
| 29 |
+
#: page-links-to.php:158
|
| 30 |
+
msgid "Open this link in a new window"
|
| 31 |
+
msgstr "このリンクを新しいウインドウで開く"
|
| 32 |
+
|
| 33 |
+
#: page-links-to.php:286
|
| 34 |
+
msgid "<strong>Note</strong>: This content is pointing to an alternate URL. Use the “Page Links To” box to change this behavior."
|
| 35 |
+
msgstr "<strong>メモ</strong>: このコンテンツは別の URL に向けられています。この挙動を変更するには “Page Links To” ボックスを利用してください。"
|
| 36 |
+
|
| 37 |
+
#. Plugin Name of the plugin/theme
|
| 38 |
+
msgid "Page Links To"
|
| 39 |
+
msgstr "Page Links To"
|
| 40 |
+
|
| 41 |
+
#. Plugin URI of the plugin/theme
|
| 42 |
+
msgid "http://txfx.net/wordpress-plugins/page-links-to/"
|
| 43 |
+
msgstr "http://txfx.net/wordpress-plugins/page-links-to/"
|
| 44 |
+
|
| 45 |
+
#. Description of the plugin/theme
|
| 46 |
+
msgid "Allows you to point WordPress pages or posts to a URL of your choosing. Good for setting up navigational links to non-WP sections of your site or to off-site resources."
|
| 47 |
+
msgstr "WordPress の固定ページや投稿を任意の URL に向けます。WP 以外のセクションやサイト外のリソースにナビゲーションリンクを設定するのに便利です。"
|
| 48 |
+
|
| 49 |
+
#. Author of the plugin/theme
|
| 50 |
+
msgid "Mark Jaquith"
|
| 51 |
+
msgstr "Mark Jaquith"
|
| 52 |
+
|
| 53 |
+
#. Author URI of the plugin/theme
|
| 54 |
+
msgid "http://coveredwebservices.com/"
|
| 55 |
+
msgstr "http://coveredwebservices.com/"
|
| 56 |
+
|
languages/page-links-to-nb_NO.mo
ADDED
|
Binary file
|
languages/page-links-to-nb_NO.po
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2012 Page Links To
|
| 2 |
+
# This file is distributed under the same license as the Page Links To package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Page Links To 2.7-beta\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/page-links-to\n"
|
| 7 |
+
"POT-Creation-Date: 2012-01-05 22:58:34+00:00\n"
|
| 8 |
+
"MIME-Version: 1.0\n"
|
| 9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
+
"PO-Revision-Date: 2012-01-06 00:39+0100\n"
|
| 12 |
+
"Last-Translator: \n"
|
| 13 |
+
"Language-Team: NorskWP <post@gulbrandsoy.com>\n"
|
| 14 |
+
"X-Poedit-Language: Norwegian Bokmal\n"
|
| 15 |
+
"X-Poedit-Country: NORWAY\n"
|
| 16 |
+
|
| 17 |
+
#: page-links-to.php:153
|
| 18 |
+
msgid "Point this content to:"
|
| 19 |
+
msgstr "Pek dette innholdet til:"
|
| 20 |
+
|
| 21 |
+
#: page-links-to.php:154
|
| 22 |
+
msgid "Its normal WordPress URL"
|
| 23 |
+
msgstr "Sin vanlige WordPress URL"
|
| 24 |
+
|
| 25 |
+
#: page-links-to.php:155
|
| 26 |
+
msgid "An alternate URL"
|
| 27 |
+
msgstr "En alternativ URL"
|
| 28 |
+
|
| 29 |
+
#: page-links-to.php:158
|
| 30 |
+
msgid "Open this link in a new window"
|
| 31 |
+
msgstr "Åpne denne lenken i nytt vindu"
|
| 32 |
+
|
| 33 |
+
#: page-links-to.php:286
|
| 34 |
+
msgid "<strong>Note</strong>: This content is pointing to an alternate URL. Use the “Page Links To” box to change this behavior."
|
| 35 |
+
msgstr "<strong>NB</strong>: Dette innholdet peker til en alternativ URL. Bruk “Side lenker til” boksen for å endre oppførsel."
|
| 36 |
+
|
| 37 |
+
#. Plugin Name of the plugin/theme
|
| 38 |
+
msgid "Page Links To"
|
| 39 |
+
msgstr "Side lenker til"
|
| 40 |
+
|
| 41 |
+
#. Plugin URI of the plugin/theme
|
| 42 |
+
msgid "http://txfx.net/wordpress-plugins/page-links-to/"
|
| 43 |
+
msgstr "http://txfx.net/wordpress-plugins/page-links-to/"
|
| 44 |
+
|
| 45 |
+
#. Description of the plugin/theme
|
| 46 |
+
msgid "Allows you to point WordPress pages or posts to a URL of your choosing. Good for setting up navigational links to non-WP sections of your site or to off-site resources."
|
| 47 |
+
msgstr "Lar deg peke WordPress sider eller poster til en vilkårlig URL. Kjekt å bruke til å peke navigasjonslinker til annet innhold på siden din eller til ressurser som ikke er på ditt domene."
|
| 48 |
+
|
| 49 |
+
#. Author of the plugin/theme
|
| 50 |
+
msgid "Mark Jaquith"
|
| 51 |
+
msgstr "Mark Jaquith"
|
| 52 |
+
|
| 53 |
+
#. Author URI of the plugin/theme
|
| 54 |
+
msgid "http://coveredwebservices.com/"
|
| 55 |
+
msgstr "http://coveredwebservices.com/"
|
| 56 |
+
|
languages/page-links-to-pt-BR.mo
ADDED
|
Binary file
|
languages/page-links-to-pt-BR.po
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2012 Page Links To
|
| 2 |
+
# This file is distributed under the same license as the Page Links To package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Page Links To 2.7-beta\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/page-links-to\n"
|
| 7 |
+
"POT-Creation-Date: 2012-01-05 22:58:34+00:00\n"
|
| 8 |
+
"MIME-Version: 1.0\n"
|
| 9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
+
"PO-Revision-Date: 2012-01-05 21:29-0300\n"
|
| 12 |
+
"Last-Translator: Rafael Ehlers <rafaehlers@gmail.com>\n"
|
| 13 |
+
"Language-Team: Rafael Ehlers <rafaehlers@gmail.com>\n"
|
| 14 |
+
|
| 15 |
+
#: page-links-to.php:153
|
| 16 |
+
msgid "Point this content to:"
|
| 17 |
+
msgstr "Apontar este conteúdo para:"
|
| 18 |
+
|
| 19 |
+
#: page-links-to.php:154
|
| 20 |
+
msgid "Its normal WordPress URL"
|
| 21 |
+
msgstr "Sua URL normal do WordPress"
|
| 22 |
+
|
| 23 |
+
#: page-links-to.php:155
|
| 24 |
+
msgid "An alternate URL"
|
| 25 |
+
msgstr "Uma URL alternativa"
|
| 26 |
+
|
| 27 |
+
#: page-links-to.php:158
|
| 28 |
+
msgid "Open this link in a new window"
|
| 29 |
+
msgstr "Abra este link em uma nova janela"
|
| 30 |
+
|
| 31 |
+
#: page-links-to.php:286
|
| 32 |
+
msgid "<strong>Note</strong>: This content is pointing to an alternate URL. Use the “Page Links To” box to change this behavior."
|
| 33 |
+
msgstr "<strong>Nota</strong>: Este conteúdo está apontando para uma URL alternativa. Use o campo “Página aponta para” para alterar este comportamento."
|
| 34 |
+
|
| 35 |
+
#. Plugin Name of the plugin/theme
|
| 36 |
+
msgid "Page Links To"
|
| 37 |
+
msgstr "Página aponta para"
|
| 38 |
+
|
| 39 |
+
#. Plugin URI of the plugin/theme
|
| 40 |
+
msgid "http://txfx.net/wordpress-plugins/page-links-to/"
|
| 41 |
+
msgstr "http://txfx.net/wordpress-plugins/page-links-to/"
|
| 42 |
+
|
| 43 |
+
#. Description of the plugin/theme
|
| 44 |
+
msgid "Allows you to point WordPress pages or posts to a URL of your choosing. Good for setting up navigational links to non-WP sections of your site or to off-site resources."
|
| 45 |
+
msgstr "Permite a você apontar páginas e posts do WordPress para a URL de sua escolha. Bom para apontar links de navegação para seções não-WP do seu site ou para recursos fora do site."
|
| 46 |
+
|
| 47 |
+
#. Author of the plugin/theme
|
| 48 |
+
msgid "Mark Jaquith"
|
| 49 |
+
msgstr "Mark Jaquith"
|
| 50 |
+
|
| 51 |
+
#. Author URI of the plugin/theme
|
| 52 |
+
msgid "http://coveredwebservices.com/"
|
| 53 |
+
msgstr "http://coveredwebservices.com/"
|
| 54 |
+
|
languages/page-links-to.pot
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2012 Page Links To
|
| 2 |
+
# This file is distributed under the same license as the Page Links To package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: Page Links To 2.7-beta\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/page-links-to\n"
|
| 7 |
+
"POT-Creation-Date: 2012-01-05 22:58:34+00:00\n"
|
| 8 |
+
"MIME-Version: 1.0\n"
|
| 9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 11 |
+
"PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
|
| 12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 14 |
+
|
| 15 |
+
#: page-links-to.php:153
|
| 16 |
+
msgid "Point this content to:"
|
| 17 |
+
msgstr ""
|
| 18 |
+
|
| 19 |
+
#: page-links-to.php:154
|
| 20 |
+
msgid "Its normal WordPress URL"
|
| 21 |
+
msgstr ""
|
| 22 |
+
|
| 23 |
+
#: page-links-to.php:155
|
| 24 |
+
msgid "An alternate URL"
|
| 25 |
+
msgstr ""
|
| 26 |
+
|
| 27 |
+
#: page-links-to.php:158
|
| 28 |
+
msgid "Open this link in a new window"
|
| 29 |
+
msgstr ""
|
| 30 |
+
|
| 31 |
+
#: page-links-to.php:286
|
| 32 |
+
msgid ""
|
| 33 |
+
"<strong>Note</strong>: This content is pointing to an alternate URL. Use the "
|
| 34 |
+
"“Page Links To” box to change this behavior."
|
| 35 |
+
msgstr ""
|
| 36 |
+
|
| 37 |
+
#. Plugin Name of the plugin/theme
|
| 38 |
+
msgid "Page Links To"
|
| 39 |
+
msgstr ""
|
| 40 |
+
|
| 41 |
+
#. Plugin URI of the plugin/theme
|
| 42 |
+
msgid "http://txfx.net/wordpress-plugins/page-links-to/"
|
| 43 |
+
msgstr ""
|
| 44 |
+
|
| 45 |
+
#. Description of the plugin/theme
|
| 46 |
+
msgid ""
|
| 47 |
+
"Allows you to point WordPress pages or posts to a URL of your choosing. "
|
| 48 |
+
"Good for setting up navigational links to non-WP sections of your site or to "
|
| 49 |
+
"off-site resources."
|
| 50 |
+
msgstr ""
|
| 51 |
+
|
| 52 |
+
#. Author of the plugin/theme
|
| 53 |
+
msgid "Mark Jaquith"
|
| 54 |
+
msgstr ""
|
| 55 |
+
|
| 56 |
+
#. Author URI of the plugin/theme
|
| 57 |
+
msgid "http://coveredwebservices.com/"
|
| 58 |
+
msgstr ""
|
page-links-to.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: Page Links To
|
| 4 |
Plugin URI: http://txfx.net/wordpress-plugins/page-links-to/
|
| 5 |
Description: Allows you to point WordPress pages or posts to a URL of your choosing. Good for setting up navigational links to non-WP sections of your site or to off-site resources.
|
| 6 |
-
Version: 2.
|
| 7 |
Author: Mark Jaquith
|
| 8 |
Author URI: http://coveredwebservices.com/
|
| 9 |
*/
|
|
@@ -29,6 +29,7 @@ class CWS_PageLinksTo {
|
|
| 29 |
static $instance;
|
| 30 |
var $targets;
|
| 31 |
var $links;
|
|
|
|
| 32 |
|
| 33 |
function __construct() {
|
| 34 |
self::$instance = $this;
|
|
@@ -40,6 +41,9 @@ class CWS_PageLinksTo {
|
|
| 40 |
*/
|
| 41 |
function init() {
|
| 42 |
$this->maybe_upgrade();
|
|
|
|
|
|
|
|
|
|
| 43 |
add_filter( 'wp_list_pages', array( $this, 'wp_list_pages' ) );
|
| 44 |
add_action( 'template_redirect', array( $this, 'template_redirect' ) );
|
| 45 |
add_filter( 'page_link', array( $this, 'link' ), 20, 2 );
|
|
@@ -49,6 +53,7 @@ class CWS_PageLinksTo {
|
|
| 49 |
add_action( 'save_post', array( $this, 'save_post' ) );
|
| 50 |
add_filter( 'wp_nav_menu_objects', array( $this, 'wp_nav_menu_objects' ), 10, 2 );
|
| 51 |
add_action( 'load-post.php', array( $this, 'load_post' ) );
|
|
|
|
| 52 |
}
|
| 53 |
|
| 54 |
/**
|
|
@@ -140,11 +145,21 @@ class CWS_PageLinksTo {
|
|
| 140 |
wp_nonce_field( 'txfx_plt', '_txfx_pl2_nonce', false, true );
|
| 141 |
echo '</p>';
|
| 142 |
$url = get_post_meta( $post->ID, '_links_to', true);
|
| 143 |
-
if ( !$url )
|
|
|
|
| 144 |
$url = 'http://';
|
|
|
|
|
|
|
|
|
|
| 145 |
?>
|
| 146 |
-
<p
|
| 147 |
-
<p><label
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
<?php
|
| 149 |
}
|
| 150 |
|
|
@@ -155,7 +170,7 @@ class CWS_PageLinksTo {
|
|
| 155 |
*/
|
| 156 |
function save_post( $post_ID ) {
|
| 157 |
if ( isset( $_REQUEST['_txfx_pl2_nonce'] ) && wp_verify_nonce( $_REQUEST['_txfx_pl2_nonce'], 'txfx_plt' ) ) {
|
| 158 |
-
if ( isset( $_POST['txfx_links_to'] ) && strlen( $_POST['txfx_links_to'] ) > 0 && $_POST['txfx_links_to'] !== 'http://' ) {
|
| 159 |
$link = stripslashes( $_POST['txfx_links_to'] );
|
| 160 |
if ( 0 === strpos( $link, 'www.' ) )
|
| 161 |
$link = 'http://' . $link; // Starts with www., so add http://
|
|
@@ -229,7 +244,7 @@ class CWS_PageLinksTo {
|
|
| 229 |
if ( isset( $page_links_to_target_cache[$id] ) )
|
| 230 |
$targets[$page] = $page_links_to_target_cache[$id];
|
| 231 |
|
| 232 |
-
if ( str_replace( 'http://www.', 'http://', $this_url ) == str_replace( 'http://www.', 'http://', $page ) || ( is_home() && str_replace( 'http://www.', 'http://', trailingslashit( get_bloginfo( '
|
| 233 |
$highlight = true;
|
| 234 |
$current_page = esc_url( $page );
|
| 235 |
}
|
|
@@ -263,7 +278,7 @@ class CWS_PageLinksTo {
|
|
| 263 |
|
| 264 |
function load_post() {
|
| 265 |
if ( isset( $_GET['post'] ) ) {
|
| 266 |
-
if (
|
| 267 |
add_action( 'admin_notices', array( $this, 'notify_of_external_link' ) );
|
| 268 |
}
|
| 269 |
}
|
|
@@ -273,6 +288,32 @@ class CWS_PageLinksTo {
|
|
| 273 |
?><div class="updated"><p><?php _e( '<strong>Note</strong>: This content is pointing to an alternate URL. Use the “Page Links To” box to change this behavior.', 'page-links-to' ); ?></p></div><?php
|
| 274 |
}
|
| 275 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
}
|
| 277 |
|
| 278 |
new CWS_PageLinksTo;
|
| 3 |
Plugin Name: Page Links To
|
| 4 |
Plugin URI: http://txfx.net/wordpress-plugins/page-links-to/
|
| 5 |
Description: Allows you to point WordPress pages or posts to a URL of your choosing. Good for setting up navigational links to non-WP sections of your site or to off-site resources.
|
| 6 |
+
Version: 2.7
|
| 7 |
Author: Mark Jaquith
|
| 8 |
Author URI: http://coveredwebservices.com/
|
| 9 |
*/
|
| 29 |
static $instance;
|
| 30 |
var $targets;
|
| 31 |
var $links;
|
| 32 |
+
var $targets_on_this_page;
|
| 33 |
|
| 34 |
function __construct() {
|
| 35 |
self::$instance = $this;
|
| 41 |
*/
|
| 42 |
function init() {
|
| 43 |
$this->maybe_upgrade();
|
| 44 |
+
|
| 45 |
+
load_plugin_textdomain( 'page-links-to', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
| 46 |
+
|
| 47 |
add_filter( 'wp_list_pages', array( $this, 'wp_list_pages' ) );
|
| 48 |
add_action( 'template_redirect', array( $this, 'template_redirect' ) );
|
| 49 |
add_filter( 'page_link', array( $this, 'link' ), 20, 2 );
|
| 53 |
add_action( 'save_post', array( $this, 'save_post' ) );
|
| 54 |
add_filter( 'wp_nav_menu_objects', array( $this, 'wp_nav_menu_objects' ), 10, 2 );
|
| 55 |
add_action( 'load-post.php', array( $this, 'load_post' ) );
|
| 56 |
+
add_filter( 'the_posts', array( $this, 'the_posts' ) );
|
| 57 |
}
|
| 58 |
|
| 59 |
/**
|
| 145 |
wp_nonce_field( 'txfx_plt', '_txfx_pl2_nonce', false, true );
|
| 146 |
echo '</p>';
|
| 147 |
$url = get_post_meta( $post->ID, '_links_to', true);
|
| 148 |
+
if ( !$url ) {
|
| 149 |
+
$linked = false;
|
| 150 |
$url = 'http://';
|
| 151 |
+
} else {
|
| 152 |
+
$linked = true;
|
| 153 |
+
}
|
| 154 |
?>
|
| 155 |
+
<p><?php _e( 'Point this content to:', 'page-links-to' ); ?></p>
|
| 156 |
+
<p><label><input type="radio" id="txfx-links-to-choose-wp" name="txfx_links_to_choice" value="wp" <?php checked( !$linked ); ?> /> <?php _e( 'Its normal WordPress URL', 'page-links-to' ); ?></label></p>
|
| 157 |
+
<p><label><input type="radio" id="txfx-links-to-choose-alternate" name="txfx_links_to_choice" value="alternate" <?php checked( $linked ); ?> /> <?php _e( 'An alternate URL', 'page-links-to' ); ?></label></p>
|
| 158 |
+
<div style="margin-left: 30px;" id="txfx-links-to-alternate-section" class="<?php echo !$linked ? 'hide-if-js' : ''; ?>">
|
| 159 |
+
<p><input name="txfx_links_to" type="text" style="width:75%" id="txfx-links-to" value="<?php echo esc_attr( $url ); ?>" /></p>
|
| 160 |
+
<p><label for="txfx-links-to-new-window"><input type="checkbox" name="txfx_links_to_new_window" id="txfx-links-to-new-window" value="_blank" <?php checked( '_blank', get_post_meta( $post->ID, '_links_to_target', true ) ); ?>> <?php _e( 'Open this link in a new window', 'page-links-to' ); ?></label></p>
|
| 161 |
+
</div>
|
| 162 |
+
<script src="<?php echo trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/page-links-to.dev.js'; ?>"></script>
|
| 163 |
<?php
|
| 164 |
}
|
| 165 |
|
| 170 |
*/
|
| 171 |
function save_post( $post_ID ) {
|
| 172 |
if ( isset( $_REQUEST['_txfx_pl2_nonce'] ) && wp_verify_nonce( $_REQUEST['_txfx_pl2_nonce'], 'txfx_plt' ) ) {
|
| 173 |
+
if ( ( !isset( $_POST['txfx_links_to_choice'] ) || 'alternate' == $_POST['txfx_links_to_choice'] ) && isset( $_POST['txfx_links_to'] ) && strlen( $_POST['txfx_links_to'] ) > 0 && $_POST['txfx_links_to'] !== 'http://' ) {
|
| 174 |
$link = stripslashes( $_POST['txfx_links_to'] );
|
| 175 |
if ( 0 === strpos( $link, 'www.' ) )
|
| 176 |
$link = 'http://' . $link; // Starts with www., so add http://
|
| 244 |
if ( isset( $page_links_to_target_cache[$id] ) )
|
| 245 |
$targets[$page] = $page_links_to_target_cache[$id];
|
| 246 |
|
| 247 |
+
if ( str_replace( 'http://www.', 'http://', $this_url ) == str_replace( 'http://www.', 'http://', $page ) || ( is_home() && str_replace( 'http://www.', 'http://', trailingslashit( get_bloginfo( 'url' ) ) ) == str_replace( 'http://www.', 'http://', trailingslashit( $page ) ) ) ) {
|
| 248 |
$highlight = true;
|
| 249 |
$current_page = esc_url( $page );
|
| 250 |
}
|
| 278 |
|
| 279 |
function load_post() {
|
| 280 |
if ( isset( $_GET['post'] ) ) {
|
| 281 |
+
if ( get_post_meta( absint( $_GET['post'] ), '_links_to', true ) ) {
|
| 282 |
add_action( 'admin_notices', array( $this, 'notify_of_external_link' ) );
|
| 283 |
}
|
| 284 |
}
|
| 288 |
?><div class="updated"><p><?php _e( '<strong>Note</strong>: This content is pointing to an alternate URL. Use the “Page Links To” box to change this behavior.', 'page-links-to' ); ?></p></div><?php
|
| 289 |
}
|
| 290 |
|
| 291 |
+
function id_to_url_callback( &$val, $key ) {
|
| 292 |
+
$val = get_permalink( $val );
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
function the_posts( $posts ) {
|
| 296 |
+
$page_links_to_target_cache = $this->get_targets();
|
| 297 |
+
if ( count( $page_links_to_target_cache ) ) {
|
| 298 |
+
$pids = array();
|
| 299 |
+
foreach ( $posts as $p )
|
| 300 |
+
$pids[$p->ID] = $p->ID;
|
| 301 |
+
$targets = array_keys( array_intersect_key( $page_links_to_target_cache, $pids ) );
|
| 302 |
+
if ( count( $targets ) ) {
|
| 303 |
+
array_walk( $targets, array( $this, 'id_to_url_callback' ) );
|
| 304 |
+
$targets = array_unique( $targets );
|
| 305 |
+
$this->targets_on_this_page = $targets;
|
| 306 |
+
wp_enqueue_script( 'jquery' );
|
| 307 |
+
add_action( 'wp_head', array( $this, 'targets_in_new_window_via_js' ) );
|
| 308 |
+
}
|
| 309 |
+
}
|
| 310 |
+
return $posts;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
function targets_in_new_window_via_js() {
|
| 314 |
+
?><script>(function($){var t=<?php echo json_encode( $this->targets_on_this_page ); ?>;$(document).ready(function(){var a=$('a');$.each(t,function(i,v){a.filter('[href="'+v+'"]').attr('target','_blank');});});})(jQuery);</script><?php
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
}
|
| 318 |
|
| 319 |
new CWS_PageLinksTo;
|
readme.txt
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
Contributors: markjaquith
|
| 3 |
Donate link: http://txfx.net/wordpress-plugins/donate
|
| 4 |
Tags: page, redirect, link, external link, repoint
|
| 5 |
-
Requires at least: 3.
|
| 6 |
-
Tested up to: 3.
|
| 7 |
-
Stable tag: 2.
|
| 8 |
|
| 9 |
Lets you make a WordPress page (or other content type) link to an external URL of your choosing, instead of its WordPress URL.
|
| 10 |
|
|
@@ -18,19 +18,19 @@ You can also use it to create a hand-crafted menu that links to pages, posts, ca
|
|
| 18 |
|
| 19 |
== Installation ==
|
| 20 |
|
| 21 |
-
1. Upload the `page-links-to` folder to your `/wp-content/plugins/` directory
|
| 22 |
|
| 23 |
-
2. Activate the "Page Links To" plugin in your WordPress administration interface
|
| 24 |
|
| 25 |
-
3. Create (or edit) a page or a post to have a title of your choosing (leave the content blank)
|
| 26 |
|
| 27 |
-
4. Down below, in the advanced section, find the Page Links To widget and add a URL of your choosing
|
| 28 |
|
| 29 |
-
5. Optionally check the
|
| 30 |
|
| 31 |
-
6. Save the post or page
|
| 32 |
|
| 33 |
-
7. Done! Now that post or page will point to the URL that you chose
|
| 34 |
|
| 35 |
== Screenshots ==
|
| 36 |
|
|
@@ -40,7 +40,7 @@ You can also use it to create a hand-crafted menu that links to pages, posts, ca
|
|
| 40 |
|
| 41 |
= How do I make it so that a page doesn't link to anything? I'd like to use it as a dummy container. =
|
| 42 |
|
| 43 |
-
Just use "#"
|
| 44 |
|
| 45 |
= Can this be used to repoint categories to an arbitrary URL? =
|
| 46 |
|
|
@@ -56,6 +56,12 @@ Yes. Linking to `/my-photos.php` is a good idea, as it'll still work if you move
|
|
| 56 |
|
| 57 |
== Changelog ==
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
= 2.6 =
|
| 60 |
* Proper linking for custom post types (insead of just a 301).
|
| 61 |
* Fixed a bug that prevented links from opening in a new window.
|
| 2 |
Contributors: markjaquith
|
| 3 |
Donate link: http://txfx.net/wordpress-plugins/donate
|
| 4 |
Tags: page, redirect, link, external link, repoint
|
| 5 |
+
Requires at least: 3.3
|
| 6 |
+
Tested up to: 3.4
|
| 7 |
+
Stable tag: 2.7
|
| 8 |
|
| 9 |
Lets you make a WordPress page (or other content type) link to an external URL of your choosing, instead of its WordPress URL.
|
| 10 |
|
| 18 |
|
| 19 |
== Installation ==
|
| 20 |
|
| 21 |
+
1. Upload the `page-links-to` folder to your `/wp-content/plugins/` directory.
|
| 22 |
|
| 23 |
+
2. Activate the "Page Links To" plugin in your WordPress administration interface.
|
| 24 |
|
| 25 |
+
3. Create (or edit) a page or a post to have a title of your choosing (leave the content blank).
|
| 26 |
|
| 27 |
+
4. Down below, in the advanced section, find the Page Links To widget, select "An alternate URL", and add a URL of your choosing.
|
| 28 |
|
| 29 |
+
5. Optionally check the box to enable link opening in a new browser window.
|
| 30 |
|
| 31 |
+
6. Save the post or page.
|
| 32 |
|
| 33 |
+
7. Done! Now that post or page will point to the URL that you chose.
|
| 34 |
|
| 35 |
== Screenshots ==
|
| 36 |
|
| 40 |
|
| 41 |
= How do I make it so that a page doesn't link to anything? I'd like to use it as a dummy container. =
|
| 42 |
|
| 43 |
+
Just use "#" as the link. That won't go anywhere.
|
| 44 |
|
| 45 |
= Can this be used to repoint categories to an arbitrary URL? =
|
| 46 |
|
| 56 |
|
| 57 |
== Changelog ==
|
| 58 |
|
| 59 |
+
= 2.7 =
|
| 60 |
+
* Fix a PHP notice
|
| 61 |
+
* Use JS to open links in an external window, even outside of nav menus
|
| 62 |
+
* Completely revamped UI
|
| 63 |
+
* Several translations
|
| 64 |
+
|
| 65 |
= 2.6 =
|
| 66 |
* Proper linking for custom post types (insead of just a 301).
|
| 67 |
* Fixed a bug that prevented links from opening in a new window.
|
screenshot-1.png
CHANGED
|
Binary file
|
