PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / trunk
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 All 66 releases
better-payment / includes / Blocks / ThirdPartyIntegration.php

ThirdPartyIntegration.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More trunk, at includes/Blocks/ThirdPartyIntegration.php

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Better_Payment\Lite\Blocks;
4
5 use Better_Payment\Lite\Blocks\Settings as Settings;
6 use Better_Payment\Lite\Traits\HasSingletone as HasSingletone;
7
8 abstract class ThirdPartyIntegration {
9 use HasSingletone;
10
11 /**
12 * Returns concat URL with the endpoint and version.
13 *
14 * @param string $endpoint
15 * @param string $version
16 * @return string
17 */
18 protected function url( $endpoint, $version = 'v1/' ) {
19 return static::URL . $version . $endpoint;
20 }
21
22 public static function is_isset( $value, $default = '' ) {
23 return isset( $_POST[ $value ] ) ? sanitize_text_field( $_POST[ $value ] ) : $default;
24 }
25
26 public function settings() {
27 return Settings::get_instance();
28 }
29
30 public function add_ajax( array $actions = array() ) {
31 if ( ! empty( $actions ) ) {
32 foreach ( $actions as $action => $method ) {
33 if ( is_string( $method ) ) {
34 add_action( "wp_ajax_$action", array( $this, $method ) );
35 add_action( "wp_ajax_nopriv_$action", array( $this, $method ) );
36 } else {
37 add_action( "wp_ajax_$action", array( $this, $method['callback'] ) );
38 if ( isset( $method['public'] ) && $method['public'] == true ) {
39 add_action( "wp_ajax_nopriv_$action", array( $this, $method['callback'] ) );
40 }
41 }
42 }
43 }
44 }
45 }
46