Version Description
- The plugin now requires WordPress 3.3
Download this release
Release Info
Developer | katzwebdesign |
Plugin | Rich Text Tags |
Version | 1.5 |
Comparing to | |
See all releases |
Code changes from version 1.4.1 to 1.5
- kws_rt_taxonomy.css +4 -5
- kws_rt_taxonomy.js +28 -50
- readme.txt +13 -8
- rich-text-tags.php +54 -169
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
kws_rt_taxonomy.css
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
/* For Rich Text Tags & Taxonomy WordPress Plugin */
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
border:1px solid #666;
|
7 |
}
|
1 |
/* For Rich Text Tags & Taxonomy WordPress Plugin */
|
2 |
+
|
3 |
+
.wp-editor-container .quicktags-toolbar input.ed_button {
|
4 |
+
border-width: 0;
|
5 |
+
width:auto;
|
|
|
6 |
}
|
kws_rt_taxonomy.js
CHANGED
@@ -1,56 +1,34 @@
|
|
1 |
// For use with Rich Text Tags, Categories, and Taxonomies WordPress Plugin
|
2 |
|
3 |
-
|
4 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
jQuery(document).ready(function($) {
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
$("textarea#description,textarea#tag-description,textarea#category_description").prop('id', 'content');
|
13 |
-
$("label[for='description'],label[for='tag-description'],label[for='category_description']").prop('for', 'content');
|
14 |
-
} else {
|
15 |
-
$("textarea#description,textarea#tag-description,textarea#category_description").attr('id', 'content');
|
16 |
-
$("label[for='description'],label[for='tag-description'],label[for='category_description']").attr('for', 'content');
|
17 |
-
}
|
18 |
-
|
19 |
-
// We do this the right way on the Update (Edit) page.
|
20 |
-
if($('.wp-list-table').length === 0) {
|
21 |
-
tinyMCE.settings['save_callback'] = function (e,c,body) { return c; }
|
22 |
-
$('label[for="content"]').parent().append('<div id="toggleRichText" class="hide-if-no-js"><p><a href="#">Toggle Rich Text Editor</a></p></div>');
|
23 |
-
} else { // Otherwise, we hack it.
|
24 |
-
|
25 |
-
$('label[for="content"]').append('<a id="toggleRichText" class="hide-if-no-js alignright" href="#">Toggle Rich Text Editor</a>');
|
26 |
-
|
27 |
-
// We've added an invalid element to trap the submission process
|
28 |
-
$('#addtag').prepend('<div class="form-field form-required hide-if-js"><input aria-required="true" type="hidden" id="richtextadded" /></div>');
|
29 |
-
|
30 |
-
$('#submit').click(function(){
|
31 |
-
|
32 |
-
$('#wpbody form textarea').html(tinyMCE.activeEditor.getContent({format : 'raw'}));
|
33 |
-
|
34 |
-
$('#richtextadded').val('1').removeClass('form-invalid');
|
35 |
-
if(validateForm($(this).parents('form'))) {
|
36 |
-
if($('table.wp-list-table.widefat').length > 0) {
|
37 |
-
tinyMCE.activeEditor.setContent('<p><br data-mce-bogus="1"></p>',{format : 'raw'});
|
38 |
-
}
|
39 |
-
} else {
|
40 |
-
$('#richtextadded').val('').addClass('form-invalid');
|
41 |
-
}
|
42 |
-
});
|
43 |
-
}
|
44 |
-
|
45 |
-
$('#toggleRichText').click(function(e) {
|
46 |
-
e.preventDefault();
|
47 |
-
tinyMCE.execCommand('mceToggleEditor',false,'content');
|
48 |
-
return false;
|
49 |
-
});
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
1 |
// For use with Rich Text Tags, Categories, and Taxonomies WordPress Plugin
|
2 |
|
3 |
+
function kwsTriggerSave() {
|
4 |
+
var rich = (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden();
|
5 |
+
if (rich) {
|
6 |
+
ed = tinyMCE.activeEditor;
|
7 |
+
if ( 'mce_fullscreen' == ed.id || 'wp_mce_fullscreen' == ed.id ) {
|
8 |
+
tinyMCE.get(0).setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
|
9 |
+
}
|
10 |
+
tinyMCE.triggerSave();
|
11 |
+
}
|
12 |
+
}
|
13 |
|
14 |
jQuery(document).ready(function($) {
|
15 |
+
|
16 |
+
// Remove the non-rich fields
|
17 |
+
$('.form-field').has('#tag-description').remove();
|
18 |
+
$('.form-field').has('#category-description').remove();
|
19 |
+
$('.form-field').has('#description').remove();
|
20 |
|
21 |
+
// Make sure you're saving the latest content
|
22 |
+
$('input#submit').click(function(e) {
|
23 |
+
kwsTriggerSave();
|
24 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
}); /* end ready() */
|
27 |
+
|
28 |
+
// On a successful save, reset field
|
29 |
+
jQuery(document).ajaxComplete(function(e, xhr, settings) {
|
30 |
+
if(settings.data.match(/action=(add|update)-tag/)) {
|
31 |
+
tinyMCE.get(0).setContent('');
|
32 |
+
kwsTriggerSave();
|
33 |
+
}
|
34 |
+
});
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: katzwebdesign
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zackkatz%40gmail%2ecom&item_name=Rich%20Text%20Tags&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
Tags: tag, tags, taxonomy, taxonomies, category, categories, category description, rich text category, editor, rich text, description, tag description, taxonomy description, rich text, wysiwyg, tinyMCE, SEO, search engine optimization
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 3.3
|
7 |
Stable tag: trunk
|
8 |
|
9 |
The Rich Text Tags Plugin allows you to edit tag, category, and taxonomy descriptions using Wordpress' built in WYSIWYG editor.
|
@@ -15,13 +15,11 @@ The Rich Text Tags Plugin allows you to edit tag, category, and taxonomy descrip
|
|
15 |
### A TinyMCE Editor for Tags, Categories, and Taxonomies ###
|
16 |
The Rich Text Tags Plugin allows you to edit tag descriptions, category descriptions, and taxonomy descriptions using Wordpress' built in rich-text editor. Switch between WYSIWYG and HTML editing modes with the click of a link. Use the WordPress uploader to insert images from your computer or site's Media Library.
|
17 |
|
18 |
-
Use the
|
19 |
|
20 |
<h4>Features</h4>
|
21 |
-
* Edit
|
22 |
* Works with custom taxonomies (and custom post types, introduced in WP 3.0)
|
23 |
-
* Capability to turn off rich text editing with a click, so you can edit the HTML
|
24 |
-
|
25 |
|
26 |
== Installation ==
|
27 |
|
@@ -35,6 +33,9 @@ Use the PHP functions `tag_description()` and `category_description()` in your t
|
|
35 |
|
36 |
== Upgrade Notice ==
|
37 |
|
|
|
|
|
|
|
38 |
= 1.4.1 =
|
39 |
* Added support for WordPress 3.3 (thanks, <a href="http://wordpress.org/support/topic/plugin-rich-text-tags-tinymce-editor-not-loading-in-wp-33-beta4" rel="nofollow">fountaininternet</a>)
|
40 |
|
@@ -70,6 +71,10 @@ Use the PHP functions `tag_description()` and `category_description()` in your t
|
|
70 |
|
71 |
== Changelog ==
|
72 |
|
|
|
|
|
|
|
|
|
73 |
= 1.4 =
|
74 |
* Improved functionality in WordPress 3.2.1
|
75 |
* Fixed `First argument is expected to be a valid callback, 'wp_tiny_mce_preload_dialogs'` error (<a href="http://wordpress.org/support/topic/625561">issue <a href="http://wordpress.org/support/topic/625561">625561</a> and <a href="http://wordpress.org/support/topic/603480">603480</a>
|
@@ -121,5 +126,5 @@ Use the PHP functions `tag_description()` and `category_description()` in your t
|
|
121 |
|
122 |
== Screenshots ==
|
123 |
|
124 |
-
1. How the rich text editor looks in the
|
125 |
-
2.
|
2 |
Contributors: katzwebdesign
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zackkatz%40gmail%2ecom&item_name=Rich%20Text%20Tags&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
Tags: tag, tags, taxonomy, taxonomies, category, categories, category description, rich text category, editor, rich text, description, tag description, taxonomy description, rich text, wysiwyg, tinyMCE, SEO, search engine optimization
|
5 |
+
Requires at least: 3.3
|
6 |
+
Tested up to: 3.3.1
|
7 |
Stable tag: trunk
|
8 |
|
9 |
The Rich Text Tags Plugin allows you to edit tag, category, and taxonomy descriptions using Wordpress' built in WYSIWYG editor.
|
15 |
### A TinyMCE Editor for Tags, Categories, and Taxonomies ###
|
16 |
The Rich Text Tags Plugin allows you to edit tag descriptions, category descriptions, and taxonomy descriptions using Wordpress' built in rich-text editor. Switch between WYSIWYG and HTML editing modes with the click of a link. Use the WordPress uploader to insert images from your computer or site's Media Library.
|
17 |
|
18 |
+
Use the WordPress functions `tag_description()` and `category_description()` in your theme to show the descriptions. To learn how to show taxonomy descriptions, <a href="http://www.seodenver.com/rich-text-tags/" rel="nofollow">read more on the plugin page</a>.
|
19 |
|
20 |
<h4>Features</h4>
|
21 |
+
* Edit term descriptions with WordPress's built-in WYSIWYG editor
|
22 |
* Works with custom taxonomies (and custom post types, introduced in WP 3.0)
|
|
|
|
|
23 |
|
24 |
== Installation ==
|
25 |
|
33 |
|
34 |
== Upgrade Notice ==
|
35 |
|
36 |
+
= 1.5 =
|
37 |
+
* The plugin now requires WordPress 3.3
|
38 |
+
|
39 |
= 1.4.1 =
|
40 |
* Added support for WordPress 3.3 (thanks, <a href="http://wordpress.org/support/topic/plugin-rich-text-tags-tinymce-editor-not-loading-in-wp-33-beta4" rel="nofollow">fountaininternet</a>)
|
41 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 1.5 =
|
75 |
+
* The plugin now uses WordPress's built-in <a href="http://codex.wordpress.org/Function_Reference/wp_editor" rel="nofollow">wp_editor()</a> and requires WordPress 3.3
|
76 |
+
* Added localization support (multiple languages)
|
77 |
+
|
78 |
= 1.4 =
|
79 |
* Improved functionality in WordPress 3.2.1
|
80 |
* Fixed `First argument is expected to be a valid callback, 'wp_tiny_mce_preload_dialogs'` error (<a href="http://wordpress.org/support/topic/625561">issue <a href="http://wordpress.org/support/topic/625561">625561</a> and <a href="http://wordpress.org/support/topic/603480">603480</a>
|
126 |
|
127 |
== Screenshots ==
|
128 |
|
129 |
+
1. How the rich text editor looks in the Tags page
|
130 |
+
2. How the rich text editor looks in the Edit Tag page
|
rich-text-tags.php
CHANGED
@@ -4,19 +4,11 @@ Plugin Name: Rich Text Tags, Categories, and Taxonomies
|
|
4 |
Plugin URI: http://www.seodenver.com/rich-text-tags/
|
5 |
Description: This plugin offers rich text editing capabilities for descriptions of tags, categories, and taxonomies.
|
6 |
Author: Katz Web Services, Inc.
|
7 |
-
Version: 1.
|
8 |
Author URI: http://www.katzwebservices.com
|
9 |
*/
|
10 |
-
/*
|
11 |
-
Based on Rich Text Biography by Matthew Praetzel. http://www.ternstyle.us
|
12 |
-
Modified by Katz Web Services, Inc. to work with Simple Taxonomies.
|
13 |
-
The license applied to the Rich Text Biography was in violation of the terms of use specified
|
14 |
-
on the WordPress.org website (http://wordpress.org/extend/plugins/about/), namely that the plugin
|
15 |
-
MUST be GPL Compatible (http://www.gnu.org/licenses/gpl.html).
|
16 |
-
As such, the license included with the original Rich Text Biography plugin was invalid.
|
17 |
-
*/
|
18 |
|
19 |
-
/* Copyright
|
20 |
|
21 |
This program is free software; you can redistribute it and/or modify
|
22 |
it under the terms of the GNU General Public License as published by
|
@@ -39,188 +31,81 @@ function kws_rich_text_tags() {
|
|
39 |
|
40 |
global $wpdb, $user, $current_user, $pagenow, $wp_version;
|
41 |
|
|
|
|
|
42 |
// ADD EVENTS
|
43 |
if(
|
44 |
$pagenow == 'edit-tags.php' ||
|
45 |
$pagenow == 'categories.php'
|
46 |
) {
|
47 |
if(!user_can_richedit()) { return; }
|
48 |
-
|
49 |
-
wp_enqueue_script('post');
|
50 |
-
//if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) return;
|
51 |
-
if(floatval($wp_version) >= 2.7) {
|
52 |
-
// wp_enqueue_script('tiny_mce');
|
53 |
-
wp_enqueue_script('jquery');
|
54 |
-
wp_enqueue_script('thickbox');
|
55 |
-
add_action('admin_head','wp_tiny_mce');
|
56 |
-
} else {
|
57 |
-
wp_enqueue_script('tiny_mce');
|
58 |
-
}
|
59 |
-
wp_enqueue_script('quicktags');
|
60 |
-
add_filter( 'tiny_mce_before_init', 'kws_rt_remove_filter');
|
61 |
-
add_filter( 'tiny_mce_before_init', 'kws_rt_tinymce_settings');
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
|
|
66 |
}
|
67 |
|
68 |
-
wp_enqueue_script('media');
|
69 |
-
wp_enqueue_script('postbox');
|
70 |
-
wp_enqueue_script('media-upload');
|
71 |
-
wp_enqueue_script('swfupload-all');
|
72 |
-
wp_enqueue_script('swfupload-handlers');
|
73 |
-
|
74 |
add_action('init','kws_rt_taxonomy_load_mce');
|
75 |
-
add_action('wp_print_scripts','kws_rt_taxonomy_scripts');
|
76 |
-
|
77 |
-
if(empty($_REQUEST['action'])) {
|
78 |
-
add_filter('get_terms', 'kws_shorten_term_description');
|
79 |
-
}
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
if($pagenow == 'edit-tags.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
|
85 |
-
if(isset($_REQUEST['taxonomy'])) {
|
86 |
-
add_action(esc_attr($_REQUEST['taxonomy']).'_edit_form_fields', 'kws_show_media_upload');
|
87 |
-
} else {
|
88 |
-
add_action('edit_tag_form_fields','kws_show_media_upload'); // Add link to disable Rich Text
|
89 |
add_action('edit_term','kws_rt_taxonomy_save');
|
90 |
}
|
91 |
-
// add_action( 'media_buttons', 'media_buttons' );
|
92 |
-
}
|
93 |
-
|
94 |
-
// Enable shortcodes in category, taxonomy, tag descriptions
|
95 |
-
if(function_exists('term_description')) {
|
96 |
-
add_filter('term_description', 'do_shortcode');
|
97 |
-
} else {
|
98 |
-
add_filter('category_description', 'do_shortcode');
|
99 |
-
}
|
100 |
-
|
101 |
-
add_action('init', 'kws_rt_remove_filter');
|
102 |
-
|
103 |
-
if($pagenow == 'categories.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') { // (!isset($_REQUEST['action']) || $_REQUEST['action'] == 'edit')) {
|
104 |
-
add_action('edit_category_form_fields','kws_show_media_upload'); // Add link to disable Rich Text
|
105 |
-
add_action('edit_category','kws_rt_category_save');
|
106 |
-
}
|
107 |
-
|
108 |
-
|
109 |
-
// LOAD SCRIPTS
|
110 |
-
function kws_rt_taxonomy_load_mce() {
|
111 |
-
$kwsScript = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'kws_rt_taxonomy.js';
|
112 |
-
wp_enqueue_style( 'thickbox' );
|
113 |
-
wp_enqueue_style('editor-buttons');
|
114 |
-
wp_enqueue_script('kws_rte',$kwsScript);
|
115 |
-
}
|
116 |
-
function kws_rt_taxonomy_scripts() {
|
117 |
-
global $pagenow;
|
118 |
-
if( $pagenow == 'edit-tags.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' ||
|
119 |
-
$pagenow == 'categories.php' && $_REQUEST['action'] == 'edit') {
|
120 |
-
echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'kws_rt_taxonomy.css" type="text/css" media="all" />' . "\n";
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
// PROCESS FIELDS
|
125 |
-
function kws_rt_taxonomy_save() {
|
126 |
-
global $tag_ID;
|
127 |
-
$a = array('description');
|
128 |
-
foreach($a as $v) {
|
129 |
-
wp_update_term($tag_ID,$v,$_POST[$v]);
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
-
// PROCESS FIELDS
|
134 |
-
function kws_rt_category_save() {
|
135 |
-
global $cat_ID;
|
136 |
-
$a = array('category_description');
|
137 |
-
foreach($a as $v) {
|
138 |
-
wp_update_category($cat_ID,$v,$_POST[$v]);
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
function kws_show_media_upload() {
|
143 |
-
global $post_ID, $temp_ID, $tag_ID;
|
144 |
-
|
145 |
-
$post_ID = $temp_ID = -1 * time();
|
146 |
-
|
147 |
-
$uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
|
148 |
-
$context = apply_filters('media_buttons_context', __('<div id="editor-toolbar"><div id="media-buttons" class="hide-if-no-js">Upload/Insert %s</div></div>'));
|
149 |
-
$media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
|
150 |
-
$media_title = __('Add Media');
|
151 |
-
$image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&type=image");
|
152 |
-
$image_title = __('Add an Image');
|
153 |
-
$video_upload_iframe_src = apply_filters('video_upload_iframe_src', "$media_upload_iframe_src&type=video");
|
154 |
-
$video_title = __('Add Video');
|
155 |
-
$audio_upload_iframe_src = apply_filters('audio_upload_iframe_src', "$media_upload_iframe_src&type=audio");
|
156 |
-
$audio_title = __('Add Audio');
|
157 |
-
$out = <<<EOF
|
158 |
|
159 |
-
<a href="{$image_upload_iframe_src}&TB_iframe=true" id="add_image" class="thickbox" title='$image_title' onclick="return false;"><img src='images/media-button-image.gif' alt='$image_title' /></a>
|
160 |
-
<a href="{$video_upload_iframe_src}&TB_iframe=true" id="add_video" class="thickbox" title='$video_title' onclick="return false;"><img src='images/media-button-video.gif' alt='$video_title' /></a>
|
161 |
-
<a href="{$audio_upload_iframe_src}&TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title' onclick="return false;"><img src='images/media-button-music.gif' alt='$audio_title' /></a>
|
162 |
-
<a href="{$media_upload_iframe_src}&TB_iframe=true" id="add_media" class="thickbox" title='$media_title' onclick="return false;"><img src='images/media-button-other.gif' alt='$media_title' /></a>
|
163 |
-
EOF;
|
164 |
-
// echo $out;
|
165 |
-
printf($context, $out);
|
166 |
}
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
$
|
175 |
-
if( $pagenow == 'edit-tags.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' ) {
|
176 |
-
$array['editor_selector'] = 'description';
|
177 |
-
} else {
|
178 |
-
$array['editor_selector'] = 'category_description';
|
179 |
-
}
|
180 |
-
}
|
181 |
-
$array['remove_linebreaks'] = false;
|
182 |
-
$array['apply_source_formatting'] = true;
|
183 |
-
return $array;
|
184 |
-
}
|
185 |
-
|
186 |
-
function kws_rt_remove_filter($array) {
|
187 |
-
global $pagenow;
|
188 |
-
if (( is_admin() || defined('DOING_AJAX') ) && current_user_can('manage_categories')) {
|
189 |
-
remove_filter('pre_term_description', 'wp_filter_kses');
|
190 |
-
}
|
191 |
-
return $array;
|
192 |
}
|
193 |
}
|
194 |
|
195 |
-
|
196 |
-
|
|
|
|
|
|
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
$
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
$text = implode(' ', $words);
|
208 |
-
$text = $text . $excerpt_more;
|
209 |
} else {
|
210 |
-
$
|
211 |
}
|
212 |
-
return apply_filters('wp_trim_term_excerpt', force_balance_tags($text), $raw_excerpt);
|
213 |
-
}
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
$term->description = kws_wp_trim_excerpt($term->description);
|
220 |
-
}
|
221 |
}
|
222 |
-
}
|
223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
225 |
|
|
|
|
|
|
|
226 |
?>
|
4 |
Plugin URI: http://www.seodenver.com/rich-text-tags/
|
5 |
Description: This plugin offers rich text editing capabilities for descriptions of tags, categories, and taxonomies.
|
6 |
Author: Katz Web Services, Inc.
|
7 |
+
Version: 1.5
|
8 |
Author URI: http://www.katzwebservices.com
|
9 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
/* Copyright 2012 Katz Web Services, Inc. (email : info@katzwebservices.com.com)
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License as published by
|
31 |
|
32 |
global $wpdb, $user, $current_user, $pagenow, $wp_version;
|
33 |
|
34 |
+
load_plugin_textdomain( 'rich-text-tags', false, '/rich-text-tags/languages' ); // I18n
|
35 |
+
|
36 |
// ADD EVENTS
|
37 |
if(
|
38 |
$pagenow == 'edit-tags.php' ||
|
39 |
$pagenow == 'categories.php'
|
40 |
) {
|
41 |
if(!user_can_richedit()) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
+
$taxonomies = get_taxonomies();
|
44 |
+
|
45 |
+
foreach($taxonomies as $tax) {
|
46 |
+
add_action($tax.'_edit_form_fields', 'kws_add_form');
|
47 |
+
add_action($tax.'_add_form_fields', 'kws_add_form');
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
add_action('init','kws_rt_taxonomy_load_mce');
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
+
if($pagenow == 'edit-tags.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' && empty($_REQUEST['taxonomy'])) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
add_action('edit_term','kws_rt_taxonomy_save');
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
+
}
|
58 |
+
|
59 |
+
// PROCESS FIELDS
|
60 |
+
function kws_rt_taxonomy_save() {
|
61 |
+
global $tag_ID;
|
62 |
+
$a = array('description');
|
63 |
+
foreach($a as $v) {
|
64 |
+
wp_update_term($tag_ID,$v,$_POST[$v]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
// LOAD SCRIPTS
|
69 |
+
function kws_rt_taxonomy_load_mce() {
|
70 |
+
$kwsScript = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'kws_rt_taxonomy.js';
|
71 |
+
wp_enqueue_script('kws_rte',$kwsScript, array('jquery'));
|
72 |
+
}
|
73 |
|
74 |
+
function kws_add_form($taxonomy = ''){
|
75 |
+
global $pagenow;
|
76 |
+
|
77 |
+
$content = is_object($taxonomy) && isset($taxonomy->description) ? $taxonomy->description : '';
|
78 |
+
$content = html_entity_decode($content);
|
79 |
+
|
80 |
+
if( $pagenow == 'edit-tags.php') {
|
81 |
+
$editor_id = 'tag_description';
|
82 |
+
$editor_selector = 'description';
|
|
|
|
|
83 |
} else {
|
84 |
+
$editor_id = $editor_selector = 'category_description';
|
85 |
}
|
|
|
|
|
86 |
|
87 |
+
$css = '
|
88 |
+
<style type="text/css">
|
89 |
+
.wp-editor-container .quicktags-toolbar input.ed_button {
|
90 |
+
width:auto;
|
|
|
|
|
91 |
}
|
92 |
+
.html-active .wp-editor-area { border:0;}
|
93 |
+
</style>';
|
94 |
+
|
95 |
+
?>
|
96 |
+
<tr class="form-field">
|
97 |
+
<th scope="row" valign="top"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
|
98 |
+
<td><?php wp_editor($content, $editor_id,
|
99 |
+
array(
|
100 |
+
'textarea_name' => $editor_selector,
|
101 |
+
'editor_css' => $css,
|
102 |
+
)); ?><br />
|
103 |
+
<span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
|
104 |
+
</tr>
|
105 |
+
<?php
|
106 |
}
|
107 |
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
?>
|
screenshot-1.jpg
CHANGED
Binary file
|
screenshot-2.jpg
CHANGED
Binary file
|