AMYBundle::dumpDefinition PHP Method

dumpDefinition() public method

public dumpDefinition ( )
    public function dumpDefinition()
    {
        $def = array('info' => $this->info, 'keymap' => $this->getKeyMapDefinition());
        // getting languages
        $languages = array();
        $lang_dir_path = $this->bundlePath . '/languages';
        if (is_dir($lang_dir_path)) {
            if (false !== ($d = opendir($lang_dir_path))) {
                while (false !== ($f = readdir($d))) {
                    if (0 != strncmp('.', $f, 1) && '.amLanguage' == substr($f, -11)) {
                        $lang_def = $this->getLanguageDefinition(substr($f, 0, -11));
                        $lang_def['id'] = substr($f, 0, -11);
                        $languages[] = $lang_def;
                    }
                }
                closedir($d);
            }
        }
        $def['languages'] = $languages;
        $def['snippets'] = $this->getSnippets();
        $def['commands'] = $this->getCommands();
        $def['templates'] = $this->getTemplates();
        $def['id'] = $this->name;
        return $def;
    }

Usage Example

Esempio n. 1
0
 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);
 }
All Usage Examples Of AMYBundle::dumpDefinition