Permalink
Browse files

fixed problem with return values, field divider gave an error...

  • Loading branch information...
1 parent e5840bd commit 4c159af5f40a4416a015ce801448d7b6c170de6f Pär Thernström committed Nov 5, 2012
Showing with 30 additions and 12 deletions.
  1. +17 −6 class_simple_fields_field.php
  2. +9 −2 readme.txt
  3. +4 −4 simple_fields.php
@@ -114,15 +114,26 @@ function get_class_name($class) {
* so loop to change all your values (there are several if using repeatable)
*/
function return_values($values) {
- // Simply return values if not redefined by child class
- // Thought: to make it more work like core/legacy plugins, let's return the first thing if only one thing exists
- // Or always, as long as developer does not haz overridz the methodz
- foreach ($values as &$one_value) {
- if (sizeof($one_value) == 1) {
- $one_value = current($one_value);
+
+ if (is_array($values)) {
+ // Thought: to make it more work like core/legacy plugins, let's return the first thing if only one thing exists
+ // Or always, as long as developer does not haz overridz the methodz
+ foreach ($values as &$one_value) {
+
+ if (is_array($one_value)) {
+ if (sizeof($one_value) == 1) {
+ $one_value = current($one_value);
+ }
+ } else {
+ // value is not array, then let it be
+ }
}
+ } else {
+ // Not an array
}
+
return $values;
+
}
/**
View
@@ -1,10 +1,10 @@
=== Simple Fields ===
Contributors: eskapism, MarsApril, samface, angrycreative, earth people
Donate link: http://simple-fields.com/about/donate/
-Tags: admin, fields, custom fields, advanced custom fields, extended custom fields, field manager, attachments, text areas, input fields, tinymce, radio button, drop down, files, meta box, edit, post, post_meta, post meta, custom
+Tags: admin, fields, custom fields, advanced custom fields, extended custom fields, more fields, repeatable fields, field manager, attachments, text areas, input fields, tinymce, radio button, drop down, files, meta box, edit, post, post_meta, post meta, custom, simple fields, cms, date picker, time picker
Requires at least: 3.3.1
Tested up to: 3.4.2
-Stable tag: 1.1
+Stable tag: 1.1.1
Add more advanced custom fields types to your edit post page. Field can be of several types, including textarea, checkbox, radio buttons, files and color picker.
@@ -164,6 +164,13 @@ See that "Add"-link above "Article images"? That means that it is repeatable, so
== Changelog ==
+#### Version x
+- Added: method edit_save() for Field Extensions API. Let you modify the values before being saved in database. (Actually this was added in last version, but I forgot about it then..)
+-
+
+#### Version 1.1.1
+- Fixed: styles and scripts where not outputed on all post types
+
#### Version 1.1
- Added: new field type "Date and Time Picker". It's a better version of the Date field. With this new field type you can choose to have a date picker, time picker, or a picker with both date and time. The saved values are stored in ISO 8601-format in the database, so they should be fine to sort posts by when using wp_query.
- Addded: action "simple_fields_admin_head". Use it to add content to the head of admin pages that use simple fields, i.e. the edit post screen. This action is better than admin_head because it's only fired on pages that use simple fields, so all other admin pages will be faster since they don't have to parse any unnecessary.
View
@@ -3,7 +3,7 @@
Plugin Name: Simple Fields
Plugin URI: http://simple-fields.com
Description: Add groups of textareas, input-fields, dropdowns, radiobuttons, checkboxes and files to your edit post screen.
-Version: 1.1
+Version: 1.1.1
Author: Pär Thernström
Author URI: http://eskapism.se/
License: GPL2
@@ -54,7 +54,7 @@ function init() {
define( "SIMPLE_FIELDS_URL", plugins_url(basename(dirname(__FILE__))). "/");
define( "SIMPLE_FIELDS_NAME", "Simple Fields");
- define( "SIMPLE_FIELDS_VERSION", "1.1");
+ define( "SIMPLE_FIELDS_VERSION", "1.1.1");
load_plugin_textdomain( 'simple-fields', null, basename(dirname(__FILE__)).'/languages/');
@@ -201,7 +201,7 @@ function admin_enqueue_scripts($hook) {
$current_screen = get_current_screen();
#sf_d($current_screen);
#sf_d($hook);
- if ($current_screen->base == "post" && in_array($current_screen->base, $this->get_post_connector_attached_types())) {
+ if ($current_screen->base == "post" && in_array($current_screen->post_type, $this->get_post_connector_attached_types())) {
$is_on_simple_fields_page = TRUE;
$page_type = "post";
} elseif ($current_screen->base === "media-upload") {
@@ -1051,7 +1051,7 @@ function admin_head() {
// Only run code if on a SF page
$current_screen = get_current_screen();
- if ($current_screen->base == "post" && in_array($current_screen->base, $this->get_post_connector_attached_types())) {
+ if ($current_screen->base == "post" && in_array($current_screen->post_type, $this->get_post_connector_attached_types())) {
$is_on_simple_fields_page = TRUE;
$page_type = "post";
}

0 comments on commit 4c159af

Please sign in to comment.