Completed
Branch develop (3b71bc)
by Reüel
04:11
created

pronamic_pay_block_activation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Plugin Name: Pronamic Pay
4
 * Plugin URI: https://www.pronamic.eu/plugins/pronamic-ideal/
5
 * Description: The Pronamic Pay plugin adds payment methods like iDEAL, Bancontact, credit card and more to your WordPress site for a variety of payment providers.
6
 *
7
 * Version: 5.3.0
8
 * Requires at least: 4.7
9
 *
10
 * Author: Pronamic
11
 * Author URI: https://www.pronamic.eu/
12
 *
13
 * Text Domain: pronamic_ideal
14
 * Domain Path: /languages/
15
 *
16
 * License: GPL-3.0-or-later
17
 *
18
 * GitHub URI: https://github.com/pronamic/wp-pronamic-ideal
19
 *
20
 * @author    Pronamic <[email protected]>
21
 * @copyright 2005-2018 Pronamic
22
 * @license   GPL-3.0-or-later
23
 * @package   Pronamic\WordPress\Pay
24
 */
25
26
/**
27
 * Dependency-checking.
28
 */
29
function pronamic_pay_deactivate() {
30
	deactivate_plugins( plugin_basename( __FILE__ ) );
31
}
32
33
/**
34
 * Function to block activation of the plugin.
35
 */
36
function pronamic_pay_block_activation() {
37
	$message = sprintf(
38
		/* translators: 1: http://www.wpupdatephp.com/update/, 2: _blank */
39
		__( 'Unfortunately the Pronamic Pay plugin will no longer work correctly in PHP versions older than 5.3. Read more information about <a href="%1$s" target="%2$s">how you can update</a>.', 'pronamic_ideal' ),
40
		esc_attr__( 'http://www.wpupdatephp.com/update/', 'pronamic_ideal' ),
41
		esc_attr( '_blank' )
42
	);
43
44
	wp_die( wp_kses( $message, array(
45
		'a' => array(
46
			'href'   => true,
47
			'target' => true,
48
		),
49
	) ) );
50
}
51
52
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
53
	register_activation_hook( __FILE__, 'pronamic_pay_block_activation' );
54
55
	add_action( 'admin_init', 'pronamic_pay_deactivate' );
56
57
	return;
58
}
59
60
/**
61
 * Autoload.
62
 */
63
if ( ! defined( 'PRONAMIC_PAY_DEBUG' ) ) {
64
	define( 'PRONAMIC_PAY_DEBUG', false );
65
}
66
67
if ( PRONAMIC_PAY_DEBUG ) {
68
	foreach ( glob( __DIR__ . '/repositories/wp-pay/*/vendor/composer/autoload_files.php' ) as $file ) {
69
		$files = require $file;
70
71
		foreach ( $files as $identifier => $path ) {
72
			if ( ! empty( $GLOBALS['__composer_autoload_files'][ $identifier ] ) ) {
73
				continue;
74
			}
75
76
			require $path;
77
78
			$GLOBALS['__composer_autoload_files'][ $identifier ] = true;
79
		}
80
	}
81
}
82
83
$loader = require plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
84
85
if ( PRONAMIC_PAY_DEBUG ) {
86
	foreach ( glob( __DIR__ . '/repositories/*/*/composer.json' ) as $file ) {
87
		$content = file_get_contents( $file );
88
89
		$object = json_decode( $content );
90
91
		if ( ! isset( $object->autoload ) ) {
92
			continue;
93
		}
94
95
		foreach ( $object->autoload as $type => $map ) {
96
			if ( 'psr-4' !== $type ) {
97
				continue;
98
			}
99
100
			foreach ( $map as $prefix => $path ) {
101
				$loader->addPsr4( $prefix, dirname( $file ) . '/' . $path, true );
102
			}
103
		}
104
	}
105
}
106
107
/**
108
 * Bootstrap.
109
 */
110
\Pronamic\WordPress\Pay\Plugin::instance( array(
111
	'file'       => __FILE__,
112
	'version'    => '5.3.0',
113
	'gateways'   => \Pronamic\WordPress\Pay\pronamic_pay_gateway_integrations(),
114
	'extensions' => array(
115
		'\Pronamic\WordPress\Pay\Extensions\Charitable\Extension::bootstrap',
116
		'\Pronamic\WordPress\Pay\Extensions\Give\Extension::bootstrap',
117
		'\Pronamic\WordPress\Pay\Extensions\WooCommerce\Extension::bootstrap',
118
		'\Pronamic\WordPress\Pay\Extensions\GravityForms\Extension::bootstrap',
119
		'\Pronamic\WordPress\Pay\Extensions\Shopp\Extension::bootstrap',
120
		'\Pronamic\WordPress\Pay\Extensions\Jigoshop\Extension::bootstrap',
121
		'\Pronamic\WordPress\Pay\Extensions\WPeCommerce\Extension::bootstrap',
122
		'\Pronamic\WordPress\Pay\Extensions\ClassiPress\Extension::bootstrap',
123
		'\Pronamic\WordPress\Pay\Extensions\EventEspressoLegacy\Extension::bootstrap',
124
		'\Pronamic\WordPress\Pay\Extensions\EventEspresso\Extension::bootstrap',
125
		'\Pronamic\WordPress\Pay\Extensions\AppThemes\Extension::bootstrap',
126
		'\Pronamic\WordPress\Pay\Extensions\S2Member\Extension::bootstrap',
127
		'\Pronamic\WordPress\Pay\Extensions\Membership\Extension::bootstrap',
128
		'\Pronamic\WordPress\Pay\Extensions\EasyDigitalDownloads\Extension::bootstrap',
129
		'\Pronamic\WordPress\Pay\Extensions\IThemesExchange\Extension::bootstrap',
130
		'\Pronamic\WordPress\Pay\Extensions\MemberPress\Extension::bootstrap',
131
		'\Pronamic\WordPress\Pay\Extensions\FormidableForms\Extension::bootstrap',
132
		'\Pronamic\WordPress\Pay\Extensions\RestrictContentPro\Extension::bootstrap',
133
		'\Pronamic\WordPress\Pay\Extensions\NinjaForms\Extension::bootstrap',
134
	),
135
) );
136
137
/**
138
 * Backward compatibility.
139
 */
140
global $pronamic_ideal;
141
142
$pronamic_ideal = pronamic_pay_plugin();
0 ignored issues
show
Bug introduced by
The function pronamic_pay_plugin was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

142
$pronamic_ideal = /** @scrutinizer ignore-call */ pronamic_pay_plugin();
Loading history...
143