PluginProbe
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News / 2.4.26
Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News v2.4.26
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 2.3.5 2.3.6 2.4.0 2.4.1 2.4.10 2.4.11 2.4.12 2.4.13 2.4.14 2.4.15 2.4.16 2.4.17 2.4.18 2.4.19 2.4.2 2.4.20 2.4.21 All 88 releases
post-carousel / admin / ElementAddons_Deprecated / Shortcode_Widget_Deprecated.php

Shortcode_Widget_Deprecated.php in Smart Post – Post Grid, Post Carousel, Post Slider Gutenberg Blocks for Blog & News 2.4.26, at admin/ElementAddons_Deprecated/Shortcode_Widget_Deprecated.php

172 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The plugin elementor addons Initializer.
4 *
5 * @link https://shapedplugin.com/
6 * @since 2.4.2
7 *
8 * @package Smart_Post_Show
9 * @subpackage Smart_Post_Show/Admin
10 * @author ShapedPlugin <support@shapedplugin.com>
11 */
12
13 /**
14 * Elementor smart post show free shortcode Widget.
15 *
16 * @since 2.4.1
17 */
18 class Shortcode_Widget_Deprecated extends \Elementor\Widget_Base {
19 /**
20 * Get widget name.
21 *
22 * @since 2.4.1
23 * @access public
24 *
25 * @return string Widget name.
26 */
27 public function get_name() {
28 return 'smart_post_show_free_shortcode';
29 }
30
31 /**
32 * Get widget title.
33 *
34 * @since 2.4.1
35 * @access public
36 *
37 * @return string Widget title.
38 */
39 public function get_title() {
40 return __( 'Smart Post Show Deprecated', 'post-carousel' );
41 }
42
43 /**
44 * Get widget icon.
45 *
46 * @since 2.2.5
47 * @access public
48 *
49 * @return string Widget icon.
50 */
51 public function get_icon() {
52 return 'sps-icon-icon';
53 }
54
55 /**
56 * Get widget categories.
57 *
58 * @since 2.2.5
59 * @access public
60 *
61 * @return array Widget categories.
62 */
63 public function get_categories() {
64 return array( 'deprecated' );
65 }
66
67 /**
68 * Get all post list.
69 *
70 * @since 2.2.5
71 * @return array
72 */
73 public function sp_pcp_post_list() {
74 $post_list = array();
75 $sp_pcp_posts = new \WP_Query(
76 array(
77 'post_type' => 'sp_post_carousel',
78 'post_status' => 'publish',
79 'posts_per_page' => 10000,
80 )
81 );
82 $posts = $sp_pcp_posts->posts;
83 foreach ( $posts as $post ) {
84 $post_list[ $post->ID ] = $post->post_title;
85 }
86 krsort( $post_list );
87 return $post_list;
88 }
89
90 /**
91 * Controls register.
92 *
93 * @return void
94 */
95 protected function register_controls() {
96 $this->start_controls_section(
97 'content_section',
98 array(
99 'label' => __( 'Content', 'post-carousel' ),
100 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
101 )
102 );
103
104 $this->add_control(
105 'sp_smart_post_show_free_shortcode',
106 array(
107 'label' => __( 'Smart Post Show Shortcode(s)', 'post-carousel' ),
108 'type' => \Elementor\Controls_Manager::SELECT2,
109 'label_block' => true,
110 'default' => '',
111 'options' => $this->sp_pcp_post_list(),
112 )
113 );
114
115 $this->add_control(
116 'deprecated_notice',
117 array(
118 'type' => \Elementor\Controls_Manager::DEPRECATED_NOTICE,
119 'widget' => 'Smart Post Show Deprecated',
120 'since' => '2.4.13',
121 'last' => '2.6.0',
122 'plugin' => 'Smart Post Show',
123 'replacement' => 'Smart Post Show',
124 'content_classes' => 'sp-post-carousel-elementor-widget-deprecated',
125 )
126 );
127
128 $this->end_controls_section();
129
130 }
131
132 /**
133 * Render smart post show free shortcode widget output on the frontend.
134 *
135 * @since 2.4.1
136 * @access protected
137 */
138 protected function render() {
139
140 $settings = $this->get_settings_for_display();
141 $sp_pcp_shortcode = $settings['sp_smart_post_show_free_shortcode'];
142
143 if ( '' === $sp_pcp_shortcode ) {
144 echo '<div style="text-align: center; margin-top: 0; padding: 10px" class="elementor-add-section-drag-title">Select a shortcode</div>';
145 return;
146 }
147
148 $generator_id = $sp_pcp_shortcode;
149
150 if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
151 $shortcode_id = esc_attr( $generator_id ); // Smart Post Show global ID for Shortcode metaboxes.
152
153 // Preset Layouts.
154 $layout = get_post_meta( $shortcode_id, 'sp_pcp_layouts', true );
155 // All the visible options for the Shortcode like – Global, Filter, Display, Popup, Typography etc.
156 $view_options = get_post_meta( $shortcode_id, 'sp_pcp_view_options', true );
157 $section_title = get_the_title( $shortcode_id );
158 // Load dynamic style for the backend preview.
159 $dynamic_style = Smart_Post_Show_Public::load_dynamic_style( $shortcode_id, $view_options, $layout );
160 echo '<style id="sps_dynamic_' . esc_attr( $shortcode_id ) . '">' . $dynamic_style['dynamic_css'] . '</style>';
161 SP_PC_Output::pc_html_show( $view_options, $layout, $shortcode_id, $section_title );
162 ?>
163 <script src="<?php echo esc_url( SP_PC_URL . 'public/assets/js/scripts.min.js' ); ?>" ></script>
164 <?php
165 } else {
166 echo do_shortcode( '[smart_post_show id="' . $generator_id . '"]' );
167 }
168
169 }
170
171 }
172