PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
← All changes | includes/core/widgets/block/class-manager.php +77 -3 2.8.16 → 3.13.3 View file →
@@ -63,8 +63,9 @@
63 63 add_action( 'init', array( $this, 'register_assets' ) );
64 64 add_action( 'init', array( $this, 'register_blocks' ) );
65 65 add_action( 'wp_footer', array( $this, 'wpfnl_inline_footer_scripts' ) );
66 66 add_action( 'wp_head', array( $this, 'add_block_inline_css' ), 100 );
67 + add_filter( 'block_categories_all', array( $this, 'register_block_category' ), 10, 2 );
67 68 new Wpfnl_Gutenberg_Editor();
68 69 }
69 70
70 71 /**
@@ -70,11 +71,57 @@
70 71 /**
71 72 * Inline jquery for editor-end floating label checkout.
72 73 */
73 74 public function wpfnl_checkout_block_editor_assets() {
74 - wp_enqueue_script( 'wpfunnels-editor-script', plugins_url( 'block/wpfunnels-editor-script.js', __DIR__ ), [], true );
75 + wp_enqueue_script( 'wpfunnels-editor-script', plugins_url( 'block/wpfunnels-editor-script.js', __DIR__ ), ['jquery'], WPFNL_VERSION, true );
76 + $this->enqueue_imported_template_inline_css();
77 +
78 + $post_id = get_the_ID();
79 + if ( ! $post_id && isset($_GET['post']) ) {
80 + $post_id = intval($_GET['post']);
81 + }
82 +
83 + if ( 'yes' === (get_post_meta($post_id, '_wpfnl_enhanced_phone_field_enabled', true) ? get_post_meta($post_id, '_wpfnl_enhanced_phone_field_enabled', true) : 'no') ) {
84 + wp_enqueue_style('intl-tel-input-style', WPFNL_URL . 'public/assets/phone/css/intlTelInput.css', array(), WPFNL_VERSION);
85 + wp_enqueue_script('intl-tel-input-script', WPFNL_URL . 'public/assets/phone/js/intlTelInput.min.js', array('jquery'), WPFNL_VERSION, true);
86 + wp_enqueue_script('intl-tel-input-utils', WPFNL_URL . 'public/assets/phone/js/utils.js', array('intl-tel-input-script'), WPFNL_VERSION, true);
87 +
88 + wp_localize_script(
89 + 'wpfunnels-editor-script',
90 + 'wpfnl_obj',
91 + [
92 + 'phone_utils_url' => WPFNL_URL . 'public/assets/phone/js/utils.js',
93 + 'phone_help_text' => get_post_meta($post_id, '_wpfnl_phone_help_text', true) ? get_post_meta($post_id, '_wpfnl_phone_help_text', true) : '',
94 + ]
95 + );
96 + }
75 97 }
76 98
99 + /**
100 + * Enqueue imported Gutenberg template inline CSS in editor mode.
101 + */
102 + private function enqueue_imported_template_inline_css() {
103 + $post_id = get_the_ID();
104 +
105 + if ( ! $post_id && isset( $_GET['post'] ) ) {
106 + $post_id = intval( $_GET['post'] );
107 + }
108 +
109 + if ( ! $post_id ) {
110 + return;
111 + }
112 +
113 + $custom_css = get_post_meta( $post_id, 'rex_gutenberg_css', true );
114 +
115 + if ( ! $custom_css ) {
116 + return;
117 + }
118 +
119 + wp_register_style( 'rex-gutenberg-css', false );
120 + wp_enqueue_style( 'rex-gutenberg-css' );
121 + wp_add_inline_style( 'rex-gutenberg-css', $custom_css );
122 + }
123 +
77 124
78 125 /**
79 126 * Register blocks, hooking up assets and render functions as needed.
80 127 */
@@ -93,14 +140,21 @@
93 140 *
94 141 * @return array
95 142 */
96 143 protected function get_block_types() {
97 - return apply_filters('wpfunnels/gutenberg_block_types', array(
144 + $block_types = array(
98 145 'NextStepButton',
99 146 'CheckoutForm',
100 147 'OrderDetails',
101 148 'OptinForm',
102 - ));
149 + );
150 +
151 + // Add OfferButton only if Pro is not active
152 + if ( ! Wpfnl_functions::is_wpfnl_pro_activated() ) {
153 + $block_types[] = 'OfferButton';
154 + }
155 +
156 + return apply_filters('wpfunnels/gutenberg_block_types', $block_types);
103 157 }
104 158
105 159
106 160 /**
@@ -161,6 +215,26 @@
161 215 } else {
162 216 echo '<style type="text/css">' . get_post_meta( get_the_ID(), '_wpfunnels_gb_css', true ) . '</style>';
163 217 }
164 218 }
219 + }
220 +
221 + /**
222 + * Register WPFunnels block category
223 + *
224 + * @param array $categories Block categories.
225 + * @param object $post Post object.
226 + * @return array Modified block categories.
227 + */
228 + public function register_block_category( $categories, $post ) {
229 + return array_merge(
230 + $categories,
231 + array(
232 + array(
233 + 'slug' => 'wpfunnels',
234 + 'title' => __( 'WPFunnels', 'wpfnl' ),
235 + 'icon' => null,
236 + ),
237 + )
238 + );
165 239 }
166 240 }