WooCommerce Plugin for payment method "Cash on Pickup"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.4 KiB

4 years ago
  1. <?php
  2. /*
  3. Plugin Name: WooChop - Cash On Pickup
  4. Plugin URI: https://wordpress.org/plugins/woochop-cash-on-pickup/
  5. Description: A WooCommerce Extension that adds the payment gateway "Cash On Pickup"
  6. Version: 2.0
  7. Author: Björn Hase
  8. Author URI: https://tentakelfabrik.de
  9. Text Domain: woochop-cash-on-pickup
  10. Domain Path: /i18n
  11. License: GPL-2.0+
  12. License URI: http://www.gnu.org/licenses/gpl-2.0.txt
  13. GitHub Plugin URI: https://github.com/tentakelfabrik/woochop-cash-on-pickup
  14. WC tested up to: 3.4
  15. */
  16. /**
  17. * WooChop - Cash On Pickup
  18. * Copyright (C) 2013-2014 Pinch Of Code. All rights reserved.
  19. * Copyright (C) 2017-2018 Marian Kadanka. All rights reserved.
  20. * Copyright (C) 2020 Björn Hase, Tentakelfabrik. All rights reserved.
  21. *
  22. * This program is free software; you can redistribute it and/or
  23. * modify it under the terms of the GNU General Public License
  24. * as published by the Free Software Foundation; either version 2
  25. * of the License, or (at your option) any later version.
  26. * This program is distributed in the hope that it will be useful,
  27. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. * GNU General Public License for more details.
  30. * You should have received a copy of the GNU General Public License
  31. * along with this program; if not, write to the Free Software
  32. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  33. */
  34. if (!defined('ABSPATH')){
  35. exit; // Exit if accessed directly.
  36. }
  37. define('WOOCHOP_CASH_ON_PICKUP_ID', 'woochop_cash_on_pickup');
  38. /**
  39. * Start the plugin
  40. *
  41. */
  42. function woochop_cash_on_pickup_init()
  43. {
  44. global $woocommerce;
  45. if (!isset($woocommerce)) {
  46. return;
  47. }
  48. require_once('classes/class.woochop_gateway_cash_on_pickup.php');
  49. }
  50. add_action('plugins_loaded', 'woochop_cash_on_pickup_init');
  51. /**
  52. * Add WooChop WooCommerce payment gateways
  53. *
  54. * @param $methods
  55. * @return array
  56. *
  57. */
  58. function woochop_cash_on_pickup_register_gateway($methods)
  59. {
  60. $methods[] = 'WooChop_Gateway_Cash_On_Pickup';
  61. return $methods;
  62. }
  63. add_filter('woocommerce_payment_gateways', 'woochop_cash_on_pickup_register_gateway');
  64. /**
  65. * Uninstall the plugin
  66. *
  67. */
  68. function woochop_cash_on_pickup_uninstall()
  69. {
  70. delete_option('woocommerce_'.WOOCHOP_CASH_ON_PICKUP_ID.'_settings');
  71. }
  72. register_uninstall_hook(__FILE__, 'woochop_cash_on_pickup_uninstall');