forked from NetX/netx-wordpress-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netx-media-manager.php
executable file
·84 lines (73 loc) · 2.05 KB
/
netx-media-manager.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
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* @package NetxWPPlugin
*/
/*
Plugin Name: NetX Media Manager
Plugin URI: http://netx.net
Description: Sync the Wordpress media library with NetX
Version: 2.1.1
Author: NetX, PNDLM
Author URI: http://netx.net
License:
*/
define('WPNETX_VERSION', '2.1.1');
define('WPNETX_PLUGIN_URL', plugin_dir_url(__FILE__));
define('NETX_PLUGIN_URL', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)));
// Make sure we don't expose any info if called directly
if (!function_exists('add_action')) {
echo "nothing to see here";
exit;
}
/**
* NetX REST API Library wrapper class
*/
require_once(dirname(__FILE__) . '/includes/netxRestWrapper.php');
/**
* Admin class
*/
if (is_admin()) {
require_once(dirname(__FILE__) . '/admin.php');
require_once(dirname(__FILE__) . '/netx-media.php');
} else {
require_once(dirname(__FILE__) . '/netx-client.php');
}
/**
* Wordpress plugin functionality
*
* @package NetxWPPlugin
*/
class netxMediaManagerPlugin {
/**
* Unregister plugin settings
*/
static function unregisterSettings() {
unregister_setting('netx_options', 'netx_username');
unregister_setting('netx_options', 'netx_password');
unregister_setting('netx_options', 'netx_uri');
unregister_setting('netx_options', 'netx_base_category_id');
unregister_setting('netx_options', 'netx_base_category_path');
unregister_setting('netx_options', 'netx_access_token');
}
/**
* Runs when plugin is deactivated. Removes the media manager table
* and the schema version option.
*/
static function deactivate() {
error_log("Calling deactivate()");
self::unregisterSettings();
delete_option('netx_options');
}
/**
* Runs when the plugin is activated.
*/
static function activate() {
$cacheDir = dirname(__FILE__) . '/netx_cache';
$options['netx_cache_path'] = $cacheDir;
add_option('netx_options', $options);
}
}
// Plugin activation / deactivation
register_activation_hook(__FILE__, array('netxMediaManagerPlugin', 'activate'));
register_deactivation_hook(__FILE__, array('netxMediaManagerPlugin', 'deactivate'));
?>