PluginProbe
Powerkit – Supercharge your WordPress Site / 2.4.4
Powerkit – Supercharge your WordPress Site v2.4.4
3.1.1 3.1.0 3.0.9 3.0.8 trunk 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 All 87 releases
powerkit / modules / inline-posts / public / class-powerkit-inline-posts-public.php

class-powerkit-inline-posts-public.php in Powerkit – Supercharge your WordPress Site 2.4.4, at modules/inline-posts/public/class-powerkit-inline-posts-public.php

114 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The public-facing functionality of the module.
4 *
5 * @link https://codesupply.co
6 * @since 1.0.0
7 *
8 * @package Powerkit
9 * @subpackage Modules/public
10 */
11
12 /**
13 * The public-facing functionality of the module.
14 */
15 class Powerkit_Inline_Posts_Public extends Powerkit_Module_Public {
16
17 /**
18 * Initialize
19 */
20 public function initialize() {
21 // PinIt exclude selectors.
22 add_filter( 'powerkit_pinit_exclude_selectors', array( $this, 'pinit_disable' ) );
23
24 // Reset global related variable.
25 add_filter( 'the_content', array( $this, 'reset_related' ), 1 );
26
27 // Register Templates.
28 add_action( 'init', array( $this, 'register_templates' ) );
29 add_filter( 'powerkit_inline_posts_templates', array( $this, 'list_templates' ) );
30 }
31
32 /**
33 * Reset global $powerkit_inline_posts.
34 *
35 * @param string $content Content of the current post.
36 */
37 public function reset_related( $content ) {
38 global $powerkit_inline_posts;
39
40 $powerkit_inline_posts = null;
41
42 return $content;
43 }
44
45 /**
46 * Register Templates
47 *
48 * @since 1.0.0
49 * @access private
50 *
51 * @param array $templates List of Templates.
52 */
53 public function register_templates( $templates = array() ) {
54 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/inline-posts-template.php';
55 }
56
57
58 /**
59 * Filter Register Templates
60 *
61 * @since 1.0.0
62 * @access private
63 *
64 * @param array $templates List of Templates.
65 */
66 public function list_templates( $templates = array() ) {
67 $templates = array(
68 'list' => array(
69 'name' => esc_html__( 'List', 'powerkit' ),
70 'func' => 'powerkit_inline_posts_default_template',
71 ),
72 'grid' => array(
73 'name' => esc_html__( 'Grid', 'powerkit' ),
74 'func' => 'powerkit_inline_posts_default_template',
75 ),
76 'grid-2' => array(
77 'name' => esc_html__( 'Grid 2', 'powerkit' ),
78 'func' => 'powerkit_inline_posts_default_template',
79 ),
80 'grid-3' => array(
81 'name' => esc_html__( 'Grid 3', 'powerkit' ),
82 'func' => 'powerkit_inline_posts_default_template',
83 ),
84 'grid-4' => array(
85 'name' => esc_html__( 'Grid 4', 'powerkit' ),
86 'func' => 'powerkit_inline_posts_default_template',
87 ),
88 );
89
90 return $templates;
91 }
92
93 /**
94 * PinIt exclude selectors
95 *
96 * @param string $selectors List selectors.
97 */
98 public function pinit_disable( $selectors ) {
99 $selectors[] = '.pk-inline-posts-container img';
100
101 return $selectors;
102 }
103
104 /**
105 * Register the stylesheets for the public-facing side of the site.
106 */
107 public function wp_enqueue_scripts() {
108 wp_enqueue_style( 'powerkit-inline-posts', powerkit_style( plugin_dir_url( __FILE__ ) . 'css/public-powerkit-inline-posts.css' ), array(), powerkit_get_setting( 'version' ), 'all' );
109
110 // Add RTL support.
111 wp_style_add_data( 'powerkit-inline-posts', 'rtl', 'replace' );
112 }
113 }
114