Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Documented function apiUrl
  • Loading branch information
Sam Tuke committed Jun 14, 2014
1 parent 85f2248 commit e981631
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions plugins/restapi_test/main.php
Expand Up @@ -345,26 +345,33 @@

<?php

/**
* @return $trimmedUrl
*/
function apiUrl( $website ){

$url = '';

if( !empty( $_SERVER["HTTPS"] ) ){
if($_SERVER["HTTPS"]!=="off")

// Check which protocol to use
if($_SERVER["HTTPS"]!=="off") {
$url = 'https://'; //https
else
} else {
$url = 'http://'; //http
}
else
}
} else {
$url = 'http://'; //http

}

$api_url = str_replace( 'page=main&pi=restapi_test', 'page=call&pi=restapi', $_SERVER['REQUEST_URI'] );
$api_url = str_replace( 'page=main&pi=restapi', 'page=call&pi=restapi', $api_url );
$api_url1 = str_replace( 'page=main&pi=restapi', 'page=call&pi=restapi', $api_url );

$url = $url . $website . $api_url;
$url = rtrim($url,'/');
$concatenatedUrl = $url . $website . $api_url1;
$trimmedUrl = rtrim($concatenatedUrl,'/');

return $url;
return $trimmedUrl;

}

?>

0 comments on commit e981631

Please sign in to comment.