]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Several fixes/improvements, new function introduced:
[mailer.git] / inc / functions.php
index 0187e2c818180a0a5fbffee9a8e7182a6e3d7b47..320c774ce890aeec5c55e6b1ea4bd344273b5703 100644 (file)
@@ -3948,6 +3948,28 @@ function fixNullEmptyToDashes ($str, $num) {
        return $return;
 }
 
+// Handles the braces [] of a field (e.g. value of 'name' attribute)
+function handleFieldWithBraces ($field) {
+       // Are there braces [] at the end?
+       if (substr($field, -2, 2) == '[]') {
+               // Try to find one and replace it. I do it this way to allow easy
+               // extending of this code.
+               foreach (array('admin_list_builder_id_value') as $key) {
+                       // Is the cache entry set?
+                       if (isset($GLOBALS[$key])) {
+                               // Insert it
+                               $field = str_replace('[]', '[' . $GLOBALS[$key] . ']', $field);
+
+                               // And abort
+                               break;
+                       } // END - if
+               } // END - foreach
+       } // END - if
+
+       // Return it
+       return $field;
+}
+
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
@@ -3987,3 +4009,4 @@ if (!function_exists('http_build_query')) {
 
 // [EOF]
 ?>
+