PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.0.41
Post Grid Gutenberg Blocks – PostX v5.0.41
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 5.0.17 2.1.1 All 238 releases
ultimate-post / addons / oxygen / oxygen.php

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

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