Add a version constant and clean up a few things - #45

This commit is contained in:
Jay Wood
2016-09-30 11:39:55 -04:00
parent 1de0a8fa0f
commit f8b913c688

View File

@ -10,25 +10,7 @@ Text Domain: content-warning-v2
Domain Path: /lang Domain Path: /lang
*/ */
//require_once dirname( __FILE__ ) . '/inc/api.php'; require_once 'includes/api.php';
//
//if ( is_admin() ) {
// require_once dirname( __FILE__ ) . '/inc/options.inc.php';
// if ( ! class_exists( 'JW_SIMPLE_OPTIONS' ) ) {
// require_once dirname( __FILE__ ) . '/lib/jw_simple_options/simple_options.php';
// }
// require_once dirname( __FILE__ ) . '/class/admin.class.php';
//
// $cwv3_options = new JW_SIMPLE_OPTIONS( $cwv3_op_data );
//// register_uninstall_hook( __FILE__, array( $cwv3_options, 'uninstall' ) );
//} else {
// require_once dirname( __FILE__ ) . '/class/main.class.php';
//}
//
//add_action( 'plugins_loaded', 'jw_cwv3_load_text_domain' );
//function jw_cwv3_load_text_domain() {
// load_plugin_textdomain( 'content-warning-v2', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
//}
function cwv2_autoload_classes( $class_name ) { function cwv2_autoload_classes( $class_name ) {
if ( 0 != strpos( $class_name, 'CWV2_' ) ) { if ( 0 != strpos( $class_name, 'CWV2_' ) ) {
@ -48,6 +30,13 @@ function cwv2_autoload_classes( $class_name ) {
spl_autoload_register( 'cwv2_autoload_classes' ); spl_autoload_register( 'cwv2_autoload_classes' );
/**
* Class ContentWarning_v2
*
* @property string $version The current plugin version
*
* @author JayWood
*/
class ContentWarning_v2 { class ContentWarning_v2 {
/** /**
@ -56,6 +45,8 @@ class ContentWarning_v2 {
*/ */
public static $instance = null; public static $instance = null;
const VERSION = '3.7';
/** /**
* @var CWV2_Admin * @var CWV2_Admin
*/ */
@ -85,7 +76,9 @@ class ContentWarning_v2 {
add_action( 'wp_footer', array( $this, 'render_dialog' ) ); add_action( 'wp_footer', array( $this, 'render_dialog' ) );
add_action( 'wp_head', array( $this, 'override_css' ) ); add_action( 'wp_head', array( $this, 'override_css' ) );
if ( ! is_admin() ) {
}
$this->plugin_classes(); $this->plugin_classes();
} }
@ -273,8 +266,10 @@ class ContentWarning_v2 {
* @see cwv3_the_css() * @see cwv3_the_css()
*/ */
public function override_css() { public function override_css() {
if ( ! is_admin() ) {
cwv3_the_css(); cwv3_the_css();
} }
}
/** /**
* Register Frontend Data * Register Frontend Data
@ -366,6 +361,14 @@ class ContentWarning_v2 {
return false; return false;
} }
public function __get( $field ) {
if ( $field == 'version' ) {
return self::VERSION;
}
return $this->$field;
}
} }
function content_warning_v2() { function content_warning_v2() {