PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 1.2.1
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v1.2.1
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.2.1, at core/class-plugin.php

129 lines 3.4 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 REST::get_instance();
73 $this->elementor = Elementor::get_instance();
74 Loader::add_action('admin_init', $this, 'migrate');
75 self::run();
76 do_action('templately_init');
77 }
78
79 /**
80 * Run all actions and hooks
81 *
82 * @return void
83 */
84 public static function run() {
85 /**
86 * Loader will run actions and filters function for the plugin.
87 */
88 Loader::run();
89 }
90 /**
91 * Migrate Users to Global Signed In if they are already logged in.
92 * @since 1.1.5
93 * @return void
94 */
95 public static function migrate(){
96 if( \version_compare(TEMPLATELY_VERSION, \get_option('_templately_migrate', '1.1.4'), '>') ) {
97 \update_option( '_templately_migrate', TEMPLATELY_VERSION );
98 if( \get_option( '_templately_connected', false ) ) {
99 if( \current_user_can('manage_options') ) {
100 \update_option( '_templately_user_login_choice', ['choice' => true, 'id' => \get_current_user_id() ] );
101 }
102 }
103 }
104 if( \version_compare(TEMPLATELY_VERSION, \get_option('_templately_migrate', '1.2.0'), '=') && ! \get_option('_templately_verification_migrate', false ) ) {
105 if( DB::get_user_specific_login_meta( '_templately_connected', false ) ) {
106 \update_option( '_templately_verification_migrate', true );
107 $user_data = DB::get_user_specific_login_meta('_templately_connect_data');
108 $user_data['is_verified'] = true;
109 DB::update_user_specific_login_meta( '_templately_connect_data', $user_data );
110 }
111 }
112 }
113 /**
114 * Get Plugin Name or You can say Text Domain
115 * @return string
116 */
117 public static function get_name() {
118 return self::$plugin_name;
119 }
120
121 /**
122 * Get Plugin Version
123 * @return String
124 */
125 public static function get_version() {
126 return self::$version;
127 }
128 }
129