<?php
/*
Plugin Name: Client Theme Viewer
Plugin URI: http://mekkawest.com/wordpress_plugins/client_site_viewer
Description: Client Theme Viewer is a plugin that allows Web Designers to allow clients to log in to WordPress and view the custom themes that are being developed for them.
Version: 1.0
Author: Frank 'viperteq' Young
Author URI: http://mekkawest.com/staff/frank-young
*/
/* Copyright 2007-2015 Frank 'viperteq' Young (email : mekkawest.info@gmail.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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
$ctv_db_version = "1.0";
function ctv_install () {
global $wpdb;
global $ctv_db_version;
$table_name = $wpdb->prefix . "ctv";
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
$sql = "CREATE TABLE " . $table_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time bigint(11) DEFAULT '0' NOT NULL,
name tinytext NOT NULL,
text text NOT NULL,
url VARCHAR(55) NOT NULL,
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($sql);
$welcome_name = "Mr. Wordpress";
$welcome_text = "Congratulations, you just completed the installation!";
$insert = "INSERT INTO " . $table_name .
" (time, name, text) " .
"VALUES ('" . time() . "','" . $wpdb->escape($welcome_name) . "','" . $wpdb->escape($welcome_text) . "')";
$results = $wpdb->query( $insert );
add_option("ctv_db_version", $ctv_db_version);
}
}
add_action('activate_plugindir/Client_Theme_Viewer.php', 'ctv_install');
//ctv_add_pages provides the functions to add the Client Theme Viewer admin page to WordPress.
function ctv_add_pages() {
// Add a new menu under Manage:
add_management_page('Client Theme Viewer Manager', 'Client Theme Viewer Manager', 8, 'ctv_admin.php', 'ctv_admin');
}
// ctv_admin() displays the page content for the Client Theme Viewer Manager submenu
function ctv_admin() {
echo "<h2>Add New Client</h2>";
}
?>