WordPress.org

Plugin Directory

Changeset 647599


Ignore:
Timestamp:
01/03/13 21:41:36 (16 months ago)
Author:
eskapism
Message:

version 1.1.6

Location:
simple-fields/trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • simple-fields/trunk/field_types/field_date_v2.php

    r621721 r647599  
    3232            wp_enqueue_script('jquery-ui-datepicker'); 
    3333            $ui = $wp_scripts->query('jquery-ui-core'); 
    34             $url = "https://ajax.aspnetcdn.com/ajax/jquery.ui/{$ui->ver}/themes/smoothness/jquery.ui.all.css"; 
     34            //$url = "https://ajax.aspnetcdn.com/ajax/jquery.ui/{$ui->ver}/themes/smoothness/jquery.ui.all.css"; 
     35            $url = "https://ajax.googleapis.com/ajax/libs/jqueryui/{$ui->ver}/themes/smoothness/jquery-ui.css"; 
    3536            wp_enqueue_style('jquery-ui-smoothness', $url, false, $ui->ver); 
    3637 
     
    3839 
    3940            // Language files 
    40             $url = "https://ajax.aspnetcdn.com/ajax/jquery.ui/{$ui->ver}/i18n/jquery-ui-i18n.min.js"; 
     41            //$url = "https://ajax.aspnetcdn.com/ajax/jquery.ui/{$ui->ver}/i18n/jquery-ui-i18n.min.js"; 
     42            $url = "https://ajax.googleapis.com/ajax/libs/jqueryui/{$ui->ver}/i18n/jquery-ui-i18n.min.js"; 
    4143            wp_enqueue_script('jquery-ui-18n', $url, false, $ui->ver); 
    4244 
  • simple-fields/trunk/functions.php

    r625129 r647599  
    681681    } // if passed as arg field group has fields 
    682682 
     683    update_option("simple_fields_groups", $field_groups); 
    683684    $sf->clear_caches(); 
    684     update_option("simple_fields_groups", $field_groups); 
    685  
    686     return $field_groups[$field_group_id]; 
     685 
     686    // Re-get the field so it's the same as when getting a field group manually 
     687    return $sf->get_field_group_by_slug($slug); 
     688 
     689    // return $field_groups[$field_group_id]; 
    687690 
    688691} 
  • simple-fields/trunk/readme.txt

    r627684 r647599  
    55Requires at least: 3.3.1 
    66Tested up to: 3.5 
    7 Stable tag: 1.1.5 
    8  
    9 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. 
     7Stable tag: 1.1.6 
     8 
     9With Simple Fields you can add any kind of custom fields to your pages and posts. 
    1010 
    1111== Description == 
    12  
    13 Simple Fields for WordPress let you add groups of fields to your edit post page. 
    14  
    15 Simple Fields turns WordPress into an even more powerful Content Management System (CMS). 
    16  
    17 #### Features and highlight 
    18  
    19 * Add textboxes, text areas, checkboxes, radio buttons, dropdowns, and file browser to the post admin area 
    20 * Much easier for the user than regular custom fields 
    21 * Group fields together into logical groups. For example combine File + Name + Description into a an Attachments-group, that let's you add multiple files to your posts 
    22 * Use "repeatable" field groups to add many any amount of field groups to a single post (great for images or attachments!) 
    23 * Use drag and drop to change order of added repeatable groups 
    24 * Different post types can use different field groups - actually you can even use different field groups even for same post type 
    25 * Can be used on any post type, including custom post types 
    26 * Nice GUI that looks like it belongs to the regular WordPress GUI 
    27  
    28 For more information check out my introductory blog post: 
    29 http://eskapism.se/blogg/2010/05/simple-fields-wp-custom-fields-on-steroids/ 
    30  
    31 To get started check out the getting started section here: 
    32 http://simple-fields.com/documentation/getting-started/ 
    33  
    34 #### Upgrading? Then backup your database 
    35  
    36 Please remember to backup your database when you upgrade this plugin. Everything should work fine, but just to be sure and safe: backup the database! 
    37  
    38 #### Help and Support 
    39  
    40 If you have questions/bug reports/feature requests for Simple Fields please use the WordPress [Support Forum](http://wordpress.org/tags/simple-fields?forum_id=10) or  
    41 [the new GitHub project page for Simple Fields](github.com/bonny/WordPress-Simple-Fields/). 
    42 There are also [tutorials available for Simple Fields](http://simple-fields.com/documentation/). 
    43  
    44 #### Donation and more plugins 
    45 * If you like this plugin don't forget to [donate to support further development](http://simple-fields.com/about/donate/). 
    46 * Also check out some [more CMS-focused plugins](http://wordpress.org/extend/plugins/profile/eskapism) by the same author. 
    47  
     12The built in custom fields in WordPress are great, but they do come with a big limitation: they only support plain text. To overcome this limitation I created the Simple Fields WordPress plugin. 
     13 
     14With Simple Fields you can add for example textboxes, text areas, checkboxes, radio buttons, dropdowns, and file browser to the post admin area. These fields are all much easier to use for the user than regular custom fields. 
     15 
     16All fields are grouped into logical groups called Field Groups. You can for example combine File + Name + Description into a an Attachments-group, that lets you add multiple files to your posts. 
     17 
     18Use "repeatable" field groups to add many any amount of field groups to a single post (great for images or attachments!) 
     19 
     20Simple Fields can be used on any post type, including custom post types. 
     21 
     22## Field Types 
     23 
     24Simple Fields comes bundled with a useful variation of fields. Note that any field can be added any number of times to a post using repeatable fields. 
     25 
     26The fields that are included in Simple Fields are: 
     27 
     28Text 
     29: A simple text input to enter any kind of information. 
     30 
     31Textarea 
     32: A bigger area for inputing text. Even support WYSIWYG/TinyMCE-mode that makes it work like the regular content editor, so you can insert images, headlines, list, paragraphs and so on. 
     33 
     34Checkbox 
     35: A simple checkbox to be able to select something on/off. 
     36 
     37 Radio Buttons 
     38: Add multiple radiobuttons where a user can select one of the buttons. Useful for letting a user choose between multiple options. 
     39  
     40Dropdown 
     41: Add multiple values to a dropdown box. User can select one or several items in the list. Useful for letting your users select one or severall things. 
     42 
     43File 
     44: Select any file using the built in file/media browser in WordPress. Since it's using the built in media browser you can also upload new images/attachments to your posts. Using this field together with repeatable field groups = very powerful! :) 
     45 
     46Post 
     47: Select any post that exists in WordPress. Can be pages or any custom post type. 
     48 
     49Taxonomy 
     50: Select a taxonomy from a list of taxonomies. 
     51 
     52Taxonomy Term 
     53: Select a term from a taxonomy. 
     54 
     55Color 
     56: Show a color picker where the user can choose any color. The color can also be entered manually, if the user knows the hex value of the color. 
     57 
     58 Date and Time 
     59: Chose a date and optionally time from a JQuery UI date and time picker. 
     60  
     61 User 
     62: Choose a user from the system. 
     63  
     64See the [field documentation](http://simple-fields.com/documentation/field-types/) for more details about the different fields. 
     65  
     66## Use Field Type Extensions to add your own field types 
     67 
     68If you miss a field type in Simple Fields you can use [Field Extensions](http://simple-fields.com/extensions/) to add more field types. These are fields that are created by other developers and shared with the Simple Fields community. 
     69 
     70if you want to create your own field you can do that using the [Extension API](http://simple-fields.com/documentation/api/extension-api/). 
     71 
     72## Repeatable fields 
     73 
     74Often just a single field is not enough. Why limit yourself to just one image or one attachment? With Repeatable Fields you can add as many images, text fields, textareas, or any other field type, as you want to to a post. This is a very useful feature when you want to create for example image slideshows or pages with many file attachments. 
     75 
     76Add attachments and image slideshows in a snap. 
     77 
     78Also, the fields in a a repeatable field group are easily sorted using drag and drop. 
     79 
     80## Simple PHP functions to speed up your development 
     81 
     82` 
     83simple_fields_value(); 
     84simple_fields_values(); 
     85` 
     86 
     87## Works with all post types 
     88 
     89With Simple Fields you can add fields to both regular pages and posts and to any custom post type. 
     90 
     91Different post types can use different field groups - actually you can even use different field groups even for same post type, on a post to post basis. 
     92 
     93## Unit testing to minimize risk of errors 
     94 
     95A lot of the functionality in Simple Fields is tested using unit testing. Test cases exists for all the functions that involve getting field values from your posts. This way the risk of anything breaking on a site after upgrade in minimized. 
     96 
     97## Help and Support 
     98 
     99If you have questions/bug reports/feature requests for Simple Fields then: 
     100 
     101* use the [WordPress Support Forum](http://wordpress.org/support/plugin/simple-fields)  
     102* visit the [GitHub project page for Simple Fields](http://github.com/bonny/WordPress-Simple-Fields) 
     103* view the [getting started guide](http://simple-fields.com/documentation/getting-started/) 
     104 
     105## Donate to keep this plugin free 
     106 * If you like this plugin don't forget to [donate to support further development](http://simple-fields.com/about/donate/). 
    48107 
    49108== Installation == 
     
    143202                                                  'priority' => 'high') 
    144203                                      ), 
    145                     'post_types' => array('post') 
     204                    'post_types' => array('post'), 
     205                    'hide_editor' => 0 
    146206                ) 
    147207); 
     
    164224 
    165225== Changelog == 
     226 
     227#### Version 1.1.6 
     228- Fixed bug that could lead to memoryleak. Thanks to plux/angry creative for patch. 
     229- Fixed some notice messages 
     230- Changed CDN for Date Picker 2 to use Google instead of Microsoft, because the one from Microsoft - ajax.aspnetcdn.com - was always slow for me + it have been completely down too. 
     231- Fixed problem with slug for field group info inside a field 
     232- Perhaps fixed a problem with the wp object cache 
     233- Updated readme to contain lots of more information 
    166234 
    167235#### Version 1.1.5 
  • simple-fields/trunk/simple_fields.php

    r627684 r647599  
    44Plugin URI: http://simple-fields.com 
    55Description: Add groups of textareas, input-fields, dropdowns, radiobuttons, checkboxes and files to your edit post screen. 
    6 Version: 1.1.5 
     6Version: 1.1.6 
    77Author: Pär Thernström 
    88Author URI: http://eskapism.se/ 
     
    5555        define( "SIMPLE_FIELDS_URL", plugins_url(basename(dirname(__FILE__))). "/"); 
    5656        define( "SIMPLE_FIELDS_NAME", "Simple Fields"); 
    57         define( "SIMPLE_FIELDS_VERSION", "1.1.5"); 
     57        define( "SIMPLE_FIELDS_VERSION", "1.1.6"); 
    5858 
    5959        load_plugin_textdomain( 'simple-fields', null, basename(dirname(__FILE__)).'/languages/'); 
     
    6363        // http://core.trac.wordpress.org/ticket/4476 
    6464        $ns_key = wp_cache_get( 'simple_fields_namespace_key', 'simple_fields' ); 
    65         if ( $ns_key === false ) wp_cache_set( 'simple_fields_namespace_key', 1, 'simple_fields' ); 
     65        if ( $ns_key === false ) { 
     66            wp_cache_set( 'simple_fields_namespace_key', 1, 'simple_fields' ); 
     67            // echo "cache key init set"; 
     68        } 
    6669        $this->ns_key = wp_cache_get( 'simple_fields_namespace_key', 'simple_fields' ); 
    67          
     70        // echo "ns_key is: $this->ns_key"; // 1 
     71 
    6872        require( dirname(__FILE__) . "/functions.php" ); 
    6973        require( dirname(__FILE__) . "/class_simple_fields_field.php" ); 
     
    106110        // Boot up 
    107111        do_action("simple_fields_init", $this); 
    108          
     112 
    109113    } 
    110114 
     
    622626 
    623627                        echo "<div class='simple-fields-metabox-field-second'>"; 
     628 
    624629                        $radio_options = $field["type_radiobuttons_options"]; 
    625630                        $radio_checked_by_default_num = @$radio_options["checked_by_default_num"]; 
    626631     
    627  
    628632                        $loopNum = 0; 
    629633                        foreach ($radio_options as $one_radio_option_key => $one_radio_option_val) { 
    630                             if ($one_radio_option_key == "checked_by_default_num") { continue; } 
    631                             if ($one_radio_option_val["deleted"]) { continue; } 
     634                             
     635                            // only values like radiobutton_num_2 are allowed 
     636                            if ( strpos($one_radio_option_key, "radiobutton_num_") === FALSE) { continue; } 
     637                             
     638                            // Skip deleted ones 
     639                            if (isset($one_radio_option_val["deleted"]) && $one_radio_option_val["deleted"]) { continue; } 
     640 
    632641                            $radio_field_unique_id = $field_unique_id . "_radio_".$loopNum; 
     642                            $one_radio_option_val_val = isset($one_radio_option_val["value"]) ? $one_radio_option_val["value"] : ""; 
    633643                             
    634644                            $selected = ""; 
     
    640650                                                     
    641651                            echo "<div class='simple-fields-metabox-field-radiobutton'>"; 
    642                             echo "<input $selected name='$field_name' id='$radio_field_unique_id' type='radio' value='$one_radio_option_key' />"; 
    643                             echo "<label for='$radio_field_unique_id' class='simple-fields-for-radiobutton'> ".$one_radio_option_val["value"]."</label>"; 
    644                             echo "</div>"; 
    645                              
     652                            echo "  <input $selected name='$field_name' id='$radio_field_unique_id' type='radio' value='$one_radio_option_key' />"; 
     653                            echo "  <label for='$radio_field_unique_id' class='simple-fields-for-radiobutton'> " . $one_radio_option_val_val . "</label>"; 
     654                            echo "</div>";                           
    646655                             
    647656                            $loopNum++; 
    648657                        } 
    649  
    650658 
    651659                        echo "</div>"; 
     
    672680                        foreach ($field["type_dropdown_options"] as $one_option_internal_name => $one_option) { 
    673681                             
    674                             if ($one_option["deleted"]) { continue; } 
     682                            if (isset($one_option["deleted"]) && $one_option["deleted"]) { continue; } 
    675683                            if (strpos($one_option_internal_name, "dropdown_num_") === FALSE) continue; 
    676684 
     
    14481456                            "id"           => $field_groups[$i]["id"], 
    14491457                            "name"         => $field_groups[$i]["name"], 
    1450                             "slug"         => $field_groups[$i]["id"], 
     1458                            "slug"         => $field_groups[$i]["slug"], 
    14511459                            "description"  => $field_groups[$i]["description"], 
    14521460                            "repeatable"   => $field_groups[$i]["repeatable"], 
     
    25782586                $field_groups[$field_group_id]["deleted"] = true; 
    25792587                update_option("simple_fields_groups", $field_groups); 
     2588                $this->clear_caches(); 
    25802589                $simple_fields_did_delete = true; 
    25812590                $action = ""; 
     
    25902599                $post_connectors[$post_connector_id]["deleted"] = 1; 
    25912600                update_option("simple_fields_post_connectors", $post_connectors); 
     2601                $this->clear_caches(); 
    25922602                $simple_fields_did_delete_post_connector = true; 
    25932603                $action = ""; 
     
    26242634                     
    26252635                    update_option("simple_fields_groups", $field_groups); 
     2636                    $this->clear_caches(); 
    26262637 
    26272638                    // we can have changed the options of a field group, so update connectors using this field group 
     
    26342645                    } 
    26352646                    update_option("simple_fields_post_connectors", $post_connectors); 
     2647                    $this->clear_caches(); 
    26362648                     
    26372649                    $simple_fields_did_save = true; 
     
    26812693     
    26822694                    update_option("simple_fields_post_connectors", $post_connectors); 
     2695                    $this->clear_caches(); 
    26832696     
    26842697                    $simple_fields_did_save_connector = true; 
     
    30863099     
    30873100                    <?php 
    3088                     if (isset($simple_fields_did_save_connector) && $simple_fields_did_save_connector) { 
     3101                    if (isset($simple_fields_did_save_connector) && $simple_fields_did_save_connector === true) { 
    30893102                        ?><div id="message" class="updated"><p><?php _e('Post connector saved', 'simple-fields') ?></p></div><?php 
    30903103                    } 
     
    32933306        $new_options = wp_parse_args($new_options, $old_options); 
    32943307        update_option("simple_fields_options", $new_options); 
     3308        $this->clear_caches(); 
    32953309    } 
    32963310     
     
    35073521                if ($button_key == "checked_by_default_num") continue; 
    35083522                 
    3509                 if ($button_value["deleted"]) continue; 
     3523                if (isset($button_value["deleted"]) && $button_value["deleted"]) continue; 
     3524                 
     3525                $button_value_value = isset($button_value["value"]) ? $button_value["value"] : ""; 
    35103526                 
    35113527                $return_field_value["radiobuttons"][] = array( 
    3512                     "value"       => $button_value["value"], 
     3528                    "value"       => $button_value_value, 
    35133529                    "key"         => $button_key, 
    35143530                    "is_selected" => ($field_value === $button_key) 
     
    35163532                if ($field_value === $button_key) { 
    35173533                    $return_field_value["selected_radiobutton"] = array( 
    3518                         "value"       => $button_value["value"], 
     3534                        "value"       => $button_value_value, 
    35193535                        "key"         => $button_key, 
    35203536                        "is_selected" => TRUE 
     
    35403556                foreach ($type_dropdown_options as $dropdown_key => $dropdown_value) { 
    35413557 
    3542                     if ($dropdown_value["deleted"]) continue; 
     3558                    // Only values like dropdown_num_2 are allowed 
     3559                    if ( strpos($dropdown_key, "dropdown_num_") === FALSE) { continue; } 
     3560 
     3561                    // Skip deleted 
     3562                    if (isset($dropdown_value["deleted"]) && $dropdown_value["deleted"]) continue;                   
     3563                     
     3564                    $dropdown_value_value = isset($dropdown_value["value"]) ? $dropdown_value["value"] : ""; 
    35433565                     
    35443566                    $return_field_value["options"][] = array( 
    3545                         "value"       => $dropdown_value["value"], 
     3567                        "value"       => $dropdown_value_value, 
    35463568                        "key"         => $dropdown_key, 
    35473569                        "is_selected" => in_array($dropdown_key, $arr_dropdown_values) 
     
    35513573                         
    35523574                        $return_field_value["selected_options"][] = array( 
    3553                             "value"       => $dropdown_value["value"], 
     3575                            "value"       => $dropdown_value_value, 
    35543576                            "key"         => $dropdown_key, 
    35553577                            "is_selected" => TRUE 
     
    35693591                foreach ($type_dropdown_options as $dropdown_key => $dropdown_value) { 
    35703592 
     3593                    // Only values like dropdown_num_2 are allowed 
     3594                    if ( strpos($dropdown_key, "dropdown_num_") === FALSE) { continue; } 
     3595 
     3596                    // Skip deleted 
    35713597                    if ($dropdown_value["deleted"]) continue; 
    35723598                     
     
    36893715     */ 
    36903716    function get_field_group_by_slug($field_group_slug) { 
    3691          
     3717#echo 111;       
     3718#var_dump($this->ns_key); 
    36923719        $cache_key = 'simple_fields_'.$this->ns_key.'_get_field_group_by_slug_' . $field_group_slug; 
     3720#echo $cache_key; 
    36933721        $return_val = wp_cache_get( $cache_key, 'simple_fields' ); 
    36943722        if (FALSE === $return_val) { 
     
    37533781    } 
    37543782 
     3783    /** 
     3784     * Clear the key used for wp_cache_get and wp_cache_set 
     3785     * Run this when options etc have been changed so fresh values are fetched upon next get 
     3786     */ 
    37553787    function clear_caches() { 
     3788 
     3789        $prev_key = $this->ns_key; 
    37563790        $this->ns_key = wp_cache_incr( 'simple_fields_namespace_key', 1, 'simple_fields' ); 
     3791        if ($this->ns_key === FALSE) { 
     3792            // I really don't know why, but wp_cache_incr returns false...always or sometimes? 
     3793            // Manually update namespace key by one 
     3794            $this->ns_key = $prev_key + 1; 
     3795            wp_cache_set( 'simple_fields_namespace_key', $this->ns_key, 'simple_fields' ); 
     3796        } 
     3797        // echo "clear_key";var_dump($this->ns_key); 
    37573798    } 
    37583799     
  • simple-fields/trunk/tests/SimpleFieldsTests/SimpleFieldsTest.php

    r618615 r647599  
    99        parent::setUp(); 
    1010        global $sf; 
     11 
    1112        $this->sf = $sf; 
    12          
    1313    } 
    1414 
     
    435435        ); 
    436436        $this->assertEquals($arr, $this->sf->get_post_connectors() ); 
    437              
     437 
    438438    } 
    439439 
     
    983983 
    984984        $expected_return = array( 
    985             'id' => 2, 
     985            'id' => 4, 
    986986            'key' => 'my_new_field_group', 
    987987            'slug' => 'my_new_field_group', 
     
    10031003                    ), 
    10041004                    'id' => 0, 
    1005                     'deleted' => 0 
    1006                 ) 
     1005                    'deleted' => 0, 
     1006                    "field_group" => array( 
     1007                        "id" => 4, 
     1008                        "name" => "Test field group", 
     1009                        "slug" => "my_new_field_group", 
     1010                        "description" => "Test field description", 
     1011                        "repeatable" => 1, 
     1012                        "fields_count" => 1 
     1013                    ) 
     1014                ), 
    10071015            ), 
    1008             'deleted' => false 
    1009         ); 
    1010          
     1016            'deleted' => false, 
     1017            "fields_count" => 1 
     1018        ); 
     1019#echo "xxx";print_r($arr_return); 
    10111020        $this->assertEquals( $expected_return, $arr_return ); 
    10121021         
     
    10561065                    ), 
    10571066                    'id' => 0, 
    1058                     'deleted' => 0 
     1067                    'deleted' => 0, 
     1068                    "field_group" => array() 
    10591069                ), 
    10601070            ), 
    1061             'deleted' => false 
    1062         ); 
    1063          
     1071            'deleted' => false, 
     1072            "fields_count" => 1 
     1073        ); 
     1074 
    10641075        $this->assertEquals( array_keys($expected_return), array_keys($arr_return) ); 
    10651076         
Note: See TracChangeset for help on using the changeset viewer.