• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Config_Writer_Xml类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Zend_Config_Writer_Xml类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: addLanguage

 public function addLanguage($languageToAdd)
 {
     // Check if language is not already added
     if (in_array($languageToAdd, Tool::getValidLanguages())) {
         $result = false;
     } else {
         // Read all the documents from the first language
         $availableLanguages = Tool::getValidLanguages();
         $firstLanguageDocument = \Pimcore\Model\Document::getByPath('/' . reset($availableLanguages));
         \Zend_Registry::set('SEI18N_add', 1);
         // Add the language main folder
         $document = Page::create(1, array('key' => $languageToAdd, "userOwner" => 1, "userModification" => 1, "published" => true, "controller" => 'default', "action" => 'go-to-first-child'));
         $document->setProperty('language', 'text', $languageToAdd);
         // Set the language to this folder and let it inherit to the child pages
         $document->setProperty('isLanguageRoot', 'text', 1, false, false);
         // Set as language root document
         $document->save();
         // Add Link to other languages
         $t = new Keys();
         $t->insert(array("document_id" => $document->getId(), "language" => $languageToAdd, "sourcePath" => $firstLanguageDocument->getFullPath()));
         // Lets add all the docs
         $this->addDocuments($firstLanguageDocument->getId(), $languageToAdd);
         \Zend_Registry::set('SEI18N_add', 0);
         $oldConfig = Config::getSystemConfig();
         $settings = $oldConfig->toArray();
         $languages = explode(',', $settings['general']['validLanguages']);
         $languages[] = $languageToAdd;
         $settings['general']['validLanguages'] = implode(',', $languages);
         $config = new \Zend_Config($settings, true);
         $writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => PIMCORE_CONFIGURATION_SYSTEM));
         $writer->write();
         $result = true;
     }
     return $result;
 }
开发者ID:studioemma,项目名称:multilingual,代码行数:35,代码来源:Document.php


示例2: installAction

 public function installAction()
 {
     // try to establish a mysql connection
     try {
         $db = Zend_Db::factory($this->_getParam("mysql_adapter"), array('host' => $this->_getParam("mysql_host"), 'username' => $this->_getParam("mysql_username"), 'password' => $this->_getParam("mysql_password"), 'dbname' => $this->_getParam("mysql_database"), "port" => $this->_getParam("mysql_port")));
         $db->getConnection();
         // check utf-8 encoding
         $result = $db->fetchRow('SHOW VARIABLES LIKE "character\\_set\\_database"');
         if ($result['Value'] != "utf8") {
             $errors[] = "Database charset is not utf-8";
         }
     } catch (Exception $e) {
         $errors[] = "Couldn't establish connection to mysql: " . $e->getMessage();
     }
     // check username & password
     if (strlen($this->_getParam("admin_password")) < 4 || strlen($this->_getParam("admin_username")) < 4) {
         $errors[] = "Username and password should have at least 4 characters";
     }
     if (empty($errors)) {
         // write configuration file
         $settings = array("general" => array("timezone" => "Europe/Berlin", "language" => "en", "validLanguages" => "en", "debug" => "1", "theme" => "/pimcore/static/js/lib/ext/resources/css/xtheme-gray.css", "loginscreenimageservice" => "1", "welcomescreen" => "1", "loglevel" => array("debug" => "1", "info" => "1", "notice" => "1", "warning" => "1", "error" => "1", "critical" => "1", "alert" => "1", "emergency" => "1")), "database" => array("adapter" => $this->_getParam("mysql_adapter"), "params" => array("host" => $this->_getParam("mysql_host"), "username" => $this->_getParam("mysql_username"), "password" => $this->_getParam("mysql_password"), "dbname" => $this->_getParam("mysql_database"), "port" => $this->_getParam("mysql_port"))), "documents" => array("versions" => array("steps" => "10"), "default_controller" => "default", "default_action" => "default", "error_page" => "/", "allowtrailingslash" => "no", "allowcapitals" => "no"), "objects" => array("versions" => array("steps" => "10")), "assets" => array("versions" => array("steps" => "10")), "services" => array(), "cache" => array("excludeCookie" => "pimcore_admin_sid"), "httpclient" => array("adapter" => "Zend_Http_Client_Adapter_Socket"));
         $config = new Zend_Config($settings, true);
         $writer = new Zend_Config_Writer_Xml(array("config" => $config, "filename" => PIMCORE_CONFIGURATION_SYSTEM));
         $writer->write();
         // insert db dump
         $db = Pimcore_Resource::get();
         $mysqlInstallScript = file_get_contents(PIMCORE_PATH . "/modules/install/mysql/install.sql");
         // remove comments in SQL script
         $mysqlInstallScript = preg_replace("/\\s*(?!<\")\\/\\*[^\\*]+\\*\\/(?!\")\\s*/", "", $mysqlInstallScript);
         // get every command as single part
         $mysqlInstallScripts = explode(";", $mysqlInstallScript);
         // execute every script with a separate call, otherwise this will end in a PDO_Exception "unbufferd queries, ..." seems to be a PDO bug after some googling
         foreach ($mysqlInstallScripts as $m) {
             $sql = trim($m);
             if (strlen($sql) > 0) {
                 $sql .= ";";
                 $db->query($m);
             }
         }
         // get a new database connection
         $db = Pimcore_Resource::reset();
         // insert data into database
         $db->insert("assets", array("id" => 1, "parentId" => 0, "type" => "folder", "filename" => "", "path" => "/", "creationDate" => time(), "modificationDate" => time(), "userOwner" => 1, "userModification" => 1));
         $db->insert("documents", array("id" => 1, "parentId" => 0, "type" => "page", "key" => "", "path" => "/", "index" => 999999, "published" => 1, "creationDate" => time(), "modificationDate" => time(), "userOwner" => 1, "userModification" => 1));
         $db->insert("documents_page", array("id" => 1, "controller" => "", "action" => "", "template" => "", "title" => "", "description" => "", "keywords" => ""));
         $db->insert("objects", array("o_id" => 1, "o_parentId" => 0, "o_type" => "folder", "o_key" => "", "o_path" => "/", "o_index" => 999999, "o_published" => 1, "o_creationDate" => time(), "o_modificationDate" => time(), "o_userOwner" => 1, "o_userModification" => 1));
         $userPermissions = array(array("key" => "assets", "translation" => "permission_assets"), array("key" => "classes", "translation" => "permission_classes"), array("key" => "clear_cache", "translation" => "permission_clear_cache"), array("key" => "clear_temp_files", "translation" => "permission_clear_temp_files"), array("key" => "document_types", "translation" => "permission_document_types"), array("key" => "documents", "translation" => "permission_documents"), array("key" => "objects", "translation" => "permission_objects"), array("key" => "plugins", "translation" => "permission_plugins"), array("key" => "predefined_properties", "translation" => "permission_predefined_properties"), array("key" => "routes", "translation" => "permission_routes"), array("key" => "seemode", "translation" => "permission_seemode"), array("key" => "system_settings", "translation" => "permission_system_settings"), array("key" => "thumbnails", "translation" => "permission_thumbnails"), array("key" => "translations", "translation" => "permission_translations"), array("key" => "users", "translation" => "permission_users"), array("key" => "update", "translation" => "permissions_update"), array("key" => "redirects", "translation" => "permissions_redirects"), array("key" => "glossary", "translation" => "permissions_glossary"), array("key" => "reports", "translation" => "permissions_reports_marketing"));
         foreach ($userPermissions as $up) {
             $db->insert("users_permission_definitions", $up);
         }
         Pimcore::initConfiguration();
         $user = User::create(array("parentId" => 0, "username" => $this->_getParam("admin_username"), "password" => Pimcore_Tool_Authentication::getPasswordHash($this->_getParam("admin_username"), $this->_getParam("admin_password")), "hasCredentials" => true, "active" => true));
         $user->setAdmin(true);
         $user->save();
         $this->_helper->json(array("success" => true));
     } else {
         echo implode("<br />", $errors);
         die;
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:60,代码来源:IndexController.php


示例3: 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


示例4: save

 /**
  * @return void
  */
 public function save()
 {
     $arrayConfig = object2array($this);
     $config = new \Zend_Config($arrayConfig);
     $writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => $this->getConfigFile()));
     $writer->write();
     return true;
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:11,代码来源:Config.php


示例5: setConfig

 public static function setConfig($onlineshopConfigFile)
 {
     $config = self::getConfig(false);
     $config->onlineshop_config_file = $onlineshopConfigFile;
     // Write the config file
     $writer = new Zend_Config_Writer_Xml(array('config' => $config, 'filename' => PIMCORE_PLUGINS_PATH . OnlineShop_Plugin::$configFile));
     $writer->write();
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:8,代码来源:Plugin.php


示例6: saveAction

 public function saveAction()
 {
     $this->checkPermission("system_settings");
     $values = \Zend_Json::decode($this->getParam("data"));
     $config = new \Zend_Config($values, true);
     $writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => PIMCORE_CONFIGURATION_DIRECTORY . "/reports.xml"));
     $writer->write();
     $this->_helper->json(array("success" => true));
 }
开发者ID:sfie,项目名称:pimcore,代码行数:9,代码来源:SettingsController.php


示例7: save

 public function save()
 {
     $defaults = $this->defaults;
     $params = $this->getData();
     $data = $this->array_join($defaults, $params);
     $config = new Zend_Config($data, true);
     $writer = new Zend_Config_Writer_Xml(array("config" => $config, "filename" => SPHINX_VAR . DIRECTORY_SEPARATOR . "config.xml"));
     $writer->write();
 }
开发者ID:VadzimBelski-ScienceSoft,项目名称:pimcore-plugin-SphinxSearch,代码行数:9,代码来源:Plugin.php


示例8: saveAction

 public function saveAction()
 {
     if ($this->getUser()->isAllowed("system_settings")) {
         $values = Zend_Json::decode($this->_getParam("data"));
         $config = new Zend_Config($values, true);
         $writer = new Zend_Config_Writer_Xml(array("config" => $config, "filename" => PIMCORE_CONFIGURATION_DIRECTORY . "/reports.xml"));
         $writer->write();
         $this->_helper->json(array("success" => true));
     }
     $this->_helper->json(false);
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:11,代码来源:SettingsController.php


示例9: indexAction

 public function indexAction()
 {
     if ($this->getParam("save") === 'yes') {
         $settings = array("replaceobjects" => $this->getParam("replaceobjects") === PimPon_Plugin::ALLOW_REPLACE ? PimPon_Plugin::ALLOW_REPLACE : PimPon_Plugin::DENY_REPLACE, "replacedocuments" => $this->getParam("replacedocuments") === PimPon_Plugin::ALLOW_REPLACE ? PimPon_Plugin::ALLOW_REPLACE : PimPon_Plugin::DENY_REPLACE, "replaceroutes" => $this->getParam("replaceroutes") === PimPon_Plugin::ALLOW_REPLACE ? PimPon_Plugin::ALLOW_REPLACE : PimPon_Plugin::DENY_REPLACE, "replaceusers" => $this->getParam("replaceusers") === PimPon_Plugin::ALLOW_REPLACE ? PimPon_Plugin::ALLOW_REPLACE : PimPon_Plugin::DENY_REPLACE, "replaceroles" => $this->getParam("replaceroles") === PimPon_Plugin::ALLOW_REPLACE ? PimPon_Plugin::ALLOW_REPLACE : PimPon_Plugin::DENY_REPLACE);
         $config = new Zend_Config($settings, true);
         $writer = new Zend_Config_Writer_Xml(array("config" => $config, "filename" => PimPon_Plugin::getConfigFile()));
         $writer->write();
     }
     $config = PimPon_Plugin::getConfig();
     $this->view->config = $config;
 }
开发者ID:jv10,项目名称:pimpon,代码行数:11,代码来源:SettingsController.php


示例10: save

 /**
  * @return void
  */
 public function save()
 {
     $arrayConfig = object2array($this);
     $items = $arrayConfig["items"];
     $arrayConfig["items"] = array("item" => $items);
     $params = $arrayConfig["params"];
     $arrayConfig["params"] = array("param" => $params);
     $config = new Zend_Config($arrayConfig);
     $writer = new Zend_Config_Writer_Xml(array("config" => $config, "filename" => $this->getConfigFile()));
     $writer->write();
     return true;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:15,代码来源:Config.php


示例11: activateTheme

 private function activateTheme($theme)
 {
     if (in_array($theme, $this->view->themes)) {
         $conf = new Zend_Config_Xml("config/config.xml", null, array('skipExtends' => true, 'allowModifications' => true));
         $conf->general->theme = $theme;
         // Write the configuration file
         $writer = new Zend_Config_Writer_Xml(array('config' => $conf, 'filename' => 'config/config.xml'));
         $writer->write();
     } else {
         throw new Exception($this->view->translate("The theme you are trying to activate doesn't exist!"));
     }
 }
开发者ID:valentinbora,项目名称:joobsbox-php,代码行数:12,代码来源:Themes.php


示例12: processAction

 public function processAction()
 {
     $error = array();
     $defaultNamespace = new Zend_Session_Namespace('Default');
     $options = array('authentication' => array('email' => $this->getRequest()->getParam('admin_email'), 'password' => $this->getRequest()->getParam('admin_password')), 'settings' => array('default_from' => $this->getRequest()->getParam('default_from'), 'keep_history' => $this->getRequest()->getParam('keep_history'), 'alchemy_api_key' => $this->getRequest()->getParam('alchemy_api_key')), 'resources' => array('db' => array('adapter' => 'PDO_MYSQL', 'params' => array('host' => $this->getRequest()->getParam('db_host'), 'username' => $this->getRequest()->getParam('db_user'), 'password' => $this->getRequest()->getParam('db_password'), 'dbname' => $this->getRequest()->getParam('db_name'), 'prefix' => $this->getRequest()->getParam('db_prefix')))), 'template' => $this->getRequest()->getParam('template'));
     $validator = new Zend_Validate_EmailAddress();
     if (!$validator->isValid($options['authentication']['email'])) {
         $error['admin_email'] = 'Administrator e-mail is invalid';
     }
     if (!trim($options['authentication']['password'])) {
         $error['admin_password'] = 'Administrator password can not be blank';
     }
     if (!$validator->isValid($options['settings']['default_from'])) {
         $error['default_from'] = 'Default "from" e-mail is invalid';
     }
     if (!trim($options['resources']['db']['params']['host'])) {
         $error['db_host'] = 'Database host can not be blank';
     }
     if (!trim($options['resources']['db']['params']['username'])) {
         $error['db_user'] = 'Database user can not be blank';
     }
     if (!trim($options['resources']['db']['params']['dbname'])) {
         $error['db_name'] = 'Database name can not be blank';
     }
     if ((int) $options['settings']['keep_history'] <= 0) {
         $error['keep_history'] = 'Timeline display length have to be positive integer';
     }
     if (!($db = new Zend_Db_Adapter_Pdo_Mysql(array('host' => $options['resources']['db']['params']['host'], 'username' => $options['resources']['db']['params']['username'], 'password' => $options['resources']['db']['params']['password'], 'dbname' => $options['resources']['db']['params']['dbname'])))) {
         $error[] = 'Incorrect database connection details';
     }
     if (count($error)) {
         /**
          * Redirect back
          */
         $defaultNamespace->error = $error;
         $defaultNamespace->options = $options;
         $this->_helper->redirector('index', 'index', 'install');
     } else {
         /**
          * Write .ini file
          */
         unset($defaultNamespace->options);
         /** @var $bootstrap Bootstrap */
         $bootstrap = $this->getInvokeArg('bootstrap');
         $options = new Zend_Config($options);
         $writer = new Zend_Config_Writer_Xml();
         $writer->write($bootstrap->getOption('local_config'), $options);
         $options = $bootstrap->getOptions();
         $options = new Zend_Config($options);
         $writer->write('application.xml', $options);
         $this->_helper->redirector('index', 'index', 'default');
     }
 }
开发者ID:sepano,项目名称:open-social-media-monitoring,代码行数:53,代码来源:IndexController.php


示例13: generateFieldCollectionXml

 /**
  * @static
  * @param  Object_Class $class
  * @return string
  */
 public static function generateFieldCollectionXml($fieldCollection)
 {
     $FieldCollectionJson = Zend_Json::encode($fieldCollection);
     $data = Zend_Json::decode($FieldCollectionJson);
     unset($data["key"]);
     $referenceFunction = function (&$value, $key) {
         $value = htmlspecialchars($value);
     };
     array_walk_recursive($data, $referenceFunction);
     $config = new Zend_Config($data, true);
     $writer = new Zend_Config_Writer_Xml(array("config" => $config));
     return $writer->render();
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:18,代码来源:Service.php


示例14: 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


示例15: setAction

 public function setAction()
 {
     $values = \Zend_Json::decode($this->getParam("data"));
     // convert all special characters to their entities so the xml writer can put it into the file
     $values = array_htmlspecialchars($values);
     // email settings
     $oldConfig = Config::getConfig();
     $oldValues = $oldConfig->toArray();
     $settings = array("base" => array("base-currency" => $values["base.base-currency"]), "product" => array("default-image" => $values["product.default-image"], "days-as-new" => $values["product.days-as-new"]), "category" => array("default-image" => $values["category.default-image"]));
     $config = new \Zend_Config($settings, true);
     $writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => CORESHOP_CONFIGURATION));
     $writer->write();
     $this->_helper->json(array("success" => true));
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:14,代码来源:SettingsController.php


示例16: newControllerAction

 public function newControllerAction()
 {
     $this->setLayout("nolayout");
     $this->setInnerLayout(self::LAYOUT_DEFAULT);
     $params = $this->_request->getParams();
     $this->view->con = $params['con'];
     $this->view->mdl = $params['mdl'];
     $this->view->act = $params['act'];
     if (isset($_POST)) {
         $module = $params['moduleName'];
         $controllerClassName = $params['controllerName'];
         $controllerClassName2 = strtolower(preg_replace('/(?<=\\w)(?=[A-Z])/', "-\$1", $controllerClassName));
         $label = $params['controllerLabel'];
         $icon = $params['controllerIcon'];
         $extendController = $params['extendController'];
         $defaultModel = $params['defaultModel'];
         if ($controllerClassName != '') {
             $gen = new App_Code_GenController();
             $gen->gen($module, $controllerClassName, $label, $extendController, $defaultModel);
             //เพิ่มในรายการเมนู
             $configfile = APPLICATION_PATH . '/configs/navigation-admin.xml';
             $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation-admin.xml', null, true);
             $sub = $config->nav->{$module}->sub->toArray();
             $sub[$controllerClassName2] = array('label' => $label, 'icon' => $icon);
             $config->nav->{$module}->sub = $sub;
             $writer = new Zend_Config_Writer_Xml();
             $writer->write($configfile, $config);
         }
     }
 }
开发者ID:hugi2002,项目名称:mylibrary,代码行数:30,代码来源:ControllerSettingController.php


示例17: getStaticSalt

function getStaticSalt($conf)
{
    if (!isset($conf->db->passwordSalt)) {
        $salt = "";
        for ($i = 0; $i < 50; $i++) {
            $salt .= chr(rand(97, 122));
        }
        $tempConf = new Zend_Config_Xml("config/config.xml", null, array('skipExtends' => true, 'allowModifications' => true));
        $tempConf->db->passwordSalt = $salt;
        $writer = new Zend_Config_Writer_Xml(array('config' => $conf, 'filename' => 'config/config.xml'));
        $writer->write();
        Zend_Registry::set('staticSalt', $salt);
    } else {
        Zend_Registry::set('staticSalt', $conf->db->passwordSalt);
    }
}
开发者ID:ntulip,项目名称:joobsbox-php,代码行数:16,代码来源:config.php


示例18: saveAction

 public function saveAction()
 {
     $this->_helper->layout()->setLayout("nolayout");
     $modelname = $this->_request->getParam("model", 'Eau_Model_Company');
     $suffixname = "model-config.xml";
     $modelnameAr = explode("_", $modelname);
     $packet = strtolower($modelnameAr[0]);
     $configfile = $packet . "-" . $suffixname;
     $config = new Zend_Config_Xml(CONFIG_PATH . "{$configfile}", null, true);
     $allfield = array();
     $arrayKey = array();
     $i = 0;
     foreach (App_Model_Config::get($modelname)->getProperties() as $element) {
         $allfield[] = $element->name;
         $arrayKey[$element->name] = $i++;
     }
     $config->production->classes->{$modelname}->text = "2";
     $props = $config->production->classes->{$modelname}->prop->toArray();
     foreach ($_POST as $key => $value) {
         list($field, $property) = explode("_", $key);
         if (in_array($field, $allfield)) {
             $index = $arrayKey[$field];
             foreach ($props as $key => $prop) {
                 if ($prop['name'] == $field) {
                     $props[$key][$property] = $value;
                     //$config->classes->{$modelname}->props->$field->$property = $value;
                 }
                 //echo $prop->name,"<br/>";
             }
             //$config->classes->{$modelname}->prop->$property = $value;
         }
     }
     $config->production->classes->{$modelname}->prop = $props;
     $config->staging = array();
     $config->setExtend('staging', 'production');
     $config->development = array();
     $config->setExtend('development', 'production');
     $writer = new Zend_Config_Writer_Xml();
     $writer->write(CONFIG_PATH . $configfile, $config);
     $this->render('blank', null, true);
 }
开发者ID:hugi2002,项目名称:mylibrary,代码行数:41,代码来源:FormSettingController.php


示例19: editAction

 public function editAction()
 {
     $this->view->title = "Edit module";
     $form = new Controlmodule_Form_Controlmodulexml();
     $form->submit->setLabel('Save');
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             //si cambiamos name hay que cambiar la carpeta
             Zend_Debug::dump($formData, "model_role", true);
             $path = APPLICATION_PATH . "/modules/" . $formData["name"] . "/info.xml";
             $config = new Zend_Config(array(), true);
             $config->info = array();
             $config->info->name = $formData["name"];
             $config->info->description = $formData["description"];
             $config->info->version = $formData["version"];
             $config->info->copyright = $formData["copyright"];
             $config->info->developer = $formData["developer"];
             $writer = new Zend_Config_Writer_Xml(array('config' => $config, 'skipExtends' => true, 'filename' => $path));
             $writer->write();
             $this->_helper->redirector('index');
         } else {
             $form->populate($formData);
         }
     } else {
         $request = $this->getRequest();
         $path = APPLICATION_PATH . "/modules/" . $request->module_name . "/info.xml";
         $config = new Zend_Config_Xml($path, 'info');
         $arrayinfo["name"] = $config->name;
         $arrayinfo["version"] = $config->version;
         $arrayinfo["description"] = $config->description;
         $arrayinfo["copyright"] = $config->copyright;
         $arrayinfo["developer"] = $config->developer;
         $this->view->form->populate($arrayinfo);
     }
 }
开发者ID:roigrande,项目名称:globalpms,代码行数:37,代码来源:ControlmoduleController.php


示例20: config

 /**
  * @param array $config
  */
 public function config($config = array())
 {
     $settings = null;
     // check for an initial configuration template
     // used eg. by the demo installer
     $configTemplatePath = PIMCORE_CONFIGURATION_DIRECTORY . "/system.xml.template";
     if (file_exists($configTemplatePath)) {
         try {
             $configTemplate = new \Zend_Config_Xml($configTemplatePath);
             if ($configTemplate->general) {
                 // check if the template contains a valid configuration
                 $settings = $configTemplate->toArray();
                 // unset database configuration
                 unset($settings["database"]["params"]["host"]);
                 unset($settings["database"]["params"]["port"]);
             }
         } catch (\Exception $e) {
         }
     }
     // set default configuration if no template is present
     if (!$settings) {
         // write configuration file
         $settings = array("general" => array("timezone" => "Europe/Berlin", "language" => "en", "validLanguages" => "en", "debug" => "1", "debugloglevel" => "debug", "custom_php_logfile" => "1", "extjs6" => "1"), "database" => array("adapter" => "Mysqli", "params" => array("username" => "root", "password" => "", "dbname" => "")), "documents" => array("versions" => array("steps" => "10"), "default_controller" => "default", "default_action" => "default", "error_pages" => array("default" => "/"), "createredirectwhenmoved" => "", "allowtrailingslash" => "no", "allowcapitals" => "no", "generatepreview" => "1"), "objects" => array("versions" => array("steps" => "10")), "assets" => array("versions" => array("steps" => "10")), "services" => array(), "cache" => array("excludeCookie" => ""), "httpclient" => array("adapter" => "Zend_Http_Client_Adapter_Socket"));
     }
     $settings = array_replace_recursive($settings, $config);
     // convert all special characters to their entities so the xml writer can put it into the file
     $settings = array_htmlspecialchars($settings);
     // create initial /website/var folder structure
     // @TODO: should use values out of startup.php (Constants)
     $varFolders = array("areas", "assets", "backup", "cache", "classes", "config", "email", "log", "plugins", "recyclebin", "search", "system", "tmp", "versions", "webdav");
     foreach ($varFolders as $folder) {
         \Pimcore\File::mkdir(PIMCORE_WEBSITE_VAR . "/" . $folder);
     }
     $config = new \Zend_Config($settings, true);
     $writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => PIMCORE_CONFIGURATION_SYSTEM));
     $writer->write();
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:40,代码来源:Setup.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Config_Xml类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Config_Writer_Ini类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap