| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: GravityForms eWAY |
| 4 |
Plugin URI: http://snippets.webaware.com.au/wordpress-plugins/gravityforms-eway/ |
| 5 |
Description: Integrates Gravity Forms with eWAY payment gateway, enabling end users to purchase goods and services through Gravity Forms. |
| 6 |
Version: 1.4.0 |
| 7 |
Author: WebAware |
| 8 |
Author URI: http://www.webaware.com.au/ |
| 9 |
*/ |
| 10 |
|
| 11 |
/* |
| 12 |
copyright (c) 2012-2013 WebAware Pty Ltd (email : rmckay@webaware.com.au) |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify |
| 15 |
it under the terms of the GNU General Public License, version 2, as |
| 16 |
published by the Free Software Foundation. |
| 17 |
|
| 18 |
This program is distributed in the hope that it will be useful, |
| 19 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
GNU General Public License for more details. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License |
| 24 |
along with this program; if not, write to the Free Software |
| 25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 26 |
*/ |
| 27 |
|
| 28 |
/* |
| 29 |
useful references: |
| 30 |
http://www.gravityhelp.com/forums/topic/credit-card-validating#post-44438 |
| 31 |
http://www.gravityhelp.com/documentation/page/Gform_creditcard_types |
| 32 |
http://www.gravityhelp.com/documentation/page/Gform_enable_credit_card_field |
| 33 |
http://www.gravityhelp.com/documentation/page/Form_Object |
| 34 |
http://www.gravityhelp.com/documentation/page/Entry_Object |
| 35 |
*/ |
| 36 |
|
| 37 |
if (!defined('GFEWAY_PLUGIN_ROOT')) { |
| 38 |
define('GFEWAY_PLUGIN_ROOT', dirname(__FILE__) . '/'); |
| 39 |
define('GFEWAY_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__)); |
| 40 |
define('GFEWAY_PLUGIN_OPTIONS', 'gfeway_plugin'); |
| 41 |
define('GFEWAY_PLUGIN_VERSION', '1.4.0'); |
| 42 |
|
| 43 |
// error message names |
| 44 |
define('GFEWAY_ERROR_ALREADY_SUBMITTED', 'gfeway_err_already'); |
| 45 |
define('GFEWAY_ERROR_NO_AMOUNT', 'gfeway_err_no_amount'); |
| 46 |
define('GFEWAY_ERROR_REQ_CARD_HOLDER', 'gfeway_err_req_card_holder'); |
| 47 |
define('GFEWAY_ERROR_REQ_CARD_NAME', 'gfeway_err_req_card_name'); |
| 48 |
define('GFEWAY_ERROR_EWAY_FAIL', 'gfeway_err_eway_fail'); |
| 49 |
|
| 50 |
// name used as cURL user agent |
| 51 |
define('GFEWAY_CURL_USER_AGENT', 'GravityForms eWAY'); |
| 52 |
|
| 53 |
// custom fields |
| 54 |
define('GFEWAY_FIELD_RECURRING', 'gfewayrecurring'); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* autoload classes as/when needed |
| 59 |
* |
| 60 |
* @param string $class_name name of class to attempt to load |
| 61 |
*/ |
| 62 |
function gfeway_autoload($class_name) { |
| 63 |
static $classMap = array ( |
| 64 |
'GFEwayAdmin' => 'class.GFEwayAdmin.php', |
| 65 |
'GFEwayFormData' => 'class.GFEwayFormData.php', |
| 66 |
'GFEwayOptionsAdmin' => 'class.GFEwayOptionsAdmin.php', |
| 67 |
'GFEwayPayment' => 'class.GFEwayPayment.php', |
| 68 |
'GFEwayPlugin' => 'class.GFEwayPlugin.php', |
| 69 |
'GFEwayRecurringField' => 'class.GFEwayRecurringField.php', |
| 70 |
'GFEwayRecurringPayment' => 'class.GFEwayRecurringPayment.php', |
| 71 |
'GFEwayStoredPayment' => 'class.GFEwayStoredPayment.php', |
| 72 |
); |
| 73 |
|
| 74 |
if (isset($classMap[$class_name])) { |
| 75 |
require GFEWAY_PLUGIN_ROOT . $classMap[$class_name]; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
// register a class (static) method for autoloading required classes |
| 80 |
spl_autoload_register('gfeway_autoload'); |
| 81 |
|
| 82 |
// instantiate the plug-in |
| 83 |
GFEwayPlugin::getInstance(); |
| 84 |
|