Awight has uploaded a new change for review. https://gerrit.wikimedia.org/r/209778
Change subject: use __DIR__ everywhere ...................................................................... use __DIR__ everywhere Change-Id: I87768f062340495b137d7cb9ec3e52be9ed2455f --- M DonationInterface.php M donationinterface_langonly.php M gateway_forms/rapidhtml/RapidHtmlResources.php M globalcollect_gateway/scripts/orphans.php M tests/includes/test_gateway/TestingAdyenAdapter.php M tests/includes/test_gateway/TestingAmazonAdapter.php M tests/includes/test_gateway/TestingAstropayAdapter.php M tests/includes/test_gateway/TestingGlobalCollectAdapter.php M tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php M tests/includes/test_gateway/TestingPaypalAdapter.php M tests/includes/test_gateway/TestingWorldPayAdapter.php 11 files changed, 127 insertions(+), 131 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/78/209778/1 diff --git a/DonationInterface.php b/DonationInterface.php index 6308aec..864c0e8 100644 --- a/DonationInterface.php +++ b/DonationInterface.php @@ -27,8 +27,6 @@ 'url' => 'https://www.mediawiki.org/wiki/Extension:DonationInterface', ); -$donationinterface_dir = dirname( __FILE__ ) . '/'; - // Test mode (not for production!) // Set it if not defined if ( !isset( $wgDonationInterfaceTestMode) || $wgDonationInterfaceTestMode !== true ) { @@ -39,86 +37,86 @@ /** * CLASSES */ -$wgAutoloadClasses['CurrencyRates'] = $donationinterface_dir . 'gateway_common/CurrencyRates.php'; -$wgAutoloadClasses['DonationData'] = $donationinterface_dir . 'gateway_common/DonationData.php'; -$wgAutoloadClasses['DonationLoggerFactory'] = $donationinterface_dir . 'gateway_common/DonationLoggerFactory.php'; -$wgAutoloadClasses['DonationLogProcessor'] = $donationinterface_dir . 'gateway_common/DonationLogProcessor.php'; -$wgAutoloadClasses['DonationQueue'] = $donationinterface_dir . 'gateway_common/DonationQueue.php'; -$wgAutoloadClasses['EncodingMangler'] = $donationinterface_dir . 'gateway_common/EncodingMangler.php'; -$wgAutoloadClasses['FinalStatus'] = $donationinterface_dir . 'gateway_common/FinalStatus.php'; -$wgAutoloadClasses['GatewayAdapter'] = $donationinterface_dir . 'gateway_common/gateway.adapter.php'; -$wgAutoloadClasses['GatewayPage'] = $donationinterface_dir . 'gateway_common/GatewayPage.php'; -$wgAutoloadClasses['GatewayType'] = $donationinterface_dir . 'gateway_common/gateway.adapter.php'; -$wgAutoloadClasses['DataValidator'] = $donationinterface_dir . 'gateway_common/DataValidator.php'; -$wgAutoloadClasses['LogPrefixProvider'] = $donationinterface_dir . 'gateway_common/gateway.adapter.php'; -$wgAutoloadClasses['NationalCurrencies'] = $donationinterface_dir . 'gateway_common/NationalCurrencies.php'; -$wgAutoloadClasses['PaymentMethod'] = $donationinterface_dir . 'gateway_common/PaymentMethod.php'; -$wgAutoloadClasses['PaymentResult'] = $donationinterface_dir . 'gateway_common/PaymentResult.php'; -$wgAutoloadClasses['PaymentTransactionResponse'] = $donationinterface_dir . 'gateway_common/PaymentTransactionResponse.php'; -$wgAutoloadClasses['ResponseCodes'] = $donationinterface_dir . 'gateway_common/ResponseCodes.php'; -$wgAutoloadClasses['ResponseProcessingException'] = $donationinterface_dir . 'gateway_common/ResponseProcessingException.php'; -$wgAutoloadClasses['WmfFramework_Mediawiki'] = $donationinterface_dir . 'gateway_common/WmfFramework.mediawiki.php'; -$wgAutoloadClasses['WmfFrameworkLogHandler'] = $donationinterface_dir . 'gateway_common/WmfFrameworkLogHandler.php'; +$wgAutoloadClasses['CurrencyRates'] = __DIR__ . '/gateway_common/CurrencyRates.php'; +$wgAutoloadClasses['DonationData'] = __DIR__ . '/gateway_common/DonationData.php'; +$wgAutoloadClasses['DonationLoggerFactory'] = __DIR__ . '/gateway_common/DonationLoggerFactory.php'; +$wgAutoloadClasses['DonationLogProcessor'] = __DIR__ . '/gateway_common/DonationLogProcessor.php'; +$wgAutoloadClasses['DonationQueue'] = __DIR__ . '/gateway_common/DonationQueue.php'; +$wgAutoloadClasses['EncodingMangler'] = __DIR__ . '/gateway_common/EncodingMangler.php'; +$wgAutoloadClasses['FinalStatus'] = __DIR__ . '/gateway_common/FinalStatus.php'; +$wgAutoloadClasses['GatewayAdapter'] = __DIR__ . '/gateway_common/gateway.adapter.php'; +$wgAutoloadClasses['GatewayPage'] = __DIR__ . '/gateway_common/GatewayPage.php'; +$wgAutoloadClasses['GatewayType'] = __DIR__ . '/gateway_common/gateway.adapter.php'; +$wgAutoloadClasses['DataValidator'] = __DIR__ . '/gateway_common/DataValidator.php'; +$wgAutoloadClasses['LogPrefixProvider'] = __DIR__ . '/gateway_common/gateway.adapter.php'; +$wgAutoloadClasses['NationalCurrencies'] = __DIR__ . '/gateway_common/NationalCurrencies.php'; +$wgAutoloadClasses['PaymentMethod'] = __DIR__ . '/gateway_common/PaymentMethod.php'; +$wgAutoloadClasses['PaymentResult'] = __DIR__ . '/gateway_common/PaymentResult.php'; +$wgAutoloadClasses['PaymentTransactionResponse'] = __DIR__ . '/gateway_common/PaymentTransactionResponse.php'; +$wgAutoloadClasses['ResponseCodes'] = __DIR__ . '/gateway_common/ResponseCodes.php'; +$wgAutoloadClasses['ResponseProcessingException'] = __DIR__ . '/gateway_common/ResponseProcessingException.php'; +$wgAutoloadClasses['WmfFramework_Mediawiki'] = __DIR__ . '/gateway_common/WmfFramework.mediawiki.php'; +$wgAutoloadClasses['WmfFrameworkLogHandler'] = __DIR__ . '/gateway_common/WmfFrameworkLogHandler.php'; //load all possible form classes -$wgAutoloadClasses['Gateway_Form'] = $donationinterface_dir . 'gateway_forms/Form.php'; -$wgAutoloadClasses['Gateway_Form_Mustache'] = $donationinterface_dir . 'gateway_forms/Mustache.php'; -$wgAutoloadClasses['Gateway_Form_RapidHtml'] = $donationinterface_dir . 'gateway_forms/RapidHtml.php'; -$wgAutoloadClasses['CountryCodes'] = $donationinterface_dir . 'gateway_forms/includes/CountryCodes.php'; -$wgAutoloadClasses['ProvinceAbbreviations'] = $donationinterface_dir . 'gateway_forms/includes/ProvinceAbbreviations.php'; -$wgAutoloadClasses['StateAbbreviations'] = $donationinterface_dir . 'gateway_forms/includes/StateAbbreviations.php'; +$wgAutoloadClasses['Gateway_Form'] = __DIR__ . '/gateway_forms/Form.php'; +$wgAutoloadClasses['Gateway_Form_Mustache'] = __DIR__ . '/gateway_forms/Mustache.php'; +$wgAutoloadClasses['Gateway_Form_RapidHtml'] = __DIR__ . '/gateway_forms/RapidHtml.php'; +$wgAutoloadClasses['CountryCodes'] = __DIR__ . '/gateway_forms/includes/CountryCodes.php'; +$wgAutoloadClasses['ProvinceAbbreviations'] = __DIR__ . '/gateway_forms/includes/ProvinceAbbreviations.php'; +$wgAutoloadClasses['StateAbbreviations'] = __DIR__ . '/gateway_forms/includes/StateAbbreviations.php'; //GlobalCollect gateway classes -$wgAutoloadClasses['GlobalCollectGateway'] = $donationinterface_dir . 'globalcollect_gateway/globalcollect_gateway.body.php'; -$wgAutoloadClasses['GlobalCollectGatewayResult'] = $donationinterface_dir . 'globalcollect_gateway/globalcollect_resultswitcher.body.php'; +$wgAutoloadClasses['GlobalCollectGateway'] = __DIR__ . '/globalcollect_gateway/globalcollect_gateway.body.php'; +$wgAutoloadClasses['GlobalCollectGatewayResult'] = __DIR__ . '/globalcollect_gateway/globalcollect_resultswitcher.body.php'; -$wgAutoloadClasses['GlobalCollectAdapter'] = $donationinterface_dir . 'globalcollect_gateway/globalcollect.adapter.php'; +$wgAutoloadClasses['GlobalCollectAdapter'] = __DIR__ . '/globalcollect_gateway/globalcollect.adapter.php'; $wgAutoloadClasses['GlobalCollectOrphanAdapter'] = __DIR__ . '/globalcollect_gateway/scripts/orphan_adapter.php'; // Amazon -$wgAutoloadClasses['AmazonGateway'] = $donationinterface_dir . 'amazon_gateway/amazon_gateway.body.php'; -$wgAutoloadClasses['AmazonAdapter'] = $donationinterface_dir . 'amazon_gateway/amazon.adapter.php'; +$wgAutoloadClasses['AmazonGateway'] = __DIR__ . '/amazon_gateway/amazon_gateway.body.php'; +$wgAutoloadClasses['AmazonAdapter'] = __DIR__ . '/amazon_gateway/amazon.adapter.php'; //Adyen -$wgAutoloadClasses['AdyenGateway'] = $donationinterface_dir . 'adyen_gateway/adyen_gateway.body.php'; -$wgAutoloadClasses['AdyenGatewayResult'] = $donationinterface_dir . 'adyen_gateway/adyen_resultswitcher.body.php'; -$wgAutoloadClasses['AdyenAdapter'] = $donationinterface_dir . 'adyen_gateway/adyen.adapter.php'; +$wgAutoloadClasses['AdyenGateway'] = __DIR__ . '/adyen_gateway/adyen_gateway.body.php'; +$wgAutoloadClasses['AdyenGatewayResult'] = __DIR__ . '/adyen_gateway/adyen_resultswitcher.body.php'; +$wgAutoloadClasses['AdyenAdapter'] = __DIR__ . '/adyen_gateway/adyen.adapter.php'; // Astropay -$wgAutoloadClasses['AstropayGateway'] = $donationinterface_dir . 'astropay_gateway/astropay_gateway.body.php'; -$wgAutoloadClasses['AstropayGatewayResult'] = $donationinterface_dir . 'astropay_gateway/astropay_resultswitcher.body.php'; -$wgAutoloadClasses['AstropayAdapter'] = $donationinterface_dir . 'astropay_gateway/astropay.adapter.php'; +$wgAutoloadClasses['AstropayGateway'] = __DIR__ . '/astropay_gateway/astropay_gateway.body.php'; +$wgAutoloadClasses['AstropayGatewayResult'] = __DIR__ . '/astropay_gateway/astropay_resultswitcher.body.php'; +$wgAutoloadClasses['AstropayAdapter'] = __DIR__ . '/astropay_gateway/astropay.adapter.php'; // Paypal -$wgAutoloadClasses['PaypalGateway'] = $donationinterface_dir . 'paypal_gateway/paypal_gateway.body.php'; -$wgAutoloadClasses['PaypalGatewayResult'] = $donationinterface_dir . 'paypal_gateway/paypal_resultswitcher.body.php'; -$wgAutoloadClasses['PaypalAdapter'] = $donationinterface_dir . 'paypal_gateway/paypal.adapter.php'; +$wgAutoloadClasses['PaypalGateway'] = __DIR__ . '/paypal_gateway/paypal_gateway.body.php'; +$wgAutoloadClasses['PaypalGatewayResult'] = __DIR__ . '/paypal_gateway/paypal_resultswitcher.body.php'; +$wgAutoloadClasses['PaypalAdapter'] = __DIR__ . '/paypal_gateway/paypal.adapter.php'; // WorldPay -$wgAutoloadClasses['WorldPayGateway'] = $donationinterface_dir . 'worldpay_gateway/worldpay_gateway.body.php'; -$wgAutoloadClasses['WorldPayAdapter'] = $donationinterface_dir . 'worldpay_gateway/worldpay.adapter.php'; +$wgAutoloadClasses['WorldPayGateway'] = __DIR__ . '/worldpay_gateway/worldpay_gateway.body.php'; +$wgAutoloadClasses['WorldPayAdapter'] = __DIR__ . '/worldpay_gateway/worldpay.adapter.php'; $wgAPIModules['di_wp_validate'] = 'WorldPayValidateApi'; -$wgAutoloadClasses['WorldPayValidateApi'] = $donationinterface_dir . 'worldpay_gateway/worldpay.api.php'; +$wgAutoloadClasses['WorldPayValidateApi'] = __DIR__ . '/worldpay_gateway/worldpay.api.php'; //Extras classes - required for ANY optional class that is considered an "extra". -$wgAutoloadClasses['Gateway_Extras'] = $donationinterface_dir . "extras/extras.body.php"; +$wgAutoloadClasses['Gateway_Extras'] = __DIR__ . '/extras/extras.body.php'; //Custom Filters classes -$wgAutoloadClasses['Gateway_Extras_CustomFilters'] = $donationinterface_dir . "extras/custom_filters/custom_filters.body.php"; +$wgAutoloadClasses['Gateway_Extras_CustomFilters'] = __DIR__ . '/extras/custom_filters/custom_filters.body.php'; //Conversion Log classes -$wgAutoloadClasses['Gateway_Extras_ConversionLog'] = $donationinterface_dir . "extras/conversion_log/conversion_log.body.php"; +$wgAutoloadClasses['Gateway_Extras_ConversionLog'] = __DIR__ . '/extras/conversion_log/conversion_log.body.php'; -$wgAutoloadClasses['Gateway_Extras_CustomFilters_MinFraud'] = $donationinterface_dir . "extras/custom_filters/filters/minfraud/minfraud.body.php"; -$wgAutoloadClasses['Gateway_Extras_CustomFilters_Referrer'] = $donationinterface_dir . "extras/custom_filters/filters/referrer/referrer.body.php"; -$wgAutoloadClasses['Gateway_Extras_CustomFilters_Source'] = $donationinterface_dir . "extras/custom_filters/filters/source/source.body.php"; -$wgAutoloadClasses['Gateway_Extras_CustomFilters_Functions'] = $donationinterface_dir . "extras/custom_filters/filters/functions/functions.body.php"; -$wgAutoloadClasses['Gateway_Extras_CustomFilters_IP_Velocity'] = $donationinterface_dir . "extras/custom_filters/filters/ip_velocity/ip_velocity.body.php"; +$wgAutoloadClasses['Gateway_Extras_CustomFilters_MinFraud'] = __DIR__ . '/extras/custom_filters/filters/minfraud/minfraud.body.php'; +$wgAutoloadClasses['Gateway_Extras_CustomFilters_Referrer'] = __DIR__ . '/extras/custom_filters/filters/referrer/referrer.body.php'; +$wgAutoloadClasses['Gateway_Extras_CustomFilters_Source'] = __DIR__ . '/extras/custom_filters/filters/source/source.body.php'; +$wgAutoloadClasses['Gateway_Extras_CustomFilters_Functions'] = __DIR__ . '/extras/custom_filters/filters/functions/functions.body.php'; +$wgAutoloadClasses['Gateway_Extras_CustomFilters_IP_Velocity'] = __DIR__ . '/extras/custom_filters/filters/ip_velocity/ip_velocity.body.php'; -$wgAutoloadClasses['Gateway_Extras_SessionVelocityFilter'] = $donationinterface_dir . "extras/session_velocity/session_velocity.body.php"; -$wgAutoloadClasses['GatewayFormChooser'] = $donationinterface_dir . 'special/GatewayFormChooser.php'; -$wgAutoloadClasses['SystemStatus'] = $donationinterface_dir . 'special/SystemStatus.php'; +$wgAutoloadClasses['Gateway_Extras_SessionVelocityFilter'] = __DIR__ . '/extras/session_velocity/session_velocity.body.php'; +$wgAutoloadClasses['GatewayFormChooser'] = __DIR__ . '/special/GatewayFormChooser.php'; +$wgAutoloadClasses['SystemStatus'] = __DIR__ . '/special/SystemStatus.php'; /** * GLOBALS @@ -127,7 +125,7 @@ /** * Global form dir */ -$wgDonationInterfaceHtmlFormDir = dirname( __FILE__ ) . "/gateway_forms/rapidhtml/html"; +$wgDonationInterfaceHtmlFormDir = __DIR__ . '/gateway_forms/rapidhtml/html'; $wgDonationInterfaceTest = false; /** @@ -247,7 +245,7 @@ # 'MerchantID' => '', // GlobalCollect ID # ); -$wgGlobalCollectGatewayHtmlFormDir = $donationinterface_dir . 'globalcollect_gateway/forms/html'; +$wgGlobalCollectGatewayHtmlFormDir = __DIR__ . '/globalcollect_gateway/forms/html'; $wgGlobalCollectGatewayCvvMap = array( 'M' => true, //CVV check performed and valid value. @@ -306,14 +304,14 @@ // even if it's 127.0.0.1 $wgAmazonGatewayReturnURL = ""; -$wgAmazonGatewayHtmlFormDir = $donationinterface_dir . 'amazon_gateway/forms/html'; +$wgAmazonGatewayHtmlFormDir = __DIR__ . '/amazon_gateway/forms/html'; $wgPaypalGatewayURL = 'https://www.paypal.com/cgi-bin/webscr'; $wgPaypalGatewayTestingURL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; $wgPaypalGatewayReturnURL = ''; //'http://127.0.0.1/index.php/Special:PaypalGatewayResult'; $wgPaypalGatewayRecurringLength = '0'; // 0 should mean forever -$wgPaypalGatewayHtmlFormDir = $donationinterface_dir . 'paypal_gateway/forms/html'; +$wgPaypalGatewayHtmlFormDir = __DIR__ . '/paypal_gateway/forms/html'; $wgPaypalGatewayXclickCountries = array(); @@ -321,7 +319,7 @@ # 'AccountEmail' => "", # ); -$wgAdyenGatewayHtmlFormDir = $donationinterface_dir . 'adyen_gateway/forms/html'; +$wgAdyenGatewayHtmlFormDir = __DIR__ . '/adyen_gateway/forms/html'; $wgAdyenGatewayBaseURL = 'https://live.adyen.com'; $wgAdyenGatewayBaseTestingURL = 'https://test.adyen.com'; // unused @@ -332,7 +330,7 @@ # 'SkinCode' => ''; # ); -$wgAstropayGatewayHtmlFormDir = $donationinterface_dir . 'astropay_gateway/forms/html'; +$wgAstropayGatewayHtmlFormDir = __DIR__ . '/astropay_gateway/forms/html'; // Set base URLs here. Individual transactions have their own paths $wgAstropayGatewayURL = 'https://astropaycard.com/'; $wgAstropayGatewayTestingURL = 'https://sandbox.astropaycard.com/'; @@ -348,7 +346,7 @@ # 'SecretKey' => '', // For signing requests and verifying responses # ); -$wgWorldPayGatewayHtmlFormDir = $donationinterface_dir . 'worldpay_gateway/forms/html'; +$wgWorldPayGatewayHtmlFormDir = __DIR__ . '/worldpay_gateway/forms/html'; $wgWorldPayGatewayURL = 'https://some.url.here'; @@ -897,7 +895,7 @@ */ // enable the API $wgAPIModules['donate'] = 'DonationApi'; -$wgAutoloadClasses['DonationApi'] = $donationinterface_dir . 'gateway_common/donation.api.php'; +$wgAutoloadClasses['DonationApi'] = __DIR__ . '/gateway_common/donation.api.php'; /** @@ -906,7 +904,7 @@ // Resource modules $wgResourceTemplate = array( - 'localBasePath' => $donationinterface_dir . 'modules', + 'localBasePath' => __DIR__ . '/modules', 'remoteExtPath' => 'DonationInterface/modules', ); $wgResourceModules['iframe.liberator'] = array( @@ -936,11 +934,11 @@ ) + $wgResourceTemplate;; // load any rapidhtml related resources -require_once( $donationinterface_dir . 'gateway_forms/rapidhtml/RapidHtmlResources.php' ); +require_once( __DIR__ . '/gateway_forms/rapidhtml/RapidHtmlResources.php' ); $wgResourceTemplate = array( - 'localBasePath' => $donationinterface_dir . 'gateway_forms', + 'localBasePath' => __DIR__ . '/gateway_forms', 'remoteExtPath' => 'DonationInterface/gateway_forms', ); @@ -1000,7 +998,7 @@ // minimum amounts for all currencies $wgResourceModules[ 'di.form.core.minimums' ] = array( 'scripts' => 'validate.currencyMinimums.js', - 'localBasePath' => $donationinterface_dir . 'modules', + 'localBasePath' => __DIR__ . '/modules', 'remoteExtPath' => 'DonationInterface/modules' ); @@ -1008,49 +1006,49 @@ $wgResourceModules[ 'di.form.core.validate' ] = array( 'scripts' => 'validate_input.js', 'dependencies' => array( 'di.form.core.minimums', 'ext.donationInterface.errorMessages' ), - 'localBasePath' => $donationinterface_dir . 'modules', + 'localBasePath' => __DIR__ . '/modules', 'remoteExtPath' => 'DonationInterface/modules' ); // Load the interface messages that are shared across multiple gateways $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/interface'; -$wgExtensionMessagesFiles['DonateInterface'] = $donationinterface_dir . 'gateway_common/interface.i18n.php'; +$wgExtensionMessagesFiles['DonateInterface'] = __DIR__ . '/gateway_common/interface.i18n.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/country-specific'; -$wgExtensionMessagesFiles['DonateInterfaceAlt'] = $donationinterface_dir . 'gateway_common/country.specific.i18n.php'; +$wgExtensionMessagesFiles['DonateInterfaceAlt'] = __DIR__ . '/gateway_common/country.specific.i18n.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/countries'; -$wgExtensionMessagesFiles['GatewayCountries'] = $donationinterface_dir . 'gateway_common/countries.i18n.php'; +$wgExtensionMessagesFiles['GatewayCountries'] = __DIR__ . '/gateway_common/countries.i18n.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/us-states'; -$wgExtensionMessagesFiles['GatewayUSStates'] = $donationinterface_dir . 'gateway_common/us-states.i18n.php'; +$wgExtensionMessagesFiles['GatewayUSStates'] = __DIR__ . '/gateway_common/us-states.i18n.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/canada-provinces'; -$wgExtensionMessagesFiles['GatewayCAProvinces'] = $donationinterface_dir . 'gateway_common/canada-provinces.i18n.php'; -$wgExtensionMessagesFiles['GatewayAliases'] = $donationinterface_dir . 'DonationInterface.alias.php'; +$wgExtensionMessagesFiles['GatewayCAProvinces'] = __DIR__ . '/gateway_common/canada-provinces.i18n.php'; +$wgExtensionMessagesFiles['GatewayAliases'] = __DIR__ . '/DonationInterface.alias.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/amazon_gateway/i18n'; -$wgExtensionMessagesFiles['AmazonGateway'] = $donationinterface_dir . 'amazon_gateway/amazon_gateway.i18n.php'; -$wgExtensionMessagesFiles['AmazonGatewayAlias'] = $donationinterface_dir . 'amazon_gateway/amazon_gateway.alias.php'; +$wgExtensionMessagesFiles['AmazonGateway'] = __DIR__ . '/amazon_gateway/amazon_gateway.i18n.php'; +$wgExtensionMessagesFiles['AmazonGatewayAlias'] = __DIR__ . '/amazon_gateway/amazon_gateway.alias.php'; //GlobalCollect gateway magical globals // @todo All the bits where we make the i18n make sense for multiple gateways. This is clearly less than ideal. $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/globalcollect_gateway/i18n'; -$wgExtensionMessagesFiles['GlobalCollectGateway'] = $donationinterface_dir . 'globalcollect_gateway/globalcollect_gateway.i18n.php'; -$wgExtensionMessagesFiles['GlobalCollectGatewayAlias'] = $donationinterface_dir . 'globalcollect_gateway/globalcollect_gateway.alias.php'; +$wgExtensionMessagesFiles['GlobalCollectGateway'] = __DIR__ . '/globalcollect_gateway/globalcollect_gateway.i18n.php'; +$wgExtensionMessagesFiles['GlobalCollectGatewayAlias'] = __DIR__ . '/globalcollect_gateway/globalcollect_gateway.alias.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/adyen_gateway/i18n'; -$wgExtensionMessagesFiles['AdyenGateway'] = $donationinterface_dir . 'adyen_gateway/adyen_gateway.i18n.php'; -$wgExtensionMessagesFiles['AdyenGatewayAlias'] = $donationinterface_dir . 'adyen_gateway/adyen_gateway.alias.php'; +$wgExtensionMessagesFiles['AdyenGateway'] = __DIR__ . '/adyen_gateway/adyen_gateway.i18n.php'; +$wgExtensionMessagesFiles['AdyenGatewayAlias'] = __DIR__ . '/adyen_gateway/adyen_gateway.alias.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/astropay_gateway/i18n'; -$wgExtensionMessagesFiles['AstropayGateway'] = $donationinterface_dir . 'astropay_gateway/astropay_gateway.i18n.php'; -$wgExtensionMessagesFiles['AstropayGatewayAlias'] = $donationinterface_dir . 'astropay_gateway/astropay_gateway.alias.php'; +$wgExtensionMessagesFiles['AstropayGateway'] = __DIR__ . '/astropay_gateway/astropay_gateway.i18n.php'; +$wgExtensionMessagesFiles['AstropayGatewayAlias'] = __DIR__ . '/astropay_gateway/astropay_gateway.alias.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/paypal_gateway/i18n'; -$wgExtensionMessagesFiles['PaypalGateway'] = $donationinterface_dir . 'paypal_gateway/paypal_gateway.i18n.php'; -$wgExtensionMessagesFiles['PaypalGatewayAlias'] = $donationinterface_dir . 'paypal_gateway/paypal_gateway.alias.php'; +$wgExtensionMessagesFiles['PaypalGateway'] = __DIR__ . '/paypal_gateway/paypal_gateway.i18n.php'; +$wgExtensionMessagesFiles['PaypalGatewayAlias'] = __DIR__ . '/paypal_gateway/paypal_gateway.alias.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/worldpay_gateway/i18n'; -$wgExtensionMessagesFiles['WorldPayGateway'] = $donationinterface_dir . 'worldpay_gateway/worldpay_gateway.i18n.php'; -$wgExtensionMessagesFiles['WorldPayGatewayAlias'] = $donationinterface_dir . 'worldpay_gateway/worldpay_gateway.alias.php'; +$wgExtensionMessagesFiles['WorldPayGateway'] = __DIR__ . '/worldpay_gateway/worldpay_gateway.i18n.php'; +$wgExtensionMessagesFiles['WorldPayGatewayAlias'] = __DIR__ . '/worldpay_gateway/worldpay_gateway.alias.php'; /** * See default values in DonationInterfaceFormSettings.php. Note that any values @@ -1071,8 +1069,8 @@ //---Stomp functions--- // TODO: Encapsulate in a class, or deprecate. -require_once( $donationinterface_dir . 'activemq_stomp/activemq_stomp.php' ); -$wgAutoloadClasses['Stomp'] = $donationinterface_dir . 'activemq_stomp/Stomp.php'; +require_once( __DIR__ . '/activemq_stomp/activemq_stomp.php' ); +$wgAutoloadClasses['Stomp'] = __DIR__ . '/activemq_stomp/Stomp.php'; function efDonationInterfaceUnitTests( &$files ) { global $wgAutoloadClasses; diff --git a/donationinterface_langonly.php b/donationinterface_langonly.php index 0fb01dc..941ef6b 100644 --- a/donationinterface_langonly.php +++ b/donationinterface_langonly.php @@ -28,19 +28,17 @@ 'url' => 'https://www.mediawiki.org/wiki/Extension:DonationInterface', ); -$donationinterface_dir = dirname( __FILE__ ) . '/'; - // Load the interface messages that are shared across all gateways $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/interface'; -$wgExtensionMessagesFiles['DonateInterface'] = $donationinterface_dir . 'gateway_common/interface.i18n.php'; +$wgExtensionMessagesFiles['DonateInterface'] = __DIR__ . '/gateway_common/interface.i18n.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/countries'; -$wgExtensionMessagesFiles['GatewayCountries'] = $donationinterface_dir . 'gateway_common/countries.i18n.php'; +$wgExtensionMessagesFiles['GatewayCountries'] = __DIR__ . '/gateway_common/countries.i18n.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/us-states'; -$wgExtensionMessagesFiles['GatewayUSStates'] = $donationinterface_dir . 'gateway_common/us-states.i18n.php'; +$wgExtensionMessagesFiles['GatewayUSStates'] = __DIR__ . '/gateway_common/us-states.i18n.php'; $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/gateway_common/i18n/canada-provinces'; -$wgExtensionMessagesFiles['GatewayCAProvinces'] = $donationinterface_dir . 'gateway_common/canada-provinces.i18n.php'; +$wgExtensionMessagesFiles['GatewayCAProvinces'] = __DIR__ . '/gateway_common/canada-provinces.i18n.php'; // GlobalCollect-specific messaging $wgMessagesDirs['DonationInterface'][] = __DIR__ . '/globalcollect_gateway/i18n'; -$wgExtensionMessagesFiles['GlobalCollectGateway'] = $donationinterface_dir . 'globalcollect_gateway/globalcollect_gateway.i18n.php'; -$wgExtensionMessagesFiles['GlobalCollectGatewayAlias'] = $donationinterface_dir . 'globalcollect_gateway/globalcollect_gateway.alias.php'; +$wgExtensionMessagesFiles['GlobalCollectGateway'] = __DIR__ . '/globalcollect_gateway/globalcollect_gateway.i18n.php'; +$wgExtensionMessagesFiles['GlobalCollectGatewayAlias'] = __DIR__ . '/globalcollect_gateway/globalcollect_gateway.alias.php'; diff --git a/gateway_forms/rapidhtml/RapidHtmlResources.php b/gateway_forms/rapidhtml/RapidHtmlResources.php index ac23c54..2dbaa93 100644 --- a/gateway_forms/rapidhtml/RapidHtmlResources.php +++ b/gateway_forms/rapidhtml/RapidHtmlResources.php @@ -19,20 +19,20 @@ ), 'scripts' => '', 'dependencies' => 'jquery.ui.accordion', - 'localBasePath' => dirname( __FILE__ ), + 'localBasePath' => __DIR__, 'remoteExtPath' => $wgDonationInterfaceRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'di.form.rapidhtml.webitects.ie6' ] = array( 'styles' => 'css/webitects.ie6.css', 'scripts' => '', 'dependencies' => 'di.form.rapidhtml.webitects', - 'localBasePath' => dirname( __FILE__ ), + 'localBasePath' => __DIR__, 'remoteExtPath' => $wgDonationInterfaceRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'di.form.rapidhtml.webitects.2nd' ] = array( 'styles' => 'css/webitects2nd.css', 'dependencies' => 'di.form.rapidhtml.webitects', - 'localBasePath' => dirname( __FILE__ ), + 'localBasePath' => __DIR__, 'remoteExtPath' => $wgDonationInterfaceRapidHtmlRemoteExtPath, ); @@ -45,7 +45,7 @@ #'js/webitects.accordian.js', ), 'dependencies' => 'di.form.rapidhtml.webitects', - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.form.rapidhtml.webitects.ie6' ] = array( @@ -53,7 +53,7 @@ 'di.form.rapidhtml.webitects.ie6', 'gc.form.rapidhtml.webitects' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.form.rapidhtml.webitects.1st' ] = array( @@ -62,7 +62,7 @@ 'dependencies' => array( 'gc.form.rapidhtml.webitects', ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.form.rapidhtml.webitects.2nd' ] = array( @@ -72,7 +72,7 @@ 'gc.form.rapidhtml.webitects', 'di.form.rapidhtml.webitects.2nd' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.form.rapidhtml.webitects.2nd.US' ] = array( @@ -82,7 +82,7 @@ 'gc.form.rapidhtml.webitects', 'di.form.rapidhtml.webitects.2nd' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.form.rapidhtml.webitects.bt' ] = array( @@ -92,14 +92,14 @@ 'gc.form.rapidhtml.webitects.2nd', #'gc.form.core.validate' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.form.rapidhtml.webitects.dd' ] = array( 'styles' => '', 'scripts' => 'js/webitects.bt.js', 'dependencies' => 'gc.form.rapidhtml.webitects.2nd', - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); @@ -107,7 +107,7 @@ 'scripts' => array( 'js/gc.interface.js' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath ); @@ -121,7 +121,7 @@ 'globalcollect_gateway-fakesucceed', 'globalcollect_gateway-fakefail' ), - 'localBasePath' => dirname( __FILE__ ) . '/../../tests', + 'localBasePath' => __DIR__ . '/../../tests', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath ) + $wgResourceTemplate; @@ -135,7 +135,7 @@ 'di.form.core.validate', 'mediawiki.Uri' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath ); @@ -151,7 +151,7 @@ 'js/gc.dd.js' ), 'dependencies' => array( 'di.form.core.validate' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.form.rapidhtml.ew' ] = array( @@ -160,7 +160,7 @@ 'js/gc.ew.js' ), 'dependencies' => array( 'di.form.core.validate' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.form.rapidhtml.boletos' ] = array( @@ -169,7 +169,7 @@ 'js/gc.boletos.js' ), 'dependencies' => array( 'di.form.core.validate' ), - 'localBasePath' => dirname( __FILE__ ).'/../../globalcollect_gateway/forms', + 'localBasePath' => __DIR__ . '/../../globalcollect_gateway/forms', 'remoteExtPath' => $wgGlobalCollectRapidHtmlRemoteExtPath, ); $wgResourceModules[ 'gc.iframe' ] = array( @@ -185,13 +185,13 @@ $wgResourceModules[ 'adyen.js' ] = array( 'styles' => 'css/adyen.css', 'scripts' => 'js/adyen.js', - 'localBasePath' => dirname( __FILE__ ).'/../../adyen_gateway/forms', + 'localBasePath' => __DIR__ . '/../../adyen_gateway/forms', 'remoteExtPath' => $wgAdyenRapidHtmlRemoteExtPath, ); $wgResourceModules['ext.donationinterface.worldpay.styles'] = array ( 'styles' => array('css/worldpay.css', 'css/bootstrap.css'), - 'localBasePath' => dirname( __FILE__ ).'/../../worldpay_gateway/forms', + 'localBasePath' => __DIR__ . '/../../worldpay_gateway/forms', 'remoteExtPath' => $wgWorldPayRapidHtmlRemoteExtPath, 'position' => 'top', ); @@ -199,7 +199,7 @@ $wgResourceModules['ext.donationinterface.worldpay.code'] = array ( 'scripts' => 'js/worldpay.js', 'dependencies' => array ( 'di.form.core.validate', 'jquery.payment' ), - 'localBasePath' => dirname( __FILE__ ).'/../../worldpay_gateway/forms', + 'localBasePath' => __DIR__ . '/../../worldpay_gateway/forms', 'remoteExtPath' => $wgWorldPayRapidHtmlRemoteExtPath, ); diff --git a/globalcollect_gateway/scripts/orphans.php b/globalcollect_gateway/scripts/orphans.php index d1e5148..b981304 100644 --- a/globalcollect_gateway/scripts/orphans.php +++ b/globalcollect_gateway/scripts/orphans.php @@ -394,10 +394,10 @@ function getAllLogFileNames(){ $files = array(); - if ($handle = opendir(dirname(__FILE__) . '/orphanlogs/')){ + if ($handle = opendir(__DIR__ . '/orphanlogs/')){ while ( ($file = readdir($handle)) !== false ){ if (trim($file, '.') != '' && $file != 'order_ids.txt' && $file != '.svn'){ - $files[] = dirname(__FILE__) . '/orphanlogs/' . $file; + $files[] = __DIR__ . '/orphanlogs/' . $file; } } } diff --git a/tests/includes/test_gateway/TestingAdyenAdapter.php b/tests/includes/test_gateway/TestingAdyenAdapter.php index e2f008a..9896af4 100644 --- a/tests/includes/test_gateway/TestingAdyenAdapter.php +++ b/tests/includes/test_gateway/TestingAdyenAdapter.php @@ -49,8 +49,8 @@ //could start stashing these in a further-down subdir if payment type starts getting in the way, //but frankly I don't want to write tests that test our dummy responses. - $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; - $file_path .= 'Responses' . DIRECTORY_SEPARATOR . self::getIdentifier() . DIRECTORY_SEPARATOR; + $file_path = __DIR__ . '/../'; + $file_path .= 'Responses' . '/' . self::getIdentifier() . '/'; $file_path .= $this->getCurrentTransaction() . $code . '.testresponse'; //these are all going to be short, so... diff --git a/tests/includes/test_gateway/TestingAmazonAdapter.php b/tests/includes/test_gateway/TestingAmazonAdapter.php index 15cf618..5d090c8 100644 --- a/tests/includes/test_gateway/TestingAmazonAdapter.php +++ b/tests/includes/test_gateway/TestingAmazonAdapter.php @@ -42,8 +42,8 @@ //could start stashing these in a further-down subdir if payment type starts getting in the way, //but frankly I don't want to write tests that test our dummy responses. - $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; - $file_path .= 'Responses' . DIRECTORY_SEPARATOR . self::getIdentifier() . DIRECTORY_SEPARATOR; + $file_path = __DIR__ . '/../'; + $file_path .= 'Responses' . '/' . self::getIdentifier() . '/'; $file_path .= $this->getCurrentTransaction() . $code . '.testresponse'; //these are all going to be short, so... diff --git a/tests/includes/test_gateway/TestingAstropayAdapter.php b/tests/includes/test_gateway/TestingAstropayAdapter.php index 6b4ef2e..48d11ba 100644 --- a/tests/includes/test_gateway/TestingAstropayAdapter.php +++ b/tests/includes/test_gateway/TestingAstropayAdapter.php @@ -51,7 +51,7 @@ //could start stashing these in a further-down subdir if payment type starts getting in the way, //but frankly I don't want to write tests that test our dummy responses. - $file_path = dirname( __FILE__ ) + $file_path = __DIR__ . '/../Responses/' . self::getIdentifier() . '/' diff --git a/tests/includes/test_gateway/TestingGlobalCollectAdapter.php b/tests/includes/test_gateway/TestingGlobalCollectAdapter.php index 30b3895..e07f4a5 100644 --- a/tests/includes/test_gateway/TestingGlobalCollectAdapter.php +++ b/tests/includes/test_gateway/TestingGlobalCollectAdapter.php @@ -140,8 +140,8 @@ //could start stashing these in a further-down subdir if payment type starts getting in the way, //but frankly I don't want to write tests that test our dummy responses. - $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; - $file_path .= 'Responses' . DIRECTORY_SEPARATOR . self::getIdentifier() . DIRECTORY_SEPARATOR; + $file_path = __DIR__ . '/../'; + $file_path .= 'Responses' . '/' . self::getIdentifier() . '/'; $file_path .= $this->getCurrentTransaction() . $code . '.testresponse'; //these are all going to be short, so... diff --git a/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php b/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php index b8c6867..4d0d592 100644 --- a/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php +++ b/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php @@ -122,8 +122,8 @@ //could start stashing these in a further-down subdir if payment type starts getting in the way, //but frankly I don't want to write tests that test our dummy responses. - $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; - $file_path .= 'Responses' . DIRECTORY_SEPARATOR . self::getIdentifier() . DIRECTORY_SEPARATOR; + $file_path = __DIR__ . '/../'; + $file_path .= 'Responses' . '/' . self::getIdentifier() . '/'; $file_path .= $this->getCurrentTransaction() . $code . '.testresponse'; //these are all going to be short, so... diff --git a/tests/includes/test_gateway/TestingPaypalAdapter.php b/tests/includes/test_gateway/TestingPaypalAdapter.php index 29e40dd..f4bfa2c 100644 --- a/tests/includes/test_gateway/TestingPaypalAdapter.php +++ b/tests/includes/test_gateway/TestingPaypalAdapter.php @@ -32,8 +32,8 @@ //could start stashing these in a further-down subdir if payment type starts getting in the way, //but frankly I don't want to write tests that test our dummy responses. - $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; - $file_path .= 'Responses' . DIRECTORY_SEPARATOR . self::getIdentifier() . DIRECTORY_SEPARATOR; + $file_path = __DIR__ . '/../'; + $file_path .= 'Responses' . '/' . self::getIdentifier() . '/'; $file_path .= $this->getCurrentTransaction() . $code . '.testresponse'; //these are all going to be short, so... diff --git a/tests/includes/test_gateway/TestingWorldPayAdapter.php b/tests/includes/test_gateway/TestingWorldPayAdapter.php index e670f57..1776df8 100644 --- a/tests/includes/test_gateway/TestingWorldPayAdapter.php +++ b/tests/includes/test_gateway/TestingWorldPayAdapter.php @@ -52,8 +52,8 @@ //could start stashing these in a further-down subdir if payment type starts getting in the way, //but frankly I don't want to write tests that test our dummy responses. - $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; - $file_path .= 'Responses' . DIRECTORY_SEPARATOR . self::getIdentifier() . DIRECTORY_SEPARATOR; + $file_path = __DIR__ . '/../'; + $file_path .= 'Responses' . '/' . self::getIdentifier() . '/'; $file_path .= $this->getCurrentTransaction() . $code . '.testresponse'; //these are all going to be short, so... -- To view, visit https://gerrit.wikimedia.org/r/209778 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I87768f062340495b137d7cb9ec3e52be9ed2455f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: master Gerrit-Owner: Awight <awi...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits