/** * Converts plaintext keyboard layout to the valid javascript code and saves it * * @param VirtualKeyboardLayout $f layout object * @return boolean conversion state * @scope public */ function convertKbd(&$f) { global $VK_ADDONS; $addon = $f->getAddon(); $code = $f->getCode(); if (!empty($addon) && !isset($VK_ADDONS[$code])) { $addon = file_get_contents($addon); if (!empty($addon)) { $VK_ADDONS[$code] = $addon; } } return $f->serialize($_REQUEST['group']); }
/** * Converts plaintext keyboard layout to the valid javascript code and saves it * * @param VirtualKeyboardLayout $f layout object * @return boolean conversion state * @scope public */ function convertKbd(&$f) { global $VK_ADDONS; $addon = $f->getAddon(); $aname = basename($addon); $fname = $f->getFilename() . '.js'; if (!empty($addon)) { copy($addon, DICTIONARY_OUT_FOLDER . $aname); } $data = '' . "VirtualKeyboard.addLayout(" . $f->serialize($_REQUEST['group']) . ");"; $fd = fopen(LAYOUT_OUT_FOLDER . $fname, "w"); fwrite($fd, $data); fclose($fd); return $f->serializeHeader($_REQUEST['group']); }