PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.1.9
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.1.9
3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 All 194 releases
convertkit / includes / integrations / class-convertkit-uncode.php

class-convertkit-uncode.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 3.1.9, at includes/integrations/class-convertkit-uncode.php

62 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ConvertKit Uncode Theme Integration.
4 *
5 * @package ConvertKit
6 * @author ConvertKit
7 */
8
9 /**
10 * Adds compatibility with the Uncode theme by using
11 * Uncode's specific hooks for outputting Forms and
12 * Restrict Content functionality.
13 *
14 * @since 2.7.7
15 */
16 class ConvertKit_Uncode {
17
18 /**
19 * Constructor. Registers actions and filters to possibly limit output of a Page/Post/CPT's
20 * content on the frontend site.
21 *
22 * @since 2.7.7
23 */
24 public function __construct() {
25
26 add_action( 'convertkit_restrict_content_register_content_filter', array( $this, 'maybe_register_restrict_content_filter' ) );
27
28 }
29
30 /**
31 * Registers the content filter if the Uncode theme is active
32 * and the Page is using the Visual Composer Page Builder.
33 *
34 * @since 2.7.7
35 */
36 public function maybe_register_restrict_content_filter() {
37
38 // Don't register a different filter if the Uncode theme is not active.
39 if ( ! function_exists( 'uncode_the_content' ) ) {
40 return;
41 }
42 if ( ! function_exists( 'vc_is_page_editable' ) ) {
43 return;
44 }
45
46 // Don't register a different filter if the Page is not using the Visual Composer Page Builder.
47 $the_content = uncode_get_the_content(); // @phpstan-ignore-line
48 if ( strpos( $the_content, '[vc_row' ) === false ) {
49 return;
50 }
51
52 // If here, the Page is using the Visual Composer Page Builder, so we need to use a different content filter
53 // to correctly restrict content.
54 add_filter( 'uncode_single_content_final_output', array( WP_ConvertKit()->get_class( 'output_restrict_content' ), 'maybe_restrict_content' ) );
55 remove_filter( 'the_content', array( WP_ConvertKit()->get_class( 'output_restrict_content' ), 'maybe_restrict_content' ) );
56
57 }
58
59 }
60
61 new ConvertKit_Uncode();
62