woocommerce/woocommerce-rest-api.php

38 lines
1018 B
PHP
Raw Normal View History

<?php
/**
* Plugin Name: WooCommerce REST API
* Plugin URI: https://github.com/woocommerce/woocommerce-rest-api
* Description: The WooCommerce core REST API, installed as a feature plugin for development and testing purposes. Requires WooCommerce 3.7+ and PHP 5.3+.
* Author: Automattic
* Author URI: https://woocommerce.com
2019-05-10 22:33:12 +00:00
* Version: 1.0.0-dev
2019-05-10 22:33:31 +00:00
* Requires PHP: 5.6
* License: GPLv3
*
* @package WooCommerce/RestApi
*/
defined( 'ABSPATH' ) || exit;
2019-05-10 22:33:31 +00:00
if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
return;
}
/**
2019-05-22 15:35:10 +00:00
* Get API feature plugin version and callback function.
*/
2019-05-22 15:35:10 +00:00
$version = include __DIR__ . '/version.php';
$init_callback = include __DIR__ . '/init.php';
/**
* This callback registers this version of the API with WooCommerce.
*/
$register_callback = function() use ( $version, $init_callback ) {
if ( ! is_callable( array( wc()->api, 'register' ) ) ) {
return;
}
wc()->api->register( $version, $init_callback );
};
add_action( 'woocommerce_loaded', $register_callback );