[TEP-COMMIT] [CVS catalog] move the initializing logic away from the constructor, and call it only when the module is installed

anonymous-OfajU3CKLf1/[email protected] 22 Jul 2004 22:00:17 -0000
Newsgroups gmane.comp.web.oscommerce.cvs
Message-ID <[email protected]>
Commit in catalog/catalog/includes/modules/payment on MAIN

authorizenet.php +15 -9 1.53 -> 1.54

cc.php +10 -5 1.58 -> 1.59

cod.php +10 -5 1.28 -> 1.29

ipayment.php +10 -5 1.39 -> 1.40

moneyorder.php +13 -8 1.10 -> 1.11

nochex.php +10 -5 1.15 -> 1.16

paypal.php +10 -5 1.43 -> 1.44

pm2checkout.php +10 -5 1.24 -> 1.25

psigate.php +10 -5 1.22 -> 1.23

secpay.php +10 -5 1.38 -> 1.39

+108 -57

10 modified files

move the initializing logic away from the constructor, and call it only when the module is installed

----------

catalog /catalog /includes /modules /payment

authorizenet.php 1.53 -> 1.54

diff -u -r1.53 -r1.54
--- authorizenet.php 2004/07/22 17:04:45 1.53
+++ authorizenet.php 2004/07/22 22:00:10 1.54
@@ -9,22 +9,29 @@

Released under the GNU General Public License
*/

-// need if (exists()) and error message maybe have admin message too
- if (file_exists(MODULE_PAYMENT_AUTHORIZENET_LOGIN_FILE)) {
- include(MODULE_PAYMENT_AUTHORIZENET_LOGIN_FILE); // Get our private defines
- }

class authorizenet {

- var $code, $title, $description, $enabled, $sort_order, $order_status, $form_action_url;

+ var $code, $title, $description, $sort_order, $enabled = false, $order_status, $form_action_url;

var $cc_card_type, $cc_card_number, $cc_expiry_month, $cc_expiry_year;

-// class constructor

function authorizenet() {

- global $order;
-

$this->code = 'authorizenet';
$this->title = MODULE_PAYMENT_AUTHORIZENET_TEXT_TITLE;
$this->description = MODULE_PAYMENT_AUTHORIZENET_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_AUTHORIZENET_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+
+// need if (exists()) and error message maybe have admin message too
+ if (file_exists(MODULE_PAYMENT_AUTHORIZENET_LOGIN_FILE)) {
+ include(MODULE_PAYMENT_AUTHORIZENET_LOGIN_FILE); // Get our private defines
+ }
+

$this->enabled = ((MODULE_PAYMENT_AUTHORIZENET_STATUS == 'True') ? true : false);
if (MODULE_PAYMENT_AUTHORIZENET_LOGIN == 'MODULE_PAYMENT_AUTHORIZENET_LOGIN') {
$this->enabled = false; // Login Name not defined, disable

@@ -108,7 +115,6 @@

}
// end authorize.net code

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

cc.php 1.58 -> 1.59

diff -u -r1.58 -r1.59
--- cc.php 2004/07/22 17:04:45 1.58
+++ cc.php 2004/07/22 22:00:10 1.59
@@ -11,15 +11,21 @@

*/

class cc {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function cc() {

- global $order;
-

$this->code = 'cc';
$this->title = MODULE_PAYMENT_CC_TEXT_TITLE;
$this->description = MODULE_PAYMENT_CC_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_CC_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_CC_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_CC_STATUS == 'True') ? true : false);

@@ -30,7 +36,6 @@

if (is_object($order)) $this->update_status();
}

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

cod.php 1.28 -> 1.29

diff -u -r1.28 -r1.29
--- cod.php 2003/02/14 05:51:31 1.28
+++ cod.php 2004/07/22 22:00:10 1.29
@@ -11,15 +11,21 @@

*/

class cod {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function cod() {

- global $order;
-

$this->code = 'cod';
$this->title = MODULE_PAYMENT_COD_TEXT_TITLE;
$this->description = MODULE_PAYMENT_COD_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_COD_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_COD_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_COD_STATUS == 'True') ? true : false);

@@ -30,7 +36,6 @@

if (is_object($order)) $this->update_status();
}

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

ipayment.php 1.39 -> 1.40

diff -u -r1.39 -r1.40
--- ipayment.php 2004/07/22 17:04:45 1.39
+++ ipayment.php 2004/07/22 22:00:10 1.40
@@ -11,15 +11,21 @@

*/

class ipayment {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function ipayment() {

- global $order;
-

$this->code = 'ipayment';
$this->title = MODULE_PAYMENT_IPAYMENT_TEXT_TITLE;
$this->description = MODULE_PAYMENT_IPAYMENT_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_IPAYMENT_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_IPAYMENT_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_IPAYMENT_STATUS == 'True') ? true : false);

@@ -32,7 +38,6 @@

$this->form_action_url = 'https://ipayment.de/merchant/' . MODULE_PAYMENT_IPAYMENT_ID . '/processor.php';
}

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

moneyorder.php 1.10 -> 1.11

diff -u -r1.10 -r1.11
--- moneyorder.php 2003/01/29 19:57:14 1.10
+++ moneyorder.php 2004/07/22 22:00:10 1.11
@@ -11,15 +11,21 @@

*/

class moneyorder {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function moneyorder() {

- global $order;
-

$this->code = 'moneyorder';
$this->title = MODULE_PAYMENT_MONEYORDER_TEXT_TITLE;

- $this->description = MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION;

+ $this->description = sprintf(MODULE_PAYMENT_MONEYORDER_TEXT_DESCRIPTION, (defined('MODULE_PAYMENT_MONEYORDER_PAYTO') ? MODULE_PAYMENT_MONEYORDER_PAYTO : '(not set)'));
+
+ if (defined('MODULE_PAYMENT_MONEYORDER_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_MONEYORDER_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_MONEYORDER_STATUS == 'True') ? true : false);

@@ -28,11 +34,10 @@

}

if (is_object($order)) $this->update_status();

-
- $this->email_footer = MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER;

+
+ $this->email_footer = sprintf(MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER, MODULE_PAYMENT_MONEYORDER_PAYTO);

}

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

nochex.php 1.15 -> 1.16

diff -u -r1.15 -r1.16
--- nochex.php 2004/07/22 17:04:45 1.15
+++ nochex.php 2004/07/22 22:00:10 1.16
@@ -11,15 +11,21 @@

*/

class nochex {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function nochex() {

- global $order;
-

$this->code = 'nochex';
$this->title = MODULE_PAYMENT_NOCHEX_TEXT_TITLE;
$this->description = MODULE_PAYMENT_NOCHEX_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_NOCHEX_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_NOCHEX_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_NOCHEX_STATUS == 'True') ? true : false);

@@ -32,7 +38,6 @@

$this->form_action_url = 'https://www.nochex.com/nochex.dll/checkout';
}

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

paypal.php 1.43 -> 1.44

diff -u -r1.43 -r1.44
--- paypal.php 2004/07/22 17:04:45 1.43
+++ paypal.php 2004/07/22 22:00:10 1.44
@@ -11,15 +11,21 @@

*/

class paypal {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function paypal() {

- global $order;
-

$this->code = 'paypal';
$this->title = MODULE_PAYMENT_PAYPAL_TEXT_TITLE;
$this->description = MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_PAYPAL_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_PAYPAL_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_PAYPAL_STATUS == 'True') ? true : false);

@@ -32,7 +38,6 @@

$this->form_action_url = 'https://secure.paypal.com/cgi-bin/webscr';
}

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

pm2checkout.php 1.24 -> 1.25

diff -u -r1.24 -r1.25
--- pm2checkout.php 2004/07/22 17:04:45 1.24
+++ pm2checkout.php 2004/07/22 22:00:10 1.25
@@ -11,15 +11,21 @@

*/

class pm2checkout {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function pm2checkout() {

- global $order;
-

$this->code = 'pm2checkout';
$this->title = MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE;
$this->description = MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_2CHECKOUT_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_2CHECKOUT_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_2CHECKOUT_STATUS == 'True') ? true : false);

@@ -32,7 +38,6 @@

$this->form_action_url = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c';
}

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

psigate.php 1.22 -> 1.23

diff -u -r1.22 -r1.23
--- psigate.php 2004/07/22 17:04:45 1.22
+++ psigate.php 2004/07/22 22:00:10 1.23
@@ -11,15 +11,21 @@

*/

class psigate {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function psigate() {

- global $order;
-

$this->code = 'psigate';
$this->title = MODULE_PAYMENT_PSIGATE_TEXT_TITLE;
$this->description = MODULE_PAYMENT_PSIGATE_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_PSIGATE_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_PSIGATE_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_PSIGATE_STATUS == 'True') ? true : false);

@@ -32,7 +38,6 @@

$this->form_action_url = 'https://order.psigate.com/psigate.asp';
}

-// class methods

function update_status() {
global $order;

----------

catalog /catalog /includes /modules /payment

secpay.php 1.38 -> 1.39

diff -u -r1.38 -r1.39
--- secpay.php 2004/07/22 17:04:45 1.38
+++ secpay.php 2004/07/22 22:00:10 1.39
@@ -11,15 +11,21 @@

*/

class secpay {

- var $code, $title, $description, $enabled;

+ var $code, $title, $description, $sort_order, $enabled = false;

-// class constructor

function secpay() {

- global $order;
-

$this->code = 'secpay';
$this->title = MODULE_PAYMENT_SECPAY_TEXT_TITLE;
$this->description = MODULE_PAYMENT_SECPAY_TEXT_DESCRIPTION;

+
+ if (defined('MODULE_PAYMENT_SECPAY_STATUS')) {
+ $this->initialize();
+ }
+ }
+
+ function initialize() {
+ global $order;
+

$this->sort_order = MODULE_PAYMENT_SECPAY_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_SECPAY_STATUS == 'True') ? true : false);

@@ -32,7 +38,6 @@

$this->form_action_url = 'https://www.secpay.com/java-bin/ValCard';
}

-// class methods

function update_status() {
global $order;

CVSspam 0.2.8

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click