Plugin Directory

source: my-tickets/trunk/mt-payment-settings.php

Last change on this file was 3384872, checked in by joedolson, 4 weeks ago

Remove 2.0.22, add 2.1.0, change stable.

https://github.com/joedolson/my-tickets/releases/tag/v2.1.0

File size: 24.9 KB
Line 
] ) . "'>" . get_the_title( $options['mt_purchase_page'] ) . '</a>', get_post_status( $options['mt_purchase_page'] ) ) : __( 'Not defined', 'my-tickets' );
] ) . "'>" . get_the_title( $options['mt_receipt_page'] ) . '</a>', get_post_status( $options['mt_receipt_page'] ) ) : __( 'Not defined', 'my-tickets' );
] ) . "'>" . get_the_title( $options['mt_tickets_page'] ) . '</a>', get_post_status( $options['mt_tickets_page'] ) ) : __( 'Not defined', 'my-tickets' );
333                                                                        ?>
334                                                                        <p>
335                                                                                <input type="search" aria-describedby="mt_purchase_page_new" size='9' class='suggest' id="mt_purchase_page" name="mt_purchase_page" value="<?php echo stripslashes( esc_attr( $options['mt_purchase_page'] ) ); ?>" required aria-required="true" />
336                                                                                <label for="mt_purchase_page">
337                                                                                        <?php _e( 'Shopping cart', 'my-tickets' ); ?><br />
338                                                                                        <em class='current'><?php echo wp_kses_post( $current_purchase_page ); ?></em>
339                                                                                </label>
340                                                                                <span class='new' aria-live="assertive" id="mt_purchase_page_new"></span>
341                                                                        </p>
342                                                                        <p>
343                                                                                <input type="search" aria-describedby="mt_receipt_page_new"  size='9' class='suggest' id="mt_receipt_page" name="mt_receipt_page" value="<?php echo stripslashes( esc_attr( $options['mt_receipt_page'] ) ); ?>" required aria-required="true"/>
344                                                                                <label for="mt_receipt_page">
345                                                                                        <?php _e( 'Receipt page', 'my-tickets' ); ?><br />
346                                                                                        <em class='current'><?php echo wp_kses_post( $current_receipt_page ); ?></em>
347                                                                                </label>
348                                                                                <span class='new' aria-live="assertive" id="mt_receipt_page"></span>
349                                                                        </p>
350                                                                        <p>
351                                                                                <input type="search" aria-describedby="mt_tickets_page_new" size='9' class='suggest' id="mt_tickets_page" name="mt_tickets_page" value="<?php echo stripslashes( esc_attr( $options['mt_tickets_page'] ) ); ?>" required aria-required="true"/>
352                                                                                <label for="mt_tickets_page">
353                                                                                        <?php _e( 'Tickets page', 'my-tickets' ); ?><br />
354                                                                                        <em class='current'><?php echo wp_kses_post( $current_tickets_page ); ?></em>
355                                                                                </label>
356                                                                                <span class='new' aria-live="assertive" id="mt_tickets_page_new"></span>
357                                                                        </p>
358                                                                </fieldset>
359                                                        </div>
360                                                </div>
361                                        </div>
362                                        <p class="mt-save-settings"><input type="submit" name="mt-payment-settings" class="button-primary" value="<?php _e( 'Save Payment Settings', 'my-tickets' ); ?>"/></p>
363                                </form>
364                        </div>
365                </div>
366                <?php mt_show_support_box(); ?>
367        </div>
368        <?php
369        // creates settings page for My tickets.
370}
371
372/**
373 * Return current currency symbol.
374 *
375 * @param array $currency Currencies.
376 *
377 * @return string
378 */
379function mt_symbols( $currency ) {
380        $currencies = mt_currency();
381        $symbol     = $currencies[ $currency ]['symbol'];
382        $symbol     = ( ! $symbol ) ? $currency : $symbol;
383
384        return $symbol;
385}
386
387/**
388 * All currencies.
389 *
390 * @return array
391 */
392function mt_currency() {
393        /**
394         * Filter array of available currencies. Currencies available vary depending on payment gateway used.
395         *
396         * @hook mt_currencies
397         *
398         * @param {array} $currencies Array of currencies available.
399         *
400         * @return {array}
401         */
402        $currencies = apply_filters(
403                'mt_currencies',
404                array(
405                        'USD' => array(
406                                'symbol'      => '$',
407                                'description' => __( 'U.S. Dollars ($)', 'my-tickets' ),
408                        ),
409                        'EUR' => array(
410                                'symbol'      => '€',
411                                'description' => __( 'Euros (€)', 'my-tickets' ),
412                        ),
413                        'AUD' => array(
414                                'symbol'      => 'A $',
415                                'description' => __( 'Australian Dollars (A $)', 'my-tickets' ),
416                        ),
417                        'CAD' => array(
418                                'symbol'      => 'C $',
419                                'description' => __( 'Canadian Dollars (C $)', 'my-tickets' ),
420                        ),
421                        'CZK' => array(
422                                'symbol'      => 'Kč',
423                                'description' => __( 'Czech Koruna (Kč)', 'my-tickets' ),
424                        ),
425                        'GBP' => array(
426                                'symbol'      => '£',
427                                'description' => __( 'Pounds Sterling (£)', 'my-tickets' ),
428                        ),
429                        'INR' => array(
430                                'symbol'      => '₹',
431                                'description' => __( 'Indian Rupees (₹)', 'my-tickets' ),
432                        ),
433                        'JPY' => array(
434                                'symbol'      => '¥',
435                                'description' => __( 'Yen (¥)', 'my-tickets' ),
436                                'zerodecimal' => true,
437                        ),
438                        'NZD' => array(
439                                'symbol'      => '$',
440                                'description' => __( 'New Zealand Dollar ($)', 'my-tickets' ),
441                        ),
442                        'CHF' => array(
443                                'symbol'      => 'CHF ',
444                                'description' => __( 'Swiss Franc', 'my-tickets' ),
445                        ),
446                        'HKD' => array(
447                                'symbol'      => '$',
448                                'description' => __( 'Hong Kong Dollar ($)', 'my-tickets' ),
449                        ),
450                        'SGD' => array(
451                                'symbol'      => '$',
452                                'description' => __( 'Singapore Dollar ($)', 'my-tickets' ),
453                        ),
454                        'SEK' => array(
455                                'symbol'      => 'kr ',
456                                'description' => __( 'Swedish Krona', 'my-tickets' ),
457                        ),
458                        'DKK' => array(
459                                'symbol'      => 'kr ',
460                                'description' => __( 'Danish Krone', 'my-tickets' ),
461                        ),
462                        'PLN' => array(
463                                'symbol'      => 'zł',
464                                'description' => __( 'Polish Zloty', 'my-tickets' ),
465                        ), // this is triggedec9decring an error. Why.
466                        'NOK' => array(
467                                'symbol'      => 'kr ',
468                                'description' => __( 'Norwegian Krone', 'my-tickets' ),
469                        ),
470                        'HUF' => array(
471                                'symbol'      => 'Ft ',
472                                'description' => __( 'Hungarian Forint', 'my-tickets' ),
473                                'zerodecimal' => true,
474                        ),
475                        'ILS' => array(
476                                'symbol'      => '₪',
477                                'description' => __( 'Israeli Shekel', 'my-tickets' ),
478                        ),
479                        'MXN' => array(
480                                'symbol'      => '$',
481                                'description' => __( 'Mexican Peso', 'my-tickets' ),
482                        ),
483                        'BRL' => array(
484                                'symbol'      => 'R$',
485                                'description' => __( 'Brazilian Real', 'my-tickets' ),
486                        ),
487                        'MYR' => array(
488                                'symbol'      => 'RM',
489                                'description' => __( 'Malaysian Ringgits', 'my-tickets' ),
490                        ),
491                        'PHP' => array(
492                                'symbol'      => '₱',
493                                'description' => __( 'Philippine Pesos', 'my-tickets' ),
494                        ),
495                        'TWD' => array(
496                                'symbol'      => 'NT$',
497                                'description' => __( 'Taiwan New Dollars', 'my-tickets' ),
498                                'zerodecimal' => true,
499                        ),
500                        'THB' => array(
501                                'symbol'      => '฿',
502                                'description' => __( 'Thai Baht', 'my-tickets' ),
503                        ),
504                        'TRY' => array(
505                                'symbol'      => 'TRY ',
506                                'description' => __( 'Turkish Lira', 'my-tickets' ),
507                        ),
508                        'ZAR' => array(
509                                'symbol'      => 'R',
510                                'description' => __( 'South African Rand', 'my-tickets' ),
511                        ),
512                )
513        );
514
515        ksort( $currencies );
516
517        return $currencies;
518}
519
520/**
521 * Is the current currency a zerodecimal type.
522 *
523 * @return bool
524 */
525function mt_zerodecimal_currency() {
526        $options    = mt_get_settings();
527        $currency   = $options['mt_currency'];
528        $currencies = mt_currency();
529        $data       = $currencies[ $currency ];
530
531        if ( isset( $data['zerodecimal'] ) && true === $data['zerodecimal'] ) {
532                return true;
533        }
534
535        return false;
536}
Note: See TracBrowser for help on using the repository browser.