-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEE_Paypal_Smart_Buttons.class.php
110 lines (100 loc) · 3.59 KB
/
EE_Paypal_Smart_Buttons.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
// define the plugin directory path and URL
define('EE_PAYPAL_SMART_BUTTONS_BASENAME', plugin_basename(EE_PAYPAL_SMART_BUTTONS_PLUGIN_FILE));
define('EE_PAYPAL_SMART_BUTTONS_PATH', plugin_dir_path(__FILE__));
define('EE_PAYPAL_SMART_BUTTONS_URL', plugin_dir_url(__FILE__));
/**
* ------------------------------------------------------------------------
*
* Class EE_Paypal_Smart_Buttons
*
* @package Event Espresso
* @subpackage espresso-paypal-smart-buttons
* @author Brent Christensen
*
*
* ------------------------------------------------------------------------
*/
class EE_Paypal_Smart_Buttons extends EE_Addon
{
/**
* @throws EE_Error
* @throws ReflectionException
*/
public static function register_addon()
{
// register addon via Plugin API
EE_Register_Addon::register(
'Paypal_Smart_Buttons',
array(
'version' => EE_PAYPAL_SMART_BUTTONS_VERSION,
'min_core_version' => '4.9.64.rc.006',
'main_file_path' => EE_PAYPAL_SMART_BUTTONS_PLUGIN_FILE,
'namespace' => array(
'FQNS' => 'EventEspresso\PayPalSmartButtons',
'DIR' => __DIR__,
),
'admin_callback' => 'additional_admin_hooks',
// if plugin update engine is being used for auto-updates. not needed if PUE is not being used.
'pue_options' => array(
'pue_plugin_slug' => 'eea-paypal-smart-buttons',
'plugin_basename' => EE_PAYPAL_SMART_BUTTONS_BASENAME,
'checkPeriod' => '24',
'use_wp_update' => false,
),
'payment_method_paths' => array(
EE_PAYPAL_SMART_BUTTONS_PATH . 'payment_methods' . DS . 'Paypal_Smart_Buttons',
),
'module_paths' => array(
EE_PAYPAL_SMART_BUTTONS_PATH . 'EED_Paypal_Smart_Buttons.module.php'
)
)
);
}
/**
* @return void;
*/
public function after_registration()
{
EE_Dependency_Map::register_dependencies(
'EventEspresso\PayPalSmartButtons\payment_methods\Paypal_Smart_Buttons\forms\PayPalSmartButtonBillingForm',
[
null,
null,
null,
'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache
]
);
}
/**
* additional_admin_hooks
*
* @access public
* @return void
*/
public function additional_admin_hooks()
{
// is admin and not in M-Mode ?
if (is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
add_filter('plugin_action_links', array( $this, 'plugin_actions' ), 10, 2);
}
}
/**
* plugin_actions
*
* Add a settings link to the Plugins page, so people can go straight from the plugin page to the settings page.
* @param $links
* @param $file
* @return array
*/
public function plugin_actions($links, $file)
{
if ($file == EE_PAYPAL_SMART_BUTTONS_BASENAME) {
// before other links
array_unshift($links, '<a href="admin.php?page=espresso_payment_settings">' . __('Settings', 'event_espresso') . '</a>');
}
return $links;
}
}
// End of file EE_Paypal_Smart_Buttons.class.php
// Location: wp-content/plugins/espresso-paypal-smart-buttons/EE_Paypal_Smart_Buttons.class.php