r75840 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75839‎ | r75840 | r75841 >
Date:23:06, 1 November 2010
Author:awjrichards
Status:deferred
Tags:
Comment:
Merging from r75664 through r75839 of trunk
Modified paths:
  • /branches/fundraising/deployment/DonationInterface (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/GeoIP/GeoIP.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/GeoIP/RebuildGeoIP.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Exception.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Frame.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message/Bytes.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message/Map.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/activemq_stomp/activemq_stomp.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface.i18n.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface_validate_donation.js (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/api_payflowpro_gateway.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/custom_filters.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/custom_filters.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/minfraud/minfraud.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/minfraud/minfraud.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/referrer/referrer.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/referrer/referrer.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/source/source.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/source/source.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/extras.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/extras.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/CreditCardFraudDetection.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/HTTPBase.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/LocationVerification.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/TelephoneVerification.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/tests/minfraudTest.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha-php/recaptchalib.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/Form.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/OneStepTwoColumn.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/SingleColumn.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter2.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnPayPal.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/owa_get_info.js (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.us-states.i18n.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/payflowpro_gateway/validate_input.js (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/paypal_gateway/paypal_gateway.i18n.php (modified) (history)
  • /branches/fundraising/deployment/DonationInterface/paypal_gateway/paypal_gateway.php (modified) (history)

Diff [purge]

Index: branches/fundraising/deployment/DonationInterface/GeoIP/RebuildGeoIP.php
@@ -19,7 +19,7 @@
2020 * @ingroup Maintenance
2121 */
2222
23 -require_once( dirname(__FILE__) . '/../../maintenance/Maintenance.php' );
 23+require_once( dirname( __FILE__ ) . '/../../maintenance/Maintenance.php' );
2424
2525 class RebuildGeoIP extends Maintenance {
2626 public function __construct() {
@@ -51,9 +51,9 @@
5252 $handle = fopen( $filename, 'r' );
5353
5454 $count = 0;
55 - while( ( $data = fgetcsv( $handle, 256, ',' ) ) !== false ) {
 55+ while ( ( $data = fgetcsv( $handle, 256, ',' ) ) !== false ) {
5656 // Output a nice progress bar.
57 - if( $count % 1000 == 0 ) {
 57+ if ( $count % 1000 == 0 ) {
5858 $progress = ceil( ( $count / $lines ) * 50 );
5959 $this->output( '[' . str_repeat( '=', $progress ) .
6060 str_repeat( ' ', 50 - $progress ) . '] ' .
@@ -69,10 +69,10 @@
7070 );
7171 $dbw->insert( 'geoip', $record, __METHOD__ );
7272 }
73 - $this->output( "\n" );
 73+ $this->output( "\n" );
7474
7575 $dbw->commit();
76 - $this->output( 'Successfully loaded ' . $count . ' geographic IP ranges.' . "\n" );
 76+ $this->output( 'Successfully loaded ' . $count . ' geographic IP ranges.' . "\n" );
7777 }
7878 }
7979
Index: branches/fundraising/deployment/DonationInterface/GeoIP/GeoIP.php
@@ -21,9 +21,9 @@
2222 * @author David Strauss <david@fourkitchens.com>
2323 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
2424 */
25 -
 25+
2626 // Alert the user that this is not a valid entry point to MediaWiki if they try to access this file directly.
27 -if ( !defined ('MEDIAWIKI' ) ) {
 27+if ( !defined ( 'MEDIAWIKI' ) ) {
2828 echo <<<EOT
2929 To install GeoIP extension, put the following line in LocalSettings.php:
3030 require_once( "\$IP/extensions/GeoIP/GeoIP.php" );
@@ -56,20 +56,18 @@
5757 class NotFoundGeoIP extends Exception { }
5858
5959 function fnGetGeoIP( $ip_address = null ) {
60 - if( !isset( $ip_address ) ) {
 60+ if ( !isset( $ip_address ) ) {
6161 $ip_address = IP::sanitizeIP( wfGetIP() );
6262 }
6363
64 - if( isset( $_GET['ip'] ) ) {
 64+ if ( isset( $_GET['ip'] ) ) {
6565 $ip_address = IP::sanitizeIP( $_GET['ip'] );
6666 }
6767
68 - if( !IP::isIPv4( $ip_address ) ) {
 68+ if ( !IP::isIPv4( $ip_address ) ) {
6969 throw new UnsupportedGeoIP( 'Only IPv4 addresses are supported.' );
7070 }
7171
72 - $country_code = null;
73 -
7472 $dbr = wfGetDB( DB_SLAVE );
7573 $long_ip = IP::toUnsigned( $ip_address );
7674 $conditions = array(
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/api_payflowpro_gateway.php
@@ -1,43 +1,43 @@
2 -<?php
 2+<?php
33 /**
44 * PayflowPro Gateway API extension
55 */
6 -
 6+
77 class ApiPayflowProGateway extends ApiBase {
8 -
 8+
99 /**
1010 * An array of valid dispatch methods
1111 */
1212 public $validDispatchMethods = array( 'dispatch_get_required_dynamic_form_elements' );
13 -
 13+
1414 /**
1515 * API for PayflowProGateway extension
16 - *
 16+ *
1717 * Parameters:
1818 * dispatch: A string that maps to an API method. Dispatchable API methods follow the naming convention
1919 * dispatch_<requested dispatch method>
2020 */
2121 public function execute() {
2222 // this is likely not defined because User.php hasn't been loaded, but we need it, so we define it.
23 - if ( !defined( 'EDIT_TOKEN_SUFFIX' )) define( 'EDIT_TOKEN_SUFFIX', '+\\' );
24 -
 23+ if ( !defined( 'EDIT_TOKEN_SUFFIX' ) ) define( 'EDIT_TOKEN_SUFFIX', '+\\' );
 24+
2525 // extract and validate the parameters
26 - $params = $this->extractRequestParams();
 26+ $params = $this->extractRequestParams();
2727 $this->validateParams( $params );
28 -
 28+
2929 // route 'dispatch' requests to the appropriate method
30 - if ( strlen($params[ 'dispatch' ] )) {
31 - $method = $this->getDispatchMethod( $params[ 'dispatch' ]);
 30+ if ( strlen( $params[ 'dispatch' ] ) ) {
 31+ $method = $this->getDispatchMethod( $params[ 'dispatch' ] );
3232 $this->$method( $params );
3333 }
3434 }
35 -
 35+
3636 public function getDescription() {
3737 return array(
3838 'Exposes API interaction with the PayflowPro Gateway extension.',
3939 );
4040 }
41 -
 41+
4242 public function getAllowedParams() {
4343 return array(
4444 'dispatch' => array(
@@ -48,12 +48,12 @@
4949 ),
5050 );
5151 }
52 -
 52+
5353 public function getParamDescription() {
5454 return array(
5555 'dispatch' => 'the API method from which to return data',
5656 'tracking_data' => 'A JSON formatted string of data to insert into contribution_tracking',
57 - );
 57+ );
5858 }
5959
6060 /**
@@ -61,47 +61,47 @@
6262 * @params array Parameters extracted from $_POST
6363 */
6464 public function validateParams( $params ) {
65 -
 65+
6666 /**
6767 * If 'dispatch' is specified in the params, make sure the requested dispatch method exists
68 - *
 68+ *
6969 * A 'dispatch' method is a string that maps to an API method whose name is dispatch_<requested dispatch method>
7070 * so we need to make sure that method actually exists. If not, die with an error.
7171 */
72 - if ( isset( $params[ 'dispatch' ] ) && strlen( $params[ 'dispatch' ] )) {
 72+ if ( isset( $params[ 'dispatch' ] ) && strlen( $params[ 'dispatch' ] ) ) {
7373 $method = $this->getDispatchMethod( $params[ 'dispatch' ] );
74 - if ( !in_array( $method, $this->validDispatchMethods ) || !method_exists( $this, $method )) {
 74+ if ( !in_array( $method, $this->validDispatchMethods ) || !method_exists( $this, $method ) ) {
7575 $this->dieUsage( "Invalid dispatch method <<<$method>>> passed to the PayflowPro Gatweay API.", 'unknown_method' );
7676 }
77 -
 77+
7878 // make sure we have tracking data for get_required_dynamic_form_elements
7979 if ( strtolower( $params[ 'dispatch' ] ) == 'get_required_dynamic_form_elements' ) {
80 - if ( !isset( $params[ 'tracking_data' ] )) {
81 - $this->dieUsage( "Dispatch method get_required_dynamic_form_elements requires 'tracking_data' parameter.", 'required_param' );
 80+ if ( !isset( $params[ 'tracking_data' ] ) ) {
 81+ $this->dieUsage( "Dispatch method get_required_dynamic_form_elements requires 'tracking_data' parameter.", 'required_param' );
8282 }
8383 }
8484 }
85 -
 85+
8686 // Validate tracking data
87 - if ( isset( $params[ 'tracking_data' ] )) {
 87+ if ( isset( $params[ 'tracking_data' ] ) ) {
8888 // Make sure tracking data is well formatted JSON
8989 $tracking_data = json_decode( $params[ 'tracking_data' ], true );
90 -
91 - if ( !count( $tracking_data )) {
92 - $this->dieUsage( "Invalid JSON encoded tracking data", 'invalid_tracking');
 90+
 91+ if ( !count( $tracking_data ) ) {
 92+ $this->dieUsage( "Invalid JSON encoded tracking data", 'invalid_tracking' );
9393 }
94 -
 94+
9595 // Make sure that url and pageref tracking bits are set
96 - if ( !isset( $tracking_data[ 'pageref' ] ) || !isset( $tracking_data[ 'url' ] )) {
 96+ if ( !isset( $tracking_data[ 'pageref' ] ) || !isset( $tracking_data[ 'url' ] ) ) {
9797 $this->dieUsage( "Tracking data requires 'pageref' and 'url' tracking bits.", 'invalid_tracking' );
9898 }
9999 }
100100 }
101 -
 101+
102102 public function getVersion() {
103 - return __CLASS__ . ': $Id$';
 103+ return __CLASS__ . ': $Id$';
104104 }
105 -
 105+
106106 /**
107107 * Construct the method name for a requested 'dispatch'
108108 * @param string The method to dispatch requested in the API call
@@ -110,10 +110,10 @@
111111 private function getDispatchMethod( $method ) {
112112 return 'dispatch_' . strtolower( $method );
113113 }
114 -
 114+
115115 /**
116116 * Get the required dynamic form elements
117 - *
 117+ *
118118 * The first time a PayflowProGateway credit card form is loaded, there are
119119 * some dynamic elements that also need to be loaded, primarily for CSRF
120120 * prevention and tracking data. This will fetch the values for those
@@ -121,30 +121,30 @@
122122 */
123123 protected function dispatch_get_required_dynamic_form_elements( $params ) {
124124 global $wgPayflowGatewaySalt;
125 -
 125+
126126 // fetch the order_id
127127 require_once( 'includes/payflowUser.inc' );
128128 $payflow_data = payflowUser();
129129 $order_id = $payflow_data[ 'order_id' ];
130 -
 130+
131131 // fetch the CSRF prevention token and set it if it's not already set
132132 $token = PayflowProGateway::fnPayflowEditToken( $wgPayflowGatewaySalt );
133133
134134 /**
135135 * retrieve and unpack the json encoded string of tracking data
136 - *
 136+ *
137137 * it should include two bits:
138138 * url => the full url-encoded user-requested URL
139139 * pageref => the url-encoded referrer to the full user-requested URL
140 - */
141 - $tracking_data = $this->parseTrackingData( json_decode( $params[ 'tracking_data' ], true ));
142 -
 140+ */
 141+ $tracking_data = $this->parseTrackingData( json_decode( $params[ 'tracking_data' ], true ) );
 142+
143143 // clean up tracking data to make sure everything is set correctly
144144 $tracking_data = PayflowProGateway::cleanTrackingData( $tracking_data, true );
145145
146146 // fetch the contribution_tracking_id by inserting tracking data to contrib tracking table
147147 $contribution_tracking_id = PayflowProGateway::insertContributionTracking( $tracking_data );
148 -
 148+
149149 // this try/catch design pattern stolen from ClickTracking/ApiSpecialClickTracking.php
150150 try {
151151 // add dynamic elements to result object
@@ -156,28 +156,28 @@
157157 /* no result */
158158 }
159159 }
160 -
 160+
161161 /**
162162 * Parse tracking_data param into something meaningful to PayflowPro gateway
163 - *
 163+ *
164164 * @param array $tracking_data An array of tracking data - expects 'referrer' and 'url'
165165 * @return array of cleaned up, PayflowPro Gateway-consumable tracking data
166166 */
167167 protected function parseTrackingData( $unparsed_tracking_data ) {
168168 // get the query string from the URL and turn it into an associative array
169 - $url_bits = wfParseUrl( urldecode( $unparsed_tracking_data[ 'url' ] ));
 169+ $url_bits = wfParseUrl( urldecode( $unparsed_tracking_data[ 'url' ] ) );
170170 $tracking_data = wfCgiToArray( $url_bits[ 'query' ] );
171 -
 171+
172172 // add the referrer to the tracked_data array
173173 $tracking_data[ 'referrer' ] = urldecode( $unparsed_tracking_data[ 'pageref' ] );
174 -
 174+
175175 // ensure the utm_source is formatted correctly
176 - $utm_source_str = ( isset( $tracking_data[ 'utm_source' ] )) ? $tracking_data[ 'utm_source' ] : null;
177 - $utm_source_id = ( isset( $tracking_data[ 'utm_source_id' ] )) ? $tracking_data[ 'utm_source_id' ] : null;
 176+ $utm_source_str = ( isset( $tracking_data[ 'utm_source' ] ) ) ? $tracking_data[ 'utm_source' ] : null;
 177+ $utm_source_id = ( isset( $tracking_data[ 'utm_source_id' ] ) ) ? $tracking_data[ 'utm_source_id' ] : null;
178178 $tracking_data[ 'utm_source' ] = PayflowProGateway::getUtmSource( $utm_source_str, $utm_source_id );
179 -
 179+
180180 return $tracking_data;
181181 }
182 -
183 - public function isReadMode(){ return false;}
 182+
 183+ public function isReadMode() { return false; }
184184 }
\ No newline at end of file
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/validate_input.js
@@ -1,14 +1,14 @@
22 //<![CDATA[
3 -function addEvent(obj, evType, fn){
4 - if (obj.addEventListener){
5 - obj.addEventListener(evType, fn, false);
6 - return true;
7 - } else if (obj.attachEvent){
8 - var r = obj.attachEvent("on"+evType, fn);
9 - return r;
10 - } else {
11 - return false;
12 - }
 3+function addEvent(obj, evType, fn){
 4+ if (obj.addEventListener){
 5+ obj.addEventListener(evType, fn, false);
 6+ return true;
 7+ } else if (obj.attachEvent){
 8+ var r = obj.attachEvent("on"+evType, fn);
 9+ return r;
 10+ } else {
 11+ return false;
 12+ }
1313 }
1414
1515 function getIfSessionSet() {
@@ -37,7 +37,7 @@
3838 output += payflowproGatewayErrorMsgJs + ' ' + currField + '.\r\n';
3939 }
4040 }
41 -
 41+
4242 //set state to "outside us"
4343 if ( document.payment.country.value != '840' ) {
4444 document.payment.state.value = 'XX';
@@ -55,8 +55,8 @@
5656 if( output ) {
5757 alert( output );
5858 return false;
59 - }
60 -
 59+ }
 60+
6161 return true;
6262 }
6363
@@ -83,7 +83,7 @@
8484
8585 function PopupCVV() {
8686 cvv = window.open("", 'cvvhelp','scrollbars=yes,resizable=yes,width=600,height=400,left=200,top=100');
87 - cvv.document.write( payflowproGatewayCVVExplain );
 87+ cvv.document.write( payflowproGatewayCVVExplain );
8888 cvv.focus();
8989 }
9090
@@ -94,5 +94,5 @@
9595 }
9696 }
9797
98 -window.onfocus = CloseCVV;
 98+window.onfocus = CloseCVV;
9999 //]]>
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -1,11 +1,11 @@
22 <?php
33
44 class PayflowProGateway extends UnlistedSpecialPage {
5 -
 5+
66 /**
77 * Defines the action to take on a PFP transaction.
88 *
9 - * Possible values include 'process', 'challenge',
 9+ * Possible values include 'process', 'challenge',
1010 * 'review', 'reject'. These values can be set during
1111 * data processing validation, for instance.
1212 *
@@ -29,7 +29,7 @@
3030 * @var object
3131 */
3232 public $form_class;
33 -
 33+
3434 /**
3535 * An array of form errors
3636 * @var array
@@ -41,8 +41,6 @@
4242 */
4343 public function __construct() {
4444 parent::__construct( 'PayflowProGateway' );
45 - wfLoadExtensionMessages( 'PayflowProGateway' );
46 -
4745 $this->errors = $this->getPossibleErrors();
4846 }
4947
@@ -52,14 +50,14 @@
5351 * @param $par Mixed: parameter passed to the page or null
5452 */
5553 public function execute( $par ) {
56 - global $wgRequest, $wgOut, $wgUser, $wgScriptPath,
57 - $wgPayFlowProGatewayCSSVersion, $wgPayflowGatewayPaypalURL,
 54+ global $wgRequest, $wgOut, $wgScriptPath,
 55+ $wgPayFlowProGatewayCSSVersion,
5856 $wgPayflowGatewaySalt;
59 -
60 - $wgOut->addExtensionStyle(
61 - "{$wgScriptPath}/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css?284" .
62 - $wgPayFlowProGatewayCSSVersion);
63 -
 57+
 58+ $wgOut->addExtensionStyle(
 59+ "{$wgScriptPath}/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.css?284" .
 60+ $wgPayFlowProGatewayCSSVersion );
 61+
6462 $scriptVars = array(
6563 'payflowproGatewayErrorMsgJs' => wfMsg( 'payflowpro_gateway-error-msg-js' ),
6664 'payflowproGatewayErrorMsgEmail' => wfMsg( 'payflowpro_gateway-error-msg-email' ),
@@ -76,9 +74,9 @@
7775 'payflowproGatewayErrorMsgCvv' => wfMsg( 'payflowpro_gateway-error-msg-cvv' ),
7876 'payflowproGatewayCVVExplain' => wfMsg( 'payflowpro_gateway-cvv-explain' ),
7977 );
80 -
 78+
8179 $wgOut->addScript( Skin::makeVariablesScript( $scriptVars ) );
82 -
 80+
8381 // @fixme can this be moved into the form generators?
8482 $js = <<<EOT
8583 <script type="text/javascript">
@@ -88,40 +86,40 @@
8987 </script>
9088 EOT;
9189 $wgOut->addHeadItem( 'logolinkoverride', $js );
92 -
 90+
9391 // find out if amount was a radio button or textbox, set amount
94 - if( isset( $_REQUEST['amount'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount' ) ) ) {
 92+ if ( isset( $_REQUEST['amount'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount' ) ) ) {
9593 $amount = $wgRequest->getText( 'amount' );
96 - } elseif( isset( $_REQUEST['amountGiven'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amountGiven' ) ) ) {
 94+ } elseif ( isset( $_REQUEST['amountGiven'] ) && preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amountGiven' ) ) ) {
9795 $amount = number_format( $wgRequest->getText( 'amountGiven' ), 2, '.', '' );
98 - } elseif( isset( $_REQUEST['amount'] ) ) {
 96+ } elseif ( isset( $_REQUEST['amount'] ) ) {
9997 $amount = '0.00';
100 - } elseif( $wgRequest->getText( 'amount' ) == '-1' ) {
 98+ } elseif ( $wgRequest->getText( 'amount' ) == '-1' ) {
10199 $amount = $wgRequest->getText( 'amountOther' );
102100 } else {
103101 $amount = '0.00';
104102 }
105 -
 103+
106104 // track the number of attempts the user has made
107105 $numAttempt = $wgRequest->getVal( 'numAttempt', 0 );
108106
109 - // Get array of default account values necessary for Payflow
 107+ // Get array of default account values necessary for Payflow
110108 require_once( 'includes/payflowUser.inc' );
111109
112110 $payflow_data = payflowUser();
113 -
 111+
114112 // if _cache_ is requested by the user, do not set a session/token; dynamic data will be loaded via ajax
115113 if ( $wgRequest->getText( '_cache_', false ) ) {
116114 $cache = true;
117115 $token = '';
118116 $token_match = false;
119 -
 117+
120118 // if we have squid caching enabled, set the maxage
121119 global $wgUseSquid, $wgPayflowSMaxAge;
122120 if ( $wgUseSquid ) $wgOut->setSquidMaxage( $wgPayflowSMaxAge );
123121 } else {
124122 $cache = false;
125 -
 123+
126124 // establish the edit token to prevent csrf
127125 $token = self::fnPayflowEditToken( $wgPayflowGatewaySalt );
128126
@@ -129,54 +127,54 @@
130128 $token_check = ( $wgRequest->getText( 'token' ) ) ? $wgRequest->getText( 'token' ) : $token;
131129 $token_match = $this->fnPayflowMatchEditToken( $token_check, $wgPayflowGatewaySalt );
132130 }
133 -
 131+
134132 $this->setHeaders();
135 -
 133+
136134 // Populate form data
137135 $data = $this->fnGetFormData( $amount, $numAttempt, $token, $payflow_data['order_id'] );
138 -
 136+
139137 /**
140 - * handle PayPal redirection
141 - *
 138+ * handle PayPal redirection
 139+ *
142140 * if paypal redirection is enabled ($wgPayflowGatewayPaypalURL must be defined)
143141 * and the PaypalRedirect form value must be true
144142 */
145 - if ( $wgRequest->getBool( 'PaypalRedirect' )) {
 143+ if ( $wgRequest->getBool( 'PaypalRedirect' ) ) {
146144 $this->paypalRedirect( $data );
147145 return;
148146 }
149 -
 147+
150148 // dispatch forms/handling
151 - if( $token_match ) {
152 -
153 - if( $data['payment_method'] == 'processed' ) {
154 - //increase the count of attempts
 149+ if ( $token_match ) {
 150+
 151+ if ( $data['payment_method'] == 'processed' ) {
 152+ // increase the count of attempts
155153 ++$data['numAttempt'];
156 -
 154+
157155 // Check form for errors and redisplay with messages
158156 $form_errors = $this->fnPayflowValidateForm( $data, $this->errors );
159 - if( $form_errors ) {
 157+ if ( $form_errors ) {
160158 $this->fnPayflowDisplayForm( $data, $this->errors );
161159 } else { // The submitted form data is valid, so process it
162 - // allow any external validators to have their way with the data
163 - wfRunHooks( 'PayflowGatewayValidate', array( &$this, &$data ));
 160+ // allow any external validators to have their way with the data
 161+ wfRunHooks( 'PayflowGatewayValidate', array( &$this, &$data ) );
164162
165163 // if the transaction was flagged for review
166164 if ( $this->action == 'review' ) {
167165 // expose a hook for external handling of trxns flagged for review
168 - wfRunHooks( 'PayflowGatewayReview', array( &$this, &$data ));
 166+ wfRunHooks( 'PayflowGatewayReview', array( &$this, &$data ) );
169167 }
170168
171169 // if the transaction was flagged to be 'challenged'
172170 if ( $this->action == 'challenge' ) {
173171 // expose a hook for external handling of trxns flagged for challenge (eg captcha)
174 - wfRunHooks( 'PayflowGatewayChallenge', array( &$this, &$data ));
 172+ wfRunHooks( 'PayflowGatewayChallenge', array( &$this, &$data ) );
175173 }
176174
177175 // if the transaction was flagged for rejection
178176 if ( $this->action == 'reject' ) {
179177 // expose a hook for external handling of trxns flagged for rejection
180 - wfRunHooks( 'PayflowGatewayReject', array( &$this, &$data ));
 178+ wfRunHooks( 'PayflowGatewayReject', array( &$this, &$data ) );
181179
182180 $this->fnPayflowDisplayDeclinedResults( '' );
183181 $this->fnPayflowUnsetEditToken();
@@ -185,18 +183,18 @@
186184 // if the transaction was flagged for processing
187185 if ( $this->action == 'process' ) {
188186 // expose a hook for external handling of trxns ready for processing
189 - wfRunHooks( 'PayflowGatewayProcess', array( &$this, &$data ));
 187+ wfRunHooks( 'PayflowGatewayProcess', array( &$this, &$data ) );
190188 $this->fnPayflowProcessTransaction( $data, $payflow_data );
191189 }
192190
193191 // expose a hook for any post processing
194 - wfRunHooks( 'PayflowGatewayPostProcess', array( &$this, &$data ));
 192+ wfRunHooks( 'PayflowGatewayPostProcess', array( &$this, &$data ) );
195193 }
196194 } else {
197 - //Display form for the first time
 195+ // Display form for the first time
198196 $this->fnPayflowDisplayForm( $data, $this->errors );
199197 }
200 - } else {
 198+ } else {
201199 if ( !$cache ) {
202200 // if we're not caching, there's a token mismatch
203201 $this->errors['general']['token-mismatch'] = wfMsg( 'payflowpro_gateway-token-mismatch' );
@@ -214,11 +212,12 @@
215213 * The message at the top of the form can be edited in the payflow_gateway.i18n.php file
216214 */
217215 public function fnPayflowDisplayForm( &$data, &$error ) {
218 - global $wgOut, $wgRequest;
 216+ global $wgOut, $wgRequest;
219217
220218 // save contrib tracking id early to track abondonment
221 - if ( $data[ 'numAttempt' ] == '0' && ( !$wgRequest->getText( 'utm_source_id', false ) || $wgRequest->getText( '_nocache_' ) == 'true' )) {
222 - if ( !$tracked = $this->fnPayflowSaveContributionTracking( $data ) ) {
 219+ if ( $data[ 'numAttempt' ] == '0' && ( !$wgRequest->getText( 'utm_source_id', false ) || $wgRequest->getText( '_nocache_' ) == 'true' ) ) {
 220+ $tracked = $this->fnPayflowSaveContributionTracking( $data );
 221+ if ( !$tracked ) {
223222 $when = time();
224223 wfDebugLog( 'payflowpro_gateway', 'Unable to save data to the contribution_tracking table ' . $when );
225224 }
@@ -235,17 +234,17 @@
236235 *
237236 * @param string $class_name The class name of the form to use
238237 */
239 - public function setFormClass( $class_name=NULL ) {
 238+ public function setFormClass( $class_name = NULL ) {
240239 if ( !$class_name ) {
241240 global $wgRequest, $wgPayflowGatewayDefaultForm;
242241 $form_class = $wgRequest->getText( 'form_name', $wgPayflowGatewayDefaultForm );
243 -
 242+
244243 // make sure our form class exists before going on, if not try loading default form class
245244 $class_name = "PayflowProGateway_Form_" . $form_class;
246 - if ( !class_exists( $class_name )) {
 245+ if ( !class_exists( $class_name ) ) {
247246 $class_name_orig = $class_name;
248247 $class_name = "PayflowProGateway_Form_" . $wgPayflowGatewayDefaultForm;
249 - if ( !class_exists( $class_name )) {
 248+ if ( !class_exists( $class_name ) ) {
250249 throw new MWException( 'Could not load form ' . $class_name_orig . ' nor default form ' . $class_name );
251250 }
252251 }
@@ -262,7 +261,7 @@
263262 * @return string
264263 */
265264 public function getFormClass( ) {
266 - if ( !isset( $this->form_class )) {
 265+ if ( !isset( $this->form_class ) ) {
267266 $this->setFormClass();
268267 }
269268 return $this->form_class;
@@ -272,14 +271,12 @@
273272 * Checks posted form data for errors and returns array of messages
274273 */
275274 private function fnPayflowValidateForm( $data, &$error ) {
276 - global $wgOut;
277 -
278275 // begin with no errors
279276 $error_result = '0';
280277
281278 // create the human-speak message for required fields
282279 // does not include fields that are not required
283 - $msg = array(
 280+ $msg = array(
284281 'amount' => wfMsg( 'payflowpro_gateway-error-msg-amount' ),
285282 'emailAdd' => wfMsg( 'payflowpro_gateway-error-msg-emailAdd' ),
286283 'fname' => wfMsg( 'payflowpro_gateway-error-msg-fname' ),
@@ -293,32 +290,32 @@
294291 'cvv' => wfMsg( 'payflowpro_gateway-error-msg-cvv' ),
295292 );
296293
297 - // find all empty fields and create message
298 - foreach( $data as $key => $value ) {
299 - if( $value == '' || $data['state'] == 'YY' ) {
 294+ // find all empty fields and create message
 295+ foreach ( $data as $key => $value ) {
 296+ if ( $value == '' || $data['state'] == 'YY' ) {
300297 // ignore fields that are not required
301 - if( isset($msg[$key]) ) {
 298+ if ( isset( $msg[$key] ) ) {
302299 $error[$key] = "**" . wfMsg( 'payflowpro_gateway-error-msg', $msg[$key] ) . "**<br />";
303300 $error_result = '1';
304301 }
305302 }
306303 }
307 -
308 - //check amount
 304+
 305+ // check amount
309306 if ( !preg_match( '/^\d+(\.(\d+)?)?$/', $data['amount'] ) || $data['amount'] == "0.00" ) {
310307 $error['invalidamount'] = wfMsg( 'payflowpro_gateway-error-msg-invalid-amount' );
311308 $error_result = '1';
312309 }
313 -
 310+
314311 // is email address valid?
315312 $isEmail = User::isValidEmailAddr( $data['email'] );
316313
317314 // create error message (supercedes empty field message)
318 - if( !$isEmail ) {
 315+ if ( !$isEmail ) {
319316 $error['emailAdd'] = wfMsg( 'payflowpro_gateway-error-msg-email' );
320317 $error_result = '1';
321318 }
322 -
 319+
323320 // validate that credit card number entered is correct for the brand
324321 switch( $data['card'] ) {
325322 case 'american':
@@ -326,7 +323,7 @@
327324 $pattern = '/^3[47][0-9]{13}$/';
328325
329326 // if the pattern doesn't match
330 - if( !preg_match( $pattern, $data['card_num'] ) ) {
 327+ if ( !preg_match( $pattern, $data['card_num'] ) ) {
331328 $error_result = '1';
332329 $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-amex' );
333330 }
@@ -338,7 +335,7 @@
339336 $pattern = '/^5[1-5][0-9]{14}$/';
340337
341338 // if pattern doesn't match
342 - if( !preg_match( $pattern, $data['card_num'] ) ) {
 339+ if ( !preg_match( $pattern, $data['card_num'] ) ) {
343340 $error_result = '1';
344341 $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-mc' );
345342 }
@@ -350,29 +347,29 @@
351348 $pattern = '/^4[0-9]{12}(?:[0-9]{3})?$/';
352349
353350 // if pattern doesn't match
354 - if( !preg_match( $pattern, $data['card_num'] ) ) {
 351+ if ( !preg_match( $pattern, $data['card_num'] ) ) {
355352 $error_result = '1';
356353 $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-visa' );
357354 }
358355
359356 break;
360 -
 357+
361358 case 'discover':
362359 // pattern for Discover
363360 $pattern = '/^6(?:011|5[0-9]{2})[0-9]{12}$/';
364361
365362 // if pattern doesn't match
366 - if( !preg_match( $pattern, $data['card_num'] ) ) {
 363+ if ( !preg_match( $pattern, $data['card_num'] ) ) {
367364 $error_result = '1';
368365 $error['card'] = wfMsg( 'payflowpro_gateway-error-msg-discover' );
369366 }
370367
371368 break;
372 -
373 -
374 -
 369+
 370+
 371+
375372 } // end switch
376 -
 373+
377374 return $error_result;
378375 }
379376
@@ -388,7 +385,7 @@
389386
390387 // update contribution tracking
391388 $this->updateContributionTracking( $data );
392 -
 389+
393390 // create payflow query string, include string lengths
394391 $queryArray = array(
395392 'TRXTYPE' => $payflow_data['trxtype'],
@@ -411,14 +408,14 @@
412409 'CUSTIP' => $payflow_data['user_ip'],
413410 );
414411
415 - foreach( $queryArray as $name => $value ) {
 412+ foreach ( $queryArray as $name => $value ) {
416413 $query[] = $name . '[' . strlen( $value ) . ']=' . $value;
417414 }
418415
419416 $queryString = implode( '&', $query );
420417
421418 $payflow_query = $queryString;
422 -
 419+
423420 // assign header data necessary for the curl_setopt() function
424421 $user_agent = Http::userAgent();
425422 $headers[] = 'Content-Type: text/namevalue';
@@ -426,7 +423,7 @@
427424 $headers[] = 'X-VPS-Client-Timeout: 45';
428425 $headers[] = 'X-VPS-Request-ID:' . $data['order_id'];
429426 $ch = curl_init();
430 - $paypalPostTo = isset ( $wgDonationTestingMode ) ? 'testingurl' : 'paypalurl';
 427+ $paypalPostTo = isset ( $wgDonationTestingMode ) ? 'testingurl' : 'paypalurl';
431428 curl_setopt( $ch, CURLOPT_URL, $payflow_data[ $paypalPostTo ] );
432429 curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
433430 curl_setopt( $ch, CURLOPT_USERAGENT, $user_agent );
@@ -437,7 +434,7 @@
438435 curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
439436 curl_setopt( $ch, CURLOPT_POSTFIELDS, $payflow_query );
440437 curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 2 );
441 - curl_setopt( $ch, CURLOPT_FORBID_REUSE, true );
 438+ curl_setopt( $ch, CURLOPT_FORBID_REUSE, true );
442439 curl_setopt( $ch, CURLOPT_POST, 1 );
443440
444441 // set proxy settings if necessary
@@ -447,21 +444,21 @@
448445 }
449446
450447 // As suggested in the PayPal developer forum sample code, try more than once to get a response
451 - // in case there is a general network issue
 448+ // in case there is a general network issue
452449 $i = 1;
453450
454 - while( $i++ <= 3 ) {
 451+ while ( $i++ <= 3 ) {
455452 $result = curl_exec( $ch );
456453 $headers = curl_getinfo( $ch );
457454
458 - if( $headers['http_code'] != 200 && $headers['http_code'] != 403 ) {
 455+ if ( $headers['http_code'] != 200 && $headers['http_code'] != 403 ) {
459456 sleep( 5 );
460 - } elseif( $headers['http_code'] == 200 || $headers['http_code'] == 403 ) {
 457+ } elseif ( $headers['http_code'] == 200 || $headers['http_code'] == 403 ) {
461458 break;
462459 }
463460 }
464461
465 - if( $headers['http_code'] != 200 ) {
 462+ if ( $headers['http_code'] != 200 ) {
466463 $wgOut->addHTML( '<h3>No response from credit card processor. Please try again later!</h3><p>' );
467464 $when = time();
468465 wfDebugLog( 'payflowpro_gateway', 'No response from credit card processor ' . $when );
@@ -487,14 +484,13 @@
488485 * Credit: code modified from payflowpro_example_EC.php posted (and supervised) on the PayPal developers message board
489486 */
490487 private function fnPayflowGetResults( $data, $result ) {
491 - global $wgOut;
492 - // prepare NVP response for sorting and outputting
 488+ // prepare NVP response for sorting and outputting
493489 $responseArray = array();
494 -
 490+
495491 /**
496492 * The result response string looks like:
497493 * RESULT=7&PNREF=E79P2C651DC2&RESPMSG=Field format error&HOSTCODE=10747&DUPLICATE=1
498 - * We want to turn this into an array of key value pairs, so explode on '&' and then
 494+ * We want to turn this into an array of key value pairs, so explode on '&' and then
499495 * split up the resulting strings into $key => $value
500496 */
501497 $result_arr = explode( "&", $result );
@@ -502,7 +498,7 @@
503499 list( $key, $value ) = preg_split( "/=/", $result_pair );
504500 $responseArray[ $key ] = $value;
505501 }
506 -
 502+
507503 // store the response array as an object property for easy retrival/manipulation elsewhere
508504 $this->payflow_response = $responseArray;
509505
@@ -511,33 +507,32 @@
512508 $resultCode = $responseArray['RESULT'];
513509
514510 // initialize response message
515 - $tryAgainResponse = '';
516511 $responseMsg = '';
517512
518513 // interpret result code, return
519514 // approved (1), denied (2), try again (3), general error (4)
520515 $errorCode = $this->fnPayflowGetResponseMsg( $resultCode, $responseMsg );
521516 // if approved, display results and send transaction to the queue
522 - if( $errorCode == '1' ) {
 517+ if ( $errorCode == '1' ) {
523518 $this->fnPayflowDisplayApprovedResults( $data, $responseArray, $responseMsg );
524519 // give user a second chance to enter incorrect data
525 - } elseif( ( $errorCode == '3' ) && ( $data['numAttempt'] < '5' ) ) {
 520+ } elseif ( ( $errorCode == '3' ) && ( $data['numAttempt'] < '5' ) ) {
526521 // pass responseMsg as an array key as required by displayForm
527522 $this->errors['retryMsg'] = $responseMsg;
528523 $this->fnPayflowDisplayForm( $data, $this->errors );
529524 // if declined or if user has already made two attempts, decline
530 - } elseif( ( $errorCode == '2' ) || ( $data['numAttempt'] >= '3' ) ) {
 525+ } elseif ( ( $errorCode == '2' ) || ( $data['numAttempt'] >= '3' ) ) {
531526 $this->fnPayflowDisplayDeclinedResults( $responseMsg );
532 - } elseif( ( $errorCode == '4' ) ) {
 527+ } elseif ( ( $errorCode == '4' ) ) {
533528 $this->fnPayflowDisplayOtherResults( $responseMsg );
534 - } elseif( ( $errorCode == '5' ) ) {
 529+ } elseif ( ( $errorCode == '5' ) ) {
535530 $this->fnPayflowDisplayPending( $data, $responseArray, $responseMsg );
536531 }
537532
538533 }// end display results
539534
540535 /**
541 - * Interpret response code, return
 536+ * Interpret response code, return
542537 * 1 if approved
543538 * 2 if declined
544539 * 3 if invalid data was submitted by user
@@ -545,8 +540,7 @@
546541 */
547542 function fnPayflowGetResponseMsg( $resultCode, &$responseMsg ) {
548543 $responseMsg = wfMsg( 'payflowpro_gateway-response-default' );
549 - $errorCode = '0';
550 -
 544+
551545 switch( $resultCode ) {
552546 case '0':
553547 $responseMsg = wfMsg( 'payflowpro_gateway-response-0' );
@@ -592,9 +586,9 @@
593587 $responseMsg = wfMsg( 'payflowpro_gateway-response-default' );
594588 $errorCode = '4';
595589 }
596 -
 590+
597591 return $errorCode;
598 - }
 592+ }
599593
600594 /**
601595 * Display response message to user with submitted user-supplied data
@@ -607,9 +601,8 @@
608602
609603 global $wgOut, $wgExternalThankYouPage;
610604 $transaction = '';
611 - $tracked = '';
612605
613 - // push to ActiveMQ server
 606+ // push to ActiveMQ server
614607 // include response message
615608 $transaction['response'] = $responseMsg;
616609 // include date
@@ -619,14 +612,14 @@
620613 $transaction['country_name'] = $countries[$data['country']];
621614 $transaction['country_code'] = $data['country'];
622615 // put all data into one array
623 - $optout = $this->determineOptOut($data);
 616+ $optout = $this->determineOptOut( $data );
624617 $data[ 'anonymous' ] = $optout[ 'anonymous' ];
625618 $data[ 'optout' ] = $optout[ 'optout' ];
626619 $transaction += array_merge( $data, $responseArray );
627 -
 620+
628621 /**
629622 * hook to call stomp functions
630 - *
 623+ *
631624 * Sends transaction to Stomp-based queueing service,
632625 * eg ActiveMQ
633626 */
@@ -638,7 +631,7 @@
639632 // display response message
640633 $wgOut->addHTML( '<h3 class="response_message">' . $responseMsg . '</h3>' );
641634
642 - // translate country code into text
 635+ // translate country code into text
643636 $countries = countryCodes();
644637
645638 $rows = array(
@@ -669,7 +662,7 @@
670663
671664 // display response message
672665 $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . ' ' . $responseMsg . '</h3>' );
673 -
 666+
674667 // unset edit token
675668 $this->fnPayflowUnsetEditToken();
676669 }
@@ -687,17 +680,17 @@
688681
689682 // display response message
690683 $wgOut->addHTML( '<h3 class="response_message">' . $declinedDefault . ' ' . $responseMsg . '</h3>' );
691 -
 684+
692685 // unset edit token
693686 $this->fnPayflowUnsetEditToken();
694687 }
695 -
 688+
696689 function fnPayflowDisplayPending( $data, $responseArray, $responseMsg ) {
697690 global $wgOut;
698 -
 691+
699692 $transaction = '';
700693
701 - // push to ActiveMQ server
 694+ // push to ActiveMQ server
702695 // include response message
703696 $transaction['response'] = $responseMsg;
704697 // include date
@@ -721,20 +714,20 @@
722715 // unset edit token
723716 $this->fnPayflowUnsetEditToken();
724717 }
725 -
 718+
726719 /**
727720 * Determine proper opt-out settings for contribution tracking
728 - *
 721+ *
729722 * because the form elements for comment anonymization and email opt-out
730723 * are backwards (they are really opt-in) relative to contribution_tracking
731724 * (which is opt-out), we need to reverse the values
732725 */
733726 public static function determineOptOut( $data ) {
734 - $optout[ 'optout' ] = ( isset( $data[ 'email-opt' ]) && $data[ 'email-opt' ] == "1" ) ? '0' : '1';
735 - $optout[ 'anonymous' ] = ( isset( $data[ 'comment-option' ]) && $data[ 'comment-option' ] == "1" ) ? '0' : '1';
 727+ $optout[ 'optout' ] = ( isset( $data[ 'email-opt' ] ) && $data[ 'email-opt' ] == "1" ) ? '0' : '1';
 728+ $optout[ 'anonymous' ] = ( isset( $data[ 'comment-option' ] ) && $data[ 'comment-option' ] == "1" ) ? '0' : '1';
736729 return $optout;
737730 }
738 -
 731+
739732 function fnPayflowSaveContributionTracking( &$data ) {
740733 // determine opt-out settings
741734 $optout = self::determineOptOut( $data );
@@ -753,87 +746,87 @@
754747
755748 // insert tracking data and get the tracking id
756749 $data['contribution_tracking_id'] = self::insertContributionTracking( $tracked_contribution );
757 -
758 - if ( !$data[ 'contribution_tracking_id' ]) {
 750+
 751+ if ( !$data[ 'contribution_tracking_id' ] ) {
759752 return false;
760753 }
761754 return true;
762755 }
763 -
 756+
764757 /**
765758 * Insert a record into the contribution_tracking table
766 - *
 759+ *
767760 * @param array $tracking_data The array of tracking data to insert to contribution_tracking
768761 * NOTE: this should probably be run thru self::cleanTrackingData to ensure data integrity
769762 * @return mixed Contribution tracking ID or false on failure
770763 */
771764 public static function insertContributionTracking( $tracking_data ) {
772765 $db = payflowGatewayConnection();
773 -
774 - if (!$db) { return false; }
775766
 767+ if ( !$db ) { return false; }
 768+
776769 // set the time stamp if it's not already set
777 - if ( !isset( $tracking_data[ 'ts' ] ) || !strlen( $tracking_data[ 'ts' ] )) {
 770+ if ( !isset( $tracking_data[ 'ts' ] ) || !strlen( $tracking_data[ 'ts' ] ) ) {
778771 $tracking_data[ 'ts' ] = $db->timestamp();
779772 }
780 -
 773+
781774 // Store the contribution data
782 - if ($db->insert( 'contribution_tracking', $tracking_data )) {
 775+ if ( $db->insert( 'contribution_tracking', $tracking_data ) ) {
783776 return $db->insertId();
784 - } else {
785 - return false;
786 - }
 777+ } else {
 778+ return false;
 779+ }
787780 }
788 -
 781+
789782 /**
790783 * Clean array of tracking data to contain valid fields
791 - *
792 - * Compares tracking data array to list of valid tracking fields and
 784+ *
 785+ * Compares tracking data array to list of valid tracking fields and
793786 * removes any extra tracking fields/data. Also sets empty values to
794787 * 'null' values.
795788 * @param array $tracking_data
796789 * @param bool $clean_opouts If true, form opt-out values will be run through $this->determineOptOut
797790 * for cleanup.
798791 */
799 - public static function cleanTrackingData( $tracking_data, $clean_optouts=false ) {
 792+ public static function cleanTrackingData( $tracking_data, $clean_optouts = false ) {
800793 // clean up the optout values if necessary
801794 if ( $clean_optouts ) {
802795 $optouts = self::determineOptOut( $tracking_data );
803796 $tracking_data[ 'optout' ] = $optouts[ 'optout' ];
804797 $tracking_data[ 'anonymous' ] = $optouts[ 'anonymous' ];
805798 }
806 -
 799+
807800 // define valid tracking fields
808 - $tracking_fields = array(
809 - 'note',
810 - 'referrer',
811 - 'anonymous',
812 - 'utm_source',
813 - 'utm_medium',
814 - 'utm_campaign',
815 - 'optout',
816 - 'language',
 801+ $tracking_fields = array(
 802+ 'note',
 803+ 'referrer',
 804+ 'anonymous',
 805+ 'utm_source',
 806+ 'utm_medium',
 807+ 'utm_campaign',
 808+ 'optout',
 809+ 'language',
817810 'ts'
818811 );
819 -
 812+
820813 // loop through tracking data and clean it up
821 - foreach ($tracking_data as $key => $value) {
 814+ foreach ( $tracking_data as $key => $value ) {
822815 // Make sure we only have valid fields
823 - if( !in_array( $key, $tracking_fields )) {
824 - unset( $tracking_data[ $key ]);
 816+ if ( !in_array( $key, $tracking_fields ) ) {
 817+ unset( $tracking_data[ $key ] );
825818 }
826 -
827 - // Make all empty strings NULL
828 - if ( !strlen( $value )) {
 819+
 820+ // Make all empty strings NULL
 821+ if ( !strlen( $value ) ) {
829822 $tracking_data[$key] = null;
830823 }
831824 }
832 -
 825+
833826 return $tracking_data;
834827 }
835 -
 828+
836829 function fnPayflowReturnCurrencies() {
837 -
 830+
838831 $payflowCurrencies = array(
839832 'GBP' => 'GBP: British Pound',
840833 'EUR' => 'EUR: Euro',
@@ -841,38 +834,38 @@
842835 'AUD' => 'AUD: Australian Dollar',
843836 'CAD' => 'CAD: Canadian Dollar',
844837 'JPY' => 'JPY: Japanese Yen',
845 - );
846 -
 838+ );
 839+
847840 return $payflowCurrencies;
848841 }
849 -
 842+
850843 /**
851844 * Establish an 'edit' token to help prevent CSRF, etc
852845 *
853846 * We use this in place of $wgUser->editToken() b/c currently
854 - * $wgUser->editToken() is broken (apparently by design) for
855 - * anonymous users. Using $wgUser->editToken() currently exposes
856 - * a security risk for non-authenticated users. Until this is
 847+ * $wgUser->editToken() is broken (apparently by design) for
 848+ * anonymous users. Using $wgUser->editToken() currently exposes
 849+ * a security risk for non-authenticated users. Until this is
857850 * resolved in $wgUser, we'll use our own methods for token
858851 * handling.
859852 *
860853 * @var mixed $salt
861854 * @return string
862855 */
863 - public static function fnPayflowEditToken( $salt='' ) {
864 -
 856+ public static function fnPayflowEditToken( $salt = '' ) {
 857+
865858 // make sure we have a session open for tracking a CSRF-prevention token
866859 self::fnPayflowEnsureSession();
867 -
868 - if ( !isset( $_SESSION[ 'payflowEditToken' ] )) {
869 - //generate unsalted token to place in the session
 860+
 861+ if ( !isset( $_SESSION[ 'payflowEditToken' ] ) ) {
 862+ // generate unsalted token to place in the session
870863 $token = self::fnPayflowGenerateToken();
871864 $_SESSION[ 'payflowEditToken' ] = $token;
872865 } else {
873866 $token = $_SESSION[ 'payflowEditToken' ];
874867 }
875 -
876 - if ( is_array( $salt )) {
 868+
 869+ if ( is_array( $salt ) ) {
877870 $salt = implode( "|", $salt );
878871 }
879872 return md5( $token . $salt ) . EDIT_TOKEN_SUFFIX;
@@ -880,11 +873,11 @@
881874
882875 /**
883876 * Generate a token string
884 - *
 877+ *
885878 * @var mixed $salt
886879 * @return string
887880 */
888 - public static function fnPayflowGenerateToken( $salt='' ) {
 881+ public static function fnPayflowGenerateToken( $salt = '' ) {
889882 $token = dechex( mt_rand() ) . dechex( mt_rand() );
890883 return md5( $token . $salt );
891884 }
@@ -896,7 +889,7 @@
897890 * @var mixed $salt
898891 * @return bool
899892 */
900 - function fnPayflowMatchEditToken( $val, $salt='' ) {
 893+ function fnPayflowMatchEditToken( $val, $salt = '' ) {
901894 // fetch a salted version of the session token
902895 $sessionToken = self::fnPayflowEditToken( $salt );
903896 if ( $val != $sessionToken ) {
@@ -915,7 +908,7 @@
916909 /**
917910 * Ensure that we have a session set for the current user
918911 *
919 - * If we do not have a session set for the current user,
 912+ * If we do not have a session set for the current user,
920913 * start the session.
921914 */
922915 public static function fnPayflowEnsureSession() {
@@ -934,7 +927,7 @@
935928 */
936929 public function fnGetFormData( $amount, $numAttempt, $token, $order_id ) {
937930 global $wgPayflowGatewayTest, $wgRequest;
938 -
 931+
939932 // if we're in testing mode and an action hasn't yet be specified, prepopulate the form
940933 if ( !$wgRequest->getText( 'action', false ) && !$numAttempt && $wgPayflowGatewayTest ) {
941934 // define arrays of cc's and cc #s for random selection
@@ -965,11 +958,11 @@
966959 'country' => 840,
967960 'card' => $cards[ $card_index ],
968961 'card_num' => $card_nums[ $cards[ $card_index ]][ $card_num_index ],
969 - 'expiration' => date( 'my', strtotime( '+1 year 1 month' )),
 962+ 'expiration' => date( 'my', strtotime( '+1 year 1 month' ) ),
970963 'cvv' => '001',
971964 'currency' => 'USD',
972965 'payment_method' => $wgRequest->getText( 'payment_method' ),
973 - 'order_id' => $order_id,
 966+ 'order_id' => $order_id,
974967 'numAttempt' => $numAttempt,
975968 'referrer' => 'http://www.baz.test.com/index.php?action=foo&action=bar',
976969 'utm_source' => self::getUtmSource(),
@@ -1007,16 +1000,16 @@
10081001 'payment_method' => $wgRequest->getText( 'payment_method' ),
10091002 'order_id' => $order_id,
10101003 'numAttempt' => $numAttempt,
1011 - 'referrer' => ( $wgRequest->getVal( 'referrer' )) ? $wgRequest->getVal( 'referrer' ) : $wgRequest->getHeader( 'referer' ),
 1004+ 'referrer' => ( $wgRequest->getVal( 'referrer' ) ) ? $wgRequest->getVal( 'referrer' ) : $wgRequest->getHeader( 'referer' ),
10121005 'utm_source' => self::getUtmSource(),
10131006 'utm_medium' => $wgRequest->getText( 'utm_medium' ),
10141007 'utm_campaign' => $wgRequest->getText( 'utm_campaign' ),
10151008 // try to honr the user-set language (uselang), otherwise the language set in the URL (language)
1016 - 'language' => $wgRequest->getText( 'uselang', $wgRequest->getText( 'language' )),
 1009+ 'language' => $wgRequest->getText( 'uselang', $wgRequest->getText( 'language' ) ),
10171010 'comment' => $wgRequest->getText( 'comment' ),
10181011 'comment-option' => $wgRequest->getText( 'comment-option' ),
10191012 'email-opt' => $wgRequest->getText( 'email-opt' ),
1020 - 'test_string' => $wgRequest->getText( 'process' ), //for showing payflow string during testing
 1013+ 'test_string' => $wgRequest->getText( 'process' ), // for showing payflow string during testing
10211014 'token' => $token,
10221015 'contribution_tracking_id' => $wgRequest->getText( 'contribution_tracking_id' ),
10231016 'data_hash' => $wgRequest->getText( 'data_hash' ),
@@ -1062,50 +1055,50 @@
10631056 * we try to figure it out from the request object
10641057 * @return string The full utm_source
10651058 */
1066 - public static function getUtmSource( $utm_source=null, $utm_source_id=null ) {
 1059+ public static function getUtmSource( $utm_source = null, $utm_source_id = null ) {
10671060 global $wgRequest;
10681061
10691062 /**
10701063 * fetch whatever was passed in as the utm_source
1071 - *
 1064+ *
10721065 * if utm_source was not passed in as a param, we try to divine it from
10731066 * the request. if it's not set there, no big deal, we'll just be
10741067 * missing some tracking data.
1075 - */
1076 - if ( is_null( $utm_source )) {
 1068+ */
 1069+ if ( is_null( $utm_source ) ) {
10771070 $utm_source = $wgRequest->getText( 'utm_source' );
10781071 }
1079 -
 1072+
10801073 /**
10811074 * if we have a utm_source_id, then the user is on a single-step credit card form.
1082 - * if that's the case, we treat the single-step credit card form as a landing page,
 1075+ * if that's the case, we treat the single-step credit card form as a landing page,
10831076 * which we label as cc#, where # = the utm_source_id
10841077 */
1085 - if ( is_null( $utm_source_id )) {
 1078+ if ( is_null( $utm_source_id ) ) {
10861079 $utm_source_id = $wgRequest->getVal( 'utm_source_id', 0 );
10871080 }
1088 -
 1081+
10891082 // this is how the CC portion of the utm_source should be defined
10901083 $correct_cc_source = ( $utm_source_id ) ? 'cc' . $utm_source_id . '.cc' : 'cc';
1091 -
 1084+
10921085 // check to see if the utm_source is already correct - if so, return
1093 - if ( preg_match('/' . str_replace( ".", "\.", $correct_cc_source ) . '$/', $utm_source)) {
 1086+ if ( preg_match( '/' . str_replace( ".", "\.", $correct_cc_source ) . '$/', $utm_source ) ) {
10941087 return $utm_source;
10951088 }
1096 -
 1089+
10971090 // split the utm_source into its parts for easier manipulation
10981091 $source_parts = explode( ".", $utm_source );
1099 -
 1092+
11001093 // if there are no sourceparts element, then the banner portion of the string needs to be set.
11011094 // since we don't know what it is, set it to an empty string
1102 - if ( !count( $source_parts )) $source_parts[0] = '';
1103 -
1104 - // if the utm_source_id is set, set the landing page portion of the string to cc#
1105 - $source_parts[1] = ( $utm_source_id ) ? 'cc' . $utm_source_id : ( isset( $source_parts[1] ) ? $source_parts[1] : '');
1106 -
 1095+ if ( !count( $source_parts ) ) $source_parts[0] = '';
 1096+
 1097+ // if the utm_source_id is set, set the landing page portion of the string to cc#
 1098+ $source_parts[1] = ( $utm_source_id ) ? 'cc' . $utm_source_id : ( isset( $source_parts[1] ) ? $source_parts[1] : '' );
 1099+
11071100 // the payment instrument portion should always be 'cc' if this method is being accessed
1108 - $source_parts[2] = 'cc';
1109 -
 1101+ $source_parts[2] = 'cc';
 1102+
11101103 // return a reconstructed string
11111104 return implode( ".", $source_parts );
11121105 }
@@ -1116,23 +1109,23 @@
11171110 * @param array $data Form data
11181111 * @param bool $force If set to true, will ensure that contribution tracking is updated
11191112 */
1120 - public function updateContributionTracking( &$data, $force=false ) {
1121 - // ony update contrib tracking if we're coming from a single-step landing page
 1113+ public function updateContributionTracking( &$data, $force = false ) {
 1114+ // ony update contrib tracking if we're coming from a single-step landing page
11221115 // which we know with cc# in utm_source or if force=true or if contribution_tracking_id is not set
1123 - if ( !$force &&
1124 - !preg_match( "/cc[0-9]/", $data[ 'utm_source' ] ) &&
1125 - $data[ 'contribution_tracking_id' ] ) {
 1116+ if ( !$force &&
 1117+ !preg_match( "/cc[0-9]/", $data[ 'utm_source' ] ) &&
 1118+ is_numeric( $data[ 'contribution_tracking_id' ] ) ) {
11261119 return;
11271120 }
11281121
1129 -
 1122+
11301123 // determine opt-out settings
11311124 $optout = self::determineOptOut( $data );
1132 -
 1125+
11331126 $db = payflowGatewayConnection();
1134 -
1135 - if (!$db) { return true ; }
11361127
 1128+ if ( !$db ) { return true ; }
 1129+
11371130 $tracked_contribution = array(
11381131 'note' => $data['comment'],
11391132 'referrer' => $data['referrer'],
@@ -1143,39 +1136,39 @@
11441137 'optout' => $optout[ 'optout' ],
11451138 'language' => $data['language'],
11461139 );
1147 -
 1140+
11481141 // Make all empty strings NULL
1149 - foreach ($tracked_contribution as $key => $value) {
1150 - if ($value === '') {
 1142+ foreach ( $tracked_contribution as $key => $value ) {
 1143+ if ( $value === '' ) {
11511144 $tracked_contribution[$key] = null;
11521145 }
11531146 }
1154 -
 1147+
11551148 // if contrib tracking id is not already set, we need to insert the data, otherwise update
11561149 if ( !$data[ 'contribution_tracking_id' ] ) {
11571150 $data[ 'contribution_tracking_id' ] = $this->insertContributionTracking( $tracked_contribution );
11581151 } else {
1159 - $db->update( 'contribution_tracking', $tracked_contribution, array( 'id' => $data[ 'contribution_tracking_id' ] ));
 1152+ $db->update( 'contribution_tracking', $tracked_contribution, array( 'id' => $data[ 'contribution_tracking_id' ] ) );
11601153 }
11611154 }
1162 -
 1155+
11631156 /**
11641157 * Handle redirection of form content to PayPal
1165 - *
 1158+ *
11661159 * @fixme If we can update contrib tracking table in ContributionTracking
11671160 * extension, we can probably get rid of this method and just submit the form
11681161 * directly to the paypal URL, and have all processing handled by ContributionTracking
11691162 * This would make this a lot less hack-ish
11701163 */
11711164 public function paypalRedirect( &$data ) {
1172 - global $wgOut, $wgPayflowGatewayPaypalURL;
1173 -
1174 - // if we don't have a URL enabled throw a graceful error to the user
1175 - if ( !strlen( $wgPayflowGatewayPaypalURL )) {
 1165+ global $wgPayflowGatewayPaypalURL, $wgPayflowGatewayTest;
 1166+
 1167+ // if we don't have a URL enabled throw a graceful error to the user
 1168+ if ( !strlen( $wgPayflowGatewayPaypalURL ) ) {
11761169 $this->errors['general'][ 'nopaypal' ] = wfMsg( 'payflow_gateway-error-msg-nopaypal' );
11771170 return;
11781171 }
1179 -
 1172+
11801173 // update the utm source to set the payment instrument to pp rather than cc
11811174 $utm_source_parts = explode( ".", $data[ 'utm_source' ] );
11821175 $utm_source_parts[2] = 'pp';
@@ -1185,17 +1178,24 @@
11861179 * update contribution tracking
11871180 */
11881181 $this->updateContributionTracking( $data, true );
1189 -
 1182+
11901183 $wgPayflowGatewayPaypalURL .= "/" . $data[ 'language' ] . "?gateway=paypal";
11911184
1192 - $output = '<form method="post" name="paypalredirect" action="' . $wgPayflowGatewayPaypalURL . '">';
1193 - foreach ( $data as $key => $value ) {
1194 - $output .= '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '" />';
 1185+ // submit the data to the paypal redirect URL
 1186+ $ch = curl_init();
 1187+ curl_setopt( $ch, CURLOPT_URL, $wgPayflowGatewayPaypalURL );
 1188+ curl_setopt( $ch, CURLOPT_USERAGENT, 'Donation_Interface PayflowPro Gateway PayPal Redirecter 1.0' );
 1189+ curl_setopt( $ch, CURLOPT_POST, count( $data ) );
 1190+ curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $data ) );
 1191+ if ( $wgPayflowGatewayTest ) curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
 1192+ $curl_result = curl_exec( $ch );
 1193+ $curl_error = ( !$curl_result ) ? curl_error( $ch ) : null;
 1194+ curl_close( $ch );
 1195+
 1196+ // throw an exception if there was a curl error
 1197+ if ( !is_null( $curl_error ) ) {
 1198+ throw new MWException( 'There was a cURL error submitting information to ' . $wgPayflowGatewayPaypalURL . ': ' . $curl_error );
11951199 }
11961200
1197 - $wgOut->addHTML( $output );
1198 -
1199 - // Automatically post the form if the user has Javascript support
1200 - $wgOut->addHTML( '<script type="text/javascript">document.paypalredirect.submit();</script>' );
12011201 }
1202 -} // end class
\ No newline at end of file
 1202+} // end class
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/custom_filters.body.php
@@ -4,14 +4,14 @@
55 /**
66 * A value for tracking the 'riskiness' of a transaction
77 *
8 - * The action to take based on a transaction's riskScore is determined by
 8+ * The action to take based on a transaction's riskScore is determined by
99 * $action_ranges. This is built assuming a range of possible risk scores
1010 * as 0-100, although you can probably bend this as needed.
1111 * @var public int
1212 */
1313 public $risk_score;
1414
15 - /**
 15+ /**
1616 * Define the action to take for a given $risk_score
1717 * @var public array
1818 */
@@ -45,8 +45,8 @@
4646
4747 // load user action ranges and risk score
4848 global $wgPayflowGatewayCustomFiltersActionRanges, $wgPayflowGatewayCustomFiltersRiskScore;
49 - if ( isset( $wgPayflowGatewayCustomFiltersActionRanges )) $this->action_ranges = $wgPayflowGatewayCustomFiltersActionRanges;
50 - if ( isset( $wgPayflowGatewayCustomFiltersRiskScore )) $this->risk_score = $wgPayflowGatewayCustomFiltersRiskScore;
 49+ if ( isset( $wgPayflowGatewayCustomFiltersActionRanges ) ) $this->action_ranges = $wgPayflowGatewayCustomFiltersActionRanges;
 50+ if ( isset( $wgPayflowGatewayCustomFiltersRiskScore ) ) $this->risk_score = $wgPayflowGatewayCustomFiltersRiskScore;
5151 }
5252
5353 /**
@@ -59,8 +59,8 @@
6060 if ( $this->risk_score < 0 ) $this->risk_score = 0;
6161 if ( $this->risk_score > 100 ) $this->risk_score = 100;
6262
63 - foreach ( $this->action_ranges as $action => $range ) {
64 - if ( $this->risk_score >= $range[0] && $this->risk_score <= $range[1] ) {
 63+ foreach ( $this->action_ranges as $action => $range ) {
 64+ if ( $this->risk_score >= $range[0] && $this->risk_score <= $range[1] ) {
6565 return $action;
6666 }
6767 }
@@ -71,10 +71,10 @@
7272 */
7373 public function validate() {
7474 // expose a hook for custom filters
75 - wfRunHooks( 'PayflowGatewayCustomFilter', array( &$this ));
 75+ wfRunHooks( 'PayflowGatewayCustomFilter', array( &$this ) );
7676 $this->gateway_object->action = $this->determineAction();
7777
78 - $log_msg = '"' . $this->gateway_object->action . "\"\t\"" . $this->risk_score . "\"";
 78+ $log_msg = '"' . $this->gateway_object->action . "\"\t\"" . $this->risk_score . "\"";
7979 $this->log( $this->gateway_data['contribution_tracking_id'], 'Filtered', $log_msg );
8080 return TRUE;
8181 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/custom_filters.php
@@ -3,7 +3,7 @@
44 * Provides a unified way to define and run custom filters for incoming transactions
55 *
66 * Running filters through 'custom filters' rather than directly through the validate hook in the gateway
7 - * offers the advantage of simplifying the passage of relvent data between filters/validators that's
 7+ * offers the advantage of simplifying the passage of relvent data between filters/validators that's
88 * needed to perform more complex validation/filtering of transactions.
99 *
1010 * The actual filters themselves are regular MW extensions and can optional be organized in filters/
@@ -12,18 +12,18 @@
1313 * object.
1414 */
1515
16 -if ( !defined( 'MEDIAWIKI' ) ) {
17 - die( "This file is part of the MinFraud for PayflowPro Gateway extension. It is not a valid entry point.\n" );
 16+if ( !defined( 'MEDIAWIKI' ) ) {
 17+ die( "This file is part of the MinFraud for PayflowPro Gateway extension. It is not a valid entry point.\n" );
1818 }
1919
2020 $wgExtensionCredits['payflowprogateway_custom_filters'][] = array(
2121 'name' => 'custom filters',
22 - 'author' =>'Arthur Richards',
23 - 'url' => '',
 22+ 'author' => 'Arthur Richards',
 23+ 'url' => '',
2424 'description' => 'This extension provides a way to define custom filters for incoming transactions for the Payflow Pro gateway.'
2525 );
2626
27 -/**
 27+/**
2828 * Define the action to take for a given $risk_score
2929 */
3030 $wgPayflowGatewayCustomFiltersActionRanges = array(
@@ -36,7 +36,7 @@
3737 /**
3838 * A value for tracking the 'riskiness' of a transaction
3939 *
40 - * The action to take based on a transaction's riskScore is determined by
 40+ * The action to take based on a transaction's riskScore is determined by
4141 * $action_ranges. This is built assuming a range of possible risk scores
4242 * as 0-100, although you can probably bend this as needed.
4343 */
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/source/source.body.php
@@ -21,7 +21,7 @@
2222 public function filter() {
2323 // pull out the source from the filter object
2424 $source = $this->cfo->gateway_data['utm_source'];
25 -
 25+
2626 // a very complex filtering algorithm for sources
2727 global $wgCustomFiltersSrcRules;
2828 foreach ( $wgCustomFiltersSrcRules as $regex => $risk_score_modifier ) {
@@ -29,14 +29,14 @@
3030 * Note that regex pattern does not include delimiters.
3131 * These will need to be included your custom regex patterns.
3232 */
33 - if( preg_match( "$regex", $source )) {
 33+ if ( preg_match( "$regex", $source ) ) {
3434 $this->cfo->risk_score += $risk_score_modifier;
35 -
 35+
3636 // log it
37 - $log_msg = "\"" . addslashes($source) . "\"";
38 - $log_msg .= "\t\"" . addslashes($regex) . "\"";
 37+ $log_msg = "\"" . addslashes( $source ) . "\"";
 38+ $log_msg .= "\t\"" . addslashes( $regex ) . "\"";
3939 $log_msg .= "\t\"" . $this->cfo->risk_score . "\"";
40 - $this->log(
 40+ $this->log(
4141 $this->cfo->gateway_data['contribution_tracking_id'],
4242 'Filter: Source',
4343 $log_msg
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/source/source.php
@@ -6,7 +6,7 @@
77 * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/source/source.php" );
88 */
99
10 -if ( !defined( 'MEDIAWIKI' )) {
 10+if ( !defined( 'MEDIAWIKI' ) ) {
1111 die( "This file is part of the source custom filter part of the PayflowPro Gateway extension. It is not a valid entry point\n" );
1212 }
1313
@@ -21,9 +21,9 @@
2222 * An array defining source strings and their associated risk score amount
2323 *
2424 * The key of the array is a regular expression to run against the source and the value is
25 - * the amount to add to the risk score. The regex is run through preg_match and does not
 25+ * the amount to add to the risk score. The regex is run through preg_match and does not
2626 * need to include staring/ending delimiters - be sure to escape your characters!
27 - *
 27+ *
2828 * eg:
2929 * $wgCustomFiltersSrcRules['support.cc'] = "100";
3030 * // increases risk score for trxns with source of 'support.cc' referrals by 100
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/minfraud/minfraud.body.php
@@ -15,14 +15,14 @@
1616 $data =& $custom_filter_object->gateway_data;
1717
1818 // see if we can bypass minfraud
19 - if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data )) return TRUE;
 19+ if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data ) ) return TRUE;
2020
2121 $minfraud_query = $this->build_query( $data );
2222 $this->query_minfraud( $minfraud_query );
2323 $pfp_gateway_object->action = 'Filter';
2424
2525 $custom_filter_object->risk_score += $this->minfraud_response['riskScore'];
26 -
 26+
2727 // Write the query/response to the log
2828 // @fixme this will cause the 'action' to be logged even though it's premature here
2929 $this->log_query( $minfraud_query, $pfp_gateway_object, $data );
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/minfraud/minfraud.php
@@ -3,7 +3,7 @@
44 * Custom filter using minFraud
55 *
66 * Essentially acts as a wrapper for the minFraud extra and runs minFraud
7 - * queries via custom filter paradigm. This allows us to capture the
 7+ * queries via custom filter paradigm. This allows us to capture the
88 * riskScore from minfraud and adjust it with our own custom filters and
99 * risk score modifications.
1010 *
@@ -17,20 +17,20 @@
1818
1919 $wgExtensionCredits['payflowprogateway_extras_customfilters_minfraud'][] = array(
2020 'name' => 'minfraud custom filter',
21 - 'author' =>'Arthur Richards',
22 - 'url' => '',
 21+ 'author' => 'Arthur Richards',
 22+ 'url' => '',
2323 'description' => 'This extension uses the MaxMind minFraud service as a validator for the Payflow Pro gateway via custom filters.'
2424 );
2525
2626 /**
2727 * Set minFraud to NOT run in standalone mode.
2828 *
29 - * If minFraud is set to run in standalone mode, it will not be run
30 - * through custom filters. If you do not know what you're doing
 29+ * If minFraud is set to run in standalone mode, it will not be run
 30+ * through custom filters. If you do not know what you're doing
3131 * or otherwise have this set up incorrectly, you may have unexpected
3232 * results. If you want minFraud to run OUTSIDE of custom filters,
33 - * you will want to make sure you know whether minFraud queries are
34 - * happening before or after custom filters, defined by the order of
 33+ * you will want to make sure you know whether minFraud queries are
 34+ * happening before or after custom filters, defined by the order of
3535 * your require statements in LocalSettings.
3636 */
3737 $wgMinFraudStandalone = FALSE;
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/referrer/referrer.php
@@ -6,7 +6,7 @@
77 * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/referrer/referrer.php" );
88 */
99
10 -if ( !defined( 'MEDIAWIKI' )) {
 10+if ( !defined( 'MEDIAWIKI' ) ) {
1111 die( "This file is part of the referrer custom filter part of the PayflowPro Gateway extension. It is not a valid entry point\n" );
1212 }
1313
@@ -21,9 +21,9 @@
2222 * An array defining a regex to match referrer URLs and their associated risk score amount
2323 *
2424 * The key of the array is a regular expression to run against the referrer and the value is
25 - * the amount to add to the risk score. The regex is run through preg_match and does not
 25+ * the amount to add to the risk score. The regex is run through preg_match and does not
2626 * need to include staring/ending delimiters - be sure to escape your characters!
27 - *
 27+ *
2828 * eg:
2929 * $wgCustomFiltersRefRules['fraud\.com'] = "100";
3030 * // increases risk score for trxns with http://fraud.com referrals by 100
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/custom_filters/filters/referrer/referrer.body.php
@@ -21,7 +21,7 @@
2222 public function filter() {
2323 // pull out the referrer from the filter object
2424 $referrer = $this->cfo->gateway_data['referrer'];
25 -
 25+
2626 // a very complex filtering algorithm for referrers
2727 global $wgCustomFiltersRefRules;
2828 foreach ( $wgCustomFiltersRefRules as $regex => $risk_score_modifier ) {
@@ -29,14 +29,14 @@
3030 * note that the regex pattern does NOT include delimiters.
3131 * these will need to be included in your custom regex patterns.
3232 */
33 - if( preg_match( "$regex", $referrer )) {
 33+ if ( preg_match( "$regex", $referrer ) ) {
3434 $this->cfo->risk_score += $risk_score_modifier;
35 -
 35+
3636 // log it
37 - $log_msg = "\"" . addslashes($referrer) . "\"";
38 - $log_msg .= "\t\"" . addslashes($regex) . "\"";
 37+ $log_msg = "\"" . addslashes( $referrer ) . "\"";
 38+ $log_msg .= "\t\"" . addslashes( $regex ) . "\"";
3939 $log_msg .= "\t\"" . $this->cfo->risk_score . "\"";
40 - $this->log(
 40+ $this->log(
4141 $this->cfo->gateway_data['contribution_tracking_id'],
4242 'Filter: Referrer',
4343 $log_msg
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/HTTPBase.php
@@ -19,30 +19,30 @@
2020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2121 */
2222
23 -class HTTPBase{
24 - var $server;
25 - var $numservers;
26 - var $url;
27 - var $queries;
28 - var $allowed_fields;
29 - var $num_allowed_fields;
30 - var $outputstr;
31 - var $isSecure;
32 - var $timeout;
33 - var $debug;
34 - var $check_field;
35 - var $wsIpaddrRefreshTimeout;
36 - var $wsIpaddrCacheFile;
37 - var $useDNS;
38 - var $ipstr;
 23+class HTTPBase {
 24+ var $server;
 25+ var $numservers;
 26+ var $url;
 27+ var $queries;
 28+ var $allowed_fields;
 29+ var $num_allowed_fields;
 30+ var $outputstr;
 31+ var $isSecure;
 32+ var $timeout;
 33+ var $debug;
 34+ var $check_field;
 35+ var $wsIpaddrRefreshTimeout;
 36+ var $wsIpaddrCacheFile;
 37+ var $useDNS;
 38+ var $ipstr;
3939 function __construct() {
4040 $this->isSecure = 0;
4141 $this->debug = 0;
4242 $this->timeout = 0;
4343 $this->check_field = "score";
4444 $this->wsIpaddrRefreshTimeout = 18000;
45 - $this->wsIpaddrCacheFile = $this->_getTempDir()."/maxmind.ws.cache";
46 - if ($this->debug == 1) {
 45+ $this->wsIpaddrCacheFile = $this->_getTempDir() . "/maxmind.ws.cache";
 46+ if ( $this->debug == 1 ) {
4747 print "wsIpaddrRefreshTimeout: " . $this->wsIpaddrRefreshTimeout . "\n";
4848 print "wsIpaddrCacheFile: " . $this->wsIpaddrCacheFile . "\n";
4949 print "useDNS: " . $this->useDNS . "\n";
@@ -50,50 +50,50 @@
5151 }
5252
5353 // this function sets the checked field
54 - function set_check_field($f) {
55 - $check_field = $f;
 54+ function set_check_field( $f ) {
 55+ $this->check_field = $f;
5656 }
5757
5858 // this function sets the allowed fields
59 - function set_allowed_fields($i) {
 59+ function set_allowed_fields( $i ) {
6060 $this->allowed_fields = $i;
61 - $this->num_allowed_fields = count($i);
 61+ $this->num_allowed_fields = count( $i );
6262 }
6363
64 - //this function queries the servers
 64+ // this function queries the servers
6565 function query() {
66 - //query every server in the list
67 - if (!$this->useDNS){
 66+ // query every server in the list
 67+ if ( !$this->useDNS ) {
6868 $ipstr = $this->readIpAddressFromCache();
69 - if ($this->debug == 1){
 69+ if ( $this->debug == 1 ) {
7070 print "using ip addresses, IPs are " . $ipstr . "\n";
7171 }
7272 }
7373 // query every server using its ip address
7474 // if there was success reading the ip addresses
7575 // from the web or the cache file
76 - if ($ipstr) {
77 - $ipaddr = explode(";",$ipstr);
78 - $numipaddr = count($ipaddr);
79 - for ($i = 0;$i < $numipaddr;$i++){
80 - $result = $this->querySingleServer($ipaddr[$i]);
81 - if ($this->debug == 1) {
 76+ if ( $ipstr ) {
 77+ $ipaddr = explode( ";", $ipstr );
 78+ $numipaddr = count( $ipaddr );
 79+ for ( $i = 0; $i < $numipaddr; $i++ ) {
 80+ $result = $this->querySingleServer( $ipaddr[$i] );
 81+ if ( $this->debug == 1 ) {
8282 print "ip address: " . $ipaddr[$i] . "\n";
8383 print "result: " . $result . "\n";
8484 }
85 - if ($result) {
 85+ if ( $result ) {
8686 return $result;
8787 }
8888 }
8989 }
90 -
 90+
9191 // query every server using its domain name
92 - for ($i = 0; $i < $this->numservers; $i++ ) {
93 - $result = $this->querySingleServer($this->server[$i]);
94 - if ($this->debug == 1) {
 92+ for ( $i = 0; $i < $this->numservers; $i++ ) {
 93+ $result = $this->querySingleServer( $this->server[$i] );
 94+ if ( $this->debug == 1 ) {
9595 print "server: " . $this->server[$i] . "\nresult: " . $result . "\n";
9696 }
97 - if ($result) {
 97+ if ( $result ) {
9898 return $result;
9999 }
100100 }
@@ -101,15 +101,15 @@
102102 }
103103
104104 // this function takes a input hash and stores it in the hash named queries
105 - function input($vars) {
106 - $numinputkeys = count($vars); // get the number of keys in the input hash
107 - $inputkeys = array_keys($vars); // get a array of keys in the input hash
108 - for ($i = 0; $i < $numinputkeys; $i++) {
 105+ function input( $vars ) {
 106+ $numinputkeys = count( $vars ); // get the number of keys in the input hash
 107+ $inputkeys = array_keys( $vars ); // get a array of keys in the input hash
 108+ for ( $i = 0; $i < $numinputkeys; $i++ ) {
109109 $key = $inputkeys[$i];
110 - if ($this->allowed_fields[$key] == 1) {
111 - //if key is a allowed field then store it in
112 - //the hash named queries
113 - $this->queries[$key] = urlencode($this->filter_field($key, $vars[$key]));
 110+ if ( $this->allowed_fields[$key] == 1 ) {
 111+ // if key is a allowed field then store it in
 112+ // the hash named queries
 113+ $this->queries[$key] = urlencode( $this->filter_field( $key, $vars[$key] ) );
114114 } else {
115115 print "invalid input $key - perhaps misspelled field?";
116116 return 0;
@@ -118,85 +118,85 @@
119119 $this->queries["clientAPI"] = $this->API_VERSION;
120120 }
121121
122 - //sub-class should override this if it needs to filter inputs
123 - function filter_field($key, $value) {
 122+ // sub-class should override this if it needs to filter inputs
 123+ function filter_field( $key, $value ) {
124124 return $value;
125125 }
126126
127 - //this function returns the output from the server
 127+ // this function returns the output from the server
128128 function output() {
129 - return $this->outputstr;
 129+ return $this->outputstr;
130130 }
131131
132132 // write the ip Addresses and the time right now to
133133 // the cache file
134 - function writeIpAddressToCache($filename,$ipstr) {
 134+ function writeIpAddressToCache( $filename, $ipstr ) {
135135 $datetime = time();
136 - $fh = fopen($this->wsIpaddrCacheFile,'w');
137 - fwrite($fh,$ipstr . "\n");
138 - fwrite($fh,$datetime . "\n");
139 - fclose($fh);
140 - if ($this->debug == 1) {
 136+ $fh = fopen( $this->wsIpaddrCacheFile, 'w' );
 137+ fwrite( $fh, $ipstr . "\n" );
 138+ fwrite( $fh, $datetime . "\n" );
 139+ fclose( $fh );
 140+ if ( $this->debug == 1 ) {
141141 print "writing ip address to cache\n";
142142 print "ip str: " . $ipstr . "\n";
143143 print "date time: " . $datetime . "\n";
144144 }
145145 }
146 -
 146+
147147 function readIpAddressFromCache() {
148148 // if the cache file exists then
149149 // read the ip addresses and the time
150150 // IPs were cached
151 - if (file_exists($this->wsIpaddrCacheFile)) {
152 - $fh = fopen($this->wsIpaddrCacheFile,'r');
153 - $ipstr = fgets($fh,1024);
154 - $ipstr = rtrim($ipstr);
155 - $datetime = fgets($fh,1024);
156 - $datetime = rtrim($datetime);
157 - fclose($fh);
 151+ if ( file_exists( $this->wsIpaddrCacheFile ) ) {
 152+ $fh = fopen( $this->wsIpaddrCacheFile, 'r' );
 153+ $ipstr = fgets( $fh, 1024 );
 154+ $ipstr = rtrim( $ipstr );
 155+ $datetime = fgets( $fh, 1024 );
 156+ $datetime = rtrim( $datetime );
 157+ fclose( $fh );
158158 }
159 -
 159+
160160 // if the ip addresses expired or don't exist then
161 - // get them from the web and write
 161+ // get them from the web and write
162162 // them to the cache file
163 - if (((time() - $datetime) > $this->wsIpaddrRefreshTimeout) | (!$ipstr)) {
 163+ if ( ( ( time() - $datetime ) > $this->wsIpaddrRefreshTimeout ) | ( !$ipstr ) ) {
164164 $tryIpstr = $this->readIpAddressFromWeb();
165 - if ($tryIpstr) {
 165+ if ( $tryIpstr ) {
166166 $ipstr = $tryIpstr;
167167 } else {
168 - if ($this->debug == 1){
 168+ if ( $this->debug == 1 ) {
169169 print "Warning, unable to get ws_ipaddr from www.maxmind.com\n";
170170 }
171171 }
172172 // we write to cache whether or not we were able to get $tryIpStr, since
173173 // in case DNS goes down, we don't want to check app/ws_ipaddr over and over
174 - $this->writeIpAddressToCache($this->wsIpaddrCacheFile,$ipstr);
 174+ $this->writeIpAddressToCache( $this->wsIpaddrCacheFile, $ipstr );
175175 }
176 - if ($this->debug == 1){
 176+ if ( $this->debug == 1 ) {
177177 print "reading ip address from cache\n";
178178 print "ip str: " . $ipstr . "\n";
179179 print "date time: " . $datetime . "\n";
180180 }
181 - //return the ip addresses
182 - return $ipstr;
 181+ // return the ip addresses
 182+ return $ipstr;
183183 }
184184
185185 function readIpAddressFromWeb() {
186 - //check if the curl module exists
 186+ // check if the curl module exists
187187 $url = "http://www.maxmind.com/app/ws_ipaddr";
188 - if (extension_loaded('curl')) {
 188+ if ( extension_loaded( 'curl' ) ) {
189189 // open curl
190190 $ch = curl_init();
191191
192192 // set curl options
193 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
194 - curl_setopt($ch, CURLOPT_URL, $url);
195 - curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
 193+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
 194+ curl_setopt( $ch, CURLOPT_URL, $url );
 195+ curl_setopt( $ch, CURLOPT_TIMEOUT, $this->timeout );
196196
197 - //get the content
198 - $content = curl_exec($ch);
199 - $content = rtrim($content);
200 - if ($this->debug == 1) {
 197+ // get the content
 198+ $content = curl_exec( $ch );
 199+ $content = rtrim( $content );
 200+ if ( $this->debug == 1 ) {
201201 print "using curl\n";
202202 }
203203 } else {
@@ -204,101 +204,99 @@
205205
206206 // parse the url to get
207207 // host, path and query
208 - $url3 = parse_url($url);
 208+ $url3 = parse_url( $url );
209209 $host = $url3["host"];
210210 $path = $url3["path"];
211211
212212 // open the connection
213 - $fp = fsockopen ($host, 80, $errno, $errstr, $this->timeout);
214 - if ($fp) {
 213+ $fp = fsockopen ( $host, 80, $errno, $errstr, $this->timeout );
 214+ if ( $fp ) {
215215 // send the request
216 - fputs ($fp, "GET $path HTTP/1.0\nHost: " . $host . "\n\n");
217 - while (!feof($fp)) {
218 - $buf .= fgets($fp, 128);
 216+ fputs ( $fp, "GET $path HTTP/1.0\nHost: " . $host . "\n\n" );
 217+ while ( !feof( $fp ) ) {
 218+ $buf .= fgets( $fp, 128 );
219219 }
220 - $lines = preg_split("/\n/", $buf);
 220+ $lines = preg_split( "/\n/", $buf );
221221 // get the content
222 - $content = $lines[count($lines)-1];
223 - //close the connection
224 - fclose($fp);
 222+ $content = $lines[count( $lines ) -1];
 223+ // close the connection
 224+ fclose( $fp );
225225 }
226 - if ($this->debug == 1) {
 226+ if ( $this->debug == 1 ) {
227227 print "using fsockopen\n";
228228 }
229229 }
230 - if ($this->debug == 1) {
 230+ if ( $this->debug == 1 ) {
231231 print "readIpAddressFromWeb found ip addresses: " . $content . "\n";
232232 }
233233 // TODO fix regexp so that it checks if it only has IP addresses
234 - if (preg_match("/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/",$content)) {
 234+ if ( preg_match( "/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/", $content ) ) {
235235 return $content;
236 - }
 236+ }
237237 return "";
238238 }
239239
240240 // this function queries a single server
241 - function querySingleServer($server) {
 241+ function querySingleServer( $server ) {
242242 global $wgPayflowGatewayUseHTTPProxy, $wgPayflowGatewayHTTPProxy;
243 -
 243+
244244 // check if we using the Secure HTTPS proctol
245 - if ($this->isSecure == 1) {
 245+ if ( $this->isSecure == 1 ) {
246246 $scheme = "https://"; // Secure HTTPS proctol
247247 } else {
248248 $scheme = "http://"; // Regular HTTP proctol
249249 }
250250
251251 // build a query string from the hash called queries
252 - $numquerieskeys = count($this->queries); // get the number of keys in the hash called queries
253 - $querieskeys = array_keys($this->queries); // get a array of keys in the hash called queries
254 - if ($this->debug == 1) {
255 - print "number of query keys " + $numquerieskeys + "\n";
 252+ $numquerieskeys = count( $this->queries ); // get the number of keys in the hash called queries
 253+ $querieskeys = array_keys( $this->queries ); // get a array of keys in the hash called queries
 254+ if ( $this->debug == 1 ) {
 255+ print "number of query keys " . $numquerieskeys . "\n";
256256 }
257257
258258 $query_string = "";
259259
260 - for ($i = 0; $i < $numquerieskeys; $i++) {
261 - //for each element in the hash called queries
262 - //append the key and value of the element to the query string
 260+ for ( $i = 0; $i < $numquerieskeys; $i++ ) {
 261+ // for each element in the hash called queries
 262+ // append the key and value of the element to the query string
263263 $key = $querieskeys[$i];
264264 $value = $this->queries[$key];
265 - //encode the key and value before adding it to the string
266 - //$key = urlencode($key);
267 - //$value = urlencode($value);
268 - if ($this->debug == 1) {
 265+ // encode the key and value before adding it to the string
 266+ // $key = urlencode($key);
 267+ // $value = urlencode($value);
 268+ if ( $this->debug == 1 ) {
269269 print " query key " . $key . " query value " . $value . "\n";
270270 }
271271 $query_string = $query_string . $key . "=" . $value;
272 - if ($i < $numquerieskeys - 1) {
 272+ if ( $i < $numquerieskeys - 1 ) {
273273 $query_string = $query_string . "&";
274274 }
275275 }
276276
277 - $content = "";
278 -
279 - //check if the curl module exists
280 - if (extension_loaded('curl')) {
281 - //use curl
282 - if ($this->debug == 1) {
 277+ // check if the curl module exists
 278+ if ( extension_loaded( 'curl' ) ) {
 279+ // use curl
 280+ if ( $this->debug == 1 ) {
283281 print "using curl\n";
284282 }
285283
286 - //open curl
 284+ // open curl
287285 $ch = curl_init();
288286
289287 $url = $scheme . $server . "/" . $this->url;
290288
291 - //set curl options
292 - if ($this->debug == 1){
 289+ // set curl options
 290+ if ( $this->debug == 1 ) {
293291 print "url " . $url . "\n";
294292 }
295 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
296 - curl_setopt($ch, CURLOPT_URL, $url);
297 - curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
298 - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
 293+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
 294+ curl_setopt( $ch, CURLOPT_URL, $url );
 295+ curl_setopt( $ch, CURLOPT_TIMEOUT, $this->timeout );
 296+ curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
299297
300 - //this option lets you store the result in a string
301 - curl_setopt($ch, CURLOPT_POST, 1);
302 - curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
 298+ // this option lets you store the result in a string
 299+ curl_setopt( $ch, CURLOPT_POST, 1 );
 300+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $query_string );
303301
304302 // set proxy settings if necessary
305303 if ( $wgPayflowGatewayUseHTTPProxy ) {
@@ -306,8 +304,8 @@
307305 curl_setopt( $ch, CURLOPT_PROXY, $wgPayflowGatewayHTTPProxy );
308306 }
309307
310 - //get the content
311 - $content = curl_exec($ch);
 308+ // get the content
 309+ $content = curl_exec( $ch );
312310
313311 // For some reason curl_errno returns an error even when function works
314312 // Until we figure this out, will ignore curl errors - (not good i know)
@@ -318,121 +316,121 @@
319317 // print "error: this version of curl does not support HTTPS try build curl with SSL or specify \$ccfs->isSecure = 0\n";
320318 // }
321319 // if ($e > 0) {
322 - //we get a error msg print it
 320+ // we get a error msg print it
323321 // print "Received error message $e from curl: " . curl_error($ch) . "\n";
324322 // return 0;
325323 // }
326 - //close curl
327 - curl_close($ch);
 324+ // close curl
 325+ curl_close( $ch );
328326 } else {
329 - //curl does not exist
330 - //use the fsockopen function,
331 - //the fgets function and the fclose function
332 - if ($this->debug == 1) {
 327+ // curl does not exist
 328+ // use the fsockopen function,
 329+ // the fgets function and the fclose function
 330+ if ( $this->debug == 1 ) {
333331 print "using fsockopen for querySingleServer\n";
334332 }
335333
336334 $url = $scheme . $server . "/" . $this->url . "?" . $query_string;
337 - if ($this->debug == 1) {
 335+ if ( $this->debug == 1 ) {
338336 print "url " . $url . " " . "\n";
339337 }
340338
341 - //now check if we are using regular HTTP
342 - if ($this->isSecure == 0) {
343 - //we using regular HTTP
 339+ // now check if we are using regular HTTP
 340+ if ( $this->isSecure == 0 ) {
 341+ // we using regular HTTP
344342
345 - //parse the url to get
346 - //host, path and query
347 - $url3 = parse_url($url);
 343+ // parse the url to get
 344+ // host, path and query
 345+ $url3 = parse_url( $url );
348346 $host = $url3["host"];
349347 $path = $url3["path"];
350 - $query = $url3["query"];
 348+ $query = $url3["query"];
351349
352 - //open the connection
353 - $fp = fsockopen ($host, 80, $errno, $errstr, $this->timeout);
354 - if ($fp) {
355 - //send the request
356 - $post = "POST $path HTTP/1.0\nHost: " . $host . "\nContent-type: application/x-www-form-urlencoded\nUser-Agent: Mozilla 4.0\nContent-length: " . strlen($query) . "\nConnection: close\n\n$query";
357 - fputs ($fp, $post);
358 - while (!feof($fp)) {
359 - $buf .= fgets($fp, 128);
 350+ // open the connection
 351+ $fp = fsockopen ( $host, 80, $errno, $errstr, $this->timeout );
 352+ if ( $fp ) {
 353+ // send the request
 354+ $post = "POST $path HTTP/1.0\nHost: " . $host . "\nContent-type: application/x-www-form-urlencoded\nUser-Agent: Mozilla 4.0\nContent-length: " . strlen( $query ) . "\nConnection: close\n\n$query";
 355+ fputs ( $fp, $post );
 356+ while ( !feof( $fp ) ) {
 357+ $buf .= fgets( $fp, 128 );
360358 }
361 - $lines = preg_split("/\n/", $buf);
 359+ $lines = preg_split( "/\n/", $buf );
362360 // get the content
363 - $content = $lines[count($lines)-1];
364 - //close the connection
365 - fclose($fp);
 361+ $content = $lines[count( $lines ) -1];
 362+ // close the connection
 363+ fclose( $fp );
366364 } else {
367365 return 0;
368366 }
369367 } else {
370 - //secure HTTPS requires CURL
 368+ // secure HTTPS requires CURL
371369 print "error: you need to install curl if you want secure HTTPS or specify the variable to be $ccfs->isSecure = 0";
372370 return 0;
373371 }
374372 }
375373
376 - if ($this->debug == 1) {
 374+ if ( $this->debug == 1 ) {
377375 print "content = " . $content . "\n";
378376 }
379377 // get the keys and values from
380378 // the string content and store them
381379 // the hash named outputstr
382380
383 - // split content into pairs containing both
 381+ // split content into pairs containing both
384382 // the key and the value
385 - $keyvaluepairs = explode(";",$content);
 383+ $keyvaluepairs = explode( ";", $content );
386384
387 - //get the number of key and value pairs
388 - $numkeyvaluepairs = count($keyvaluepairs);
 385+ // get the number of key and value pairs
 386+ $numkeyvaluepairs = count( $keyvaluepairs );
389387
390 - //for each pair store key and value into the
391 - //hash named outputstr
 388+ // for each pair store key and value into the
 389+ // hash named outputstr
392390 $this->outputstr = array();
393 - for ($i = 0; $i < $numkeyvaluepairs; $i++) {
394 - //split the pair into a key and a value
395 - list($key,$value) = explode("=",$keyvaluepairs[$i]);
396 - if ($this->debug == 1) {
 391+ for ( $i = 0; $i < $numkeyvaluepairs; $i++ ) {
 392+ // split the pair into a key and a value
 393+ list( $key, $value ) = explode( "=", $keyvaluepairs[$i] );
 394+ if ( $this->debug == 1 ) {
397395 print " output " . $key . " = " . $value . "\n";
398396 }
399 - //store the key and the value into the
400 - //hash named outputstr
 397+ // store the key and the value into the
 398+ // hash named outputstr
401399 $this->outputstr[$key] = $value;
402400 }
403 - //check if outputstr has the score if outputstr does not have
404 - //the score return 0
405 - if ($this->outputstr[$this->check_field] == "") {
 401+ // check if outputstr has the score if outputstr does not have
 402+ // the score return 0
 403+ if ( $this->outputstr[$this->check_field] == "" ) {
406404 return 0;
407405 }
408 - //one other way to do it
409 - //if (!array_key_exists("score",$this->outputstr)) {
 406+ // one other way to do it
 407+ // if (!array_key_exists("score",$this->outputstr)) {
410408 // return 0;
411 - //}
 409+ // }
412410 return 1;
413411 }
414412
415413 function _getTempDir() {
416 - if (ini_get('upload_tmp_dir')) {
417 - return ini_get('upload_tmp_dir');
 414+ if ( ini_get( 'upload_tmp_dir' ) ) {
 415+ return ini_get( 'upload_tmp_dir' );
418416 }
419417
420 - if (substr(PHP_OS, 0, 3) != 'WIN') {
 418+ if ( substr( PHP_OS, 0, 3 ) != 'WIN' ) {
421419 return '/tmp';
422420 }
423421
424 - if (isset($_ENV['TMP'])) {
 422+ if ( isset( $_ENV['TMP'] ) ) {
425423 return $_ENV['TMP'];
426424 }
427425
428 - if (isset($_ENV['TEMP'])) {
 426+ if ( isset( $_ENV['TEMP'] ) ) {
429427 return $_ENV['TEMP'];
430428 }
431429
432 - if (is_dir('c:\\windows\\temp')) {
 430+ if ( is_dir( 'c:\\windows\\temp' ) ) {
433431 return 'c:\\windows\\temp';
434432 }
435433
436 - if (is_dir('c:\\winnt\\temp')) {
 434+ if ( is_dir( 'c:\\winnt\\temp' ) ) {
437435 return 'c:\\winnt\\temp';
438436 }
439437
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/LocationVerification.php
@@ -19,7 +19,7 @@
2020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2121 */
2222
23 -require_once ("HTTPBase.php");
 23+require_once ( "HTTPBase.php" );
2424 class LocationVerification extends HTTPBase {
2525 var $server;
2626 var $numservers;
@@ -29,21 +29,21 @@
3030 parent::__construct();
3131 $this->isSecure = 1; // use HTTPS by default
3232
33 - //set the allowed_fields hash
 33+ // set the allowed_fields hash
3434 $this->allowed_fields["i"] = 1;
3535 $this->allowed_fields["city"] = 1;
3636 $this->allowed_fields["region"] = 1;
3737 $this->allowed_fields["postal"] = 1;
3838 $this->allowed_fields["country"] = 1;
3939 $this->allowed_fields["license_key"] = 1;
40 - $this->num_allowed_fields = count($this->allowed_fields);
 40+ $this->num_allowed_fields = count( $this->allowed_fields );
4141
42 - //set the url of the web service
 42+ // set the url of the web service
4343 $this->url = "app/locvr";
4444 $this->check_field = "distance";
4545
46 - $this->server = array("www.maxmind.com", "www2.maxmind.com");
47 - $this->numservers = count($this->server);
 46+ $this->server = array( "www.maxmind.com", "www2.maxmind.com" );
 47+ $this->numservers = count( $this->server );
4848 $this->API_VERSION = 'PHP/1.4';
4949 }
5050 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/CreditCardFraudDetection.php
@@ -19,7 +19,7 @@
2020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2121 */
2222
23 -require_once ("HTTPBase.php");
 23+require_once ( "HTTPBase.php" );
2424 class CreditCardFraudDetection extends HTTPBase {
2525 var $server;
2626 var $numservers;
@@ -29,7 +29,7 @@
3030 parent::__construct();
3131 $this->isSecure = 1; // use HTTPS by default
3232
33 - //set the allowed_fields hash
 33+ // set the allowed_fields hash
3434 $this->allowed_fields["i"] = 1;
3535 $this->allowed_fields["domain"] = 1;
3636 $this->allowed_fields["city"] = 1;
@@ -57,24 +57,24 @@
5858 $this->allowed_fields["accept_language"] = 1;
5959
6060
61 - $this->num_allowed_fields = count($this->allowed_fields);
 61+ $this->num_allowed_fields = count( $this->allowed_fields );
6262
63 - //set the url of the web service
 63+ // set the url of the web service
6464 $this->url = "app/ccv2r";
6565 $this->check_field = "score";
66 - $this->server = array("minfraud3.maxmind.com", "minfraud1.maxmind.com", "minfraud2.maxmind.com");
67 - $this->numservers = count($this->server);
 66+ $this->server = array( "minfraud3.maxmind.com", "minfraud1.maxmind.com", "minfraud2.maxmind.com" );
 67+ $this->numservers = count( $this->server );
6868 $this->API_VERSION = 'PHP/1.49';
6969 }
7070
71 - function filter_field($key, $value) {
72 - if ($key == 'emailMD5'){
73 - if (preg_match('/@/',$value)){
74 - return md5(strtolower($value));
 71+ function filter_field( $key, $value ) {
 72+ if ( $key == 'emailMD5' ) {
 73+ if ( preg_match( '/@/', $value ) ) {
 74+ return md5( strtolower( $value ) );
7575 }
76 - } else if ($key == 'usernameMD5' || $key == 'passwordMD5') {
77 - if (strlen($value) != 32) {
78 - return md5(strtolower($value));
 76+ } else if ( $key == 'usernameMD5' || $key == 'passwordMD5' ) {
 77+ if ( strlen( $value ) != 32 ) {
 78+ return md5( strtolower( $value ) );
7979 }
8080 }
8181 return $value;
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/ccfd/TelephoneVerification.php
@@ -1,24 +1,24 @@
22 <?php
3 -require_once ("HTTPBase.php");
 3+require_once ( "HTTPBase.php" );
44 class TelephoneVerification extends HTTPBase {
55 var $server;
66 var $numservers;
77 var $API_VERSION;
8 - function __construct(){
 8+ function __construct() {
99 parent::__construct();
1010 $this->isSecure = 1; // use HTTPS by default
1111
12 - //set the allowed_fields hash
 12+ // set the allowed_fields hash
1313 $this->allowed_fields["l"] = 1;
1414 $this->allowed_fields["phone"] = 1;
1515 $this->allowed_fields["verify_code"] = 1;
16 - $this->num_allowed_fields = count($this->allowed_fields);
 16+ $this->num_allowed_fields = count( $this->allowed_fields );
1717
18 - //set the url of the web service
 18+ // set the url of the web service
1919 $this->url = "app/telephone_http";
2020 $this->check_field = "refid";
21 - $this->server = array("www.maxmind.com", "www2.maxmind.com");
22 - $this->numservers = count($this->server);
 21+ $this->server = array( "www.maxmind.com", "www2.maxmind.com" );
 22+ $this->numservers = count( $this->server );
2323 $this->API_VERSION = 'PHP/1.4';
2424 $this->timeout = 30;
2525 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/tests/minfraudTest.php
@@ -8,11 +8,11 @@
99 {
1010 protected function setUp() {
1111 $dir = dirname( __FILE__ ) . '/';
12 - require_once( $dir . '../../extras.php');
13 - require_once( $dir . '../minfraud.body.php');
 12+ require_once( $dir . '../../extras.php' );
 13+ require_once( $dir . '../minfraud.body.php' );
1414 require_once( $dir . "../../../includes/countryCodes.inc" );
1515 global $wgPayflowGatewayLog;
16 - $wgPayflowGatewayLog = dirname(__FILE__) . "/test_log";
 16+ $wgPayflowGatewayLog = dirname( __FILE__ ) . "/test_log";
1717 $license_key = 'XBCKSF4gnHA7';
1818 $this->fixture = new PayflowProGateway_Extras_MinFraud( $license_key );
1919 }
@@ -42,9 +42,9 @@
4343 $this->assertArrayHasKey( "emailMD5", $query );
4444 $this->assertArrayHasKey( "bin", $query );
4545 $this->assertArrayHasKey( "txnID", $query );
46 - $this->assertArrayNotHasKey( "foo", $query ); //make sure we're not adding extraneous info
47 - $this->assertNotContains( "@", $query[ 'domain' ] ); //make sure we're only getting domains from email addresses
48 - $this->assertEquals( 6, strlen( $query[ 'bin' ] )); //make sure our bin is 6 digits long
 46+ $this->assertArrayNotHasKey( "foo", $query ); // make sure we're not adding extraneous info
 47+ $this->assertNotContains( "@", $query[ 'domain' ] ); // make sure we're only getting domains from email addresses
 48+ $this->assertEquals( 6, strlen( $query[ 'bin' ] ) ); // make sure our bin is 6 digits long
4949 }
5050
5151 public function queryDataProvider() {
@@ -78,7 +78,7 @@
7979 * @dataProvider hashValidateFalseData
8080 */
8181 public function testValidateMinfraudHashFalse( $data ) {
82 - $this->assertFalse( $this->fixture->validate_minfraud_query( $data ));
 82+ $this->assertFalse( $this->fixture->validate_minfraud_query( $data ) );
8383 }
8484
8585 public function hashValidateFalseData() {
@@ -86,7 +86,7 @@
8787 array(
8888 array(),
8989 array( 'license_key' => 'a' ),
90 - array(
 90+ array(
9191 'license_key' => 'a',
9292 'i' => 'a',
9393 ),
@@ -120,13 +120,13 @@
121121 * @dataProvider hashValidateTrueData
122122 */
123123 public function testValidateMinfraudHashTrue( $data ) {
124 - $this->assertTrue( $this->fixture->validate_minfraud_query( $data ));
 124+ $this->assertTrue( $this->fixture->validate_minfraud_query( $data ) );
125125 }
126126
127127 public function hashValidateTrueData() {
128 - return array(
129 - array(
130 - array(
 128+ return array(
 129+ array(
 130+ array(
131131 'license_key' => 'a',
132132 'i' => 'a',
133133 'city' => 'a',
@@ -143,13 +143,13 @@
144144 */
145145 public function testDetermineActions( $risk_score, $action_ranges, $expected ) {
146146 $this->fixture->action_ranges = $action_ranges;
147 - $this->assertEquals( $expected, $this->fixture->determine_action( $risk_score ));
 147+ $this->assertEquals( $expected, $this->fixture->determine_action( $risk_score ) );
148148 }
149149
150150 public function determineActionsData() {
151151 return array(
152 - array( '0.1', array( 'process' => array(0, 100)), 'process'),
153 - array( '75.04', array( 'process' => array(0, 50), 'reject' => array( '50.01', '100')), 'reject'),
 152+ array( '0.1', array( 'process' => array( 0, 100 ) ), 'process' ),
 153+ array( '75.04', array( 'process' => array( 0, 50 ), 'reject' => array( '50.01', '100' ) ), 'reject' ),
154154 );
155155 }
156156
@@ -157,21 +157,21 @@
158158 global $wgPayflowGatewayLog;
159159 $this->fixture->log( '', '', "\"foo\"" );
160160 $new_fh = fopen( $wgPayflowGatewayLog, 'r' );
161 - $this->assertEquals('"'.date('c').'"'."\t\"\"\t\"\"\t\"foo\"\n", fread( $new_fh, filesize( $wgPayflowGatewayLog ) ));
 161+ $this->assertEquals( '"' . date( 'c' ) . '"' . "\t\"\"\t\"\"\t\"foo\"\n", fread( $new_fh, filesize( $wgPayflowGatewayLog ) ) );
162162 fclose( $new_fh );
163163 }
164164
165165 public function testGenerateHash() {
166166 global $wgPayflowGatewaySalt;
167167 $wgPayflowGatewaySalt = 'salt';
168 - $this->assertEquals( '5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', $this->fixture->generate_hash( 'foo' ));
 168+ $this->assertEquals( '5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', $this->fixture->generate_hash( 'foo' ) );
169169 }
170170
171171 public function testCompareHash() {
172172 global $wgPayflowGatewaySalt;
173173 $wgPayflowGatewaySalt = 'salt';
174 - $this->assertTrue( $this->fixture->compare_hash('5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', 'foo'));
175 - $this->assertFalse( $this->fixture->compare_hash('5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', 'bar'));
 174+ $this->assertTrue( $this->fixture->compare_hash( '5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', 'foo' ) );
 175+ $this->assertFalse( $this->fixture->compare_hash( '5a9ee1e4a15adbf03b3ef9f7baa6caffa9f6bcd72c736498f045c073e57753e7b244bc97fe82b075eabd80778a4d56eb14406e9a1ac4b13737b2c3fd8c3717e8', 'bar' ) );
176176 }
177177
178178 public function testBypassMinfraud() {
@@ -183,12 +183,12 @@
184184 'foo',
185185 'num_attempt' => 2
186186 );
187 - //@fixme this needs updating
188 - //$this->assertTrue( $this->fixture->can_bypass_minfraud( &$this->fixture, &$data ));
189 - //$this->assertEquals( 'challenge', $this->fixture->action );
190 - //$this->assertEquals( '029ef6f5c2a165215b5a92ff1a194e4a6de8c668d6193582da42713f119c1b07d8358b5cd94a3bd51c9aa50709c8533295215ce3cce8c2b61e69078d789bc3f3', $data[ 'data_hash' ]);
 187+ // @fixme this needs updating
 188+ // $this->assertTrue( $this->fixture->can_bypass_minfraud( &$this->fixture, &$data ));
 189+ // $this->assertEquals( 'challenge', $this->fixture->action );
 190+ // $this->assertEquals( '029ef6f5c2a165215b5a92ff1a194e4a6de8c668d6193582da42713f119c1b07d8358b5cd94a3bd51c9aa50709c8533295215ce3cce8c2b61e69078d789bc3f3', $data[ 'data_hash' ]);
191191
192192 $data[] = 'bar';
193 - $this->assertFalse( $this->fixture->can_bypass_minfraud( &$this->fixture, &$data ));
 193+ $this->assertFalse( $this->fixture->can_bypass_minfraud( &$this->fixture, &$data ) );
194194 }
195195 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.body.php
@@ -15,7 +15,7 @@
1616
1717 /**
1818 * User-definable riskScore ranges for actions to take
19 - *
 19+ *
2020 * Overload with $wgMinFraudActionRanges
2121 * @var public array
2222 */
@@ -39,7 +39,7 @@
4040
4141 function __construct( $license_key = NULL ) {
4242 parent::__construct();
43 - $dir = dirname( __FILE__ ) .'/';
 43+ $dir = dirname( __FILE__ ) . '/';
4444 require_once( $dir . "ccfd/CreditCardFraudDetection.php" );
4545 require_once( $dir . "../../includes/countryCodes.inc" );
4646 global $wgMinFraudLicenseKey, $wgMinFraudActionRanges;
@@ -48,9 +48,9 @@
4949 if ( !$license_key && !$wgMinFraudLicenseKey ) {
5050 throw new MWException( "minFraud license key required but not present." );
5151 }
52 - $this->minfraud_license_key = ( $license_key ) ? $license_key : $wgMinFraudLicenseKey;
 52+ $this->minfraud_license_key = ( $license_key ) ? $license_key : $wgMinFraudLicenseKey;
5353
54 - if ( isset( $wgMinFraudActionRanges )) $this->action_ranges = $wgMinFraudActionRanges;
 54+ if ( isset( $wgMinFraudActionRanges ) ) $this->action_ranges = $wgMinFraudActionRanges;
5555 }
5656
5757 /**
@@ -62,17 +62,17 @@
6363 */
6464 public function validate( &$pfp_gateway_object, &$data ) {
6565 // see if we can bypass minfraud
66 - if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data )) return TRUE;
 66+ if ( $this->can_bypass_minfraud( $pfp_gateway_object, $data ) ) return TRUE;
6767
6868 $minfraud_query = $this->build_query( $data );
6969 $this->query_minfraud( $minfraud_query );
7070 $pfp_gateway_object->action = $this->determine_action( $this->minfraud_response[ 'riskScore' ] );
7171
7272 // reset the data hash
73 - if ( isset( $data[ 'data_hash' ] )) unset( $data[ 'data_hash' ] );
 73+ if ( isset( $data[ 'data_hash' ] ) ) unset( $data[ 'data_hash' ] );
7474 $data[ 'action' ] = $this->generate_hash( $pfp_gateway_object->action );
75 - $data[ 'data_hash' ] = $this->generate_hash( serialize( $data ));
76 -
 75+ $data[ 'data_hash' ] = $this->generate_hash( serialize( $data ) );
 76+
7777 // Write the query/response to the log
7878 $this->log_query( $minfraud_query, $pfp_gateway_object, $data );
7979 return TRUE;
@@ -85,8 +85,8 @@
8686 if ( $this->log_fh ) {
8787 $log_message = '"' . addslashes( $data[ 'comment' ] ) . '"';
8888 $log_message .= "\t" . '"' . addslashes( $data[ 'amount' ] . ' ' . $data[ 'currency' ] ) . '"';
89 - $log_message .= "\t" . '"' . addslashes( json_encode( $minfraud_query )) . '"';
90 - $log_message .= "\t" . '"' . addslashes( json_encode( $this->minfraud_response )) . '"';
 89+ $log_message .= "\t" . '"' . addslashes( json_encode( $minfraud_query ) ) . '"';
 90+ $log_message .= "\t" . '"' . addslashes( json_encode( $this->minfraud_response ) ) . '"';
9191 $log_message .= "\t" . '"' . addslashes( $pfp_gateway_object->action ) . '"';
9292 $log_message .= "\t" . '"' . addslashes( $data[ 'referrer' ] ) . '"';
9393 $this->log( $data[ 'contribution_tracking_id' ], 'minFraud query', $log_message );
@@ -99,7 +99,7 @@
100100 * The first time a user hits the submission form, a hash of the full data array plus a
101101 * hashed action name are injected to the data. This allows us to track the transaction's
102102 * status. If a valid hash of the data is present and a valid action is present, we can
103 - * assume the transaction has already gone through the minFraud check and can be passed
 103+ * assume the transaction has already gone through the minFraud check and can be passed
104104 * on to the appropriate action.
105105 *
106106 * @param object $pfp_gateway_object The PayflowPro gateway object
@@ -119,15 +119,15 @@
120120 // unset these values from the data aray since they are not part of the overall data hash
121121 unset( $data[ 'data_hash' ] );
122122 // compare the data hash to make sure it's legit
123 - if ( $this->compare_hash( $data_hash, serialize( $data ))) {
 123+ if ( $this->compare_hash( $data_hash, serialize( $data ) ) ) {
124124 $data[ 'numAttempt' ] = $num_attempt; // reset the current num attempt
125 - $data[ 'data_hash' ] = $this->generate_hash( serialize( $data )); // hash the data array
 125+ $data[ 'data_hash' ] = $this->generate_hash( serialize( $data ) ); // hash the data array
126126
127127 // check to see if we have a valid action set for us to bypass minfraud
128128 $actions = array( 'process', 'challenge', 'review', 'reject' );
129129 $action_hash = $data[ 'action' ]; // a hash of the action to take passed in by the form submission
130130 foreach ( $actions as $action ) {
131 - if ( $this->compare_hash( $action_hash, $action )) {
 131+ if ( $this->compare_hash( $action_hash, $action ) ) {
132132 // set the action that should be taken
133133 $pfp_gateway_object->action = $action;
134134 return TRUE;
@@ -179,10 +179,10 @@
180180
181181 // user's user agent
182182 global $wgRequest;
183 - $minfraud_array[ "user_agent" ] = $wgRequest->getHeader('user-agent');
 183+ $minfraud_array[ "user_agent" ] = $wgRequest->getHeader( 'user-agent' );
184184
185185 // user's language
186 - $minfraud_array[ 'accept_language' ] = $wgRequest->getHeader('accept-language');
 186+ $minfraud_array[ 'accept_language' ] = $wgRequest->getHeader( 'accept-language' );
187187
188188 // fetch the array of country codes
189189 $country_codes = countryCodes();
@@ -225,8 +225,8 @@
226226 *
227227 * This is a pretty dumb validator. It just checks to see if
228228 * there is a value for a required field and if its length is > 0
229 - *
230 - * @param array $minfraud_query which is the array you would pass to
 229+ *
 230+ * @param array $minfraud_query which is the array you would pass to
231231 * minfraud in a query
232232 * @result bool
233233 */
@@ -242,7 +242,7 @@
243243 );
244244
245245 foreach ( $reqd_fields as $reqd_field ) {
246 - if ( !isset( $minfraud_query[ $reqd_field ] ) ||
 246+ if ( !isset( $minfraud_query[ $reqd_field ] ) ||
247247 strlen( $minfraud_query[ $reqd_field ] ) < 1 ) {
248248 return FALSE;
249249 }
@@ -254,7 +254,7 @@
255255 /**
256256 * Determine the action for the processor to take
257257 *
258 - * Determined based on predefined riskScore ranges for
 258+ * Determined based on predefined riskScore ranges for
259259 * a given action.
260260 * @param float risk score (returned from minFraud)
261261 * @return array of actions to be taken
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.php
@@ -6,17 +6,17 @@
77 *
88 * To install:
99 * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/minfraud/minfraud.php" );
10 - *
 10+ *
1111 */
1212
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( "This file is part of the MinFraud for PayflowPro Gateway extension. It is not a valid entry point.\n" );
 13+if ( !defined( 'MEDIAWIKI' ) ) {
 14+ die( "This file is part of the MinFraud for PayflowPro Gateway extension. It is not a valid entry point.\n" );
1515 }
1616
1717 $wgExtensionCredits['payflowprogateway_extras_minfraud'][] = array(
1818 'name' => 'minfraud',
19 - 'author' =>'Arthur Richards',
20 - 'url' => '',
 19+ 'author' => 'Arthur Richards',
 20+ 'url' => '',
2121 'description' => 'This extension uses the MaxMind minFraud service as a validator for the Payflow Pro gateway.'
2222 );
2323
@@ -30,8 +30,8 @@
3131 *
3232 * The keys to the array are the 'actions' to be taken (eg 'process').
3333 * The value for one of these keys is an array representing the lower
34 - * and upper bounds for that action. For instance,
35 - * $wgMinFraudActionRagnes = array(
 34+ * and upper bounds for that action. For instance,
 35+ * $wgMinFraudActionRagnes = array(
3636 * 'process' => array( 0, 100)
3737 * ...
3838 * );
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.body.php
@@ -15,13 +15,13 @@
1616 return TRUE;
1717 }
1818
19 - //make sure the payflow response property has been set (signifying a transaction has been made)
 19+ // make sure the payflow response property has been set (signifying a transaction has been made)
2020 if ( !$pfp_gateway_object->payflow_response ) return FALSE;
2121
22 - $this->log(
23 - $data[ 'contribution_tracking_id' ],
24 - "Payflow response: " . addslashes( $pfp_gateway_object->payflow_response[ 'RESPMSG' ] ),
25 - '"' . addslashes( json_encode( $pfp_gateway_object->payflow_response )) . '"'
 22+ $this->log(
 23+ $data[ 'contribution_tracking_id' ],
 24+ "Payflow response: " . addslashes( $pfp_gateway_object->payflow_response[ 'RESPMSG' ] ),
 25+ '"' . addslashes( json_encode( $pfp_gateway_object->payflow_response ) ) . '"'
2626 );
2727 return TRUE;
2828 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php
@@ -8,14 +8,14 @@
99 * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/conversion_log/conversion_log.php"
1010 */
1111
12 -if ( !defined( 'MEDIAWIKI' ) ) {
13 - die( "This file is part of the Conversion Log for PayflowPro Gateway extension. It is not a valid entry point.\n");
 12+if ( !defined( 'MEDIAWIKI' ) ) {
 13+ die( "This file is part of the Conversion Log for PayflowPro Gateway extension. It is not a valid entry point.\n" );
1414 }
1515
1616 $wgExtensionCredits['payflowprogateway_extras_conversionLog'][] = array(
1717 'name' => 'conversion log',
18 - 'author' =>'Arthur Richards',
19 - 'url' => '',
 18+ 'author' => 'Arthur Richards',
 19+ 'url' => '',
2020 'description' => "This extension handles logging for Payflow Gateway extension 'extras'"
2121 );
2222
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/extras.body.php
@@ -13,7 +13,7 @@
1414 public function __construct() {
1515 global $wgPayflowGatewayLog;
1616 // prepare the log file if the user has specified one
17 - if ( strlen( $wgPayflowGatewayLog) > 0 ) $this->prepare_log_file( $wgPayflowGatewayLog );
 17+ if ( strlen( $wgPayflowGatewayLog ) > 0 ) $this->prepare_log_file( $wgPayflowGatewayLog );
1818 }
1919
2020 /**
@@ -22,19 +22,19 @@
2323 * @param string path to log file
2424 * @return resource Pointer for the log file
2525 */
26 - protected function prepare_log_file( $log_file ){
 26+ protected function prepare_log_file( $log_file ) {
2727 $this->log_fh = fopen( $log_file, 'a+' );
2828 }
2929
3030 /**
3131 * Writes message to a log file
32 - *
 32+ *
3333 * If a log file does not exist and could not be created,
3434 * do nothing.
3535 * @fixme Perhaps lack of log file can be handled better?
3636 * @param string The message to log
3737 */
38 - public function log( $id='', $status='', $data='' ) {
 38+ public function log( $id = '', $status = '', $data = '' ) {
3939 if ( !$this->log_fh ) {
4040 echo "what log file?";
4141 return;
@@ -63,7 +63,7 @@
6464 * @return bool
6565 */
6666 public function compare_hash( $hash, $data ) {
67 - if ( $hash == $this->generate_hash( $data )) {
 67+ if ( $hash == $this->generate_hash( $data ) ) {
6868 return TRUE;
6969 }
7070
@@ -75,5 +75,5 @@
7676 */
7777 public function __destruct() {
7878 if ( $this->log_fh ) fclose( $this->log_fh );
79 - }
 79+ }
8080 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha-php/recaptchalib.php
@@ -35,22 +35,22 @@
3636 /**
3737 * The reCAPTCHA server URL's
3838 */
39 -define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
40 -define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
41 -define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
 39+define( "RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api" );
 40+define( "RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api" );
 41+define( "RECAPTCHA_VERIFY_SERVER", "www.google.com" );
4242
4343 /**
4444 * Encodes the given data into a query string format
4545 * @param $data - array of string elements to be encoded
4646 * @return string - encoded request
4747 */
48 -function _recaptcha_qsencode ($data) {
 48+function _recaptcha_qsencode ( $data ) {
4949 $req = "";
5050 foreach ( $data as $key => $value )
51 - $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
 51+ $req .= $key . '=' . urlencode( stripslashes( $value ) ) . '&';
5252
5353 // Cut the last '&'
54 - $req=substr($req,0,strlen($req)-1);
 54+ $req = substr( $req, 0, strlen( $req ) -1 );
5555 return $req;
5656 }
5757
@@ -64,29 +64,29 @@
6565 * @param int port
6666 * @return array response
6767 */
68 -function _recaptcha_http_post($host, $path, $data, $port = 80) {
 68+function _recaptcha_http_post( $host, $path, $data, $port = 80 ) {
6969
70 - $req = _recaptcha_qsencode ($data);
 70+ $req = _recaptcha_qsencode ( $data );
7171
7272 $http_request = "POST $path HTTP/1.0\r\n";
7373 $http_request .= "Host: $host\r\n";
7474 $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
75 - $http_request .= "Content-Length: " . strlen($req) . "\r\n";
 75+ $http_request .= "Content-Length: " . strlen( $req ) . "\r\n";
7676 $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
7777 $http_request .= "\r\n";
7878 $http_request .= $req;
7979
8080 $response = '';
81 - if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
82 - die ('Could not open socket');
 81+ if ( false == ( $fs = @fsockopen( $host, $port, $errno, $errstr, 10 ) ) ) {
 82+ die ( 'Could not open socket' );
8383 }
8484
85 - fwrite($fs, $http_request);
 85+ fwrite( $fs, $http_request );
8686
87 - while ( !feof($fs) )
88 - $response .= fgets($fs, 1160); // One TCP-IP packet
89 - fclose($fs);
90 - $response = explode("\r\n\r\n", $response, 2);
 87+ while ( !feof( $fs ) )
 88+ $response .= fgets( $fs, 1160 ); // One TCP-IP packet
 89+ fclose( $fs );
 90+ $response = explode( "\r\n\r\n", $response, 2 );
9191
9292 return $response;
9393 }
@@ -103,26 +103,26 @@
104104
105105 * @return string - The HTML to be embedded in the user's form.
106106 */
107 -function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
 107+function recaptcha_get_html ( $pubkey, $error = null, $use_ssl = false )
108108 {
109 - if ($pubkey == null || $pubkey == '') {
110 - die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
 109+ if ( $pubkey == null || $pubkey == '' ) {
 110+ die ( "To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>" );
111111 }
112 -
113 - if ($use_ssl) {
 112+
 113+ if ( $use_ssl ) {
114114 $server = RECAPTCHA_API_SECURE_SERVER;
115115 } else {
116116 $server = RECAPTCHA_API_SERVER;
117117 }
118118
119119 $errorpart = "";
120 - if ($error) {
 120+ if ( $error ) {
121121 $errorpart = "&amp;error=" . $error;
122122 }
123 - return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
 123+ return '<script type="text/javascript" src="' . $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
124124
125125 <noscript>
126 - <iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
 126+ <iframe src="' . $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
127127 <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
128128 <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
129129 </noscript>';
@@ -149,27 +149,27 @@
150150 * @param array $extra_params an array of extra variables to post to the server
151151 * @return ReCaptchaResponse
152152 */
153 -function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
 153+function recaptcha_check_answer ( $privkey, $remoteip, $challenge, $response, $extra_params = array() )
154154 {
155 - if ($privkey == null || $privkey == '') {
156 - die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
 155+ if ( $privkey == null || $privkey == '' ) {
 156+ die ( "To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>" );
157157 }
158158
159 - if ($remoteip == null || $remoteip == '') {
160 - die ("For security reasons, you must pass the remote ip to reCAPTCHA");
 159+ if ( $remoteip == null || $remoteip == '' ) {
 160+ die ( "For security reasons, you must pass the remote ip to reCAPTCHA" );
161161 }
162162
163 -
164 -
165 - //discard spam submissions
166 - if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
 163+
 164+
 165+ // discard spam submissions
 166+ if ( $challenge == null || strlen( $challenge ) == 0 || $response == null || strlen( $response ) == 0 ) {
167167 $recaptcha_response = new ReCaptchaResponse();
168168 $recaptcha_response->is_valid = false;
169169 $recaptcha_response->error = 'incorrect-captcha-sol';
170170 return $recaptcha_response;
171171 }
172172
173 - $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
 173+ $response = _recaptcha_http_post ( RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
174174 array (
175175 'privatekey' => $privkey,
176176 'remoteip' => $remoteip,
@@ -178,10 +178,10 @@
179179 ) + $extra_params
180180 );
181181
182 - $answers = explode ("\n", $response [1]);
 182+ $answers = explode ( "\n", $response [1] );
183183 $recaptcha_response = new ReCaptchaResponse();
184184
185 - if (trim ($answers [0]) == 'true') {
 185+ if ( trim ( $answers [0] ) == 'true' ) {
186186 $recaptcha_response->is_valid = true;
187187 }
188188 else {
@@ -199,45 +199,45 @@
200200 * @param string $domain The domain where the page is hosted
201201 * @param string $appname The name of your application
202202 */
203 -function recaptcha_get_signup_url ($domain = null, $appname = null) {
204 - return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
 203+function recaptcha_get_signup_url ( $domain = null, $appname = null ) {
 204+ return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode ( array ( 'domains' => $domain, 'app' => $appname ) );
205205 }
206206
207 -function _recaptcha_aes_pad($val) {
 207+function _recaptcha_aes_pad( $val ) {
208208 $block_size = 16;
209 - $numpad = $block_size - (strlen ($val) % $block_size);
210 - return str_pad($val, strlen ($val) + $numpad, chr($numpad));
 209+ $numpad = $block_size - ( strlen ( $val ) % $block_size );
 210+ return str_pad( $val, strlen ( $val ) + $numpad, chr( $numpad ) );
211211 }
212212
213213 /* Mailhide related code */
214214
215 -function _recaptcha_aes_encrypt($val,$ky) {
216 - if (! function_exists ("mcrypt_encrypt")) {
217 - die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
 215+function _recaptcha_aes_encrypt( $val, $ky ) {
 216+ if ( ! function_exists ( "mcrypt_encrypt" ) ) {
 217+ die ( "To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed." );
218218 }
219 - $mode=MCRYPT_MODE_CBC;
220 - $enc=MCRYPT_RIJNDAEL_128;
221 - $val=_recaptcha_aes_pad($val);
222 - return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
 219+ $mode = MCRYPT_MODE_CBC;
 220+ $enc = MCRYPT_RIJNDAEL_128;
 221+ $val = _recaptcha_aes_pad( $val );
 222+ return mcrypt_encrypt( $enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" );
223223 }
224224
225225
226 -function _recaptcha_mailhide_urlbase64 ($x) {
227 - return strtr(base64_encode ($x), '+/', '-_');
 226+function _recaptcha_mailhide_urlbase64 ( $x ) {
 227+ return strtr( base64_encode ( $x ), '+/', '-_' );
228228 }
229229
230230 /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
231 -function recaptcha_mailhide_url($pubkey, $privkey, $email) {
232 - if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
233 - die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
234 - "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
 231+function recaptcha_mailhide_url( $pubkey, $privkey, $email ) {
 232+ if ( $pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null ) {
 233+ die ( "To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
 234+ "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>" );
235235 }
236 -
237236
238 - $ky = pack('H*', $privkey);
239 - $cryptmail = _recaptcha_aes_encrypt ($email, $ky);
240 -
241 - return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
 237+
 238+ $ky = pack( 'H*', $privkey );
 239+ $cryptmail = _recaptcha_aes_encrypt ( $email, $ky );
 240+
 241+ return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ( $cryptmail );
242242 }
243243
244244 /**
@@ -245,15 +245,15 @@
246246 * eg, given johndoe@example,com return ["john", "example.com"].
247247 * the email is then displayed as john...@example.com
248248 */
249 -function _recaptcha_mailhide_email_parts ($email) {
250 - $arr = preg_split("/@/", $email );
 249+function _recaptcha_mailhide_email_parts ( $email ) {
 250+ $arr = preg_split( "/@/", $email );
251251
252 - if (strlen ($arr[0]) <= 4) {
253 - $arr[0] = substr ($arr[0], 0, 1);
254 - } else if (strlen ($arr[0]) <= 6) {
255 - $arr[0] = substr ($arr[0], 0, 3);
 252+ if ( strlen ( $arr[0] ) <= 4 ) {
 253+ $arr[0] = substr ( $arr[0], 0, 1 );
 254+ } else if ( strlen ( $arr[0] ) <= 6 ) {
 255+ $arr[0] = substr ( $arr[0], 0, 3 );
256256 } else {
257 - $arr[0] = substr ($arr[0], 0, 4);
 257+ $arr[0] = substr ( $arr[0], 0, 4 );
258258 }
259259 return $arr;
260260 }
@@ -264,13 +264,13 @@
265265 *
266266 * http://www.google.com/recaptcha/mailhide/apikey
267267 */
268 -function recaptcha_mailhide_html($pubkey, $privkey, $email) {
269 - $emailparts = _recaptcha_mailhide_email_parts ($email);
270 - $url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
271 -
272 - return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
273 - "' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
 268+function recaptcha_mailhide_html( $pubkey, $privkey, $email ) {
 269+ $emailparts = _recaptcha_mailhide_email_parts ( $email );
 270+ $url = recaptcha_mailhide_url ( $pubkey, $privkey, $email );
274271
 272+ return htmlentities( $emailparts[0] ) . "<a href='" . htmlentities ( $url ) .
 273+ "' onclick=\"window.open('" . htmlentities ( $url ) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ( $emailparts [1] );
 274+
275275 }
276276
277277
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha.php
@@ -6,14 +6,14 @@
77 * require_once( "$IP/extensions/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha.php"
88 */
99
10 -if ( !defined( 'MEDIAWIKI' ) ) {
11 - die( "This file is part of the ReCaptcha for PayflowPro Gateway extension. It is not a valid entry point.\n");
 10+if ( !defined( 'MEDIAWIKI' ) ) {
 11+ die( "This file is part of the ReCaptcha for PayflowPro Gateway extension. It is not a valid entry point.\n" );
1212 }
1313
1414 $wgExtensionCredits['payflowgateway_extras_recaptcha'][] = array(
1515 'name' => 'reCaptcha',
16 - 'author' =>'Arthur Richards',
17 - 'url' => '',
 16+ 'author' => 'Arthur Richards',
 17+ 'url' => '',
1818 'description' => "This extension exposes a reCpathca for 'challenged' transactions in the Payflowpro Gateway"
1919 );
2020
@@ -30,4 +30,4 @@
3131 $wgAutoloadClasses['PayflowProGateway_Extras_ReCaptcha'] = $dir . "recaptcha.body.php";
3232
3333 // Set reCpatcha as plugin for 'challenge' action
34 -$wgHooks["PayflowGatewayChallenge"][] = array( "PayflowProGateway_Extras_ReCaptcha::onChallenge");
 34+$wgHooks["PayflowGatewayChallenge"][] = array( "PayflowProGateway_Extras_ReCaptcha::onChallenge" );
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha.body.php
@@ -28,10 +28,10 @@
2929 */
3030 public function challenge( &$pfp_gateway_object, &$data ) {
3131 // if captcha posted, validate
32 - if ( isset( $_POST[ 'recaptcha_response_field' ] )) {
33 - //check the captcha response
 32+ if ( isset( $_POST[ 'recaptcha_response_field' ] ) ) {
 33+ // check the captcha response
3434 $captcha_resp = $this->check_captcha();
35 - if ( $captcha_resp->is_valid ){
 35+ if ( $captcha_resp->is_valid ) {
3636 // if validated, update the action and move on
3737 $this->log( $data[ 'contribution_tracking_id' ], 'Captcha passed' );
3838 $pfp_gateway_object->action = "process";
@@ -51,17 +51,17 @@
5252 */
5353 public function display_captcha( &$pfp_gateway_object, &$data ) {
5454 global $wgOut, $wgPayflowRecaptchaPublicKey, $wgProto;
55 -
 55+
5656 // log that a captcha's been triggered
5757 $this->log( $data[ 'contribution_tracking_id' ], 'Captcha triggered' );
58 -
 58+
5959 // check if we need to be using HTTPs to communicate with reCaptcha
6060 $use_ssl = ( $wgProto == 'https' ) ? TRUE : FALSE;
61 -
 61+
6262 // construct the HTML used to display the captcha
63 - $captcha_html = Xml::openElement( 'div', array( 'id' => 'mw-donate-captcha' ));
 63+ $captcha_html = Xml::openElement( 'div', array( 'id' => 'mw-donate-captcha' ) );
6464 $captcha_html .= recaptcha_get_html( $wgPayflowRecaptchaPublicKey, $this->recap_err, $use_ssl );
65 - $captcha_html .= '<span class="creditcard-error-msg">' . wfMsg( 'payflowpro_gateway-error-msg-captcha-please') . '</span>';
 65+ $captcha_html .= '<span class="creditcard-error-msg">' . wfMsg( 'payflowpro_gateway-error-msg-captcha-please' ) . '</span>';
6666 $captcha_html .= Xml::closeElement( 'div' ); // close div#mw-donate-captcha
6767
6868 // load up the form class
@@ -72,7 +72,7 @@
7373 $form_obj->setCaptchaHTML( $captcha_html );
7474
7575 // output the form
76 - $wgOut->addHTML( $form_obj->getForm());
 76+ $wgOut->addHTML( $form_obj->getForm() );
7777 }
7878
7979 /**
@@ -83,7 +83,7 @@
8484 $resp = recaptcha_check_answer( $wgPayflowRecaptchaPrivateKey,
8585 wfGetIP(),
8686 $wgRequest->getText( 'recaptcha_challenge_field' ),
87 - $wgRequest->getText( 'recaptcha_response_field' ));
 87+ $wgRequest->getText( 'recaptcha_response_field' ) );
8888
8989 return $resp;
9090 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/extras.php
@@ -7,14 +7,14 @@
88 * Note: This should be specified in LocalSettings.php BEFORE requiring any of the other 'extras'
99 */
1010
11 -if ( !defined( 'MEDIAWIKI' ) ) {
12 - die( "This file is part of PayflowPro Gateway extension. It is not a valid entry point.\n");
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ die( "This file is part of PayflowPro Gateway extension. It is not a valid entry point.\n" );
1313 }
1414
1515 $wgExtensionCredits['payflowprogateway_extras'][] = array(
1616 'name' => 'extras',
17 - 'author' =>'Arthur Richards',
18 - 'url' => '',
 17+ 'author' => 'Arthur Richards',
 18+ 'url' => '',
1919 'description' => "This extension handles some of the set up required for PayflowPro Gateway extras"
2020 );
2121
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter2.php
@@ -4,10 +4,10 @@
55 public $paypal = false; // true for paypal only version
66
77 public function __construct( &$form_data, &$form_errors ) {
8 - global $wgOut, $wgScriptPath;
 8+ global $wgScriptPath;
99
1010 // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this
11 - if ( !strlen( $this->getStylePath())) {
 11+ if ( !strlen( $this->getStylePath() ) ) {
1212 $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css' );
1313 }
1414
@@ -20,33 +20,33 @@
2121 $this->paypal = $wgRequest->getBool( 'paypal', false );
2222
2323 $form = parent::generateBannerHeader();
24 -
25 - $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0));
 24+
 25+ $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) );
2626 $form .= Xml::openElement( 'tr' );
2727 $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) );
28 -
 28+
2929 $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' );
3030 // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string
31 - if ( $wgRequest->getText( 'language' )) $text_template .= '/' . $this->form_data[ 'language' ];
 31+ if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ];
3232
33 - $template = ( strlen( $text_template )) ? $wgOut->parse( '{{'.$text_template.'}}' ) : '';
 33+ $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : '';
3434 // if the template doesn't exist, prevent the display of the red link
35 - if ( preg_match( '/redlink\=1/', $template )) $template = NULL;
 35+ if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL;
3636 $form .= $template;
37 -
 37+
3838 $form .= Xml::closeElement( 'td' );
3939
4040 $form .= Xml::openElement( 'td', array( 'id' => 'donate', 'valign' => 'top' ) );
41 -
 41+
4242 // add noscript tags for javascript disabled browsers
4343 $form .= $this->getNoScript();
44 -
 44+
4545 // $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' ));
4646
4747 // provide a place at the top of the form for displaying general messages
4848 if ( $this->form_errors['general'] ) {
49 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ));
50 - if ( is_array( $this->form_errors['general'] )) {
 49+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) );
 50+ if ( is_array( $this->form_errors['general'] ) ) {
5151 foreach ( $this->form_errors['general'] as $this->form_errors_msg ) {
5252 $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg );
5353 }
@@ -72,7 +72,7 @@
7373
7474 protected function generateBillingContainer() {
7575 $form = '';
76 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ));
 76+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) );
7777 $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) );
7878 $form .= $this->generateBillingFields();
7979 $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor
@@ -86,12 +86,12 @@
8787 $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes";
8888
8989 $form = '';
90 -
 90+
9191 if ( !$this->paypal ) {
9292 // PayPal button
9393 $form .= '<tr>';
94 - $form .= '<td style="text-align:center;" colspan="2"><big><b>'.wfMsg( 'payflowpro_gateway-paypal-button' ).'</b></big><br/><a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/paypal.png"/></a><br/>'.
95 - '— '.wfMsg( 'payflowpro_gateway-or' ).' —<br/><big><b>'.wfMsg( 'payflowpro_gateway-donate-wikipedia' ).'</b></big></td>';
 94+ $form .= '<td style="text-align:center;" colspan="2"><big><b>' . wfMsg( 'payflowpro_gateway-paypal-button' ) . '</b></big><br/><a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="' . $scriptPath . '/paypal.png"/></a><br/>' .
 95+ '— ' . wfMsg( 'payflowpro_gateway-or' ) . ' —<br/><big><b>' . wfMsg( 'payflowpro_gateway-donate-wikipedia' ) . '</b></big></td>';
9696 $form .= '</tr>';
9797 }
9898
@@ -107,14 +107,14 @@
108108 if ( !$this->paypal ) {
109109 // PayPal button
110110 // make sure we have a paypal url set to redirect the user to before displaying the button
111 - if ( strlen( $wgPayflowGatewayPaypalURL )) {
 111+ if ( strlen( $wgPayflowGatewayPaypalURL ) ) {
112112 $form .= '<tr>';
113113 $form .= '<td class="label"></td>';
114114 $form .= '<td>';
115 - $form .= Xml::hidden( 'PaypalRedirect', false );
 115+ $form .= Html::hidden( 'PaypalRedirect', false );
116116 $form .= Xml::tags( 'div',
117117 array(),
118 - Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ))
 118+ Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) )
119119 );
120120 $form .= '</td>';
121121 $form .= '</tr>';
@@ -143,7 +143,7 @@
144144 // country
145145 $form .= $this->getCountryField();
146146 }
147 -
 147+
148148 // anonymous
149149 $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true;
150150 $form .= '<tr>';
@@ -156,16 +156,16 @@
157157
158158 return $form;
159159 }
160 -
 160+
161161 public function generateFormSubmit() {
162162 // submit button
163 - $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit'));
164 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ));
 163+ $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) );
 164+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) );
165165 if ( $this->paypal ) {
166 - $form .= Xml::hidden( 'PaypalRedirect', false );
167 - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button'), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit'));
 166+ $form .= Html::hidden( 'PaypalRedirect', false );
 167+ $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button' ), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit' ) );
168168 } else {
169 - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-donor-submit'), 'onclick' => 'submit_form( this )', 'type' => 'submit'));
 169+ $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-donor-submit' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) );
170170 $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button
171171 $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) .
172172 wfMsg( 'payflowpro_gateway-donate-click' );
@@ -184,7 +184,7 @@
185185 // add hidden fields
186186 $hidden_fields = $this->getHiddenFields();
187187 foreach ( $hidden_fields as $field => $value ) {
188 - $form .= Xml::hidden( $field, $value );
 188+ $form .= Html::hidden( $field, $value );
189189 }
190190
191191 $form .= Xml::closeElement( 'form' ); // close form 'payment'
@@ -194,7 +194,7 @@
195195 $form .= Xml::closeElement( 'table' );
196196 return $form;
197197 }
198 -
 198+
199199 /**
200200 * Generates the donation footer ("There are other ways to give...")
201201 * @returns string of HTML
@@ -202,14 +202,14 @@
203203 public function generateDonationFooter() {
204204 global $wgScriptPath;
205205 $form = '';
206 - $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ));
207 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-secure-logos' ));
208 - $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" )));
 206+ $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) );
 207+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-secure-logos' ) );
 208+ $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" ) ) );
209209 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-secure-logos
210 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ));
211 - $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways-short' ));
 210+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ) );
 211+ $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways-short' ) );
212212 $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) );
213 - $form .= Xml::tags( 'p', array( 'class' => ''), wfMsg( 'payflowpro_gateway-question-comment' ) );
 213+ $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-question-comment' ) );
214214 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-text
215215 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info
216216 return $form;
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumn.php
@@ -3,7 +3,7 @@
44 class PayflowProGateway_Form_TwoStepTwoColumn extends PayflowProGateway_Form {
55
66 public function __construct( &$form_data, &$form_errors ) {
7 - global $wgOut, $wgScriptPath;
 7+ global $wgOut;
88
99 parent::__construct( $form_data, $form_errors );
1010
@@ -49,15 +49,14 @@
5050 }
5151
5252 public function generateFormStart() {
53 - global $wgPayflowGatewayHeader, $wgPayflwGatewayTest, $wgOut;
5453 $form = $this->generateBannerHeader();
5554
5655 $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) );
5756
5857 // provide a place at the top of the form for displaying general messages
5958 if ( $this->form_errors['general'] ) {
60 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ));
61 - if ( is_array( $this->form_errors['general'] )) {
 59+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) );
 60+ if ( is_array( $this->form_errors['general'] ) ) {
6261 foreach ( $this->form_errors['general'] as $this->form_errors_msg ) {
6362 $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg );
6463 }
@@ -77,11 +76,11 @@
7877 $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>";
7978 $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) );
8079
81 - $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section'));
 80+ $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section' ) );
8281 $form .= $this->generatePersonalContainer();
8382 $form .= Xml::closeElement( 'div' ); // close div#left-column
8483
85 - $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ));
 84+ $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ) );
8685 $form .= $this->generatePaymentContainer();
8786
8887 return $form;
@@ -89,10 +88,10 @@
9089
9190 public function generateFormSubmit() {
9291 // submit button
93 - $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit'));
94 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ));
95 - //$form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' ));
96 - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button'), 'onclick' => 'submit_form( this )', 'type' => 'submit'));
 92+ $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) );
 93+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) );
 94+ // $form .= Xml::submitButton( wfMsg( 'payflowpro_gateway-submit-button' ));
 95+ $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) );
9796 $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button
9897 $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) .
9998 wfMsg( 'payflowpro_gateway-donate-click' );
@@ -106,7 +105,7 @@
107106 // add hidden fields
108107 $hidden_fields = $this->getHiddenFields();
109108 foreach ( $hidden_fields as $field => $value ) {
110 - $form .= Xml::hidden( $field, $value );
 109+ $form .= Html::hidden( $field, $value );
111110 }
112111 $form .= Xml::closeElement( 'div' ); // close div#right-column
113112 $form .= Xml::closeElement( 'form' );
@@ -118,8 +117,8 @@
119118
120119 protected function generatePersonalContainer() {
121120 $form = '';
122 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); ;
123 - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header','id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-cc-form-header-personal' ));
 121+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); ;
 122+ $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-cc-form-header-personal' ) );
124123 $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) );
125124
126125 $form .= $this->generatePersonalFields();
@@ -159,8 +158,8 @@
160159 protected function generatePaymentContainer() {
161160 $form = '';
162161 // credit card info
163 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' ));
164 - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-payment' ), wfMsg( 'payflowpro_gateway-cc-form-header-payment' ));
 162+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' ) );
 163+ $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-payment' ), wfMsg( 'payflowpro_gateway-cc-form-header-payment' ) );
165164 $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) );
166165
167166 $form .= $this->generatePaymentFields();
@@ -172,16 +171,14 @@
173172 }
174173
175174 protected function generatePaymentFields() {
176 - global $wgScriptPath, $wgPayflowGatewayTest;
 175+ global $wgScriptPath;
177176
178 - $form = '';
179 -
180177 // amount
181178 $form = '<tr>';
182179 $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>';
183180 $form .= '</tr>';
184181 $form .= '<tr>';
185 - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
 182+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>';
186183 $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) .
187184 ' ' . $this->generateCurrencyDropdown() . '</td>';
188185 $form .= '</tr>';
@@ -189,7 +186,7 @@
190187 // card logos
191188 $form .= '<tr>';
192189 $form .= '<td />';
193 - $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>';
 190+ $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) ) . '</td>';
194191 $form .= '</tr>';
195192
196193 // credit card type
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoStepTwoColumnLetter.php
@@ -2,10 +2,10 @@
33
44 class PayflowProGateway_Form_TwoStepTwoColumnLetter extends PayflowProGateway_Form_TwoStepTwoColumn {
55 public function __construct( &$form_data, &$form_errors ) {
6 - global $wgOut, $wgScriptPath;
 6+ global $wgScriptPath;
77
88 // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this
9 - if ( !strlen( $this->getStylePath())) {
 9+ if ( !strlen( $this->getStylePath() ) ) {
1010 $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoStepTwoColumnLetter.css' );
1111 }
1212
@@ -17,17 +17,17 @@
1818
1919 $form = parent::generateBannerHeader();
2020
21 - $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0));
 21+ $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) );
2222 $form .= Xml::openElement( 'tr' );
2323 $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) );
2424
2525 $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' );
2626 // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string
27 - if ( $wgRequest->getText( 'language' )) $text_template .= '/' . $this->form_data[ 'language' ];
 27+ if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ];
2828
29 - $template = ( strlen( $text_template )) ? $wgOut->parse( '{{'.$text_template.'}}' ) : '';
 29+ $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : '';
3030 // if the template doesn't exist, prevent the display of the red link
31 - if ( preg_match( '/redlink\=1/', $template )) $template = NULL;
 31+ if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL;
3232 $form .= $template;
3333
3434 $form .= Xml::closeElement( 'td' );
@@ -37,12 +37,12 @@
3838 // add noscript tags for javascript disabled browsers
3939 $form .= $this->getNoScript();
4040
41 - $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' ));
 41+ $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) );
4242
4343 // provide a place at the top of the form for displaying general messages
4444 if ( $this->form_errors['general'] ) {
45 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ));
46 - if ( is_array( $this->form_errors['general'] )) {
 45+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) );
 46+ if ( is_array( $this->form_errors['general'] ) ) {
4747 foreach ( $this->form_errors['general'] as $this->form_errors_msg ) {
4848 $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg );
4949 }
@@ -68,7 +68,7 @@
6969
7070 protected function generateBillingContainer() {
7171 $form = '';
72 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ));
 72+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) );
7373 $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) );
7474 $form .= $this->generateBillingFields();
7575 $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor
@@ -79,7 +79,6 @@
8080
8181 protected function generateBillingFields() {
8282 global $wgScriptPath;
83 - $scriptPath = "$wgScriptPath/extensions/DonationInterface/payflowpro_gateway/includes";
8483
8584 $form = '';
8685
@@ -94,7 +93,7 @@
9594 $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>';
9695 $form .= '</tr>';
9796 $form .= '<tr>';
98 - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
 97+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>';
9998 $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) .
10099 ' ' . $this->generateCurrencyDropdown() . '</td>';
101100 $form .= '</tr>';
@@ -102,7 +101,7 @@
103102 // card logos
104103 $form .= '<tr>';
105104 $form .= '<td />';
106 - $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>';
 105+ $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) ) . '</td>';
107106 $form .= '</tr>';
108107
109108 // card number
@@ -139,7 +138,7 @@
140139 // add hidden fields
141140 $hidden_fields = $this->getHiddenFields();
142141 foreach ( $hidden_fields as $field => $value ) {
143 - $form .= Xml::hidden( $field, $value );
 142+ $form .= Html::hidden( $field, $value );
144143 }
145144
146145 $form .= Xml::closeElement( 'form' ); // close form 'payment'
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnPayPal.php
@@ -2,20 +2,18 @@
33
44 class PayflowProGateway_Form_TwoColumnPayPal extends PayflowProGateway_Form_OneStepTwoColumn {
55 public function __construct( &$form_data, &$form_errors ) {
6 -
76 parent::__construct( $form_data, $form_errors );
87 }
98
109 public function generateFormStart() {
11 - global $wgPayflowGatewayHeader, $wgPayflwGatewayTest, $wgOut;
1210 $form = $this->generateBannerHeader();
1311
1412 $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) );
1513
1614 // provide a place at the top of the form for displaying general messages
1715 if ( $this->form_errors['general'] ) {
18 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ));
19 - if ( is_array( $this->form_errors['general'] )) {
 16+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) );
 17+ if ( is_array( $this->form_errors['general'] ) ) {
2018 foreach ( $this->form_errors['general'] as $this->form_errors_msg ) {
2119 $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg );
2220 }
@@ -35,21 +33,20 @@
3634 $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>";
3735 $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) );
3836
39 - $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section'));
 37+ $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section' ) );
4038 $form .= $this->generatePersonalContainer();
4139 $form .= Xml::closeElement( 'div' ); // close div#left-column
4240
43 - $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ));
 41+ $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ) );
4442 $form .= $this->generatePaymentContainer();
4543
4644 return $form;
4745 }
4846
4947 protected function generatePersonalContainer() {
50 - global $wgRequest;
5148 $form = '';
52 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' )); ;
53 - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header','id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-make-your-donation' ));
 49+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); ;
 50+ $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) );
5451 $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) );
5552
5653 $form .= $this->generatePersonalFields();
@@ -70,10 +67,10 @@
7168 // email
7269 $form .= $this->getEmailField();
7370
74 - //comment message
 71+ // comment message
7572 $form .= $this->getCommentMessageField();
7673
77 - //comment
 74+ // comment
7875 $form .= $this->getCommentField();
7976
8077 // anonymous
@@ -86,7 +83,7 @@
8784 $form .= $this->getAmountField();
8885
8986 // PayPal button
90 - if ( strlen( $wgPayflowGatewayPaypalURL )) {
 87+ if ( strlen( $wgPayflowGatewayPaypalURL ) ) {
9188 $form .= $this->getPaypalButton();
9289 }
9390
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/SingleColumn.php
@@ -3,10 +3,10 @@
44 class PayflowProGateway_Form_SingleColumn extends PayflowProGateway_Form_TwoColumnLetter {
55
66 public function __construct( &$form_data, &$form_errors ) {
7 - global $wgOut, $wgScriptPath;
 7+ global $wgScriptPath;
88
99 // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this
10 - if ( !strlen( $this->getStylePath())) {
 10+ if ( !strlen( $this->getStylePath() ) ) {
1111 $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/SingleColumn.css' );
1212 }
1313
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/Form.php
@@ -61,7 +61,7 @@
6262 * using $this->setStylePath, which should be called before
6363 * calling parent::__construct()
6464 */
65 - if ( !strlen( $this->getStylePath())) {
 65+ if ( !strlen( $this->getStylePath() ) ) {
6666 $this->setStylePath();
6767 }
6868 $wgOut->addExtensionStyle( $this->getStylePath() );
@@ -75,7 +75,7 @@
7676 * to the default css in css/Form.css
7777 * @param string $style_path
7878 */
79 - public function setStylePath( $style_path=null ) {
 79+ public function setStylePath( $style_path = null ) {
8080 global $wgScriptPath;
8181 if ( !$style_path ) {
8282 // load the default form CSS if the style path not explicitly set
@@ -99,14 +99,14 @@
100100 public function generateDonationFooter() {
101101 global $wgScriptPath;
102102 $form = '';
103 - $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ));
104 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-secure-logos' ));
105 - $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" )));
 103+ $form .= Xml::openElement( 'div', array( 'class' => 'payflow-cc-form-section', 'id' => 'payflowpro_gateway-donate-addl-info' ) );
 104+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-secure-logos' ) );
 105+ $form .= Xml::tags( 'p', array( 'class' => '' ), Xml::openElement( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/rapidssl_ssl_certificate.gif" ) ) );
106106 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-secure-logos
107 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ));
108 - $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways' ));
 107+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-donate-addl-info-text' ) );
 108+ $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-otherways' ) );
109109 $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-credit-storage-processing' ) );
110 - $form .= Xml::tags( 'p', array( 'class' => ''), wfMsg( 'payflowpro_gateway-question-comment' ) );
 110+ $form .= Xml::tags( 'p', array( 'class' => '' ), wfMsg( 'payflowpro_gateway-question-comment' ) );
111111 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info-text
112112 $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-donate-addl-info
113113 return $form;
@@ -156,7 +156,7 @@
157157 'name' => 'country',
158158 'id' => 'country',
159159 'onchange' => 'return disableStates( this )'
160 - ));
 160+ ) );
161161 $country_menu .= $country_options;
162162 $country_menu .= Xml::closeElement( 'select' );
163163
@@ -192,7 +192,7 @@
193193 array(
194194 'name' => 'card',
195195 'id' => 'card'
196 - ));
 196+ ) );
197197 $card_menu .= $card_options;
198198 $card_menu .= Xml::closeElement( 'select' );
199199
@@ -224,7 +224,7 @@
225225 array(
226226 'name' => 'mos',
227227 'id' => 'expiration'
228 - ));
 228+ ) );
229229 $expiry_month_menu .= $expiry_months;
230230 $expiry_month_menu .= Xml::closeElement( 'select' );
231231 return $expiry_month_menu;
@@ -251,7 +251,7 @@
252252 array(
253253 'name' => 'year',
254254 'id' => 'year',
255 - ));
 255+ ) );
256256 $expiry_year_menu .= $expiry_years;
257257 $expiry_year_menu .= Xml::closeElement( 'select' );
258258 return $expiry_year_menu;
@@ -281,7 +281,7 @@
282282 array(
283283 'name' => 'state',
284284 'id' => 'state'
285 - ));
 285+ ) );
286286 $state_menu .= $state_opts;
287287 $state_menu .= Xml::closeElement( 'select' );
288288
@@ -319,7 +319,7 @@
320320 array(
321321 'name' => 'currency_code',
322322 'id' => 'input_currency_code'
323 - ));
 323+ ) );
324324 $currency_menu .= $currency_opts;
325325 $currency_menu .= Xml::closeElement( 'select' );
326326
@@ -332,10 +332,8 @@
333333 * If you pass nothing in, we'll set the fields for you.
334334 * @param array $hidden_fields
335335 */
336 - public function setHiddenFields( $hidden_fields=NULL ) {
 336+ public function setHiddenFields( $hidden_fields = NULL ) {
337337 if ( !$hidden_fields ) {
338 - global $wgRequest;
339 -
340338 $hidden_fields = array(
341339 'utm_source' => $this->form_data[ 'utm_source' ],
342340 'utm_medium' => $this->form_data[ 'utm_medium' ],
@@ -365,7 +363,7 @@
366364 * @return array
367365 */
368366 public function getHiddenFields() {
369 - if ( !isset( $this->hidden_fields )) {
 367+ if ( !isset( $this->hidden_fields ) ) {
370368 $this->setHiddenFields();
371369 }
372370 return $this->hidden_fields;
@@ -378,7 +376,7 @@
379377 * @return string The HTML to display the captcha or an empty string
380378 */
381379 public function getCaptchaHTML() {
382 - if ( !strlen( $this->captcha_html )) {
 380+ if ( !strlen( $this->captcha_html ) ) {
383381 return '';
384382 }
385383 return $this->captcha_html;
@@ -403,7 +401,7 @@
404402 $template = '';
405403
406404 // intro text
407 - if ( $wgRequest->getText('masthead', false)) {
 405+ if ( $wgRequest->getText( 'masthead', false ) ) {
408406 $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data[ 'language' ] . '}}' );
409407 } elseif ( $wgPayflowGatewayHeader ) {
410408 $header = str_replace( '@language', $this->form_data[ 'language' ], $wgPayflowGatewayHeader );
@@ -411,7 +409,7 @@
412410 }
413411
414412 // make sure that we actually have a matching template to display so we don't display the 'redlink'
415 - if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template )) {
 413+ if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template ) ) {
416414 $wgOut->addHtml( $template );
417415 }
418416 }
@@ -440,7 +438,7 @@
441439 $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>';
442440 $form .= '</tr>';
443441 $form .= '<tr>';
444 - $form .= '<td class="label">' . Xml::label(wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount') . '</td>';
 442+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-amount' ), 'amount' ) . '</td>';
445443 $form .= '<td>' . Xml::radio( 'amount', 100, $this->form_data['amount'] == 100 ) . '100 ' .
446444 Xml::radio( 'amount', 50, $this->form_data['amount'] == 50 ) . '50 ' .
447445 Xml::radio( 'amount', 35, $this->form_data['amount'] == 35 ) . '35 ' .
@@ -485,7 +483,7 @@
486484 $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['cvv'] . '</span></td>';
487485 $form .= '<tr>';
488486 $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-donor-security' ), 'cvv' ) . '</td>';
489 - $form .= '<td>' . Xml::input( 'cvv', '5', $cvv, array( 'type' => 'text', 'maxlength' => '10', 'id' => 'cvv', 'autocomplete' => 'off') ) .
 487+ $form .= '<td>' . Xml::input( 'cvv', '5', $cvv, array( 'type' => 'text', 'maxlength' => '10', 'id' => 'cvv', 'autocomplete' => 'off' ) ) .
490488 ' ' . '<a href="javascript:PopupCVV();">' . wfMsg( 'payflowpro_gateway-cvv-link' ) . '</a>' .
491489 '</td>';
492490 $form .= '</tr>';
@@ -546,7 +544,7 @@
547545 protected function getCommentMessageField() {
548546 $form = '<tr>';
549547 $form .= '<td colspan="2">';
550 - $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ));
 548+ $form .= Xml::tags( 'p', array(), wfMsg( 'donate_interface-comment-message' ) );
551549 $form .= '</td>';
552550 $form .= '</tr>';
553551 return $form;
@@ -554,8 +552,8 @@
555553
556554 protected function getCommentField() {
557555 $form = '<tr>';
558 - $form .= '<td class="label">' . Xml::label( wfMsg('payflowpro_gateway-comment'), 'comment' ) . '</td>';
559 - $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' )) . '</td>';
 556+ $form .= '<td class="label">' . Xml::label( wfMsg( 'payflowpro_gateway-comment' ), 'comment' ) . '</td>';
 557+ $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data[ 'comment' ], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' ) ) . '</td>';
560558 $form .= '</tr>';
561559 return $form;
562560 }
@@ -577,7 +575,7 @@
578576 $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value );
579577 $form .= ' ';
580578 // put the label inside Xml::openElement so any HTML in the msg might get rendered (right, Germany?)
581 - $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ));
 579+ $form .= Xml::openElement( 'label', array( 'for' => 'email-opt' ) );
582580 $form .= wfMsg( 'donate_interface-email-agreement' );
583581 $form .= Xml::closeElement( 'label' );
584582 $form .= '</td>';
@@ -591,10 +589,10 @@
592590
593591 $form = '<tr>';
594592 $form .= '<td class="paypal-button" colspan="2">';
595 - $form .= Xml::hidden( 'PaypalRedirect', false );
 593+ $form .= Html::hidden( 'PaypalRedirect', false );
596594 $form .= Xml::tags( 'div',
597595 array(),
598 - '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>'
 596+ '<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="' . $scriptPath . '/donate_with_paypal.gif"/></a>'
599597 );
600598 $form .= '</td>';
601599 $form .= '</tr>';
@@ -687,15 +685,15 @@
688686 $url = $wgRequest->getFullRequestURL();
689687 $url_parts = wfParseUrl( $url );
690688 $query_array = wfCgiToArray( $url_parts[ 'query' ] );
691 -
 689+
692690 // ensure that _cache_ does not get set in the URL
693 - unset( $query_array[ '_cache_' ]);
694 -
 691+ unset( $query_array[ '_cache_' ] );
 692+
695693 // make sure no other data that might overwrite posted data makes it into the URL
696694 foreach ( $this->form_data as $key => $value ) {
697695 unset( $query_array[ $key ] );
698696 }
699 -
 697+
700698 // construct the submission url
701699 return wfAppendQuery( $wgTitle->getLocalURL(), $query_array );
702700 }
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/OneStepTwoColumn.php
@@ -4,7 +4,7 @@
55 public $paypal = false; // true for paypal only version
66
77 public function __construct( &$form_data, &$form_errors ) {
8 - global $wgOut, $wgScriptPath;
 8+ global $wgOut;
99
1010 parent::__construct( $form_data, $form_errors );
1111
@@ -61,7 +61,7 @@
6262 }
6363
6464 public function generateFormStart() {
65 - global $wgPayflowGatewayHeader, $wgPayflwGatewayTest, $wgOut, $wgRequest;
 65+ global $wgRequest;
6666
6767 $this->paypal = $wgRequest->getBool( 'paypal', false );
6868
@@ -71,8 +71,8 @@
7272
7373 // provide a place at the top of the form for displaying general messages
7474 if ( $this->form_errors['general'] ) {
75 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ));
76 - if ( is_array( $this->form_errors['general'] )) {
 75+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) );
 76+ if ( is_array( $this->form_errors['general'] ) ) {
7777 foreach ( $this->form_errors['general'] as $this->form_errors_msg ) {
7878 $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg );
7979 }
@@ -92,13 +92,13 @@
9393 $form .= "<p class='creditcard-error-msg'>" . $this->form_errors['retryMsg'] . "</p>";
9494 $form .= Xml::openElement( 'form', array( 'name' => 'payment', 'method' => 'post', 'action' => $this->getNoCacheAction(), 'onsubmit' => 'return validate_form(this)', 'autocomplete' => 'off' ) );
9595
96 - $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section'));
 96+ $form .= Xml::openElement( 'div', array( 'id' => 'left-column', 'class' => 'payflow-cc-form-section' ) );
9797 $form .= $this->generatePersonalContainer();
9898
9999 if ( !$this->paypal ) {
100100 $form .= Xml::closeElement( 'div' ); // close div#left-column
101101
102 - $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ));
 102+ $form .= Xml::openElement( 'div', array( 'id' => 'right-column', 'class' => 'payflow-cc-form-section' ) );
103103 $form .= $this->generatePaymentContainer();
104104 }
105105
@@ -106,13 +106,13 @@
107107 }
108108 public function generateFormSubmit() {
109109 // submit button
110 - $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit'));
111 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ));
 110+ $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) );
 111+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-donate-submit-button' ) );
112112 if ( $this->paypal ) {
113 - $form .= Xml::hidden( 'PaypalRedirect', false );
114 - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button'), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit'));
 113+ $form .= Html::hidden( 'PaypalRedirect', false );
 114+ $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-paypal-button' ), 'onclick' => 'document.payment.PaypalRedirect.value=\'true\';document.payment.submit();', 'type' => 'submit' ) );
115115 } else {
116 - $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button'), 'onclick' => 'submit_form( this )', 'type' => 'submit'));
 116+ $form .= Xml::element( 'input', array( 'class' => 'button-plain', 'value' => wfMsg( 'payflowpro_gateway-cc-button' ), 'onclick' => 'submit_form( this )', 'type' => 'submit' ) );
117117 $form .= Xml::closeElement( 'div' ); // close div#mw-donate-submit-button
118118 $form .= Xml::openElement( 'div', array( 'class' => 'mw-donate-submessage', 'id' => 'payflowpro_gateway-donate-submessage' ) ) .
119119 wfMsg( 'payflowpro_gateway-donate-click' );
@@ -128,7 +128,7 @@
129129 // add hidden fields
130130 $hidden_fields = $this->getHiddenFields();
131131 foreach ( $hidden_fields as $field => $value ) {
132 - $form .= Xml::hidden( $field, $value );
 132+ $form .= Html::hidden( $field, $value );
133133 }
134134 $form .= Xml::closeElement( 'div' ); // close div#right-column
135135 $form .= Xml::closeElement( 'form' );
@@ -143,7 +143,7 @@
144144 $template = '';
145145
146146 // intro text
147 - if ( $wgRequest->getText('masthead', false)) {
 147+ if ( $wgRequest->getText( 'masthead', false ) ) {
148148 $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data[ 'language' ] . '}}' );
149149 } elseif ( $wgPayflowGatewayHeader ) {
150150 $header = str_replace( '@language', $this->form_data[ 'language' ], $wgPayflowGatewayHeader );
@@ -151,7 +151,7 @@
152152 }
153153
154154 // make sure that we actually have a matching template to display so we don't display the 'redlink'
155 - if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template )) {
 155+ if ( strlen( $template ) && !preg_match( '/redlink\=1/', $template ) ) {
156156 $wgOut->addHtml( $template );
157157 }
158158 }
@@ -159,14 +159,14 @@
160160 protected function generatePersonalContainer() {
161161 global $wgRequest, $wgScriptPath;
162162 $form = '';
163 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ));
164 - $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header','id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-make-your-donation' ));
 163+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) );
 164+ $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-personal' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) );
165165 if ( !$this->paypal ) {
166166 $source = $wgRequest->getText( 'utm_source' );
167167 $medium = $wgRequest->getText( 'utm_medium' );
168168 $campaign = $wgRequest->getText( 'utm_campaign' );
169169 $formname = $wgRequest->getText( 'form_name' );
170 - $form .= Xml::Tags( 'p', array( 'id' => 'payflowpro_gateway-cc_otherways' ), wfMsg( 'payflowpro_gateway-paypal', $wgScriptPath, $formname, $source, $medium, $campaign ));
 170+ $form .= Xml::Tags( 'p', array( 'id' => 'payflowpro_gateway-cc_otherways' ), wfMsg( 'payflowpro_gateway-paypal', $wgScriptPath, $formname, $source, $medium, $campaign ) );
171171 }
172172 $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) );
173173
@@ -187,10 +187,10 @@
188188 // email
189189 $form .= $this->getEmailField();
190190
191 - //comment message
 191+ // comment message
192192 $form .= $this->getCommentMessageField();
193193
194 - //comment
 194+ // comment
195195 $form .= $this->getCommentField();
196196
197197 // anonymous
@@ -208,7 +208,7 @@
209209 protected function generatePaymentContainer() {
210210 $form = '';
211211 // credit card info
212 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' ));
 212+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-payment-info' ) );
213213 $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) );
214214
215215 $form .= $this->generatePaymentFields();
@@ -220,14 +220,14 @@
221221 }
222222
223223 protected function generatePaymentFields() {
224 - global $wgScriptPath, $wgPayflowGatewayTest;
 224+ global $wgScriptPath;
225225
226226 $form = '';
227227
228228 // card logos
229229 $form .= '<tr>';
230230 $form .= '<td />';
231 - $form .= '<td>&nbsp;<br/>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" )) . '</td>';
 231+ $form .= '<td>&nbsp;<br/>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos.gif" ) ) . '</td>';
232232 $form .= '</tr>';
233233
234234 // card number
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/forms/TwoColumnLetter.php
@@ -4,10 +4,10 @@
55 public $paypal = false; // true for paypal only version
66
77 public function __construct( &$form_data, &$form_errors ) {
8 - global $wgOut, $wgScriptPath;
 8+ global $wgScriptPath;
99
1010 // set the path to css, before the parent constructor is called, checking to make sure some child class hasn't already set this
11 - if ( !strlen( $this->getStylePath())) {
 11+ if ( !strlen( $this->getStylePath() ) ) {
1212 $this->setStylePath( $wgScriptPath . '/extensions/DonationInterface/payflowpro_gateway/forms/css/TwoColumnLetter.css' );
1313 }
1414
@@ -20,33 +20,33 @@
2121 $this->paypal = $wgRequest->getBool( 'paypal', false );
2222
2323 $form = parent::generateBannerHeader();
24 -
25 - $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0));
 24+
 25+ $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) );
2626 $form .= Xml::openElement( 'tr' );
2727 $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) );
28 -
 28+
2929 $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' );
3030 // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string
31 - if ( $wgRequest->getText( 'language' )) $text_template .= '/' . $this->form_data[ 'language' ];
 31+ if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ];
3232
33 - $template = ( strlen( $text_template )) ? $wgOut->parse( '{{'.$text_template.'}}' ) : '';
 33+ $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : '';
3434 // if the template doesn't exist, prevent the display of the red link
35 - if ( preg_match( '/redlink\=1/', $template )) $template = NULL;
 35+ if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL;
3636 $form .= $template;
37 -
 37+
3838 $form .= Xml::closeElement( 'td' );
3939
4040 $form .= Xml::openElement( 'td', array( 'id' => 'donate', 'valign' => 'top' ) );
41 -
 41+
4242 // add noscript tags for javascript disabled browsers
4343 $form .= $this->getNoScript();
44 -
45 - $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' ));
4644
 45+ $form .= Xml::tags( 'h2', array( 'id' => 'donate-head' ), wfMsg( 'payflowpro_gateway-make-your-donation' ) );
 46+
4747 // provide a place at the top of the form for displaying general messages
4848 if ( $this->form_errors['general'] ) {
49 - $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ));
50 - if ( is_array( $this->form_errors['general'] )) {
 49+ $form .= Xml::openElement( 'div', array( 'id' => 'mw-payflow-general-error' ) );
 50+ if ( is_array( $this->form_errors['general'] ) ) {
5151 foreach ( $this->form_errors['general'] as $this->form_errors_msg ) {
5252 $form .= Xml::tags( 'p', array( 'class' => 'creditcard-error-msg' ), $this->form_errors_msg );
5353 }
@@ -72,7 +72,7 @@
7373
7474 protected function generateBillingContainer() {
7575 $form = '';
76 - $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ));
 76+ $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) );
7777 $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) );
7878 $form .= $this->generateBillingFields();
7979 $form .= Xml::closeElement( 'table' ); // close table#payflow-table-donor
@@ -93,10 +93,10 @@
9494 // email
9595 $form .= $this->getEmailField();
9696
97 - //comment message
 97+ // comment message
9898 $form .= $this->getCommentMessageField();
9999
100 - //comment
 100+ // comment
101101 $form .= $this->getCommentField();
102102
103103 // anonymous
@@ -111,14 +111,14 @@
112112 if ( !$this->paypal ) {
113113 // PayPal button
114114 // make sure we have a paypal url set to redirect the user to before displaying the button
115 - if ( strlen( $wgPayflowGatewayPaypalURL )) {
 115+ if ( strlen( $wgPayflowGatewayPaypalURL ) ) {
116116 $form .= '<tr>';
117117 $form .= '<td class="label"></td>';
118118 $form .= '<td class="paypal-button">';
119 - $form .= Xml::hidden( 'PaypalRedirect', false );
 119+ $form .= Html::hidden( 'PaypalRedirect', false );
120120 $form .= Xml::tags( 'div',
121121 array(),
122 - Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos2.gif" )) . '&nbsp;&nbsp;&nbsp;<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="'.$scriptPath.'/donate_with_paypal.gif"/></a>'
 122+ Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/payflowpro_gateway/includes/credit_card_logos2.gif" ) ) . '&nbsp;&nbsp;&nbsp;<a href="#" onclick="document.payment.PaypalRedirect.value=\'true\';document.payment.submit();"><img src="' . $scriptPath . '/donate_with_paypal.gif"/></a>'
123123 );
124124 $form .= '</td>';
125125 $form .= '</tr>';
@@ -159,7 +159,7 @@
160160 // add hidden fields
161161 $hidden_fields = $this->getHiddenFields();
162162 foreach ( $hidden_fields as $field => $value ) {
163 - $form .= Xml::hidden( $field, $value );
 163+ $form .= Html::hidden( $field, $value );
164164 }
165165
166166 $form .= Xml::closeElement( 'form' ); // close form 'payment'
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.i18n.php
@@ -34,7 +34,7 @@
3535 'payflowpro_gateway-donor-state' => 'State',
3636 'payflowpro_gateway-donor-postal' => 'Postal code',
3737 'payflowpro_gateway-donor-country' => 'Country/Region',
38 - 'payflowpro_gateway-donor-address'=> 'Address',
 38+ 'payflowpro_gateway-donor-address' => 'Address',
3939 'payflowpro_gateway-donor-card' => 'Credit card',
4040 'payflowpro_gateway-donor-card-num' => 'Card number',
4141 'payflowpro_gateway-donor-expiration' => 'Expiration date',
@@ -108,6 +108,7 @@
109109 'payflowpro_gateway-state-in-us' => 'if inside the US',
110110 'payflowpro_gateway-comment' => 'Comment',
111111 'payflowpro_gateway-first' => 'First',
 112+ 'payflowpro_gateway-middle' => 'Middle',
112113 'payflowpro_gateway-last' => 'Last',
113114 'payflowpro_gateway-other' => 'Other',
114115 'payflowpro_gateway-noscript-msg' => 'It appears that you do not have JavaScript enabled, or your browser does not support it.
@@ -115,7 +116,85 @@
116117 'payflowpro_gateway-noscript-redirect-msg' => 'If you cannot or do not wish to enable JavaScript, you may still contribute by visiting:',
117118 'payflowpro_gateway-anon-message' => 'Please list my name on the public donor list.',
118119 'payflowpro_gateway-donate-wikipedia' => 'Donate on Wikipedia',
119 - 'payflowpro_gateway-or' => 'or'
 120+ 'payflowpro_gateway-or' => 'or',
 121+ 'payflowpro_gateway-your-information' => 'Your Information',
 122+ 'payflowpro_gateway-mailing-address' => 'Mailing Address',
 123+ 'payflowpro_gateway-billing-address' => 'Billing Address',
 124+ 'payflowpro_gateway-billing-name' => 'Billing Name',
 125+ 'payflowpro_gateway-title' => 'Title',
 126+ 'payflowpro_gateway-suffix' => 'Suffix',
 127+ 'payflowpro_gateway-company-name' => 'Company or Organization Name',
 128+ 'payflowpro_gateway-address-1' => 'Address 1',
 129+ 'payflowpro_gateway-address-2' => 'Address 2',
 130+ 'payflowpro_gateway-address-lines' => 'Address Lines',
 131+ 'payflowpro_gateway-address-line-2' => 'Address (Line 2)',
 132+ 'payflowpro_gateway-street-address' => 'Street Address',
 133+ 'payflowpro_gateway-street-address-line-2' => 'Street Address [line 2]',
 134+ 'payflowpro_gateway-street-1' => 'Street 1',
 135+ 'payflowpro_gateway-street-2' => 'Street 2',
 136+ 'payflowpro_gateway-apartment-number' => 'Apt. #',
 137+ 'payflowpro_gateway-city-town' => 'City/Town',
 138+ 'payflowpro_gateway-town-city' => 'Town/City',
 139+ 'payflowpro_gateway-state-province' => 'State/Province',
 140+ 'payflowpro_gateway-zip' => 'Zip',
 141+ 'payflowpro_gateway-zip-code' => 'Zip Code',
 142+ 'payflowpro_gateway-zip-postal' => 'Zip/Postal',
 143+ 'payflowpro_gateway-zip-postal-code' => 'Zip/Postal Code',
 144+ 'payflowpro_gateway-billing-code' => 'Billing Zip',
 145+ 'payflowpro_gateway-country' => 'Country',
 146+ 'payflowpro_gateway-select-country' => 'Select Country',
 147+ 'payflowpro_gateway-confirm-email' => 'Confirm Email',
 148+ 'payflowpro_gateway-confirmation-email' => 'Confirmation Email',
 149+ 'payflowpro_gateway-phone' => 'Phone',
 150+ 'payflowpro_gateway-telephone' => 'Telephone',
 151+ 'payflowpro_gateway-telephone-home' => 'Tel. (home)',
 152+ 'payflowpro_gateway-billing-phone-number' => 'Billing Phone Number',
 153+ 'payflowpro_gateway-donation-information' => 'Donation Information',
 154+ 'payflowpro_gateway-cc-billing-information' => 'Credit Card Billing Information',
 155+ 'payflowpro_gateway-pay-by-credit-card' => 'Pay By Credit Card',
 156+ 'payflowpro_gateway-which-card' => 'Which Card Would You Like to Use',
 157+ 'payflowpro_gateway-choose-donation-method' => 'Choose Donation Method',
 158+ 'payflowpro_gateway-cardholders-name' => 'Cardholder’s Name',
 159+ 'payflowpro_gateway-name-on-card' => 'Name on Card',
 160+ 'payflowpro_gateway-type-of-card' => 'Type of Card',
 161+ 'payflowpro_gateway-cards-accepted' => 'Cards Accepted',
 162+ 'payflowpro_gateway-card-type' => 'Card Type',
 163+ 'payflowpro_gateway-credit-card-type' => 'Credit Card Type',
 164+ 'payflowpro_gateway-credit-card-number' => 'Credit Card Number',
 165+ 'payflowpro_gateway-credit-card-number-abbreviated' => 'Credit Card #',
 166+ 'payflowpro_gateway-credit-card-expiration' => 'Credit Card Expiration',
 167+ 'payflowpro_gateway-card-expiration' => 'Card Expiration',
 168+ 'payflowpro_gateway-select-month-of-expiration' => 'Select Month of Expiration',
 169+ 'payflowpro_gateway-select-year-of-expiration' => 'Select Year of Expiration',
 170+ 'payflowpro_gateway-expires-question' => 'Expires?',
 171+ 'payflowpro_gateway-expires' => 'Expires',
 172+ 'payflowpro_gateway-card-security-code' => 'Card Security Code',
 173+ 'payflowpro_gateway-cvv' => 'CVV',
 174+ 'payflowpro_gateway-cvv-number-abbreviated' => 'CVV #',
 175+ 'payflowpro_gateway-cvv2' => 'CVV2',
 176+ 'payflowpro_gateway-cvv-number' => 'CVV Number',
 177+ 'payflowpro_gateway-verification-number' => 'Verification Number',
 178+ 'payflowpro_gateway-what-is-this' => 'What is this?',
 179+ 'payflowpro_gateway-do-not-include-dashes' => 'Please Do Not Include Dashes',
 180+ 'payflowpro_gateway-please-donate-today' => 'Please Donate Today',
 181+ 'payflowpro_gateway-donate-now' => 'Donate Now',
 182+ 'payflowpro_gateway-please-select-gift-amount' => 'Please select a gift amount',
 183+ 'payflowpro_gateway-select-gift-amount' => 'Select Gift Amount',
 184+ 'payflowpro_gateway-select-amount' => 'Select Amount',
 185+ 'payflowpro_gateway-amount' => 'Amount',
 186+ 'payflowpro_gateway-make-a-donation' => 'Make a donation',
 187+ 'payflowpro_gateway-enter-your-amount' => 'Or enter your amount in the box above',
 188+ 'payflowpro_gateway-will-support-with-gift' => 'I will support with a gift of:',
 189+ 'payflowpro_gateway-will-make-tax-deductible-gift' => 'I will make a tax-deductible gift of:',
 190+ 'payflowpro_gateway-select-dollar-amount' => 'Select Dollar Amount',
 191+ 'payflowpro_gateway-submit-my-secure-donation' => 'Submit My Secure Donation',
 192+ 'payflowpro_gateway-next' => 'Next',
 193+ 'payflowpro_gateway-continue' => 'Continue',
 194+ 'payflowpro_gateway-cancel' => 'Cancel',
 195+
 196+ // For more USA states, see payflowpro_gateway.us-states.i18n.php.
 197+ 'payflowpro_gateway-state-dropdown-YY' => 'Select a State',
 198+ 'payflowpro_gateway-state-dropdown-XX' => 'Outside the U.S.',
120199 );
121200
122201 /** Message documentation (Message documentation)
@@ -191,6 +270,12 @@
192271 'payflowpro_gateway-first' => "first name (without the 'name')",
193272 'payflowpro_gateway-last' => "last name (without the 'name')",
194273 'payflowpro_gateway-other' => '{{Identical|Other}}',
 274+
 275+ 'payflowpro_gateway-credit-card-number-abbreviated' => "Abbreviation of 'Credit Card Number'",
 276+ 'payflowpro_gateway-cvv' => "Abbreviation of 'Card Verification Value'",
 277+ 'payflowpro_gateway-cvv-number-abbreviated' => "Abbreviation of 'Card Verification Value Number'",
 278+ 'payflowpro_gateway-cvv2' => "Abbreviation of 'Card Verification Value 2'",
 279+ 'payflowpro_gateway-cvv-number' => "Abbreviation of 'Card Verification Value' + 'Number' (unabbreviated)"
195280 );
196281
197282 /** Magyar (magázó) (Magyar (magázó))
@@ -682,6 +767,8 @@
683768 'payflowpro_gateway-anon-message' => 'Калі ласка, унясіце маё імя ў публічны сьпіс ахвяравальнікаў.',
684769 'payflowpro_gateway-donate-wikipedia' => 'Ахвяраваць на Вікіпэдыю',
685770 'payflowpro_gateway-or' => 'ці',
 771+ 'payflowpro_gateway-state-dropdown-YY' => 'Выбраць штат',
 772+ 'payflowpro_gateway-state-dropdown-XX' => 'Не ў ЗША',
686773 );
687774
688775 /** Bulgarian (Български)
@@ -1015,10 +1102,13 @@
10161103 'payflowpro_gateway-anon-message' => 'Molim navedite moje ime na javnom spisku donatora.',
10171104 'payflowpro_gateway-donate-wikipedia' => 'Donirajte na Wikipediji',
10181105 'payflowpro_gateway-or' => 'ili',
 1106+ 'payflowpro_gateway-state-dropdown-YY' => 'Odaberi Saveznu državu',
 1107+ 'payflowpro_gateway-state-dropdown-XX' => 'Izvan SAD',
10191108 );
10201109
10211110 /** Catalan (Català)
10221111 * @author Aleator
 1112+ * @author Martorell
10231113 * @author SMP
10241114 * @author Solde
10251115 */
@@ -1105,6 +1195,7 @@
11061196 'payflowpro_gateway-question-comment' => 'Preguntes o comentaris? Contacte: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>',
11071197 'payflowpro_gateway-donate-click' => 'La vostra targeta de crèdit serà processada de manera segura.',
11081198 'payflowpro_gateway-otherways' => 'Hi ha <a href="http://wikimediafoundation.org/wiki/Ways_to_Give/ca">altres maneres de fer donatius, incloent PayPal, xecs, o per correu</a>.',
 1199+ 'payflowpro_gateway-otherways-short' => '<a href="http://wikimediafoundation.org/wiki/Ways_to_Give/ca">Altres maneres de donar</a>',
11091200 'payflowpro_gateway-paypal' => 'Teniu un compte PayPal? <a href="$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=ca&utm_source=$3&utm_medium=$4&utm_campaign=$5">Feu un donatiu amb PayPal</a>.',
11101201 'payflowpro_gateway-credit-storage-processing' => 'Nosaltres no emmagatzemem la informació de la targeta de crèdit, i les vostres dades personals estan subjectes a la nostra <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">política de privadesa</a>.',
11111202 'payflowpro_gateway-token-mismatch' => "La vostra sessió ha caducat. Proveu d'omplir i enviar de nou el formulari.",
@@ -1120,6 +1211,10 @@
11211212 Per a proporcionar una experiència segura i agradable, el nostre formulari de donatius requereix JavaScript.',
11221213 'payflowpro_gateway-noscript-redirect-msg' => 'Si no podeu o no voleu habilitar el JavaScript, podeu contribuir accedint a:',
11231214 'payflowpro_gateway-anon-message' => 'Anoteu el meu nom a la llista pública de donants.',
 1215+ 'payflowpro_gateway-donate-wikipedia' => 'Doneu a Wikipedia',
 1216+ 'payflowpro_gateway-or' => 'o',
 1217+ 'payflowpro_gateway-state-dropdown-YY' => 'Seleccioneu un estat',
 1218+ 'payflowpro_gateway-state-dropdown-XX' => 'No sóc als EUA',
11241219 );
11251220
11261221 /** Czech (Česky)
@@ -1229,8 +1324,22 @@
12301325 'payflowpro_gateway-anon-message' => 'Zveřejněte prosím mé jméno na seznamu dárců.',
12311326 'payflowpro_gateway-donate-wikipedia' => 'Přispět na Wikipedii',
12321327 'payflowpro_gateway-or' => 'nebo',
 1328+ 'payflowpro_gateway-state-dropdown-YY' => 'Vyberte stát',
 1329+ 'payflowpro_gateway-state-dropdown-XX' => 'Mimo USA',
12331330 );
12341331
 1332+/** Church Slavic (Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ)
 1333+ * @author ОйЛ
 1334+ */
 1335+$messages['cu'] = array(
 1336+ 'payflowpro_gateway-donor-currency-label' => 'пла́тьно срѣ́дьство',
 1337+ 'payflowpro_gateway-donor-name' => 'и́мѧ',
 1338+ 'payflowpro_gateway-donor-city' => 'гра́дъ',
 1339+ 'payflowpro_gateway-donor-country' => 'дрьжава/страна',
 1340+ 'payflowpro_gateway-error-msg-city' => 'гра́дъ',
 1341+ 'payflowpro_gateway-or' => 'или',
 1342+);
 1343+
12351344 /** Welsh (Cymraeg)
12361345 * @author Arwel Parry
12371346 * @author Lloffiwr
@@ -1431,6 +1540,8 @@
14321541 'payflowpro_gateway-anon-message' => 'Bitte meinen Namen in die öffentliche Spenderliste aufnehmen.',
14331542 'payflowpro_gateway-donate-wikipedia' => 'Spenden auf Wikipedia',
14341543 'payflowpro_gateway-or' => 'oder',
 1544+ 'payflowpro_gateway-state-dropdown-YY' => 'Wähle ein Land',
 1545+ 'payflowpro_gateway-state-dropdown-XX' => 'Außerhalb der Vereinigten Staaten',
14351546 );
14361547
14371548 /** German (formal address) (Deutsch (Sie-Form))
@@ -1440,6 +1551,7 @@
14411552 $messages['de-formal'] = array(
14421553 'payflowpro_gateway-form-message' => 'Verwenden Sie das untenstehende Formular, um per Kreditkarte zu spenden, oder',
14431554 'payflowpro_gateway-form-message-2' => 'Um den Betrag oder die Währung zu ändern, können Sie zur <a href="https://www.mediawiki.org/index.php?title=Donate">Spendenseite</a> zurückkehren.',
 1555+ 'payflow_gateway-error-msg-nopaypal' => 'Aufgrund eines technischen Problems können wir keine Verbindung zu PayPal herstellen. Bitte nutzen Sie stattdessen das Formular für Kreditkartenspenden.',
14441556 'payflowpro_gateway-error-msg-email' => '** Bitte geben Sie eine gültige E-Mail-Adresse ein **',
14451557 'payflowpro_gateway-error-msg-amex' => '** Bitte geben Sie eine korrekte American-Express-Kartennummer ein **',
14461558 'payflowpro_gateway-error-msg-mc' => '** Bitte geben Sie eine korrekte Mastercard-Kartennummer ein **',
@@ -1464,8 +1576,10 @@
14651577 Bitte versuchen Sie es später noch einmal.',
14661578 'php-response-declined' => 'Ihre Transaktion konnte nicht akzeptiert werden.',
14671579 'payflowpro_gateway-thankyou' => 'Vielen Dank für Ihre Spende!',
1468 - 'payflowpro_gateway-donate-click' => 'Nach dem Klick auf „{{int:payflowpro_gateway-donor-submit}}“ werden Ihre Kreditkarteninformationen verarbeitet.',
1469 - 'payflowpro_gateway-credit-storage-processing' => 'Wir speichern Ihre Kreditkarteninformationen nicht, und Ihre persönlichen Daten unterliegen unseren <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">Datenschutzbestimmungen</a>.',
 1580+ 'payflowpro_gateway-question-comment' => 'Fragen oder Kommentare? Kontaktieren Sie uns unter: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>',
 1581+ 'payflowpro_gateway-donate-click' => 'Ihre Kreditkarteninformationen werden gesichert verarbeitet.',
 1582+ 'payflowpro_gateway-paypal' => 'Verfügen Sie über ein PayPal-Konto? <a href="$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=en&utm_source=$3&utm_medium=$4&utm_campaign=$5">Spende per PayPal</a>.',
 1583+ 'payflowpro_gateway-credit-storage-processing' => 'Wir speichern Ihre Kreditkarteninformationen nicht. Zudem unterliegen Ihre persönlichen Daten unseren <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">Datenschutzbestimmungen</a>.',
14701584 'payflowpro_gateway-token-mismatch' => 'Ihre Sitzung ist inzwischen abgelaufen. Bitte füllen Sie das Formular erneut aus und senden Sie es nochmals ab.',
14711585 );
14721586
@@ -2166,6 +2280,7 @@
21672281 );
21682282
21692283 /** Finnish (Suomi)
 2284+ * @author Centerlink
21702285 * @author Crt
21712286 * @author Nike
21722287 * @author Olli
@@ -2256,6 +2371,7 @@
22572372 'payflowpro_gateway-question-comment' => 'Kysymyksiä tai kommentteja? Ota yhteyttä: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>',
22582373 'payflowpro_gateway-donate-click' => 'Luottokorttisi käsitellään turvallisesti.',
22592374 'payflowpro_gateway-otherways' => 'On myös <a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">muita lahjoitustapoja, kuten PayPal, šekki tai posti</a>.',
 2375+ 'payflowpro_gateway-otherways-short' => '<a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">Muut tavat antaa</a>',
22602376 'payflowpro_gateway-paypal' => 'Onko sinulla PayPal-tili? <a href="$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=en&utm_source=$3&utm_medium=$4&utm_campaign=$5">Lahjoita PayPalin avulla</a>.',
22612377 'payflowpro_gateway-credit-storage-processing' => 'Emme tallenna luottokorttitietojasi, ja henkilökohtaisia tietojasi suojaavat <a href="http://wikimediafoundation.org/wiki/Wikimedia:Privacy_policy">tietoturvaperiaatteemme</a>.',
22622378 'payflowpro_gateway-token-mismatch' => 'Istuntosi on vanhentunut. Yritä täyttämällä lomake uudestaan ja lähettämällä se.',
@@ -2266,9 +2382,13 @@
22672383 'payflowpro_gateway-comment' => 'Kommentti',
22682384 'payflowpro_gateway-first' => 'Ensimmäinen',
22692385 'payflowpro_gateway-last' => 'Viimeinen',
 2386+ 'payflowpro_gateway-other' => 'Muu',
22702387 'payflowpro_gateway-noscript-msg' => 'Näyttää siltä, että et ole ottanut JavaScriptiä käyttöön, tai selaimesi ei tue sitä.
22712388 Jotta turvallinen ja miellyttävä lahjoituskokemus annettaisiin, lahjoituslomakkeemme vaatii JavaScriptin.',
22722389 'payflowpro_gateway-noscript-redirect-msg' => 'Jos et voi tai et halua ottaa JavaScriptiä käyttöön, voit siltikin osallistua vierailemalla osoitteessa:',
 2390+ 'payflowpro_gateway-anon-message' => 'Luettele nimeni julkisessa lahjoittajaluettelossa.',
 2391+ 'payflowpro_gateway-donate-wikipedia' => 'Lahjoita Wikipediassa',
 2392+ 'payflowpro_gateway-or' => 'tai',
22732393 );
22742394
22752395 /** French (Français)
@@ -2467,6 +2587,13 @@
24682588 'payflowpro_gateway-last' => 'Dèrriér',
24692589 );
24702590
 2591+/** Friulian (Furlan)
 2592+ * @author Klenje
 2593+ */
 2594+$messages['fur'] = array(
 2595+ 'payflowpro_gateway-donor-name' => 'Non',
 2596+);
 2597+
24712598 /** Irish (Gaeilge)
24722599 * @author Kwekubo
24732600 */
@@ -3185,6 +3312,8 @@
31863313 'payflowpro_gateway-anon-message' => 'Per favor mentiona mi nomine in le lista public de donatores.',
31873314 'payflowpro_gateway-donate-wikipedia' => 'Donar sur Wikipedia',
31883315 'payflowpro_gateway-or' => 'o',
 3316+ 'payflowpro_gateway-state-dropdown-YY' => 'Selige un stato',
 3317+ 'payflowpro_gateway-state-dropdown-XX' => 'Extra le Statos Unite',
31893318 );
31903319
31913320 /** Indonesian (Bahasa Indonesia)
@@ -3500,6 +3629,8 @@
35013630 'payflowpro_gateway-anon-message' => '寄付者の公開一覧への、自分の名前を追加を希望します。',
35023631 'payflowpro_gateway-donate-wikipedia' => 'ウィキペディアに寄付',
35033632 'payflowpro_gateway-or' => 'または',
 3633+ 'payflowpro_gateway-state-dropdown-YY' => '州を選択',
 3634+ 'payflowpro_gateway-state-dropdown-XX' => 'アメリカ合衆国以外',
35043635 );
35053636
35063637 /** Georgian (ქართული)
@@ -3848,7 +3979,7 @@
38493980 'payflowpro_gateway-donor-name' => 'Numm:',
38503981 'payflowpro_gateway-donor-fname' => 'Virnumm:',
38513982 'payflowpro_gateway-donor-mname' => 'Zweete Virnumm:',
3852 - 'payflowpro_gateway-donor-lname' => 'Familjennumm:',
 3983+ 'payflowpro_gateway-donor-lname' => 'Familljennumm',
38533984 'payflowpro_gateway-donor-street' => 'Strooss:',
38543985 'payflowpro_gateway-donor-city' => 'Stad:',
38553986 'payflowpro_gateway-donor-state' => 'Staat:',
@@ -3873,7 +4004,7 @@
38744005 'payflowpro_gateway-error-msg-amount' => 'Betrag vum Don',
38754006 'payflowpro_gateway-error-msg-emailAdd' => 'E-Mailadress',
38764007 'payflowpro_gateway-error-msg-fname' => 'Virnumm',
3877 - 'payflowpro_gateway-error-msg-lname' => 'Familjennumm',
 4008+ 'payflowpro_gateway-error-msg-lname' => 'Familljennumm',
38784009 'payflowpro_gateway-error-msg-street' => 'Adress',
38794010 'payflowpro_gateway-error-msg-city' => 'Stad/Uertschaft',
38804011 'payflowpro_gateway-error-msg-state' => 'Staat',
@@ -3932,6 +4063,8 @@
39334064 'payflowpro_gateway-anon-message' => 'Setzt mäin Numm w.e.g. op déi ëffentlech Lëscht vun den Donateuren.',
39344065 'payflowpro_gateway-donate-wikipedia' => 'Maacht en Don op Wikipedia',
39354066 'payflowpro_gateway-or' => 'oder',
 4067+ 'payflowpro_gateway-state-dropdown-YY' => 'Sicht e Staat eraus',
 4068+ 'payflowpro_gateway-state-dropdown-XX' => 'Ausserhalb de Vereenegte Staate vun Amerika',
39364069 );
39374070
39384071 /** Limburgish (Limburgs)
@@ -4092,6 +4225,8 @@
40934226 'payflowpro_gateway-anon-message' => 'Наведете ме во јавниот список на дарители.',
40944227 'payflowpro_gateway-donate-wikipedia' => 'Донирајте на Википедија',
40954228 'payflowpro_gateway-or' => 'или',
 4229+ 'payflowpro_gateway-state-dropdown-YY' => 'Одберете сој. држава',
 4230+ 'payflowpro_gateway-state-dropdown-XX' => 'Надвор од САД',
40964231 );
40974232
40984233 /** Malayalam (മലയാളം)
@@ -4203,6 +4338,8 @@
42044339 'payflowpro_gateway-anon-message' => 'ദയവായി പൊതുസംഭാവകരുടെ പട്ടികയിൽ എന്റെ പേര് പ്രദർശിപ്പിക്കുക.',
42054340 'payflowpro_gateway-donate-wikipedia' => 'വിക്കിപീഡിയയിൽ സംഭാവന ചെയ്യുക',
42064341 'payflowpro_gateway-or' => 'അഥവാ',
 4342+ 'payflowpro_gateway-state-dropdown-YY' => 'സംസ്ഥാനം തിരഞ്ഞെടുക്കുക',
 4343+ 'payflowpro_gateway-state-dropdown-XX' => 'അമേരിക്കൻ ഐക്യനാടുകളല്ല',
42074344 );
42084345
42094346 /** Malay (Bahasa Melayu)
@@ -4589,6 +4726,8 @@
45904727 'payflowpro_gateway-anon-message' => 'Mijn naam mag zichtbaar zijn op de publieke lijst met donoren.',
45914728 'payflowpro_gateway-donate-wikipedia' => 'Doneren aan Wikipedia',
45924729 'payflowpro_gateway-or' => 'of',
 4730+ 'payflowpro_gateway-state-dropdown-YY' => 'Selecteer een staat',
 4731+ 'payflowpro_gateway-state-dropdown-XX' => 'Buiten de VS',
45934732 );
45944733
45954734 /** Norwegian Nynorsk (‪Norsk (nynorsk)‬)
@@ -4739,6 +4878,8 @@
47404879 'payflowpro_gateway-anon-message' => 'Vennligst list opp navnet mitt på den offentlige donorlisten.',
47414880 'payflowpro_gateway-donate-wikipedia' => 'Doner på Wikipedia',
47424881 'payflowpro_gateway-or' => 'eller',
 4882+ 'payflowpro_gateway-state-dropdown-YY' => 'Velg en stat',
 4883+ 'payflowpro_gateway-state-dropdown-XX' => 'Utenfor USA',
47434884 );
47444885
47454886 /** Occitan (Occitan)
@@ -4948,6 +5089,8 @@
49495090 'payflowpro_gateway-anon-message' => 'Wyświetlaj mnie na publicznie widocznej liście darczyńców.',
49505091 'payflowpro_gateway-donate-wikipedia' => 'Darowizna dla Wikipedii',
49515092 'payflowpro_gateway-or' => 'lub',
 5093+ 'payflowpro_gateway-state-dropdown-YY' => 'Wybierz stan',
 5094+ 'payflowpro_gateway-state-dropdown-XX' => 'Poza USA',
49525095 );
49535096
49545097 /** Piedmontese (Piemontèis)
@@ -5038,6 +5181,7 @@
50395182 'payflowpro_gateway-question-comment' => 'Chestion o coment? Contat: <a href="mailto:donate@wikimedia.org">donate@wikimedia.org</a>',
50405183 'payflowpro_gateway-donate-click' => 'Soa carta ëd crédit a sarà tratà an manera sigura.',
50415184 'payflowpro_gateway-otherways' => 'A-i é <a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">d\'àutre manere ëd doné, comprèis PayPal, s-cianchet, o pòsta</a>.',
 5185+ 'payflowpro_gateway-otherways-short' => '<a href="http://wikimediafoundation.org/wiki/Ways_to_Give/en">Autre manere për doné</a>',
50425186 'payflowpro_gateway-paypal' => 'Ha-lo un cont PayPal? <a href="$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=en&utm_source=$3&utm_medium=$4&utm_campaign=$5">Ch\'a eufra con PayPal</a>.',
50435187 'payflowpro_gateway-credit-storage-processing' => 'Noi i memorisoma pa j\'anformassion ëd soa carta ëd crédit, e ij sò dat përsonaj a son soget a nòstre <a href="http://wikimediafoundation.org/wiki/Donor_Privacy_Policy">régole ëd confidensialità</a>.',
50445188 'payflowpro_gateway-token-mismatch' => "Soa session a l'é terminà. Për piasì, ch'a preuva a ampinì e a mandé torna ël formolari.",
@@ -5052,6 +5196,10 @@
50535197 'payflowpro_gateway-noscript-msg' => "A smija ch'a l'abia nen JavaScript abilità, o sò navigador a lo manten pa. Për smon-e n'esperiensa sicura, sensa arzigh e piasosa, nòst formolari ëd donassion a ciama JavaScript.",
50545198 'payflowpro_gateway-noscript-redirect-msg' => "S'a peul o a veul pa abilité JavaScript, a peul ancor contribuì an visitand:",
50555199 'payflowpro_gateway-anon-message' => 'Për piasì lista mè nòm an sla lista pùblica dij donator.',
 5200+ 'payflowpro_gateway-donate-wikipedia' => 'Doné dzora a Wikipedia',
 5201+ 'payflowpro_gateway-or' => 'o',
 5202+ 'payflowpro_gateway-state-dropdown-YY' => 'Selession-a në Stat',
 5203+ 'payflowpro_gateway-state-dropdown-XX' => 'Fòra djë Stat Unì',
50565204 );
50575205
50585206 /** Pashto (پښتو)
@@ -5203,6 +5351,8 @@
52045352 'payflowpro_gateway-anon-message' => 'Por favor, coloque o meu nome na lista pública de benfeitores.',
52055353 'payflowpro_gateway-donate-wikipedia' => 'Faça um donativo na Wikipédia',
52065354 'payflowpro_gateway-or' => 'ou',
 5355+ 'payflowpro_gateway-state-dropdown-YY' => 'Seleccione um Estado.',
 5356+ 'payflowpro_gateway-state-dropdown-XX' => 'Fora dos EUA.',
52075357 );
52085358
52095359 /** Brazilian Portuguese (Português do Brasil)
@@ -5492,6 +5642,9 @@
54935643 'payflowpro_gateway-last' => 'Urteme',
54945644 'payflowpro_gateway-other' => 'Otre',
54955645 'payflowpro_gateway-anon-message' => "Se preghe de sckaffà 'u nome mèje jndr'à la liste de le donatore pubbleche.",
 5646+ 'payflowpro_gateway-or' => 'o',
 5647+ 'payflowpro_gateway-state-dropdown-YY' => "Scacchie 'nu State",
 5648+ 'payflowpro_gateway-state-dropdown-XX' => 'Fore a le State Aunìte',
54965649 );
54975650
54985651 /** Russian (Русский)
@@ -6048,6 +6201,8 @@
60496202 'payflowpro_gateway-anon-message' => 'Prosim, navedite moje ime na javnem seznamu donatorjev.',
60506203 'payflowpro_gateway-donate-wikipedia' => 'Darujte na Wikipediji',
60516204 'payflowpro_gateway-or' => 'ali',
 6205+ 'payflowpro_gateway-state-dropdown-YY' => 'Izberite državo',
 6206+ 'payflowpro_gateway-state-dropdown-XX' => 'Izven ZDA',
60526207 );
60536208
60546209 /** Serbian Cyrillic ekavian (Српски (ћирилица))
@@ -6885,6 +7040,7 @@
68867041 'payflowpro_gateway-anon-message' => "Будь ласка, включіть моє ім'я у відкритий список донорів",
68877042 'payflowpro_gateway-donate-wikipedia' => 'Пожертвувати на Вікіпедію',
68887043 'payflowpro_gateway-or' => 'або',
 7044+ 'payflowpro_gateway-state-dropdown-XX' => 'За межами США',
68897045 );
68907046
68917047 /** Vèneto (Vèneto)
@@ -7095,6 +7251,8 @@
70967252 'payflowpro_gateway-anon-message' => 'Xin ghi tên của tôi vào danh sách người đóng góp công cộng.',
70977253 'payflowpro_gateway-donate-wikipedia' => 'Quyên góp trên Wikipedia',
70987254 'payflowpro_gateway-or' => 'hoặc',
 7255+ 'payflowpro_gateway-state-dropdown-YY' => 'Chọn tiểu bang',
 7256+ 'payflowpro_gateway-state-dropdown-XX' => 'Bên ngoài Hoa Kỳ',
70997257 );
71007258
71017259 /** Volapük (Volapük)
@@ -7202,6 +7360,7 @@
72037361 /** Simplified Chinese (‪中文(简体)‬)
72047362 * @author Bencmq
72057363 * @author Chenxiaoqino
 7364+ * @author Hydra
72067365 * @author Liangent
72077366 * @author Wilsonmess
72087367 */
@@ -7298,9 +7457,12 @@
72997458 'payflowpro_gateway-comment' => '注释',
73007459 'payflowpro_gateway-first' => '首先',
73017460 'payflowpro_gateway-last' => '最后',
 7461+ 'payflowpro_gateway-other' => '其他',
73027462 'payflowpro_gateway-noscript-msg' => '似乎你没有启用JavaScript,或者你的浏览器不支持JavaScript。
73037463 为了给你提供安全、 舒适的体验,我们的捐助表格需要使用JavaScript。',
73047464 'payflowpro_gateway-noscript-redirect-msg' => '如果你不想或不能启用JavaScript, 你依然可以在以下地址完成捐助:',
 7465+ 'payflowpro_gateway-or' => '或者',
 7466+ 'payflowpro_gateway-state-dropdown-XX' => '不再美国内',
73057467 );
73067468
73077469 /** Traditional Chinese (‪中文(繁體)‬)
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.php
@@ -1,7 +1,7 @@
22 <?php
33
44 # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
5 -if( !defined( 'MEDIAWIKI' ) ) {
 5+if ( !defined( 'MEDIAWIKI' ) ) {
66 echo <<<EOT
77 To install PayflowPro Gateway extension, put the following line in LocalSettings.php:
88 require_once( "\$IP/extensions/payflowpro_gateway/payflowpro_gateway.php" );
@@ -19,7 +19,7 @@
2020 );
2121
2222 // Set up the new special page
23 -$dir = dirname(__FILE__) . '/';
 23+$dir = dirname( __FILE__ ) . '/';
2424 $wgAutoloadClasses['PayflowProGateway'] = $dir . 'payflowpro_gateway.body.php';
2525 $wgAutoloadClasses[ 'PayflowProGateway_Form' ] = $dir . 'forms/Form.php';
2626 $wgAutoloadClasses[ 'PayflowProGateway_Form_OneStepTwoColumn' ] = $dir . 'forms/OneStepTwoColumn.php';
@@ -43,10 +43,10 @@
4444
4545 $wgPayFlowProGatewayCSSVersion = 1;
4646
47 -$wgPayflowProPartnerID = ''; //PayPal or original authorized reseller
 47+$wgPayflowProPartnerID = ''; // PayPal or original authorized reseller
4848 $wgPayflowProVendorID = ''; // paypal merchant login ID
49 -$wgPayflowProUserID = ''; //if one or more users are set up, authorized user ID, else same as VENDOR
50 -$wgPayflowProPassword = ''; //merchant login password
 49+$wgPayflowProUserID = ''; // if one or more users are set up, authorized user ID, else same as VENDOR
 50+$wgPayflowProPassword = ''; // merchant login password
5151
5252 // a boolean to determine if we're in testing mode
5353 $wgPayflowGatewayTest = FALSE;
@@ -75,7 +75,7 @@
7676 *
7777 * This string gets run like so: $wg->addHtml( $wg->Parse( $wgpayflowGatewayHeader ))
7878 * You can use '@language' as a placeholder token to extract the user's language.
79 - *
 79+ *
8080 */
8181 $wgPayflowGatewayHeader = NULL;
8282
@@ -86,10 +86,10 @@
8787
8888 /**
8989 * Proxy settings
90 - *
 90+ *
9191 * If you need to use an HTTP proxy for outgoing traffic,
9292 * set wgPayflowGatweayUseHTTPProxy=TRUE and set $wgPayflowGatewayHTTPProxy
93 - * to the proxy desination.
 93+ * to the proxy desination.
9494 * eg:
9595 * $wgPayflowGatewayUseHTTPProxy=TRUE;
9696 * $wgPayflowGatewayHTTPProxy='192.168.1.1:3128'
@@ -104,14 +104,14 @@
105105
106106 /**
107107 * Set the max-age value for Squid
108 - *
 108+ *
109109 * If you have Squid enabled for caching, use this variable to configure
110110 * the s-max-age for cached requests.
111111 * @var int Time in seconds
112112 */
113113 $wgPayflowSMaxAge = 6000;
114114
115 -/**
 115+/**
116116 * Hooks required to interface with the donation extension (include <donate> on page)
117117 *
118118 * gwValue supplies the value of the form option, the name that appears on the form
@@ -125,21 +125,21 @@
126126 $wgAutoloadClasses[ 'ApiPayflowProGateway' ] = $dir . 'api_payflowpro_gateway.php';
127127
128128 function payflowGatewayConnection() {
129 - global $wgPayflowGatewayDBserver, $wgPayflowGatewayDBname;
130 - global $wgPayflowGatewayDBuser, $wgPayflowGatewayDBpassword;
 129+ global $wgPayflowGatewayDBserver, $wgPayflowGatewayDBname;
 130+ global $wgPayflowGatewayDBuser, $wgPayflowGatewayDBpassword;
131131
132 - static $db;
 132+ static $db;
133133
134 - if ( !$db ) {
135 - $db = new DatabaseMysql(
136 - $wgPayflowGatewayDBserver,
137 - $wgPayflowGatewayDBuser,
138 - $wgPayflowGatewayDBpassword,
139 - $wgPayflowGatewayDBname );
140 - $db->query( "SET names utf8" );
141 - }
 134+ if ( !$db ) {
 135+ $db = new DatabaseMysql(
 136+ $wgPayflowGatewayDBserver,
 137+ $wgPayflowGatewayDBuser,
 138+ $wgPayflowGatewayDBpassword,
 139+ $wgPayflowGatewayDBname );
 140+ $db->query( "SET names utf8" );
 141+ }
142142
143 - return $db;
 143+ return $db;
144144 }
145145
146146 /**
@@ -147,22 +147,21 @@
148148 * also supplies currencies supported by this gateway
149149 */
150150 function pfpGatewayValue( &$values ) {
 151+ $values['payflow'] = array(
 152+ 'gateway' => 'payflow',
 153+ 'display_name' => 'Credit Card',
 154+ 'form_value' => 'payflow',
 155+ 'currencies' => array(
 156+ 'GBP' => 'GBP: British Pound',
 157+ 'EUR' => 'EUR: Euro',
 158+ 'USD' => 'USD: U.S. Dollar',
 159+ 'AUD' => 'AUD: Australian Dollar',
 160+ 'CAD' => 'CAD: Canadian Dollar',
 161+ 'JPY' => 'JPY: Japanese Yen',
 162+ ),
 163+ );
151164
152 - $values['payflow'] = array(
153 - 'gateway' => 'payflow',
154 - 'display_name' => 'Credit Card',
155 - 'form_value' => 'payflow',
156 - 'currencies' => array(
157 - 'GBP' => 'GBP: British Pound',
158 - 'EUR' => 'EUR: Euro',
159 - 'USD' => 'USD: U.S. Dollar',
160 - 'AUD' => 'AUD: Australian Dollar',
161 - 'CAD' => 'CAD: Canadian Dollar',
162 - 'JPY' => 'JPY: Japanese Yen',
163 - ),
164 - );
165 -
166 - return true;
 165+ return true;
167166 }
168167
169168 /**
@@ -173,15 +172,8 @@
174173 * the result might look like this: http://www.yourdomain.com/index.php?title=Special:PayflowPro&amount=75.00&currency_code=USD&payment_method=payflow
175174 */
176175 function pfpGatewayPage( &$url ) {
177 - global $wgScript;
 176+ global $wgScript;
178177
179 - $url['payflow'] = $wgScript . "?title=Special:PayflowProGateway";
180 - return true;
 178+ $url['payflow'] = $wgScript . "?title=Special:PayflowProGateway";
 179+ return true;
181180 }
182 -
183 -//Add JQuery
184 -$wgHooks['BeforePageDisplay'][] = 'pfpAddJQuery';
185 -function pfpAddJQuery($out, $sk){
186 - $out->includeJQuery();
187 - return true;
188 -}
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/owa_get_info.js
@@ -6,7 +6,7 @@
77 //NOTE: This only works as long as sid is the last param in the OWA cookie
88 if(owaS_start_index >= 0){
99 var owaSessionID = owa_s_val.substr(owaS_start_index + owa_s_ident.length);
10 - if(document.getElementById("owa_session_id") &&
 10+ if(document.getElementById("owa_session_id") &&
1111 document.getElementById("owa_pageref") ){ ){
1212 document.getElementById("owa_session_id").value = owaSessionID;
1313 document.getElementById("owa_pageref").value = encode(window.location);
Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/payflowpro_gateway.us-states.i18n.php
@@ -10,8 +10,9 @@
1111
1212 /** English */
1313 $messages['en'] = array(
14 - 'payflowpro_gateway-state-dropdown-YY' => 'Select a State',
15 - 'payflowpro_gateway-state-dropdown-XX' => 'Outside the U.S.',
 14+ // Below two messages are in payflowpro_gateway.i18n.php.
 15+ //'payflowpro_gateway-state-dropdown-YY' => 'Select a State',
 16+ //'payflowpro_gateway-state-dropdown-XX' => 'Outside the U.S.',
1617 'payflowpro_gateway-state-dropdown-AK' => 'Alaska',
1718 'payflowpro_gateway-state-dropdown-AL' => 'Alabama',
1819 'payflowpro_gateway-state-dropdown-AR' => 'Arkansas',
Index: branches/fundraising/deployment/DonationInterface/paypal_gateway/paypal_gateway.i18n.php
@@ -10,7 +10,7 @@
1111
1212 /** English */
1313 $messages['en'] = array(
14 - //'paypalgateway' => 'Paypal gateway', // FIXME: remove? Appears to be unused.
 14+ // 'paypalgateway' => 'Paypal gateway', // FIXME: remove? Appears to be unused.
1515 'paypal_gateway-desc' => 'Registers PayPal as a donation mechanism',
1616 );
1717
Index: branches/fundraising/deployment/DonationInterface/paypal_gateway/paypal_gateway.php
@@ -1,6 +1,6 @@
22 <?php
33 # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
4 -if( !defined( 'MEDIAWIKI' ) ) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 echo <<<EOT
66 To install my extension, put the following line in LocalSettings.php:
77 require_once( "\$IP/extensions/DonationInterface/paypal_gateway/paypal_gateway.php" );
@@ -76,10 +76,10 @@
7777 */
7878 function paypalGatewayPage( &$url ) {
7979 // Business email address set in LocalSettings.php
80 - global $wgPaypalEmail, $wgPaypalUrl;
 80+ global $wgPaypalUrl;
8181
8282 // to go directly to Paypal, will be used for this extension in general
83 - //$url['paypal'] = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=" . urlencode( $wgPaypalEmail ) . "&lc=US&no_note=1&no_shipping=1&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted";
 83+ // $url['paypal'] = "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=" . urlencode( $wgPaypalEmail ) . "&lc=US&no_note=1&no_shipping=1&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted";
8484
8585 // specifically for Wikimedia, goes to processor page
8686 $url['paypal'] = $wgPaypalUrl;
Index: branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface.php
@@ -7,7 +7,7 @@
88 * @link http://www.mediawiki.org/wiki/Extension:DonateInterface Documentation
99 */
1010
11 -if( !defined( 'MEDIAWIKI' ) ) {
 11+if ( !defined( 'MEDIAWIKI' ) ) {
1212 die( "This is not a valid entry point.\n" );
1313 }
1414
@@ -16,8 +16,8 @@
1717 $wgExtensionCredits['specialpage'][] = array(
1818 'path' => __FILE__,
1919 'name' => 'DonateInterface',
20 - //'author' => array( 'diana' ), // FIXME: Committer does not have details in http://svn.wikimedia.org/viewvc/mediawiki/USERINFO/
21 - 'descriptionmsg' => 'donate_interface-desc',
 20+ // 'author' => array( 'diana' ), // FIXME: Committer does not have details in http://svn.wikimedia.org/viewvc/mediawiki/USERINFO/
 21+ 'descriptionmsg' => 'donate_interface-desc',
2222 'url' => 'http://www.mediawiki.org/wiki/Extension:DonateInterface',
2323 );
2424
@@ -32,14 +32,9 @@
3333 * Create <donate /> tag to include landing page donation form
3434 */
3535 function efDonateSetup( &$parser ) {
36 - global $wgHooks, $wgRequest;
37 -
38 - //load extension messages
39 - wfLoadExtensionMessages( 'DonateInterface' );
 36+ $parser->setHook( 'donate', 'efDonateRender' );
4037
41 - $parser->setHook( 'donate', 'efDonateRender' );
42 -
43 - return true;
 38+ return true;
4439 }
4540
4641
@@ -53,26 +48,26 @@
5449 function efDonateRender( $input, $args, $parser ) {
5550 global $wgOut, $wgExtensionAssetsPath;
5651 static $formProcessed = false;
57 -
58 - $parser->disableCache();
59 -
60 - // if chapter exists for user's country, redirect
61 - //not currently in use - in place for adding it when ready
62 - //$chapter = fnDonateChapterRedirect();
63 -
64 - // add JavaScript validation to <head>
65 - $wgOut->addScriptFile( $wgExtensionAssetsPath . '/DonationInterface/donate_interface/donate_interface_validate_donation.js' );
66 -
67 - if (!$formProcessed) {
68 - //process form
69 - wfRunHooks( 'DonationInterface_DisplayForm' );
 52+
 53+ $parser->disableCache();
 54+
 55+ // if chapter exists for user's country, redirect
 56+ // not currently in use - in place for adding it when ready
 57+ // $chapter = fnDonateChapterRedirect();
 58+
 59+ // add JavaScript validation to <head>
 60+ $wgOut->addScriptFile( $wgExtensionAssetsPath . '/DonationInterface/donate_interface/donate_interface_validate_donation.js' );
 61+
 62+ if ( !$formProcessed ) {
 63+ // process form
 64+ wfRunHooks( 'DonationInterface_DisplayForm' );
7065 $formProcessed = true;
7166 }
7267
73 - //display form to gather data from user
74 - $output = fnDonateCreateOutput();
75 -
76 - return $output;
 68+ // display form to gather data from user
 69+ $output = fnDonateCreateOutput();
 70+
 71+ return $output;
7772 }
7873
7974 /**
@@ -82,166 +77,159 @@
8378 * option supplies it's value and name for the form, as well as currencies it supports.
8479 */
8580 function fnDonateCreateOutput() {
86 - global $wgOut, $wgRequest;
 81+ global $wgRequest;
8782
88 - // declare variable
89 - $utm_source = '';
90 - $utm_medium = '';
91 - $utm_campaign = '';
92 - $referrer = '';
93 -
94 - // set them equal to post data
95 - $utm_source = $wgRequest->getText( 'utm_source' );
96 - $utm_medium = $wgRequest->getText( 'utm_medium' );
97 - $utm_campaign = $wgRequest->getText( 'utm_campaign' );
98 - $referrer = $wgRequest->getHeader('referer');
99 -
100 - //get language from URL
101 - $url = $wgRequest->getRequestURL();
102 -
103 - if ($url) {
104 - $getLang = explode('/', $url);
105 - $language = substr($getLang[3], 0, 2);
106 - }
107 -
108 - // error check and set "en" as default
109 - if ( !preg_match( '/^[a-z-]+$/', $language ) ) {
110 - $language = 'en';
111 - }
 83+ // set them equal to post data
 84+ $utm_source = $wgRequest->getText( 'utm_source' );
 85+ $utm_medium = $wgRequest->getText( 'utm_medium' );
 86+ $utm_campaign = $wgRequest->getText( 'utm_campaign' );
 87+ $referrer = $wgRequest->getHeader( 'referer' );
11288
113 - //get payment method gateway value and name from each gateway and create menu of options
114 - $values = array();
115 - wfRunHooks('DonationInterface_Value', array(&$values));
116 -
117 - $gatewayMenu = '';
118 -
119 - foreach($values as $current) {
120 - $gatewayMenu .= Xml::option($current['display_name'], $current['form_value']);
121 - }
122 -
123 - //get available currencies
124 -
125 - $currencies = array( 'USD' => "USD: U.S. Dollar" );
126 - //FIXME: It uses the currencies of the last gateway to be loaded. It should probably use the union of currencies, (currencies allowed by any gateway).
127 - foreach($values as $key) {
128 - if (isset($key['currencies'])) {
129 - $currencies = $key['currencies'];
130 - }
 89+ // get language from URL
 90+ $url = $wgRequest->getRequestURL();
 91+
 92+ if ( $url ) {
 93+ $getLang = explode( '/', $url );
 94+ $language = substr( $getLang[3], 0, 2 );
 95+ }
 96+
 97+ // error check and set "en" as default
 98+ if ( !preg_match( '/^[a-z-]+$/', $language ) ) {
 99+ $language = 'en';
 100+ }
 101+
 102+ // get payment method gateway value and name from each gateway and create menu of options
 103+ $values = array();
 104+ wfRunHooks( 'DonationInterface_Value', array( &$values ) );
 105+
 106+ $gatewayMenu = '';
 107+
 108+ foreach ( $values as $current ) {
 109+ $gatewayMenu .= Xml::option( $current['display_name'], $current['form_value'] );
 110+ }
 111+
 112+ // get available currencies
 113+
 114+ $currencies = array( 'USD' => "USD: U.S. Dollar" );
 115+ // FIXME: It uses the currencies of the last gateway to be loaded. It should probably use the union of currencies, (currencies allowed by any gateway).
 116+ foreach ( $values as $key ) {
 117+ if ( isset( $key['currencies'] ) ) {
 118+ $currencies = $key['currencies'];
 119+ }
131120 }
132121
133122 $currencyMenu = '';
134123
135 - foreach( $currencies as $value => $fullName ) {
136 - $currencyMenu .= Xml::option( $fullName, $value );
137 - }
138 -
139 - $output = Xml::openElement( 'form', array( 'name' => "donate", 'method' => "post", 'action' => "", 'onsubmit' => 'return DonateValidateForm(this)' )) .
140 - Xml::openElement( 'div', array('id' => 'mw-donation-intro' )) .
141 - Xml::element( 'p', array( 'class' => 'mw-donation-intro-text' ), wfMsg( 'donate_interface-intro' )) .
142 - Xml::closeElement( 'div' );
143 -
144 - $output .= Xml::hidden( 'utm_source', $utm_source ) .
145 - Xml::hidden( 'utm_medium', $utm_medium ) .
146 - Xml::hidden( 'utm_campaign', $utm_campaign ) .
147 - Xml::hidden( 'language', $language ) .
148 - Xml::hidden( 'referrer', $referrer ) .
149 - XML::hidden('process', '_yes_');
150 -
151 - $amount = array(
152 - Xml::radioLabel(wfMsg( 'donate_interface-big-amount-display' ), 'amount', wfMsg( 'donate_interface-big-amount-value' ), 'input_amount_3', false ),
153 - Xml::radioLabel(wfMsg( 'donate_interface-medium-amount-display' ), 'amount', wfMsg( 'donate_interface-medium-amount-value' ), 'input_amount_2', false ),
154 - Xml::radioLabel(wfMsg( 'donate_interface-small-amount-display' ), 'amount', wfMsg( 'donate_interface-small-amount-value' ), 'input_amount_1', false ),
155 - Xml::inputLabel(wfMsg( 'donate_interface-other-amount' ), 'amountGiven', 'input_amount_other', '5'),
156 - );
157 -
158 - $amountFields = '<table><tr>';
159 - foreach( $amount as $value ) {
160 - $amountFields .= '<td>' . $value . '</td>';
161 - }
162 - $amountFields .= '</tr></table>';
163 -
164 - $output .= Xml::fieldset(wfMsg( 'donate_interface-amount' ), $amountFields, array('class' => "mw-donation-amount"));
165 -
166 - // Build currency options
167 - $default_currency = fnDonateDefaultCurrency();
168 -
169 - $currency_options = '';
 124+ foreach ( $currencies as $value => $fullName ) {
 125+ $currencyMenu .= Xml::option( $fullName, $value );
 126+ }
 127+
 128+ $output = Xml::openElement( 'form', array( 'name' => "donate", 'method' => "post", 'action' => "", 'onsubmit' => 'return DonateValidateForm(this)' ) ) .
 129+ Xml::openElement( 'div', array( 'id' => 'mw-donation-intro' ) ) .
 130+ Xml::element( 'p', array( 'class' => 'mw-donation-intro-text' ), wfMsg( 'donate_interface-intro' ) ) .
 131+ Xml::closeElement( 'div' );
 132+
 133+ $output .= Html::hidden( 'utm_source', $utm_source ) .
 134+ Html::hidden( 'utm_medium', $utm_medium ) .
 135+ Html::hidden( 'utm_campaign', $utm_campaign ) .
 136+ Html::hidden( 'language', $language ) .
 137+ Html::hidden( 'referrer', $referrer ) .
 138+ Html::hidden( 'process', '_yes_' );
 139+
 140+ $amount = array(
 141+ Xml::radioLabel( wfMsg( 'donate_interface-big-amount-display' ), 'amount', wfMsg( 'donate_interface-big-amount-value' ), 'input_amount_3', false ),
 142+ Xml::radioLabel( wfMsg( 'donate_interface-medium-amount-display' ), 'amount', wfMsg( 'donate_interface-medium-amount-value' ), 'input_amount_2', false ),
 143+ Xml::radioLabel( wfMsg( 'donate_interface-small-amount-display' ), 'amount', wfMsg( 'donate_interface-small-amount-value' ), 'input_amount_1', false ),
 144+ Xml::inputLabel( wfMsg( 'donate_interface-other-amount' ), 'amountGiven', 'input_amount_other', '5' ),
 145+ );
 146+
 147+ $amountFields = '<table><tr>';
 148+ foreach ( $amount as $value ) {
 149+ $amountFields .= '<td>' . $value . '</td>';
 150+ }
 151+ $amountFields .= '</tr></table>';
 152+
 153+ $output .= Xml::fieldset( wfMsg( 'donate_interface-amount' ), $amountFields, array( 'class' => "mw-donation-amount" ) );
 154+
 155+ // Build currency options
 156+ $default_currency = fnDonateDefaultCurrency();
 157+
 158+ $currency_options = '';
170159 foreach ( $currencies as $code => $name ) {
171 - $selected = '';
172 - if ( $code == $default_currency ) {
173 - $selected = ' selected="selected"';
174 - }
175 - $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>';
 160+ $selected = '';
 161+ if ( $code == $default_currency ) {
 162+ $selected = ' selected="selected"';
 163+ }
 164+ $currency_options .= '<option value="' . $code . '"' . $selected . '>' . wfMsg( 'donate_interface-' . $code ) . '</option>';
176165 }
177 -
178 - $currencyFields = Xml::openElement( 'select', array( 'name' => 'currency_code', 'id' => "input_currency_code" )) .
179 - $currency_options .
 166+
 167+ $currencyFields = Xml::openElement( 'select', array( 'name' => 'currency_code', 'id' => "input_currency_code" ) ) .
 168+ $currency_options .
180169 Xml::closeElement( 'select' );
181 -
182 - $output .= Xml::fieldset(wfMsg( 'donate_interface-currency' ), $currencyFields, array('class' => "mw-donation-currency" ));
183 -
184 - $gatewayFields = Xml::openElement( 'select', array('name' => 'payment_method', 'id' => 'select_payment_method')) .
 170+
 171+ $output .= Xml::fieldset( wfMsg( 'donate_interface-currency' ), $currencyFields, array( 'class' => "mw-donation-currency" ) );
 172+
 173+ $gatewayFields = Xml::openElement( 'select', array( 'name' => 'payment_method', 'id' => 'select_payment_method' ) ) .
185174 $gatewayMenu .
186 - Xml::closeElement('select');
187 -
188 - $output .= Xml::fieldset(wfMsg( 'donate_interface-gateway' ), $gatewayFields, array( 'class' => 'mw-donation-gateway' ));
189 -
190 - $publicComment = Xml::element( 'div', array( 'class' => 'mw-donation-comment-message'), wfMsg( 'donate_interface-comment-message' )) .
191 - Xml::inputLabel(wfMsg( 'donate_interface-comment-label' ), 'comment', 'comment', '30', '', array( 'maxlength' => '200' )) .
192 - Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' )) .
193 - Xml::checkLabel( wfMsg( 'donate_interface-anon-message' ), 'comment-option', 'input_comment-option', TRUE ) .
 175+ Xml::closeElement( 'select' );
 176+
 177+ $output .= Xml::fieldset( wfMsg( 'donate_interface-gateway' ), $gatewayFields, array( 'class' => 'mw-donation-gateway' ) );
 178+
 179+ $publicComment = Xml::element( 'div', array( 'class' => 'mw-donation-comment-message' ), wfMsg( 'donate_interface-comment-message' ) ) .
 180+ Xml::inputLabel( wfMsg( 'donate_interface-comment-label' ), 'comment', 'comment', '30', '', array( 'maxlength' => '200' ) ) .
 181+ Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' ) ) .
 182+ Xml::checkLabel( wfMsg( 'donate_interface-anon-message' ), 'comment-option', 'input_comment-option', TRUE ) .
194183 Xml::closeElement( 'div' ) .
195 - Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' )) .
 184+ Xml::openElement( 'div', array( 'id' => 'mw-donation-checkbox' ) ) .
196185 Xml::check( 'email-opt', TRUE ) .
197 - Xml::tags( 'span', array( 'class' => 'mw-email-agreement' ), wfMsg( 'donate_interface-email-agreement' )) .
 186+ Xml::tags( 'span', array( 'class' => 'mw-email-agreement' ), wfMsg( 'donate_interface-email-agreement' ) ) .
198187 Xml::closeElement( 'div' );
199 -
200 - $output .= Xml::fieldset(wfMsg( 'donate_interface-comment-title' ), $publicComment, array( 'class' => 'mw-donation-public-comment'));
201 -
202 - $output .= Xml::submitButton(wfMsg( 'donate_interface-submit-button' ));
203 -
204 - $output .= Xml::closeElement( 'form' );
205 -
206 - // NOTE: For testing: show country of origin
207 - //$country = fnDonateGetCountry();
208 - //$output .= Xml::element('p', array('class' => 'mw-donation-test-message'), 'Country:' . $country);
209 -
210 - // NOTE: for testing: show default currency
211 - //$currencyTest = fnDonateDefaultCurrency();
212 - //$output .= Xml::element('p', array('class' => 'mw-donation-test-message'), wfMsg( 'donate_interface-currency' ) . $currencyTest);
213 -
214 - // NOTE: for testing: show IP address
215 - //$referrer = $_SERVER['HTTP_REFERER'];
216 - //$output .= '<p>' . 'Referrer:' . $referrer . '</p>';
217 -
218 - //for testing to show language culled from URL
219 - $output .= '<p>' . ' Language: ' . $language . '</p>';
220 -
221 - return $output;
 188+
 189+ $output .= Xml::fieldset( wfMsg( 'donate_interface-comment-title' ), $publicComment, array( 'class' => 'mw-donation-public-comment' ) );
 190+
 191+ $output .= Xml::submitButton( wfMsg( 'donate_interface-submit-button' ) );
 192+
 193+ $output .= Xml::closeElement( 'form' );
 194+
 195+ // NOTE: For testing: show country of origin
 196+ // $country = fnDonateGetCountry();
 197+ // $output .= Xml::element('p', array('class' => 'mw-donation-test-message'), 'Country:' . $country);
 198+
 199+ // NOTE: for testing: show default currency
 200+ // $currencyTest = fnDonateDefaultCurrency();
 201+ // $output .= Xml::element('p', array('class' => 'mw-donation-test-message'), wfMsg( 'donate_interface-currency' ) . $currencyTest);
 202+
 203+ // NOTE: for testing: show IP address
 204+ // $referrer = $_SERVER['HTTP_REFERER'];
 205+ // $output .= '<p>' . 'Referrer:' . $referrer . '</p>';
 206+
 207+ // for testing to show language culled from URL
 208+ $output .= '<p>' . ' Language: ' . $language . '</p>';
 209+
 210+ return $output;
222211 }
223212
224213 /*
225214 * Redirects user to their chosen payment processor
226 -*
 215+*
227216 * Includes the user's input passed as GET
228217 * $url for the gateway was supplied with the gwPage hook and the key
229218 * matches the form value (also supplied by the gateway)
230219 */
231 -function fnDonateRedirectToProcessorPage($userInput, $url) {
232 - global $wgOut,$wgPaymentGatewayHost;
233 -
234 - $chosenGateway = $userInput['gateway'];
 220+function fnDonateRedirectToProcessorPage( $userInput, $url ) {
 221+ global $wgOut;
235222
236 - $redirectionData = wfArrayToCGI( $userInput );
237 -
238 - //$wgOut->redirect(
239 - //$wgPaymentGatewayHost . $url[$chosenGateway] . $redirectionData
240 - //);
241 -
 223+ $chosenGateway = $userInput['gateway'];
 224+
 225+ $redirectionData = wfArrayToCGI( $userInput );
 226+
 227+ // $wgOut->redirect(
 228+ // $wgPaymentGatewayHost . $url[$chosenGateway] . $redirectionData
 229+ // );
 230+
242231 $wgOut->redirect(
243232 $url[$chosenGateway] . '&' . $redirectionData
244233 );
245 -
246234 }
247235
248236 /**
@@ -251,7 +239,7 @@
252240 function fnDonateGetCountry() {
253241 $country_code = null;
254242
255 - if( function_exists( 'fnGetGeoIP' ) ) {
 243+ if ( function_exists( 'fnGetGeoIP' ) ) {
256244 try {
257245 $country_code = fnGetGeoIP();
258246 } catch ( NotFoundGeoIP $e ) {
@@ -272,34 +260,33 @@
273261 require_once( 'country2currency.inc' );
274262
275263 $country_code = null;
276 - $currency = null;
277264
278 - if( function_exists( 'fnGetCountry' ) ) {
 265+ if ( function_exists( 'fnGetCountry' ) ) {
279266 $country_code = fnGetCountry();
280267 }
281268
282269 $currency = fnCountry2Currency( $country_code );
283270
284 - return $result = $currency ? $currency : 'USD';
 271+ return $currency ? $currency : 'USD';
285272 }
286273
287274 /**
288 - * Will use GeoIP extension to redirect user to
 275+ * Will use GeoIP extension to redirect user to
289276 * chapter page as dictated by IP address
290277 * NOT CURRENTLY IN USE
291278 */
292279 function fnDonateChapterRedirect() {
293280 require_once( 'chapters.inc' );
294 -
 281+
295282 $country_code = null;
296283
297 - if( function_exists( 'fnGetCountry' ) ) {
 284+ if ( function_exists( 'fnGetCountry' ) ) {
298285 $country_code = fnDonateGetCountry();
299286 }
300287
301288 $chapter = fnDonateGetChapter( $country_code );
302289
303 - if( $chapter ) {
 290+ if ( $chapter ) {
304291 global $wgOut;
305292 $wgOut->redirect( 'http://' . $chapter );
306293 } else {
@@ -307,27 +294,27 @@
308295 }
309296
310297 }
311 -
 298+
312299 function fnProcessDonationForm( ) {
313300 global $wgRequest, $wgOut;
314 -
 301+
315302 // Checking that it was posted is not enough, donate_interface-amount-error
316303 // would be shown on previews, anon purges... (bug 22640)
317 - if ( ( !$wgRequest->wasPosted() ) || ( $wgRequest->getVal('process') != "_yes_" ) ) {
 304+ if ( ( !$wgRequest->wasPosted() ) || ( $wgRequest->getVal( 'process' ) != "_yes_" ) ) {
318305 return true;
319306 }
320 - // if form has been submitted, assign data and redirect user to chosen payment gateway
 307+ // if form has been submitted, assign data and redirect user to chosen payment gateway
321308
322 - //find out which amount option was chosen for amount, redefined buttons or text box
323 - if ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText('amount') ) ) {
324 - $amount = number_format( $wgRequest->getText('amount'), 2 );
325 - } elseif ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText('amountGiven') ) ) {
326 - $amount = number_format( $wgRequest->getText('amountGiven'), 2, '.', '' );
 309+ // find out which amount option was chosen for amount, redefined buttons or text box
 310+ if ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amount' ) ) ) {
 311+ $amount = number_format( $wgRequest->getText( 'amount' ), 2 );
 312+ } elseif ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText( 'amountGiven' ) ) ) {
 313+ $amount = number_format( $wgRequest->getText( 'amountGiven' ), 2, '.', '' );
327314 } else {
328315 $wgOut->addHTML( wfMsg( 'donate_interface-amount-error' ) );
329316 return true;
330 - }
331 -
 317+ }
 318+
332319 // create array of user input from post data
333320 $userInput = array (
334321 'currency_code' => $wgRequest->getText( 'currency_code', 'USD' ),
@@ -345,17 +332,17 @@
346333 'lname' => $wgRequest->getText( 'lname', null ),
347334 'email' => $wgRequest->getText( 'emailAdd', null ),
348335 );
349 -
 336+
350337 // ask payment processor extensions for their URL/page title
351338 $url = '';
352 -
353 - if ( wfRunHooks('DonationInterface_Page', array(&$url)) ) {
354 - // send user to correct page for payment
 339+
 340+ if ( wfRunHooks( 'DonationInterface_Page', array( &$url ) ) ) {
 341+ // send user to correct page for payment
355342 fnDonateRedirectToProcessorPage( $userInput, $url );
356343 } else {
357344 $wgOut->addHTML( wfMsg( 'donate_interface-processing-error' ) );
358345 }
359 -
 346+
360347 return true;
361348 }
362349
Index: branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface_validate_donation.js
@@ -47,7 +47,7 @@
4848 alert( 'You must contribute at least $1'.replace('$1', minimums[currency] + ' ' + currency ) );
4949 error = true;
5050 }
51 -
 51+
5252 return !error;
5353 }
5454 //]]>
Index: branches/fundraising/deployment/DonationInterface/donate_interface/donate_interface.i18n.php
@@ -413,6 +413,18 @@
414414 'donate_interface-ILS' => 'ILS: Izraelský šekel',
415415 );
416416
 417+/** Church Slavic (Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ)
 418+ * @author ОйЛ
 419+ */
 420+$messages['cu'] = array(
 421+ 'donate_interface-currency' => 'пла́тьно срѣ́дьство',
 422+ 'donate_interface-submit-button' => 'даꙗ́ниꙗ сътворѥ́ниѥ',
 423+ 'donate_interface-EUR' => 'EUR: єѵрѡ́',
 424+ 'donate_interface-USD' => 'USD: амєрїка́ньскъ до́ларъ',
 425+ 'donate_interface-AUD' => 'AUD: аѵстралі́искъ до́ларъ',
 426+ 'donate_interface-CAD' => 'CAD: канадьскъ до́ларъ',
 427+);
 428+
417429 /** Welsh (Cymraeg)
418430 * @author Lloffiwr
419431 */
@@ -882,6 +894,14 @@
883895 'donate_interface-ILS' => 'ILS : ch·équèl israèlien',
884896 );
885897
 898+/** Friulian (Furlan)
 899+ * @author Klenje
 900+ */
 901+$messages['fur'] = array(
 902+ 'donate_interface-comment-label' => 'Coment:',
 903+ 'donate_interface-comment-title' => 'Coment public',
 904+);
 905+
886906 /** Galician (Galego)
887907 * @author Toliño
888908 */
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/activemq_stomp.php
@@ -1,6 +1,6 @@
22 <?php
33 # Alert the user that this is not a valid entry point to MediaWiki if they try to access the special pages file directly.
4 -if (!defined('MEDIAWIKI')) {
 4+if ( !defined( 'MEDIAWIKI' ) ) {
55 echo <<<EOT
66 To install my extension, put the following line in LocalSettings.php:
77 require_once( "\$IP/extensions/DonationInterface/activemq_stomp/activemq_stomp.php" );
@@ -16,11 +16,11 @@
1717 'version' => '1.0.0',
1818 );
1919
20 -$dir = dirname(__FILE__) . '/';
 20+$dir = dirname( __FILE__ ) . '/';
2121
2222 $wgAutoloadClasses['activemq_stomp'] = $dir . 'activemq_stomp.php'; # Tell MediaWiki to load the extension body.
2323
24 -//default variables that should be set in LocalSettings
 24+// default variables that should be set in LocalSettings
2525 $wgStompServer = "";
2626
2727 $wgHooks['ParserFirstCallInit'][] = 'efStompSetup';
@@ -28,26 +28,25 @@
2929 /*
3030 * Create <donate /> tag to include landing page donation form
3131 */
32 -function efStompSetup(&$parser) {
33 - global $wgParser, $wgOut;
 32+function efStompSetup( &$parser ) {
 33+ global $wgParser;
3434
35 - //redundant and causes Fatal Error
36 - //$parser->disableCache();
 35+ // redundant and causes Fatal Error
 36+ // $parser->disableCache();
3737
38 - $wgParser->setHook( 'stomp', 'efStompTest' );
 38+ $wgParser->setHook( 'stomp', 'efStompTest' );
3939
40 - return true;
 40+ return true;
4141 }
4242
43 -function efStompTest($input, $args, &$parser) {
 43+function efStompTest( $input, $args, &$parser ) {
 44+ $parser->disableCache();
4445
45 - $parser->disableCache();
 46+ $output = "STOMP Test page";
4647
47 - $output = "STOMP Test page";
 48+ wfRunHooks( 'gwStomp', array( &$transaction ) );
4849
49 - wfRunHooks('gwStomp', array(&$transaction));
50 -
51 - return $output;
 50+ return $output;
5251 }
5352
5453 /**
@@ -57,69 +56,66 @@
5857 $wgHooks['gwStomp'][] = 'sendSTOMP';
5958 $wgHooks['gwPendingStomp'][] = 'sendPendingSTOMP';
6059
61 -
6260 /*
6361 * Hook to send transaction information to ActiveMQ server
6462 */
65 -function sendSTOMP($transaction) {
66 - global $wgOut;
67 - global $wgStompServer, $wgStompQueueName;
 63+function sendSTOMP( $transaction ) {
 64+ global $wgStompServer, $wgStompQueueName;
6865
69 - $queueName = isset ( $wgStompQueueName ) ? $wgStompQueueName : 'test';
 66+ $queueName = isset ( $wgStompQueueName ) ? $wgStompQueueName : 'test';
7067
71 - // include a library
72 - require_once("Stomp.php");
 68+ // include a library
 69+ require_once( "Stomp.php" );
7370
74 - $message = json_encode(createQueueMessage($transaction));
 71+ $message = json_encode( createQueueMessage( $transaction ) );
7572
76 - // make a connection
77 - $con = new Stomp($wgStompServer);
 73+ // make a connection
 74+ $con = new Stomp( $wgStompServer );
7875
79 - // connect
80 - $con->connect();
 76+ // connect
 77+ $con->connect();
8178
82 - // send a message to the queue
83 - $result = $con->send("/queue/$queueName", $message, array('persistent' => 'true'));
 79+ // send a message to the queue
 80+ $result = $con->send( "/queue/$queueName", $message, array( 'persistent' => 'true' ) );
8481
85 - if (!$result) {
86 - wfDebugLog('activemq_stomp', 'Send to Q failed for this message: ' . $message);
87 -}
 82+ if ( !$result ) {
 83+ wfDebugLog( 'activemq_stomp', 'Send to Q failed for this message: ' . $message );
 84+ }
8885
89 - $con->disconnect();
 86+ $con->disconnect();
9087
91 - return true;
 88+ return true;
9289 }
9390
9491 /*
9592 * Hook to send transaction information to ActiveMQ server
9693 */
97 -function sendPendingSTOMP($transaction) {
98 - global $wgOut;
99 - global $wgStompServer, $wgPendingStompQueueName;
 94+function sendPendingSTOMP( $transaction ) {
 95+ global $wgStompServer, $wgPendingStompQueueName;
10096
101 - $queueName = isset ( $wgPendingStompQueueName ) ? $wgPendingStompQueueName : 'pending';
 97+ $queueName = isset ( $wgPendingStompQueueName ) ? $wgPendingStompQueueName : 'pending';
10298
103 - // include a library
104 - require_once("Stomp.php");
 99+ // include a library
 100+ require_once( "Stomp.php" );
105101
106 - $message = json_encode(createQueueMessage($transaction));
 102+ $message = json_encode( createQueueMessage( $transaction ) );
107103
108 - // make a connection
109 - $con = new Stomp($wgStompServer);
 104+ // make a connection
 105+ $con = new Stomp( $wgStompServer );
110106
111 - // connect
112 - $con->connect();
 107+ // connect
 108+ $con->connect();
113109
114 - // send a message to the queue
115 - $result = $con->send("/queue/$queueName", $message, array('persistent' => 'true'));
 110+ // send a message to the queue
 111+ $result = $con->send( "/queue/$queueName", $message, array( 'persistent' => 'true' ) );
116112
117 - if (!$result) {
118 - wfDebugLog('activemq_stomp', 'Send to Pending Q failed for this message: ' . $message);
119 -}
 113+ if ( !$result ) {
 114+ wfDebugLog( 'activemq_stomp', 'Send to Pending Q failed for this message: ' . $message );
 115+ }
120116
121 - $con->disconnect();
 117+ $con->disconnect();
122118
123 - return true;
 119+ return true;
124120 }
125121
126122 /**
@@ -135,46 +131,41 @@
136132 * Order ID (generated with transaction) is assigned to 'contribution_tracking_id'?
137133 * Response from Payflow is assigned to 'response'
138134 */
139 -function createQueueMessage($transaction) {
140 - $message = array();
 135+function createQueueMessage( $transaction ) {
 136+ // specifically designed to match the CiviCRM API that will handle it
 137+ // edit this array to include/ignore transaction data sent to the server
 138+ $message = array(
 139+ 'contribution_tracking_id' => $transaction['contribution_tracking_id'],
 140+ 'optout' => $transaction['optout'],
 141+ 'anonymous' => $transaction['anonymous'],
 142+ 'comment' => $transaction['comment'],
 143+ 'utm_source' => $transaction['utm_source'],
 144+ 'utm_medium' => $transaction['utm_medium'],
 145+ 'utm_campaign' => $transaction['utm_campaign'],
 146+ 'language' => $transaction['language'],
 147+ 'referrer' => $transaction['referrer'],
 148+ 'email' => $transaction['email'],
 149+ 'first_name' => $transaction['fname'],
 150+ 'middle_name' => $transaction['mname'],
 151+ 'last_name' => $transaction['lname'],
 152+ 'street_address' => $transaction['street'],
 153+ 'supplemental_address_1' => '',
 154+ 'city' => $transaction['city'],
 155+ 'state_province' => $transaction['state'],
 156+ 'country' => $transaction['country_name'],
 157+ 'countryID' => $transaction['country_code'],
 158+ 'postal_code' => $transaction['zip'],
 159+ 'gateway' => $transaction[ 'gateway' ],
 160+ 'gateway_txn_id' => $transaction['PNREF'],
 161+ 'response' => $transaction['RESPMSG'],
 162+ 'currency' => $transaction['currency'],
 163+ 'original_currency' => $transaction['currency'],
 164+ 'original_gross' => $transaction['amount'],
 165+ 'fee' => '0',
 166+ 'gross' => $transaction['amount'],
 167+ 'net' => $transaction['amount'],
 168+ 'date' => $transaction['date'],
 169+ );
141170
142 - $timestamp = strtotime($transaction['date']);
143 -
144 - // specifically designed to match the CiviCRM API that will handle it
145 - // edit this array to include/ignore transaction data sent to the server
146 - $message = array(
147 - 'contribution_tracking_id' => $transaction['contribution_tracking_id'],
148 - 'optout' => $transaction['optout'],
149 - 'anonymous' => $transaction['anonymous'],
150 - 'comment' => $transaction['comment'],
151 - 'utm_source' => $transaction['utm_source'],
152 - 'utm_medium' => $transaction['utm_medium'],
153 - 'utm_campaign' => $transaction['utm_campaign'],
154 - 'language' => $transaction['language'],
155 - 'referrer' => $transaction['referrer'],
156 - 'email' => $transaction['email'],
157 - 'first_name' => $transaction['fname'],
158 - 'middle_name' => $transaction['mname'],
159 - 'last_name' => $transaction['lname'],
160 - 'street_address' => $transaction['street'],
161 - 'supplemental_address_1' => '',
162 - 'city' => $transaction['city'],
163 - 'state_province' => $transaction['state'],
164 - 'country' => $transaction['country_name'],
165 - 'countryID' => $transaction['country_code'],
166 - 'postal_code' => $transaction['zip'],
167 - 'gateway' => $transaction[ 'gateway' ],
168 - 'gateway_txn_id' => $transaction['PNREF'],
169 - 'response' => $transaction['RESPMSG'],
170 - 'currency' => $transaction['currency'],
171 - 'original_currency' => $transaction['currency'],
172 - 'original_gross' => $transaction['amount'],
173 - 'fee' => '0',
174 - 'gross' => $transaction['amount'],
175 - 'net' => $transaction['amount'],
176 - 'date' => $transaction['date'],
177 -
178 - );
179 -
180 - return $message;
 171+ return $message;
181172 }
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Frame.php
@@ -32,7 +32,7 @@
3333 public $command;
3434 public $headers = array();
3535 public $body;
36 -
 36+
3737 /**
3838 * Constructor
3939 *
@@ -40,25 +40,25 @@
4141 * @param array $headers
4242 * @param string $body
4343 */
44 - public function __construct ($command = null, $headers = null, $body = null)
 44+ public function __construct ( $command = null, $headers = null, $body = null )
4545 {
46 - $this->_init($command, $headers, $body);
 46+ $this->_init( $command, $headers, $body );
4747 }
48 -
49 - protected function _init ($command = null, $headers = null, $body = null)
 48+
 49+ protected function _init ( $command = null, $headers = null, $body = null )
5050 {
5151 $this->command = $command;
52 - if ($headers != null) {
 52+ if ( $headers != null ) {
5353 $this->headers = $headers;
5454 }
5555 $this->body = $body;
56 -
57 - if ($this->command == 'ERROR') {
 56+
 57+ if ( $this->command == 'ERROR' ) {
5858 require_once 'Exception.php';
59 - throw new Stomp_Exception($this->headers['message'], 0, $this->body);
 59+ throw new Stomp_Exception( $this->headers['message'], 0, $this->body );
6060 }
6161 }
62 -
 62+
6363 /**
6464 * Convert frame to transportable string
6565 *
@@ -67,14 +67,14 @@
6868 public function __toString()
6969 {
7070 $data = $this->command . "\n";
71 -
72 - foreach ($this->headers as $name => $value) {
 71+
 72+ foreach ( $this->headers as $name => $value ) {
7373 $data .= $name . ": " . $value . "\n";
7474 }
75 -
 75+
7676 $data .= "\n";
7777 $data .= $this->body;
78 - return $data .= "\x00\n";
 78+ return $data . "\x00\n";
7979 }
8080 }
8181 ?>
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Exception.php
@@ -29,7 +29,7 @@
3030 class Stomp_Exception extends Exception
3131 {
3232 protected $_details;
33 -
 33+
3434 /**
3535 * Constructor
3636 *
@@ -37,13 +37,13 @@
3838 * @param int $code Error code
3939 * @param string $details Stomp server error details
4040 */
41 - public function __construct($message = null, $code = 0, $details = '')
 41+ public function __construct( $message = null, $code = 0, $details = '' )
4242 {
4343 $this->_details = $details;
4444 $message = "Stomp Error. Check host connection. Details suppressed for security.";
45 - parent::__construct($message, $code);
 45+ parent::__construct( $message, $code );
4646 }
47 -
 47+
4848 /**
4949 * Stomp server error details
5050 *
@@ -52,8 +52,8 @@
5353 public function getDetails()
5454 {
5555 return $this->_details;
56 -
 56+
5757 }
58 -
 58+
5959 }
6060 ?>
\ No newline at end of file
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message/Map.php
@@ -30,25 +30,25 @@
3131 class Stomp_Message_Map extends Stomp_Message
3232 {
3333 public $map;
34 -
 34+
3535 /**
3636 * Constructor
3737 *
3838 * @param Stomp_Frame|string $msg
3939 * @param array $headers
4040 */
41 - function __construct ($msg, $headers = null)
 41+ function __construct ( $msg, $headers = null )
4242 {
43 - if ($msg instanceof Stomp_Frame) {
44 - $this->_init($msg->command, $msg->headers, $msg->body);
45 - $this->map = json_decode($msg->body);
 43+ if ( $msg instanceof Stomp_Frame ) {
 44+ $this->_init( $msg->command, $msg->headers, $msg->body );
 45+ $this->map = json_decode( $msg->body );
4646 } else {
47 - $this->_init("SEND", $headers, $msg);
48 - if ($this->headers == null) {
 47+ $this->_init( "SEND", $headers, $msg );
 48+ if ( $this->headers == null ) {
4949 $this->headers = array();
5050 }
5151 $this->headers['amq-msg-type'] = 'MapMessage';
52 - $this->body = json_encode($msg);
 52+ $this->body = json_encode( $msg );
5353 }
5454 }
5555 }
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message/Bytes.php
@@ -35,13 +35,13 @@
3636 * @param string $body
3737 * @param array $headers
3838 */
39 - function __construct ($body, $headers = null)
 39+ function __construct ( $body, $headers = null )
4040 {
41 - $this->_init("SEND", $headers, $body);
42 - if ($this->headers == null) {
 41+ $this->_init( "SEND", $headers, $body );
 42+ if ( $this->headers == null ) {
4343 $this->headers = array();
4444 }
45 - $this->headers['content-length'] = count($body);
 45+ $this->headers['content-length'] = count( $body );
4646 }
4747 }
4848 ?>
\ No newline at end of file
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp/Message.php
@@ -29,9 +29,9 @@
3030 */
3131 class Stomp_Message extends Stomp_Frame
3232 {
33 - public function __construct ($body, $headers = null)
 33+ public function __construct ( $body, $headers = null )
3434 {
35 - $this->_init("SEND", $headers, $body);
 35+ $this->_init( "SEND", $headers, $body );
3636 }
3737 }
3838 ?>
\ No newline at end of file
Index: branches/fundraising/deployment/DonationInterface/activemq_stomp/Stomp.php
@@ -26,7 +26,7 @@
2727 *
2828 * @package Stomp
2929 * @author Hiram Chirino <hiram@hiramchirino.com>
30 - * @author Dejan Bosanac <dejan@nighttale.net>
 30+ * @author Dejan Bosanac <dejan@nighttale.net>
3131 * @author Michael Caplan <mcaplan@labnet.net>
3232 * @version $Revision: 43 $
3333 */
@@ -45,14 +45,14 @@
4646 * @var int
4747 */
4848 public $prefetchSize = 1;
49 -
 49+
5050 /**
5151 * Client id used for durable subscriptions
5252 *
5353 * @var string
5454 */
5555 public $clientId = null;
56 -
 56+
5757 protected $_brokerUri = null;
5858 protected $_socket = null;
5959 protected $_hosts = array();
@@ -66,14 +66,14 @@
6767 protected $_sessionId;
6868 protected $_read_timeout_seconds = 60;
6969 protected $_read_timeout_milliseconds = 0;
70 -
 70+
7171 /**
7272 * Constructor
7373 *
7474 * @param string $brokerUri Broker URL
7575 * @throws Stomp_Exception
7676 */
77 - public function __construct ($brokerUri)
 77+ public function __construct ( $brokerUri )
7878 {
7979 $this->_brokerUri = $brokerUri;
8080 $this->_init();
@@ -86,24 +86,24 @@
8787 protected function _init ()
8888 {
8989 $pattern = "|^(([a-zA-Z]+)://)+\(*([a-zA-Z0-9\.:/i,-]+)\)*\??([a-zA-Z0-9=]*)$|i";
90 - if (preg_match($pattern, $this->_brokerUri, $regs)) {
 90+ if ( preg_match( $pattern, $this->_brokerUri, $regs ) ) {
9191 $scheme = $regs[2];
9292 $hosts = $regs[3];
9393 $params = $regs[4];
94 - if ($scheme != "failover") {
95 - $this->_processUrl($this->_brokerUri);
 94+ if ( $scheme != "failover" ) {
 95+ $this->_processUrl( $this->_brokerUri );
9696 } else {
97 - $urls = explode(",", $hosts);
98 - foreach ($urls as $url) {
99 - $this->_processUrl($url);
 97+ $urls = explode( ",", $hosts );
 98+ foreach ( $urls as $url ) {
 99+ $this->_processUrl( $url );
100100 }
101101 }
102 - if ($params != null) {
103 - parse_str($params, $this->_params);
 102+ if ( $params != null ) {
 103+ parse_str( $params, $this->_params );
104104 }
105105 } else {
106106 require_once 'Stomp/Exception.php';
107 - throw new Stomp_Exception("Bad Broker URL {$this->_brokerUri}");
 107+ throw new Stomp_Exception( "Bad Broker URL {$this->_brokerUri}" );
108108 }
109109 }
110110 /**
@@ -113,14 +113,14 @@
114114 * @throws Stomp_Exception
115115 * @return boolean
116116 */
117 - protected function _processUrl ($url)
 117+ protected function _processUrl ( $url )
118118 {
119 - $parsed = parse_url($url);
120 - if ($parsed) {
121 - array_push($this->_hosts, array($parsed['host'] , $parsed['port'] , $parsed['scheme']));
 119+ $parsed = parse_url( $url );
 120+ if ( $parsed ) {
 121+ array_push( $this->_hosts, array( $parsed['host'] , $parsed['port'] , $parsed['scheme'] ) );
122122 } else {
123123 require_once 'Stomp/Exception.php';
124 - throw new Stomp_Exception("Bad Broker URL $url");
 124+ throw new Stomp_Exception( "Bad Broker URL $url" );
125125 }
126126 }
127127 /**
@@ -130,47 +130,47 @@
131131 */
132132 protected function _makeConnection ()
133133 {
134 - if (count($this->_hosts) == 0) {
 134+ if ( count( $this->_hosts ) == 0 ) {
135135 require_once 'Stomp/Exception.php';
136 - throw new Stomp_Exception("No broker defined");
 136+ throw new Stomp_Exception( "No broker defined" );
137137 }
138 -
 138+
139139 // force disconnect, if previous established connection exists
140140 $this->disconnect();
141 -
 141+
142142 $i = $this->_currentHost;
143143 $att = 0;
144144 $connected = false;
145 - while (! $connected && $att ++ < $this->_attempts) {
146 - if (isset($this->_params['randomize']) && $this->_params['randomize'] == 'true') {
147 - $i = rand(0, count($this->_hosts) - 1);
 145+ while ( ! $connected && $att ++ < $this->_attempts ) {
 146+ if ( isset( $this->_params['randomize'] ) && $this->_params['randomize'] == 'true' ) {
 147+ $i = rand( 0, count( $this->_hosts ) - 1 );
148148 } else {
149 - $i = ($i + 1) % count($this->_hosts);
 149+ $i = ( $i + 1 ) % count( $this->_hosts );
150150 }
151151 $broker = $this->_hosts[$i];
152152 $host = $broker[0];
153153 $port = $broker[1];
154154 $scheme = $broker[2];
155 - if ($port == null) {
 155+ if ( $port == null ) {
156156 $port = $this->_defaultPort;
157157 }
158 - if ($this->_socket != null) {
159 - fclose($this->_socket);
 158+ if ( $this->_socket != null ) {
 159+ fclose( $this->_socket );
160160 $this->_socket = null;
161161 }
162 - $this->_socket = @fsockopen($scheme . '://' . $host, $port);
163 - if (!is_resource($this->_socket) && $att >= $this->_attempts && !array_key_exists($i + 1, $this->_hosts)) {
 162+ $this->_socket = @fsockopen( $scheme . '://' . $host, $port );
 163+ if ( !is_resource( $this->_socket ) && $att >= $this->_attempts && !array_key_exists( $i + 1, $this->_hosts ) ) {
164164 require_once 'Stomp/Exception.php';
165 - throw new Stomp_Exception("Could not connect to $host:$port ($att/{$this->_attempts})");
166 - } else if (is_resource($this->_socket)) {
 165+ throw new Stomp_Exception( "Could not connect to $host:$port ($att/{$this->_attempts})" );
 166+ } else if ( is_resource( $this->_socket ) ) {
167167 $connected = true;
168168 $this->_currentHost = $i;
169169 break;
170170 }
171171 }
172 - if (! $connected) {
 172+ if ( ! $connected ) {
173173 require_once 'Stomp/Exception.php';
174 - throw new Stomp_Exception("Could not connect to a broker");
 174+ throw new Stomp_Exception( "Could not connect to a broker" );
175175 }
176176 }
177177 /**
@@ -181,35 +181,35 @@
182182 * @return boolean
183183 * @throws Stomp_Exception
184184 */
185 - public function connect ($username = '', $password = '')
 185+ public function connect ( $username = '', $password = '' )
186186 {
187187 $this->_makeConnection();
188 - if ($username != '') {
 188+ if ( $username != '' ) {
189189 $this->_username = $username;
190190 }
191 - if ($password != '') {
 191+ if ( $password != '' ) {
192192 $this->_password = $password;
193193 }
194 - $headers = array('login' => $this->_username , 'passcode' => $this->_password);
195 - if ($this->clientId != null) {
 194+ $headers = array( 'login' => $this->_username , 'passcode' => $this->_password );
 195+ if ( $this->clientId != null ) {
196196 $headers["client-id"] = $this->clientId;
197197 }
198 - $frame = new Stomp_Frame("CONNECT", $headers);
199 - $this->_writeFrame($frame);
 198+ $frame = new Stomp_Frame( "CONNECT", $headers );
 199+ $this->_writeFrame( $frame );
200200 $frame = $this->readFrame();
201 - if ($frame instanceof Stomp_Frame && $frame->command == 'CONNECTED') {
 201+ if ( $frame instanceof Stomp_Frame && $frame->command == 'CONNECTED' ) {
202202 $this->_sessionId = $frame->headers["session"];
203203 return true;
204204 } else {
205205 require_once 'Stomp/Exception.php';
206 - if ($frame instanceof Stomp_Frame) {
207 - throw new Stomp_Exception("Unexpected command: {$frame->command}", 0, $frame->body);
 206+ if ( $frame instanceof Stomp_Frame ) {
 207+ throw new Stomp_Exception( "Unexpected command: {$frame->command}", 0, $frame->body );
208208 } else {
209 - throw new Stomp_Exception("Connection not acknowledged");
 209+ throw new Stomp_Exception( "Connection not acknowledged" );
210210 }
211211 }
212212 }
213 -
 213+
214214 /**
215215 * Check if client session has ben established
216216 *
@@ -217,7 +217,7 @@
218218 */
219219 public function isConnected ()
220220 {
221 - return !empty($this->_sessionId) && is_resource($this->_socket);
 221+ return !empty( $this->_sessionId ) && is_resource( $this->_socket );
222222 }
223223 /**
224224 * Current stomp session ID
@@ -229,7 +229,7 @@
230230 return $this->_sessionId;
231231 }
232232 /**
233 - * Send a message to a destination in the messaging system
 233+ * Send a message to a destination in the messaging system
234234 *
235235 * @param string $destination Destination queue
236236 * @param string|Stomp_Frame $msg Message
@@ -237,20 +237,20 @@
238238 * @param boolean $sync Perform request synchronously
239239 * @return boolean
240240 */
241 - public function send ($destination, $msg, $properties = null, $sync = null)
 241+ public function send ( $destination, $msg, $properties = null, $sync = null )
242242 {
243 - if ($msg instanceof Stomp_Frame) {
 243+ if ( $msg instanceof Stomp_Frame ) {
244244 $msg->headers['destination'] = $destination;
245 - $msg->headers = array_merge($msg->headers, $properties);
 245+ $msg->headers = array_merge( $msg->headers, $properties );
246246 $frame = $msg;
247247 } else {
248248 $headers = $properties;
249249 $headers['destination'] = $destination;
250 - $frame = new Stomp_Frame('SEND', $headers, $msg);
 250+ $frame = new Stomp_Frame( 'SEND', $headers, $msg );
251251 }
252 - $this->_prepareReceipt($frame, $sync);
253 - $this->_writeFrame($frame);
254 - return $this->_waitForReceipt($frame, $sync);
 252+ $this->_prepareReceipt( $frame, $sync );
 253+ $this->_writeFrame( $frame );
 254+ return $this->_waitForReceipt( $frame, $sync );
255255 }
256256 /**
257257 * Prepair frame receipt
@@ -258,14 +258,14 @@
259259 * @param Stomp_Frame $frame
260260 * @param boolean $sync
261261 */
262 - protected function _prepareReceipt (Stomp_Frame $frame, $sync)
 262+ protected function _prepareReceipt ( Stomp_Frame $frame, $sync )
263263 {
264264 $receive = $this->sync;
265 - if ($sync !== null) {
 265+ if ( $sync !== null ) {
266266 $receive = $sync;
267267 }
268 - if ($receive == true) {
269 - $frame->headers['receipt'] = md5(microtime());
 268+ if ( $receive == true ) {
 269+ $frame->headers['receipt'] = md5( microtime() );
270270 }
271271 }
272272 /**
@@ -276,32 +276,32 @@
277277 * @return boolean
278278 * @throws Stomp_Exception
279279 */
280 - protected function _waitForReceipt (Stomp_Frame $frame, $sync)
 280+ protected function _waitForReceipt ( Stomp_Frame $frame, $sync )
281281 {
282282
283283 $receive = $this->sync;
284 - if ($sync !== null) {
 284+ if ( $sync !== null ) {
285285 $receive = $sync;
286286 }
287 - if ($receive == true) {
288 - $id = (isset($frame->headers['receipt'])) ? $frame->headers['receipt'] : null;
289 - if ($id == null) {
 287+ if ( $receive == true ) {
 288+ $id = ( isset( $frame->headers['receipt'] ) ) ? $frame->headers['receipt'] : null;
 289+ if ( $id == null ) {
290290 return true;
291291 }
292292 $frame = $this->readFrame();
293 - if ($frame instanceof Stomp_Frame && $frame->command == 'RECEIPT') {
294 - if ($frame->headers['receipt-id'] == $id) {
 293+ if ( $frame instanceof Stomp_Frame && $frame->command == 'RECEIPT' ) {
 294+ if ( $frame->headers['receipt-id'] == $id ) {
295295 return true;
296296 } else {
297297 require_once 'Stomp/Exception.php';
298 - throw new Stomp_Exception("Unexpected receipt id {$frame->headers['receipt-id']}", 0, $frame->body);
 298+ throw new Stomp_Exception( "Unexpected receipt id {$frame->headers['receipt-id']}", 0, $frame->body );
299299 }
300300 } else {
301301 require_once 'Stomp/Exception.php';
302 - if ($frame instanceof Stomp_Frame) {
303 - throw new Stomp_Exception("Unexpected command {$frame->command}", 0, $frame->body);
 302+ if ( $frame instanceof Stomp_Frame ) {
 303+ throw new Stomp_Exception( "Unexpected command {$frame->command}", 0, $frame->body );
304304 } else {
305 - throw new Stomp_Exception("Receipt not received");
 305+ throw new Stomp_Exception( "Receipt not received" );
306306 }
307307 }
308308 }
@@ -316,23 +316,23 @@
317317 * @return boolean
318318 * @throws Stomp_Exception
319319 */
320 - public function subscribe ($destination, $properties = null, $sync = null)
 320+ public function subscribe ( $destination, $properties = null, $sync = null )
321321 {
322 - $headers = array('ack' => 'client');
 322+ $headers = array( 'ack' => 'client' );
323323 $headers['activemq.prefetchSize'] = $this->prefetchSize;
324 - if ($this->clientId != null) {
 324+ if ( $this->clientId != null ) {
325325 $headers["activemq.subcriptionName"] = $this->clientId;
326326 }
327 - if (isset($properties)) {
328 - foreach ($properties as $name => $value) {
 327+ if ( isset( $properties ) ) {
 328+ foreach ( $properties as $name => $value ) {
329329 $headers[$name] = $value;
330330 }
331331 }
332332 $headers['destination'] = $destination;
333 - $frame = new Stomp_Frame('SUBSCRIBE', $headers);
334 - $this->_prepareReceipt($frame, $sync);
335 - $this->_writeFrame($frame);
336 - if ($this->_waitForReceipt($frame, $sync) == true) {
 333+ $frame = new Stomp_Frame( 'SUBSCRIBE', $headers );
 334+ $this->_prepareReceipt( $frame, $sync );
 335+ $this->_writeFrame( $frame );
 336+ if ( $this->_waitForReceipt( $frame, $sync ) == true ) {
337337 $this->_subscriptions[$destination] = $properties;
338338 return true;
339339 } else {
@@ -348,20 +348,20 @@
349349 * @return boolean
350350 * @throws Stomp_Exception
351351 */
352 - public function unsubscribe ($destination, $properties = null, $sync = null)
 352+ public function unsubscribe ( $destination, $properties = null, $sync = null )
353353 {
354354 $headers = array();
355 - if (isset($properties)) {
356 - foreach ($properties as $name => $value) {
 355+ if ( isset( $properties ) ) {
 356+ foreach ( $properties as $name => $value ) {
357357 $headers[$name] = $value;
358358 }
359359 }
360360 $headers['destination'] = $destination;
361 - $frame = new Stomp_Frame('UNSUBSCRIBE', $headers);
362 - $this->_prepareReceipt($frame, $sync);
363 - $this->_writeFrame($frame);
364 - if ($this->_waitForReceipt($frame, $sync) == true) {
365 - unset($this->_subscriptions[$destination]);
 361+ $frame = new Stomp_Frame( 'UNSUBSCRIBE', $headers );
 362+ $this->_prepareReceipt( $frame, $sync );
 363+ $this->_writeFrame( $frame );
 364+ if ( $this->_waitForReceipt( $frame, $sync ) == true ) {
 365+ unset( $this->_subscriptions[$destination] );
366366 return true;
367367 } else {
368368 return false;
@@ -375,16 +375,16 @@
376376 * @return boolean
377377 * @throws Stomp_Exception
378378 */
379 - public function begin ($transactionId = null, $sync = null)
 379+ public function begin ( $transactionId = null, $sync = null )
380380 {
381381 $headers = array();
382 - if (isset($transactionId)) {
 382+ if ( isset( $transactionId ) ) {
383383 $headers['transaction'] = $transactionId;
384384 }
385 - $frame = new Stomp_Frame('BEGIN', $headers);
386 - $this->_prepareReceipt($frame, $sync);
387 - $this->_writeFrame($frame);
388 - return $this->_waitForReceipt($frame, $sync);
 385+ $frame = new Stomp_Frame( 'BEGIN', $headers );
 386+ $this->_prepareReceipt( $frame, $sync );
 387+ $this->_writeFrame( $frame );
 388+ return $this->_waitForReceipt( $frame, $sync );
389389 }
390390 /**
391391 * Commit a transaction in progress
@@ -394,16 +394,16 @@
395395 * @return boolean
396396 * @throws Stomp_Exception
397397 */
398 - public function commit ($transactionId = null, $sync = null)
 398+ public function commit ( $transactionId = null, $sync = null )
399399 {
400400 $headers = array();
401 - if (isset($transactionId)) {
 401+ if ( isset( $transactionId ) ) {
402402 $headers['transaction'] = $transactionId;
403403 }
404 - $frame = new Stomp_Frame('COMMIT', $headers);
405 - $this->_prepareReceipt($frame, $sync);
406 - $this->_writeFrame($frame);
407 - return $this->_waitForReceipt($frame, $sync);
 404+ $frame = new Stomp_Frame( 'COMMIT', $headers );
 405+ $this->_prepareReceipt( $frame, $sync );
 406+ $this->_writeFrame( $frame );
 407+ return $this->_waitForReceipt( $frame, $sync );
408408 }
409409 /**
410410 * Roll back a transaction in progress
@@ -411,16 +411,16 @@
412412 * @param string $transactionId
413413 * @param boolean $sync Perform request synchronously
414414 */
415 - public function abort ($transactionId = null, $sync = null)
 415+ public function abort ( $transactionId = null, $sync = null )
416416 {
417417 $headers = array();
418 - if (isset($transactionId)) {
 418+ if ( isset( $transactionId ) ) {
419419 $headers['transaction'] = $transactionId;
420420 }
421 - $frame = new Stomp_Frame('ABORT', $headers);
422 - $this->_prepareReceipt($frame, $sync);
423 - $this->_writeFrame($frame);
424 - return $this->_waitForReceipt($frame, $sync);
 421+ $frame = new Stomp_Frame( 'ABORT', $headers );
 422+ $this->_prepareReceipt( $frame, $sync );
 423+ $this->_writeFrame( $frame );
 424+ return $this->_waitForReceipt( $frame, $sync );
425425 }
426426 /**
427427 * Acknowledge consumption of a message from a subscription
@@ -431,20 +431,20 @@
432432 * @return boolean
433433 * @throws Stomp_Exception
434434 */
435 - public function ack ($message, $transactionId = null)
 435+ public function ack ( $message, $transactionId = null )
436436 {
437 - if ($message instanceof Stomp_Frame) {
438 - $frame = new Stomp_Frame('ACK', $message->headers);
439 - $this->_writeFrame($frame);
 437+ if ( $message instanceof Stomp_Frame ) {
 438+ $frame = new Stomp_Frame( 'ACK', $message->headers );
 439+ $this->_writeFrame( $frame );
440440 return true;
441441 } else {
442442 $headers = array();
443 - if (isset($transactionId)) {
 443+ if ( isset( $transactionId ) ) {
444444 $headers['transaction'] = $transactionId;
445445 }
446446 $headers['message-id'] = $message;
447 - $frame = new Stomp_Frame('ACK', $headers);
448 - $this->_writeFrame($frame);
 447+ $frame = new Stomp_Frame( 'ACK', $headers );
 448+ $this->_writeFrame( $frame );
449449 return true;
450450 }
451451 }
@@ -454,15 +454,13 @@
455455 */
456456 public function disconnect ()
457457 {
458 - $header = array();
459 -
460 - if ($this->clientId != null) {
 458+ if ( $this->clientId != null ) {
461459 $headers["client-id"] = $this->clientId;
462460 }
463461
464 - if (is_resource($this->_socket)) {
465 - $this->_writeFrame(new Stomp_Frame('DISCONNECT', $headers));
466 - fclose($this->_socket);
 462+ if ( is_resource( $this->_socket ) ) {
 463+ $this->_writeFrame( new Stomp_Frame( 'DISCONNECT', $headers ) );
 464+ fclose( $this->_socket );
467465 }
468466 $this->_socket = null;
469467 $this->_sessionId = null;
@@ -476,34 +474,34 @@
477475 *
478476 * @param Stomp_Frame $stompFrame
479477 */
480 - protected function _writeFrame (Stomp_Frame $stompFrame)
 478+ protected function _writeFrame ( Stomp_Frame $stompFrame )
481479 {
482 - if (!is_resource($this->_socket)) {
 480+ if ( !is_resource( $this->_socket ) ) {
483481 require_once 'Stomp/Exception.php';
484 - throw new Stomp_Exception('Socket connection hasn\'t been established');
 482+ throw new Stomp_Exception( 'Socket connection hasn\'t been established' );
485483 }
486484
487485 $data = $stompFrame->__toString();
488 -
489 - $r = fwrite($this->_socket, $data, strlen($data));
490 - if ($r === false || $r == 0) {
 486+
 487+ $r = fwrite( $this->_socket, $data, strlen( $data ) );
 488+ if ( $r === false || $r == 0 ) {
491489 $this->_reconnect();
492 - $this->_writeFrame($stompFrame);
 490+ $this->_writeFrame( $stompFrame );
493491 }
494492 }
495 -
 493+
496494 /**
497495 * Set timeout to wait for content to read
498496 *
499497 * @param int $seconds_to_wait Seconds to wait for a frame
500498 * @param int $milliseconds Milliseconds to wait for a frame
501499 */
502 - public function setReadTimeout($seconds, $milliseconds = 0)
 500+ public function setReadTimeout( $seconds, $milliseconds = 0 )
503501 {
504502 $this->_read_timeout_seconds = $seconds;
505503 $this->_read_timeout_milliseconds = $milliseconds;
506504 }
507 -
 505+
508506 /**
509507 * Read responce frame from server
510508 *
@@ -511,49 +509,49 @@
512510 */
513511 public function readFrame ()
514512 {
515 - if (!$this->hasFrameToRead()) {
 513+ if ( !$this->hasFrameToRead() ) {
516514 return false;
517515 }
518 -
519 - stream_set_timeout($this->_socket, 5);
 516+
 517+ stream_set_timeout( $this->_socket, 5 );
520518 $rb = 1024;
521519 $data = '';
522520 do {
523 - $read = fgets($this->_socket, $rb);
524 - $info = stream_get_meta_data($this->_socket);
525 - if ($info['timed_out']) {
 521+ $read = fgets( $this->_socket, $rb );
 522+ $info = stream_get_meta_data( $this->_socket );
 523+ if ( $info['timed_out'] ) {
526524 return FALSE;
527525 }
528 - //if ($read === false) {
 526+ // if ($read === false) {
529527 // $this->_reconnect();
530528 // return $this->readFrame();
531 - //}
 529+ // }
532530 $data .= $read;
533 - $len = strlen($data);
534 - } while ($read && ($len < 2 || ! ($data[$len - 2] == "\x00" && $data[$len - 1] == "\n")));
535 -
536 - list ($header, $body) = explode("\n\n", $data, 2);
537 - $header = explode("\n", $header);
 531+ $len = strlen( $data );
 532+ } while ( $read && ( $len < 2 || ! ( $data[$len - 2] == "\x00" && $data[$len - 1] == "\n" ) ) );
 533+
 534+ list ( $header, $body ) = explode( "\n\n", $data, 2 );
 535+ $header = explode( "\n", $header );
538536 $headers = array();
539537 $command = null;
540 - foreach ($header as $v) {
541 - if (isset($command)) {
542 - list ($name, $value) = explode(':', $v, 2);
 538+ foreach ( $header as $v ) {
 539+ if ( isset( $command ) ) {
 540+ list ( $name, $value ) = explode( ':', $v, 2 );
543541 $headers[$name] = $value;
544542 } else {
545543 $command = $v;
546544 }
547545 }
548 - $frame = new Stomp_Frame($command, $headers, trim($body));
549 -
550 - if (isset($frame->headers['amq-msg-type']) && $frame->headers['amq-msg-type'] == 'MapMessage') {
 546+ $frame = new Stomp_Frame( $command, $headers, trim( $body ) );
 547+
 548+ if ( isset( $frame->headers['amq-msg-type'] ) && $frame->headers['amq-msg-type'] == 'MapMessage' ) {
551549 require_once 'Stomp/Message/Map.php';
552 - return new Stomp_Message_Map($frame);
 550+ return new Stomp_Message_Map( $frame );
553551 } else {
554552 return $frame;
555553 }
556554 }
557 -
 555+
558556 /**
559557 * Check if there is a frame to read
560558 *
@@ -561,12 +559,12 @@
562560 */
563561 public function hasFrameToRead()
564562 {
565 - return TRUE; // http://bugs.php.net/bug.php?id=46024
566 -
567 - $read = array($this->_socket);
 563+ return true; // http://bugs.php.net/bug.php?id=46024
 564+
 565+ /*$read = array($this->_socket);
568566 $write = null;
569567 $except = null;
570 -
 568+
571569 $has_frame_to_read = stream_select($read, $write, $except, $this->_read_timeout_seconds, $this->_read_timeout_milliseconds);
572570
573571 if ($has_frame_to_read === false) {
@@ -574,21 +572,21 @@
575573 } else if ($has_frame_to_read > 0) {
576574 return true;
577575 } else {
578 - return false;
579 - }
 576+ return false;
 577+ }*/
580578 }
581 -
 579+
582580 /**
583581 * Reconnects and renews subscriptions (if there were any)
584 - * Call this method when you detect connection problems
 582+ * Call this method when you detect connection problems
585583 */
586584 protected function _reconnect ()
587585 {
588586 $subscriptions = $this->_subscriptions;
589 -
590 - $this->connect($this->_username, $this->_password);
591 - foreach ($subscriptions as $dest => $properties) {
592 - $this->subscribe($dest, $properties);
 587+
 588+ $this->connect( $this->_username, $this->_password );
 589+ foreach ( $subscriptions as $dest => $properties ) {
 590+ $this->subscribe( $dest, $properties );
593591 }
594592 }
595593 /**
Property changes on: branches/fundraising/deployment/DonationInterface
___________________________________________________________________
Modified: svn:mergeinfo
596594 Merged /trunk/extensions/DonationInterface:r75665-75839

Follow-up revisions

RevisionCommit summaryAuthorDate
r75851Merging from r75840 through r75850 from trunkawjrichards02:16, 2 November 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75664Merging from r75657 to r75663 of trunkawjrichards19:00, 29 October 2010
r75839Followup r75817, fixup api code a little bitreedy23:02, 1 November 2010

Status & tagging log