Built on the technologies developed and maintained by April-Child.com
Copyright (c)2007,2008 Petr Krontorad, April-Child.com.
Author: Petr Krontorad, petr@krontorad.com
All rights reserved.
------------------------------------------------------------------------------------------
Bundle library
------------------------------------------------------------------------------------------
} echo 'this.' . $key . ' = ' . "'{$value}';\n"; } 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"; }
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); }
protected function getSnippets() { $snippets = array(); foreach ($this->snippets_inherited as $bundle_id) { $bundle = new AMYBundle($this->supportPath, $bundle_id, $this->hostOS); $snippets = array_merge($snippets, $bundle->getSnippets()); } $snippets_path = $this->bundlePath . '/snippets/'; if (!is_dir($snippets_path)) { return $snippets; } $res_snippets = array(); foreach ($snippets as $snippet) { $snippet['is_inherited'] = '1'; $res_snippets[] = $snippet; } return array_merge($res_snippets, $this->getSnippetsInDirectory($snippets_path, '')); }