WP-ShowHide - Version 1.03

Version Description

N/A

Download this release

Release Info

Developer GamerZ
Plugin Icon WP-ShowHide
Version 1.03
Comparing to
See all releases

Code changes from version 1.02 to 1.03

Files changed (5) hide show
  1. readme.txt +16 -11
  2. screenshot-1.png +0 -0
  3. screenshot-2.png +0 -0
  4. screenshot-3.png +0 -0
  5. wp-showhide.php +8 -8
readme.txt CHANGED
@@ -3,32 +3,35 @@ Contributors: GamerZ
3
  Donate link: http://lesterchan.net/site/donation/
4
  Tags: show, hide, content, visibility, press release, toggle
5
  Requires at least: 3.0
6
- Tested up to: 3.9
7
- Stable tag: 1.02
8
 
9
  Allows you to embed content within your blog post via WordPress ShortCode API and toggling the visibility of the cotent via a link.
10
 
11
  == Description ==
12
-
13
  By default the content is hidden and user will have to click on the "Show Content" link to toggle it. Similar to what Engadget is doing for their press releases. Example usage: `[showhide type="pressrelease"]Press Release goes in here.[/showhide]`
14
 
15
- = Previous Versions =
16
- * N/A
17
 
18
  = Development =
19
- * [https://github.com/lesterchan/wp-showhide](https://github.com/lesterchan/wp-showhide "https://github.com/lesterchan/wp-showhide")
20
 
21
  = Translations =
22
- * [http://dev.wp-plugins.org/browser/wp-showhide/i18n/](http://dev.wp-plugins.org/browser/wp-showhide/i18n/ "http://dev.wp-plugins.org/browser/wp-showhide/i18n/")
23
 
24
  = Credits =
25
- * N/A
26
 
27
  = Donations =
28
- * I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appericiate it. If not feel free to use it without any obligations.
29
 
30
  == Changelog ==
31
 
 
 
 
 
32
  = Version 1.02 =
33
  * FIXED: Some theme uses `.hide` as `display: none` and hence I have changed `.show` to `.sh-show` and `.hide` to `.sh-hide` to advoid conflicts.
34
 
@@ -58,16 +61,18 @@ By default the content is hidden and user will have to click on the "Show Conten
58
 
59
  1. You can style the content via CSS that is generated by the plugin. Here is a sample of the generated HTML. Note that pressrelease is the default type.
60
  <code>
61
- &lt;div id="pressrelease-link-1" class="pressrelease-link sh-hide"&gt;
62
  &nbsp;&nbsp;&lt;a href="#"&gt;
63
  &nbsp;&nbsp;&nbsp;&nbsp;&lt;span id="pressrelease-toggle-1"&gt;Show Press Release (4 More Words)&lt;/span&gt;
64
  &nbsp;&nbsp;&lt;/a&gt;
65
  &lt;/div&gt;
66
- &lt;div id="pressrelease-content-1" class="pressrelease-content sh-hide" style="display: none;"&gt;Content&lt;/div&gt;
67
  </code>
68
 
69
  2. With the example above, here are the following styles you can use in your CSS:
70
  <code>
 
 
71
  .pressrelease-link { }
72
  .pressrelease-link.sh-hide A { }
73
  .pressrelease-link.sh-show A { }
3
  Donate link: http://lesterchan.net/site/donation/
4
  Tags: show, hide, content, visibility, press release, toggle
5
  Requires at least: 3.0
6
+ Tested up to: 4.1
7
+ Stable tag: 1.03
8
 
9
  Allows you to embed content within your blog post via WordPress ShortCode API and toggling the visibility of the cotent via a link.
10
 
11
  == Description ==
 
12
  By default the content is hidden and user will have to click on the "Show Content" link to toggle it. Similar to what Engadget is doing for their press releases. Example usage: `[showhide type="pressrelease"]Press Release goes in here.[/showhide]`
13
 
14
+ = Build Status =
15
+ [![Build Status](https://travis-ci.org/lesterchan/wp-showhide.svg?branch=master)](https://travis-ci.org/lesterchan/wp-showhide)
16
 
17
  = Development =
18
+ [https://github.com/lesterchan/wp-showhide](https://github.com/lesterchan/wp-showhide "https://github.com/lesterchan/wp-showhide")
19
 
20
  = Translations =
21
+ [http://dev.wp-plugins.org/browser/wp-showhide/i18n/](http://dev.wp-plugins.org/browser/wp-showhide/i18n/ "http://dev.wp-plugins.org/browser/wp-showhide/i18n/")
22
 
23
  = Credits =
24
+ * Plugin icon by [Freepik](http://www.freepik.com) from [Flaticon](http://www.flaticon.com)
25
 
26
  = Donations =
27
+ I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appericiate it. If not feel free to use it without any obligations.
28
 
29
  == Changelog ==
30
 
31
+ = Version 1.03 =
32
+ * NEW: Added `.sh-link` and `.sh-content` as a standard class name on top of the type specific class name.
33
+ * NEW: Added do_shortcode() to allow shortcode to be parsed within ShowHide
34
+
35
  = Version 1.02 =
36
  * FIXED: Some theme uses `.hide` as `display: none` and hence I have changed `.show` to `.sh-show` and `.hide` to `.sh-hide` to advoid conflicts.
37
 
61
 
62
  1. You can style the content via CSS that is generated by the plugin. Here is a sample of the generated HTML. Note that pressrelease is the default type.
63
  <code>
64
+ &lt;div id="pressrelease-link-1" class="sh-link pressrelease-link sh-hide"&gt;
65
  &nbsp;&nbsp;&lt;a href="#"&gt;
66
  &nbsp;&nbsp;&nbsp;&nbsp;&lt;span id="pressrelease-toggle-1"&gt;Show Press Release (4 More Words)&lt;/span&gt;
67
  &nbsp;&nbsp;&lt;/a&gt;
68
  &lt;/div&gt;
69
+ &lt;div id="pressrelease-content-1" class="sh-content pressrelease-content sh-hide" style="display: none;"&gt;Content&lt;/div&gt;
70
  </code>
71
 
72
  2. With the example above, here are the following styles you can use in your CSS:
73
  <code>
74
+ .sh-link A { }
75
+ .sh-content { }
76
  .pressrelease-link { }
77
  .pressrelease-link.sh-hide A { }
78
  .pressrelease-link.sh-show A { }
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
wp-showhide.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-ShowHide
4
  Plugin URI: http://lesterchan.net/portfolio/programming/php/
5
  Description: Allows you to embed content within your blog post via WordPress ShortCode API and toggling the visibility of the cotent via a link. By default the content is hidden and user will have to click on the "Show Content" link to toggle it. Similar to what Engadget is doing for their press releases. Example usage: <code>[showhide type="pressrelease"]Press Release goes in here.[/showhide]</code>
6
- Version: 1.02
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: http://lesterchan.net
9
  Text Domain: wp-showhide
@@ -44,21 +44,21 @@ function showhide_shortcode($atts, $content = null) {
44
  $word_count = number_format_i18n(sizeof(explode(' ', strip_tags($content))));
45
 
46
  // Extract ShortCode Attributes
47
- extract(shortcode_atts(array(
48
  'type' => 'pressrelease',
49
  'more_text' => __('Show Press Release (%s More Words)'),
50
  'less_text' => __('Hide Press Release (%s Less Words)'),
51
  'hidden' => 'yes'
52
- ), $atts));
53
 
54
  // More/Less Text
55
- $more_text = sprintf($more_text, $word_count);
56
- $less_text = sprintf($less_text, $word_count);
57
 
58
  // Determine Whether To Show Or Hide Press Release
59
  $hidden_class = 'sh-hide';
60
  $hidden_css = 'display: none;';
61
- if($hidden == 'no') {
62
  $hidden_class = 'sh-show';
63
  $hidden_css = 'display: block;';
64
  $tmp_text = $more_text;
@@ -67,8 +67,8 @@ function showhide_shortcode($atts, $content = null) {
67
  }
68
 
69
  // Format HTML Output
70
- $output = '<div id="'.$type.'-link-'.$post_id.'" class="'.$type.'-link '.$hidden_class.'"><a href="#" onclick="showhide_toggle(\''.$type.'\', '.$post_id.', \''.esc_js($more_text).'\', \''.esc_js($less_text).'\'); return false;"><span id="'.$type.'-toggle-'.$post_id.'">'.$more_text.'</span></a></div>';
71
- $output .= '<div id="'.$type.'-content-'.$post_id.'" class="'.$type.'-content '.$hidden_class.'" style="'.$hidden_css.'">'.$content.'</div>';
72
 
73
  return $output;
74
  }
3
  Plugin Name: WP-ShowHide
4
  Plugin URI: http://lesterchan.net/portfolio/programming/php/
5
  Description: Allows you to embed content within your blog post via WordPress ShortCode API and toggling the visibility of the cotent via a link. By default the content is hidden and user will have to click on the "Show Content" link to toggle it. Similar to what Engadget is doing for their press releases. Example usage: <code>[showhide type="pressrelease"]Press Release goes in here.[/showhide]</code>
6
+ Version: 1.03
7
  Author: Lester 'GaMerZ' Chan
8
  Author URI: http://lesterchan.net
9
  Text Domain: wp-showhide
44
  $word_count = number_format_i18n(sizeof(explode(' ', strip_tags($content))));
45
 
46
  // Extract ShortCode Attributes
47
+ $attributes = shortcode_atts(array(
48
  'type' => 'pressrelease',
49
  'more_text' => __('Show Press Release (%s More Words)'),
50
  'less_text' => __('Hide Press Release (%s Less Words)'),
51
  'hidden' => 'yes'
52
+ ), $atts);
53
 
54
  // More/Less Text
55
+ $more_text = sprintf($attributes['more_text'], $word_count);
56
+ $less_text = sprintf($attributes['less_text'], $word_count);
57
 
58
  // Determine Whether To Show Or Hide Press Release
59
  $hidden_class = 'sh-hide';
60
  $hidden_css = 'display: none;';
61
+ if($attributes['hidden'] == 'no') {
62
  $hidden_class = 'sh-show';
63
  $hidden_css = 'display: block;';
64
  $tmp_text = $more_text;
67
  }
68
 
69
  // Format HTML Output
70
+ $output = '<div id="'.$attributes['type'].'-link-'.$post_id.'" class="sh-link '.$attributes['type'].'-link '.$hidden_class.'"><a href="#" onclick="showhide_toggle(\''.$attributes['type'].'\', '.$post_id.', \''.esc_js($more_text).'\', \''.esc_js($less_text).'\'); return false;"><span id="'.$attributes['type'].'-toggle-'.$post_id.'">'.$more_text.'</span></a></div>';
71
+ $output .= '<div id="'.$attributes['type'].'-content-'.$post_id.'" class="sh-content '.$attributes['type'].'-content '.$hidden_class.'" style="'.$hidden_css.'">'.do_shortcode( $content ).'</div>';
72
 
73
  return $output;
74
  }