working on admin

This commit is contained in:
John Bintz 2009-08-13 12:37:33 -04:00
parent 2b91ce8125
commit c4f2e9ccb9
3 changed files with 26 additions and 6 deletions

View File

@ -15,8 +15,6 @@ class WhatDidTheySay {
} }
function install() { function install() {
global $wpdb;
if (get_option('what-did-they-say-version') !== $this->version) { if (get_option('what-did-they-say-version') !== $this->version) {
$sql = "CREATE TABLE %s ( $sql = "CREATE TABLE %s (
id int NOT NULL AUTO_INCREMENT, id int NOT NULL AUTO_INCREMENT,
@ -28,9 +26,9 @@ class WhatDidTheySay {
);"; );";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql); dbDelta(sprintf($sql, $this->table));
update_option('what-did-they-say-version', $version); update_option('what-did-they-say-version', $this->version);
} }
} }

View File

@ -1,6 +1,14 @@
<?php <?php
class WhatDidTheySayAdmin { class WhatDidTheySayAdmin {
var $default_languages = array(
array('name' => 'English', 'default' => true),
'French',
'Spanish',
'Italian',
'German'
);
function WhatDidTheySayAdmin() { function WhatDidTheySayAdmin() {
} }
@ -18,6 +26,13 @@ class WhatDidTheySayAdmin {
} }
} }
} }
function install() {
$languages = get_option('what-did-they-say-languages');
if (empty($languages)) {
update_option('what-did-they-say-languages', $this->default_languages);
}
}
function admin_menu() { function admin_menu() {
add_submenu_page( add_submenu_page(
@ -42,11 +57,15 @@ class WhatDidTheySayAdmin {
} }
function manage_transcriptions_admin() { function manage_transcriptions_admin() {
$languages = get_option('what-did-they-say-languages');
include(dirname(__FILE__) . '/admin.inc');
} }
function manage_transcriptions_meta_box() { function manage_transcriptions_meta_box() {
global $post;
var_dump($post->ID);
} }
function handle_update($info) { function handle_update($info) {

View File

@ -4,10 +4,10 @@ Plugin Name: What Did They Say?!?
Plugin URI: http://www.coswellproductions.com/wordpress/wordpress-plugins/ Plugin URI: http://www.coswellproductions.com/wordpress/wordpress-plugins/
Description: Manage and display text transcriptions of comics, videos, or other media. Description: Manage and display text transcriptions of comics, videos, or other media.
Version: 0.1 Version: 0.1
Author: johncoswell Author: John Bintz
Author URI: http://www.coswellproductions.com/wordpress/ Author URI: http://www.coswellproductions.com/wordpress/
Copyright 2009 John Bintx (email : john@coswellproductions.com) Copyright 2009 John Bintz (email : john@coswellproductions.com)
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -24,10 +24,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
foreach (glob(dirname(__FILE__) . '/classes/*.php') as $file) { require_once($file); }
$what_did_they_say =& new WhatDidTheySay(); $what_did_they_say =& new WhatDidTheySay();
$what_did_they_say_admin =& new WhatDidTheySayAdmin(&$what_did_they_say); $what_did_they_say_admin =& new WhatDidTheySayAdmin(&$what_did_they_say);
add_action('init', array(&$what_did_they_say_admin, 'init')); add_action('init', array(&$what_did_they_say_admin, 'init'));
register_activation_hook(__FILE__, array(&$what_did_they_say, 'install')); register_activation_hook(__FILE__, array(&$what_did_they_say, 'install'));
register_activation_hook(__FILE__, array(&$what_did_they_say_admin, 'install'));
?> ?>