You are here

function _fancybox_array_walk_convert_string in fancyBox 7.2

Convert strings into appropriate values for floats/integers/etc.

Parameters

$item mixed: The element in the array.

$key mixed: The key of the element.

See also

fancybox_admin_settings_form_submit().

1 string reference to '_fancybox_array_walk_convert_string'
fancybox_admin_settings_form_submit in ./fancybox.admin.inc
Submit handler for the fancyBox Admin Settings Form.

File

./fancybox.module, line 700
Provides the fancyBox jQuery plugin, a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages, and an extensive settings page for configuring fancyBox settings and how fancyBox…

Code

function _fancybox_array_walk_convert_string(&$item, &$key) {
  if (preg_match('/[0-9]+(px|ms)/', $item)) {
    $item = substr($item, 0, -2);
  }
  if (is_numeric($item)) {
    $f = (double) $item;
    $i = (int) $item;
    $item = $f == $i ? $i : $f;
  }
}