Genesis Simple Sidebars - Version 0.9.2

Version Description

  • Added support for custom taxonomies
  • Added translation support
  • bug fix to prevent invalid sidebar creation
Download this release

Release Info

Developer wpmuguru
Plugin Icon 128x128 Genesis Simple Sidebars
Version 0.9.2
Comparing to
See all releases

Code changes from version 0.9.1 to 0.9.2

Files changed (9) hide show
  1. admin.php +2 -2
  2. functions.php +9 -1
  3. inpost.php +9 -2
  4. languages/ss-de_DE.mo +0 -0
  5. languages/ss-de_DE.po +226 -0
  6. languages/ss.po +148 -0
  7. plugin.php +63 -36
  8. readme.txt +9 -4
  9. term.php +8 -2
admin.php CHANGED
@@ -5,7 +5,7 @@
5
  add_action('admin_init', 'register_ss_settings');
6
  function register_ss_settings() {
7
  register_setting(SS_SETTINGS_FIELD, SS_SETTINGS_FIELD);
8
- add_option(SS_SETTINGS_FIELD, '__return_empty_array', '', 'yes');
9
  }
10
 
11
  /**
@@ -96,7 +96,7 @@ function ss_settings_admin() { ?>
96
 
97
  </table>
98
 
99
- <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update', 'ee'); ?>" /></p>
100
 
101
  </form>
102
 
5
  add_action('admin_init', 'register_ss_settings');
6
  function register_ss_settings() {
7
  register_setting(SS_SETTINGS_FIELD, SS_SETTINGS_FIELD);
8
+ add_option(SS_SETTINGS_FIELD, array(), '', 'yes');
9
  }
10
 
11
  /**
96
 
97
  </table>
98
 
99
+ <p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update', 'ss'); ?>" /></p>
100
 
101
  </form>
102
 
functions.php CHANGED
@@ -50,6 +50,10 @@ function ss_create_sidebar( $args = array() ) {
50
  // nonce verification
51
  check_admin_referer('simple-sidebars-action_create-sidebar');
52
 
 
 
 
 
53
  $db = (array)get_option(SS_SETTINGS_FIELD);
54
  $new = array(
55
  sanitize_title_with_dashes( $args['id'] ) => array(
@@ -81,6 +85,10 @@ function ss_edit_sidebar( $args = array() ) {
81
  // nonce verification
82
  check_admin_referer('simple-sidebars-action_edit-sidebar');
83
 
 
 
 
 
84
  $db = (array)get_option(SS_SETTINGS_FIELD);
85
  $new = array(
86
  sanitize_title_with_dashes( $args['id'] ) => array(
@@ -137,7 +145,7 @@ function ss_error_message( $error = false ) {
137
  return __('Oops! Please choose a valid Name and ID for this sidebar', 'ss');
138
  break;
139
  case 2:
140
- return __('Oops! That sidebar ID already exists');
141
  break;
142
  case 3:
143
  return __('Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'ss');
50
  // nonce verification
51
  check_admin_referer('simple-sidebars-action_create-sidebar');
52
 
53
+ // WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user
54
+ if ( is_numeric( $args['id'] ) )
55
+ $args['id'] = sanitize_title_with_dashes( $args['name'] );
56
+
57
  $db = (array)get_option(SS_SETTINGS_FIELD);
58
  $new = array(
59
  sanitize_title_with_dashes( $args['id'] ) => array(
85
  // nonce verification
86
  check_admin_referer('simple-sidebars-action_edit-sidebar');
87
 
88
+ // WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user
89
+ if ( is_numeric( $args['id'] ) )
90
+ $args['id'] = sanitize_title_with_dashes( $args['name'] );
91
+
92
  $db = (array)get_option(SS_SETTINGS_FIELD);
93
  $new = array(
94
  sanitize_title_with_dashes( $args['id'] ) => array(
145
  return __('Oops! Please choose a valid Name and ID for this sidebar', 'ss');
146
  break;
147
  case 2:
148
+ return __('Oops! That sidebar ID already exists', 'ss');
149
  break;
150
  case 3:
151
  return __('Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'ss');
inpost.php CHANGED
@@ -7,7 +7,7 @@ add_action('admin_menu', 'ss_add_inpost_metabox');
7
  function ss_add_inpost_metabox() {
8
  foreach ( (array)get_post_types( array( 'public' => true ) ) as $type ) {
9
  if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || $type == 'post' || $type == 'page' ) {
10
- add_meta_box('ss_inpost_metabox', __('Sidebar Selection', 'genesis'), 'ss_inpost_metabox', $type, 'side', 'low');
11
  }
12
  }
13
  }
@@ -29,7 +29,14 @@ function ss_inpost_metabox() {
29
  ?>
30
  </select>
31
  </p>
32
-
 
 
 
 
 
 
 
33
  <p>
34
  <label class="howto" for="_ss_sidebar_alt"><span><?php _e('Secondary Sidebar', 'ss'); ?><span></label>
35
  <select name="_ss_sidebar_alt" id="_ss_sidebar_alt" style="width: 99%">
7
  function ss_add_inpost_metabox() {
8
  foreach ( (array)get_post_types( array( 'public' => true ) ) as $type ) {
9
  if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || $type == 'post' || $type == 'page' ) {
10
+ add_meta_box('ss_inpost_metabox', __('Sidebar Selection', 'ss'), 'ss_inpost_metabox', $type, 'side', 'low');
11
  }
12
  }
13
  }
29
  ?>
30
  </select>
31
  </p>
32
+ <?php
33
+ // don't show the option if there are no 3 column layouts registered
34
+ $_layouts = (array) genesis_get_layouts();
35
+ $_layouts = array_keys( $_layouts );
36
+ $_3_column = array_intersect( $_layouts, array( 'content-sidebar-sidebar', 'sidebar-content-sidebar', 'sidebar-sidebar-content' ) );
37
+ if ( empty( $_3_column ) )
38
+ return;
39
+ ?>
40
  <p>
41
  <label class="howto" for="_ss_sidebar_alt"><span><?php _e('Secondary Sidebar', 'ss'); ?><span></label>
42
  <select name="_ss_sidebar_alt" id="_ss_sidebar_alt" style="width: 99%">
languages/ss-de_DE.mo ADDED
Binary file
languages/ss-de_DE.po ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2011 Genesis Layout Extras by David Decker of deckerweb.de
2
+ # This file is distributed under the same license as the Genesis Layout Extras package.
3
+ #
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: Genesis Simple Sidebars (Plugin)\n"
7
+ "Report-Msgid-Bugs-To: http://wordpress.org/tags/genesis-simple-sidebars\n"
8
+ "POT-Creation-Date: 2011-12-24 01:10+0100\n"
9
+ "PO-Revision-Date: 2011-12-24 01:18+0100\n"
10
+ "Last-Translator: David Decker <deckerweb.mobil@googlemail.com>\n"
11
+ "Language-Team: DECKERWEB <deckerweb.mobil@googlemail.com>\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
16
+ "X-Poedit-Language: German\n"
17
+ "X-Poedit-Country: GERMANY\n"
18
+ "X-Poedit-SourceCharset: utf-8\n"
19
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
20
+ "X-Textdomain-Support: yes\n"
21
+ "X-Poedit-SearchPath-0: .\n"
22
+
23
+ #@ ss
24
+ #: admin.php:17
25
+ msgid "Simple Sidebars"
26
+ msgstr "Einfache Sidebars"
27
+
28
+ #@ ss
29
+ #: admin.php:66
30
+ msgid "Nice try, partner. But that sidebar doesn't exist. Click back and try again."
31
+ msgstr "Netter Versuch, doch leider existiert diese Sidebar nicht. Gehen Sie zurück und versuchen Sie es erneut."
32
+
33
+ #@ ss
34
+ #: admin.php:72
35
+ msgid "Edit Sidebar"
36
+ msgstr "Sidebar bearbeiten"
37
+
38
+ #@ ss
39
+ #: admin.php:79
40
+ #: admin.php:117
41
+ #: admin.php:125
42
+ #: admin.php:152
43
+ msgid "Name"
44
+ msgstr "Name"
45
+
46
+ #@ ss
47
+ #: admin.php:81
48
+ #: admin.php:154
49
+ msgid "A recognizable name for your new sidebar widget area"
50
+ msgstr "Ein passender Name für Ihren neuen Sidebar-Widget-Bereich"
51
+
52
+ #@ ss
53
+ #: admin.php:85
54
+ #: admin.php:118
55
+ #: admin.php:126
56
+ #: admin.php:158
57
+ msgid "ID"
58
+ msgstr "ID"
59
+
60
+ #@ ss
61
+ #: admin.php:89
62
+ msgid "The unique ID is used to register the sidebar widget area (cannot be changed)"
63
+ msgstr "Die einzigartige ID wird verwendet, um den Sidebar-Widget-Bereich zu registrieren. Diese ID kann nicht verändert werden. Verwenden Sie am besten nur kleinbuchstaben, Bindestriche (Minus) und Zahlen."
64
+
65
+ #@ ss
66
+ #: admin.php:93
67
+ #: admin.php:119
68
+ #: admin.php:127
69
+ #: admin.php:164
70
+ msgid "Description"
71
+ msgstr "Beschreibung"
72
+
73
+ #@ ss
74
+ #: admin.php:99
75
+ msgid "Update"
76
+ msgstr "Aktualisieren"
77
+
78
+ #@ ss
79
+ #: admin.php:106
80
+ msgid "Genesis - Simple Sidebars"
81
+ msgstr "Genesis - Einfache Sidebars"
82
+
83
+ #@ ss
84
+ #: admin.php:113
85
+ msgid "Current Sidebars"
86
+ msgstr "Aktuelle Sidebars"
87
+
88
+ #@ ss
89
+ #: admin.php:146
90
+ #: admin.php:168
91
+ msgid "Add New Sidebar"
92
+ msgstr "Neue Sidebar hinzufügen"
93
+
94
+ #@ ss
95
+ #: admin.php:160
96
+ msgid "The unique ID is used to register the sidebar widget area"
97
+ msgstr "Die einzigartige ID wird verwendet, um den neuen Sidebar-Widget-Bereich zu registrieren. Diese ID kann nicht verändert werden. Verwenden Sie am besten nur kleinbuchstaben, Bindestriche (Minus) und Zahlen."
98
+
99
+ #@ ss
100
+ #: functions.php:28
101
+ msgid "Edit"
102
+ msgstr "Bearbeiten"
103
+
104
+ #@ ss
105
+ #: functions.php:29
106
+ msgid "Delete"
107
+ msgstr "Löschen"
108
+
109
+ #@ ss
110
+ #: functions.php:145
111
+ msgid "Oops! Please choose a valid Name and ID for this sidebar"
112
+ msgstr "Oops! Bitte wählen Sie einen gültigen Namen und eine gültige ID für diese Sidebar"
113
+
114
+ #@ ss
115
+ #: functions.php:148
116
+ msgid "Oops! That sidebar ID already exists"
117
+ msgstr "Oops! Diese Sidebar-ID existiert bereits"
118
+
119
+ #@ ss
120
+ #: functions.php:151
121
+ msgid "Oops! You are trying to edit a sidebar that does not exist, or is not editable"
122
+ msgstr "Oops! Sie versuchen eine Sidebar zu bearbeiten, die nicht existiert, oder nicht bearbeitet werden kann"
123
+
124
+ #@ ss
125
+ #: functions.php:154
126
+ msgid "Oops! You are trying to delete a sidebar that does not exist, or cannot be deleted"
127
+ msgstr "Oops! Sie versuchen eine Sidebar zu löschen, die nicht existiert oder nicht gelöscht werden kann/ darf"
128
+
129
+ #@ ss
130
+ #: functions.php:157
131
+ msgid "Oops! Something went wrong. Try again."
132
+ msgstr "Oops! Etwas ging schief. Bitte versuchen Sie es noch einmal."
133
+
134
+ #@ ss
135
+ #: functions.php:173
136
+ msgid "New sidebar successfully created!"
137
+ msgstr "Neue Sidebar erfolgreich erstellt!"
138
+
139
+ #@ ss
140
+ #: functions.php:178
141
+ msgid "Sidebar successfully edited!"
142
+ msgstr "Sidebar erfolgreich bearbeitet!"
143
+
144
+ #@ ss
145
+ #: functions.php:183
146
+ msgid "Sidebar successfully deleted."
147
+ msgstr "Sidebar erfolgreich gelöscht."
148
+
149
+ #@ ss
150
+ #: inpost.php:10
151
+ msgid "Sidebar Selection"
152
+ msgstr "Sidebar-Auswahl"
153
+
154
+ #@ ss
155
+ #: inpost.php:22
156
+ #: term.php:29
157
+ msgid "Primary Sidebar"
158
+ msgstr "Haupt-Sidebar (Primary)"
159
+
160
+ #@ ss
161
+ #: inpost.php:24
162
+ #: inpost.php:43
163
+ #: term.php:32
164
+ #: term.php:46
165
+ msgid "Default"
166
+ msgstr "Standard"
167
+
168
+ #@ ss
169
+ #: inpost.php:41
170
+ #: term.php:43
171
+ msgid "Secondary Sidebar"
172
+ msgstr "Zweit-Sidebar (Secondary)"
173
+
174
+ #@ ss
175
+ #: plugin.php:24
176
+ #, php-format
177
+ msgid "Sorry, you can't activate unless you have installed <a href=\"%s\">Genesis</a>"
178
+ msgstr "Hinweis: Dieses Plugin kann <em>nicht</em> aktiviert werden, solange das <a href=\"%s\">Genesis Framework</a> nicht installiert ist."
179
+
180
+ #@ ss
181
+ #: plugin.php:29
182
+ #, php-format
183
+ msgid "Sorry, you cannot activate without <a href=\"%s\">Genesis %s</a> or greater"
184
+ msgstr "Hinweis: Dieses Plugin kann <em>nicht</em> aktiviert werden, au&szlig;er das <a href=\"%s\">Genesis Framework Version %s</a> oder h&ouml;her ist installiert."
185
+
186
+ #@ ss
187
+ #: term.php:25
188
+ msgid "Sidebar Options"
189
+ msgstr "Sidebar-Optionen"
190
+
191
+ #@ ss
192
+ #. translators: plugin header field 'Name'
193
+ #: plugin.php:0
194
+ msgid "Genesis Simple Sidebars"
195
+ msgstr "Genesis Einfache Sidebars"
196
+
197
+ #@ ss
198
+ #. translators: plugin header field 'PluginURI'
199
+ #: plugin.php:0
200
+ msgid "http://www.studiopress.com/plugins/simple-sidebars"
201
+ msgstr "http://www.studiopress.com/plugins/simple-sidebars"
202
+
203
+ #@ ss
204
+ #. translators: plugin header field 'Description'
205
+ #: plugin.php:0
206
+ msgid "Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas."
207
+ msgstr "Genesis Einfache Sidebars (Simple Sidebars) erlaubt es auf einfache Art und Weise neue Sidebar-Widget-Bereiche zu erstellen und zu verwenden."
208
+
209
+ #@ ss
210
+ #. translators: plugin header field 'Author'
211
+ #: plugin.php:0
212
+ msgid "Nathan Rice"
213
+ msgstr "Nathan Rice"
214
+
215
+ #@ ss
216
+ #. translators: plugin header field 'AuthorURI'
217
+ #: plugin.php:0
218
+ msgid "http://www.nathanrice.net/"
219
+ msgstr "http://www.nathanrice.net/"
220
+
221
+ #@ ss
222
+ #. translators: plugin header field 'Version'
223
+ #: plugin.php:0
224
+ msgid "0.9.2"
225
+ msgstr "0.9.2"
226
+
languages/ss.po ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2011-08-06 21:23-0300\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=CHARSET\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+
19
+ #: admin.php:17
20
+ msgid "Simple Sidebars"
21
+ msgstr ""
22
+
23
+ #: admin.php:66
24
+ msgid ""
25
+ "Nice try, partner. But that sidebar doesn't exist. Click back and try again."
26
+ msgstr ""
27
+
28
+ #: admin.php:72
29
+ msgid "Edit Sidebar"
30
+ msgstr ""
31
+
32
+ #: admin.php:79 admin.php:117 admin.php:125 admin.php:152
33
+ msgid "Name"
34
+ msgstr ""
35
+
36
+ #: admin.php:81 admin.php:154
37
+ msgid "A recognizable name for your new sidebar widget area"
38
+ msgstr ""
39
+
40
+ #: admin.php:85 admin.php:118 admin.php:126 admin.php:158
41
+ msgid "ID"
42
+ msgstr ""
43
+
44
+ #: admin.php:89
45
+ msgid ""
46
+ "The unique ID is used to register the sidebar widget area (cannot be changed)"
47
+ msgstr ""
48
+
49
+ #: admin.php:93 admin.php:119 admin.php:127 admin.php:164
50
+ msgid "Description"
51
+ msgstr ""
52
+
53
+ #: admin.php:99
54
+ msgid "Update"
55
+ msgstr ""
56
+
57
+ #: admin.php:106
58
+ msgid "Genesis - Simple Sidebars"
59
+ msgstr ""
60
+
61
+ #: admin.php:113
62
+ msgid "Current Sidebars"
63
+ msgstr ""
64
+
65
+ #: admin.php:146 admin.php:168
66
+ msgid "Add New Sidebar"
67
+ msgstr ""
68
+
69
+ #: admin.php:160
70
+ msgid "The unique ID is used to register the sidebar widget area"
71
+ msgstr ""
72
+
73
+ #: functions.php:28
74
+ msgid "Edit"
75
+ msgstr ""
76
+
77
+ #: functions.php:29
78
+ msgid "Delete"
79
+ msgstr ""
80
+
81
+ #: functions.php:137
82
+ msgid "Oops! Please choose a valid Name and ID for this sidebar"
83
+ msgstr ""
84
+
85
+ #: functions.php:140
86
+ msgid "Oops! That sidebar ID already exists"
87
+ msgstr ""
88
+
89
+ #: functions.php:143
90
+ msgid ""
91
+ "Oops! You are trying to edit a sidebar that does not exist, or is not "
92
+ "editable"
93
+ msgstr ""
94
+
95
+ #: functions.php:146
96
+ msgid ""
97
+ "Oops! You are trying to delete a sidebar that does not exist, or cannot be "
98
+ "deleted"
99
+ msgstr ""
100
+
101
+ #: functions.php:149
102
+ msgid "Oops! Something went wrong. Try again."
103
+ msgstr ""
104
+
105
+ #: functions.php:165
106
+ msgid "New sidebar successfully created!"
107
+ msgstr ""
108
+
109
+ #: functions.php:170
110
+ msgid "Sidebar successfully edited!"
111
+ msgstr ""
112
+
113
+ #: functions.php:175
114
+ msgid "Sidebar successfully deleted."
115
+ msgstr ""
116
+
117
+ #: inpost.php:10
118
+ msgid "Sidebar Selection"
119
+ msgstr ""
120
+
121
+ #: inpost.php:22 term.php:29
122
+ msgid "Primary Sidebar"
123
+ msgstr ""
124
+
125
+ #: inpost.php:24 inpost.php:36 term.php:32 term.php:46
126
+ msgid "Default"
127
+ msgstr ""
128
+
129
+ #: inpost.php:34 term.php:43
130
+ msgid "Secondary Sidebar"
131
+ msgstr ""
132
+
133
+ #: plugin.php:21
134
+ #, php-format
135
+ msgid ""
136
+ "Sorry, you can't activate unless you have installed <a href=\"%s\">Genesis</"
137
+ "a>"
138
+ msgstr ""
139
+
140
+ #: plugin.php:26
141
+ #, php-format
142
+ msgid ""
143
+ "Sorry, you cannot activate without <a href=\"%s\">Genesis %s</a> or greater"
144
+ msgstr ""
145
+
146
+ #: term.php:25
147
+ msgid "Sidebar Options"
148
+ msgstr ""
plugin.php CHANGED
@@ -3,20 +3,23 @@
3
  Plugin Name: Genesis Simple Sidebars
4
  Plugin URI: http://www.studiopress.com/plugins/simple-sidebars
5
  Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
6
- Version: 0.9.1
7
  Author: Nathan Rice
8
  Author URI: http://www.nathanrice.net/
 
 
9
  */
10
 
11
  // require Genesis 1.2 upon activation
12
  register_activation_hook(__FILE__, 'ss_activation_check');
13
  function ss_activation_check() {
14
 
15
- $latest = '1.2';
16
 
17
- $theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
18
 
19
  if( basename(TEMPLATEPATH) != 'genesis' ) {
 
20
  deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
21
  wp_die( sprintf( __('Sorry, you can\'t activate unless you have installed <a href="%s">Genesis</a>', 'ss'), 'http://www.studiopress.com/themes/genesis' ) );
22
  }
@@ -28,20 +31,33 @@ function ss_activation_check() {
28
 
29
  }
30
 
31
- // Define our constants
32
- define('SS_SETTINGS_FIELD', 'ss-settings');
33
- define('SS_PLUGIN_DIR', dirname(__FILE__));
 
 
 
 
 
34
 
35
- // Include files
36
- require_once(SS_PLUGIN_DIR . '/admin.php');
37
- require_once(SS_PLUGIN_DIR . '/functions.php');
38
- require_once(SS_PLUGIN_DIR . '/inpost.php');
39
- require_once(SS_PLUGIN_DIR . '/term.php');
40
 
 
 
 
 
 
 
 
 
 
41
  /**
42
  * This function registers the created sidebars
43
  */
44
- add_action('widgets_init', 'ss_register_sidebars');
45
  function ss_register_sidebars() {
46
 
47
  $_sidebars = stripslashes_deep( get_option( SS_SETTINGS_FIELD ) );
@@ -70,7 +86,6 @@ function ss_register_sidebars() {
70
  * Remove the default sidebars, run some conditional logic,
71
  * use alternate sidebars if necessary, else fallback on default sidebars.
72
  */
73
- add_action('get_header', 'ss_sidebars_init');
74
  function ss_sidebars_init() {
75
  remove_action('genesis_sidebar', 'genesis_do_sidebar');
76
  remove_action('genesis_sidebar_alt', 'genesis_do_sidebar_alt');
@@ -79,40 +94,52 @@ function ss_sidebars_init() {
79
  }
80
 
81
  function ss_do_sidebar() {
82
-
83
- if ( is_singular() && $_sidebar = genesis_get_custom_field('_ss_sidebar') ) {
84
- if ( dynamic_sidebar($_sidebar) ) return;
85
- }
86
-
87
- if ( is_category() ) {
88
- $term = get_term( get_query_var('cat'), 'category' );
89
- if( isset( $term->meta['_ss_sidebar'] ) && dynamic_sidebar( $term->meta['_ss_sidebar'] ) ) return;
90
- }
91
-
92
- if ( is_tag() ) {
93
- $term = get_term( get_query_var('tag_id'), 'post_tag' );
94
- if( isset( $term->meta['_ss_sidebar'] ) && dynamic_sidebar( $term->meta['_ss_sidebar'] ) ) return;
95
- }
96
-
97
- genesis_do_sidebar();
98
-
99
  }
100
  function ss_do_sidebar_alt() {
 
 
 
 
 
 
 
 
101
 
102
- if ( is_singular() && $_sidebar_alt = genesis_get_custom_field('_ss_sidebar_alt') ) {
103
- if ( dynamic_sidebar($_sidebar_alt) ) return;
104
  }
105
 
106
  if ( is_category() ) {
107
  $term = get_term( get_query_var('cat'), 'category' );
108
- if( isset( $term->meta['_ss_sidebar_alt'] ) && dynamic_sidebar( $term->meta['_ss_sidebar_alt'] ) ) return;
109
  }
110
 
111
  if ( is_tag() ) {
112
  $term = get_term( get_query_var('tag_id'), 'post_tag' );
113
- if( isset( $term->meta['_ss_sidebar_alt'] ) && dynamic_sidebar( $term->meta['_ss_sidebar_alt'] ) ) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
 
116
- genesis_do_sidebar_alt();
117
 
118
- }
3
  Plugin Name: Genesis Simple Sidebars
4
  Plugin URI: http://www.studiopress.com/plugins/simple-sidebars
5
  Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
6
+ Version: 0.9.2
7
  Author: Nathan Rice
8
  Author URI: http://www.nathanrice.net/
9
+ Text Domain: ss
10
+ Domain Path: /languages/
11
  */
12
 
13
  // require Genesis 1.2 upon activation
14
  register_activation_hook(__FILE__, 'ss_activation_check');
15
  function ss_activation_check() {
16
 
17
+ $latest = '1.2';
18
 
19
+ $theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
20
 
21
  if( basename(TEMPLATEPATH) != 'genesis' ) {
22
+ load_plugin_textdomain( 'ss', false, 'genesis-simple-sidebars/languages' );
23
  deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
24
  wp_die( sprintf( __('Sorry, you can\'t activate unless you have installed <a href="%s">Genesis</a>', 'ss'), 'http://www.studiopress.com/themes/genesis' ) );
25
  }
31
 
32
  }
33
 
34
+ /**
35
+ * Hook into Genesis
36
+ */
37
+ add_action( 'genesis_init', 'ss_genesis_init', 12 );
38
+ function ss_genesis_init() {
39
+ // Define our constants
40
+ define( 'SS_SETTINGS_FIELD', 'ss-settings' );
41
+ define( 'SS_PLUGIN_DIR', dirname( __FILE__ ) );
42
 
43
+ // required hooks
44
+ add_action( 'get_header', 'ss_sidebars_init' );
45
+ add_action( 'widgets_init', 'ss_register_sidebars' );
46
+ if ( !is_admin() )
47
+ return;
48
 
49
+ // Include admin files
50
+ load_plugin_textdomain( 'ss', false, 'genesis-simple-sidebars/languages' );
51
+ require_once( SS_PLUGIN_DIR . '/admin.php' );
52
+ require_once( SS_PLUGIN_DIR . '/functions.php' );
53
+ require_once( SS_PLUGIN_DIR . '/inpost.php' );
54
+ require_once( SS_PLUGIN_DIR . '/term.php' );
55
+ // let the child theme hook the genesis_simple_sidebars_taxonomies filter before hooking term edit
56
+ add_action( 'init', 'ss_term_edit_init' );
57
+ }
58
  /**
59
  * This function registers the created sidebars
60
  */
 
61
  function ss_register_sidebars() {
62
 
63
  $_sidebars = stripslashes_deep( get_option( SS_SETTINGS_FIELD ) );
86
  * Remove the default sidebars, run some conditional logic,
87
  * use alternate sidebars if necessary, else fallback on default sidebars.
88
  */
 
89
  function ss_sidebars_init() {
90
  remove_action('genesis_sidebar', 'genesis_do_sidebar');
91
  remove_action('genesis_sidebar_alt', 'genesis_do_sidebar_alt');
94
  }
95
 
96
  function ss_do_sidebar() {
97
+
98
+ if ( ! ss_do_one_sidebar( '_ss_sidebar' ) )
99
+ genesis_do_sidebar();
100
+
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  }
102
  function ss_do_sidebar_alt() {
103
+
104
+ if ( ! ss_do_one_sidebar( '_ss_sidebar_alt' ) )
105
+ genesis_do_sidebar_alt();
106
+
107
+ }
108
+
109
+ function ss_do_one_sidebar( $bar = '_ss_sidebar' ) {
110
+ static $taxonomies = null;
111
 
112
+ if ( is_singular() && $_bar = genesis_get_custom_field( $bar ) ) {
113
+ if ( dynamic_sidebar( $_bar ) ) return true;
114
  }
115
 
116
  if ( is_category() ) {
117
  $term = get_term( get_query_var('cat'), 'category' );
118
+ if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
119
  }
120
 
121
  if ( is_tag() ) {
122
  $term = get_term( get_query_var('tag_id'), 'post_tag' );
123
+ if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
124
+ }
125
+
126
+ if ( is_tax() ) {
127
+ if( $taxonomies === null )
128
+ $taxonomies = (array)apply_filters( 'genesis_simple_sidebars_taxonomies', array() );
129
+
130
+ foreach( $taxonomies as $tax ) {
131
+ if( $tax == 'post_tag' || $tax == 'category' )
132
+ continue;
133
+
134
+ if( is_tax( $tax ) ) {
135
+ $obj = get_queried_object();
136
+ $term = get_term( $obj->term_id, $tax );
137
+ if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
138
+ break;
139
+ }
140
+ }
141
  }
142
 
143
+ return false;
144
 
145
+ }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Plugin Name ===
2
- Contributors: nathanrice
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: hooks, genesis, genesiswp, studiopress
5
  Requires at least: 3.0
6
- Tested up to: 3.0.1
7
- Stable tag: 0.9.1
8
 
9
  This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Theme Framework on a per post, per page, or per tag/category archive basis.
10
 
@@ -47,4 +47,9 @@ Not in the way you're probably thinking. The markup surrounding the widget area
47
  * Bump to pre-release 0.9 branch
48
 
49
  = 0.9.1 =
50
- * Added support for custom post types
 
 
 
 
 
1
  === Plugin Name ===
2
+ Contributors: nathanrice, wpmuguru
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: hooks, genesis, genesiswp, studiopress
5
  Requires at least: 3.0
6
+ Tested up to: 3.3
7
+ Stable tag: 0.9.2
8
 
9
  This plugin allows you to create multiple, dynamic widget areas, and assign those widget areas to sidebar locations within the Genesis Theme Framework on a per post, per page, or per tag/category archive basis.
10
 
47
  * Bump to pre-release 0.9 branch
48
 
49
  = 0.9.1 =
50
+ * Added support for custom post types
51
+
52
+ = 0.9.2 =
53
+ * Added support for custom taxonomies
54
+ * Added translation support
55
+ * bug fix to prevent invalid sidebar creation
term.php CHANGED
@@ -4,8 +4,14 @@
4
  * adds new fields to select a sidebar. The variables $tag and $taxonomy
5
  * are passed via the hook so that we can use them.
6
  */
7
- add_action('category_edit_form', 'ss_term_sidebar', 9, 2);
8
- add_action('post_tag_edit_form', 'ss_term_sidebar', 9, 2);
 
 
 
 
 
 
9
  function ss_term_sidebar($tag, $taxonomy) {
10
 
11
  // Merge Defaults to prevent notices
4
  * adds new fields to select a sidebar. The variables $tag and $taxonomy
5
  * are passed via the hook so that we can use them.
6
  */
7
+ function ss_term_edit_init() {
8
+ $taxonomies = apply_filters( 'genesis_simple_sidebars_taxonomies', array() );
9
+ if( !empty( $taxonomies ) && is_admin() && is_array( $taxonomies ) ) {
10
+ foreach( $taxonomies as $tax )
11
+ add_action( "{$tax}_edit_form", 'ss_term_sidebar', 9, 2 );
12
+ }
13
+ }
14
+
15
  function ss_term_sidebar($tag, $taxonomy) {
16
 
17
  // Merge Defaults to prevent notices