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


PHP Zend_Config_Writer_Xml::write方法代码示例

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


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

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

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

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

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

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

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

示例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()
 {
     $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

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

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

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

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

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

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


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