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


PHP Zend_Config_Writer_Xml::setConfig方法代码示例

本文整理汇总了PHP中Zend_Config_Writer_Xml::setConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Writer_Xml::setConfig方法的具体用法?PHP Zend_Config_Writer_Xml::setConfig怎么用?PHP Zend_Config_Writer_Xml::setConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Config_Writer_Xml的用法示例。


在下文中一共展示了Zend_Config_Writer_Xml::setConfig方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: serialize

 /**
  * 
  * @param array $array
  * @return string
  */
 public static function serialize($array)
 {
     $config = new Zend_Config_Writer_Xml();
     ZendT_Xml::encodeXml($array);
     $config->setConfig(new Zend_Config($array));
     $xml = $config->render();
     return $xml;
     /*$serializer = new XML_Serializer(array(XML_SERIALIZER_OPTION_ROOT_NAME=>'config'));
       $result = $serializer->serialize($array);
       if ($result){
           $xml = $serializer->getSerializedData();
       }
       return $xml;*/
 }
开发者ID:rtsantos,项目名称:mais,代码行数:19,代码来源:Xml.php

示例3: testRender

    /**
     * @group ZF-8234
     */
    public function testRender()
    {
        $config = new Zend_Config(array('test' => 'foo', 'bar' => array(0 => 'baz', 1 => 'foo')));
        $writer = new Zend_Config_Writer_Xml();
        $configString = $writer->setConfig($config)->render();
        $expected = <<<ECS
<?xml version="1.0"?>
<zend-config xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/">
  <test>foo</test>
  <bar>baz</bar>
  <bar>foo</bar>
</zend-config>

ECS;
        $this->assertEquals($expected, $configString);
    }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:19,代码来源:XmlTest.php

示例4: uninstall

 /**
  * Uninstall plugin
  *
  * Sets config file parameter "installed" to 0 (if config file exists)
  *
  * @return string uninstall success|failure message
  */
 public static function uninstall()
 {
     if (file_exists(self::getConfigName())) {
         $config = new \Zend_Config_Xml(self::getConfigName(), null, array('allowModifications' => true));
         $config->librato->installed = 0;
         $configWriter = new \Zend_Config_Writer_Xml();
         $configWriter->setConfig($config);
         $configWriter->write(self::getConfigName());
     }
     if (!self::isInstalled()) {
         return "Successfully uninstalled.";
     } else {
         return "Could not be uninstalled";
     }
 }
开发者ID:basilicom,项目名称:pimcore-plugin-librato,代码行数:22,代码来源:Plugin.php

示例5: removePluginRoute

 public static function removePluginRoute($pluginName)
 {
     $routesData = self::_initValues();
     $pluginConfigPath = $routesData['pluginsDirPath'] . $pluginName . '/config/config.ini';
     $routes = $routesData['routes'];
     if (!file_exists($pluginConfigPath)) {
         return;
     }
     try {
         $configIni = new Zend_Config_Ini($pluginConfigPath);
         if (!isset($configIni->route)) {
             return;
         }
         $pluginRoute = self::_formatPluginRoute($configIni->route->toArray(), $pluginName);
         if (!empty($routes)) {
             if (array_key_exists($pluginRoute['name'], $routes['routes'])) {
                 unset($routes['routes'][$pluginRoute['name']]);
                 $writer = new Zend_Config_Writer_Xml();
                 $writer->setConfig(new Zend_Config($routes));
                 $writer->write($routesData['routesPath']);
             }
         }
     } catch (Zend_Config_Exception $zce) {
         return;
     }
 }
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:26,代码来源:Tools.php


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