Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env php
- <?php
- $dialog = str_replace('Application Support', 'Application\ Support', $_ENV['DIALOG']);
- $dir = $_ENV['TM_PROJECT_DIRECTORY'];
- $charlist = "\t\n\r\0\x0B";
- $models = glob("{$dir}/models/*Model.php");
- foreach($models as $model):
- $file = basename($model);
- $file = str_replace('Model.php', '',$file);
- $ret[] = " { title = '$file'; } ";
- endforeach;
- $time = time();
- exec("touch /path/to/tmp/.vardump/{$time}");
- exec("{$dialog} -up '{ menuItems = ( ".implode(',', $ret)." ); }' > /path/to/tmp/.vardump/{$time}");
- $tmp_file = file_get_contents("/path/to/tmp/.vardump/{$time}");
- $tmp_file = strip_tags($tmp_file);
- $tmp_file = str_replace(str_split($charlist), '', $tmp_file);
- $tmp_file = preg_replace('#selectedIndex[0-9+]selectedMenuItemtitle#', '', $tmp_file);
- echo '\$this->'.$tmp_file.'->';
- unlink("/path/to/tmp/.vardump/{$time}");
- $contents = file_get_contents($dir.'/models/'.$tmp_file.'Model.php');
- preg_match_all('#function ([^(]+)#i', $contents, $results);
- foreach($results[1] as $func)
- $ret2[] = " { title = '$func'; } ";
- $time = time() + 1;
- exec("touch /path/to/tmp/.vardump/{$time}");
- exec("{$dialog} -up '{ menuItems = ( ".implode(',', $ret2)." ); }' > /path/to/tmp/.vardump/{$time}");
- $tmp_file = file_get_contents("/path/to/tmp/.vardump/{$time}");
- $tmp_file = strip_tags($tmp_file);
- $tmp_file = str_replace(str_split($charlist), '', $tmp_file);
- $tmp_file = preg_replace('#selectedIndex[0-9+]selectedMenuItemtitle#', '', $tmp_file);
- echo $tmp_file.'(${1:vars});';
- unlink("/path/to/tmp/.vardump/{$time}");
- ?>
Add Comment
Please, Sign In to add comment