-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
71 lines (56 loc) · 2.05 KB
/
index.php
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
<?php
/*
Plugin Name: Jobvite for Wordpress
Plugin URI: https://github.com/harryfinn/jobvite-for-wordpress
Description: A WP plugin to pull in a JSON feed of job listings from Jobvite
Version: 1.0.0
Author: harryfinn
Author URI: https://github.com/harryfinn
License: GPL2
Jobvite for Wordpress 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.
Jobvite for Wordpress 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 Jobvite for Wordpress. If not, see https://www.gnu.org/licenses/gpl.html.
*/
class JobviteSetup {
public $name,
$prefix,
$title,
$slug;
public function __construct() {
$this->name = 'jobvite_for_wp';
$this->prefix = 'jfw_';
$this->title = ucwords(str_replace('_', ' ', $this->name));
$this->slug = str_replace('_', '-', $this->name);
spl_autoload_register([$this, $this->prefix . 'autoload_classes']);
if(function_exists('__autoload')) {
spl_autoload_register('__autoload');
}
}
public function jfw_autoload_classes($name) {
$admin_path = plugin_dir_path(__FILE__) . 'admin/class.' . strtolower($name) . '.php';
if(file_exists($admin_path))
require_once $admin_path;
$frontend_path = plugin_dir_path(__FILE__) . 'frontend/class.' . strtolower($name) . '.php';
if(file_exists($frontend_path))
require_once $frontend_path;
}
public function init() {
register_activation_hook(
__FILE__,
[$this, $this->prefix . 'activate_plugin']
);
new JobviteAdmin();
}
public function jfw_activate_plugin() {
update_option($this->prefix . 'version', '0.1.0');
}
}
$jobvite_plugin = new JobviteSetup();
$jobvite_plugin->init();