PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
← All changes | includes/Blocks/Blocks_Register.php +26 -24 trunk2.2.0 View file →
@@ -19,9 +19,8 @@
19 19 require_once __DIR__ . '/Render/single-forum.php';
20 20 require_once __DIR__ . '/Render/forum-ajax.php';
21 21 require_once __DIR__ . '/Render/forum-overview.php';
22 22
23 -
24 23 use admin\Blocks\Render\Forum_Posts;
25 24 use admin\Blocks\Render\Forum_Tab;
26 25 use admin\Blocks\Render\Forums;
27 26 use admin\Blocks\Render\Search;
@@ -28,9 +27,8 @@
28 27 use admin\Blocks\Render\Single_Forum;
29 28 use admin\Blocks\Render\Forum_Ajax;
30 29 use admin\Blocks\Render\Forum_Overview;
31 30
32 -
33 31 class Blocks_Register {
34 32
35 33 /**
36 34 * Render class instances.
@@ -54,10 +52,8 @@
54 52 $this->renderers['search'] = new Search();
55 53 $this->renderers['single_forum'] = new Single_Forum();
56 54 $this->renderers['forum_ajax'] = new Forum_Ajax();
57 55 $this->renderers['forum_overview'] = new Forum_Overview();
58 -
59 -
60 56 }
61 57
62 58 /**
63 59 * Register the Forumax block category.
@@ -106,30 +102,36 @@
106 102 * delegates rendering to the appropriate Render class.
107 103 */
108 104 public function blocks_init() {
109 105
110 - $blocks = array(
111 - 'forum-posts' => 'forum_posts',
112 - 'forum-tab' => 'forum_tab',
113 - 'forums' => 'forums',
114 - 'search' => 'search',
115 - 'single-forum' => 'single_forum',
116 - 'forum-ajax' => 'forum_ajax',
117 - 'forum-overview' => 'forum_overview',
118 - );
106 + register_block_type( __DIR__ . '/../../build/forum-posts', array(
107 + 'render_callback' => array( $this->renderers['forum_posts'], 'render_forum_posts' ),
108 + ) );
119 109
120 - foreach ( $blocks as $block_dir => $renderer_key ) {
121 - if ( 'forum-ajax' === $block_dir && \WP_Block_Type_Registry::get_instance()->is_registered( 'bbp-core/forum-ajax' ) ) {
122 - continue;
123 - }
110 + register_block_type( __DIR__ . '/../../build/forum-tab', array(
111 + 'render_callback' => array( $this->renderers['forum_tab'], 'render_forum_tab' ),
112 + ) );
124 113
125 - $block_path = __DIR__ . '/../../build/' . $block_dir;
126 - if ( file_exists( $block_path . '/block.json' ) ) {
127 - register_block_type( $block_path, array(
128 - 'render_callback' => array( $this->renderers[ $renderer_key ], 'render_' . $renderer_key ),
129 - ) );
130 - }
114 + register_block_type( __DIR__ . '/../../build/forums', array(
115 + 'render_callback' => array( $this->renderers['forums'], 'render_forums' ),
116 + ) );
117 +
118 + register_block_type( __DIR__ . '/../../build/search', array(
119 + 'render_callback' => array( $this->renderers['search'], 'render_search' ),
120 + ) );
121 +
122 + register_block_type( __DIR__ . '/../../build/single-forum', array(
123 + 'render_callback' => array( $this->renderers['single_forum'], 'render_single_forum' ),
124 + ) );
125 +
126 + // Only register forum-ajax from bbp-core if Forumax Pro hasn't already registered it.
127 + if ( ! \WP_Block_Type_Registry::get_instance()->is_registered( 'bbp-core/forum-ajax' ) ) {
128 + register_block_type( __DIR__ . '/../../build/forum-ajax', array(
129 + 'render_callback' => array( $this->renderers['forum_ajax'], 'render_forum_ajax' ),
130 + ) );
131 131 }
132 132
133 -
133 + register_block_type( __DIR__ . '/../../build/forum-overview', array(
134 + 'render_callback' => array( $this->renderers['forum_overview'], 'render_forum_overview' ),
135 + ) );
134 136 }
135 137 }