PluginProbe ʕ •ᴥ•ʔ
پارسی دیت – Parsi Date / trunk
پارسی دیت – Parsi Date vtrunk
6.2.1 6.2 6.1 5.1.6 5.1.7 5.1.8 5.1.8.2 6.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.0.0-alpha 2.1 2.1.1 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0.1 2.3.0.2 2.3.1 2.3.2 2.3.3 2.3.4 3.0.1 3.0.2 3.0.3 4.0.0 4.0.1 4.0.2 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5
wp-parsidate / inc / App / Integration / WooCommerce / wc-gateways / blocks / wpp-melli-pg-block.php
wp-parsidate / inc / App / Integration / WooCommerce / wc-gateways / blocks Last commit date
wpp-mellat-pg-block.php 3 months ago wpp-melli-pg-block.php 3 months ago wpp-parsian-pg-block.php 3 months ago wpp-pasargad-pg-block.php 3 months ago
wpp-melli-pg-block.php
83 lines
1 <?php
2
3 defined( 'ABSPATH' ) or exit( 'No direct script access allowed' );
4
5 use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
6 use WPParsidate\Helper\Assets;
7
8 if ( ! class_exists( 'WPP_WC_Melli_Gateway_Blocks' ) ) {
9 final class WPP_WC_Melli_Gateway_Blocks extends AbstractPaymentMethodType {
10
11 private $gateway;
12
13 /**
14 * Payment method name/id/slug.
15 *
16 * @var string
17 */
18 protected $name = 'melli';
19
20
21 /**
22 * Initializes the payment method type.
23 */
24 public function initialize() {
25 $class_name = get_class( $this );
26 $this->settings = get_option( "woocommerce_{$this->name}_settings", [] );
27 $this->gateway = new $class_name;
28 }
29
30 /**
31 * Returns if this payment method should be active. If false, the scripts will not be enqueued.
32 *
33 * @return boolean
34 */
35 public function is_active() {
36 return filter_var( $this->get_setting( 'enabled', true ), FILTER_VALIDATE_BOOLEAN );
37 }
38
39 /**
40 * Returns an array of scripts/handles to be registered for this payment method.
41 *
42 * @return array
43 */
44 public function get_payment_method_script_handles() {
45 $script_id = "wpp-wc-$this->name-blocks-integration";
46 $script_name = "wpp-wc-$this->name-pg.js";
47
48 wp_register_script(
49 $script_id,
50 Assets::url( "js-admin/wc-pg-blocks/$script_name" ),
51 array(
52 'wc-blocks-registry',
53 'wc-settings',
54 'wp-element',
55 'wp-html-entities',
56 'wp-i18n',
57 ),
58 Assets::getVersion(),
59 true
60 );
61
62 if ( function_exists( 'wp_set_script_translations' ) ) {
63 wp_set_script_translations( $script_id, 'wp-parsidate', WP_PARSI_DIR . 'languages/' );
64 }
65
66 return array( $script_id );
67 }
68
69 /**
70 * Returns an array of key=>value pairs of data made available to the payment methods script.
71 *
72 * @return array
73 */
74 public function get_payment_method_data() {
75 return array(
76 'title' => $this->get_setting( 'title' ),
77 'description' => $this->get_setting( 'description' ),
78 'supports' => $this->get_supported_features(),
79 );
80 }
81 }
82 }
83