forked from fastly/WordPress-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfastly.php
68 lines (57 loc) · 1.69 KB
/
fastly.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
<?php
/*
Plugin Name: Fastly
Plugin URI: http://fastly.com/
Description: Configuration and cache purging for the Fastly CDN.
Author: Fastly.com
Version: 0.97
Author URI: http://fastly.com/
*/
/**
* Main plugin code.
* @package Fastly
* @version 0.97
* @author Ryan Sandor Richards
* @copyright 2011 Fastly.com, All Rights Reserved
*/
// Basic plugin definitions
define('FASTLY_VERSION', '0.97');
define('FASTLY_PLUGIN_URL', plugin_dir_url( __FILE__ ));
// Includes
include_once dirname( __FILE__ ) . '/lib/purge.php';
include_once dirname( __FILE__ ) . '/lib/admin.php';
include_once dirname( __FILE__ ) . '/lib/api.php';
// Check for JSON support
if (!function_exists('json_decode')) {
require_once dirname( __FILE__ ) . '/lib/JSON.php';
define('FASTLY_JSON', false);
}
// Plugin Options
add_option('fastly_hostname', '');
add_option('fastly_api_key', '');
add_option('fastly_service_id', '');
add_option('fastly_api_hostname', 'https://api.fastly.com');
add_option('fastly_api_port', null);
add_option('fastly_page', 'welcome');
add_option('fastly_log_purges', '0');
// Setup Purging
new FastlyPurge();
// Setup admin (if needed)
if (is_admin()) {
new FastlyAdmin();
}
// Custom action links for the plugin.
function fastly_action_links($links, $file) {
static $this_plugin;
if (!$this_plugin) {
$this_plugin = plugin_basename(__FILE__);
}
if ($file == $this_plugin) {
$settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/options-general.php?page=fastly-admin-panel">Settings</a>';
array_unshift($links, $settings_link);
}
return $links;
}
add_filter('plugin_action_links', 'fastly_action_links', 10, 2);
// "Look out honey, cause I'm using technology..." - Iggy Pop
?>