PluginProbe
Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe / trunk
Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe vtrunk
4.17.3 trunk 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 4.10.0 4.11.1 4.12.2 4.14.1 4.14.2 4.14.3 4.15.0 4.16.0 All 59 releases
stripe / src / Block / BlockSubscriber.php

BlockSubscriber.php in Stripe Payment Forms by WP Simple Pay – Accept Credit Card Payments + Subscriptions with Stripe trunk, at src/Block/BlockSubscriber.php

81 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Block: Subscriber
4 *
5 * @package SimplePay
6 * @subpackage Core
7 * @copyright Copyright (c) 2021, Sandhills Development, LLC
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 4.4.2
10 */
11
12 namespace SimplePay\Core\Block;
13
14 use SimplePay\Core\EventManagement\SubscriberInterface;
15
16 /**
17 * BlockSubscriber class.
18 *
19 * @since 4.4.2
20 */
21 class BlockSubscriber implements SubscriberInterface {
22
23 /**
24 * Block types.
25 *
26 * @since 4.4.2
27 * @var \SimplePay\Core\Block\BlockInterface[] $blocks Block types.
28 */
29 private $blocks;
30
31 /**
32 * BlockSubscriber.
33 *
34 * @since 4.4.2
35 *
36 * @param \SimplePay\Core\Block\BlockInterface[] $blocks Block types.
37 */
38 public function __construct( array $blocks ) {
39 $this->blocks = array();
40
41 foreach ( $blocks as $block ) {
42 $this->add_block( $block );
43 }
44 }
45
46 /**
47 * Adds an block to be registered.
48 *
49 * @since 4.4.2
50 *
51 * @param \SimplePay\Core\Block\BlockInterface $block Block to add for future registration.
52 * @return void
53 */
54 private function add_block( BlockInterface $block ) {
55 $this->blocks[] = $block;
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function get_subscribed_events() {
62 return array(
63 'init' => 'register_block_types',
64 );
65 }
66
67 /**
68 * Registers added block types.
69 *
70 * @since 4.4.2
71 *
72 * @return void
73 */
74 public function register_block_types() {
75 foreach ( $this->blocks as $block ) {
76 $block->register();
77 }
78 }
79
80 }
81