PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.1.1
Post Grid Gutenberg Blocks – PostX v5.1.1
5.1.1 5.1.0 5.0.41 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 All 240 releases
ultimate-post / addons / oxygen / oxygen.php

oxygen.php in Post Grid Gutenberg Blocks – PostX 5.1.1, at addons/oxygen/oxygen.php

78 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3
4 class PostXOxygenElement extends OxyEl {
5
6 function init() {
7 // Do some initial things here.
8 }
9
10 function afterInit() {
11 $this->removeApplyParamsButton();
12 }
13
14 function name() {
15 return __( 'PostX Templates', 'ultimate-post' );
16 }
17
18 function slug() {
19 return 'postx-templates';
20 }
21
22 function icon() {
23 return ULTP_URL . 'addons/oxygen/icon.svg';
24 }
25
26 function button_place() {
27 // return "interactive";
28 }
29
30 function button_priority() {
31 return 9;
32 }
33
34
35 function render( $options, $defaults, $content ) {
36 $templates = $options['templates'];
37
38 if ( $templates ) {
39 if ( isset( $_GET['action'] ) && strpos( sanitize_key( $_GET['action'] ), 'oxy_render_oxy' ) !== false ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only Oxygen editor detection.
40 echo ultimate_post()->build_css_for_inline_print( $templates, true ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- <style> tag from build_css_for_inline_print(): integer post ID, CSS passed through wp_strip_all_tags().
41 }
42
43 $args = array(
44 'p' => $templates,
45 'post_type' => 'ultp_templates',
46 );
47 $the_query = new \WP_Query( $args );
48 if ( $the_query->have_posts() ) {
49 while ( $the_query->have_posts() ) {
50 $the_query->the_post();
51 the_content();
52 }
53 wp_reset_postdata();
54 }
55 } elseif ( isset( $_GET['action'] ) && strpos( sanitize_key( $_GET['action'] ), 'oxy_render_oxy' ) !== false ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only Oxygen editor detection.
56 // @codingStandardsIgnoreLine
57 echo '<p style="text-align:center;">' . sprintf( esc_html__( 'Pick a Template from your saved ones. Or create a template from: %s.', 'ultimate-post' ) . ' ', '<strong><i>' . esc_html__( 'Dashboard > PostX > Saved Templates', 'ultimate-post' ) . '</i></strong>' ) . '</p>';
58 }
59 }
60
61 function controls() {
62 $this->addOptionControl(
63 array(
64 'type' => 'dropdown',
65 'name' => esc_html__( 'Select Your Template', 'ultimate-post' ),
66 'slug' => 'templates',
67 'default' => '',
68 )
69 )->setValue( ultimate_post()->get_all_lists( 'ultp_templates' ) )->rebuildElementOnChange();
70 }
71
72 function defaultCSS() {
73 ultimate_post()->register_scripts_common();
74 }
75 }
76
77 new PostXOxygenElement();
78