Adminer (formerly phpMinAdmin) is a full-featured MySQL management tool written in PHP. This plugin include this tool in WordPress for a fast management of your database. Author: Frank Bültge Version: 1.1.1 Author URI: http://bueltge.de/ Donate URI: http://bueltge.de/wunschliste/ License: Apache License Last change: 22.09.2011 */ /** License: ============================================================================== Copyright 2009/2011 Frank Bueltge (email : frank@bueltge.de) 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 Requirements: ============================================================================== This plugin requires WordPress >= 2.7 and tested with PHP Interpreter >= 5.2.9 */ //avoid direct calls to this file, because now WP core and framework has been used if ( ! function_exists( 'add_action' ) ) { header( 'Status: 403 Forbidden' ); header( 'HTTP/1.1 403 Forbidden' ); exit(); } elseif ( version_compare( phpversion(), '5.0.0', '<' ) ) { $exit_msg = 'The plugin require PHP 5 or newer'; header( 'Status: 403 Forbidden' ); header( 'HTTP/1.1 403 Forbidden' ); exit( $exit_msg ); } if ( ! class_exists('AdminerForWP' ) ) { //WordPress definitions if ( ! defined('WP_CONTENT_URL' ) ) define( 'WP_CONTENT_URL', get_option('siteurl' ) . '/wp-content' ); if ( ! defined('WP_CONTENT_DIR' ) ) define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); if ( ! defined('WP_PLUGIN_URL' ) ) define( 'WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins' ); if ( ! defined('WP_PLUGIN_DIR' ) ) define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins' ); if ( ! defined('PLUGINDIR' ) ) define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. if ( ! defined('WP_LANG_DIR' ) ) define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // plugin definitions define( 'FB_ADM_BASENAME', plugin_basename(__FILE__) ); define( 'FB_ADM_BASEDIR', dirname( plugin_basename(__FILE__) ) ); define( 'FB_ADM_TEXTDOMAIN', 'adminer' ); class AdminerForWP { public function __construct() { if ( ! is_admin() ) return FALSE; add_action( 'init', array( &$this, 'register_styles' ) ); add_action( 'admin_init', array( &$this, 'text_domain' ) ); add_action( 'admin_menu', array( &$this, 'on_admin_menu' ) ); } public function text_domain() { load_plugin_textdomain( FB_ADM_TEXTDOMAIN, false, FB_ADM_BASEDIR . '/languages' ); } public function register_styles() { wp_register_style( 'adminer-menu', plugins_url( 'css/menu.css', __FILE__ ) ); wp_register_style( 'adminer-settings', plugins_url( 'css/settings.css', __FILE__ ) ); } public function on_load_page() { add_thickbox(); wp_enqueue_style( 'adminer-settings' ); add_action( 'contextual_help', array(&$this, 'contextual_help' ), 10, 3 ); } public function on_admin_menu() { if ( current_user_can('unfiltered_html' ) ) { wp_enqueue_style( 'adminer-menu' ); $menutitle = ''; $menutitle .= __( 'Adminer', FB_ADM_TEXTDOMAIN ); $this->pagehook = add_management_page( __( 'Adminer', FB_ADM_TEXTDOMAIN ), $menutitle, 'unfiltered_html', FB_ADM_BASENAME, array( &$this, 'on_show_page' ) ); add_action( 'load-' . $this -> pagehook, array( &$this, 'on_load_page' ) ); } } public function contextual_help( $contextual_help, $screen_id, $screen ) { if ( 'tools_page_adminer/adminer' !== $screen_id ) return FALSE; $contextual_help = '
';
$contextual_help .= __( 'Start the Thickbox inside the Adminer-tool with the button ›Start Adminer inside‹.', FB_ADM_TEXTDOMAIN );
$contextual_help .= '
';
$contextual_help .= __( 'Alternatively, you can use the button for use ›Adminer in a new Tab‹.', FB_ADM_TEXTDOMAIN );
$contextual_help .= '
' . __( 'Documentation on Plugin Directory', FB_ADM_TEXTDOMAIN ); $contextual_help .= ' · ' .__( 'Blog of Plugin author', FB_ADM_TEXTDOMAIN ); $contextual_help .= ' · ' . __( 'Adminer website
', FB_ADM_TEXTDOMAIN ); return $contextual_help; } public function on_show_page() { global $wpdb; if ( '' == DB_USER ) $db_user = __( 'empty', FB_ADM_TEXTDOMAIN ); else $db_user = DB_USER; if ( '' == DB_PASSWORD ) $db_password = __( 'empty', FB_ADM_TEXTDOMAIN ); else $db_password = DB_PASSWORD; ?>