PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 1.1.6
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v1.1.6
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
templately / core / class-plugin.php

class-plugin.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! 1.1.6, at core/class-plugin.php

120 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 * Templately plugin.
4 *
5 * The main plugin handler class is responsible for initializing Templately. The
6 * class registers and all the components required to run the plugin.
7 *
8 * @package Templately
9 */
10
11 namespace Templately;
12
13 defined('ABSPATH') or exit;
14
15 use Templately\Admin\Admin;
16
17 final class Plugin {
18 /**
19 * Plugin Version
20 * @var string
21 */
22 protected static $version;
23 /**
24 * Plugin Name
25 * @var string
26 */
27 protected static $plugin_name;
28 /**
29 * Plugin Instance
30 * @var \Templately\Plugin
31 */
32 private static $_instance = null;
33 /**
34 * Elementor Instance
35 *
36 * @var \Templately\Elementor
37 */
38 public $elementor = null;
39 /**
40 * Admin Instance
41 *
42 * @var \Templately\Admin\Admin
43 */
44 public $admin = null;
45
46 /**
47 * Get a single instance of Plugin
48 * @return Plugin
49 */
50 public static function get_instance() {
51 if (is_null(self::$_instance)) {
52 self::$_instance = new self();
53 }
54 return self::$_instance;
55 }
56
57 /**
58 * Plugin constructor.
59 * Initializing Templately plugin.
60 *
61 * @access private
62 */
63 private function __construct() {
64 if (defined('TEMPLATELY_VERSION')) {
65 self::$version = TEMPLATELY_VERSION;
66 } else {
67 self::$version = '0.0.1';
68 }
69 Installer::init();
70 self::$plugin_name = 'templately';
71 $this->admin = Admin::get_instance();
72 $this->elementor = Elementor::get_instance();
73 Loader::add_action('admin_init', $this, 'migrate');
74 self::run();
75 do_action('templately_init');
76 }
77
78 /**
79 * Run all actions and hooks
80 *
81 * @return void
82 */
83 public static function run() {
84 /**
85 * Loader will run actions and filters function for the plugin.
86 */
87 Loader::run();
88 }
89 /**
90 * Migrate Users to Global Signed In if they are already logged in.
91 * @since 1.1.5
92 * @return void
93 */
94 public static function migrate(){
95 if( \version_compare(TEMPLATELY_VERSION, \get_option('_templately_migrate', '1.1.4'), '>') ) {
96 \update_option( '_templately_migrate', TEMPLATELY_VERSION );
97 if( \get_option( '_templately_connected', false ) ) {
98 if( \current_user_can('manage_options') ) {
99 \update_option( '_templately_user_login_choice', ['choice' => true, 'id' => \get_current_user_id() ] );
100 }
101 }
102 }
103 }
104 /**
105 * Get Plugin Name or You can say Text Domain
106 * @return string
107 */
108 public static function get_name() {
109 return self::$plugin_name;
110 }
111
112 /**
113 * Get Plugin Version
114 * @return String
115 */
116 public static function get_version() {
117 return self::$version;
118 }
119 }
120