Accordion Shortcodes - Version 1.2

Version Description

  • Fixed a potential error with headers already being sent
  • Fixed an issue with the SVN repo
  • Code cleanup
Download this release

Release Info

Developer philbuchanan
Plugin Icon 128x128 Accordion Shortcodes
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.2 to 1.2

accordion-shortcodes.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Accordion Shortcodes
4
  * Description: Adds a few shortcodes to allow for accordion dropdowns.
5
- * Version: 1.1.1
6
  * Author: Phil Buchanan
7
  * Author URI: http://philbuchanan.com
8
  */
@@ -46,7 +46,7 @@ class Accordion_Shortcodes {
46
  # Registers the minified accordion JavaScript file
47
  static function register_script() {
48
 
49
- wp_register_script('accordion-shortcodes-script', plugins_url('accordion.min.js', __FILE__), array('jquery'), '1.1.1', true);
50
 
51
  }
52
 
@@ -103,9 +103,10 @@ class Accordion_Shortcodes {
103
  # Add documentation link on plugin page
104
  static function add_documentation_link($links) {
105
 
106
- $settings_link = '<a href="http://wordpress.org/plugins/accordion-shortcodes/">' . __('Documentation', 'accordion_shortcodes') . '</a>';
107
-
108
- array_push($links, $settings_link);
 
109
 
110
  return $links;
111
 
@@ -115,6 +116,4 @@ class Accordion_Shortcodes {
115
 
116
  $Accordion_Shortcodes = new Accordion_Shortcodes;
117
 
118
- endif;
119
-
120
- ?>
2
  /**
3
  * Plugin Name: Accordion Shortcodes
4
  * Description: Adds a few shortcodes to allow for accordion dropdowns.
5
+ * Version: 1.2
6
  * Author: Phil Buchanan
7
  * Author URI: http://philbuchanan.com
8
  */
46
  # Registers the minified accordion JavaScript file
47
  static function register_script() {
48
 
49
+ wp_register_script('accordion-shortcodes-script', plugins_url('accordion.min.js', __FILE__), array('jquery'), '1.2', true);
50
 
51
  }
52
 
103
  # Add documentation link on plugin page
104
  static function add_documentation_link($links) {
105
 
106
+ array_push($links, sprintf('<a href="%s">%s</a>',
107
+ 'http://wordpress.org/plugins/accordion-shortcodes/',
108
+ __('Documentation', 'accordion_shortcodes')
109
+ ));
110
 
111
  return $links;
112
 
116
 
117
  $Accordion_Shortcodes = new Accordion_Shortcodes;
118
 
119
+ endif;
 
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate Link: http://philbuchanan.com/
5
  Tags: accordion, accordions, shortcodes
6
  Requires at least: 3.3
7
  Tested up to: 3.8
8
- Stable tag: 1.1.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -118,10 +118,14 @@ You can also set the HTML tag for the titles of each item by added `tag="tagname
118
  For bug reports or feature requests or if you'd like to contribute to the plugin you can check everything out on [Github](https://github.com/philbuchanan/Accordion-Shortcodes/).
119
 
120
  == Changelog ==
121
- = 1.1.1=
 
 
 
 
 
122
  * Added link to documentation from plugins page
123
  * Added FAQs to readme
124
- * Added screenshots
125
 
126
  = 1.1 =
127
  * **WARNING**: This update makes HTML structure changes and will require changes to your CSS
@@ -151,6 +155,9 @@ For bug reports or feature requests or if you'd like to contribute to the plugin
151
  * Initial release
152
 
153
  == Upgrade Notice ==
 
 
 
154
  = 1.1.1 =
155
  Added a link to plugin documentation from the plugins page for easy access.
156
 
5
  Tags: accordion, accordions, shortcodes
6
  Requires at least: 3.3
7
  Tested up to: 3.8
8
+ Stable tag: 1.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
118
  For bug reports or feature requests or if you'd like to contribute to the plugin you can check everything out on [Github](https://github.com/philbuchanan/Accordion-Shortcodes/).
119
 
120
  == Changelog ==
121
+ = 1.2 =
122
+ * Fixed a potential error with headers already being sent
123
+ * Fixed an issue with the SVN repo
124
+ * Code cleanup
125
+
126
+ = 1.1.1 =
127
  * Added link to documentation from plugins page
128
  * Added FAQs to readme
 
129
 
130
  = 1.1 =
131
  * **WARNING**: This update makes HTML structure changes and will require changes to your CSS
155
  * Initial release
156
 
157
  == Upgrade Notice ==
158
+ = 1.2 =
159
+ General code cleanup and bug fixes.
160
+
161
  = 1.1.1 =
162
  Added a link to plugin documentation from the plugins page for easy access.
163
 
trunk/accordion-shortcodes.php DELETED
@@ -1,120 +0,0 @@
1
- <?php
2
- /**
3
- * Plugin Name: Accordion Shortcodes
4
- * Description: Adds a few shortcodes to allow for accordion dropdowns.
5
- * Version: 1.1.2
6
- * Author: Phil Buchanan
7
- * Author URI: http://philbuchanan.com
8
- */
9
-
10
- # Make sure to not redeclare the class
11
- if (!class_exists('Accordion_Shortcodes')) :
12
-
13
- class Accordion_Shortcodes {
14
-
15
- static $add_script;
16
-
17
- function __construct() {
18
-
19
- $basename = plugin_basename(__FILE__);
20
-
21
- # Load text domain
22
- load_plugin_textdomain('accordion_shortcodes', false, dirname($basename) . '/languages/');
23
-
24
- # Register JavaScript
25
- add_action('wp_enqueue_scripts', array(__CLASS__, 'register_script'));
26
-
27
- # Add shortcodes
28
- add_shortcode('accordion', array(__CLASS__, 'accordion_shortcode'));
29
- add_shortcode('accordion-item', array(__CLASS__, 'accordion_item_shortcode'));
30
-
31
- # Print script in wp_footer
32
- add_action('wp_footer', array(__CLASS__, 'print_script'));
33
-
34
- # Add link to documentation
35
- add_filter("plugin_action_links_$basename", array(__CLASS__, 'add_documentation_link'));
36
-
37
- }
38
-
39
- # Checks for boolean value
40
- static function parse_boolean($value) {
41
-
42
- return filter_var($value, FILTER_VALIDATE_BOOLEAN);
43
-
44
- }
45
-
46
- # Registers the minified accordion JavaScript file
47
- static function register_script() {
48
-
49
- wp_register_script('accordion-shortcodes-script', plugins_url('accordion.min.js', __FILE__), array('jquery'), '1.1.2', true);
50
-
51
- }
52
-
53
- # Prints the minified accordion JavaScript file in the footer
54
- static function print_script() {
55
-
56
- # Check to see if shortcodes are used on page
57
- if (!self::$add_script) return;
58
-
59
- wp_enqueue_script('accordion-shortcodes-script');
60
-
61
- }
62
-
63
- # Accordion wrapper shortcode
64
- static function accordion_shortcode($atts, $content = null) {
65
-
66
- # The shortcode is used on the page, so we'll need to load the JavaScript
67
- self::$add_script = true;
68
-
69
- extract(shortcode_atts(array(
70
- 'autoclose' => true,
71
- 'openfirst' => false,
72
- 'clicktoclose' => false
73
- ), $atts));
74
-
75
- # Set settings object (for use in JavaScript)
76
- $script_data = array(
77
- 'autoClose' => self::parse_boolean($autoclose),
78
- 'openFirst' => self::parse_boolean($openfirst),
79
- 'clickToClose' => self::parse_boolean($clicktoclose)
80
- );
81
- wp_localize_script('accordion-shortcodes-script', 'accordionSettings', $script_data);
82
-
83
- return '<div class="accordion">' . do_shortcode($content) . '</div>';
84
-
85
- }
86
-
87
- # Accordion item shortcode
88
- static function accordion_item_shortcode($atts, $content = null) {
89
-
90
- extract(shortcode_atts(array(
91
- 'title' => '',
92
- 'tag' => 'h3'
93
- ), $atts));
94
-
95
- return sprintf('<%3$s class="accordion-title">%1$s</%3$s><div class="accordion-content">%2$s</div>',
96
- $title ? $title : '<span style="color:red;">' . __('Please enter a title attribute: [accordion-item title="Item title"]', 'accordion_shortcodes') . '</span>',
97
- do_shortcode($content),
98
- $tag
99
- );
100
-
101
- }
102
-
103
- # Add documentation link on plugin page
104
- static function add_documentation_link($links) {
105
-
106
- $settings_link = '<a href="http://wordpress.org/plugins/accordion-shortcodes/">' . __('Documentation', 'accordion_shortcodes') . '</a>';
107
-
108
- array_push($links, $settings_link);
109
-
110
- return $links;
111
-
112
- }
113
-
114
- }
115
-
116
- $Accordion_Shortcodes = new Accordion_Shortcodes;
117
-
118
- endif;
119
-
120
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/accordion.js DELETED
@@ -1,54 +0,0 @@
1
- (function($) {
2
- 'use strict';
3
-
4
- var allTitles = $('.accordion-title'),
5
- allPanels = $('.accordion-content').hide(),
6
- firstPanel = $('.accordion-content:first-of-type'),
7
- duration = 250,
8
- settings = {
9
- // Set defaults
10
- autoClose: true,
11
- openFirst: false,
12
- clickToClose: false
13
- };
14
-
15
- // Check for accordion settings variable passed from WordPress
16
- if (typeof accordionSettings !== 'undefined') {
17
- settings = accordionSettings;
18
- }
19
-
20
- // Open the first accordion item
21
- if (settings.openFirst) {
22
- firstPanel.prev().addClass('open');
23
- firstPanel.slideDown(duration);
24
- }
25
-
26
- // Add event listener
27
- allTitles.click(function() {
28
-
29
- // Only open the item if item isn't already open
30
- if (!$(this).hasClass('open')) {
31
-
32
- // Close all accordion items
33
- if (settings.autoClose) {
34
- allPanels.slideUp(duration);
35
- allTitles.removeClass('open');
36
- }
37
-
38
- // Open clicked item
39
- $(this).next().slideDown(duration);
40
- $(this).addClass('open');
41
-
42
- }
43
- // If item is open, close it
44
- else if (settings.clickToClose) {
45
-
46
- $(this).next().slideUp(duration);
47
- $(this).removeClass('open');
48
-
49
- }
50
- return false;
51
-
52
- });
53
-
54
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/accordion.min.js DELETED
@@ -1 +0,0 @@
1
- (function(e){"use strict";var t=e(".accordion-title"),n=e(".accordion-content").hide(),r=e(".accordion-content:first-of-type"),i=250,s={autoClose:true,openFirst:false,clickToClose:false};if(typeof accordionSettings!=="undefined"){s=accordionSettings}if(s.openFirst){r.prev().addClass("open");r.slideDown(i)}t.click(function(){if(!e(this).hasClass("open")){if(s.autoClose){n.slideUp(i);t.removeClass("open")}e(this).next().slideDown(i);e(this).addClass("open")}else if(s.clickToClose){e(this).next().slideUp(i);e(this).removeClass("open")}return false})})(jQuery)
 
trunk/assets/screenshot-1.jpg DELETED
Binary file
trunk/assets/screenshot-2.jpg DELETED
Binary file
trunk/languages/default.po DELETED
@@ -1,24 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Accordion Shortcodes\n"
4
- "POT-Creation-Date: 2014-01-22 09:48-0500\n"
5
- "PO-Revision-Date: 2014-01-22 09:51-0500\n"
6
- "Last-Translator: Phil Buchanan <info@philbuchanan.com>\n"
7
- "Language-Team: \n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=UTF-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Generator: Poedit 1.6.3\n"
12
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
13
- "X-Poedit-Basepath: .\n"
14
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
- "Language: en_CA\n"
16
- "X-Poedit-SearchPath-0: ..\n"
17
-
18
- #: ../accordion-shortcodes.php:96
19
- msgid "Please enter a title attribute: [accordion-item title=\"Item title\"]"
20
- msgstr ""
21
-
22
- #: ../accordion-shortcodes.php:106
23
- msgid "Documentation"
24
- msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/languages/es_ES.mo DELETED
Binary file
trunk/languages/fr_FR.mo DELETED
Binary file
trunk/readme.txt DELETED
@@ -1,179 +0,0 @@
1
- === Accordion Shortcodes ===
2
- Contributors: philbuchanan
3
- Author URI: http://philbuchanan.com/
4
- Donate Link: http://philbuchanan.com/
5
- Tags: accordion, accordions, shortcodes
6
- Requires at least: 3.3
7
- Tested up to: 3.8
8
- Stable tag: 1.1.2
9
- License: GPLv2 or later
10
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
-
12
- Adds a few shortcodes to allow for accordion dropdowns.
13
-
14
- == Description ==
15
- Adds a few shortcodes to allow for accordion dropdowns.
16
-
17
- **NOTE:** If you are not comfortable with WordPress shortcodes, this plugin may not be for you.
18
-
19
- = Features =
20
-
21
- * Adds two shortcodes for adding an accordion to your site
22
- * No default CSS added
23
- * Only adds JavaScript on pages that use the shortcodes
24
- * Set the HTML tag for the title element of each item (optional)
25
- * Open the first accordion item by default (optional)
26
- * Disable auto closing of accordion items (optinoal)
27
- * Manually close items by clicking the title again (optional)
28
-
29
- = The Shortcodes =
30
-
31
- The two shortcodes that are added are:
32
-
33
- `[accordion]`
34
-
35
- and
36
-
37
- `[accordion-item title="" tag=""]`
38
-
39
- = Basic Usage Example =
40
-
41
- [accordion]
42
- [accordion-item title="Title of accordion item"]Dropdown content goes here.[/accordion-item]
43
- [accordion-item title="Second accordion item"]Dropdown content goes here.[/accordion-item]
44
- [/accordion]
45
-
46
- This will output the following HTML:
47
-
48
- <div class="accordion">
49
- <h3 class="accordion-title">Title of accordion item</h3>
50
- <div class="accordion-content">
51
- Dropdown content goes here.
52
- </div>
53
- <h3 class="accordion-title">Second accordion item</h3>
54
- <div class="accordion-content">
55
- Dropdown content goes here.
56
- </div>
57
- </div>
58
-
59
- = Advanced Settings =
60
-
61
- There are a few [advances settings](http://wordpress.org/plugins/accordion-shortcodes/other_notes/) for the plugin.
62
-
63
- == Installation ==
64
- 1. Upload the 'accordion-shortcodes' folder to the '/wp-content/plugins/' directory.
65
- 2. Activate the plugin through the Plugins menu in WordPress.
66
- 3. Add the shortcodes to your content.
67
- 4. Add some [CSS](http://wordpress.org/plugins/accordion-shortcodes/other_notes/#Other-Notes) to your themes stylesheet to make the accordion look the way you want.
68
-
69
- == Frequently Asked Questions ==
70
-
71
- = Why isn't the JavaScript file loading on my site? =
72
-
73
- This is most likely caused by a poorly coded theme. The plugin makes use of the `wp_footer()` function to load the JavaScript file and it's dependancy (jQuery). Check your theme to ensure that the `wp_footer()` function is being called right before the closing `</body>` tag in your themes footer.php file.
74
-
75
- = How can I change the look of the accordion? =
76
- No CSS is added by default to the accordion.
77
-
78
- Changing the look and feel of the plugin requires you to be comfortable with editing your themes stylesheet. If you are familier with that process, you can add some [CSS](http://wordpress.org/plugins/accordion-shortcodes/other_notes/#Other-Notes) to make the accordion look the way you want.
79
-
80
- == Other Notes ==
81
-
82
- = Sample CSS =
83
-
84
- Here is some sample CSS to get you started if you want to customize the look and feel of the accordion.
85
-
86
- /* Accordion Styles */
87
- .accordion {
88
- border-bottom: 1px solid #dbdbdb;
89
- margin-bottom: 20px;
90
- }
91
- .accordion-title {
92
- border-top: 1px solid #dbdbdb;
93
- margin: 0;
94
- padding: 20px 0;
95
- cursor: pointer;
96
- }
97
- .accordion-title:hover {}
98
- .accordion-title:first-child {border: none;}
99
- .accordion-title.open {cursor: default;}
100
- .accordion-content {padding-bottom: 20px;}
101
-
102
- = Advanced Settings =
103
-
104
- There are a few advanced settings you can add to the opening accordion shortcode. The full shortcode, with all the default settings looks like this:
105
-
106
- [accordion autoclose="true" openfirst="false" clicktoclose="false"]
107
-
108
- **autoclose**: Sets whether accordion items close automatically when you open the next item. Set `autoclose="true/false"` on the opening accordion tag like this: `[accordion autoclose="false"]`. Default is `true`.
109
-
110
- **openfirst**: Sets whether the first accordion item is open by default. Set `openfirst="true/false"` on the opening accordion tag like this: `[accordion openfirst="true"]`. Default is `false`.
111
-
112
- **clicktoclose**: Sets whether clicking an open title closes it. Set `clicktoclose="true/false"` on the opening accordion tag like this: `[accordion clicktoclose="true"]`. Default is `false`.
113
-
114
- You can also set the HTML tag for the titles of each item by added `tag="tagname"` to each `[accordion-item]` shortcode. Make sure to **not** include the angle brackets around the tag name. Example: to use `<h2>` instead of the default `<h3>` tag: `[accordion-item title="Item title" tag="h2"]Item content[/accordion-item]`
115
-
116
- = Issues/Suggestions =
117
-
118
- For bug reports or feature requests or if you'd like to contribute to the plugin you can check everything out on [Github](https://github.com/philbuchanan/Accordion-Shortcodes/).
119
-
120
- == Changelog ==
121
- = 1.1.2 =
122
- * Fixed an issue with the readme change log
123
-
124
- = 1.1.1 =
125
- * Added link to documentation from plugins page
126
- * Added FAQs to readme
127
- * Added screenshots
128
-
129
- = 1.1 =
130
- * **WARNING**: This update makes HTML structure changes and will require changes to your CSS
131
- * New HTML structure, based on class names
132
- * HTML now validates properly
133
- * Added localization support for error messages
134
-
135
- = 1.0.4 =
136
- * Added option to close an open item by clicking the title
137
-
138
- = 1.0.3 =
139
- * Added option to open the first item by default
140
- * Fixed an issue where clicking an already open item will close and reopen it
141
- * Added better inline documentation
142
- * Added minified JavaScript file
143
-
144
- = 1.0.2 =
145
- * Added setting to disable auto closing of accordion items
146
- * Better handling of accordion items with no title attribute set
147
- * Updated minimum WordPress version requirement (should still work down to 2.8, but not supported)
148
-
149
- = 1.0.1 =
150
- * Checks if the class exists before trying to create it
151
- * Updated readme
152
-
153
- = 1.0 =
154
- * Initial release
155
-
156
- == Upgrade Notice ==
157
- = 1.1.2 =
158
- Fixed an issue with the readme change log.
159
-
160
- = 1.1.1 =
161
- Added a link to plugin documentation from the plugins page for easy access.
162
-
163
- = 1.1 =
164
- **WARNING**: This update makes HTML structure changes and will require changes to your CSS.
165
-
166
- = 1.0.4 =
167
- Added an option to close an item by clicking the title.
168
-
169
- = 1.0.3 =
170
- Added an option to open the first item by default. Fixed a bug that caused open items to close and reopen when clicking them.
171
-
172
- = 1.0.2 =
173
- Added an option to disable auto closing of accordion items.
174
-
175
- = 1.0.1 =
176
- Minor code updates.
177
-
178
- = 1.0 =
179
- Initial release.