PluginProbe
Document Embedder – let visitors read files without downloading / 2.1.2
Document Embedder – let visitors read files without downloading v2.1.2
2.3.1 2.3.0 2.2.1 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.3 1.7.4 1.7.6 1.7.9 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 2.0.0 2.0.1 2.0.2 All 30 releases
document-emberdder / includes / class-bplde-init.php

class-bplde-init.php in Document Embedder – let visitors read files without downloading 2.1.2, at includes/class-bplde-init.php

100 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * BPLDE Main Initialization Class.
4 *
5 * @package DocumentEmbedder
6 */
7
8 if (!defined('ABSPATH')) {
9 exit;
10 }
11
12 if (!class_exists('BPLDEDocumentEmbedder')) {
13 class BPLDEDocumentEmbedder
14 {
15
16 public function __construct()
17 {
18 add_action('plugins_loaded', [$this, 'load_dependencies'], 5);
19 add_action('admin_notices', [$this, 'upgrade_notice']);
20 add_filter('plugin_action_links_' . plugin_basename(BPLDE__FILE__), [$this, 'add_action_links']);
21 }
22
23 public function load_dependencies()
24 {
25 if (is_admin()) {
26 \BPLDE_Admin_Assets::instance();
27 }
28 new BPLDE_Document_Library();
29 new BPLDE_Document_Embedder();
30 }
31
32 public function upgrade_notice()
33 {
34 $page = get_current_screen();
35 if (!$page) {
36 return;
37 }
38 $is_document_embedder_page = ($page->base == 'edit' && $page->post_type == 'ppt_viewer') || ($page->base != 'post' && $page->post_type == 'document_library');
39 if ($page->base == 'ppt_viewer_page_settings' || $is_document_embedder_page) {
40 ?>
41 <div class="bplde_upgrade_notice <?php echo esc_attr($is_document_embedder_page ? 'ppt_viewer' : 'settings'); ?> ">
42 <div class="flex">
43 <img src="<?php echo esc_url(BPLDE_PLUGIN_DIR . 'assets/img/icn2.png'); ?>" alt="Document Embedder" />
44 <h3>Document Embedder</h3>
45 </div>
46 <p>The Ultimate Document Embedder Plugin for WordPress, Loved by Over 10,000+ Users.</p>
47 <div>
48 <a href="<?php echo esc_url(admin_url('edit.php?post_type=ppt_viewer&page=document-emberdder-pricing')); ?>"
49 class="button button-primary" target="_blank">Upgrade To Pro <svg
50 enable-background="new 0 0 515.283 515.283" height="16" viewBox="0 0 515.283 515.283" width="16"
51 xmlns="http://www.w3.org/2000/svg">
52 <g>
53 <g>
54 <g>
55 <g>
56 <path
57 d="m372.149 515.283h-286.268c-22.941 0-44.507-8.934-60.727-25.155s-25.153-37.788-25.153-60.726v-286.268c0-22.94 8.934-44.506 25.154-60.726s37.786-25.154 60.727-25.154h114.507c15.811 0 28.627 12.816 28.627 28.627s-12.816 28.627-28.627 28.627h-114.508c-7.647 0-14.835 2.978-20.241 8.384s-8.385 12.595-8.385 20.242v286.268c0 7.647 2.978 14.835 8.385 20.243 5.406 5.405 12.594 8.384 20.241 8.384h286.267c7.647 0 14.835-2.978 20.242-8.386 5.406-5.406 8.384-12.595 8.384-20.242v-114.506c0-15.811 12.817-28.626 28.628-28.626s28.628 12.816 28.628 28.626v114.507c0 22.94-8.934 44.505-25.155 60.727-16.221 16.22-37.788 25.154-60.726 25.154zm-171.76-171.762c-7.327 0-14.653-2.794-20.242-8.384-11.179-11.179-11.179-29.306 0-40.485l237.397-237.398h-102.648c-15.811 0-28.626-12.816-28.626-28.627s12.815-28.627 28.626-28.627h171.761c3.959 0 7.73.804 11.16 2.257 3.201 1.354 6.207 3.316 8.837 5.887.001.001.001.001.002.002.019.019.038.037.056.056.005.005.012.011.017.016.014.014.03.029.044.044.01.01.019.019.029.029.011.011.023.023.032.032.02.02.042.041.062.062.02.02.042.042.062.062.011.01.023.023.031.032.011.01.019.019.029.029.016.015.03.029.044.045.005.004.012.011.016.016.019.019.038.038.056.057 0 .001.001.001.002.002 2.57 2.632 4.533 5.638 5.886 8.838 1.453 3.43 2.258 7.2 2.258 11.16v171.761c0 15.811-12.817 28.627-28.628 28.627s-28.626-12.816-28.626-28.627v-102.648l-237.4 237.399c-5.585 5.59-12.911 8.383-20.237 8.383z"
58 fill="rgba(255, 255, 255, 1)" />
59 </g>
60 </g>
61 </g>
62 </g>
63 </svg></a>
64 </div>
65 </div>
66 <?php
67 }
68 }
69
70 public function add_action_links($links)
71 {
72 $help_link = '<a href="' . admin_url('edit.php?post_type=ppt_viewer&page=bplde-dashboard') . '"><span style="color: #f18500; font-weight: 600;">' . __('Help & Demo\'s', 'document-emberdder') . '</span></a>';
73 array_unshift($links, $help_link);
74 return $links;
75 }
76
77 public static function activate()
78 {
79 global $wpdb;
80
81 $table_name = $wpdb->prefix . 'docembedder_leads';
82 $charset_collate = $wpdb->get_charset_collate();
83
84 $sql = "CREATE TABLE $table_name (
85 id int(11) NOT NULL AUTO_INCREMENT,
86 name varchar(100) NOT NULL,
87 email varchar(150) NOT NULL,
88 document_id int(11) NOT NULL,
89 document_title varchar(255) NOT NULL,
90 downloaded_at datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
91 ip_address varchar(45) NOT NULL,
92 PRIMARY KEY (id)
93 ) $charset_collate;";
94
95 require_once ABSPATH . 'wp-admin/includes/upgrade.php';
96 dbDelta($sql);
97 }
98 }
99 }
100