forked from 10up/ElasticPress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelasticpress.php
92 lines (79 loc) · 2.89 KB
/
elasticpress.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
85
86
87
88
89
90
91
92
<?php
/**
* Plugin Name: ElasticPress
* Description: A fast and flexible search and query engine for WordPress.
* Version: 2.1.1
* Author: Taylor Lovett, Matt Gross, Aaron Holbrook, 10up
* Author URI: http://10up.com
* License: GPLv2 or later
* Text Domain: elasticpress
* Domain Path: /lang/
* This program derives work from Alley Interactive's SearchPress
* and Automattic's VIP search plugin:
*
* Copyright (C) 2012-2013 Automattic
* Copyright (C) 2013 SearchPress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
define( 'EP_URL', plugin_dir_url( __FILE__ ) );
define( 'EP_PATH', plugin_dir_path( __FILE__ ) );
define( 'EP_VERSION', '2.1.1' );
define( 'EP_MODULES_DIR', dirname( __FILE__ ) . '/modules' );
require_once( 'classes/class-ep-config.php' );
require_once( 'classes/class-ep-api.php' );
// Define a constant if we're network activated to allow plugin to respond accordingly.
$network_activated = ep_is_network_activated( plugin_basename( __FILE__ ) );
if ( $network_activated ) {
define( 'EP_IS_NETWORK', true );
}
require_once( 'classes/class-ep-sync-manager.php' );
require_once( 'classes/class-ep-wp-query-integration.php' );
require_once( 'classes/class-ep-wp-date-query.php' );
require_once( 'classes/class-ep-module.php' );
require_once( 'classes/class-ep-modules.php' );
require_once( 'classes/class-ep-dashboard.php' );
// Include core modules
require_once( 'modules/search/search.php' );
require_once( 'modules/related-posts/related-posts.php' );
require_once( 'modules/admin/admin.php' );
require_once( 'modules/woocommerce/woocommerce.php' );
/**
* WP CLI Commands
*/
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once( 'bin/wp-cli.php' );
}
/**
* If we activate the plugin with no modules option, activate search by default. This
* should only happy when first upgrading to 2.1. We also want to clear any syncs that were
* in progress when the plugin was deactivated.
*
* @since 2.1
*/
function ep_on_activate() {
$active_modules = get_option( 'ep_active_modules', false );
if ( false === $active_modules ) {
$active_modules = array( 'search' );
}
if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
update_site_option( 'ep_active_modules', $active_modules );
delete_site_option( 'ep_index_meta' );
} else {
update_option( 'ep_active_modules', $active_modules );
delete_option( 'ep_index_meta' );
}
}
register_activation_hook( __FILE__, 'ep_on_activate' );
/**
* Load text domain and handle debugging
*/
function ep_loader() {
load_plugin_textdomain( 'elasticpress', false, basename( dirname( __FILE__ ) ) . '/lang' ); // Load any available translations first.
if ( is_user_logged_in() && ! defined( 'WP_EP_DEBUG' ) ) {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
define( 'WP_EP_DEBUG', is_plugin_active( 'debug-bar-elasticpress/debug-bar-elasticpress.php' ) );
}
}
add_action( 'plugins_loaded', 'ep_loader' );