forked from ePages-de/ePages-wordpress-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
80 lines (59 loc) · 2.64 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
72
73
74
75
76
77
78
79
80
<?php
/*
Plugin Name: ePages Online Shop
Plugin URI: http://www.epages.com/us/
Description: ePages Online Shop integration for WordPress.
Version: 1.1
Author: ePages GmbH
Author URI: http://www.epages.com/
Text Domain: epages
Domain Path: /languages
*/
defined("ABSPATH") or die(__("Plugin file cannot be accessed directly."));
if (!defined('EPAGES_PLUGIN_NAME'))
define('EPAGES_PLUGIN_NAME', trim(dirname(plugin_basename(__FILE__)), '/'));
if (!defined('EPAGES_PLUGIN_DIR'))
define('EPAGES_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . EPAGES_PLUGIN_NAME);
if (!defined('EPAGES_PLUGIN_URL'))
define('EPAGES_PLUGIN_URL', WP_PLUGIN_URL . '/' . EPAGES_PLUGIN_NAME);
static $siteUrl = "https://site-production.herokuapp.com/site.js";
// TODO: add auth to headers if access to non-public api calls
// "Authorization" => "Bearer M0mPgTiGPtw5LkdCGwhel3gcGc5PqIPF",
static $epages_api_http_options = array(
"headers" => array(
"Accept" => "application/vnd.epages.v1+json"
),
);
// Load functions
require_once EPAGES_PLUGIN_DIR . "/functions/log.php";
require_once EPAGES_PLUGIN_DIR . "/functions/load_template.php";
require_once EPAGES_PLUGIN_DIR . "/functions/options_page.php";
require_once EPAGES_PLUGIN_DIR . "/functions/register_shortcode.php";
// Load actions
require_once EPAGES_PLUGIN_DIR . "/actions/init.php";
require_once EPAGES_PLUGIN_DIR . "/actions/add_options_page.php";
require_once EPAGES_PLUGIN_DIR . "/actions/show_admin_message.php";
require_once EPAGES_PLUGIN_DIR . "/actions/add_editor_button.php";
require_once EPAGES_PLUGIN_DIR . "/actions/add_admin_scripts.php";
require_once EPAGES_PLUGIN_DIR . "/actions/add_front_scripts.php";
require_once EPAGES_PLUGIN_DIR . "/actions/add_popup.php";
// Load filters
require_once EPAGES_PLUGIN_DIR . "/filters/add_mce_plugin.php";
require_once EPAGES_PLUGIN_DIR . "/filters/build_script_tag.php";
add_action( 'plugins_loaded', 'epages_load_textdomain' );
function epages_load_textdomain() {
load_plugin_textdomain( 'epages', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
if (is_admin()) {
add_action("admin_init", "epages_init");
add_action("admin_notices", "epages_show_admin_message");
add_action("admin_menu", "epages_add_options_page");
add_action("media_buttons", "epages_add_editor_button" );
# TODO: only register these on the editor page.
add_filter("mce_external_plugins", "epages_add_mce_plugin");
add_action("admin_enqueue_scripts", "epages_add_admin_scripts");
add_action("in_admin_header", "epages_add_popup");
} else {
add_filter("script_loader_tag", "epages_build_script_tag", 10, 2);
add_action("wp_enqueue_scripts", "epages_add_front_scripts" );
}