return array('key' => 'post_type', 'lookup_table' => array()); }); birch_defmulti($ns, 'enqueue_scripts_post_new', $ns->get_post_type_lookup_config, function ($arg) { }); birch_defmulti($ns, 'enqueue_scripts_post_edit', $ns->get_post_type_lookup_config, function ($arg) { }); birch_defmulti($ns, 'enqueue_scripts_post_list', $ns->get_post_type_lookup_config, function ($arg) { }); birch_defmulti($ns, 'load_post_edit', $ns->get_post_type_lookup_config, function ($arg) { }); birch_defmulti($ns, 'load_post_new', $ns->get_post_type_lookup_config, function ($arg) { }); birch_defmulti($ns, 'save_post', $ns->get_post_type_lookup_config, function ($post_a) { }); birch_defmulti($ns, 'pre_save_post', $ns->get_post_type_lookup_config, function ($post_data, $post_attr) { return $post_data; }); birch_defn($ns, 'get_wp_screen', function ($hook_name) use($ns) { if (substr($hook_name, -4) !== '.php') { $hook_name = $hook_name . '.php'; } $screen = WP_Screen::get($hook_name); return $screen; }); birch_defn($ns, 'register_3rd_scripts', function () use($ns) { global $birchpress; wp_register_script('underscore_string', $birchpress->get_framework_url() . '/lib/assets/js/underscore/underscore.string.min.js', array('underscore'), '2.3.0'); }); birch_defn($ns, 'register_core_scripts', function () use($ns) { global $birchpress; $version = $birchpress->get_version();
birch_defn($ns, 'enqueue_scripts', function ($hook) use($ns) { global $birchschedule; if ($birchschedule->view->get_page_hook('settings') !== $hook) { return; } $birchschedule->view->register_3rd_scripts(); $birchschedule->view->register_3rd_styles(); $birchschedule->view->enqueue_scripts(array('birchschedule_view_admincommon')); }); birch_defn($ns, 'get_tabs', function () { return array(); }); birch_defn($ns, 'get_tab_lookup_config', function () { return array('key' => 'tab', 'lookup_table' => array()); }); birch_defmulti($ns, 'init_tab', $ns->get_tab_lookup_config, function ($arg) { }); birch_defn($ns, 'compare_tab_order', function ($a, $b) { if ($a['order'] == $b['order']) { return 0; } return $a['order'] < $b['order'] ? -1 : 1; }); birch_defn($ns, 'render_admin_page', function () use($ns, $_ns_data) { global $birchschedule; $setting_page_url = admin_url("admin.php") . "?page=birchschedule_settings"; uasort($_ns_data->tabs, array($ns, 'compare_tab_order')); $birchschedule->view->show_notice(); ?> <div class="wrap"> <h2 class="nav-tab-wrapper"> <?php
birch_defn($ns, 'init', function () use($ns) { add_filter('birchbase_db_get_essential_post_columns', array($ns, 'add_more_essential_columns'), 20, 2); }); birch_defn($ns, 'get_post_type_lookup_config', function () { return array('key' => 'post_type', 'lookup_table' => array()); }); birch_defmulti($ns, 'save', $ns->get_post_type_lookup_config, function ($model, $config = false) { global $birchschedule, $birchpress; $model = $birchschedule->model->pre_save($model, $config); return $birchpress->db->save($model, $config); }); birch_defmulti($ns, 'pre_save', $ns->get_post_type_lookup_config, function ($model, $config) { return $model; }); birch_defmulti($ns, 'post_get', $ns->get_post_type_lookup_config, function ($model) { return $model; }); birch_defn($ns, 'is_valid_id', function ($id) { global $birchpress; return $birchpress->db->is_valid_id($id); }); birch_defn($ns, 'add_more_essential_columns', function ($columns, $post_type) { if ($post_type == 'birs_staff') { $columns[] = 'post_title'; $columns[] = 'post_content'; } if ($post_type == 'birs_service') { $columns[] = 'post_title'; $columns[] = 'post_content'; } return $columns;
$modules_dir = $ns->plugin_dir_path() . 'modules'; $_module_names = scandir($modules_dir); foreach ($_module_names as $module_name) { if ($module_name != '.' && $module_name != '..') { $module_names[] = $module_name; $module_dir = $modules_dir . '/' . $module_name; $birchpress->load_package($module_dir); } } }); birch_defn($ns, 'upgrade_core', function () { }); birch_defn($ns, 'get_module_lookup_config', function () { return array('key' => 'module', 'lookup_table' => array()); }); birch_defmulti($ns, 'upgrade_module', $ns->get_module_lookup_config, function ($module_a) { }); birch_defn($ns, 'upgrade', function () use($ns, &$module_names) { $ns->upgrade_core(); foreach ($module_names as $module_name) { $ns->upgrade_module(array('module' => $module_name)); } }); birch_defn($ns, 'init_packages', function () use($ns) { global $birchpress; $birchpress->init_package($ns); }); birch_defn($ns, 'run', function () use($ns) { global $birchpress; $ns->load_core(); $ns->load_modules(); $ns->init_packages();