PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
← All changes | includes/Core/Util/Utilities.php +46 -0 3.1.33.3.1 View file →
@@ -126,8 +126,54 @@
126 126 $fileName = "bitform-{$formId}-formid.css";
127 127 Helpers::saveFile($path, $fileName, $css, $mode);
128 128 }
129 129
130 + /**
131 + * First row of a Model/get() style result, or null when the lookup failed
132 + * (WP_Error), returned an empty set, or has no index 0. Prevents
133 + * "Attempt to read property on null" when dereferencing $result[0]->col.
134 + *
135 + * @param mixed $result
136 + * @return object|null
137 + */
138 + public static function firstRow($result)
139 + {
140 + if (is_wp_error($result) || empty($result) || !isset($result[0])) {
141 + return null;
142 + }
143 + return $result[0];
144 + }
145 +
146 + /**
147 + * Decode a JSON string to an object, guaranteed to return object|null so
148 + * downstream `$obj->prop ?? default` reads never emit an undefined-property
149 + * warning. Returns null for non-strings, empty strings and malformed JSON.
150 + *
151 + * @param mixed $json
152 + * @return object|null
153 + */
154 + public static function jsonObj($json)
155 + {
156 + if (!is_string($json) || '' === $json) {
157 + return null;
158 + }
159 + $decoded = json_decode($json);
160 + return is_object($decoded) ? $decoded : null;
161 + }
162 +
163 + /**
164 + * Hardened hosts disable ignore_user_abort in php.ini; PHP 8 fatals on the call instead of warning.
165 + *
166 + * @param bool $ignore
167 + * @return void
168 + */
169 + public static function ignoreUserAbort($ignore = true)
170 + {
171 + if (\function_exists('ignore_user_abort')) {
172 + \ignore_user_abort($ignore);
173 + }
174 + }
175 +
130 176 public static function duplicateDbTable($oldTableName, $newTableName)
131 177 {
132 178 global $wpdb;
133 179 $oldTable = "{$wpdb->prefix}bitforms_{$oldTableName}";