| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Paytium |
| 5 |
* |
| 6 |
* @package PT |
| 7 |
* @author David de Boer <david@davdeb.com> |
| 8 |
* @license GPL-2.0+ |
| 9 |
* @link https://www.paytium.nl |
| 10 |
* @copyright 2015-2019 David de Boer |
| 11 |
* @copyright Paytium is based on Stripe Checkout by Phil Derksen and Stripe Checkout Companion by Kyle M. Brown |
| 12 |
* @copyright 2014-2015 Phil Derksen for Stripe Checkout |
| 13 |
* @copyright 2014-2015 Kyle M. Brown for Stripe Checkout Companion |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: Paytium |
| 17 |
* Plugin URI: https://www.paytium.nl |
| 18 |
* Description: Paytium, making payments in WordPress even more awesome! |
| 19 |
* Version: 5.0.5 |
| 20 |
* Author: David de Boer |
| 21 |
* Author URI: https://www.paytium.nl |
| 22 |
* License: GPL-2.0+ |
| 23 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 24 |
* Text Domain: paytium |
| 25 |
* Domain Path: /languages/ |
| 26 |
*/ |
| 27 |
|
| 28 |
// Exit if accessed directly. |
| 29 |
if ( ! defined( 'ABSPATH' ) ) { |
| 30 |
exit; |
| 31 |
} |
| 32 |
|
| 33 |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 34 |
|
| 35 |
|
| 36 |
if ( class_exists( 'Paytium' ) ) { |
| 37 |
|
| 38 |
deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 39 |
|
| 40 |
} else { |
| 41 |
|
| 42 |
|
| 43 |
if ( ! defined( 'PT_MAIN_FILE' ) ) { |
| 44 |
define( 'PT_MAIN_FILE', __FILE__ ); |
| 45 |
} |
| 46 |
|
| 47 |
if ( ! defined( 'PT_PATH' ) ) { |
| 48 |
define( 'PT_PATH', plugin_dir_path( __FILE__ ) ); |
| 49 |
} |
| 50 |
|
| 51 |
if ( ! defined( 'PT_URL' ) ) { |
| 52 |
define( 'PT_URL', plugins_url( '', __FILE__ ) . '/' ); |
| 53 |
} |
| 54 |
|
| 55 |
if ( ! defined( 'PT_VERSION' ) ) { |
| 56 |
define( 'PT_VERSION', '5.0.5' ); |
| 57 |
} |
| 58 |
|
| 59 |
if ( ! defined( 'PT_NAME' ) ) { |
| 60 |
define( 'PT_NAME', 'Paytium' ); |
| 61 |
} |
| 62 |
|
| 63 |
if ( ! defined( 'PT_PACKAGE' ) ) { |
| 64 |
define( 'PT_PACKAGE', 'paytium' ); |
| 65 |
} |
| 66 |
|
| 67 |
if ( ! defined( 'PT_WEBSITE_URL' ) ) { |
| 68 |
define( 'PT_WEBSITE_URL', 'https://www.paytium.nl/' ); |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Registration & activation hook |
| 73 |
*/ |
| 74 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- renaming a registered hook callback is a silent breaking change for customer sites that remove_action() it; deferred to a major version. |
| 75 |
function install_paytium() { |
| 76 |
|
| 77 |
// Add value to indicate that we should show admin notice for setup wizard. |
| 78 |
update_option( 'pt_show_admin_notice_setup_wizard', 1 ); |
| 79 |
|
| 80 |
// Add value to indicate that we should show admin notice for newsletter. |
| 81 |
update_option( 'pt_show_admin_notice_newsletter', 1 ); |
| 82 |
|
| 83 |
// Add value to indicate that we should show admin notice for extensions. |
| 84 |
update_option( 'pt_show_admin_notice_extensions', 1 ); |
| 85 |
|
| 86 |
// Other options |
| 87 |
update_option( 'paytium_enable_remember', 1 ); |
| 88 |
update_option( 'paytium_uninstall_save_settings', 1 ); |
| 89 |
update_option( 'paytium_always_enqueue', 1 ); |
| 90 |
|
| 91 |
if ( ! function_exists( 'curl_version' ) ) { |
| 92 |
wp_die( sprintf( |
| 93 |
/* translators: %1$s: plugin name, %2$s: URL of the Plugins page. */ |
| 94 |
wp_kses_post( __( 'You must have the cURL extension enabled in order to run %1$s. Please enable cURL and try again. <a href="%2$s">Return to Plugins</a>.', 'paytium' ) ), |
| 95 |
esc_html( PT_NAME ), |
| 96 |
esc_url( get_admin_url( '', 'plugins.php' ) ) |
| 97 |
) ); |
| 98 |
} |
| 99 |
|
| 100 |
// Remove old log file format |
| 101 |
if ( file_exists( plugin_dir_path( __FILE__ ) . 'logs.txt' ) ) { |
| 102 |
wp_delete_file( plugin_dir_path( __FILE__ ) . 'logs.txt' ); |
| 103 |
} |
| 104 |
|
| 105 |
} |
| 106 |
|
| 107 |
register_activation_hook( PT_MAIN_FILE, 'install_paytium' ); |
| 108 |
|
| 109 |
/** |
| 110 |
* Load plugin text domain (for translation files) |
| 111 |
*/ |
| 112 |
function paytium_load_textdomain() { |
| 113 |
|
| 114 |
load_plugin_textdomain( |
| 115 |
'paytium', |
| 116 |
false, |
| 117 |
dirname( plugin_basename( PT_MAIN_FILE ) ) . '/languages/' |
| 118 |
); |
| 119 |
|
| 120 |
} |
| 121 |
|
| 122 |
add_action( 'init', 'paytium_load_textdomain' ); |
| 123 |
|
| 124 |
/** |
| 125 |
* Get Paytium class. |
| 126 |
*/ |
| 127 |
if ( ! class_exists( 'Paytium' ) ) { |
| 128 |
require_once( PT_PATH . 'class-paytium.php' ); |
| 129 |
} |
| 130 |
|
| 131 |
/** |
| 132 |
* @return Paytium |
| 133 |
*/ |
| 134 |
function Paytium() { |
| 135 |
|
| 136 |
$paytium = Paytium::get_instance(); |
| 137 |
|
| 138 |
require_once( PT_PATH . 'includes/class-shortcode-tracker.php' ); |
| 139 |
Paytium_Shortcode_Tracker::get_instance(); |
| 140 |
|
| 141 |
return $paytium; |
| 142 |
|
| 143 |
} |
| 144 |
|
| 145 |
Paytium(); |
| 146 |
} |
| 147 |
|
| 148 |
|