本文整理汇总了PHP中sfToolkit类的典型用法代码示例。如果您正苦于以下问题:PHP sfToolkit类的具体用法?PHP sfToolkit怎么用?PHP sfToolkit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfToolkit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$config = $this->getCliConfig();
$args = array(
'data_fixtures_path' => $config['data_fixtures_path'][0],
);
if (!is_dir($args['data_fixtures_path']))
{
$this->getFilesystem()->mkdirs($args['data_fixtures_path']);
}
if ($arguments['target'])
{
$filename = $arguments['target'];
if (!sfToolkit::isPathAbsolute($filename))
{
$filename = $args['data_fixtures_path'].'/'.$filename;
}
$this->getFilesystem()->mkdirs(dirname($filename));
$args['data_fixtures_path'] = $filename;
}
$this->logSection('doctrine', sprintf('dumping data to fixtures to "%s"', $args['data_fixtures_path']));
$this->callDoctrineCli('dump-data', $args);
}
开发者ID:nationalfield,项目名称:symfony,代码行数:34,代码来源:sfDoctrineDataDumpTask.class.php
示例2: customize
public function customize($params)
{
$params['moduleName'] = 'search';
sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
$generatorManager = new sfGeneratorManager(sfProjectConfiguration::getActive());
sfGeneratorConfigHandler::getContent($generatorManager, 'xfGeneratorInterface', $params);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:7,代码来源:xfGeneratorInterfaceTest.php
示例3: addClassBody
protected function addClassBody(&$script)
{
parent::addClassBody($script);
// remove comments and fix coding standards
$script = str_replace(array("\t", "{\n \n"), array(' ', "{\n"), sfToolkit::stripComments($script));
}
开发者ID:nationalfield,项目名称:symfony,代码行数:7,代码来源:SfMultiExtendObjectBuilder.php
示例4: execute
protected function execute($arguments = array(), $options = array())
{
$this->standardBootstrap($arguments['application'], $options['env']);
$remove = sfLuceneToolkit::getDirtyIndexRemains();
if (count($remove) == 0) {
$this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Nothing to do!', 'INFO'))));
} elseif ($arguments['confirmation'] == 'delete') {
$this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->format('Delete confirmation provided. Deleting directories now...', array('fg' => 'red', 'bold' => true)))));
foreach ($remove as $dir) {
sfToolkit::clearDirectory($dir);
rmdir($dir);
$this->dispatcher->notify(new sfEvent($this, 'command.log', array($this->formatter->formatSection('dir-', $dir))));
}
} else {
$messages = array($this->formatter->format('The following directories are alien and not referenced by your configuration:', 'INFO'));
for ($c = count($remove), $x = 0; $x < $c; $x++) {
$messages[] = ' ' . ($x + 1) . ') ' . $remove[$x];
}
$messages[] = '';
$messages[] = 'These directories were ' . $this->formatter->format('not', array('fg' => 'red', 'bold' => true)) . ' deleted. To delete these directories, please run:';
$messages[] = '';
$messages[] = ' ' . $this->formatter->format('symfony lucene:clean ' . $arguments['application'] . ' delete', 'INFO');
$messages[] = '';
$this->dispatcher->notify(new sfEvent($this, 'command.log', $messages));
}
}
开发者ID:palcoprincipal,项目名称:sfLucenePlugin,代码行数:26,代码来源:sfLuceneCleanupTask.class.php
示例5: initialize
/**
* @see sfPluginConfiguration
*/
public function initialize()
{
sfConfig::set('sf_orm', 'propel');
if (!sfConfig::get('sf_admin_module_web_dir')) {
sfConfig::set('sf_admin_module_web_dir', '/sfPropelPlugin');
}
sfToolkit::addIncludePath(array(sfConfig::get('sf_root_dir'), sfConfig::get('sf_propel_runtime_path', realpath(dirname(__FILE__) . '/../lib/vendor'))));
require_once 'propel/Propel.php';
if (!Propel::isInit()) {
if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
Propel::setLogger(new sfPropelLogger($this->dispatcher));
}
$propelConfiguration = new PropelConfiguration();
Propel::setConfiguration($propelConfiguration);
$this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure'));
Propel::initialize();
}
$this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
if (sfConfig::get('sf_web_debug')) {
$this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent'));
}
if (sfConfig::get('sf_test')) {
$this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools'));
}
}
开发者ID:xfifix,项目名称:symfony-1.4,代码行数:28,代码来源:sfPropelPluginConfiguration.class.php
示例6: sf_unit_test_shutdown
function sf_unit_test_shutdown()
{
$sf_root_dir = sys_get_temp_dir().'/sf_test_project';
if(is_dir($sf_root_dir))
{
sfToolkit::clearDirectory($sf_root_dir);
@rmdir($sf_root_dir);
}
$sessions = glob(sys_get_temp_dir().'/sessions*');
$tmp_files = glob(sys_get_temp_dir().'/sf*');
$files = array_merge((empty($sessions) ? array() : $sessions), (empty($tmp_files) ? array() : $tmp_files));
foreach ($files as $file)
{
if(is_dir($file))
{
sfToolkit::clearDirectory($file);
@rmdir($file);
}
else
{
@unlink($file);
}
}
}
开发者ID:nationalfield,项目名称:symfony,代码行数:26,代码来源:unit.php
示例7: cleanup
function cleanup()
{
//sfToolkit::clearDirectory(dirname(__FILE__).'/../fixtures/project/cache');
sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/log');
@unlink(sfConfig::get('sf_data_dir') . '/test.sqlite');
@unlink(sfConfig::get('sf_config_dir') . '/app.yml');
}
开发者ID:blt04,项目名称:sfDoctrine2Plugin,代码行数:7,代码来源:cleanup.php
示例8: execute
/**
* Executes this configuration handler.
*
* @param array $configFiles An array of absolute filesystem path to a configuration file
*
* @return string Data to be written to a cache file
*
* @throws sfConfigurationException If a requested configuration file does not exist or is not readable
* @throws sfParseException If a requested configuration file is improperly formatted
*/
public function execute($configFiles)
{
// parse the yaml
$config = self::getConfiguration($configFiles);
// init our data
$data = '';
// let's do our fancy work
foreach ($config as $file) {
if (!is_readable($file)) {
// file doesn't exist
throw new sfParseException(sprintf('Configuration file "%s" specifies nonexistent or unreadable file "%s".', $configFiles[0], $file));
}
$contents = file_get_contents($file);
// strip comments (not in debug mode)
if (!sfConfig::get('sf_debug')) {
$contents = sfToolkit::stripComments($contents);
}
// insert configuration files
/* $contents = preg_replace_callback(array('#(require|include)(_once)?\((sfContext::getInstance\(\)\->getConfigCache\(\)|\$configCache)->checkConfig\(\'config/([^\']+)\'\)\);#m',
'#()()(sfContext::getInstance\(\)\->getConfigCache\(\)|\$configCache)->import\(\'config/([^\']+)\'(, false)?\);#m'),
array($this, 'insertConfigFileCallback'), $contents);
*/
// strip php tags
$contents = sfToolkit::pregtr($contents, array('/^\\s*<\\?(php)?/m' => '', '/^\\s*\\?>/m' => ''));
// replace windows and mac format with unix format
$contents = str_replace("\r", "\n", $contents);
// replace multiple new lines with a single newline
$contents = preg_replace(array('/\\s+$/Sm', '/\\n+/S'), "\n", $contents);
// append file data
$data .= "\n" . $contents;
}
// compile data
$retval = sprintf("<?php\n" . "// auto-generated by sfCompileConfigHandler\n" . "// date: %s\n%s\n", date('Y/m/d H:i:s'), $data);
return $retval;
}
开发者ID:xfifix,项目名称:symfony-1.4,代码行数:45,代码来源:sfCompileConfigHandler.class.php
示例9: execute
/**
* Executes this configuration handler.
*
* @param array An array of absolute filesystem path to a configuration file
*
* @return string Data to be written to a cache file
*
* @throws <b>sfConfigurationException</b> If a requested configuration file does not exist or is not readable
* @throws <b>sfParseException</b> If a requested configuration file is improperly formatted
* @throws <b>sfInitializationException</b> If a cache.yml key check fails
*/
public function execute($configFiles)
{
// set our required categories list and initialize our handler
$categories = array('required_categories' => array());
$this->initialize($categories);
// parse the yaml
$myConfig = $this->parseYamls($configFiles);
$myConfig['all'] = sfToolkit::arrayDeepMerge(isset($myConfig['default']) && is_array($myConfig['default']) ? $myConfig['default'] : array(), isset($myConfig['all']) && is_array($myConfig['all']) ? $myConfig['all'] : array());
unset($myConfig['default']);
$this->yamlConfig = $myConfig;
// iterate through all action names
$data = array();
$first = true;
foreach ($this->yamlConfig as $actionName => $values) {
if ($actionName == 'all') {
continue;
}
$data[] = $this->addCache($actionName);
$first = false;
}
// general cache configuration
$data[] = $this->addCache('DEFAULT');
// compile data
$retval = sprintf("<?php\n" . "// auto-generated by sfCacheConfigHandler\n" . "// date: %s\n%s\n", date('Y/m/d H:i:s'), implode('', $data));
return $retval;
}
开发者ID:taryono,项目名称:school,代码行数:37,代码来源:sfCacheConfigHandler.class.php
示例10: underscore
/**
* Returns an underscore-syntaxed version or the CamelCased string.
*
* @param string $camel_cased_word String to underscore.
*
* @return string Underscored string.
*/
public static function underscore($camel_cased_word)
{
$tmp = $camel_cased_word;
$tmp = str_replace('::', '/', $tmp);
$tmp = sfToolkit::pregtr($tmp, array('/([A-Z]+)([A-Z][a-z])/' => '\\1_\\2', '/([a-z\\d])([A-Z])/' => '\\1_\\2'));
return strtolower($tmp);
}
开发者ID:Phennim,项目名称:symfony1,代码行数:14,代码来源:sfInflector.class.php
示例11: clearDirectory
protected function clearDirectory($dir)
{
sfToolkit::clearDirectory($dir);
if (is_dir($dir)) {
rmdir($dir);
}
}
开发者ID:cuongnv540,项目名称:jobeet,代码行数:7,代码来源:crudBrowser.class.php
示例12: findPhpBinary
protected function findPhpBinary()
{
if (defined('PHP_BINARY') && PHP_BINARY)
{
return PHP_BINARY;
}
if (false !== strpos(basename($php = $_SERVER['_']), 'php'))
{
return $php;
}
// from https://github.com/symfony/Process/blob/379b35a41a2749cf7361dda0f03e04410daaca4c/PhpExecutableFinder.php
$suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array('');
foreach ($suffixes as $suffix)
{
if (is_executable($php = PHP_BINDIR.DIRECTORY_SEPARATOR.'php'.$suffix))
{
return $php;
}
}
if ($php = getenv('PHP_PEAR_PHP_BIN'))
{
if (is_executable($php))
{
return $php;
}
}
return sfToolkit::getPhpCli();
}
开发者ID:nise-nabe,项目名称:opKdtPlugin,代码行数:32,代码来源:opKdtBaseTask.class.php
示例13: executeCommand
public function executeCommand(sfWebRequest $request)
{
$command = trim($request->getParameter("dm_command"));
if (substr($command, 0, 2) == "sf") {
$command = substr($command, 3);
$exec = sprintf('%s "%s" %s --color', sfToolkit::getPhpCli(), dmProject::getRootDir() . '/symfony', $command);
} else {
$options = substr(trim($command), 0, 2) == 'll' || substr(trim($command), 0, 2) == 'ls' ? '--color' : '';
$parts = explode(" ", $command);
$parts[0] = dmArray::get($this->getAliases(), $parts[0], $parts[0]);
$command = implode(" ", $parts);
$parts = explode(" ", $command);
$command = dmArray::get($this->getAliases(), $command, $command);
if (!in_array($parts[0], $this->getCommands())) {
return $this->renderText(sprintf("%s<li>This command is not available. You can do: <strong>%s</strong></li>", $this->renderCommand($command), implode(' ', $this->getCommands())));
}
$exec = sprintf("%s {$options}", $command);
}
ob_start();
passthru($exec . ' 2>&1', $return);
$raw = dmAnsiColorFormatHtmlRenderer::render(ob_get_clean());
$arr = explode("\n", $raw);
$res = $this->renderCommand($command);
foreach ($arr as $a) {
$res .= "<li class='dm_result_command'><pre>" . $a . "</pre></li>";
}
return $this->renderText($res);
}
开发者ID:theolymp,项目名称:diem,代码行数:28,代码来源:actions.class.php
示例14: initialize
protected function initialize(array $options)
{
$this->options = sfToolkit::arrayDeepMerge($this->options, $options);
if (!$this->page instanceof DmPage) {
throw new dmException(sprintf('%s require a source instance of DmPage, %s given', get_class($this), get_class($this->page)));
}
}
开发者ID:runopencode,项目名称:diem-extended,代码行数:7,代码来源:dmSearchPageDocument.php
示例15: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$filename = $arguments['target'];
if (null !== $filename && !sfToolkit::isPathAbsolute($filename))
{
$dir = sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'fixtures';
$this->getFilesystem()->mkdirs($dir);
$filename = $dir.DIRECTORY_SEPARATOR.$filename;
$this->logSection('propel', sprintf('dumping data to "%s"', $filename));
}
$data = new sfPropelData();
$classes = null === $options['classes'] ? 'all' : explode(',', $options['classes']);
if (null !== $filename)
{
$data->dumpData($filename, $classes, $options['connection']);
}
else
{
fwrite(STDOUT, sfYaml::dump($data->getData($classes, $options['connection']), 3));
}
}
开发者ID:nurhidayatullah,项目名称:inventory,代码行数:30,代码来源:sfPropelDataDumpTask.class.php
示例16: getLinkToAction
public function getLinkToAction($actionName, $params, $pk_link = false)
{
$options = isset($params['params']) && !is_array($params['params']) ? sfToolkit::stringToArray($params['params']) : array();
// default values
if ($actionName[0] == '_') {
$actionName = substr($actionName, 1);
$name = $actionName;
//$icon = sfConfig::get('sf_admin_web_dir').'/images/'.$actionName.'_icon.png';
$action = $actionName;
if ($actionName == 'delete') {
$options['post'] = true;
if (!isset($options['confirm'])) {
$options['confirm'] = 'Are you sure?';
}
}
} else {
$name = isset($params['name']) ? $params['name'] : $actionName;
//$icon = isset($params['icon']) ? sfToolkit::replaceConstants($params['icon']) : sfConfig::get('sf_admin_web_dir').'/images/default_icon.png';
$action = isset($params['action']) ? $params['action'] : 'List' . sfInflector::camelize($actionName);
}
$url_params = $pk_link ? '?' . $this->getPrimaryKeyUrlParams() : '\'';
$phpOptions = var_export($options, true);
// little hack
$phpOptions = preg_replace("/'confirm' => '(.+?)(?<!\\\\)'/", '\'confirm\' => __(\'$1\')', $phpOptions);
return '<li class="sf_admin_action_' . sfInflector::underscore($name) . '">[?php echo link_to(__(\'' . $params['label'] . '\'), \'' . $this->getModuleName() . '/' . $action . $url_params . ($options ? ', ' . $phpOptions : '') . ') ?]</li>' . "\n";
}
开发者ID:nvidela,项目名称:kimkelen,代码行数:26,代码来源:sfPropelRevisitedGenerator.class.php
示例17: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
/**
* include path to propel generator
*/
sfToolkit::addIncludePath(array(sfConfig::get('sf_propel_path') . '/generator/lib'));
/**
* first check the db connectivity for all connections
*/
$this->logBlock('Checking Db Connectivity', "QUESTION");
if (!$this->createTask('afs:db-connectivity')->run()) {
return;
}
$this->logBlock('Creating specific AppFlower folders', "QUESTION");
$this->createFolders();
$this->logBlock('Setting Symfony project permissions', "QUESTION");
$this->createTask('project:permissions')->run();
$type_method = 'execute' . sfInflector::camelize($options['type']);
if (!method_exists($this, $type_method)) {
throw new sfCommandException("Type method '{$type_method}' not defined.");
}
call_user_func(array($this, $type_method), $arguments, $options);
$this->logBlock('Creating models from current schema', "QUESTION");
$this->createTask('propel:build-model')->run();
$this->logBlock('Creating forms from current schema', "QUESTION");
$this->createTask('propel:build-forms')->run();
$this->logBlock('Setting AppFlower project permissions', "QUESTION");
$this->createTask('afs:fix-perms')->run();
$this->logBlock('Creating AppFlower validator cache', "QUESTION");
$this->createTask('appflower:validator-cache')->run(array('frontend', 'cache', 'yes'));
$this->logBlock('Clearing Symfony cache', "QUESTION");
$this->createTask('cc')->run();
}
开发者ID:cbsistem,项目名称:appflower_studio,代码行数:36,代码来源:afsInitTask.class.php
示例18: execute
/**
* Executes this configuration handler.
*
* @param array $configFiles An array of absolute filesystem path to a configuration file
*
* @return string Data to be written to a cache file
*
* @throws sfConfigurationException If a requested configuration file does not exist or is not readable
* @throws sfParseException If a requested configuration file is improperly formatted
*/
public function execute($configFiles)
{
// parse the yaml
$config = self::getConfiguration($configFiles);
// init our data
$data = '';
// let's do our fancy work
foreach ($config as $file) {
if (!is_readable($file)) {
// file doesn't exist
throw new sfParseException(sprintf('Configuration file "%s" specifies nonexistent or unreadable file "%s".', $configFiles[0], $file));
}
$contents = file_get_contents($file);
// strip comments (not in debug mode)
if (!sfConfig::get('sf_debug')) {
$contents = sfToolkit::stripComments($contents);
}
// strip php tags
$contents = sfToolkit::pregtr($contents, array('/^\\s*<\\?(php\\s*)?/m' => '', '/^\\s*\\?>/m' => ''));
// replace windows and mac format with unix format
$contents = str_replace("\r", "\n", $contents);
// replace multiple new lines with a single newline
$contents = preg_replace(array('/\\s+$/Sm', '/\\n+/S'), "\n", $contents);
// append file data
$data .= "\n" . $contents;
}
// compile data
return sprintf("<?php\n" . "// auto-generated by sfCompileConfigHandler\n" . "// date: %s\n" . "%s\n", date('Y/m/d H:i:s'), $data);
}
开发者ID:sabaki-dev,项目名称:symfony1,代码行数:39,代码来源:sfCompileConfigHandler.class.php
示例19: task_extra_cleanup
function task_extra_cleanup()
{
sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/cache');
sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/log');
sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/plugins');
sfToolkit::clearDirectory(dirname(__FILE__) . '/../fixtures/project/test/unit');
}
开发者ID:jmiridis,项目名称:atcsf1,代码行数:7,代码来源:unit.php
示例20: build
public function build()
{
if (!DataModelBuilder::getBuildProperty('builderAddComments')) {
return sfToolkit::stripComments(parent::build());
}
return parent::build();
}
开发者ID:taryono,项目名称:school,代码行数:7,代码来源:SfPeerBuilder.php
注:本文中的sfToolkit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论