PluginProbe
WDesignKit – AI Templates, Widget Builder & MCP Workflow / 2.6.6
WDesignKit – AI Templates, Widget Builder & MCP Workflow v2.6.6
2.6.6 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.0 2.3.3 2.3.2 2.3.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 All 128 releases
wdesignkit / includes / widget-load / elementor / wb-controller.php

wb-controller.php in WDesignKit – AI Templates, Widget Builder & MCP Workflow 2.6.6, at includes/widget-load/elementor/wb-controller.php

107 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Exit if accessed directly.
4 *
5 * @link https://posimyth.com/
6 * @since 1.0.0
7 *
8 * @package Wdesignkit
9 * @subpackage Wdesignkit/elementor/
10 * */
11
12 namespace wdkit\wdkit_wbcontroller;
13
14 /**Exit if accessed directly.*/
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit;
17 }
18
19 if ( ! class_exists( 'Wdkit_Wb_Elementor_Controller' ) ) {
20
21 /**
22 * This class used for only load elementor custom controler
23 *
24 * @since 1.0.0
25 */
26 class Wdkit_Wb_Elementor_Controller {
27
28 /**
29 *
30 * Ensures only one instance of the class is loaded or can be loaded.
31 *
32 * @var instance
33 * @since 1.0.0
34 */
35 private static $instance = null;
36
37 /**
38 * Instance
39 *
40 * Ensures only one instance of the class is loaded or can be loaded.
41 *
42 * @since 1.0.0
43 * @static
44 * @return \Wdkit_Wb_Elementor_Controller\Plugin An instance of the class.
45 */
46 public static function instance() {
47 if ( is_null( self::$instance ) ) {
48 self::$instance = new self();
49 }
50 return self::$instance;
51 }
52
53 /**
54 * Constructor
55 *
56 * Perform some compatibility checks to make sure basic requirements are meet.
57 * If all compatibility checks pass, initialize the functionality.
58 *
59 * @since 1.0.0
60 */
61 public function __construct() {
62 }
63
64 /**
65 *
66 * Add Elementor library and get template in widget controller
67 *
68 * @since 1.0.0
69 */
70 public static function wdkit_elementor() {
71 return \Elementor\Plugin::$instance;
72 }
73
74 /**
75 * Wdkit_get_templates function
76 *
77 * This function retrieves a list of templates from the Elementor controller.
78 *
79 * @since 1.0.0
80 * @return array An array of template options
81 */
82 public static function wdkit_get_templates() {
83
84 $templates = self::wdkit_elementor()->templates_manager->get_source( 'local' )->get_items();
85 $types = array();
86 if ( empty( $templates ) ) {
87 $options = array(
88 '0' => esc_html__( "You Haven't Saved Templates Yet.", 'wdesignkit' ),
89 );
90 } else {
91 $options = array(
92 '0' => esc_html__( 'Select Template', 'wdesignkit' ),
93 );
94
95 foreach ( $templates as $template ) {
96 $options[ $template['template_id'] ] = $template['title'] . ' (' . $template['type'] . ')';
97 $types[ $template['template_id'] ] = $template['type'];
98 }
99 }
100
101 return $options;
102 }
103 }
104
105 Wdkit_Wb_Elementor_Controller::instance();
106 }
107