WordPress.org

Plugin Directory

Changeset 725294


Ignore:
Timestamp:
06/11/13 12:56:00 (11 months ago)
Author:
eskapism
Message:

simple fields 1.3.3 is in da house

Location:
simple-fields
Files:
2 edited
24 copied

Legend:

Unmodified
Added
Removed
  • simple-fields/tags/1.3.3/readme.txt

    r718502 r725294  
    55Requires at least: 3.5.1 
    66Tested up to: 3.5.1 
    7 Stable tag: 1.3.2 
     7Stable tag: 1.3.3 
    88 
    99With Simple Fields you can add any kind of custom fields to your pages, posts and attachments. 
     
    3333Simple 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. 
    3434 
    35 The fields that are included in Simple Fields are: 
     35Fields types available in Simple Fields: 
    3636 
    3737* **Text**<br> 
     
    144144 
    145145== Changelog == 
     146 
     147#### Version 1.3.3 
     148 
     149- Added support for using "sf_meta_key" as an argument to regular wp_query. just add sf_meta_key = "field_group_slug/field_slug" to the args of wp_query and then the argument meta_key will automatically be filled with the correct custom field key to use for that field. Useful when you need to for example sort things based on simple fields in a wp_query. Please note that different field types store their values in different ways, but it works really good for plan text, date/timepicker, and probably some more too. 
     150 
     151- Added method get_field_by_fieldgroup_and_slug_string() that can retrive a field array based on a field group slug and a field slug. like this: $sf->get_field_by_fieldgroup_and_slug_string("my_fieldgroup_slug/my_field_slug"); 
    146152 
    147153#### Version 1.3.2 
  • simple-fields/tags/1.3.3/simple_fields.php

    r718500 r725294  
    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.3.2 
     6Version: 1.3.3 
    77Author: Pär Thernström 
    88Author URI: http://eskapism.se/ 
     
    5353    function init() { 
    5454 
    55         define( "SIMPLE_FIELDS_VERSION", "1.3.2"); 
     55        define( "SIMPLE_FIELDS_VERSION", "1.3.3"); 
    5656        define( "SIMPLE_FIELDS_URL", plugins_url(basename(dirname(__FILE__))). "/"); 
    5757        define( "SIMPLE_FIELDS_NAME", "Simple Fields"); 
     
    8888 
    8989        // Actions and filters 
    90  
    9190        add_action( 'admin_init', array($this, 'admin_init') ); 
    9291        add_action( 'admin_init', array($this, 'check_upgrade_stuff') ); 
     
    105104        add_action( 'edit_attachment', array($this, 'save_postdata') ); 
    106105 
     106        // Query filters 
     107        add_action( 'pre_get_posts', array($this, 'action_pre_get_posts_meta') ); 
     108 
    107109        add_action( 'plugins_loaded', array($this, 'plugins_loaded') ); 
    108110        add_action( 'init', array($this, "maybe_add_debug_info") );  
     
    138140 
    139141    /** 
     142     * If sf_meta_key is set then that is assumed to be the slugs of a field group and a field 
     143     * and the meta_key of the value will be replaced by the meta_key value of that simple field-field 
     144     */ 
     145    function action_pre_get_posts_meta( $query ) { 
     146 
     147        $sf_meta_key = $query->get("sf_meta_key"); 
     148        if ( ! empty( $sf_meta_key ) ) { 
     149 
     150            $field = $this->get_field_by_fieldgroup_and_slug_string( $sf_meta_key ); 
     151 
     152            if ( false !== $field ) { 
     153 
     154                $field_meta_key = $this->get_meta_key( $field["field_group"]["id"], $field["id"], 0, $field["field_group"]["slug"], $field["slug"] ); 
     155                $query->set("meta_key", $field_meta_key ); 
     156                 
     157            } 
     158 
     159        } 
     160 
     161    } 
     162 
     163    /** 
    140164     * Inserts debug panel to debug bar 
    141165     * Called form debug bar filter "debug_bar_panels", so will only be run'ed when debug bar is activated 
     
    158182        return $panels; 
    159183 
    160 } 
     184    } 
    161185 
    162186    // check some things regarding update 
     
    40634087    } 
    40644088 
     4089    /** 
     4090     * Retrive a field by a string in the format <fieldgroup_slug>/<field_slug> 
     4091     * used when fieldgroups and fields need to be passed as string 
     4092     * 
     4093     * @param string $string 
     4094     * @return array field info or false if field not found 
     4095     */ 
     4096    function get_field_by_fieldgroup_and_slug_string($string) { 
     4097         
     4098        if ( empty($string) ) { 
     4099            return false; 
     4100        } 
     4101 
     4102        $arr = explode("/", $string); 
     4103        if ( 2 !== sizeof($arr) ) { 
     4104            return false; 
     4105        } 
     4106         
     4107        // sf_d($arr, "arr"); // 0 timeline 1 timeline_date 
     4108        $field = $this->get_field_by_slug( $arr[1], $arr[0] ); 
     4109 
     4110        return $field; 
     4111 
     4112    } // end get_field_by_fieldgroup_and_slug_string 
     4113 
    40654114} // end class 
    40664115 
  • simple-fields/trunk/readme.txt

    r718502 r725294  
    55Requires at least: 3.5.1 
    66Tested up to: 3.5.1 
    7 Stable tag: 1.3.2 
     7Stable tag: 1.3.3 
    88 
    99With Simple Fields you can add any kind of custom fields to your pages, posts and attachments. 
     
    3333Simple 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. 
    3434 
    35 The fields that are included in Simple Fields are: 
     35Fields types available in Simple Fields: 
    3636 
    3737* **Text**<br> 
     
    144144 
    145145== Changelog == 
     146 
     147#### Version 1.3.3 
     148 
     149- Added support for using "sf_meta_key" as an argument to regular wp_query. just add sf_meta_key = "field_group_slug/field_slug" to the args of wp_query and then the argument meta_key will automatically be filled with the correct custom field key to use for that field. Useful when you need to for example sort things based on simple fields in a wp_query. Please note that different field types store their values in different ways, but it works really good for plan text, date/timepicker, and probably some more too. 
     150 
     151- Added method get_field_by_fieldgroup_and_slug_string() that can retrive a field array based on a field group slug and a field slug. like this: $sf->get_field_by_fieldgroup_and_slug_string("my_fieldgroup_slug/my_field_slug"); 
    146152 
    147153#### Version 1.3.2 
  • simple-fields/trunk/simple_fields.php

    r718500 r725294  
    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.3.2 
     6Version: 1.3.3 
    77Author: Pär Thernström 
    88Author URI: http://eskapism.se/ 
     
    5353    function init() { 
    5454 
    55         define( "SIMPLE_FIELDS_VERSION", "1.3.2"); 
     55        define( "SIMPLE_FIELDS_VERSION", "1.3.3"); 
    5656        define( "SIMPLE_FIELDS_URL", plugins_url(basename(dirname(__FILE__))). "/"); 
    5757        define( "SIMPLE_FIELDS_NAME", "Simple Fields"); 
     
    8888 
    8989        // Actions and filters 
    90  
    9190        add_action( 'admin_init', array($this, 'admin_init') ); 
    9291        add_action( 'admin_init', array($this, 'check_upgrade_stuff') ); 
     
    105104        add_action( 'edit_attachment', array($this, 'save_postdata') ); 
    106105 
     106        // Query filters 
     107        add_action( 'pre_get_posts', array($this, 'action_pre_get_posts_meta') ); 
     108 
    107109        add_action( 'plugins_loaded', array($this, 'plugins_loaded') ); 
    108110        add_action( 'init', array($this, "maybe_add_debug_info") );  
     
    138140 
    139141    /** 
     142     * If sf_meta_key is set then that is assumed to be the slugs of a field group and a field 
     143     * and the meta_key of the value will be replaced by the meta_key value of that simple field-field 
     144     */ 
     145    function action_pre_get_posts_meta( $query ) { 
     146 
     147        $sf_meta_key = $query->get("sf_meta_key"); 
     148        if ( ! empty( $sf_meta_key ) ) { 
     149 
     150            $field = $this->get_field_by_fieldgroup_and_slug_string( $sf_meta_key ); 
     151 
     152            if ( false !== $field ) { 
     153 
     154                $field_meta_key = $this->get_meta_key( $field["field_group"]["id"], $field["id"], 0, $field["field_group"]["slug"], $field["slug"] ); 
     155                $query->set("meta_key", $field_meta_key ); 
     156                 
     157            } 
     158 
     159        } 
     160 
     161    } 
     162 
     163    /** 
    140164     * Inserts debug panel to debug bar 
    141165     * Called form debug bar filter "debug_bar_panels", so will only be run'ed when debug bar is activated 
     
    158182        return $panels; 
    159183 
    160 } 
     184    } 
    161185 
    162186    // check some things regarding update 
     
    40634087    } 
    40644088 
     4089    /** 
     4090     * Retrive a field by a string in the format <fieldgroup_slug>/<field_slug> 
     4091     * used when fieldgroups and fields need to be passed as string 
     4092     * 
     4093     * @param string $string 
     4094     * @return array field info or false if field not found 
     4095     */ 
     4096    function get_field_by_fieldgroup_and_slug_string($string) { 
     4097         
     4098        if ( empty($string) ) { 
     4099            return false; 
     4100        } 
     4101 
     4102        $arr = explode("/", $string); 
     4103        if ( 2 !== sizeof($arr) ) { 
     4104            return false; 
     4105        } 
     4106         
     4107        // sf_d($arr, "arr"); // 0 timeline 1 timeline_date 
     4108        $field = $this->get_field_by_slug( $arr[1], $arr[0] ); 
     4109 
     4110        return $field; 
     4111 
     4112    } // end get_field_by_fieldgroup_and_slug_string 
     4113 
    40654114} // end class 
    40664115 
Note: See TracChangeset for help on using the changeset viewer.