Navigation Menu

Skip to content

Commit

Permalink
Add correct endpoing to draft URLs with query args
Browse files Browse the repository at this point in the history
Before we added /liveblog/ to a permalink if the
blog had pretty permalinks. But if the post was
a draft it's URL isn't pretty, it's ?p=XX-style.

So, instead of checking whether the blog used
pretty permalinks we check if it has ?p=. There
shouldn't be any false positives, because if a URL
has a ? and it doesn't mean a separator between
path and query args it should be escaped.

Fixes #17.
  • Loading branch information
nb committed Sep 18, 2012
1 parent 4221823 commit 0dccc81
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions liveblog.php
Expand Up @@ -535,11 +535,11 @@ private static function add_default_plupload_settings() {
* @return string
*/
private static function get_entries_endpoint_url() {
if ( get_option( 'permalink_structure' ) )
$url = trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . self::url_endpoint ); // returns something like /2012/01/01/post/liveblog/
$post_permalink = get_permalink( self::$post_id );
if ( false !== strpos( $post_permalink, '?p=' ) )
$url = add_query_arg( self::url_endpoint, '', $post_permalink ) . '='; // returns something like ?p=1&liveblog=
else
$url = add_query_arg( self::url_endpoint, '', get_permalink( self::$post_id ) ) . '='; // returns something like ?p=1&liveblog=

$url = trailingslashit( trailingslashit( $post_permalink ) . self::url_endpoint ); // returns something like /2012/01/01/post/liveblog/
return $url;
}

Expand Down

0 comments on commit 0dccc81

Please sign in to comment.