Rich Text Tags - Version 1.7

Version Description

  • Added Media description support
Download this release

Release Info

Developer katzwebdesign
Plugin Icon 128x128 Rich Text Tags
Version 1.7
Comparing to
See all releases

Code changes from version 1.6.3 to 1.7

Files changed (2) hide show
  1. readme.txt +6 -0
  2. rich-text-tags.php +33 -6
readme.txt CHANGED
@@ -37,6 +37,9 @@ Thanks, it's by <a href="http://www.flickr.com/photos/laurenmanning/5659535988/"
37
 
38
  == Upgrade Notice ==
39
 
 
 
 
40
  = 1.6.3 =
41
  * Fixed bug that made the password fields disappear in Edit User & User Profile screens.
42
 
@@ -94,6 +97,9 @@ Thanks, it's by <a href="http://www.flickr.com/photos/laurenmanning/5659535988/"
94
 
95
  == Changelog ==
96
 
 
 
 
97
  = 1.6.3 =
98
  * Fixed bug that made the password fields disappear in Edit User & User Profile screens.
99
 
37
 
38
  == Upgrade Notice ==
39
 
40
+ = 1.7 =
41
+ * Added Media description support
42
+
43
  = 1.6.3 =
44
  * Fixed bug that made the password fields disappear in Edit User & User Profile screens.
45
 
97
 
98
  == Changelog ==
99
 
100
+ = 1.7 =
101
+ * Added Media description support
102
+
103
  = 1.6.3 =
104
  * Fixed bug that made the password fields disappear in Edit User & User Profile screens.
105
 
rich-text-tags.php CHANGED
@@ -4,7 +4,7 @@ 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.6.3
8
  Author URI: http://www.katzwebservices.com
9
  */
10
 
@@ -37,6 +37,7 @@ function kws_rich_text_tags() {
37
  if(
38
  $pagenow == 'edit-tags.php' ||
39
  $pagenow == 'categories.php' ||
 
40
  $pagenow == 'profile.php' ||
41
  $pagenow == 'user-edit.php'
42
  ) {
@@ -51,6 +52,9 @@ function kws_rich_text_tags() {
51
  add_action($tax.'_add_form_fields', 'kws_add_form');
52
  }
53
 
 
 
 
54
  if($pagenow == 'edit-tags.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' && empty($_REQUEST['taxonomy'])) {
55
  add_action('edit_term','kws_rt_taxonomy_save');
56
  }
@@ -81,18 +85,41 @@ function kws_rt_taxonomy_save() {
81
  }
82
  }
83
 
84
-
85
- function kws_add_form($object = ''){
86
- global $pagenow;
87
 
88
- $css = '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  <style type="text/css">
90
  .wp-editor-container .quicktags-toolbar input.ed_button {
91
  width:auto;
92
  }
93
  .html-active .wp-editor-area { border:0;}
94
  </style>';
 
95
 
 
 
 
96
  // This is a profile page
97
  if(is_a($object, 'WP_User')) {
98
  $content = html_entity_decode(get_user_meta($object->ID, 'description', true));
@@ -104,7 +131,7 @@ function kws_add_form($object = ''){
104
  <td><?php wp_editor($content, $editor_id,
105
  array(
106
  'textarea_name' => $editor_selector,
107
- 'editor_css' => $css,
108
  )); ?><br />
109
  <span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td>
110
  </tr>
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.7
8
  Author URI: http://www.katzwebservices.com
9
  */
10
 
37
  if(
38
  $pagenow == 'edit-tags.php' ||
39
  $pagenow == 'categories.php' ||
40
+ $pagenow == 'media.php' ||
41
  $pagenow == 'profile.php' ||
42
  $pagenow == 'user-edit.php'
43
  ) {
52
  add_action($tax.'_add_form_fields', 'kws_add_form');
53
  }
54
 
55
+ add_filter('attachment_fields_to_edit', 'kws_add_form_media', 1, 2);
56
+ add_filter('media_post_single_attachment_fields_to_edit', 'kws_add_form_media', 1, 2);
57
+
58
  if($pagenow == 'edit-tags.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit' && empty($_REQUEST['taxonomy'])) {
59
  add_action('edit_term','kws_rt_taxonomy_save');
60
  }
85
  }
86
  }
87
 
88
+ function kws_add_form_media($form_fields, $post) {
 
 
89
 
90
+ $form_fields['post_content']['input'] = 'html';
91
+
92
+ // We remove the ' and " from the $name so it works for tinyMCE.
93
+ $name = "attachments[$post->ID][post_content]";
94
+
95
+ // Let's grab the editor.
96
+ ob_start();
97
+ wp_editor($post->post_content, $name,
98
+ array(
99
+ 'textarea_name' => $name,
100
+ 'editor_css' => kws_rtt_get_css(),
101
+ )
102
+ );
103
+ $editor = ob_get_clean();
104
+
105
+ $form_fields['post_content']['html'] = $editor;
106
+
107
+ return $form_fields;
108
+ }
109
+
110
+ function kws_rtt_get_css() {
111
+ return '
112
  <style type="text/css">
113
  .wp-editor-container .quicktags-toolbar input.ed_button {
114
  width:auto;
115
  }
116
  .html-active .wp-editor-area { border:0;}
117
  </style>';
118
+ }
119
 
120
+ function kws_add_form($object = ''){
121
+ global $pagenow;
122
+
123
  // This is a profile page
124
  if(is_a($object, 'WP_User')) {
125
  $content = html_entity_decode(get_user_meta($object->ID, 'description', true));
131
  <td><?php wp_editor($content, $editor_id,
132
  array(
133
  'textarea_name' => $editor_selector,
134
+ 'editor_css' => kws_rtt_get_css(),
135
  )); ?><br />
136
  <span class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></span></td>
137
  </tr>