<?php

// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}
Kanban_Post_Types::init();
class Kanban_Post_Types
{
    static $post_types = array('task' => array('taxonomies' => array('status' => array('backlog' => 'Backlog', 'ready' => 'Ready', 'in-progress' => 'In progress', 'qa' => 'QA', 'done' => 'Done', 'archive' => 'Archive'), 'estimate' => array('2' => '2h', '4' => '4h', '8' => '1d', '16' => '2d', '32' => '4d')), 'postmeta_fields' => array('project_id' => 0, 'user_id_assigned' => 0, 'work_hour_count' => 0)), 'project' => array('taxonomies' => array(), 'postmeta_fields' => array('color' => 'lightblue')), 'work_hour' => array('taxonomies' => array(), 'postmeta_fields' => array('task_id' => 0, 'task_status_id' => 0, 'project_id' => 0, 'user_id_logged' => 0, 'operator' => '+1')));
    // post_types
    static function init()
    {
        self::$post_types = apply_filters(sprintf('%s_Post_Types_init', Kanban::$instance->settings->basename), self::$post_types);
        add_action('init', array(__CLASS__, 'custom_post_types'), 0);
        // build list of post types, fields and taxonomies
        foreach (Kanban_Post_Types::$post_types as $post_type_slug => $post_type_data) {
            $post_type_key = Kanban_Post_Types::format_post_type($post_type_slug);
            if (!isset(Kanban::$instance->post_type_keys)) {
                Kanban::$instance->post_type_keys = array();
            }
            Kanban::$instance->post_type_keys[$post_type_slug] = $post_type_key;
            foreach ($post_type_data as $key_type => $key_type_data) {
                foreach ($key_type_data as $key_slug => $values) {
                    $variable = sprintf('%s_list', $key_type);
                    if (!isset(Kanban::$instance->{$variable})) {
                        Kanban::$instance->{$variable} = array();
                    }
                    // get variable by reference
                    $array =& Kanban::$instance->{$variable};
                    $array[] = Kanban_Utils::format_key($post_type_slug, $key_slug);