Version Description
- Support looking up hierarchical pages by slug; insert hierarchical pages by path (not slug).
- Fix for php warning when displaying meta values that are strings instead of arrays.
Download this release
Release Info
Developer | figureone |
Plugin | Insert Pages |
Version | 3.2.5 |
Comparing to | |
See all releases |
Code changes from version 3.2.4 to 3.2.5
- insert-pages.php +22 -4
- js/wpinsertpages.js +1 -1
- readme.txt +4 -0
insert-pages.php
CHANGED
@@ -9,7 +9,7 @@ Author URI: http://www.linkedin.com/in/paulrryan
|
|
9 |
Text Domain: insert-pages
|
10 |
Domain Path: /languages
|
11 |
License: GPL2
|
12 |
-
Version: 3.2.
|
13 |
*/
|
14 |
|
15 |
/* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
|
@@ -70,7 +70,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
70 |
'wpinsertpages',
|
71 |
plugins_url( '/js/wpinsertpages.js', __FILE__ ),
|
72 |
array( 'wpdialogs' ),
|
73 |
-
'
|
74 |
);
|
75 |
wp_localize_script(
|
76 |
'wpinsertpages',
|
@@ -200,6 +200,20 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
200 |
create_function( '$type', 'return ! in_array( $type, array( "nav_menu_item", "attachment" ) );' )
|
201 |
);
|
202 |
$inserted_page = get_page_by_path( $attributes['page'], OBJECT, $insertable_post_types );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
$attributes['page'] = $inserted_page ? $inserted_page->ID : $attributes['page'];
|
204 |
} else {
|
205 |
$inserted_page = get_post( intval( $attributes['page'] ) );
|
@@ -312,8 +326,11 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
312 |
if ( is_protected_meta( $keyt, 'post' ) ) {
|
313 |
continue;
|
314 |
}
|
315 |
-
$
|
316 |
-
|
|
|
|
|
|
|
317 |
|
318 |
/**
|
319 |
* Filter the HTML output of the li element in the post custom fields list.
|
@@ -793,6 +810,7 @@ if ( !class_exists( 'InsertPagesPlugin' ) ) {
|
|
793 |
'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
|
794 |
'permalink' => get_permalink( $post->ID ),
|
795 |
'slug' => $post->post_name,
|
|
|
796 |
'info' => $info,
|
797 |
);
|
798 |
}
|
9 |
Text Domain: insert-pages
|
10 |
Domain Path: /languages
|
11 |
License: GPL2
|
12 |
+
Version: 3.2.5
|
13 |
*/
|
14 |
|
15 |
/* Copyright 2011 Paul Ryan (email: prar@hawaii.edu)
|
70 |
'wpinsertpages',
|
71 |
plugins_url( '/js/wpinsertpages.js', __FILE__ ),
|
72 |
array( 'wpdialogs' ),
|
73 |
+
'20171006'
|
74 |
);
|
75 |
wp_localize_script(
|
76 |
'wpinsertpages',
|
200 |
create_function( '$type', 'return ! in_array( $type, array( "nav_menu_item", "attachment" ) );' )
|
201 |
);
|
202 |
$inserted_page = get_page_by_path( $attributes['page'], OBJECT, $insertable_post_types );
|
203 |
+
|
204 |
+
// If get_page_by_path() didn't find the page, check to see if the slug
|
205 |
+
// was provided instead of the full path (useful for hierarchical pages
|
206 |
+
// that are nested under another page).
|
207 |
+
if ( is_null( $inserted_page ) ) {
|
208 |
+
global $wpdb;
|
209 |
+
$page = $wpdb->get_var( $wpdb->prepare(
|
210 |
+
"SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_status = 'publish' LIMIT 1", $attributes['page']
|
211 |
+
) );
|
212 |
+
if ( $page ) {
|
213 |
+
$inserted_page = get_post( $page );
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
$attributes['page'] = $inserted_page ? $inserted_page->ID : $attributes['page'];
|
218 |
} else {
|
219 |
$inserted_page = get_post( intval( $attributes['page'] ) );
|
326 |
if ( is_protected_meta( $keyt, 'post' ) ) {
|
327 |
continue;
|
328 |
}
|
329 |
+
$value = get_post_custom_values( $key );
|
330 |
+
if ( is_array( $value ) ) {
|
331 |
+
$values = array_map( 'trim', $value );
|
332 |
+
$value = implode( $values, ', ' );
|
333 |
+
}
|
334 |
|
335 |
/**
|
336 |
* Filter the HTML output of the li element in the post custom fields list.
|
810 |
'title' => trim( esc_html( strip_tags( get_the_title( $post ) ) ) ),
|
811 |
'permalink' => get_permalink( $post->ID ),
|
812 |
'slug' => $post->post_name,
|
813 |
+
'path' => get_page_uri( $post ),
|
814 |
'info' => $info,
|
815 |
);
|
816 |
}
|
js/wpinsertpages.js
CHANGED
@@ -559,7 +559,7 @@ var wpInsertPages;
|
|
559 |
classes += this.title ? '' : ' no-title';
|
560 |
list += classes ? '<li class="' + classes + '">' : '<li>';
|
561 |
list += '<input type="hidden" class="item-permalink" value="' + this.permalink + '" />';
|
562 |
-
list += '<input type="hidden" class="item-slug" value="' + this.
|
563 |
list += '<input type="hidden" class="item-id" value="' + this.ID + '" />';
|
564 |
list += '<span class="item-title">';
|
565 |
list += this.title ? this.title : wpInsertPagesL10n.noTitle;
|
559 |
classes += this.title ? '' : ' no-title';
|
560 |
list += classes ? '<li class="' + classes + '">' : '<li>';
|
561 |
list += '<input type="hidden" class="item-permalink" value="' + this.permalink + '" />';
|
562 |
+
list += '<input type="hidden" class="item-slug" value="' + this.path + '" />';
|
563 |
list += '<input type="hidden" class="item-id" value="' + this.ID + '" />';
|
564 |
list += '<span class="item-title">';
|
565 |
list += this.title ? this.title : wpInsertPagesL10n.noTitle;
|
readme.txt
CHANGED
@@ -86,6 +86,10 @@ Just one! The plugin prevents you from embedding a page in itself, but you can t
|
|
86 |
|
87 |
== Changelog ==
|
88 |
|
|
|
|
|
|
|
|
|
89 |
= 3.2.4 =
|
90 |
* Restrict custom template paths to theme directory (prevent directory traversal attacks).
|
91 |
|
86 |
|
87 |
== Changelog ==
|
88 |
|
89 |
+
= 3.2.5 =
|
90 |
+
* Support looking up hierarchical pages by slug; insert hierarchical pages by path (not slug).
|
91 |
+
* Fix for php warning when displaying meta values that are strings instead of arrays.
|
92 |
+
|
93 |
= 3.2.4 =
|
94 |
* Restrict custom template paths to theme directory (prevent directory traversal attacks).
|
95 |
|