PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.12.3
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.12.3
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / includes / square / charitable-square-core-functions.php

charitable-square-core-functions.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.12.3, at includes/square/charitable-square-core-functions.php

107 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Square core functions.
4 *
5 * @package Charitable Square/Functions/Core
6 * @author David Bisset
7 * @copyright Copyright (c) 2021-2022, David Bisset
8 * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9 * @since 1.8.7
10 */
11
12 // Exit if accessed directly.
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Check whether webhooks should be set up.
19 *
20 * @since 1.3.0
21 *
22 * @return boolean
23 */
24 function charitable_square_should_setup_webhooks() {
25 /**
26 * Filter whether webhooks should be set up for this site.
27 *
28 * By default, this will return true unless this is localhost.
29 *
30 * @since 1.3.0
31 *
32 * @param boolean $should Whether the webhooks should be set up.
33 */
34 return apply_filters(
35 'charitable_square_setup_webhooks',
36 ! charitable_is_localhost()
37 );
38 }
39
40 // replaces charitable_get_option( 'gateways_square','square_legacy_settings' ) ) {
41
42 /**
43 * Check if the Square legacy settings are set to true.
44 *
45 * @since 1.8.7
46 *
47 * @return boolean
48 */
49 function charitable_square_legacy_settings_check() {
50 $settings = charitable_get_option( 'gateways_square' );
51
52 if ( isset( $settings['square_legacy_settings'] ) && $settings['square_legacy_settings'] ) {
53 return true;
54 }
55 return false;
56 }
57
58 /**
59 * Retrieve the Square location ID.
60 *
61 * @since 1.8.7
62 *
63 * @param string $mode The mode to get the location ID for.
64 *
65 * @return string
66 */
67 function charitable_square_get_location_id( $mode = 'test' ) {
68
69 // If nothing was passed in, get the current mode.
70 if ( empty( $mode ) ) {
71 $mode = charitable_get_option( 'test_mode' ) ? 'test' : 'live';
72 }
73
74 $location_id = get_option( 'charitable_square_location_id_' . $mode );
75
76 return $location_id;
77 }
78
79 /**
80 * Retrieve the Square settings page URL.
81 *
82 * @since 1.8.7
83 *
84 * @return string
85 */
86 function charitable_get_square_settings_page_url() {
87 return add_query_arg(
88 array(
89 'page' => 'charitable-settings',
90 'tab' => 'gateways',
91 'group' => 'gateways_square_core',
92 ),
93 admin_url( 'admin.php' )
94 );
95 }
96
97 /**
98 * Check if Square integration is present. A "dumb" function but easy way for Square to check if new integration is present.
99 *
100 * @since 1.8.7
101 *
102 * @return boolean
103 */
104 function charitable_square_connect_integration_check() {
105 return true;
106 }
107