WordPress.org

Plugin Directory

Changeset 621721


Ignore:
Timestamp:
11/06/12 15:30:37 (18 months ago)
Author:
eskapism
Message:

1.1.3

Location:
simple-fields
Files:
4 edited
17 copied

Legend:

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

    r620797 r621721  
    239239            $str_unixtime_to_set = ""; 
    240240            if (isset($options["use_defaults"]) && $options["use_defaults"]) { 
    241                 if ($options["default_date"] === "today") { 
     241                if (isset($options["default_date"]) && $options["default_date"] === "today") { 
    242242                    $str_unixtime_to_set = time() * 1000; 
    243                     $str_iso_to_set = date("Y-m-d H:i"); 
    244                 } elseif ($options["default_date"] === "no_date") { 
     243                    $str_iso_to_set = date("Y/m/d H:i"); 
     244                } elseif (isset($options["default_date"]) && $options["default_date"] === "no_date") { 
    245245                     
    246246                } 
     
    252252                    // if only time, then make it a full date to be able to create javascript date object 
    253253                    //$str_saved_unixtime = "2000-01-01 $str_saved_unixtime"; 
    254                     $str_iso_to_set = "1970-01-01 $str_saved_unixtime"; 
     254                    $str_iso_to_set = "1970/01/01 $str_saved_unixtime"; 
    255255                } else { 
    256                     $str_iso_to_set = $saved_values["saved_date_time"]; 
     256                    $str_iso_to_set = date("Y/m/d H:i", strtotime($saved_values["saved_date_time"]) ); 
    257257                } 
    258258                $str_unixtime_to_set = strtotime($str_saved_unixtime); 
     
    275275            $method_name = "datepicker"; 
    276276            $altFieldTimeOnly = "false"; 
    277             $show_as = $options["show_as"]; 
     277            $show_as = isset($options["show_as"]) ? $options["show_as"] : "date"; 
    278278            $alt_format = "yy-mm-dd"; 
    279279            if ("datetime" === $show_as) { 
     
    425425                        "type" => "date", 
    426426                        "date_unixtime" => $one_value_unix, 
    427                         "ISO_8601" => date("c", $one_value_unix), 
     427                        "ISO_8601" => date("Y-m-d", $one_value_unix), 
    428428                        "RFC_2822" => date("r", $one_value_unix), 
    429429                        "Y-m-d" => date("Y-m-d", $one_value_unix), 
     
    437437                        "type" => "datetime", 
    438438                        "date_unixtime" => $one_value_unix, 
    439                         "ISO_8601" => date("c", $one_value_unix), 
     439                        "ISO_8601" => date("Y-m-d H:i", $one_value_unix), 
    440440                        "RFC_2822" => date("r", $one_value_unix), 
    441441                        "Y-m-d" => date("Y-m-d", $one_value_unix), 
  • simple-fields/tags/1.1.3/readme.txt

    r621362 r621721  
    55Requires at least: 3.3.1 
    66Tested up to: 3.4.2 
    7 Stable tag: 1.1.2 
     7Stable tag: 1.1.3 
    88 
    99Add 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. 
     
    164164 
    165165== Changelog == 
     166 
     167#### Version 1.1.3 
     168- Fixed date and time picker not working in Firefox (I spend way too much time in Chrome nowadays...) 
     169- Changed date and time picker to use simplified ISO 8601 return format 
     170- Changed repeatable fields to be a bit more nice looking, IMHO anyway :) 
     171- Changed file field to show "edit" and "remove"-links only on mouse over. Yes, I really want less clutter in my plugin. 
     172- Fixed some notice warnings 
     173- Fixed: use built in function to remove meta instead of direct sql calls. fixes some problem in wp 3.5b. And it feel a lot less dirty. 
     174- Misc other stuff 
    166175 
    167176#### Version 1.1.2 
  • simple-fields/tags/1.1.3/simple_fields.php

    r621362 r621721  
    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.2 
     6Version: 1.1.3 
    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.2"); 
     57        define( "SIMPLE_FIELDS_VERSION", "1.1.3"); 
    5858 
    5959        load_plugin_textdomain( 'simple-fields', null, basename(dirname(__FILE__)).'/languages/'); 
     
    366366        // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want to do anything 
    367367        if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) { return $post_id; } 
     368 
     369        // dont's save if is revision 
     370        if (wp_is_post_revision($post_id) !== FALSE) return $post_id; 
    368371         
    369372        // attach post connector 
     
    382385        if ($post_id && is_array($fieldgroups)) { 
    383386     
    384             // remove existing simple fields custom fields for this post 
    385             $wpdb->query("DELETE FROM $table WHERE post_id = $post_id AND meta_key LIKE '_simple_fields_fieldGroupID_%'"); 
     387            #echo "fieldgroups is:";sf_d($fieldgroups); 
     388 
     389            // Delete all exisiting custom fields meta that begins with "_simple_fields_fieldGroupID_", .ie. position 0 
     390            $post_meta = get_post_custom($post_id); 
     391            foreach ($post_meta as $meta_key => $meta_val) { 
     392                if ( strpos($meta_key, "_simple_fields_fieldGroupID_") === 0 ) delete_post_meta($post_id, $meta_key); 
     393            } 
    386394     
    387395            // cleanup missing keys, due to checkboxes not being checked 
     
    473481     
    474482                        } 
    475  
     483                         
     484                        // echo "<br>Saving value for post with id $post_id. Custom_field_key is $custom_field_key, custom_field_value is:";sf_d($custom_field_value); 
    476485                        update_post_meta($post_id, $custom_field_key, $custom_field_value); 
    477486                        $num_in_set++; 
     
    488497            $wpdb->query("DELETE FROM $table WHERE post_id = $post_id AND meta_key LIKE '_simple_fields_fieldGroupID_%'"); 
    489498        }  
     499        // echo "end save"; 
    490500     
    491501    } // save postdata 
     
    10541064        // Only run code if on a SF page 
    10551065        $current_screen = get_current_screen(); 
     1066        $is_on_simple_fields_page = FALSE; 
    10561067        if ($current_screen->base == "post" && in_array($current_screen->post_type, $this->get_post_connector_attached_types())) { 
    10571068            $is_on_simple_fields_page = TRUE; 
    10581069            $page_type = "post"; 
    10591070        } 
    1060         if (!is_on_simple_fields_page) return; 
     1071 
     1072        if (!$is_on_simple_fields_page) return; 
    10611073 
    10621074        // Add meta box to post 
  • simple-fields/tags/1.1.3/styles-edit-post.css

    r620797 r621721  
    2121} 
    2222 
     23 
    2324.simple-fields-metabox-field-add-bottom { 
    2425    display: none; 
     
    4041ul.simple-fields-metabox-field-group-fields li { 
    4142    position: relative; 
     43} 
     44 
     45/* remove margin added by default to inside by WP */ 
     46ul.simple-fields-metabox-field-group-fields { 
     47    margin: 0 -10px; 
    4248} 
    4349 
     
    5561    padding: .5em 1.5em; 
    5662    margin: 0 0 0 0; 
    57     opacity: .75; 
     63    opacity: .8; 
    5864} 
    5965ul.simple-fields-metabox-field-group-fields-repeatable li:hover { 
     
    6167    opacity: 1; 
    6268} 
    63 /*ul.simple-fields-metabox-field-group-fields-repeatable li.active { 
    64     background-color: #fff7db; 
    65 }*/ 
     69 
    6670 
    6771.simple-fields-metabox-field-group-handle 
     
    7074    height: 16px; 
    7175    background: transparent url(icon-drag.gif) no-repeat 0 50%; 
    72     /*float: left;*/ 
    7376    cursor: move; 
    74     margin-top: 7px; 
    7577    display: none; 
    7678    position: absolute; 
     79    margin-left: -16px; 
     80    margin-top: 12px; 
    7781} 
    7882.simple-fields-metabox-field-group-fields-repeatable:hover .simple-fields-metabox-field-group-handle { 
    7983    display: block; 
    80     margin-left: -16px; 
    81     margin-top: 10px; 
    82 } 
    83  
    84 /*.simple-fields-metabox-field-group:hover .simple-fields-metabox-field-group-handle { 
    85 } 
    86 */ 
     84} 
     85 
     86 
     87 
    8788.simple-fields-metabox-field-group input.text { 
    8889    border: 1px solid #dfdfdf; 
     
    223224    } 
    224225 
    225  
    226226    .simple-fields-metabox-field-file { 
    227227        height: 50px; 
     
    250250        margin-left: 56px; 
    251251        margin-top: -46px; 
     252    } 
     253 
     254    .xxxsimple-fields-metabox-field-file-select, 
     255    .simple-fields-metabox-field-file-edit, 
     256    .simple-fields-metabox-field-file-clear { 
     257        visibility: hidden; 
     258    } 
     259    .simple-fields-metabox-field-group:hover .simple-fields-metabox-field-file-select, 
     260    .simple-fields-metabox-field-group:hover .simple-fields-metabox-field-file-edit, 
     261    .simple-fields-metabox-field-group:hover .simple-fields-metabox-field-file-clear { 
     262        visibility: visible; 
    252263    } 
    253264 
  • simple-fields/trunk/field_types/field_date_v2.php

    r620797 r621721  
    239239            $str_unixtime_to_set = ""; 
    240240            if (isset($options["use_defaults"]) && $options["use_defaults"]) { 
    241                 if ($options["default_date"] === "today") { 
     241                if (isset($options["default_date"]) && $options["default_date"] === "today") { 
    242242                    $str_unixtime_to_set = time() * 1000; 
    243                     $str_iso_to_set = date("Y-m-d H:i"); 
    244                 } elseif ($options["default_date"] === "no_date") { 
     243                    $str_iso_to_set = date("Y/m/d H:i"); 
     244                } elseif (isset($options["default_date"]) && $options["default_date"] === "no_date") { 
    245245                     
    246246                } 
     
    252252                    // if only time, then make it a full date to be able to create javascript date object 
    253253                    //$str_saved_unixtime = "2000-01-01 $str_saved_unixtime"; 
    254                     $str_iso_to_set = "1970-01-01 $str_saved_unixtime"; 
     254                    $str_iso_to_set = "1970/01/01 $str_saved_unixtime"; 
    255255                } else { 
    256                     $str_iso_to_set = $saved_values["saved_date_time"]; 
     256                    $str_iso_to_set = date("Y/m/d H:i", strtotime($saved_values["saved_date_time"]) ); 
    257257                } 
    258258                $str_unixtime_to_set = strtotime($str_saved_unixtime); 
     
    275275            $method_name = "datepicker"; 
    276276            $altFieldTimeOnly = "false"; 
    277             $show_as = $options["show_as"]; 
     277            $show_as = isset($options["show_as"]) ? $options["show_as"] : "date"; 
    278278            $alt_format = "yy-mm-dd"; 
    279279            if ("datetime" === $show_as) { 
     
    425425                        "type" => "date", 
    426426                        "date_unixtime" => $one_value_unix, 
    427                         "ISO_8601" => date("c", $one_value_unix), 
     427                        "ISO_8601" => date("Y-m-d", $one_value_unix), 
    428428                        "RFC_2822" => date("r", $one_value_unix), 
    429429                        "Y-m-d" => date("Y-m-d", $one_value_unix), 
     
    437437                        "type" => "datetime", 
    438438                        "date_unixtime" => $one_value_unix, 
    439                         "ISO_8601" => date("c", $one_value_unix), 
     439                        "ISO_8601" => date("Y-m-d H:i", $one_value_unix), 
    440440                        "RFC_2822" => date("r", $one_value_unix), 
    441441                        "Y-m-d" => date("Y-m-d", $one_value_unix), 
  • simple-fields/trunk/readme.txt

    r621362 r621721  
    55Requires at least: 3.3.1 
    66Tested up to: 3.4.2 
    7 Stable tag: 1.1.2 
     7Stable tag: 1.1.3 
    88 
    99Add 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. 
     
    164164 
    165165== Changelog == 
     166 
     167#### Version 1.1.3 
     168- Fixed date and time picker not working in Firefox (I spend way too much time in Chrome nowadays...) 
     169- Changed date and time picker to use simplified ISO 8601 return format 
     170- Changed repeatable fields to be a bit more nice looking, IMHO anyway :) 
     171- Changed file field to show "edit" and "remove"-links only on mouse over. Yes, I really want less clutter in my plugin. 
     172- Fixed some notice warnings 
     173- Fixed: use built in function to remove meta instead of direct sql calls. fixes some problem in wp 3.5b. And it feel a lot less dirty. 
     174- Misc other stuff 
    166175 
    167176#### Version 1.1.2 
  • simple-fields/trunk/simple_fields.php

    r621362 r621721  
    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.2 
     6Version: 1.1.3 
    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.2"); 
     57        define( "SIMPLE_FIELDS_VERSION", "1.1.3"); 
    5858 
    5959        load_plugin_textdomain( 'simple-fields', null, basename(dirname(__FILE__)).'/languages/'); 
     
    366366        // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want to do anything 
    367367        if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) { return $post_id; } 
     368 
     369        // dont's save if is revision 
     370        if (wp_is_post_revision($post_id) !== FALSE) return $post_id; 
    368371         
    369372        // attach post connector 
     
    382385        if ($post_id && is_array($fieldgroups)) { 
    383386     
    384             // remove existing simple fields custom fields for this post 
    385             $wpdb->query("DELETE FROM $table WHERE post_id = $post_id AND meta_key LIKE '_simple_fields_fieldGroupID_%'"); 
     387            #echo "fieldgroups is:";sf_d($fieldgroups); 
     388 
     389            // Delete all exisiting custom fields meta that begins with "_simple_fields_fieldGroupID_", .ie. position 0 
     390            $post_meta = get_post_custom($post_id); 
     391            foreach ($post_meta as $meta_key => $meta_val) { 
     392                if ( strpos($meta_key, "_simple_fields_fieldGroupID_") === 0 ) delete_post_meta($post_id, $meta_key); 
     393            } 
    386394     
    387395            // cleanup missing keys, due to checkboxes not being checked 
     
    473481     
    474482                        } 
    475  
     483                         
     484                        // echo "<br>Saving value for post with id $post_id. Custom_field_key is $custom_field_key, custom_field_value is:";sf_d($custom_field_value); 
    476485                        update_post_meta($post_id, $custom_field_key, $custom_field_value); 
    477486                        $num_in_set++; 
     
    488497            $wpdb->query("DELETE FROM $table WHERE post_id = $post_id AND meta_key LIKE '_simple_fields_fieldGroupID_%'"); 
    489498        }  
     499        // echo "end save"; 
    490500     
    491501    } // save postdata 
     
    10541064        // Only run code if on a SF page 
    10551065        $current_screen = get_current_screen(); 
     1066        $is_on_simple_fields_page = FALSE; 
    10561067        if ($current_screen->base == "post" && in_array($current_screen->post_type, $this->get_post_connector_attached_types())) { 
    10571068            $is_on_simple_fields_page = TRUE; 
    10581069            $page_type = "post"; 
    10591070        } 
    1060         if (!is_on_simple_fields_page) return; 
     1071 
     1072        if (!$is_on_simple_fields_page) return; 
    10611073 
    10621074        // Add meta box to post 
  • simple-fields/trunk/styles-edit-post.css

    r620797 r621721  
    2121} 
    2222 
     23 
    2324.simple-fields-metabox-field-add-bottom { 
    2425    display: none; 
     
    4041ul.simple-fields-metabox-field-group-fields li { 
    4142    position: relative; 
     43} 
     44 
     45/* remove margin added by default to inside by WP */ 
     46ul.simple-fields-metabox-field-group-fields { 
     47    margin: 0 -10px; 
    4248} 
    4349 
     
    5561    padding: .5em 1.5em; 
    5662    margin: 0 0 0 0; 
    57     opacity: .75; 
     63    opacity: .8; 
    5864} 
    5965ul.simple-fields-metabox-field-group-fields-repeatable li:hover { 
     
    6167    opacity: 1; 
    6268} 
    63 /*ul.simple-fields-metabox-field-group-fields-repeatable li.active { 
    64     background-color: #fff7db; 
    65 }*/ 
     69 
    6670 
    6771.simple-fields-metabox-field-group-handle 
     
    7074    height: 16px; 
    7175    background: transparent url(icon-drag.gif) no-repeat 0 50%; 
    72     /*float: left;*/ 
    7376    cursor: move; 
    74     margin-top: 7px; 
    7577    display: none; 
    7678    position: absolute; 
     79    margin-left: -16px; 
     80    margin-top: 12px; 
    7781} 
    7882.simple-fields-metabox-field-group-fields-repeatable:hover .simple-fields-metabox-field-group-handle { 
    7983    display: block; 
    80     margin-left: -16px; 
    81     margin-top: 10px; 
    82 } 
    83  
    84 /*.simple-fields-metabox-field-group:hover .simple-fields-metabox-field-group-handle { 
    85 } 
    86 */ 
     84} 
     85 
     86 
     87 
    8788.simple-fields-metabox-field-group input.text { 
    8889    border: 1px solid #dfdfdf; 
     
    223224    } 
    224225 
    225  
    226226    .simple-fields-metabox-field-file { 
    227227        height: 50px; 
     
    250250        margin-left: 56px; 
    251251        margin-top: -46px; 
     252    } 
     253 
     254    .xxxsimple-fields-metabox-field-file-select, 
     255    .simple-fields-metabox-field-file-edit, 
     256    .simple-fields-metabox-field-file-clear { 
     257        visibility: hidden; 
     258    } 
     259    .simple-fields-metabox-field-group:hover .simple-fields-metabox-field-file-select, 
     260    .simple-fields-metabox-field-group:hover .simple-fields-metabox-field-file-edit, 
     261    .simple-fields-metabox-field-group:hover .simple-fields-metabox-field-file-clear { 
     262        visibility: visible; 
    252263    } 
    253264 
Note: See TracChangeset for help on using the changeset viewer.