public function on_load_bundle($pars) { $pars['id'] = $this->stripFileName($pars['id']); $host_os = isset($pars['host_os']) ? $pars['host_os'] : (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'intosh') ? 'Mac' : 'Windows'); if (!in_array($host_os, array('Mac', 'Windows'))) { $host_os = 'Windows'; } $cached_file = $this->configuration['support-path'] . '/cached/bundle_' . $pars['id'] . '_' . $host_os . '.ser'; $bundle_last_modified = filectime($this->configuration['support-path'] . '/bundles/' . $pars['id'] . '/info.amBundle'); $bundle_dump = null; if (file_exists($cached_file)) { $bundle_cache = @unserialize(@file_get_contents($cached_file)); if (is_array($bundle_cache['bundle']) && $bundle_cache['time'] == $bundle_last_modified) { $bundle_dump = $bundle_cache['bundle']; } } if (null == $bundle_dump) { $bundle = new AMYBundle($this->configuration['support-path'], $pars['id'], $host_os); $bundle_dump = $bundle->dumpDefinition(); file_put_contents($cached_file, @serialize(array('time' => $bundle_last_modified, 'bundle' => $bundle_dump))); } self::setResult($bundle_dump); }
} echo '}' . "\n\n"; // END: embedding Theme definition script echo "\n// Generated from bundle keymap definition file.\n"; // BEGIN: embedding bundle $bundle_id = strip_file_name($_REQUEST['bundle']); $host_os = isset($pars['host_os']) ? $pars['host_os'] : (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'intosh') ? 'Mac' : 'Windows'); if (!in_array($host_os, array('Mac', 'Windows'))) { $host_os = 'Windows'; } try { $bundle = new AMYBundle($_AMY_CONF['support-path'], $bundle_id, $host_os); } catch (Exception $e) { $bundle = new AMYBundle($_AMY_CONF['support-path'], 'default', $host_os); } $bundle_def = $bundle->dumpDefinition(); echo 'ac.chap.KeyMap.prototype.initDefinition = function() { var _ = \'\\n\'; this.compile (""'; $lines = explode("\n", trim($bundle_def['keymap'])); foreach ($lines as $line) { $line = trim($line); if ('' == $line || '#' == $line[0]) { continue; } echo '+_+ "' . ('K' == $line[0] ? '' : "\t") . $line . "\"\n"; } echo ")};\n\n"; echo '$class(\'ac.chap.lang.EAmy < ac.chap.Language\');