This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | /* |
||
3 | * Plugin Name: WooCommerce First Atlantic Commerce Gateway |
||
4 | * Plugin URI: https://github.com/Strikewood/woocommerce-first-atlantic-commerce |
||
5 | * Description: First Atlantic Commerce gateway extension for WooCommerce. |
||
6 | * Version: 0.1.7 |
||
7 | * Author: Strikewood Studios |
||
8 | * Author URI: http://strikewood.com/ |
||
9 | * License: MIT |
||
10 | * License URI: https://github.com/Strikewood/woocommerce-first-atlantic-commerce/blob/master/LICENSE |
||
11 | */ |
||
12 | |||
13 | if ( !defined('ABSPATH') ) exit; |
||
0 ignored issues
–
show
|
|||
14 | |||
15 | function woocommerce_init_fac_gateway() |
||
16 | { |
||
17 | // Make sure WooCommerce is available |
||
0 ignored issues
–
show
|
|||
18 | if ( !class_exists('WC_Payment_Gateway') ) return; |
||
0 ignored issues
–
show
|
|||
19 | |||
20 | // Localisation |
||
0 ignored issues
–
show
|
|||
21 | load_plugin_textdomain('wc-gateway-fac', false, dirname( plugin_basename(__FILE__) ) . '/languages'); |
||
0 ignored issues
–
show
|
|||
22 | |||
23 | // Our classes and depdencies (if not using composer) |
||
0 ignored issues
–
show
|
|||
24 | if ( is_file( dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor/autoload.php' ) ) require_once('vendor/autoload.php'); |
||
0 ignored issues
–
show
|
|||
25 | |||
26 | // Make sure the FAC class was autoloaded |
||
0 ignored issues
–
show
|
|||
27 | if ( !class_exists('WC_Gateway_FirstAtlanticCommerce') ) return; |
||
0 ignored issues
–
show
|
|||
28 | |||
29 | // Register the gateway in WC |
||
0 ignored issues
–
show
|
|||
30 | function woocommerce_register_fac_gateway($methods) |
||
0 ignored issues
–
show
|
|||
31 | { |
||
0 ignored issues
–
show
|
|||
32 | $methods[] = 'WC_Gateway_FirstAtlanticCommerce'; |
||
0 ignored issues
–
show
|
|||
33 | |||
34 | return $methods; |
||
0 ignored issues
–
show
|
|||
35 | } |
||
0 ignored issues
–
show
|
|||
36 | add_filter('woocommerce_payment_gateways', 'woocommerce_register_fac_gateway'); |
||
0 ignored issues
–
show
|
|||
37 | |||
38 | function woocommerce_fac_process_payment($order_id) |
||
0 ignored issues
–
show
|
|||
39 | { |
||
0 ignored issues
–
show
|
|||
40 | $fac = new WC_Gateway_FirstAtlanticCommerce; |
||
0 ignored issues
–
show
|
|||
41 | |||
42 | $fac->process_payment($order_id); |
||
0 ignored issues
–
show
|
|||
43 | } |
||
0 ignored issues
–
show
|
|||
44 | |||
45 | function woocommerce_fac_process_refund($order_id) |
||
0 ignored issues
–
show
|
|||
46 | { |
||
0 ignored issues
–
show
|
|||
47 | $fac = new WC_Gateway_FirstAtlanticCommerce; |
||
0 ignored issues
–
show
|
|||
48 | |||
49 | $fac->process_refund($order_id); |
||
0 ignored issues
–
show
|
|||
50 | } |
||
0 ignored issues
–
show
|
|||
51 | |||
52 | // Actions to capture or void authorized transactions |
||
0 ignored issues
–
show
|
|||
53 | add_action('woocommerce_order_status_on-hold_to_processing', 'woocommerce_fac_process_payment'); |
||
0 ignored issues
–
show
|
|||
54 | add_action('woocommerce_order_status_on-hold_to_completed', 'woocommerce_fac_process_payment'); |
||
0 ignored issues
–
show
|
|||
55 | add_action('woocommerce_order_status_on-hold_to_cancelled', 'woocommerce_fac_process_refund'); |
||
0 ignored issues
–
show
|
|||
56 | add_action('woocommerce_order_status_on-hold_to_refunded', 'woocommerce_fac_process_refund'); |
||
0 ignored issues
–
show
|
|||
57 | } |
||
58 | add_action('plugins_loaded', 'woocommerce_init_fac_gateway', 0); |
||
0 ignored issues
–
show
|
|||
59 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.