forked from LiveCarta/PayPal-PHP-SDK
Updating samples to use fluent setters + doc fixes
This commit is contained in:
@@ -9,6 +9,8 @@ if(!file_exists(__DIR__ .'/vendor/autoload.php')) {
|
||||
exit(1);
|
||||
}
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
require __DIR__ . '/common.php';
|
||||
|
||||
define("PP_CONFIG_PATH", __DIR__);
|
||||
|
||||
use PayPal\Rest\ApiContext;
|
||||
@@ -36,24 +38,3 @@ $apiContext->setConfig(array(
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* ### getBaseUrl function
|
||||
* // utility function that returns base url for
|
||||
* // determining return/cancel urls
|
||||
* @return string
|
||||
*/
|
||||
function getBaseUrl() {
|
||||
|
||||
$protocol = 'http';
|
||||
if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) {
|
||||
$protocol .= 's';
|
||||
$protocol_port = $_SERVER['SERVER_PORT'];
|
||||
} else {
|
||||
$protocol_port = 80;
|
||||
}
|
||||
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$port = $_SERVER['SERVER_PORT'];
|
||||
$request = $_SERVER['PHP_SELF'];
|
||||
return dirname($protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user