Skip to content

Commit

Permalink
rename woocommerce-ibantest to ibantest-for-woocommerce
Browse files Browse the repository at this point in the history
  • Loading branch information
ibantest committed May 31, 2018
1 parent 6007951 commit 8bb7b50
Show file tree
Hide file tree
Showing 14 changed files with 130 additions and 127 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ibantest/woocommerce-ibantest",
"name": "ibantest/ibantest-for-woocommerce",
"type": "project",
"require": {
"ibantest/ibantest-php": "^1.0",
Expand Down
32 changes: 16 additions & 16 deletions ibantest-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: IBANTEST for WooCommerce
* Plugin URI: https://www.ibantest.com/
* Description: Provides direct debit payment with IBAN and BIC validation for WooCommerce
* Version: 1.1.0
* Version: 1.2.0
* Author: IBANTEST
* Author URI: https://www.ibantest.com
* Requires at least: 3.8
Expand All @@ -14,7 +14,7 @@
* Requires at least WooCommerce: 3.0
* Tested up to WooCommerce: 3.3
*
* Text Domain: woocommerce-ibantest
* Text Domain: ibantest-for-woocommerce
* Domain Path: /languages/
*
* @author IBANTEST
Expand All @@ -28,7 +28,7 @@
/**
* Required minimums and constants
*/
define( 'WC_IBANTEST_VERSION', '1.1.0' );
define( 'WC_IBANTEST_VERSION', '1.2.0' );
define( 'WC_IBANTEST_MIN_PHP_VER', '5.6.0' );
define( 'WC_IBANTEST_MIN_WC_VER', '3.0.0' );
define( 'WC_IBANTEST_MAIN_FILE', __FILE__ );
Expand All @@ -37,9 +37,9 @@
define( 'WC_IBANTEST_ASSETS_URL', untrailingslashit( WC_IBANTEST_PLUGIN_URL . '/files' ) );
define( 'WC_IBANTEST_TEMPLATE_PATH', WC_IBANTEST_PLUGIN_PATH . '/templates/' );

if ( ! class_exists( 'WooCommerce_IBANTEST' ) ) {
if ( ! class_exists( 'IBANTEST_For_WooCommerce' ) ) {

class WooCommerce_IBANTEST {
class IBANTEST_For_WooCommerce {

/**
* The reference the *Singleton* instance of this class.
Expand Down Expand Up @@ -89,21 +89,21 @@ private function __wakeup() {
public $settings = array();

/**
* WooCommerce_IBANTEST constructor.
* IBANTEST_For_WooCommerce constructor.
*/
public function __construct() {
$this->settings = get_option( 'woocommerce_ibantest_settings' );
add_action( 'init', array( $this, 'init' ), 0 );

// Loaded action
do_action( 'woocommerce_ibantest_loaded' );
do_action( 'ibantest_for_woocommerce_loaded' );
}

/**
* Init
*/
public function init() {
do_action( 'before_woocommerce_ibantest_init' );
do_action( 'before_ibantest_for_woocommerce_init' );
include_once( 'includes/wc-ibantest-ajax.php' );
include_once( 'includes/wc-ibantest-encryption.php' );
include_once( 'includes/wc-ibantest-export.php' );
Expand All @@ -117,14 +117,14 @@ public function init() {
add_action( 'export_wp', array( WC_IBANTEST_Export(), 'export' ), 0, 1 );
add_filter( 'export_args', array( WC_IBANTEST_Export(), 'export_args' ) );

load_plugin_textdomain( 'woocommerce-ibantest', false, plugin_basename( dirname( __FILE__ ) ) . '/languages/' );
load_plugin_textdomain( 'ibantest-for-woocommerce', false, plugin_basename( dirname( __FILE__ ) ) . '/languages/' );
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );

// Payment gateways
add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );

// Init action
do_action( 'woocommerce_ibantest_init' );
do_action( 'ibantest_for_woocommerce_init' );
}

/**
Expand All @@ -146,8 +146,8 @@ public function get_settings() {
public function plugin_action_links( $links ) {
$setting_link = $this->get_setting_link();
$plugin_links = array(
'<a href="' . $setting_link . '">' . __( 'Settings', 'woocommerce-ibantest' ) . '</a>',
'<a href="https://www.ibantest.com">' . __( 'Support', 'woocommerce-ibantest' ) . '</a>',
'<a href="' . $setting_link . '">' . __( 'Settings', 'ibantest-for-woocommerce' ) . '</a>',
'<a href="https://www.ibantest.com">' . __( 'Support', 'ibantest-for-woocommerce' ) . '</a>',
);

return array_merge( $plugin_links, $links );
Expand Down Expand Up @@ -180,11 +180,11 @@ public function add_gateways( $methods ) {
}

/**
* Returns the global instance of WooCommerce IBANTEST
* Returns the global instance of IBANTEST for WooCommerce
*/
function WooCommerce_IBANTEST() {
return WooCommerce_IBANTEST::instance();
function IBANTEST_For_WooCommerce() {
return IBANTEST_For_WooCommerce::instance();
}

WooCommerce_IBANTEST();
IBANTEST_For_WooCommerce();

6 changes: 3 additions & 3 deletions includes/wc-ibantest-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static function ibantest_show_sepa_mandate() {
exit;
}

$settings = WooCommerce_IBANTEST()->get_settings();
$settings = IBANTEST_For_WooCommerce()->get_settings();
$values = array();
parse_str( $_POST['checkout'], $values );

Expand All @@ -78,7 +78,7 @@ public static function ibantest_show_sepa_mandate() {
'postcode' => wc_clean( isset( $values['billing_postcode'] ) ? $values['billing_postcode'] : '' ),
'city' => wc_clean( isset( $values['billing_city'] ) ? $values['billing_city'] : '' ),
'country' => ( isset( $values['billing_country'] ) && isset( WC()->countries->countries[ $values['billing_country'] ] ) ? WC()->countries->countries[ $values['billing_country'] ] : '' ),
'mandate_id' => isset( $values['order_id'] ) ? wc_clean( $values['order_id'] ) : __( 'Will be notified separately', 'woocommerce-ibantest' ),
'mandate_id' => isset( $values['order_id'] ) ? wc_clean( $values['order_id'] ) : __( 'Will be notified separately', 'ibantest-for-woocommerce' ),
);

$args = wp_parse_args( $params, array(
Expand All @@ -88,7 +88,7 @@ public static function ibantest_show_sepa_mandate() {
'date' => date_i18n( wc_date_format(), strtotime( "now" ) ),
) );

$text = __( $settings['mandate_text'], 'woocommerce-ibantest' );
$text = __( $settings['mandate_text'], 'ibantest-for-woocommerce' );

foreach ( $args as $key => $val ) {
$text = str_replace( '[' . $key . ']', $val, $text );
Expand Down
2 changes: 1 addition & 1 deletion includes/wc-ibantest-encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function decrypt( $string ) {
}

/**
* Returns the global instance of WooCommerce IBANTEST
* Returns the global instance of IBANTEST for WooCommerce
*/
function WC_IBANTEST_Encryption() {
return WC_IBANTEST_Encryption::instance();
Expand Down
6 changes: 3 additions & 3 deletions includes/wc-ibantest-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private function __wakeup() {
*/
public function __construct() {
include_once WC_IBANTEST_PLUGIN_PATH . '/vendor/autoload.php';
$this->settings = WooCommerce_IBANTEST()->get_settings();
$this->settings = IBANTEST_For_WooCommerce()->get_settings();
}

/**
Expand Down Expand Up @@ -131,7 +131,7 @@ public function export( $args = array() ) {
'debtorName' => WC_IBANTEST_Encryption()->decrypt( $order->get_meta( '_direct_debit_holder' ) ),
'debtorMandate' => $order->get_meta( '_direct_debit_mandate_id' ) ,
'debtorMandateSignDate' => new \DateTime( date('Y-m-d', $order->get_meta( '_direct_debit_mandate_date' ) ) ),
'remittanceInformation' => sprintf( __( 'Order %s', 'woocommerce-ibantest' ), $order->get_order_number() ),
'remittanceInformation' => sprintf( __( 'Order %s', 'ibantest-for-woocommerce' ), $order->get_order_number() ),
)
);

Expand All @@ -153,7 +153,7 @@ public function export( $args = array() ) {
}

/**
* Returns the global instance of WooCommerce IBANTEST
* Returns the global instance of IBANTEST for WooCommerce
*/
function WC_IBANTEST_Export() {
return WC_IBANTEST_Export::instance();
Expand Down
52 changes: 26 additions & 26 deletions includes/wc-ibantest-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class WC_IBANTEST_Gateway extends WC_Payment_Gateway {
*/
public function __construct() {
$this->id = 'ibantest';
$this->method_title = __( 'SEPA Direct Debit (IBANTEST)', 'woocommerce-ibantest' );
$this->method_description = __( 'add SEPA Direct Debit as payment method', 'woocommerce-ibantest' );
$this->method_title = __( 'SEPA Direct Debit (IBANTEST)', 'ibantest-for-woocommerce' );
$this->method_description = __( 'add SEPA Direct Debit as payment method', 'ibantest-for-woocommerce' );
$this->has_fields = false;

// Load the form fields.
Expand Down Expand Up @@ -91,7 +91,7 @@ public function enqueue_scripts() {

wp_register_script(
'ibantest',
plugins_url( 'files/js/woocommerce-ibantest' . $suffix . '.js', WC_IBANTEST_MAIN_FILE ),
plugins_url( 'files/js/ibantest-for-woocommerce' . $suffix . '.js', WC_IBANTEST_MAIN_FILE ),
array( 'jquery', 'wc-cart' ),
WC_IBANTEST_VERSION,
true
Expand Down Expand Up @@ -142,23 +142,23 @@ public function form() {

$fields = array(
'account-iban' => '<p class="form-row form-row-wide account-iban">
<label for="' . esc_attr( $this->id ) . '-account-iban">' . __( 'IBAN', 'woocommerce-ibantest' ) . ' <span class="required">*</span></label>
<label for="' . esc_attr( $this->id ) . '-account-iban">' . __( 'IBAN', 'ibantest-for-woocommerce' ) . ' <span class="required">*</span></label>
<input id="' . esc_attr( $this->id ) . '-account-iban" class="input-text wc-' . esc_attr( $this->id ) . '-account-iban transform-uppercase" type="text" value="' . ( isset( $data['iban'] ) ? esc_attr( $data['iban'] ) : '' ) . '" autocomplete="off" placeholder="" name="' . esc_attr( $this->id ) . '_account_iban' . '" />
<span id="' . esc_attr( $this->id ) . '-account-iban-error" class="error-message" style="display: none;"></span>
</p>',
'account-bic' => '<p class="form-row form-row-wide account-bic" style="' . ( isset( $data['bic'] ) ? '' : 'display: none;' ) . '">
<label for="' . esc_attr( $this->id ) . '-account-bic">' . __( 'BIC/SWIFT', 'woocommerce-ibantest' ) . '</label>
<label for="' . esc_attr( $this->id ) . '-account-bic">' . __( 'BIC/SWIFT', 'ibantest-for-woocommerce' ) . '</label>
<input id="' . esc_attr( $this->id ) . '-account-bic" class="input-text wc-' . esc_attr( $this->id ) . '-account-bic transform-uppercase" type="text" value="' . ( isset( $data['bic'] ) ? esc_attr( $data['bic'] ) : '' ) . '" autocomplete="off" placeholder="" name="' . esc_attr( $this->id ) . '_account_bic' . '" />
<span id="' . esc_attr( $this->id ) . '-account-bank" style="display: none;"></span>
</p>',
'account-holder' => '<p class="form-row form-row-wide account-holder">
<label for="' . esc_attr( $this->id ) . '-account-holder">' . __( 'Account Holder', 'woocommerce-ibantest' ) . ' <span class="required">*</span></label>
<label for="' . esc_attr( $this->id ) . '-account-holder">' . __( 'Account Holder', 'ibantest-for-woocommerce' ) . ' <span class="required">*</span></label>
<input id="' . esc_attr( $this->id ) . '-account-holder" class="input-text wc-' . esc_attr( $this->id ) . '-account-holder" value="' . ( isset( $data['holder'] ) ? esc_attr( $data['holder'] ) : '' ) . '" type="text" autocomplete="off" placeholder="" name="' . esc_attr( $this->id ) . '_account_holder' . '" />
</p>',
);
?>
<fieldset id="wc-<?php echo esc_attr( $this->id ); ?>-form" class="wc-payment-form">
<?php do_action( 'woocommerce_ibantest_form_start', $this->id ); ?>
<?php do_action( 'ibantest_for_woocommerce_form_start', $this->id ); ?>
<?php
foreach ( $fields as $field ) {
echo $field;
Expand All @@ -185,7 +185,7 @@ public function form() {
</p>';

?>
<?php do_action( 'woocommerce_ibantest_form_end', $this->id ); ?>
<?php do_action( 'ibantest_for_woocommerce_form_end', $this->id ); ?>
<div class="clear"></div>
</fieldset>
<?php
Expand Down Expand Up @@ -213,7 +213,7 @@ public function validate_fields() {
}

if ( 'yes' == $this->settings['enable_mandate_checkbox'] && ! isset( $_POST['ibantest_mandate_checkbox'] ) ) {
wc_add_notice( __( 'Please agree to SEPA mandate.', 'woocommerce-ibantest' ), 'error' );
wc_add_notice( __( 'Please agree to SEPA mandate.', 'ibantest-for-woocommerce' ), 'error' );

return false;
}
Expand All @@ -223,19 +223,19 @@ public function validate_fields() {
$holder = ( isset( $_POST['ibantest_account_holder'] ) ? wc_clean( $_POST['ibantest_account_holder'] ) : '' );

if ( empty( $iban ) ) {
wc_add_notice( __( 'Please insert your IBAN.', 'woocommerce-ibantest' ), 'error' );
wc_add_notice( __( 'Please insert your IBAN.', 'ibantest-for-woocommerce' ), 'error' );

return false;
}

if ( empty( $bic ) ) {
wc_add_notice( __( 'Please insert your IBAN.', 'woocommerce-ibantest' ), 'error' );
wc_add_notice( __( 'Please insert your IBAN.', 'ibantest-for-woocommerce' ), 'error' );

return false;
}

if ( empty( $holder ) ) {
wc_add_notice( __( 'Please insert the account holder.', 'woocommerce-ibantest' ), 'error' );
wc_add_notice( __( 'Please insert the account holder.', 'ibantest-for-woocommerce' ), 'error' );

return false;
}
Expand All @@ -250,7 +250,7 @@ public function validate_fields() {

// Validate BIC
if ( ! preg_match( '/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/', $bic ) ) {
wc_add_notice( __( 'Your BIC is invalid.', 'woocommerce-ibantest' ), 'error' );
wc_add_notice( __( 'Your BIC is invalid.', 'ibantest-for-woocommerce' ), 'error' );
}

WC()->session->set( 'ibantest', serialize( [ 'iban' => $iban, 'bic' => $bic, 'holder' => $holder ] ) );
Expand All @@ -267,7 +267,7 @@ public function process_payment( $order_id ) {
$order = wc_get_order( $order_id );

// Mark as on-hold (we're awaiting the cheque)
$order->update_status( 'on-hold', __( 'Awaiting Direct Debit Payment', 'woocommerce-ibantest' ) );
$order->update_status( 'on-hold', __( 'Awaiting Direct Debit Payment', 'ibantest-for-woocommerce' ) );

// Check if cart instance exists (frontend request only)
if ( WC()->cart ) {
Expand Down Expand Up @@ -319,8 +319,8 @@ public function add_order_meta( $order_id ) {
*/
public function show_thank_you() {
?>
<h3><?php esc_html_e( 'Payment notice:', 'woocommerce-ibantest' ); ?></h3>
<p><?php esc_html_e( 'The order amount will be debited directly from your bank account.', 'woocommerce-ibantest' ); ?></p>
<h3><?php esc_html_e( 'Payment notice:', 'ibantest-for-woocommerce' ); ?></h3>
<p><?php esc_html_e( 'The order amount will be debited directly from your bank account.', 'ibantest-for-woocommerce' ); ?></p>
<?php
}

Expand All @@ -336,15 +336,15 @@ public function order_detail_fields( $order ) {
<p class="form-field form-field-wide">
<br/>
<h3>
<?php _e( 'Direct debit', 'woocommerce-ibantest' ); ?>:
<?php _e( 'Direct debit', 'ibantest-for-woocommerce' ); ?>:
<a href="<?php echo add_query_arg( array(
'content' => 'ibantest-sepa',
'sepa_order_id' => $order->get_id(),
'download' => true
), admin_url( 'export.php' ) ); ?>" target="_blank"
class="download_sepa_xml"><?php _e( 'SEPA XML Download', 'woocommerce-ibantest' ); ?></a>
class="download_sepa_xml"><?php _e( 'SEPA XML Download', 'ibantest-for-woocommerce' ); ?></a>
</h3>
<p><?php echo __( 'IBAN', 'woocommerce-ibantest' ) . ': ' . $this->hide_chars( $iban ) ?> <br/></p>
<p><?php echo __( 'IBAN', 'ibantest-for-woocommerce' ) . ': ' . $this->hide_chars( $iban ) ?> <br/></p>
<?php
}
}
Expand Down Expand Up @@ -393,16 +393,16 @@ public function email_direct_debit( $order, $sent_to_admin, $plain_text ) {
}

$sepa_fields = array(
__( 'Account Holder', 'woocommerce-ibantest' ) => WC_IBANTEST_Encryption()->decrypt( $order->get_meta( '_direct_debit_holder' ) ),
__( 'IBAN', 'woocommerce-ibantest' ) => $this->hide_chars( WC_IBANTEST_Encryption()->decrypt( $order->get_meta( '_direct_debit_iban' ) ) ),
__( 'BIC/SWIFT', 'woocommerce-ibantest' ) => WC_IBANTEST_Encryption()->decrypt( $order->get_meta( '_direct_debit_bic' ) )
__( 'Account Holder', 'ibantest-for-woocommerce' ) => WC_IBANTEST_Encryption()->decrypt( $order->get_meta( '_direct_debit_holder' ) ),
__( 'IBAN', 'ibantest-for-woocommerce' ) => $this->hide_chars( WC_IBANTEST_Encryption()->decrypt( $order->get_meta( '_direct_debit_iban' ) ) ),
__( 'BIC/SWIFT', 'ibantest-for-woocommerce' ) => WC_IBANTEST_Encryption()->decrypt( $order->get_meta( '_direct_debit_bic' ) )
);

if ( $sent_to_admin ) {
$sepa_fields[ __( 'Mandate Reference ID', 'woocommerce-ibantest' ) ] = $order->get_meta( '_direct_debit_mandate_id' );
$sepa_fields[ __( 'Mandate Reference ID', 'ibantest-for-woocommerce' ) ] = $order->get_meta( '_direct_debit_mandate_id' );
}
$debit_date = $order->get_meta( '_direct_debit_mandate_date' );
$pre_notification_text = sprintf( __( 'We will debit %s from your account by direct debit on or shortly after %s.', 'woocommerce-ibantest' ), wc_price( $order->get_total(), array( 'currency' => $order->get_currency() ) ), date_i18n( wc_date_format(), $debit_date ) );
$pre_notification_text = sprintf( __( 'We will debit %s from your account by direct debit on or shortly after %s.', 'ibantest-for-woocommerce' ), wc_price( $order->get_total(), array( 'currency' => $order->get_currency() ) ), date_i18n( wc_date_format(), $debit_date ) );
$mandate = $this->generate_mandate( $order );

wc_get_template( 'emails/email-sepa-data.php', array(
Expand Down Expand Up @@ -436,7 +436,7 @@ public function generate_mandate( $order ) {
'date' => $order->get_meta( '_direct_debit_mandate_date' ),
) );

$text = __( $this->settings['mandate_text'], 'woocommerce-ibantest' );
$text = __( $this->settings['mandate_text'], 'ibantest-for-woocommerce' );

foreach ( $args as $key => $val ) {
$text = str_replace( '[' . $key . ']', $val, $text );
Expand All @@ -454,7 +454,7 @@ public function generate_mandate( $order ) {
*/
public function admin_footer_text( $text ) {
if ( isset( $_GET['section'] ) && 'ibantest' === $_GET['section'] ) {
$text = sprintf( __( 'If you like <b>IBANTEST for Woocommerce</b> please leave us a %1$s rating. A huge thanks in advance!', 'woocommerce-ibantest' ),
$text = sprintf( __( 'If you like <b>IBANTEST for Woocommerce</b> please leave us a %1$s rating. A huge thanks in advance!', 'ibantest-for-woocommerce' ),
'<a href="https://wordpress.org/support/plugin/ibantest-for-woocommerce/reviews?rate=5#new-post" target="_blank" class="wc-rating-link" data-rated="Thanks">&#9733;&#9733;&#9733;&#9733;&#9733;</a>' );
}

Expand Down
Loading

0 comments on commit 8bb7b50

Please sign in to comment.