Tagging 0.9.2.

This commit is contained in:
Nathan Rice
2013-08-09 13:07:35 -04:00
parent 00d39a0424
commit 78faae2bbd
9 changed files with 474 additions and 47 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
add_action('admin_init', 'register_ss_settings');
function register_ss_settings() {
register_setting(SS_SETTINGS_FIELD, SS_SETTINGS_FIELD);
add_option(SS_SETTINGS_FIELD, '__return_empty_array', '', 'yes');
add_option(SS_SETTINGS_FIELD, array(), '', 'yes');
}
/**
@@ -96,7 +96,7 @@ function ss_settings_admin() { ?>
</table>
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update', 'ee'); ?>" /></p>
<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update', 'ss'); ?>" /></p>
</form>
+9 -1
View File
@@ -50,6 +50,10 @@ function ss_create_sidebar( $args = array() ) {
// nonce verification
check_admin_referer('simple-sidebars-action_create-sidebar');
// WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user
if ( is_numeric( $args['id'] ) )
$args['id'] = sanitize_title_with_dashes( $args['name'] );
$db = (array)get_option(SS_SETTINGS_FIELD);
$new = array(
sanitize_title_with_dashes( $args['id'] ) => array(
@@ -81,6 +85,10 @@ function ss_edit_sidebar( $args = array() ) {
// nonce verification
check_admin_referer('simple-sidebars-action_edit-sidebar');
// WP changes a numeric sidebar id to sidebar-id which makes it inaccessible to the user
if ( is_numeric( $args['id'] ) )
$args['id'] = sanitize_title_with_dashes( $args['name'] );
$db = (array)get_option(SS_SETTINGS_FIELD);
$new = array(
sanitize_title_with_dashes( $args['id'] ) => array(
@@ -137,7 +145,7 @@ function ss_error_message( $error = false ) {
return __('Oops! Please choose a valid Name and ID for this sidebar', 'ss');
break;
case 2:
return __('Oops! That sidebar ID already exists');
return __('Oops! That sidebar ID already exists', 'ss');
break;
case 3:
return __('Oops! You are trying to edit a sidebar that does not exist, or is not editable', 'ss');
+9 -2
View File
@@ -7,7 +7,7 @@ add_action('admin_menu', 'ss_add_inpost_metabox');
function ss_add_inpost_metabox() {
foreach ( (array)get_post_types( array( 'public' => true ) ) as $type ) {
if ( post_type_supports( $type, 'genesis-simple-sidebars' ) || $type == 'post' || $type == 'page' ) {
add_meta_box('ss_inpost_metabox', __('Sidebar Selection', 'genesis'), 'ss_inpost_metabox', $type, 'side', 'low');
add_meta_box('ss_inpost_metabox', __('Sidebar Selection', 'ss'), 'ss_inpost_metabox', $type, 'side', 'low');
}
}
}
@@ -29,7 +29,14 @@ function ss_inpost_metabox() {
?>
</select>
</p>
<?php
// don't show the option if there are no 3 column layouts registered
$_layouts = (array) genesis_get_layouts();
$_layouts = array_keys( $_layouts );
$_3_column = array_intersect( $_layouts, array( 'content-sidebar-sidebar', 'sidebar-content-sidebar', 'sidebar-sidebar-content' ) );
if ( empty( $_3_column ) )
return;
?>
<p>
<label class="howto" for="_ss_sidebar_alt"><span><?php _e('Secondary Sidebar', 'ss'); ?><span></label>
<select name="_ss_sidebar_alt" id="_ss_sidebar_alt" style="width: 99%">
Binary file not shown.
+226
View File
@@ -0,0 +1,226 @@
# Copyright (C) 2011 Genesis Layout Extras by David Decker of deckerweb.de
# This file is distributed under the same license as the Genesis Layout Extras package.
#
msgid ""
msgstr ""
"Project-Id-Version: Genesis Simple Sidebars (Plugin)\n"
"Report-Msgid-Bugs-To: http://wordpress.org/tags/genesis-simple-sidebars\n"
"POT-Creation-Date: 2011-12-24 01:10+0100\n"
"PO-Revision-Date: 2011-12-24 01:18+0100\n"
"Last-Translator: David Decker <deckerweb.mobil@googlemail.com>\n"
"Language-Team: DECKERWEB <deckerweb.mobil@googlemail.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Poedit-Language: German\n"
"X-Poedit-Country: GERMANY\n"
"X-Poedit-SourceCharset: utf-8\n"
"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"
"X-Textdomain-Support: yes\n"
"X-Poedit-SearchPath-0: .\n"
#@ ss
#: admin.php:17
msgid "Simple Sidebars"
msgstr "Einfache Sidebars"
#@ ss
#: admin.php:66
msgid "Nice try, partner. But that sidebar doesn't exist. Click back and try again."
msgstr "Netter Versuch, doch leider existiert diese Sidebar nicht. Gehen Sie zurück und versuchen Sie es erneut."
#@ ss
#: admin.php:72
msgid "Edit Sidebar"
msgstr "Sidebar bearbeiten"
#@ ss
#: admin.php:79
#: admin.php:117
#: admin.php:125
#: admin.php:152
msgid "Name"
msgstr "Name"
#@ ss
#: admin.php:81
#: admin.php:154
msgid "A recognizable name for your new sidebar widget area"
msgstr "Ein passender Name für Ihren neuen Sidebar-Widget-Bereich"
#@ ss
#: admin.php:85
#: admin.php:118
#: admin.php:126
#: admin.php:158
msgid "ID"
msgstr "ID"
#@ ss
#: admin.php:89
msgid "The unique ID is used to register the sidebar widget area (cannot be changed)"
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."
#@ ss
#: admin.php:93
#: admin.php:119
#: admin.php:127
#: admin.php:164
msgid "Description"
msgstr "Beschreibung"
#@ ss
#: admin.php:99
msgid "Update"
msgstr "Aktualisieren"
#@ ss
#: admin.php:106
msgid "Genesis - Simple Sidebars"
msgstr "Genesis - Einfache Sidebars"
#@ ss
#: admin.php:113
msgid "Current Sidebars"
msgstr "Aktuelle Sidebars"
#@ ss
#: admin.php:146
#: admin.php:168
msgid "Add New Sidebar"
msgstr "Neue Sidebar hinzufügen"
#@ ss
#: admin.php:160
msgid "The unique ID is used to register the sidebar widget area"
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."
#@ ss
#: functions.php:28
msgid "Edit"
msgstr "Bearbeiten"
#@ ss
#: functions.php:29
msgid "Delete"
msgstr "Löschen"
#@ ss
#: functions.php:145
msgid "Oops! Please choose a valid Name and ID for this sidebar"
msgstr "Oops! Bitte wählen Sie einen gültigen Namen und eine gültige ID für diese Sidebar"
#@ ss
#: functions.php:148
msgid "Oops! That sidebar ID already exists"
msgstr "Oops! Diese Sidebar-ID existiert bereits"
#@ ss
#: functions.php:151
msgid "Oops! You are trying to edit a sidebar that does not exist, or is not editable"
msgstr "Oops! Sie versuchen eine Sidebar zu bearbeiten, die nicht existiert, oder nicht bearbeitet werden kann"
#@ ss
#: functions.php:154
msgid "Oops! You are trying to delete a sidebar that does not exist, or cannot be deleted"
msgstr "Oops! Sie versuchen eine Sidebar zu löschen, die nicht existiert oder nicht gelöscht werden kann/ darf"
#@ ss
#: functions.php:157
msgid "Oops! Something went wrong. Try again."
msgstr "Oops! Etwas ging schief. Bitte versuchen Sie es noch einmal."
#@ ss
#: functions.php:173
msgid "New sidebar successfully created!"
msgstr "Neue Sidebar erfolgreich erstellt!"
#@ ss
#: functions.php:178
msgid "Sidebar successfully edited!"
msgstr "Sidebar erfolgreich bearbeitet!"
#@ ss
#: functions.php:183
msgid "Sidebar successfully deleted."
msgstr "Sidebar erfolgreich gelöscht."
#@ ss
#: inpost.php:10
msgid "Sidebar Selection"
msgstr "Sidebar-Auswahl"
#@ ss
#: inpost.php:22
#: term.php:29
msgid "Primary Sidebar"
msgstr "Haupt-Sidebar (Primary)"
#@ ss
#: inpost.php:24
#: inpost.php:43
#: term.php:32
#: term.php:46
msgid "Default"
msgstr "Standard"
#@ ss
#: inpost.php:41
#: term.php:43
msgid "Secondary Sidebar"
msgstr "Zweit-Sidebar (Secondary)"
#@ ss
#: plugin.php:24
#, php-format
msgid "Sorry, you can't activate unless you have installed <a href=\"%s\">Genesis</a>"
msgstr "Hinweis: Dieses Plugin kann <em>nicht</em> aktiviert werden, solange das <a href=\"%s\">Genesis Framework</a> nicht installiert ist."
#@ ss
#: plugin.php:29
#, php-format
msgid "Sorry, you cannot activate without <a href=\"%s\">Genesis %s</a> or greater"
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."
#@ ss
#: term.php:25
msgid "Sidebar Options"
msgstr "Sidebar-Optionen"
#@ ss
#. translators: plugin header field 'Name'
#: plugin.php:0
msgid "Genesis Simple Sidebars"
msgstr "Genesis Einfache Sidebars"
#@ ss
#. translators: plugin header field 'PluginURI'
#: plugin.php:0
msgid "http://www.studiopress.com/plugins/simple-sidebars"
msgstr "http://www.studiopress.com/plugins/simple-sidebars"
#@ ss
#. translators: plugin header field 'Description'
#: plugin.php:0
msgid "Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas."
msgstr "Genesis Einfache Sidebars (Simple Sidebars) erlaubt es auf einfache Art und Weise neue Sidebar-Widget-Bereiche zu erstellen und zu verwenden."
#@ ss
#. translators: plugin header field 'Author'
#: plugin.php:0
msgid "Nathan Rice"
msgstr "Nathan Rice"
#@ ss
#. translators: plugin header field 'AuthorURI'
#: plugin.php:0
msgid "http://www.nathanrice.net/"
msgstr "http://www.nathanrice.net/"
#@ ss
#. translators: plugin header field 'Version'
#: plugin.php:0
msgid "0.9.2"
msgstr "0.9.2"
+148
View File
@@ -0,0 +1,148 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-08-06 21:23-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: admin.php:17
msgid "Simple Sidebars"
msgstr ""
#: admin.php:66
msgid ""
"Nice try, partner. But that sidebar doesn't exist. Click back and try again."
msgstr ""
#: admin.php:72
msgid "Edit Sidebar"
msgstr ""
#: admin.php:79 admin.php:117 admin.php:125 admin.php:152
msgid "Name"
msgstr ""
#: admin.php:81 admin.php:154
msgid "A recognizable name for your new sidebar widget area"
msgstr ""
#: admin.php:85 admin.php:118 admin.php:126 admin.php:158
msgid "ID"
msgstr ""
#: admin.php:89
msgid ""
"The unique ID is used to register the sidebar widget area (cannot be changed)"
msgstr ""
#: admin.php:93 admin.php:119 admin.php:127 admin.php:164
msgid "Description"
msgstr ""
#: admin.php:99
msgid "Update"
msgstr ""
#: admin.php:106
msgid "Genesis - Simple Sidebars"
msgstr ""
#: admin.php:113
msgid "Current Sidebars"
msgstr ""
#: admin.php:146 admin.php:168
msgid "Add New Sidebar"
msgstr ""
#: admin.php:160
msgid "The unique ID is used to register the sidebar widget area"
msgstr ""
#: functions.php:28
msgid "Edit"
msgstr ""
#: functions.php:29
msgid "Delete"
msgstr ""
#: functions.php:137
msgid "Oops! Please choose a valid Name and ID for this sidebar"
msgstr ""
#: functions.php:140
msgid "Oops! That sidebar ID already exists"
msgstr ""
#: functions.php:143
msgid ""
"Oops! You are trying to edit a sidebar that does not exist, or is not "
"editable"
msgstr ""
#: functions.php:146
msgid ""
"Oops! You are trying to delete a sidebar that does not exist, or cannot be "
"deleted"
msgstr ""
#: functions.php:149
msgid "Oops! Something went wrong. Try again."
msgstr ""
#: functions.php:165
msgid "New sidebar successfully created!"
msgstr ""
#: functions.php:170
msgid "Sidebar successfully edited!"
msgstr ""
#: functions.php:175
msgid "Sidebar successfully deleted."
msgstr ""
#: inpost.php:10
msgid "Sidebar Selection"
msgstr ""
#: inpost.php:22 term.php:29
msgid "Primary Sidebar"
msgstr ""
#: inpost.php:24 inpost.php:36 term.php:32 term.php:46
msgid "Default"
msgstr ""
#: inpost.php:34 term.php:43
msgid "Secondary Sidebar"
msgstr ""
#: plugin.php:21
#, php-format
msgid ""
"Sorry, you can't activate unless you have installed <a href=\"%s\">Genesis</"
"a>"
msgstr ""
#: plugin.php:26
#, php-format
msgid ""
"Sorry, you cannot activate without <a href=\"%s\">Genesis %s</a> or greater"
msgstr ""
#: term.php:25
msgid "Sidebar Options"
msgstr ""
+63 -36
View File
@@ -3,20 +3,23 @@
Plugin Name: Genesis Simple Sidebars
Plugin URI: http://www.studiopress.com/plugins/simple-sidebars
Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
Version: 0.9.1
Version: 0.9.2
Author: Nathan Rice
Author URI: http://www.nathanrice.net/
Text Domain: ss
Domain Path: /languages/
*/
// require Genesis 1.2 upon activation
register_activation_hook(__FILE__, 'ss_activation_check');
function ss_activation_check() {
$latest = '1.2';
$latest = '1.2';
$theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
$theme_info = get_theme_data(TEMPLATEPATH.'/style.css');
if( basename(TEMPLATEPATH) != 'genesis' ) {
load_plugin_textdomain( 'ss', false, 'genesis-simple-sidebars/languages' );
deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
wp_die( sprintf( __('Sorry, you can\'t activate unless you have installed <a href="%s">Genesis</a>', 'ss'), 'http://www.studiopress.com/themes/genesis' ) );
}
@@ -28,20 +31,33 @@ function ss_activation_check() {
}
// Define our constants
define('SS_SETTINGS_FIELD', 'ss-settings');
define('SS_PLUGIN_DIR', dirname(__FILE__));
/**
* Hook into Genesis
*/
add_action( 'genesis_init', 'ss_genesis_init', 12 );
function ss_genesis_init() {
// Define our constants
define( 'SS_SETTINGS_FIELD', 'ss-settings' );
define( 'SS_PLUGIN_DIR', dirname( __FILE__ ) );
// Include files
require_once(SS_PLUGIN_DIR . '/admin.php');
require_once(SS_PLUGIN_DIR . '/functions.php');
require_once(SS_PLUGIN_DIR . '/inpost.php');
require_once(SS_PLUGIN_DIR . '/term.php');
// required hooks
add_action( 'get_header', 'ss_sidebars_init' );
add_action( 'widgets_init', 'ss_register_sidebars' );
if ( !is_admin() )
return;
// Include admin files
load_plugin_textdomain( 'ss', false, 'genesis-simple-sidebars/languages' );
require_once( SS_PLUGIN_DIR . '/admin.php' );
require_once( SS_PLUGIN_DIR . '/functions.php' );
require_once( SS_PLUGIN_DIR . '/inpost.php' );
require_once( SS_PLUGIN_DIR . '/term.php' );
// let the child theme hook the genesis_simple_sidebars_taxonomies filter before hooking term edit
add_action( 'init', 'ss_term_edit_init' );
}
/**
* This function registers the created sidebars
*/
add_action('widgets_init', 'ss_register_sidebars');
function ss_register_sidebars() {
$_sidebars = stripslashes_deep( get_option( SS_SETTINGS_FIELD ) );
@@ -70,7 +86,6 @@ function ss_register_sidebars() {
* Remove the default sidebars, run some conditional logic,
* use alternate sidebars if necessary, else fallback on default sidebars.
*/
add_action('get_header', 'ss_sidebars_init');
function ss_sidebars_init() {
remove_action('genesis_sidebar', 'genesis_do_sidebar');
remove_action('genesis_sidebar_alt', 'genesis_do_sidebar_alt');
@@ -79,40 +94,52 @@ function ss_sidebars_init() {
}
function ss_do_sidebar() {
if ( is_singular() && $_sidebar = genesis_get_custom_field('_ss_sidebar') ) {
if ( dynamic_sidebar($_sidebar) ) return;
}
if ( is_category() ) {
$term = get_term( get_query_var('cat'), 'category' );
if( isset( $term->meta['_ss_sidebar'] ) && dynamic_sidebar( $term->meta['_ss_sidebar'] ) ) return;
}
if ( is_tag() ) {
$term = get_term( get_query_var('tag_id'), 'post_tag' );
if( isset( $term->meta['_ss_sidebar'] ) && dynamic_sidebar( $term->meta['_ss_sidebar'] ) ) return;
}
genesis_do_sidebar();
if ( ! ss_do_one_sidebar( '_ss_sidebar' ) )
genesis_do_sidebar();
}
function ss_do_sidebar_alt() {
if ( ! ss_do_one_sidebar( '_ss_sidebar_alt' ) )
genesis_do_sidebar_alt();
}
function ss_do_one_sidebar( $bar = '_ss_sidebar' ) {
static $taxonomies = null;
if ( is_singular() && $_sidebar_alt = genesis_get_custom_field('_ss_sidebar_alt') ) {
if ( dynamic_sidebar($_sidebar_alt) ) return;
if ( is_singular() && $_bar = genesis_get_custom_field( $bar ) ) {
if ( dynamic_sidebar( $_bar ) ) return true;
}
if ( is_category() ) {
$term = get_term( get_query_var('cat'), 'category' );
if( isset( $term->meta['_ss_sidebar_alt'] ) && dynamic_sidebar( $term->meta['_ss_sidebar_alt'] ) ) return;
if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
}
if ( is_tag() ) {
$term = get_term( get_query_var('tag_id'), 'post_tag' );
if( isset( $term->meta['_ss_sidebar_alt'] ) && dynamic_sidebar( $term->meta['_ss_sidebar_alt'] ) ) return;
if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
}
genesis_do_sidebar_alt();
if ( is_tax() ) {
if( $taxonomies === null )
$taxonomies = (array)apply_filters( 'genesis_simple_sidebars_taxonomies', array() );
foreach( $taxonomies as $tax ) {
if( $tax == 'post_tag' || $tax == 'category' )
continue;
if( is_tax( $tax ) ) {
$obj = get_queried_object();
$term = get_term( $obj->term_id, $tax );
if( isset( $term->meta[$bar] ) && dynamic_sidebar( $term->meta[$bar] ) ) return true;
break;
}
}
}
}
return false;
}
+9 -4
View File
@@ -1,10 +1,10 @@
=== Plugin Name ===
Contributors: nathanrice
Contributors: nathanrice, wpmuguru
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
Tags: hooks, genesis, genesiswp, studiopress
Requires at least: 3.0
Tested up to: 3.0.1
Stable tag: 0.9.1
Tested up to: 3.3
Stable tag: 0.9.2
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.
@@ -47,4 +47,9 @@ Not in the way you're probably thinking. The markup surrounding the widget area
* Bump to pre-release 0.9 branch
= 0.9.1 =
* Added support for custom post types
* Added support for custom post types
= 0.9.2 =
* Added support for custom taxonomies
* Added translation support
* bug fix to prevent invalid sidebar creation
+8 -2
View File
@@ -4,8 +4,14 @@
* adds new fields to select a sidebar. The variables $tag and $taxonomy
* are passed via the hook so that we can use them.
*/
add_action('category_edit_form', 'ss_term_sidebar', 9, 2);
add_action('post_tag_edit_form', 'ss_term_sidebar', 9, 2);
function ss_term_edit_init() {
$taxonomies = apply_filters( 'genesis_simple_sidebars_taxonomies', array() );
if( !empty( $taxonomies ) && is_admin() && is_array( $taxonomies ) ) {
foreach( $taxonomies as $tax )
add_action( "{$tax}_edit_form", 'ss_term_sidebar', 9, 2 );
}
}
function ss_term_sidebar($tag, $taxonomy) {
// Merge Defaults to prevent notices