-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcivicrm-wp-rest.php
39 lines (31 loc) · 1.09 KB
/
civicrm-wp-rest.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
<?php
/**
* Plugin Name: CiviCRM WP REST API
* Description: WordPress REST endpoints for CiviCRM's 'extern' endpoints.
* Version: 0.1
* Author: Andrei Mondoc
* Author URI: https://github.com/mecachisenros
* Plugin URI: https://github.com/mecachisenros/civicrm-wp-rest
* GitHub Plugin URI: mecachisenros/civicrm-wp-rest
*/
if ( ! defined( 'WPINC' ) ) die( 'Silence...' );
// version
define( 'CIVICRM_WP_REST_VERSION', '0.1' );
// plugin basename
define( 'CIVICRM_WP_REST_BASENAME', plugin_basename( __FILE__ ) );
// plugin path
define( 'CIVICRM_WP_REST_PATH', plugin_dir_path( __FILE__ ) );
// source path
define( 'CIVICRM_WP_REST_SRC', trailingslashit( CIVICRM_WP_REST_PATH . 'src' ) );
// plugin url
define( 'CIVICRM_WP_REST_URL', plugin_dir_url( __FILE__ ) );
// init
add_action( 'init', function() {
if ( ! function_exists( 'civi_wp' ) ) return;
if ( class_exists( 'CiviCRM_WP_REST\Autoloader' ) ) return;
// autoloader
require_once( CIVICRM_WP_REST_SRC . 'Autoloader.php' );
CiviCRM_WP_REST\Autoloader::add_source( $source_path = CIVICRM_WP_REST_SRC );
// init
new CiviCRM_WP_REST\Plugin;
} );