Options --> Add Quicktags by Roel Meurders and Frank Bueltge
*/
// SCRIPT INFO ///////////////////////////////////////////////////////////////////////////
/*
WP-AddQuicktag for Wordpress is in originally by
(C) 2005 Roel Meurders - GNU General Public License
AddQuicktag is an newer version with more functions and worked in WP 2.1
(C) 2007 Frank Bueltge
This Wordpress plugin is released under a GNU General Public License. A complete version of this license
can be found here: http://www.gnu.org/licenses/gpl.txt
This Wordpress plugin has been tested with Wordpress 2.0, 2.1 and Wordpress 2.3;
This Wordpress plugin is released "as is". Without any warranty. The authors cannot
be held responsible for any damage that this script might cause.
*/
// NO EDITING HERE!!!!! ////////////////////////////////////////////////////////////////
if(function_exists('load_plugin_textdomain'))
load_plugin_textdomain('addquicktag','wp-content/plugins');
function wpaq_install() {
global $wpdb;
if (!get_option('rmnlQuicktagSettings') != '') {
$name = 'rmnlQuicktagSettings';
$value = 'a:1:{s:7:"buttons";a:1:{i:0;a:3:{s:4:"text";s:7:"Example";s:5:"start";s:9:"";s:3:"end";s:10:"";}}}';
$description = '';
$autoload = 'yes';
$wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, option_description, autoload) VALUES ('$name', '$value', '$description', '$autoload')");
}
return;
}
if (function_exists('add_action')) {
add_action('admin_menu', 'wpaq_admin_menu');
if (strpos($_SERVER['REQUEST_URI'], 'addquicktag.php')) {
add_action('init', 'wpaq_install');
}
}
function wpaq_admin_menu(){
add_options_page('WP-Quicktag - Add Quicktags', 'Add Quicktags', 9, basename(__FILE__), 'wpaq_options_page');
}
function wpaq_options_page(){
global $wpdb;
$wpaq_document_root = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'];
$wpaq_document_root = str_replace("/wp-admin/options-general.php?page=addquicktag.php", "/wp-content", $wpaq_document_root);
$wpaq_link = $_SERVER['REQUEST_URI'];
$wpaq_link = str_replace("\\", "/", $wpaq_link);
if ($_POST['wpaq']){
$buttons = array();
for ($i = 0; $i < count($_POST['wpaq']['buttons']); $i++){
$b = $_POST['wpaq']['buttons'][$i];
if ($b['text'] != '' && $b['start'] != ''){
$b['text'] = htmlentities($b['text']);
$b['start'] = stripslashes($b['start']);
$b['end'] = stripslashes($b['end']);
$buttons[] = $b;
}
}
$_POST['wpaq']['buttons'] = $buttons;
update_option('rmnlQuicktagSettings', $_POST['wpaq']);
$message = '
';
}
$string1 = __('Adding or deleting Quicktag-buttons', 'addquicktag');
$string2 = __('Fill in the fields below to add or edit the quicktags. Fields with * are compulsary. To delete a tag simply empty all fields.', 'addquicktag');
$field1 = __('Buttonstring*', 'addquicktag');
$field2 = __('Start tag(s)*', 'addquicktag');
$field3 = __('End tag(s)', 'addquicktag');
$button1 = __('Update Options »', 'addquicktag');
// Export strings
$button2 = __('Export »', 'addquicktag');
$export1 = __('Export Quicktag-buttons options', 'addquicktag');
$export2 = __('You can save a wpaq-File with your options in /wp-content/', 'addquicktag');
// Import strings
$button3 = __('Upload file and import »', 'addquicktag');
$import1 = __('Import Quicktag-buttons options', 'addquicktag');
$import2 = __('Choose a AddQuicktag (wpaq) file to upload, then click Upload file and import.', 'addquicktag');
$import3 = __('Choose a file from your computer: ', 'addquicktag');
// Info
$info1 = __('Further information: Visit the plugin homepage for further information or to grab the latest version of this plugin.', 'addquicktag');
$info2 = __('You want to thank me? Visit my wishlist.', 'addquicktag');
$o = get_option('rmnlQuicktagSettings');
echo <<