PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 1.3.0
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v1.3.0
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
← All changes | core/admin/class-admin.php +83 -0 1-final1.3.0 View file →
@@ -1,0 +1,83 @@
1 +<?php
2 +
3 +namespace Templately\Admin;
4 +
5 +use Templately\Base;
6 +use Templately\Loader;
7 +use Templately\Helper;
8 +use Templately\Query;
9 +use Templately\DB;
10 +
11 +class Admin extends Base {
12 + public function __construct() {
13 + Loader::add_action( 'admin_init', $this, 'maybe_redirect_templately' );
14 + Loader::add_action( 'plugins_loaded', $this, 'load_plugin_textdomain' );
15 + Loader::add_action( 'admin_menu', Settings::class, 'init' );
16 + Loader::add_action( 'admin_footer', $this, 'footer' );
17 + // Loader::add_action('templately_admin_header', $this, 'header');
18 + }
19 + public function footer( $hook ){
20 + echo '<div id="templately-gutenberg"></div>';
21 + }
22 + /**
23 + * Load Text Domain
24 + */
25 + public function load_plugin_textdomain(){
26 + load_plugin_textdomain( 'templately', false, dirname( plugin_basename( TEMPLATELY_FILE ) ) . '/languages' );
27 + }
28 + /**
29 + * Redirect on Active
30 + */
31 + public function maybe_redirect_templately(){
32 + if ( ! get_transient( 'templately_activation_redirect' ) ) {
33 + return;
34 + }
35 + if ( wp_doing_ajax() ) {
36 + return;
37 + }
38 +
39 + delete_transient( 'templately_activation_redirect' );
40 + if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
41 + return;
42 + }
43 + // Safe Redirect to Templately Page
44 + wp_safe_redirect( admin_url( 'admin.php?page=templately' ) );
45 + exit;
46 + }
47 +
48 + /**
49 + * If Elementor doesn't exists.
50 + *
51 + * @return boolean
52 + */
53 + public static function has_no_elementor() {
54 + $plugin_url = \wp_nonce_url(\self_admin_url('update.php?action=install-plugin&amp;plugin=elementor'), 'install-plugin_elementor');
55 + $button_text = 'Install Elementor';
56 + if (isset(Helper::get_plugins()['elementor/elementor.php'])) {
57 + $plugin_url = \wp_nonce_url('plugins.php?action=activate&amp;plugin=elementor/elementor.php', 'activate-plugin_elementor/elementor.php');
58 + $button_text = 'Activate Elementor';
59 + }
60 + $output = '<div class="notice notice-error">';
61 + $output .= sprintf(
62 + "<p><strong>%s</strong> %s <strong>%s</strong> %s &nbsp;&nbsp;<a class='button-primary' href='%s'>%s</a></p>",
63 + __('Templately', 'templately'),
64 + __('requires', 'templately'),
65 + __('Elementor', 'templately'),
66 + __('plugin to be installed and activated. Please install Elementor to continue.', 'templately'),
67 + esc_url( $plugin_url ),
68 + __($button_text, 'templately')
69 + );
70 + $output .= '</div>';
71 + echo $output;
72 + }
73 +
74 + public function header(){
75 + Helper::views('core/admin/views/header');
76 + }
77 + /**
78 + * Enqueue Admin Styles
79 + */
80 + // public function enqueue( $hook ){
81 +
82 + // }
83 +}