Page Links To - Version 2.9.2

Version Description

Download this release

Release Info

Developer markjaquith
Plugin Icon wp plugin Page Links To
Version 2.9.2
Comparing to
See all releases

Code changes from version 2.9.1 to 2.9.2

languages/import.rb CHANGED
@@ -124,13 +124,30 @@ langs = {
124
  'zh_HK' => 'zh-hk',
125
  'zh_TW' => 'zh-tw',
126
  }
 
127
  require 'pathname'
 
128
  plugin = Pathname.new(File.expand_path '../').basename
129
- url_root = 'http://translate.markjaquith.com/projects/wordpress-plugins/%s/%s/default/export-translations?format=%s'
130
- files = Dir.glob("*.mo").map { |f| g = f[/#{plugin}-(.*)\.mo/, 1]; [g, langs[g]] }
131
- files.each do |l|
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  ['po', 'mo'].each do |fmt|
133
- `wget -O #{plugin}-#{l[0]}.#{fmt} #{format url_root, plugin, l[1], fmt} 2>/dev/null`
134
  end
135
  `git checkout #{plugin}-#{l[0]}.*` if `git diff #{plugin}-#{l[0]}.po | ack '^[+-][^+-]{2}' | ack -v 'PO-Revision-Date'`.chomp.length === 0
136
  end
124
  'zh_HK' => 'zh-hk',
125
  'zh_TW' => 'zh-tw',
126
  }
127
+ reverse_langs = langs.invert
128
  require 'pathname'
129
+ require 'open-uri'
130
  plugin = Pathname.new(File.expand_path '../').basename
131
+ url_domain = 'http://translate.markjaquith.com'
132
+ url_path = '/projects/wordpress-plugins/'
133
+ item_url = url_domain + url_path + '%s/%s/default/export-translations?format=%s'
134
+ index_url = url_domain + url_path + '%s/'
135
+
136
+ formats = []
137
+ language_regex = %r{<a href="#{url_path}#{plugin}/([^/]+)/default"}
138
+
139
+ open( format index_url, plugin ) do |f|
140
+ f.each_line do |l|
141
+ if l.match language_regex
142
+ lang = l[language_regex, 1]
143
+ formats << [reverse_langs[lang], lang]
144
+ end
145
+ end
146
+ end
147
+
148
+ formats.each do |l|
149
  ['po', 'mo'].each do |fmt|
150
+ `wget -O #{plugin}-#{l[0]}.#{fmt} #{format item_url, plugin, l[1], fmt} 2>/dev/null`
151
  end
152
  `git checkout #{plugin}-#{l[0]}.*` if `git diff #{plugin}-#{l[0]}.po | ack '^[+-][^+-]{2}' | ack -v 'PO-Revision-Date'`.chomp.length === 0
153
  end
languages/page-links-to-it_IT.mo ADDED
Binary file
languages/page-links-to-it_IT.po ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of Page Links To in Italian
2
+ # This file is distributed under the same license as the Page Links To package.
3
+ msgid ""
4
+ msgstr ""
5
+ "PO-Revision-Date: 2013-07-01 19:54:27+0000\n"
6
+ "MIME-Version: 1.0\n"
7
+ "Content-Type: text/plain; charset=UTF-8\n"
8
+ "Content-Transfer-Encoding: 8bit\n"
9
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
10
+ "X-Generator: GlotPress/0.1\n"
11
+ "Project-Id-Version: Page Links To\n"
12
+
13
+ #: page-links-to.php:209
14
+ msgctxt "Meta box title"
15
+ msgid "Page Links To"
16
+ msgstr "Pagina Collegata A"
17
+
18
+ #: page-links-to.php:230
19
+ msgid "A custom URL"
20
+ msgstr "Una custom URL"
21
+
22
+ #: page-links-to.php:233
23
+ msgid "Open this link in a new tab"
24
+ msgstr "Apri questo link in una nuova tab"
25
+
26
+ #: page-links-to.php:492
27
+ msgid "<strong>Note</strong>: This content is pointing to a custom URL. Use the &#8220;Page Links To&#8221; box to change this behavior."
28
+ msgstr "<strong>Nota</strong> Questo contenuto punta a una custom URL. Usa il box &#8220;Pagina Collegata A&#8221; per modificare questo comportamento."
29
+
30
+ #: page-links-to.php:228
31
+ msgid "Point this content to:"
32
+ msgstr "Punta questo contenuto a:"
33
+
34
+ #: page-links-to.php:229
35
+ msgid "Its normal WordPress URL"
36
+ msgstr "La sua normale URL WordPress"
37
+
38
+ msgid "Page Links To"
39
+ msgstr "Pagina Collegata A"
40
+
41
+ msgid "http://txfx.net/wordpress-plugins/page-links-to/"
42
+ msgstr "http://txfx.net/wordpress-plugins/page-links-to/"
43
+
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 "Permette di reindirizzare pagine o articoli WordPress a una URL di vostra scelta. Perfetto per impostare collegamenti a sezioni non-WP del vostro sito o a risorse esterne."
46
+
47
+ msgid "Mark Jaquith"
48
+ msgstr "Mark Jaquith"
49
+
50
+ msgid "http://coveredwebservices.com/"
51
+ msgstr "http://coveredwebservices.com/"
languages/page-links-to-nl_NL.mo ADDED
Binary file
languages/page-links-to-nl_NL.po ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Translation of Page Links To in Dutch
2
+ # This file is distributed under the same license as the Page Links To package.
3
+ msgid ""
4
+ msgstr ""
5
+ "PO-Revision-Date: 2013-07-01 20:36:29+0000\n"
6
+ "MIME-Version: 1.0\n"
7
+ "Content-Type: text/plain; charset=UTF-8\n"
8
+ "Content-Transfer-Encoding: 8bit\n"
9
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
10
+ "X-Generator: GlotPress/0.1\n"
11
+ "Project-Id-Version: Page Links To\n"
12
+
13
+ #: page-links-to.php:209
14
+ msgctxt "Meta box title"
15
+ msgid "Page Links To"
16
+ msgstr "Pagina linkt naar"
17
+
18
+ #: page-links-to.php:230
19
+ msgid "A custom URL"
20
+ msgstr "Een aangepaste URL"
21
+
22
+ #: page-links-to.php:233
23
+ msgid "Open this link in a new tab"
24
+ msgstr "Open deze link in een nieuwe tab"
25
+
26
+ #: page-links-to.php:492
27
+ msgid "<strong>Note</strong>: This content is pointing to a custom URL. Use the &#8220;Page Links To&#8221; box to change this behavior."
28
+ msgstr "<strong>Let op</strong>: Deze content verwijst naar een aangepast URL Gebruik de &#8220;Pagina linkt naar&#8221; box om dit aan te passen."
29
+
30
+ #: page-links-to.php:228
31
+ msgid "Point this content to:"
32
+ msgstr "Stuur deze content naar:"
33
+
34
+ #: page-links-to.php:229
35
+ msgid "Its normal WordPress URL"
36
+ msgstr "De normale WordPress URL"
37
+
38
+ msgid "Page Links To"
39
+ msgstr "Page Links To"
40
+
41
+ msgid "http://txfx.net/wordpress-plugins/page-links-to/"
42
+ msgstr "http://txfx.net/wordpress-plugins/page-links-to/"
43
+
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 "Staat je toe om WordPress pagina&#8221;s naar een specifieke URL. Handig om te gebruiken bij navigatie naar URL&#8221;s van je site die niet binnen WP aanwezig zijn of compleet buiten je domein."
46
+
47
+ msgid "Mark Jaquith"
48
+ msgstr "Mark Jaquith"
49
+
50
+ msgid "http://coveredwebservices.com/"
51
+ msgstr "http://coveredwebservices.com/"
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.9.1
7
  Author: Mark Jaquith
8
  Author URI: http://coveredwebservices.com/
9
  Text Domain: page-links-to
@@ -215,7 +215,8 @@ class CWS_PageLinksTo extends WP_Stack_Plugin {
215
  * Outputs the Page Links To post screen meta box
216
  */
217
  function meta_box() {
218
- $post = get_post();
 
219
  echo '<p>';
220
  wp_nonce_field( 'cws_plt_' . $post->ID, '_cws_plt_nonce', false, true );
221
  echo '</p>';
@@ -402,18 +403,10 @@ class CWS_PageLinksTo extends WP_Stack_Plugin {
402
  }
403
 
404
  /**
405
- * Performs a redirect, if appropriate
406
  */
407
  function template_redirect() {
408
- global $wp_query;
409
-
410
- if ( ! is_singular() )
411
- return;
412
-
413
- if ( ! get_queried_object_id() )
414
- return;
415
-
416
- $link = $this->get_link( get_queried_object_id() );
417
 
418
  if ( ! $link )
419
  return;
@@ -422,6 +415,21 @@ class CWS_PageLinksTo extends WP_Stack_Plugin {
422
  exit;
423
  }
424
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  /**
426
  * Filters the list of pages to alter the links and targets
427
  *
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.9.2
7
  Author: Mark Jaquith
8
  Author URI: http://coveredwebservices.com/
9
  Text Domain: page-links-to
215
  * Outputs the Page Links To post screen meta box
216
  */
217
  function meta_box() {
218
+ $null = null;
219
+ $post = get_post( $null );
220
  echo '<p>';
221
  wp_nonce_field( 'cws_plt_' . $post->ID, '_cws_plt_nonce', false, true );
222
  echo '</p>';
403
  }
404
 
405
  /**
406
+ * Performs a redirect
407
  */
408
  function template_redirect() {
409
+ $link = $this->get_redirect();
 
 
 
 
 
 
 
 
410
 
411
  if ( ! $link )
412
  return;
415
  exit;
416
  }
417
 
418
+ /**
419
+ * gets the redirection URL
420
+ *
421
+ * @return string|bool the redirection URL, or false
422
+ */
423
+ function get_redirect() {
424
+ if ( ! is_singular() )
425
+ return false;
426
+
427
+ if ( ! get_queried_object_id() )
428
+ return false;
429
+
430
+ return $this->get_link( get_queried_object_id() );
431
+ }
432
+
433
  /**
434
  * Filters the list of pages to alter the links and targets
435
  *
readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: http://txfx.net/wordpress-plugins/donate
7
  Tags: page, redirect, link, external link, repoint
8
  Requires at least: 3.4
9
  Tested up to: 3.6
10
- Stable tag: 2.9
11
 
12
  Lets you make a WordPress page (or other content type) link to an external URL of your choosing, instead of its WordPress URL.
13
 
@@ -59,6 +59,9 @@ Yes. Linking to `/my-photos.php` is a good idea, as it'll still work if you move
59
 
60
  == Changelog ==
61
 
 
 
 
62
  = 2.9.1 =
63
  * Fix a redirection bug in 2.9
64
 
7
  Tags: page, redirect, link, external link, repoint
8
  Requires at least: 3.4
9
  Tested up to: 3.6
10
+ Stable tag: 2.9.1
11
 
12
  Lets you make a WordPress page (or other content type) link to an external URL of your choosing, instead of its WordPress URL.
13
 
59
 
60
  == Changelog ==
61
 
62
+ = 2.9.1 =
63
+ * Restore WordPress 3.4.x functionality.
64
+
65
  = 2.9.1 =
66
  * Fix a redirection bug in 2.9
67
 
tests/test-redirection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CWS_PLT_Test_Redirection extends CWS_PLT_TestCase {
4
+ function test_get_permalink_filter() {
5
+ $post_id = $this->factory->post->create( array( 'post_type' => 'post' ) );
6
+ $this->assertTrue( $this->plugin()->set_link( $post_id, 'http://example.com/' ) );
7
+ query_posts( array( 'p' => $post_id ) );
8
+ $this->assertEquals( 'http://example.com/', $this->plugin()->get_redirect() );
9
+ }
10
+ }