本文整理汇总了PHP中Zend_Config_Writer_Xml::setFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Writer_Xml::setFilename方法的具体用法?PHP Zend_Config_Writer_Xml::setFilename怎么用?PHP Zend_Config_Writer_Xml::setFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config_Writer_Xml
的用法示例。
在下文中一共展示了Zend_Config_Writer_Xml::setFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editCatalogAction
public function editCatalogAction()
{
$catalogForm = Model_Static_Loader::loadForm("catalog");
$catalogForm->preview->setDestination(APPLICATION_ROOT . "/public/files/catalogs");
$catalogForm->file->setDestination(APPLICATION_ROOT . "/public/files/catalogs");
$catalogs = new Zend_Config_Xml(APPLICATION_PATH . "/config/catalogs.xml");
$id = $this->getRequest()->getParam('guid');
if ($id && !isset($catalogs->{$id})) {
throw new Zend_Exception("Not found", 404);
} elseif ($id) {
$catalogForm->setDefaults($catalogs->{$id}->toArray());
}
if ($this->getRequest()->isPost() && $catalogForm->isValid($_POST)) {
$data = $catalogForm->getValues();
$data["preview"] = "/files/catalogs/" . $data["preview"];
$data["file"] = "/files/catalogs/" . $data["file"];
$catalogs = $catalogs->toArray();
if ($id) {
$catalogs[$id] = $data;
} else {
$catalogs['cat' . date("ymdhis")] = $data;
}
$xml = new Zend_Config_Writer_Xml();
$xml->setConfig(new Zend_Config($catalogs));
$xml->setFilename(APPLICATION_PATH . "/config/catalogs.xml");
$xml->write();
}
$this->view->form = $catalogForm;
}
示例2: backupAction
function backupAction()
{
//$message = var_export($this->getRequest()->getPost(), true);
ignore_user_abort();
/* @var $request Zend_Controller_Request_Http */
$request = $this->getRequest();
$fastAction = $request->getParam('a', false);
if ($request->isPost() || $fastAction !== false) {
$components = $request->getPost('components', array());
$plugins = X_VlcShares_Plugins::broker()->getPlugins();
$items = array();
foreach ($plugins as $pId => $plugin) {
if (array_key_exists($pId, $components) && (bool) $components[$pId] || $fastAction == 'all' || $fastAction == $pId) {
if ($plugin instanceof X_VlcShares_Plugins_BackuppableInterface) {
//$toBackup[$pId] = $plugin;
$items[$pId] = $plugin->getBackupItems();
X_Debug::i('Backuppable plugin: ' . $pId);
} elseif ($fastAction != 'all') {
$this->_helper->flashMessenger(array('text' => X_Env::_('p_backupper_backup_invalidplugin') . ": {$pId}", 'type' => 'error'));
}
} else {
//X_Debug::i('Discarded plugin: '.$pId);
}
}
//$this->_helper->flashMessenger(var_export($items, true));
if (count($items)) {
$writer = new Zend_Config_Writer_Xml();
$date = date("Y-m-d_H-i-s");
$type = $fastAction !== false ? $fastAction : 'custom';
$data['metadata'] = array('version' => X_VlcShares::VERSION, 'created' => date('d/m/Y H:i:s'), 'decrypt' => 'backupper_decodevalues_0_5_5');
$data['plugins'] = $items;
$filename = APPLICATION_PATH . "/../data/backupper/backup_{$date}_{$type}.xml";
$data['plugins'] = array_map('backupper_encodevalues', $data['plugins']);
$configs = new Zend_Config($data);
$writer->setFilename($filename);
try {
$writer->write(null, $configs, true);
$this->_helper->flashMessenger(array('text' => X_Env::_('p_backupper_backup_done'), 'type' => 'info'));
} catch (Exception $e) {
$this->_helper->flashMessenger(array('text' => X_Env::_('p_backupper_err_writefile') . ": {$e->getMessage()}", 'type' => 'error'));
}
} else {
$this->_helper->flashMessenger(array('text' => X_Env::_('p_backupper_backup_nobackupactionneeded'), 'type' => 'warning'));
}
}
//$this->_helper->flashMessenger($message);
$this->_helper->redirector('index', 'backupper');
}