public static function nodes_unmark_all() { parent::$json_data += array('unmarked_nodes' => array()); $unmarked_nodes = ApmTreeData::unmark_all_current_user_nodes(); parent::$json_data['unmarked_nodes'] = $unmarked_nodes; parent::send_json(); }
/** * Delete plugin database footprint on unsinstall */ public static function uninstall() { ApmTreeData::delete_database_data(); ApmAddons::delete_database_data(); }
/** * Insert a given page in the APM tree * @param object $post */ public static function insert_page_from_outside($page) { $tree = new ApmTreeData(); $tree->load_last_tree(); if (!$tree->is_wp_page_in_tree($page->ID) && in_array($page->post_status, ApmConfig::$allowed_post_status)) { $parent_id = empty($page->post_parent) ? ApmTreeData::root_id : $page->post_parent; $insert_infos = $tree->get_new_page_insert_infos_from_sibling($parent_id, $page->menu_order); $tree->add_new_node($insert_infos['action'], $insert_infos['index_node'], 'page', $page->ID); } }
private static function check_tree_loaded() { $tree_db = ApmTreeDb::get_last_tree(); if (empty($tree_db)) { $tree = new ApmTreeData(); $tree->load_last_tree(); //Will load the tree from WP entities } }
/** * Loads a subtree given its root. * Not used yet TODO: see if we remove this function */ public static function tree_load_sub_tree() { parent::$json_data += array('sub_tree' => '', 'node_to_replace' => '', 'sub_tree_nodes' => array()); $root_node = isset($_POST['root_node']) && is_numeric($_POST['root_node']) ? $_POST['root_node'] : ApmTreeData::root_id; $tree = new ApmTreeData(); $tree->load_last_tree(); //Set the "tree_nodes" variable retrieved and used in the following included template: $sub_tree_nodes = $tree->get_ready_to_display_tree($root_node); parent::$json_data['sub_tree'] = self::get_html_tree($sub_tree_nodes); parent::$json_data['node_to_replace_by_subtree'] = $root_node; parent::$json_data['sub_tree_nodes'] = array_keys($sub_tree_nodes); parent::send_json(); }