diff --git a/classes/WhatDidTheySay.php b/classes/WhatDidTheySay.php index c4b91ec..3583054 100644 --- a/classes/WhatDidTheySay.php +++ b/classes/WhatDidTheySay.php @@ -6,12 +6,34 @@ * other posts as necessary. */ class WhatDidTheySay { + var $version = "0.1"; + function WhatDidTheySay() { global $wpdb; $this->table = $wpdb->prefix . "provided_transcripts"; } + function install() { + global $wpdb; + + if (get_option('what-did-they-say-version') !== $this->version) { + $sql = "CREATE TABLE %s ( + id int NOT NULL AUTO_INCREMENT, + post_id int NOT NULL, + user_id int NOT NULL, + language char(10) NOT NULL, + transcript mediumtext, + UNIQUE KEY id (id) + );"; + + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + dbDelta($sql); + + update_option('what-did-they-say-version', $version); + } + } + /** * Save a transcript to a post. * @param int $post_id The post to attach the transcript to. diff --git a/classes/WhatDidTheySayAdmin.php b/classes/WhatDidTheySayAdmin.php new file mode 100644 index 0000000..1065573 --- /dev/null +++ b/classes/WhatDidTheySayAdmin.php @@ -0,0 +1,57 @@ +what_did_they_say = $what_did_they_say; + + add_action('admin_menu', array(&$this, 'admin_menu')); + + if (isset($_POST['wdts'])) { + if (isset($_POST['wdts']['_nonce'])) { + if (wp_verify_nonce('what-did-they-say', $_POST['wdts']['_nonce'])) { + $this->handle_update($_POST['wdts']); + } + } + } + } + + function admin_menu() { + add_submenu_page( + 'edit-comments.php', + __('Manage Transcriptions', 'what-did-they-say'), + __('Transcripts', 'what-did-they-say'), + 'edit_posts', + 'manage-transcriptions-wdts', + array(&$this, 'manage_transcriptions_admin') + ); + + if (current_user_can('edit_posts')) { + add_meta_box( + 'manage-transcriptions', + __('Manage Transcriptions', 'what-did-they-say'), + array(&$this, 'manage_transcriptions_meta_box'), + 'post', + 'normal', + 'low' + ); + } + } + + function manage_transcriptions_admin() { + + } + + function manage_transcriptions_meta_box() { + + } + + function handle_update($info) { + + } +} + +?> \ No newline at end of file diff --git a/what-did-they-say.php b/what-did-they-say.php index e69de29..64f9b49 100644 --- a/what-did-they-say.php +++ b/what-did-they-say.php @@ -0,0 +1,33 @@ + \ No newline at end of file