PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / square / helpers / FrmSquareLiteAppHelper.php

FrmSquareLiteAppHelper.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More trunk, at square/helpers/FrmSquareLiteAppHelper.php

89 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 class FrmSquareLiteAppHelper {
7
8 /**
9 * @var FrmSquareLiteSettings|null
10 */
11 private static $settings;
12
13 /**
14 * @return string
15 */
16 public static function plugin_path() {
17 return FrmAppHelper::plugin_path() . '/square/';
18 }
19
20 /**
21 * @return string
22 */
23 public static function plugin_folder() {
24 return basename( self::plugin_path() );
25 }
26
27 /**
28 * @return string
29 */
30 public static function plugin_url() {
31 return FrmAppHelper::plugin_url() . '/square/';
32 }
33
34 /**
35 * @return FrmSquareLiteSettings
36 */
37 public static function get_settings() {
38 if ( ! isset( self::$settings ) ) {
39 self::$settings = new FrmSquareLiteSettings();
40 }
41 return self::$settings;
42 }
43
44 /**
45 * @return string
46 *
47 * @psalm-return 'live'|'test'
48 */
49 public static function active_mode() {
50 return self::get_settings()->settings->test_mode ? 'test' : 'live';
51 }
52
53 /**
54 * Add education about Square fees.
55 *
56 * Square is not included in a grandfathered license, so its fees always apply
57 * there even though Stripe fees do not.
58 *
59 * @param string $content UTM Content for the admin upgrade link.
60 * @param array|false|string $gateway Gateway or list of gateways this applies to.
61 *
62 * @return void
63 */
64 public static function fee_education( $content = 'tip', $gateway = false ) {
65 if ( ! FrmAddonsController::payment_fees_apply( 'square' ) ) {
66 return;
67 }
68
69 $classes = 'frm-light-tip show_square';
70
71 if ( $gateway && ! array_intersect( (array) $gateway, array( 'square' ) ) ) {
72 $classes .= ' frm_hidden';
73 }
74
75 FrmTipsHelper::show_tip(
76 array(
77 'link' => array(
78 'campaign' => 'square-fee',
79 'content' => $content,
80 ),
81 'tip' => 'Pay as you go pricing: 3% fee per-transaction + Square fees.',
82 'call' => __( 'Upgrade to save on fees.', 'formidable' ),
83 'class' => $classes,
84 ),
85 'p'
86 );
87 }
88 }
89