Index: branches/2.0singleton/lib/PayPal.inc.php
===================================================================
--- branches/2.0singleton/lib/PayPal.inc.php	(revision 122)
+++ branches/2.0singleton/lib/PayPal.inc.php	(revision 128)
@@ -74,6 +74,8 @@
     function setButtonDefaults($type, $options)
     {
+		$app =& App::getInstance();
+
         if (!is_array($options) || empty($options)) {
-            App::logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
@@ -82,5 +84,5 @@
             $this->_default_button_options['_global'] = array_merge($this->_default_button_options['_global'], $options);
         } else if (!isset($this->_default_button_options[$type])) {
-            App::logMsg(sprintf('Invalid button type: %s', $type), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Invalid button type: %s', $type), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
@@ -104,16 +106,18 @@
     function newButton($type, $name, $options=null)
     {
+		$app =& App::getInstance();
+
         if (!isset($this->_default_button_options[$type])) {
-            App::logMsg(sprintf('Invalid button type: %s', $type), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Invalid button type: %s', $type), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
 
         if (!is_array($options) || empty($options)) {
-            App::logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Invalid options: %s', getDump($options)), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
 
         if (isset($this->_buttons[$name])) {
-            App::logMsg(sprintf('Overwriting existing button name: %s', getDump($this->_buttons[$name])), LOG_DEBUG, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Overwriting existing button name: %s', getDump($this->_buttons[$name])), LOG_DEBUG, __FILE__, __LINE__);
         }
 
@@ -137,6 +141,8 @@
     function getLink($name)
     {
+		$app =& App::getInstance();
+
         if (!isset($this->_buttons[$name])) {
-            App::logMsg(sprintf('Button does not exist: %s', $name), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Button does not exist: %s', $name), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
@@ -207,9 +213,11 @@
     function setParam($params)
     {
+		$app =& App::getInstance();
+
         if (isset($params) && is_array($params)) {
             // Merge new parameters with old overriding only those passed.
             $this->_params = array_merge($this->_params, $params);
         } else {
-            App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
         }
     }
@@ -224,8 +232,10 @@
     function getParam($param)
     {
+		$app =& App::getInstance();
+
         if (isset($this->_params[$param])) {
             return $this->_params[$param];
         } else {
-            App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
             return null;
         }
@@ -259,9 +269,11 @@
     function processIPN()
     {
+		$app =& App::getInstance();
+
         if (getPost('test_ipn') == '1' || $this->getParam('test_mode')) {
-            App::logMsg(sprintf('Processing PayPal IPN in test mode: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Processing PayPal IPN in test mode: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
             $url = parse_url('https://www.sandbox.paypal.com/cgi-bin/webscr');
         } else {
-            App::logMsg(sprintf('Processing PayPal IPN: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Processing PayPal IPN: %s', getDump(getFormData())), LOG_DEBUG, __FILE__, __LINE__);
             $url = parse_url($this->getParam('paypal_url'));
         }
@@ -287,5 +299,5 @@
 
         if (!$fp) {
-            App::logMsg(sprintf('Connection to PayPal URL %s failed with error: %s (%s)', $ssl . $url['host'], $errstr, $errnum), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Connection to PayPal URL %s failed with error: %s (%s)', $ssl . $url['host'], $errstr, $errnum), LOG_WARNING, __FILE__, __LINE__);
             return false;
         } else {
@@ -304,5 +316,5 @@
             fclose($fp);
 
-            App::logMsg(sprintf('IPN response received: %s', $this->_ipn_response), LOG_NOTICE, __FILE__, __LINE__);
+            $app->logMsg(sprintf('IPN response received: %s', $this->_ipn_response), LOG_NOTICE, __FILE__, __LINE__);
             return true;
         }
@@ -318,22 +330,24 @@
     function verifiedIPN()
     {
+		$app =& App::getInstance();
+
         if (!isset($this->_ipn_response)) {
-            App::logMsg(sprintf('Cannot verify IPN, response not received.', null), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Cannot verify IPN, response not received.', null), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
 
         if (empty($this->_ipn_response)) {
-            App::logMsg(sprintf('Cannot verify IPN, response empty.', null), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('Cannot verify IPN, response empty.', null), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
 
         if (preg_match('/VERIFIED/', $this->_ipn_response)) {
-            App::logMsg(sprintf('IPN verified!', null), LOG_DEBUG, __FILE__, __LINE__);
+            $app->logMsg(sprintf('IPN verified!', null), LOG_DEBUG, __FILE__, __LINE__);
             return true;
         } else if (preg_match('/INVALID/', $this->_ipn_response)) {
-            App::logMsg(sprintf('IPN invalid.', null), LOG_DEBUG, __FILE__, __LINE__);
-            return false;
-        } else {
-            App::logMsg(sprintf('IPN unknown.', null), LOG_WARNING, __FILE__, __LINE__);
+            $app->logMsg(sprintf('IPN invalid.', null), LOG_DEBUG, __FILE__, __LINE__);
+            return false;
+        } else {
+            $app->logMsg(sprintf('IPN unknown.', null), LOG_WARNING, __FILE__, __LINE__);
             return false;
         }
