From c4f2e9ccb97b1e143bdd468da7fa5d3168086a81 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 13 Aug 2009 12:37:33 -0400 Subject: [PATCH] working on admin --- classes/WhatDidTheySay.php | 6 ++---- classes/WhatDidTheySayAdmin.php | 19 +++++++++++++++++++ what-did-they-say.php | 7 +++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/classes/WhatDidTheySay.php b/classes/WhatDidTheySay.php index 3583054..7c7acbb 100644 --- a/classes/WhatDidTheySay.php +++ b/classes/WhatDidTheySay.php @@ -15,8 +15,6 @@ class WhatDidTheySay { } function install() { - global $wpdb; - if (get_option('what-did-they-say-version') !== $this->version) { $sql = "CREATE TABLE %s ( id int NOT NULL AUTO_INCREMENT, @@ -28,9 +26,9 @@ class WhatDidTheySay { );"; 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); } } diff --git a/classes/WhatDidTheySayAdmin.php b/classes/WhatDidTheySayAdmin.php index 1065573..2442e58 100644 --- a/classes/WhatDidTheySayAdmin.php +++ b/classes/WhatDidTheySayAdmin.php @@ -1,6 +1,14 @@ 'English', 'default' => true), + 'French', + 'Spanish', + 'Italian', + 'German' + ); + 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() { add_submenu_page( @@ -42,11 +57,15 @@ class WhatDidTheySayAdmin { } function manage_transcriptions_admin() { + $languages = get_option('what-did-they-say-languages'); + include(dirname(__FILE__) . '/admin.inc'); } function manage_transcriptions_meta_box() { + global $post; + var_dump($post->ID); } function handle_update($info) { diff --git a/what-did-they-say.php b/what-did-they-say.php index 64f9b49..7999fd8 100644 --- a/what-did-they-say.php +++ b/what-did-they-say.php @@ -4,10 +4,10 @@ Plugin Name: What Did They Say?!? Plugin URI: http://www.coswellproductions.com/wordpress/wordpress-plugins/ Description: Manage and display text transcriptions of comics, videos, or other media. Version: 0.1 -Author: johncoswell +Author: John Bintz 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 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 */ +foreach (glob(dirname(__FILE__) . '/classes/*.php') as $file) { require_once($file); } + $what_did_they_say =& new WhatDidTheySay(); $what_did_they_say_admin =& new WhatDidTheySayAdmin(&$what_did_they_say); 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_admin, 'install')); ?> \ No newline at end of file