Plugin Directory

Changeset 1721436


Ignore:
Timestamp:
08/29/2017 06:42:20 PM (8 years ago)
Author:
kdclabs
Message:

Internationalization

Location:
camptix-kdcpay-gateway/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • camptix-kdcpay-gateway/trunk/camptix-kdcpay.php

    r1708153 r1721436  
    66 * Author: _KDC-Labs
    77 * Author URI: http://www.kdclabs.com/
    8  * Version: 1.4.5
     8 * Version: 1.5.0
    99 * License: GPLv2 or later
    10  * Text Doomain: kdcpay
     10 * Text Domain: camptix-kdcpay
     11 * Domain Path: /languages
     12 * GitHub Plugin URI: https://github.com/kdclabs/camptix-kdcpay-gateway
    1113 */
    1214
    13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     15if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
    1416
    15 // Add INR currency
     17// Load Plugin Text Domain.
     18add_action( 'init', 'camptix_kdcpay_load_textdomain' );
     19function camptix_kdcpay_load_textdomain() {
     20    load_plugin_textdomain( 'camptix-kdcpay', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
     21}
     22
     23// Add INR currency.
    1624add_filter( 'camptix_currencies', 'camptix_kdcpay_add_inr_currency' );
    1725function camptix_kdcpay_add_inr_currency( $currencies ) {
    18     if ( ! $currencies['INR'] ) {
     26    if ( ! array_key_exists( 'INR',$currencies ) ) {
    1927        $currencies['INR'] = array(
    20             'label' => __( 'Indian Rupees', 'kdcpay' ),
     28            'label' => __( 'Indian Rupees', 'camptix-kdcpay' ),
    2129            'format' => '₹ %s',
    2230        );
    2331    }
    24     if ( ! $currencies['LKR'] ) {
     32    if ( ! array_key_exists( 'LKR',$currencies ) ) {
    2533        $currencies['LKR'] = array(
    26             'label' => __( 'Sri Lankan Rupees', 'kdcpay' ),
     34            'label' => __( 'Sri Lankan Rupees', 'camptix-kdcpay' ),
    2735            'format' => 'රු %s',
    2836        );
     
    3846    camptix_register_addon( 'CampTix_Payment_Method_KDCpay' );
    3947}
    40 
    41 ?>
  • camptix-kdcpay-gateway/trunk/classes/class-camptix-payment-method-kdcpay.php

    r1708151 r1721436  
    11<?php
    2 
    32/**
    43 * CampTix KDCpay Payment Method
     
    4241        add_action( 'template_redirect', array( $this, 'template_redirect' ) );
    4342    }
    44    
     43
    4544    /**
    4645     * CampTix fields in the settings section for entering the Payment Credentials
    4746     */
    4847    function payment_settings_fields() {
    49         $this->add_settings_field_helper( 'payment_url', 'Payment URL', array( $this, 'field_text' ) );
    50         $this->add_settings_field_helper( 'merchant_id', 'Merchant ID', array( $this, 'field_text' ) );
    51         $this->add_settings_field_helper( 'merchant_key', 'Merchant Key', array( $this, 'field_text' ) );
    52         $this->add_settings_field_helper( 'attendee_mobile_id', __( 'Mobile Field ID', 'kdcpay' ), array( $this, 'field_text' ), __( "To obtain the ID, view the form's source code and look for input name: `tix_attendee_questions[1][###]` correspondng to your Mobile field question. ### = Filed ID", 'kdcpay') );
    53         $this->add_settings_field_helper( 'iframe', __( 'Show in iFrame', 'kdcpay' ), array( $this, 'field_yesno' ),
    54             __( "Yes = The payment form will loaded on next page | No = Page will be Redirected.", 'kdcpay' )
     48        $this->add_settings_field_helper( 'payment_url', __( 'Payment URL', 'camptix-kdcpay' ), array( $this, 'field_text' ) );
     49        $this->add_settings_field_helper( 'merchant_id', __( 'Merchant ID', 'camptix-kdcpay' ), array( $this, 'field_text' ) );
     50        $this->add_settings_field_helper( 'merchant_key', __( 'Merchant Key', 'camptix-kdcpay' ), array( $this, 'field_text' ) );
     51        $this->add_settings_field_helper( 'attendee_mobile_id', __( 'Mobile Field ID', 'camptix-kdcpay' ), array( $this, 'field_text' ), __( "To obtain the ID, view the form's source code and look for input name: `tix_attendee_questions[1][###]` correspondng to your Mobile field question. ### = Filed ID", 'camptix-kdcpay') );
     52        $this->add_settings_field_helper( 'iframe', __( 'Show in iFrame', 'camptix-kdcpay' ), array( $this, 'field_yesno' ),
     53            __( "Yes = The payment form will loaded on next page | No = Page will be Redirected.", 'camptix-kdcpay' )
    5554        );
    56         $this->add_settings_field_helper( 'sandbox', __( 'Sandbox Mode', 'kdcpay' ), array( $this, 'field_yesno' ),
    57             __( "The KDCpay Sandbox is a way to test payments without using real accounts and transactions. When enabled it will use sandbox merchant details instead of the ones defined above.", 'kdcpay' )
     55        $this->add_settings_field_helper( 'sandbox', __( 'Sandbox Mode', 'camptix-kdcpay' ), array( $this, 'field_yesno' ),
     56            __( "The KDCpay Sandbox is a way to test payments without using real accounts and transactions. When enabled it will use sandbox merchant details instead of the ones defined above.", 'camptix-kdcpay' )
    5857        );
    5958    }
    60    
     59
    6160    /**
    6261     * CampTix validate the submited options
     
    168167                $this->payment_result( $payment_token, CampTix_Plugin::PAYMENT_STATUS_FAILED );
    169168            }
    170    
     169
    171170            wp_safe_redirect( esc_url_raw( $url . '#tix' ) );
    172171            die();
     
    182181
    183182        if ( ! in_array( $this->camptix_options['currency'], $this->supported_currencies ) )
    184             die( __( 'The selected currency is not supported by this payment method.', 'kdcpay' ) );
     183            die( __( 'The selected currency is not supported by this payment method.', 'camptix-kdcpay' ) );
    185184
    186185        $return_url = add_query_arg( array(
     
    199198            'tix_payment_method' => 'camptix_kdcpay',
    200199        ), $this->get_tickets_url() );
    201        
     200
    202201        $payment_url = $this->options['payment_url'];
    203202        $merchant_id = $this->options['merchant_id'];
     
    233232        foreach ( $attendees as $attendee ) {
    234233            $tix_id = get_post( get_post_meta( $attendee->ID, 'tix_ticket_id', true ) );
    235            
     234
    236235            // Get Mobile Number
    237236            $attendee_questions = get_post_meta( $attendee->ID, 'tix_questions', true ); // Array of Attendee Questons
     
    242241            }
    243242
    244             $attendee_info[] = array( 
    245                     $attendee->ID, 
    246                     get_post_meta( $attendee->ID, 'tix_email', true ), 
    247                     get_post_meta( $attendee->ID, 'tix_first_name', true ), 
     243            $attendee_info[] = array(
     244                    $attendee->ID,
     245                    get_post_meta( $attendee->ID, 'tix_email', true ),
     246                    get_post_meta( $attendee->ID, 'tix_first_name', true ),
    248247                    get_post_meta( $attendee->ID, 'tix_last_name', true ),
    249248                    get_post_meta( $attendee->ID, 'tix_ticket_discounted_price', true ),
     
    254253                ); // array(0=id,1=email,2=first_name,3=last_name,4=tix_amount,5=tix_name,6=access_token,7=edit_token,8=mobile);
    255254        }
    256        
     255
    257256        $payload = array(
    258257            'mid' => $merchant_id, // Merchant details
     
    269268
    270269            // For CampTix considering Single and Multiple Tickets as a Single Item | Required to show in the bill on payment page
    271             'productDescription' => $event_name, // Text description-1, at least 1 item is mandatory 
     270            'productDescription' => $event_name, // Text description-1, at least 1 item is mandatory
    272271            'productAmount' => $order_total,     // Amount specific to the item-1
    273             'productQuantity' => '1', // Quntity specific to the item-1 
     272            'productQuantity' => '1', // Quntity specific to the item-1
    274273
    275274            'txnDate' => date( 'Y-m-d', time() + ( 60 * 60 * 5.5 ) ), // Date in IST (Indian Standard Time)
    276275            'udf1' => $payment_token, // Used by CampTix to associate with the present order (can not use `orderId` as only 20 charachters allowed)
    277             'udf2' => $tix_quantity, // CAMPTIX : TIX->Quantity 
     276            'udf2' => $tix_quantity, // CAMPTIX : TIX->Quantity
    278277            'udf3' => json_encode( $attendee_info ), // CAMPTIX : Attendee->INFO
    279278            'app' => 'camptix', // CAMPTIX
    280279            'callBack' => '0' // Allow to remotely inform CampTix via `Notify URL`
    281280        );
    282        
     281
    283282        if ( $this->options['iframe'] ) {
    284283            $payload['display'] = 'iframe';
     
    286285            $payload['display'] = 'redirect';
    287286        }
    288        
     287
    289288        if ( $this->options['sandbox'] ) {
    290289            $payload['mode'] = '0'; // DEMO
     
    294293
    295294        $payload['checksum']    = kdcpay_verify_payload( $secret_key, $payload, 'checkout' );
    296    
     295
    297296        $kdcpay_args_array      = array();
    298297        foreach ( $payload as $key => $value ) {
     
    301300
    302301        if ( $this->options['iframe'] ) {
    303            
     302
    304303            $kdcpay_checkout_button = '';
    305304            $kdcpay_checkout_target = ' target="kdcpay_payment_frame"';
     
    308307                    jQuery(document).ready(function(){
    309308                         window.addEventListener(\'message\', function(e) {
    310                              jQuery("#kdcpay_payment_frame").css("height",e.data[\'newHeight\']+\'px\');     
     309                             jQuery("#kdcpay_payment_frame").css("height",e.data[\'newHeight\']+\'px\');
    311310                         }, false);
    312311                    });
     
    318317            $kdcpay_checkout_button = '<p>Redirecting you to the Payment Page</p><input type="submit" value="Continue Now!" />';
    319318            $kdcpay_checkout_iframe = '';
    320            
    321         }
    322        
     319
     320        }
     321
    323322        $kdcpay_checkout = '<div id="tix">
    324323            <form action="' . esc_url($payment_url) . '" method="post" id="kdcpay_payment_form"' . $kdcpay_checkout_target . '>
     
    331330            </script>
    332331        </div>';
    333        
     332
    334333        return $kdcpay_checkout;
    335334    }
     
    364363        $checksum_allowed_parameters = array( 'status', 'orderId', 'responseCode', 'responseDescription', 'amount', 'trackId', 'pgId', 'bankId', 'paidBy' );
    365364    }
    366    
     365
    367366    // Create a string to calculate Checksum Value
    368367    $check_parameters = '';
     
    378377      }
    379378    }
    380    
     379
    381380    return kdcpay_calculate_checksum( $check_parameters, $secret_key );
    382381}
  • camptix-kdcpay-gateway/trunk/readme.txt

    r1708153 r1721436  
    11=== CampTix KDCpay Payments ===
    2 Contributors: kdclabs, vachan
     2Contributors: kdclabs, vachan, ajitbohra
    33Donate link: http://www.kdclabs.com/donate/
    44Tags: camptix, kdcpay
    55Requires at least: 3.5
    66Tested up to: 4.8.1
    7 Stable tag: 1.4.5
     7Stable tag: 1.5.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3232
    3333== Changelog ==
     34
     35= 1.5.0 =
     36* Added: Internationlization (@ajitbohra)
     37* Fixed: Debug=ON Errors (@ajitbohra)
    3438
    3539= 1.4.5 =
Note: See TracChangeset for help on using the changeset viewer.