-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin-InteractiveFAQ.php
More file actions
94 lines (73 loc) · 2.51 KB
/
plugin-InteractiveFAQ.php
File metadata and controls
94 lines (73 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* Plugin Name: Interactive FAQ
* Description: This interactive FAQ enable editors to manage the FAQ se ction of their website more easily
* Version: 1.0
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Nathan Wu and Jennice Xu
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* Text Domain: plugin-InteractiveFAQ
Interactive FAQ is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
Interactive FAQ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Interactive FAQ. If not, see https://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
*/
// Step 1. Setting up security protection.
//if (! defined('ABSPATH') ){
// die;
//}
defined('ABSPATH') or die("Access permission denied.");
if (! function_exists("add_action")){
echo "Access permission denied";
exit;
}
class TestingClass {
function register(){
add_action('admin_enqueue_scripts', array($this, 'enqueue'));
}
function activate() {
$this->custom_post_type();;
flush_rewrite_rules();
// generate TCP
// flush rewrite rules
}
function deactivate() {
flush_rewrite_rules();
// flush rewrite rules
}
function uninstall() {
// delete CPT
//delete all the plugin data from the DB
}
protected function create_post_type(){
add_action('init', array($this, 'custom_post_type'));
}
function custom_post_type (){
register_post_type('FAQ', ['public' => true, 'label' => 'FAQ']);
}
function enqueue() {
wp_enqueue_style('myplugintyle', plugins_url('assets/mystyle.css', __FILE__ ) );
wp_enqueue_script('myplugintyle', plugins_url('assets/myscript.js', __FILE__ ) );
}
}
if (class_exists('TestingClass')){
// $TestingClass1 = new TestingClass();
// $TestingClass1 -> register();
}
// customFunction("This is my arg");
// Wordpress triggers plugin at these time:
// activation
register_activation_hook(__FILE__ , array($TestingClass1, 'activate'));
// deactivation
register_deactivation_hook(__FILE__ , array($TestingClass1, 'deactivate'));
// unistalled
register_uninstall_hook(__FILE__ , array($TestingClass1, 'uninstall'));
// Preventing clients interact directly with the plugin