2018-04-17 21:03:14 +00:00
< ? php
/**
2018-04-17 23:51:48 +00:00
* Plugin Name : Woo Dashboard
* Plugin URI : https :// woocommerce . com /
* Description : A feature plugin for a new Dashboard view of WooCommerce
* Author : Automattic
* Author URI : https :// woocommerce . com /
* Text Domain : woo - dash
* Domain Path : / languages
* Version : 0.1 . 0
2018-04-17 21:03:14 +00:00
*
* @ package Woo_Dash
*/
2018-04-17 23:51:48 +00:00
if ( ! defined ( 'WOO_DASH_APP' ) ) {
define ( 'WOO_DASH_APP' , 'woo-dash-app' );
}
2018-05-03 17:55:53 +00:00
/**
* Notify users of the plugin requirements
*/
function woo_dash_plugins_notice () {
$message = sprintf (
__ ( 'The WooCommerce Dashboard feature plugin requires both <a href="%1$s">Gutenberg</a> and <a href="%2$s">WooCommerce</a> to be installed and active.' , 'woo-dash' ),
'https://wordpress.org/plugins/gutenberg/' ,
'https://wordpress.org/plugins/woocommerce/'
);
printf ( '<div class="error"><p>%s</p></div>' , $message ); /* WPCS: xss ok. */
}
2018-04-17 23:51:48 +00:00
2018-05-03 17:55:53 +00:00
/**
* Set up the plugin , only if we can detect both Gutenberg and WooCommerce
*/
function woo_dash_plugins_loaded () {
2018-05-04 14:46:16 +00:00
if (
2018-05-04 18:54:50 +00:00
! ( defined ( 'GUTENBERG_DEVELOPMENT_MODE' ) || defined ( 'GUTENBERG_VERSION' ) ) ||
2018-05-04 14:46:16 +00:00
! class_exists ( 'WooCommerce' )
) {
2018-05-03 17:55:53 +00:00
add_action ( 'admin_notices' , 'woo_dash_plugins_notice' );
return ;
}
// Some common utilities
require_once dirname ( __FILE__ ) . '/lib/common.php' ;
2018-04-17 23:51:48 +00:00
2018-05-03 17:55:53 +00:00
// Register script files
require_once dirname ( __FILE__ ) . '/lib/client-assets.php' ;
2018-04-17 23:51:48 +00:00
2018-05-03 17:55:53 +00:00
// Create the Admin pages
require_once dirname ( __FILE__ ) . '/lib/admin.php' ;
}
add_action ( 'plugins_loaded' , 'woo_dash_plugins_loaded' );