Admin_Apple_Meta_Boxes::__construct PHP Method

__construct() public method

Constructor.
public __construct ( $settings = null )
    function __construct($settings = null)
    {
        $this->settings = $settings;
        // Register hooks if enabled
        if ('yes' == $settings->get('show_metabox')) {
            // Handle a publish action and saving fields
            add_action('save_post', array($this, 'do_publish'), 10, 2);
            // Add the custom meta boxes to each post type
            $post_types = $settings->get('post_types');
            if (!is_array($post_types)) {
                $post_types = array($post_types);
            }
            foreach ($post_types as $post_type) {
                add_action('add_meta_boxes_' . $post_type, array($this, 'add_meta_boxes'));
            }
            // Register assets used by the meta box
            add_action('admin_enqueue_scripts', array($this, 'register_assets'));
        }
    }