[20-Jun-2014 05:28:48 America/New_York] PHP Parse error: syntax error, unexpected 'use' (T_USE) in /paas/c0011/www/core/cache/includes/elements/modsnippet/32.include.cache.php on line 20
$modx->setDebug(E_ALL & ~E_NOTICE); // sets error_reporting to everything except NOTICE remarks
ini_set("display_errors", 1);
require($modx->config['base_path'].'assets/snippets/lvr/lib/LVRSubmitConfig.inc.php');
require($modx->config['base_path'].'assets/snippets/lvr/lib/LVRSubmitFunctions.inc.php');
// kint debugger
require($modx->config['base_path'].'assets/snippets/lvr/lib/kint/Kint.class.php');
// nusoap for SP list item creation
require($modx->config['base_path'].'assets/snippets/lvr/lib/nusoap/lib/nusoap.php');
// paypal rest api bootstrap
require($modx->config['base_path'].'assets/snippets/lvr/lib/pp/bootstrap.php');
use PayPal\Api\Amount;
use PayPal\Api\Details;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
use PayPal\Api\CreditCard;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\FundingInstrument;
use PayPal\Api\Transaction;
use PayPal\Api\RedirectUrls;
use PayPal\Api\ExecutePayment;
use PayPal\Api\PaymentExecution;
<?php
// Paypal bootstrap file.
// Include the composer autoloader
if(!file_exists($modx->config['base_path'].'core/components/composerx/vendor/autoload.php')) {
echo "The 'vendor' folder is missing. You must run 'composer update --no-dev' to resolve application dependencies.\nPlease see the README for more information.\n";
exit(1);
}
require($modx->config['base_path'].'core/components/composerx/vendor/autoload.php');
use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential;
$apiContext = getApiContext();
function getApiContext() {
$apiContext = new ApiContext(
new OAuthTokenCredential(
'AZpoTBCHzdWtFr0G-BrIiNt0eC-rjLBn5wWQHktPnsjmgdIQ79M5CVEA1_f2',
'EKIR6xDpc8T76kE3KVRui9VGH5blQ8t8Sjln1A5RThmZvqy_Uj4QWPP8iTGA'
)
);
// #### SDK configuration
$apiContext->setConfig(
array(
'mode' => 'sandbox',
'http.ConnectionTimeOut' => 30,
'log.LogEnabled' => true,
'log.FileName' => 'PayPal.log',
'log.LogLevel' => 'FINE'
)
);
return $apiContext;
}
This question has been answered by harveyev. See the first response.
<?php
function elements_modsnippet_32($scriptProperties= array()) {
global $modx;
if (is_array($scriptProperties)) {
extract($scriptProperties, EXTR_SKIP);
}
// debug info (comment out for production)
error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors", 1);
use PayPal\Api\Amount;
use PayPal\Api\Details;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
use PayPal\Api\CreditCard;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\FundingInstrument;
use PayPal\Api\Transaction;
use PayPal\Api\RedirectUrls;
use PayPal\Api\ExecutePayment;
use PayPal\Api\PaymentExecution;
require($modx->config['base_path'].'assets/snippets/lvr/lib/LVRSubmitConfig.inc.php');
require($modx->config['base_path'].'assets/snippets/lvr/lib/LVRSubmitFunctions.inc.php');
// kint debugger
require($modx->config['base_path'].'assets/snippets/lvr/lib/kint/Kint.class.php');
// nusoap for SP list item creation
require_once($modx->config['base_path'].'assets/snippets/lvr/lib/nusoap/lib/nusoap.php');
// paypal rest api bootstrap
require($modx->config['base_path'].'core/components/composerx/vendor/autoload.php');[20-Jun-2014 06:49:32 America/New_York] PHP Parse error: syntax error, unexpected 'use' (T_USE) in /paas/c0011/www/core/cache/includes/elements/modsnippet/32.include.cache.php on line 11
1. That is the snippet code itself, not the snippet output. When you call a snippet uncached, it's the output that is not cached.
As for the rest of it, I'm not familiar with it so can't be of any help.
[2014-06-20 07:22:42] (ERROR @ /paas/c0011/www/core/cache/includes/elements/modsnippet/28.include.cache.php : 7) PHP warning: file_exists(): open_basedir restriction in effect. File(/paas/c1124/www/assets/snippets/lvr/LVRSubmit-Snippet.php) is not within the allowed path(s): (/paas/c0011) [2014-06-20 07:24:19] (ERROR @ /paas/c0011/www/assets/snippets/lvr/LVRSubmit-Snippet.php : 3) PHP warning: require_once(): open_basedir restriction in effect. File(/paas/c1124/www/config.core.php) is not within the allowed path(s): (/paas/c0011) [2014-06-20 07:24:19] (ERROR @ /paas/c0011/www/assets/snippets/lvr/LVRSubmit-Snippet.php : 3) PHP warning: require_once(/paas/c1124/www/config.core.php): failed to open stream: Operation not permitted
if (file_exists($file)) {
$basePath = $modx->config['base_path'];
$o = include $basepath . $file;
} else { $o = 'File not found at: '.$basepath . $file; }
return $o;[[!include? &file=`assets/snippets/lvr/LVRSubmit-Snippet.php`]]
$basePath = $modx->config['base_path'];
dev clouds also have their base_path set. It's set to something like "paas/c0102" - the site's location on the server.
I'll bet that somewhere something was cached with the original page (dev's path) after the base_path system setting was processed.