Rich Text Tags - Version 1.7.2

Version Description

  • Re-added shortened term descriptions in Term view.
Download this release

Release Info

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

Code changes from version 1.7.1 to 1.7.2

Files changed (2) hide show
  1. readme.txt +6 -0
  2. rich-text-tags.php +36 -7
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.7.1 =
41
  * Fixed HTML "quick tags" button width
42
 
@@ -100,6 +103,9 @@ Thanks, it's by <a href="http://www.flickr.com/photos/laurenmanning/5659535988/"
100
 
101
  == Changelog ==
102
 
 
 
 
103
  = 1.7.1 =
104
  * Fixed HTML "quick tags" button width
105
 
37
 
38
  == Upgrade Notice ==
39
 
40
+ = 1.7.2 =
41
+ * Re-added shortened term descriptions in Term view.
42
+
43
  = 1.7.1 =
44
  * Fixed HTML "quick tags" button width
45
 
103
 
104
  == Changelog ==
105
 
106
+ = 1.7.2 =
107
+ * Re-added shortened term descriptions in Term view.
108
+
109
  = 1.7.1 =
110
  * Fixed HTML "quick tags" button width
111
 
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.7.1
8
  Author URI: http://www.katzwebservices.com
9
  */
10
 
@@ -44,6 +44,7 @@ function kws_rich_text_tags() {
44
  if(!user_can_richedit()) { return; }
45
 
46
  wp_enqueue_script('kws_rte', plugins_url('kws_rt_taxonomy.js', __FILE__), array('jquery'));
 
47
 
48
  $taxonomies = get_taxonomies();
49
 
@@ -66,6 +67,10 @@ function kws_rich_text_tags() {
66
  add_action('show_user_profile', 'kws_add_form', 1);
67
  add_action('edit_user_profile', 'kws_add_form', 1);
68
  add_action('edit_user_profile_update', 'kws_rt_taxonomy_save');
 
 
 
 
69
  }
70
 
71
  // Enable shortcodes in category, taxonomy, tag descriptions
@@ -118,17 +123,14 @@ function kws_rtt_get_css() {
118
  }
119
 
120
  function kws_add_form($object = ''){
121
- global $pagenow;
122
-
123
- ?>
124
 
125
  <style type="text/css">
126
  .quicktags-toolbar input { width:auto!important; }
127
  .wp-editor-area {border: none!important;}
128
  </style>
129
 
130
- <?php
131
-
132
  // This is a profile page
133
  if(is_a($object, 'WP_User')) {
134
  $content = html_entity_decode(get_user_meta($object->ID, 'description', true));
@@ -162,7 +164,8 @@ function kws_add_form($object = ''){
162
  <th scope="row" valign="top"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
163
  <td><?php wp_editor($content, $editor_id,
164
  array(
165
- 'textarea_name' => $editor_selector
 
166
  )); ?><br />
167
  <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
168
  </tr>
@@ -172,3 +175,29 @@ function kws_add_form($object = ''){
172
 
173
  }
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.2
8
  Author URI: http://www.katzwebservices.com
9
  */
10
 
44
  if(!user_can_richedit()) { return; }
45
 
46
  wp_enqueue_script('kws_rte', plugins_url('kws_rt_taxonomy.js', __FILE__), array('jquery'));
47
+ wp_enqueue_style('editor-buttons');
48
 
49
  $taxonomies = get_taxonomies();
50
 
67
  add_action('show_user_profile', 'kws_add_form', 1);
68
  add_action('edit_user_profile', 'kws_add_form', 1);
69
  add_action('edit_user_profile_update', 'kws_rt_taxonomy_save');
70
+
71
+ if(empty($_REQUEST['action'])) {
72
+ add_filter('get_terms', 'kws_shorten_term_description');
73
+ }
74
  }
75
 
76
  // Enable shortcodes in category, taxonomy, tag descriptions
123
  }
124
 
125
  function kws_add_form($object = ''){
126
+ global $pagenow;?>
 
 
127
 
128
  <style type="text/css">
129
  .quicktags-toolbar input { width:auto!important; }
130
  .wp-editor-area {border: none!important;}
131
  </style>
132
 
133
+ <?php
 
134
  // This is a profile page
135
  if(is_a($object, 'WP_User')) {
136
  $content = html_entity_decode(get_user_meta($object->ID, 'description', true));
164
  <th scope="row" valign="top"><label for="description"><?php _ex('Description', 'Taxonomy Description'); ?></label></th>
165
  <td><?php wp_editor($content, $editor_id,
166
  array(
167
+ 'textarea_name' => $editor_selector,
168
+ 'editor_css' => $css,
169
  )); ?><br />
170
  <span class="description"><?php _e('The description is not prominent by default, however some themes may show it.'); ?></span></td>
171
  </tr>
175
 
176
  }
177
 
178
+ function kws_wp_trim_excerpt($text) {
179
+ $raw_excerpt = $text;
180
+ $text = str_replace(']]>', ']]&gt;', $text);
181
+ $excerpt_length = apply_filters('term_excerpt_length', 40);
182
+ $excerpt_more = ' ' . '[...]';
183
+ $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
184
+ if ( count($words) > $excerpt_length ) {
185
+ array_pop($words);
186
+ $text = implode(' ', $words);
187
+ $text = $text . $excerpt_more;
188
+ } else {
189
+ $text = implode(' ', $words);
190
+ }
191
+ return apply_filters('wp_trim_term_excerpt', force_balance_tags($text), $raw_excerpt);
192
+ }
193
+
194
+ function kws_shorten_term_description($terms = array(), $taxonomies = null, $args = array()) {
195
+ if(is_array($terms)) {
196
+ foreach($terms as $key=>$term) {
197
+ if(is_object($term) && isset($term->description)) {
198
+ $term->description = kws_wp_trim_excerpt($term->description);
199
+ }
200
+ }
201
+ }
202
+ return $terms;
203
+ }