PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.24
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.24
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 6.24, at square/helpers/FrmSquareLiteAppHelper.php

84 lines 1.7 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 $settings = self::get_settings();
51 return $settings->settings->test_mode ? 'test' : 'live';
52 }
53
54 /**
55 * Add education about Stripe fees.
56 *
57 * @return void
58 */
59 public static function fee_education( $medium = 'tip', $gateway = false ) {
60 $license_type = FrmAddonsController::license_type();
61 if ( in_array( $license_type, array( 'elite', 'business' ), true ) ) {
62 return;
63 }
64
65 $classes = 'frm-light-tip show_square';
66 if ( $gateway && ! array_intersect( (array) $gateway, array( 'square' ) ) ) {
67 $classes .= ' frm_hidden';
68 }
69
70 FrmTipsHelper::show_tip(
71 array(
72 'link' => array(
73 'content' => 'square-fee',
74 'medium' => $medium,
75 ),
76 'tip' => 'Pay as you go pricing: 3% fee per-transaction + Square fees.',
77 'call' => __( 'Upgrade to save on fees.', 'formidable' ),
78 'class' => $classes,
79 ),
80 'p'
81 );
82 }
83 }
84