-
Notifications
You must be signed in to change notification settings - Fork 0
/
cc-client.php
80 lines (67 loc) · 2.56 KB
/
cc-client.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: CC Client
* Description: Commons Connect Client Plugin.
* Requires at least: 6.1
* Requires PHP: 7.0
* Version: 0.1.0
* Author: The WordPress Contributors
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: cc-client
*
* @package MeshResearch\CCClient
*/
namespace MeshResearch\CCClient;
if ( ! defined( 'CC_CLIENT_DOING_TESTING') ) {
define( 'CC_CLIENT_DOING_TESTING', false );
}
define( 'CC_CLIENT_BASE_DIR', plugin_dir_path( __FILE__ ) );
define( 'CC_CLIENT_BASE_URL', plugin_dir_url( __FILE__ ) );
define('CC_CLIENT_REST_NAMESPACE', 'cc-client/v1');
/**
* Feature Flags
*/
define( 'CCC_FEATURE_PROFILE_BLOCK', false );
/**
* Enqueue block editor frontend assets.
*/
function enqueue_client_block_assets() {
$asset_file = include CC_CLIENT_BASE_DIR . 'build/profile/front.asset.php';
wp_enqueue_style(
'cc-client-profile',
CC_CLIENT_BASE_URL . 'build/profile/style-index.css',
[],
$asset_file['version']
);
$asset_file = include CC_CLIENT_BASE_DIR . 'build/search/view.asset.php';
wp_enqueue_style(
'cc-client-search',
CC_CLIENT_BASE_URL . 'build/search/style-view.css',
[],
$asset_file['version']
);
if ( is_admin() ) {
// Enqueue editor only assets here
}
}
add_action( 'enqueue_block_assets', __NAMESPACE__ . '\enqueue_client_block_assets' );
/**
* Composer autoload.
*
* When cc-client is installed as a conmposer dependency, the vendor directory
* will be in the root of the project and the autoload.php will already be
* included at the project level, so the vendor directory will not exist.
*/
if ( file_exists( CC_CLIENT_BASE_DIR . 'vendor/autoload.php' ) ) {
require_once( CC_CLIENT_BASE_DIR . 'vendor/autoload.php' );
}
require_once( CC_CLIENT_BASE_DIR . 'src/admin/admin-settings.php' );
require_once( CC_CLIENT_BASE_DIR . 'src/Rest/rest.php' );
require_once( CC_CLIENT_BASE_DIR . 'src/blocks/blocks.php' );
require_once( CC_CLIENT_BASE_DIR . 'src/functions.php' );
require_once( CC_CLIENT_BASE_DIR . 'src/Search/Provisioning/bulk_provisioning.php' );
require_once( CC_CLIENT_BASE_DIR . 'src/Search/Provisioning/incremental_provisioner_functions.php' );
require_once( CC_CLIENT_BASE_DIR . 'src/Search/Provisioning/provisionable_functions.php' );
require_once( CC_CLIENT_BASE_DIR . 'src/Search/Provisioning/provisioning_helper_functions.php' );
require_once( CC_CLIENT_BASE_DIR . 'src/Search/search_functions.php' );