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


PHP Properties::setProperty方法代码示例

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


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

示例1: signupAction

 public function signupAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->addErrorMessage("Form was not properly posted.");
         $this->_forward('index');
     }
     // Retrieve the form values and its values
     $form = $this->getForm();
     $valid = $form->isValid($_POST);
     $values = $form->getValues();
     $username = $values['username'];
     $email = $values['email'];
     $password = $values['password'];
     // Validate the form itself
     if (!$form->isValid($_POST)) {
         // Failed validation; redisplay form
         $this->view->form = $form;
         $this->addErrorMessage("Your form contains some errors, please correct them and submit this form again");
         return $this->_forward('register');
     }
     // Register user
     $users = new Users();
     $user = $users->addUser($username, $password, $email);
     // Add some default widgets to the user
     $widgets = new Widgets(array(Stuffpress_Db_Table::USER => $user->id));
     $widgets->addWidget('search');
     $widgets->addWidget('rsslink');
     $widgets->addWidget('links');
     $widgets->addWidget('lastcomments');
     $widgets->addWidget('archives');
     $widgets->addWidget('logo');
     // Add some default properties
     $properties = new Properties(array(Stuffpress_Db_Properties::KEY => $user->id));
     $properties->setProperty('theme', 'clouds');
     $properties->setProperty('title', ucfirst($username));
     $properties->setProperty('subtitle', "my life online");
     // Add the storytlr data source
     StuffpressModel::forUser($user->id);
     // Add default pages
     $pages = new Pages(array(Stuffpress_Db_Table::USER => $user->id));
     //$pages->addPage('dashboard', 'Home');
     $pages->addPage('lifestream', 'Stream');
     $pages->addPage('stories', 'Stories');
     // Send the user a verification email
     Stuffpress_Emails::sendWelcomeEmail($email, $username, $password, $user->token);
     // Done !
     $this->view->username = $username;
     $this->view->email = $email;
     $this->render('success');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:50,代码来源:RegisterController.php

示例2: activarPantalla

 public function activarPantalla()
 {
     $pantallaActual = new Properties();
     $pantallaActual->load(file_get_contents("./pantallaActiva.properties"));
     $pantallaActual->setProperty("Pantalla.activa", 10);
     file_put_contents('./pantallaActiva.properties', $pantallaActual->toString(true));
 }
开发者ID:Tknika,项目名称:areto-server,代码行数:7,代码来源:GUI_DVDGrabador.php

示例3: resolve

 /**
  * Retrieves the new property or properties.
  *
  * @return     Properties The list of properties.
  */
 public function resolve()
 {
     if ($this->name === null) {
         throw new BuildException('The name attribute must be specified');
     }
     if ($this->value === null) {
         throw new BuildException('The value attribute must be specified');
     }
     $properties = new Properties();
     $properties->setProperty($this->name, $this->value);
     return $properties;
 }
开发者ID:horros,项目名称:agavi,代码行数:17,代码来源:AgaviPropertyType.php

示例4: forUser

 public static function forUser($id)
 {
     $properties = new Properties(array(Properties::KEY => $id));
     $sources = new Sources(array(Stuffpress_Db_Table::USER => $id));
     $source_id = $properties->getProperty('stuffpress_source');
     if (!$source_id) {
         $source_id = $sources->addSource('stuffpress');
         $sources->setImported($source_id, 1);
         $properties->setProperty('stuffpress_source', $source_id);
     }
     $source = $sources->getSource($source_id);
     return new StuffpressModel($source);
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:13,代码来源:StuffpressModel.php

示例5: testMergePropertiesWithSameKeyAndOverride

 /**
  * Test's the merge() method with two properties instances containing the same key
  * and the override flag has been passed.
  *
  * @return void
  */
 public function testMergePropertiesWithSameKeyAndOverride()
 {
     // initialize the properties
     $properties = new Properties();
     $properties->setProperty('foo', '${bar}');
     // initialize the properties to be merged
     $propertiesToMerge = new Properties();
     $propertiesToMerge->setProperty('foo', 'bar');
     // merge the properties
     $properties->mergeProperties($propertiesToMerge, true);
     // assert that the results are as expected
     $this->assertSame('bar', $properties->getProperty('foo'));
 }
开发者ID:appserver-io,项目名称:properties,代码行数:19,代码来源:PropertiesUtilTest.php

示例6: createSqlDbMap

 /**
  * Create the sql -> database map.
  *
  * @throws IOException - if unable to store properties
  */
 protected function createSqlDbMap()
 {
     if ($this->getSqlDbMap() === null) {
         return;
     }
     // Produce the sql -> database map
     $sqldbmap = new Properties();
     // Check to see if the sqldbmap has already been created.
     if ($this->getSqlDbMap()->exists()) {
         $sqldbmap->load($this->getSqlDbMap());
     }
     if ($this->packageObjectModel) {
         // in this case we'll get the sql file name from the package attribute
         $dataModels = $this->packageDataModels();
         foreach ($dataModels as $package => $dataModel) {
             foreach ($dataModel->getDatabases() as $database) {
                 $name = ($package ? $package . '.' : '') . 'schema.xml';
                 $sqlFile = $this->getMappedFile($name);
                 $sqldbmap->setProperty($sqlFile->getName(), $database->getName());
             }
         }
     } else {
         // the traditional way is to map the schema.xml filenames
         $dmMap = $this->getDataModelDbMap();
         foreach (array_keys($dmMap) as $dataModelName) {
             $sqlFile = $this->getMappedFile($dataModelName);
             if ($this->getDatabase() === null) {
                 $databaseName = $dmMap[$dataModelName];
             } else {
                 $databaseName = $this->getDatabase();
             }
             $sqldbmap->setProperty($sqlFile->getName(), $databaseName);
         }
     }
     try {
         $sqldbmap->store($this->getSqlDbMap(), "Sqlfile -> Database map");
     } catch (IOException $e) {
         throw new IOException("Unable to store properties: " . $e->getMessage());
     }
 }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:45,代码来源:PropelSQLTask.php

示例7: main

 /**
  * Executes the task.
  */
 public function main()
 {
     if ($this->file === null) {
         throw new BuildException('The file attribute must be set');
     }
     $properties = new Properties();
     if ($this->update === true) {
         /* Load existing properties. */
         try {
             $properties->load($this->file);
         } catch (IOException $ioe) {
             /* File doesn't exist or isn't readable, so don't worry here. */
         }
     }
     /* Add new properties. */
     foreach ($this->properties as $property) {
         foreach ($property->resolve()->getProperties() as $name => $value) {
             $properties->setProperty($name, $value);
         }
     }
     $properties->store($this->file, 'Automatically-updated properties file ' . 'generated by the Agavi write-properties task');
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:25,代码来源:AgaviWritepropertiesTask.php

示例8: merge

 static function merge($project, $codeCoverageInformation)
 {
     $database = new PhingFile($project->getProperty('coverage.database'));
     $props = new Properties();
     $props->load($database);
     $coverageTotal = $codeCoverageInformation;
     foreach ($coverageTotal as $coverage) {
         foreach ($coverage as $filename => $coverageFile) {
             $filename = strtolower($filename);
             if ($props->getProperty($filename) != null) {
                 $file = unserialize($props->getProperty($filename));
                 $left = $file['coverage'];
                 $right = $coverageFile;
                 $coverageMerged = CoverageMerger::mergeCodeCoverage($left, $right);
                 $file['coverage'] = $coverageMerged;
                 $props->setProperty($filename, serialize($file));
             }
         }
     }
     $props->store($database);
 }
开发者ID:superchangme,项目名称:jsplugin,代码行数:21,代码来源:CoverageMerger.php

示例9: _addNode

 /**
  * Adds an XML node
  * 
  * @param SimpleXMLElement $node
  * @param array $path Path to this node
  * @param Properties $prop Properties will be added as they are found (by reference here)
  *
  * @return void
  */
 protected function _addNode($node, $path, $prop)
 {
     foreach ($node as $tag => $value) {
         $prefix = implode('.', $path);
         // Check for attributes
         foreach ($value->attributes() as $attribute => $val) {
             if ($this->_collapseAttr) {
                 $prop->setProperty($prefix . ".{$attribute}", (string) $val);
             } else {
                 $prop->setProperty($prefix . "({$attribute})", (string) $val);
             }
         }
         //echo "\r\nCHILDREN ". count($value->children()). is_array($value);
         // Add tag
         if (count($value->children())) {
             //echo "\r\nOBJECT $prefix.$tag ";
             $path[] = $tag;
             $this->_addNode($value, $path, $prop);
         } else {
             //echo "\r\nADD $prefix.$tag";
             $val = (string) $value;
             /* Check for * and ** on 'exclude' and 'include' tag / ant seems to do this? could use FileSet here
                if($tag == 'exclude') {
                }*/
             // When property already exists, i.e. multiple xml tag
             // <project>
             //    <exclude>file/a.php</exclude>
             //    <exclude>file/a.php</exclude>
             // </project>
             //
             // Would be come project.exclude = file/a.php,file/a.php
             $p = empty($prefix) ? $tag : $prefix . ".{$tag}";
             $prop->append($p, (string) $val, $this->_delimiter);
         }
     }
 }
开发者ID:halfer,项目名称:Meshing,代码行数:45,代码来源:XmlPropertyTask.php

示例10: uploadimageAction

 public function uploadimageAction()
 {
     // Where we come from
     $source = $this->_getParam('source');
     // Verify that it is authorized
     if (!in_array($source, array('design', 'profile'))) {
         throw new Stuffpress_Exception("Invalid source specified {$source}");
     }
     // What are we uploading
     $image = $this->_getParam('image');
     $property = "{$image}_image";
     // Was a file uploaded ?
     if (!isset($_FILES['file'])) {
         $this->addErrorMessage('Upload failed: no files received on server end.');
         return $this->_forward('index', $source, 'admin');
     }
     // Validate the uploaded file
     $tmp_file = $_FILES['file']['tmp_name'];
     $file_name = basename($_FILES['file']['name']);
     $file_type = $_FILES['file']['type'];
     $file_ext = substr(trim(substr($file_name, strrpos($file_name, '.')), '.'), 0, 4);
     // returns the ext only
     // Check file size
     if ($_SERVER['CONTENT_LENGTH'] > 2000000) {
         $this->addErrorMessage('Upload failed: your file size is above 2Mbytes.');
         return $this->_forward('index', $source, 'admin');
     }
     // Check file extension
     if (!in_array(strtolower($file_ext), array("gif", "jpg", "png", "jpeg"))) {
         $this->addErrorMessage('Upload failed: we only support jpg, gif and png files.');
         return $this->_forward('index', $source, 'admin');
     }
     // Assign a random name to the file
     $key = Stuffpress_Token::create(32);
     $root = Zend_Registry::get("root");
     $uploaddir = $root . "/upload/";
     $uploadfile = $uploaddir . '/' . $key;
     // Move the file to the upload folder
     if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
         $this->addErrorMessage('Upload failed: your file size is above 2Mbytes.');
         return $this->_forward('index', $source, 'admin');
     }
     // Store the file in the database
     $files = new Files(array(Stuffpress_Db_Table::USER => $this->_application->user->id));
     $file_id = $files->addFile($key, $file_name, "Lifestream custom image", $file_type, $file_ext);
     // Build a thumbnail of the file
     try {
         $files->fitSquare($file_id, 75, 'thumbnails');
     } catch (Exception $e) {
         $message = $e->getMessage();
         $this->addErrorMessage("Upload failed: could not process image ({$message})");
         $files->deleteFile($key);
         return $this->_forward('index', $source, 'admin');
     }
     // Replace the user property with the new file and delete the older one
     $properties = new Properties(array(Properties::KEY => $this->_application->user->id));
     $old_file = $properties->getProperty($property);
     $properties->setProperty($property, $key);
     if ($old_file) {
         $files->deleteFile($old_file);
     }
     // If we are here, everything went smooth
     $this->addStatusMessage('Your file was successfully uploaded');
     return $this->_forward('index', $source, 'admin');
 }
开发者ID:segphault,项目名称:storytlr,代码行数:65,代码来源:FileController.php

示例11: resolveAllProperties

 /**
  * Given a Properties object, this method goes through and resolves
  * any references to properties within the object.
  *
  * @param  Properties $props The collection of Properties that need to be resolved.
  * @throws BuildException
  * @return void
  */
 protected function resolveAllProperties(Properties $props)
 {
     foreach ($props->keys() as $name) {
         // There may be a nice regex/callback way to handle this
         // replacement, but at the moment it is pretty complex, and
         // would probably be a lot uglier to work into a preg_replace_callback()
         // system.  The biggest problem is the fact that a resolution may require
         // multiple passes.
         $value = $props->getProperty($name);
         $resolved = false;
         $resolveStack = array();
         while (!$resolved) {
             $fragments = array();
             $propertyRefs = array();
             // [HL] this was ::parsePropertyString($this->value ...) ... this seems wrong
             self::parsePropertyString($value, $fragments, $propertyRefs);
             $resolved = true;
             if (count($propertyRefs) == 0) {
                 continue;
             }
             $sb = "";
             $j = $propertyRefs;
             foreach ($fragments as $fragment) {
                 if ($fragment !== null) {
                     $sb .= $fragment;
                     continue;
                 }
                 $propertyName = array_shift($j);
                 if (in_array($propertyName, $resolveStack)) {
                     // Should we maybe just log this as an error & move on?
                     // $this->log("Property ".$name." was circularly defined.", Project::MSG_ERR);
                     throw new BuildException("Property " . $propertyName . " was circularly defined.");
                 }
                 $fragment = $this->getProject()->getProperty($propertyName);
                 if ($fragment !== null) {
                     $sb .= $fragment;
                     continue;
                 }
                 if ($props->containsKey($propertyName)) {
                     $fragment = $props->getProperty($propertyName);
                     if (strpos($fragment, '${') !== false) {
                         $resolveStack[] = $propertyName;
                         $resolved = false;
                         // parse again (could have been replaced w/ another var)
                     }
                 } else {
                     $fragment = "\${" . $propertyName . "}";
                 }
                 $sb .= $fragment;
             }
             $this->log("Resolved Property \"{$value}\" to \"{$sb}\"", Project::MSG_DEBUG);
             $value = $sb;
             $props->setProperty($name, $value);
         }
         // while (!$resolved)
     }
     // while (count($keys)
 }
开发者ID:continuousphptest,项目名称:workflow.test,代码行数:66,代码来源:PropertyTask.php

示例12: merge

 static function merge($project, $codeCoverageInformation)
 {
     $coverageDatabase = $project->getProperty('coverage.database');
     if (!$coverageDatabase) {
         throw new BuildException("Property coverage.database is not set - please include coverage-setup in your build file");
     }
     $database = new PhingFile($coverageDatabase);
     $props = new Properties();
     $props->load($database);
     $coverageTotal = $codeCoverageInformation;
     foreach ($coverageTotal as $filename => $data) {
         if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0) {
             $ignoreLines = PHP_CodeCoverage_Util::getLinesToBeIgnored($filename);
         } else {
             // FIXME retrieve ignored lines for PHPUnit Version < 3.5.0
             $ignoreLines = array();
         }
         $lines = array();
         $filename = strtolower($filename);
         if ($props->getProperty($filename) != null) {
             foreach ($data as $_line => $_data) {
                 if (is_array($_data)) {
                     $count = count($_data);
                 } else {
                     if (isset($ignoreLines[$_line])) {
                         // line is marked as ignored
                         $count = 1;
                     } else {
                         if ($_data == -1) {
                             // not executed
                             $count = -1;
                         } else {
                             if ($_data == -2) {
                                 // dead code
                                 $count = -2;
                             }
                         }
                     }
                 }
                 $lines[$_line] = $count;
             }
             ksort($lines);
             $file = unserialize($props->getProperty($filename));
             $left = $file['coverage'];
             $coverageMerged = CoverageMerger::mergeCodeCoverage($left, $lines);
             $file['coverage'] = $coverageMerged;
             $props->setProperty($filename, serialize($file));
         }
     }
     $props->store($database);
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:51,代码来源:CoverageMerger.php

示例13: createDataDbMap

 /**
  * Create the data XML -> database map.
  *
  * This is necessary because there is currently no other method of knowing which
  * data XML files correspond to which database.  This map allows us to convert multiple
  * data XML files into SQL.
  *
  * @throws IOException - if unable to store properties
  */
 private function createDataDbMap()
 {
     if ($this->getDataDbMap() === null) {
         return;
     }
     // Produce the sql -> database map
     $datadbmap = new Properties();
     // Check to see if the sqldbmap has already been created.
     if ($this->getDataDbMap()->exists()) {
         $datadbmap->load($this->getDataDbMap());
     }
     foreach ($this->getDataModels() as $dataModel) {
         // there is really one 1 db per datamodel
         foreach ($dataModel->getDatabases() as $database) {
             // if database name is specified, then we only want to dump that one db.
             if (empty($this->databaseName) || $this->databaseName && $database->getName() == $this->databaseName) {
                 $outFile = $this->getMappedFile($dataModel->getName());
                 $datadbmap->setProperty($outFile->getName(), $database->getName());
             }
         }
     }
     try {
         $datadbmap->store($this->getDataDbMap(), "Data XML file -> Database map");
     } catch (IOException $e) {
         throw new IOException("Unable to store properties: " . $e->getMessage());
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:36,代码来源:PropelDataDumpTask.php

示例14: activarPantalla

 /**
  *
  *
  * @return
  * @access public
  */
 public function activarPantalla($id_pantalla = 2)
 {
     $pantallaActual = new Properties();
     $pantallaActual->load(file_get_contents("./pantallaActiva.properties"));
     $pantallaActual->setProperty("Pantalla.activa", $id_pantalla);
     file_put_contents('./pantallaActiva.properties', $pantallaActual->toString(true));
     // $this->pantalla_activa=$pantalla;
 }
开发者ID:Tknika,项目名称:areto-server,代码行数:14,代码来源:GUI_Menus.php

示例15: main

 function main()
 {
     $files = $this->getFilenames();
     $this->log("Setting up coverage database for " . count($files) . " files");
     $props = new Properties();
     foreach ($files as $file) {
         $fullname = $file['fullname'];
         $filename = $file['key'];
         $props->setProperty($filename, serialize(array('fullname' => $fullname, 'coverage' => array())));
     }
     $dbfile = new PhingFile($this->database);
     $props->store($dbfile);
     $this->project->setProperty('coverage.database', $dbfile->getAbsolutePath());
     foreach ($files as $file) {
         $fullname = $file['fullname'];
         xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
         Phing::__import($fullname, $this->classpath);
         $coverage = xdebug_get_code_coverage();
         xdebug_stop_code_coverage();
         CoverageMerger::merge($this->project, array($coverage));
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:22,代码来源:CoverageSetupTask.php


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