Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
Force SSL when force_ssl_admin(). Fixes #48.
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Mar 4, 2014
1 parent a4b4ca9 commit f0ffa60
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions class-wp-front-end-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,27 @@ public static function edit_link( $id ) {

if ( $id == get_option( 'page_on_front' ) )

return home_url( '?editing' );
$link = home_url( '?editing' );

$permalink = get_permalink( $post->ID );

if ( strpos( $permalink, '?' ) !== false )

return add_query_arg( 'edit', '', $permalink );
$link = add_query_arg( 'edit', '', $permalink );

if ( trailingslashit( $permalink ) === $permalink )

return trailingslashit( $permalink . 'edit' );
$link = trailingslashit( $permalink . 'edit' );

return trailingslashit( $permalink ) . 'edit';
if ( ! isset( $link ) )

$link = trailingslashit( $permalink ) . 'edit';

if ( force_ssl_admin() )

$link = set_url_scheme( $link, 'https' );

return $link;

}

Expand Down Expand Up @@ -182,6 +190,15 @@ public function wp() {

return;

if ( force_ssl_admin()
&& ! is_ssl() ) {

wp_redirect( set_url_scheme( get_permalink( $post->ID ), 'https' ) );

die();

}

if ( ! $post )

wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
Expand Down

0 comments on commit f0ffa60

Please sign in to comment.