page_name = $page_name; $this->page_content = $page_content; if( function_exists('add_action') ) { add_action ('activate_' . POLLPRESS_NAME, array(&$this, 'install_page')); add_action ('deactivate_' . POLLPRESS_NAME, array(&$this, 'uninstall_page')); } } function install_page() { global $user_ID; // Create the page in the DB $page = array(); $page['post_title'] = $this->page_name; $page['post_content'] = $this->page_content; $page['post_excerpt'] = ''; $page['post_category'] = array(); $page['post_status'] = 'static'; $page['post_name'] = $this->page_name; $page['comment_status'] = 'closed'; $page['ping_status'] = 'closed'; $page['post_author'] = $user_ID; $page['post_date'] = current_time('mysql'); $page['post_date_gmt'] = get_gmt_from_date($page['post_date']); $page['post_parent'] = 0; $page['to_ping'] = ''; $page['user_ID'] = $user_ID; $page_ID = wp_insert_post($page); // We need to remember our page so we can delete it later $options_controller = new pollpress_controller_options(); $options_controller->set_page($this->page_name, $page_ID); } function uninstall_page() { // Get the page_id of the page we inserted $options_controller = new pollpress_controller_options(); $page_ID = $options_controller->get_page($this->page_name); // Actually delete the page wp_delete_post($page_ID); // Finally, forget the page $options_controller->remove_page($this->page_name); } } ?>