本文整理汇总了PHP中Properties::getProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP Properties::getProperties方法的具体用法?PHP Properties::getProperties怎么用?PHP Properties::getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Properties
的用法示例。
在下文中一共展示了Properties::getProperties方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initPhingProperties
protected function initPhingProperties(Project $project)
{
// Apply all file properties, then all non-file properties
$properties = new Properties();
foreach ($this->fileProps as $key => $value) {
$properties->put($key, $value);
}
foreach ($this->customProps as $key => $value) {
$properties->put($key, $value);
}
// Then swap out placeholder values
foreach ($properties->getProperties() as $key => $value) {
$value = ProjectConfigurator::replaceProperties($project, $value, $properties->getProperties());
$project->setProperty($key, $value);
}
}
示例2: execute
//.........这里部分代码省略.........
$msg = "You must specify a listener class when using the -listener argument";
throw new ConfigurationException($msg);
} else {
$this->listeners[] = $args[++$i];
}
} elseif (StringHelper::startsWith("-D", $arg)) {
// Evaluating the property information //
// Checking whether arg. is not just a switch, and next arg. does not starts with switch identifier
if ('-D' == $arg && !StringHelper::startsWith('-', $args[$i + 1])) {
$name = $args[++$i];
} else {
$name = substr($arg, 2);
}
$value = null;
$posEq = strpos($name, "=");
if ($posEq !== false) {
$value = substr($name, $posEq + 1);
$name = substr($name, 0, $posEq);
} elseif ($i < count($args) - 1 && !StringHelper::startsWith("-D", $args[$i + 1])) {
$value = $args[++$i];
}
self::$definedProps->setProperty($name, $value);
} elseif ($arg == "-logger") {
if (!isset($args[$i + 1])) {
$msg = "You must specify a classname when using the -logger argument";
throw new ConfigurationException($msg);
} else {
$this->loggerClassname = $args[++$i];
}
} elseif ($arg == "-inputhandler") {
if ($this->inputHandlerClassname !== null) {
throw new ConfigurationException("Only one input handler class may be specified.");
}
if (!isset($args[$i + 1])) {
$msg = "You must specify a classname when using the -inputhandler argument";
throw new ConfigurationException($msg);
} else {
$this->inputHandlerClassname = $args[++$i];
}
} elseif ($arg == "-propertyfile") {
if (!isset($args[$i + 1])) {
$msg = "You must specify a filename when using the -propertyfile argument";
throw new ConfigurationException($msg);
} else {
$p = new Properties();
$p->load(new PhingFile($args[++$i]));
foreach ($p->getProperties() as $prop => $value) {
$this->setProperty($prop, $value);
}
}
} elseif ($arg == "-longtargets") {
self::$definedProps->setProperty('phing.showlongtargets', 1);
} elseif ($arg == "-projecthelp" || $arg == "-targets" || $arg == "-list" || $arg == "-l" || $arg == "-p") {
// set the flag to display the targets and quit
$this->projectHelp = true;
} elseif ($arg == "-find") {
// eat up next arg if present, default to build.xml
if ($i < count($args) - 1) {
$this->searchForThis = $args[++$i];
} else {
$this->searchForThis = self::DEFAULT_BUILD_FILENAME;
}
} elseif (substr($arg, 0, 1) == "-") {
// we don't have any more args
self::printUsage();
self::$err->write(PHP_EOL);
throw new ConfigurationException("Unknown argument: " . $arg);
} else {
// if it's no other arg, it may be the target
array_push($this->targets, $arg);
}
}
// if buildFile was not specified on the command line,
if ($this->buildFile === null) {
// but -find then search for it
if ($this->searchForThis !== null) {
$this->buildFile = $this->_findBuildFile(self::getProperty("user.dir"), $this->searchForThis);
} else {
$this->buildFile = new PhingFile(self::DEFAULT_BUILD_FILENAME);
}
}
try {
// make sure buildfile (or buildfile.dist) exists
if (!$this->buildFile->exists()) {
$distFile = new PhingFile($this->buildFile->getAbsolutePath() . ".dist");
if (!$distFile->exists()) {
throw new ConfigurationException("Buildfile: " . $this->buildFile->__toString() . " does not exist!");
}
$this->buildFile = $distFile;
}
// make sure it's not a directory
if ($this->buildFile->isDirectory()) {
throw new ConfigurationException("Buildfile: " . $this->buildFile->__toString() . " is a dir!");
}
} catch (IOException $e) {
// something else happened, buildfile probably not readable
throw new ConfigurationException("Buildfile: " . $this->buildFile->__toString() . " is not readable!");
}
$this->readyToRun = true;
}
示例3: getFilesToExecute
protected function getFilesToExecute()
{
$map = new Properties();
try {
$map->load($this->getSqlDbMap());
} catch (IOException $ioe) {
throw new BuildException("Cannot open and process the sqldbmap!");
}
$databases = array();
foreach ($map->getProperties() as $sqlfile => $database) {
if (!isset($databases[$database])) {
$databases[$database] = array();
}
// We want to make sure that the base schemas
// are inserted first.
if (strpos($sqlfile, "schema.sql") !== false) {
// add to the beginning of the array
array_unshift($databases[$database], $sqlfile);
} else {
// add to the end of the array
array_push($databases[$database], $sqlfile);
}
}
return $databases;
}
示例4: xmlSaveProperties
/**
* Output the properties as xml output.
*
* @param Properties $props the properties to save
* @param OutputStream $os the output stream to write to (Note this gets closed)
*
* @throws BuildException
*/
protected function xmlSaveProperties(Properties $props, OutputStream $os)
{
$doc = new DOMDocument('1.0', 'UTF-8');
$doc->formatOutput = true;
$rootElement = $doc->createElement(self::$PROPERTIES);
$properties = $props->getProperties();
ksort($properties);
foreach ($properties as $key => $value) {
$propElement = $doc->createElement(self::$PROPERTY);
$propElement->setAttribute(self::$ATTR_NAME, $key);
$propElement->setAttribute(self::$ATTR_VALUE, $value);
$rootElement->appendChild($propElement);
}
try {
$doc->appendChild($rootElement);
$os->write($doc->saveXML());
} catch (IOException $ioe) {
throw new BuildException("Unable to write XML file", $ioe);
}
}
示例5: stopRKey
$properties_handle = new Properties();
foreach ($properties_handle->messages as $key => $value) {
echo "<script type='text/javascript'>alert('{$value}');</script>";
}
foreach ($properties_handle->errors as $key => $value) {
echo "<script type='text/javascript'>alert('Error: {$value}');</script>";
}
$html_creator = new HtmlCreator();
$status = $server_handle->getStatus($server_name);
$jar_properties = $server_handle->getProperties();
$jars = $server_handle->getJars();
$jar = $jar_properties['jar'];
$xms = $html_creator->createInput("xms_prop", $jar_properties['xms']);
$xmx = $html_creator->createInput("xmx_prop", $jar_properties['xmx']);
$jar_selector = $html_creator->createSelector($jars, $jar, 'jar_prop', True, 'width:175px');
$properties = $properties_handle->getProperties();
$gamemode = ["0" => "0 - Survival", "1" => "1 - Creative", "2" => "2 - Adventure", "3" => "3 - Spectator"];
$gamemode_selector = $html_creator->createSelector($gamemode, $properties['gamemode'], 'gamemode', False, 'width:175px');
$difficulty = ["0" => "0 - Peaceful", "1" => "1 - Easy", "2" => "2 - Normal", "3" => "3 - Hard"];
$difficulty_selector = $html_creator->createSelector($difficulty, $properties['difficulty'], 'difficulty', False, 'width:175px');
$online = ["true" => "True", "false" => "False"];
$online_selector = $html_creator->createSelector($online, $properties['online-mode'], 'online-mode', False, 'width:175px');
?>
<script type="text/javascript">
function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}