Moving up some definitions to fix the bookmarklets (thanks Sam Tran!)
This commit is contained in:
19
result.php
19
result.php
@@ -1,12 +1,22 @@
|
||||
<?php
|
||||
include('header.php');
|
||||
|
||||
$url = yourls_sanitize_url( $_REQUEST['url'] );
|
||||
$keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
|
||||
$title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
|
||||
$return = yourls_add_new_link( $url, $keyword, $title );
|
||||
|
||||
$shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';
|
||||
$message = isset( $return['message'] ) ? $return['message'] : '';
|
||||
$title = isset( $return['title'] ) ? $return['title'] : '';
|
||||
|
||||
// Stop here if bookmarklet with a JSON callback function ("instant" bookmarklets) -- code from YOURLS
|
||||
if( isset( $_GET['jsonp'] ) && $_GET['jsonp'] == 'yourls' ) {
|
||||
$short = $return['shorturl'] ? $return['shorturl'] : '';
|
||||
$message = "Short URL (Ctrl+C to copy)";
|
||||
header('Content-type: application/json');
|
||||
echo yourls_apply_filter( 'bookmarklet_jsonp', "yourls_callback({'short_url':'$short','message':'$message'});" );
|
||||
include('footer.php');
|
||||
|
||||
die();
|
||||
}
|
||||
@@ -21,15 +31,6 @@ if (!$resp->is_valid) {
|
||||
die ( '<p class="error" title="' . $resp->error . '">' . yourls__( 'The reCAPTCHA wasn\'t entered correctly. Go back and try it again.', 'isq_translation' ) . '</p></div></div>' );
|
||||
}
|
||||
|
||||
$url = yourls_sanitize_url( $_REQUEST['url'] );
|
||||
$keyword = isset( $_REQUEST['keyword'] ) ? yourls_sanitize_keyword( $_REQUEST['keyword'] ): '' ;
|
||||
$title = isset( $_REQUEST['title'] ) ? yourls_sanitize_title( $_REQUEST['title'] ) : '' ;
|
||||
$return = yourls_add_new_link( $url, $keyword, $title );
|
||||
|
||||
$shorturl = isset( $return['shorturl'] ) ? $return['shorturl'] : '';
|
||||
$message = isset( $return['message'] ) ? $return['message'] : '';
|
||||
$title = isset( $return['title'] ) ? $return['title'] : '';
|
||||
|
||||
?>
|
||||
|
||||
<!-- Error reporting -->
|
||||
|
||||
Reference in New Issue
Block a user