/** * Initialize the class and set its properties. * * @since 1.0.0 * @var string $plugin_slug The name of this plugin. * @var string $version The version of this plugin. */ public function __construct($plugin) { $this->plugin = $plugin; $this->plugin_slug = $this->plugin->get('slug'); $this->plugin_name = $this->plugin->get('name'); $this->version = $this->plugin->get('version'); $this->options = $this->plugin->get('options'); // Setup metaboxes. add_action('cmb2_admin_init', array($this, 'register_role_metabox')); add_action('cmb2_admin_init', array($this, 'register_project_metabox')); add_action('cmb2_admin_init', array($this, 'register_action_item_metabox')); // Setup custom field types. add_action('cmb2_render_status_select', array($this, 'render_status_select'), 10, 4); }
/** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * @since 1.0.0 */ function run_mkp_holacracy() { // Pass main plugin file through to plugin class for later use. $args = array('plugin_file' => __FILE__); $plugin = MKP_Holacracy::get_instance($args); $plugin->run(); }
/** * Register the scripts for the public-facing side of the site. * * @since 1.0.0 */ public function enqueue_scripts() { $min_suffix = $this->plugin->get_min_suffix(); wp_enqueue_script("{$this->plugin_slug}-public", plugin_dir_url(__FILE__) . "js/mkp-holacracy-public{$min_suffix}.js", array('jquery'), $this->version, false); }
/** * Creates or returns an instance of this class. * * @return MKP_Holacracy A single instance of this class. */ public static function get_instance($args = array()) { if (null == self::$instance) { self::$instance = new self($args); } return self::$instance; }