Page Links To - Version 2.1

Version Description

  • WordPress MU compatibility for when switch_to_blog() is used... it now uses $blog_id to keep their caches from stomping on each other
Download this release

Release Info

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

Code changes from version 2.0 to 2.1

Files changed (2) hide show
  1. page-links-to.php +13 -13
  2. readme.txt +4 -0
page-links-to.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Page Links To
4
Plugin URI: http://txfx.net/code/wordpress/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.0
7
Author: Mark Jaquith
8
Author URI: http://coveredwebservices.com/
9
*/
@@ -26,50 +26,50 @@ Author URI: http://coveredwebservices.com/
26
*/
27
28
function txfx_get_page_links_to_meta () {
29
- global $wpdb, $page_links_to_cache;
30
31
- if ( !isset( $page_links_to_cache ) ) {
32
$links_to = $wpdb->get_results(
33
"SELECT post_id, meta_value " .
34
"FROM $wpdb->postmeta, $wpdb->posts " .
35
"WHERE post_id = ID AND meta_key = '_links_to' AND (post_status = 'static' OR post_status = 'publish')");
36
} else {
37
- return $page_links_to_cache;
38
}
39
40
if ( !$links_to ) {
41
- $page_links_to_cache = false;
42
return false;
43
}
44
45
foreach ( (array) $links_to as $link )
46
- $page_links_to_cache[$link->post_id] = $link->meta_value;
47
48
- return $page_links_to_cache;
49
}
50
51
function txfx_get_page_links_to_targets () {
52
- global $wpdb, $page_links_to_target_cache;
53
54
- if ( !isset( $page_links_to_target_cache ) ) {
55
$links_to = $wpdb->get_results(
56
"SELECT post_id, meta_value " .
57
"FROM $wpdb->postmeta, $wpdb->posts " .
58
"WHERE post_id = ID AND meta_key = '_links_to_target' AND (post_status = 'static' OR post_status = 'publish')");
59
} else {
60
- return $page_links_to_target_cache;
61
}
62
63
if ( !$links_to ) {
64
- $page_links_to_target_cache = false;
65
return false;
66
}
67
68
foreach ( (array) $links_to as $link ) {
69
- $page_links_to_target_cache[$link->post_id] = $link->meta_value;
70
}
71
72
- return $page_links_to_target_cache;
73
}
74
75
function txfx_plt_add_meta_box( $page, $context ) {
3
Plugin Name: Page Links To
4
Plugin URI: http://txfx.net/code/wordpress/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.1
7
Author: Mark Jaquith
8
Author URI: http://coveredwebservices.com/
9
*/
26
*/
27
28
function txfx_get_page_links_to_meta () {
29
+ global $wpdb, $page_links_to_cache, $blog_id;
30
31
+ if ( !isset( $page_links_to_cache[$blog_id] ) ) {
32
$links_to = $wpdb->get_results(
33
"SELECT post_id, meta_value " .
34
"FROM $wpdb->postmeta, $wpdb->posts " .
35
"WHERE post_id = ID AND meta_key = '_links_to' AND (post_status = 'static' OR post_status = 'publish')");
36
} else {
37
+ return $page_links_to_cache[$blog_id];
38
}
39
40
if ( !$links_to ) {
41
+ $page_links_to_cache[$blog_id] = false;
42
return false;
43
}
44
45
foreach ( (array) $links_to as $link )
46
+ $page_links_to_cache[$blog_id][$link->post_id] = $link->meta_value;
47
48
+ return $page_links_to_cache[$blog_id];
49
}
50
51
function txfx_get_page_links_to_targets () {
52
+ global $wpdb, $page_links_to_target_cache, $blog_id;
53
54
+ if ( !isset( $page_links_to_target_cache[$blog_id] ) ) {
55
$links_to = $wpdb->get_results(
56
"SELECT post_id, meta_value " .
57
"FROM $wpdb->postmeta, $wpdb->posts " .
58
"WHERE post_id = ID AND meta_key = '_links_to_target' AND (post_status = 'static' OR post_status = 'publish')");
59
} else {
60
+ return $page_links_to_target_cache[$blog_id];
61
}
62
63
if ( !$links_to ) {
64
+ $page_links_to_target_cache[$blog_id] = false;
65
return false;
66
}
67
68
foreach ( (array) $links_to as $link ) {
69
+ $page_links_to_target_cache[$blog_id][$link->post_id] = $link->meta_value;
70
}
71
72
+ return $page_links_to_target_cache[$blog_id];
73
}
74
75
function txfx_plt_add_meta_box( $page, $context ) {
readme.txt CHANGED
@@ -35,6 +35,10 @@ This is useful for setting up navigational links to non-WordPress sections of yo
35
1. The Page Links To meta box in action
36
37
== Changelog ==
38
= 2.0 =
39
* Allow one-character URLs so that things like "#" (dummy link) are possible
40
35
1. The Page Links To meta box in action
36
37
== Changelog ==
38
+
39
+ = 2.1 =
40
+ * WordPress MU compatibility for when switch_to_blog() is used... it now uses $blog_id to keep their caches from stomping on each other
41
+
42
= 2.0 =
43
* Allow one-character URLs so that things like "#" (dummy link) are possible
44