{"id":1118,"date":"2014-07-01T21:48:26","date_gmt":"2014-07-02T01:48:26","guid":{"rendered":"http:\/\/cfdbplugin.com\/?page_id=1118"},"modified":"2014-10-18T19:18:23","modified_gmt":"2014-10-18T23:18:23","slug":"transforms","status":"publish","type":"page","link":"https:\/\/cfdbplugin.com\/?page_id=1118","title":{"rendered":"Transforms"},"content":{"rendered":"<p>Available in version 2.8. This functionality is an ALPHA version.<\/p>\n<p>Transforms are functions applied to data to change it in some way in a short code. Short code processing proceeds like this:<\/p>\n<ol>\n<li>The database is queried\n<ol>\n<li>&#8220;<strong>unbuffered<\/strong>&#8221; and &#8220;<strong>random<\/strong>&#8221; are applied<\/li>\n<\/ol>\n<\/li>\n<li>&#8220;<strong>tfilter<\/strong>&#8221; or &#8220;<strong>tsearch<\/strong>&#8221; filters query results<\/li>\n<li>&#8220;<strong>torderby<\/strong>&#8221; orders the results<\/li>\n<li>&#8220;<strong>tlimit<\/strong>&#8221; limits the number of rows query<\/li>\n<li>&#8220;<strong>trans<\/strong>&#8221; is applied for each listed transform in order\n<ol>\n<li>Each transform can change values of fields, add or remove fields<\/li>\n<li>The results of each transform is the input for the next<\/li>\n<\/ol>\n<\/li>\n<li>&#8220;<strong>filter<\/strong>&#8221; or &#8220;<strong>search<\/strong>&#8221; is applied on the last transform results\n<ol>\n<li>field names should refer to those in the transform results<\/li>\n<\/ol>\n<\/li>\n<li>&#8220;<strong>limit<\/strong>&#8221; is applied<\/li>\n<li>&#8220;<strong>orderby<\/strong>&#8221; is applied<\/li>\n<li>&#8220;<strong>show<\/strong>&#8221; and &#8220;<strong>hide<\/strong>&#8221;\u00a0and short code-specific options are applied<\/li>\n<\/ol>\n<p>Notes:<\/p>\n<ul>\n<li><strong>tfilter<\/strong>, <strong>tsearch<\/strong>, <strong>torderby<\/strong>, and <strong>tlimit<\/strong> work like <strong>filter<\/strong>, <strong>search<\/strong>, <strong>orderby<\/strong> and <strong>limit<\/strong> respectively<\/li>\n<li><strong>tfilter<\/strong>, <strong>tsearch<\/strong>, <strong>torderby<\/strong>, and <strong>tlimit<\/strong> happen before <strong>trans\u00a0<\/strong>transforms are applied whereas\u00a0<strong>filter<\/strong>, <strong>search<\/strong>, <strong>orderby<\/strong> and <strong>limit<\/strong> are applied after<\/li>\n<li><strong>tfilter<\/strong>, <strong>tsearch<\/strong>, <strong>torderby<\/strong>, and <strong>tlimit<\/strong> are ignored if there is no <strong>trans<\/strong><\/li>\n<\/ul>\n<p>Transform Examples<\/p>\n<p>Transform Functions are<\/p>\n<ul>\n<li>PHP functions used to change a single field such as <strong>trans=&#8221;name=strtoupper(name)&#8221;<\/strong> would re-assign the &#8220;name&#8221; field to be\u00a0upper-cased. You could also assign a new field\u00a0<strong>trans=&#8221;upper-name=strtoupper(name)&#8221;<\/strong>\n<ul>\n<li>Most PHP string-related functions (like &#8220;strtoupper&#8221;) can be used<\/li>\n<li>You can create your own function and use it<\/li>\n<\/ul>\n<\/li>\n<li>PHP functions used to change the any part or all of the\u00a0data set such as <strong>trans=&#8221;myfunction&#8221;<\/strong> where you define <strong>function myfunction($data) {}<\/strong>. $data is an associated array of file =&gt; value. The functions should return an associative array of the results.<\/li>\n<li>PHP classes to change\u00a0change the\u00a0any part or all of the\u00a0data set such\u00a0<strong>trans=&#8221;NaturalSortByField(name)&#8221;<\/strong>.<\/li>\n<\/ul>\n<p>Transforms can be changed together using <strong>&amp;&amp;<\/strong>. Example:<\/p>\n<ul>\n<li>trans=&#8221;<strong>name=strtoupper(name)&amp;&amp;<strong>NaturalSortByField(name)<\/strong><\/strong>&#8220;<\/li>\n<\/ul>\n<p>See more on <a href=\"\/?page_id=1076\">Transform Functions<\/a> and <a href=\"\/?page_id=1095\">Transform Classes<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Available in version 2.8. This functionality is an ALPHA version. Transforms are functions applied to data to change it in some way in a short code. Short code processing proceeds like this: The database is queried &#8220;unbuffered&#8221; and &#8220;random&#8221; are applied &#8220;tfilter&#8221; or &#8220;tsearch&#8221; filters query results &#8220;torderby&#8221; orders the results &#8220;tlimit&#8221; limits the number [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"page-without-sidebar.php","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-1118","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1mptf-i2","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1118"}],"version-history":[{"count":7,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1118\/revisions"}],"predecessor-version":[{"id":1125,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1118\/revisions\/1125"}],"wp:attachment":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}