当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Config_Writer_Xml::setFilename方法代码示例

本文整理汇总了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;
 }
开发者ID:Alpha-Hydro,项目名称:alpha-hydro-antares,代码行数:29,代码来源:IndexController.php

示例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');
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:48,代码来源:BackupperController.php


注:本文中的Zend_Config_Writer_Xml::setFilename方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。