PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.0.25
Post Grid Gutenberg Blocks – PostX v5.0.25
5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 2.1.2 All 237 releases
ultimate-post / blocks / Advanced_List.php

Advanced_List.php in Post Grid Gutenberg Blocks – PostX 5.0.25, at blocks/Advanced_List.php

39 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ULTP\blocks;
3
4 defined( 'ABSPATH' ) || exit;
5
6 class Advanced_List {
7 public function __construct() {
8 add_action( 'init', array( $this, 'register' ) );
9 }
10
11 public function register() {
12 register_block_type(
13 'ultimate-post/list',
14 array(
15 'render_callback' => array( $this, 'render' ),
16 )
17 );
18 }
19
20 public function render( $attr, $content ) {
21
22 if ( ultimate_post()->is_dc_active( $attr ) && isset( $attr['dc'] ) ) {
23
24 $dc_text_val = \ULTP\DCService::get_dc_content_for_rich_text( $attr );
25 $text = isset( $dc_text_val['0'] ) ? $dc_text_val['0'] : '';
26 $url = isset( $dc_text_val['1'] ) ? $dc_text_val['1'] : '';
27 // [ $text, $url ] = \ULTP\DCService::get_dc_content_for_rich_text( $attr ); array destructure is not support php 7
28
29 if ( ! empty( $url ) ) {
30 $text = '<a href="' . esc_url( $url ) . '">' . wp_kses( $text, ultimate_post()->ultp_allowed_html_tags() ) . '</a>';
31 }
32
33 $content = \ULTP\DCService::replace( $content, $text );
34 }
35
36 return $content;
37 }
38 }
39