Changeset 1940701
- Timestamp:
- 09/13/2018 12:55:41 PM (7 years ago)
- Location:
- gf-dynamic-fields/trunk
- Files:
-
- 1 added
- 3 edited
-
README.md (modified) (3 diffs)
-
gravity-forms-dynamic-fields.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
-
screenshot-1.PNG (added)
Legend:
- Unmodified
- Added
- Removed
-
gf-dynamic-fields/trunk/README.md
r1938078 r1940701 25 25 * `session_desiredkey` where 'session_' is a prefix indicating you want a Session value and 'desiredkey' is the index of which Session value to retrieve 26 26 * `cookie_desiredkey` where 'cookie_' is a prefix indicating you want a Cookie value and 'desiredkey' is the index of which Cookie value to retrieve 27 * `param_desiredkey` where 'param_' is a prefix indicating that you want a URL query parameter (or form POST) and 'desiredkey' is the index of the request parameter to retrieve. Gravity Forms actually already does this, but it's included for consistency and this `param` will also check for POST parameters. 27 28 * `page_url` gets the current WP page url 28 29 * `page_url_nodomain` gets the current WP page url without the site domain (i.e. relative path) 30 * `page_url_domain` gets the domain of the current WP page url without the relative path 31 * `page_url_network` gets the network domain of the current WP page (useful with multisite); may be the same as `page_url_domain` 29 32 * `page_referer` attempts to get the current referring url 30 * `page_request` gets the server-generated page url (which may/not be the same as `page_url` )33 * `page_request` gets the server-generated page url (which may/not be the same as `page_url`, such as containing the querystring) 31 34 * `page_ip` attempts to get the client's ip address 35 * `time` gets the current timestamp 36 * `date` gets the current ISO formatted date 37 * `time_local` gets the current timestamp formatted to your local settings 38 * `date_local` gets the current date formatted to your local settings 39 * `sitename` gets the blog's name as configured in your admin settings 32 40 33 41 34 42 ## Frequently Asked Questions ## 43 44 ### How does Gravity Forms dynamically populate normally? ### 45 46 See their wiki page for it -- https://docs.gravityforms.com/using-dynamic-population/ 35 47 36 48 ### How do I get a session value? ### … … 42 54 See the installation instructions and use `cookie_yourdesiredkey` as the Parameter Name, where `yourdesiredkey` is the Cookie index you want. 43 55 56 ### How do I get a url querystring value? ### 57 58 Use native GF functionality, or see the installation instructions and use `param_yourdesiredkey` as the Parameter Name, where `yourdesiredkey` is the querystring index you want. 59 44 60 ### It doesn't work right... ### 45 61 … … 48 64 ## Screenshots ## 49 65 50 N/A. 66 1. Configuring Gravity Forms advanced field setting 'allow field to be populated dynamically' 51 67 52 68 ## Changelog ## 69 70 ### 0.3 ### 71 72 - added URL just domain 73 - added time and date 74 - added sitename 75 - added querystring parameters 76 - added other stuff, see installation 77 - basically almost parity with [Forms 3rdparty Dynamic Fields](https://wordpress.org/plugins/forms-3rdparty-dynamic-fields/) plugin. 53 78 54 79 ### 0.2 ### -
gf-dynamic-fields/trunk/gravity-forms-dynamic-fields.php
r1938074 r1940701 6 6 Description: Dynamically fill fields with session, cookie, or other values, based on 'Forms: 3rdparty Dynamic Fields' 7 7 Author: zaus 8 Version: 0. 28 Version: 0.3 9 9 Author URI: http://drzaus.com 10 10 Changelog: 11 11 0.1 initial 12 12 0.2 url without domain 13 0.3 url just domain, other parity with F3P Dynamic Fields 13 14 */ 14 15 … … 21 22 const COOKIE_PREFIX = 'cookie'; 22 23 const PAGE_PREFIX = 'page'; 24 const PARAM_PREFIX = 'param'; 25 26 const TIMESTAMP = 'time'; 27 const DATE = 'date'; 28 const DATE_I18N = 'date_local'; 29 const TIME_I18N = 'time_local'; 30 const SITENAME = 'sitename'; 23 31 24 32 const PAGE_URL = 'url'; 25 33 const PAGE_URL_NODOMAIN = 'url_nodomain'; 34 const PAGE_DOMAIN = 'url_domain'; 35 const PAGE_NETWORK_URL = 'url_network'; 26 36 const PAGE_REFERER = 'referer'; 27 37 const PAGE_REQUESTURL = 'request'; … … 50 60 ## _log(__CLASS__, $value, $name); 51 61 62 switch($name) { 63 case self::TIMESTAMP: 64 return time(); 65 case self::DATE: 66 return date('c'); // ISO 8601 = Y-m-d\TH:i:sP (PHP5) 67 case self::DATE_I18N: 68 return date_i18n( get_option('date_format'), time() ); 69 case self::TIME_I18N: 70 return date_i18n( get_option('time_format'), time() ); 71 case self::SITENAME: 72 return get_bloginfo('name'); 73 74 } 75 52 76 $prefix = self::PAGE_PREFIX; 53 77 if(strpos($name, $prefix) === 0) { 54 78 $key = substr($name, strlen($prefix)+1); 55 79 56 switch($key) { 80 switch($key) { 57 81 case self::PAGE_URL: return get_permalink(); 82 case self::PAGE_DOMAIN: return get_site_url(); 83 case self::PAGE_NETWORK_URL: return network_site_url(); 58 84 case self::PAGE_URL_NODOMAIN: return str_replace(get_site_url(), '', get_permalink()); 59 85 case self::PAGE_REFERER: return wp_get_referer(); … … 91 117 } 92 118 119 $prefix = self::PARAM_PREFIX; 120 if(strpos($name, $prefix) === 0) { 121 $key = substr($name, strlen($prefix)+1); 122 123 return isset($_REQUEST[ $key ]) ? $_REQUEST[ $key ] : $value; 124 } 125 93 126 return $value; 94 127 } -
gf-dynamic-fields/trunk/readme.txt
r1938078 r1940701 25 25 * `session_desiredkey` where 'session_' is a prefix indicating you want a Session value and 'desiredkey' is the index of which Session value to retrieve 26 26 * `cookie_desiredkey` where 'cookie_' is a prefix indicating you want a Cookie value and 'desiredkey' is the index of which Cookie value to retrieve 27 * `param_desiredkey` where 'param_' is a prefix indicating that you want a URL query parameter (or form POST) and 'desiredkey' is the index of the request parameter to retrieve. Gravity Forms actually already does this, but it's included for consistency and this `param` will also check for POST parameters. 27 28 * `page_url` gets the current WP page url 28 29 * `page_url_nodomain` gets the current WP page url without the site domain (i.e. relative path) 30 * `page_url_domain` gets the domain of the current WP page url without the relative path 31 * `page_url_network` gets the network domain of the current WP page (useful with multisite); may be the same as `page_url_domain` 29 32 * `page_referer` attempts to get the current referring url 30 * `page_request` gets the server-generated page url (which may/not be the same as `page_url` )33 * `page_request` gets the server-generated page url (which may/not be the same as `page_url`, such as containing the querystring) 31 34 * `page_ip` attempts to get the client's ip address 35 * `time` gets the current timestamp 36 * `date` gets the current ISO formatted date 37 * `time_local` gets the current timestamp formatted to your local settings 38 * `date_local` gets the current date formatted to your local settings 39 * `sitename` gets the blog's name as configured in your admin settings 32 40 33 41 34 42 == Frequently Asked Questions == 43 44 = How does Gravity Forms dynamically populate normally? = 45 46 See their wiki page for it -- https://docs.gravityforms.com/using-dynamic-population/ 35 47 36 48 = How do I get a session value? = … … 42 54 See the installation instructions and use `cookie_yourdesiredkey` as the Parameter Name, where `yourdesiredkey` is the Cookie index you want. 43 55 56 ### How do I get a url querystring value? ### 57 58 Use native GF functionality, or see the installation instructions and use `param_yourdesiredkey` as the Parameter Name, where `yourdesiredkey` is the querystring index you want. 59 44 60 = It doesn't work right... = 45 61 … … 48 64 == Screenshots == 49 65 50 N/A. 66 1. Configuring Gravity Forms advanced field setting 'allow field to be populated dynamically' 51 67 52 68 == Changelog == 69 70 = 0.3 = 71 72 - added URL just domain 73 - added time and date 74 - added sitename 75 - added querystring parameters 76 - added other stuff, see installation 77 - basically almost parity with [Forms 3rdparty Dynamic Fields](https://wordpress.org/plugins/forms-3rdparty-dynamic-fields/) plugin. 53 78 54 79 = 0.2 =
Note: See TracChangeset
for help on using the changeset viewer.