本文整理汇总了PHP中Properties::propertyNames方法的典型用法代码示例。如果您正苦于以下问题:PHP Properties::propertyNames方法的具体用法?PHP Properties::propertyNames怎么用?PHP Properties::propertyNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Properties
的用法示例。
在下文中一共展示了Properties::propertyNames方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: current
public function current()
{
Timer::start('iterator::' . get_class($this) . '::current');
$content = $this->get_next_record();
$separator = "**********\n";
//split the file at the separator
$meta = substr($content, 0, strpos($content, $separator));
$source = substr(strstr($content, $separator), strlen($separator));
Logger::info($meta);
$fp = fopen($this->currentArticleFile, "w");
fwrite($fp, $meta);
fclose($fp);
$fp = fopen($this->currentArticleFile, "r");
$p = new Properties();
$p->load($fp);
$meta = array();
$names = $p->propertyNames();
foreach ($names as $key) {
$meta[$key] = $p->getProperty($key);
}
fclose($fp);
$source = html_entity_decode($source);
$fp = fopen($this->currentArticleFile, "w");
fwrite($fp, $source);
fclose($fp);
Timer::stop('iterator::' . get_class($this) . '::current');
//$meta['title'] = urldecode($meta['title']);
$meta['pageTitle'] = urldecode($meta['pageTitle']);
$this->key = $meta['pageTitle'];
// return urldecode($pageID);
return $meta;
}
示例2: init
/** inits the project, called from main app */
public function init()
{
// set builtin properties
$this->setSystemProperties();
// load default tasks
$taskdefs = Phing::getResourcePath("phing/tasks/defaults.properties");
try {
// try to load taskdefs
$props = new Properties();
$in = new PhingFile((string) $taskdefs);
if ($in === null) {
throw new BuildException("Can't load default task list");
}
$props->load($in);
$enum = $props->propertyNames();
foreach ($enum as $key) {
$value = $props->getProperty($key);
$this->addTaskDefinition($key, $value);
}
} catch (IOException $ioe) {
throw new BuildException("Can't load default task list");
}
// load default tasks
$typedefs = Phing::getResourcePath("phing/types/defaults.properties");
try {
// try to load typedefs
$props = new Properties();
$in = new PhingFile((string) $typedefs);
if ($in === null) {
throw new BuildException("Can't load default datatype list");
}
$props->load($in);
$enum = $props->propertyNames();
foreach ($enum as $key) {
$value = $props->getProperty($key);
$this->addDataTypeDefinition($key, $value);
}
} catch (IOException $ioe) {
throw new BuildException("Can't load default datatype list");
}
}
示例3: equals
/**
* Determines if this object contains the exact same property name and value pairs as the given object.
* Part of the java.util.Hashtable API.
*
* @param other Properties object.
* @return boolean
*/
public function equals(Properties $other)
{
$other_names = $other->propertyNames();
$my_names = $this->propertyNames();
if (count($other_names) != count($my_names) || count(array_diff($other_names, $my_names))) {
return false;
}
for ($i = 0; $i < count($my_names); $i++) {
if ($this->getProperty($my_names[$i]) !== $other->getProperty($my_names[$i])) {
return false;
}
}
return true;
}
示例4: getEstadoSistema
public function getEstadoSistema()
{
$status = new status_class();
$status->checkStatus();
$properties = new Properties();
$properties->load(file_get_contents("./sinta.properties"));
$dispositivos = array();
foreach ($properties->propertyNames() as $property) {
$pos = stripos($property, ".");
$disp = substr($property, 0, $pos);
$parent = $properties->getProperty($disp . ".parent");
$parentStatus = $properties->getProperty($parent . ".status");
if (!in_array($disp, $dispositivos) && $properties->getProperty($disp . ".status") == 1 && (empty($parent) || $parentStatus == 0)) {
$dispositivos[] = $disp;
}
}
if (count($dispositivos) == 0) {
return '';
}
$alert_messages = array();
// $dispositivos=array("CamaraPresidencia","CamaraAlumnos1","CamaraAlumnos2","FocoMovil","Dvd","DvdGrabador","GeneradorMultiventanas","MatrizVGA","MatrizVideo","MesaMezclas","Pantalla","PantallaPresidencia","PantallaEntrada","Plasma","ProyectorCentral","ProyectorPizarra","Videoconferencia","VisorOpacos","Luces","Automata");
foreach ($dispositivos as $dispositivo) {
$errorMsg = $properties->getProperty($dispositivo . ".error");
if (empty($errorMsg)) {
$alert_messages[] = "ERROR {$dispositivo}";
} else {
$alert_messages[] = $properties->getProperty($dispositivo . ".error");
}
}
$alert_message = implode("\n", $alert_messages);
echo "ALERT::: " . $alert_message;
$alert_message = str_replace('"', '', $alert_message);
return $alert_message;
}
示例5: main
/** Main entry point */
public function main()
{
if ($this->typeFile === null && ($this->name === null || $this->classname === null)) {
throw new BuildException("You must specify name and class attributes for <taskdef>.");
}
if ($this->typeFile == null) {
$this->log("Task " . $this->name . " will be handled by class " . $this->classname, Project::MSG_VERBOSE);
$this->project->addTaskDefinition($this->name, $this->classname, $this->classpath);
} else {
try {
// try to load taskdefs given in file
$props = new Properties();
$in = new PhingFile((string) $this->typeFile);
if ($in === null) {
throw new BuildException("Can't load task list {$this->typeFile}");
}
$props->load($in);
$enum = $props->propertyNames();
foreach ($enum as $key) {
$value = $props->getProperty($key);
$this->project->addTaskDefinition($key, $value, $this->classpath);
}
} catch (IOException $ioe) {
throw new BuildException("Can't load task list {$this->typeFile}");
}
}
}
示例6: Properties
<?php
include_once './Properties.php';
$cameraStatus = new Properties();
$cameraStatus->load(file_get_contents("./sinta.properties"));
$dispositivos = array();
foreach ($cameraStatus->propertyNames() as $property) {
$pos = stripos($property, ".");
$disp = substr($property, 0, $pos);
if (!in_array($disp, $dispositivos) && $cameraStatus->getProperty($disp . ".check") == 1) {
$dispositivos[] = $disp;
}
}
print_r($dispositivos);
示例7: main
/** Main entry point */
public function main()
{
if ($this->typeFile === null && ($this->name === null || $this->classname === null)) {
throw new BuildException("You must specify name and class attributes for <taskdef>.");
}
if ($this->typeFile !== null) {
try {
// try to load taskdefs given in file
$props = new Properties();
$in = new PhingFile((string) $this->typeFile);
if ($in === null) {
throw new BuildException("Can't load task list {$this->typeFile}");
}
$props->load($in);
$enum = $props->propertyNames();
foreach ($enum as $key) {
$value = $props->getProperty($key);
$this->project->addTaskDefinition($key, $value, $this->classpath);
}
} catch (IOException $ioe) {
throw new BuildException("Can't load task list {$this->typeFile}");
}
return;
}
$this->log("Task {$this->name} will be handled by class {$this->classname}", Project::MSG_VERBOSE);
try {
$this->project->addTaskDefinition($this->name, $this->classname, $this->classpath);
} catch (ConfigurationException $ce) {
/**
* If the class can't be loaded but requiredWithoutComposer = false
* and there isn't a composer autoloader file, we silent it. It
* happens when a phing task is executed in composer pre-install-cmd
*
*
* Handle if the exception should be throwed when...
*
* PHP version is <= 5.2, Composer requires 5.3
*/
if (PHP_MAJOR_VERSION . PHP_MINOR_VERSION <= 52) {
throw new BuildException("Can't load task {$this->name} at {$this->classname}");
} elseif ($this->requiredWithoutComposer) {
/**
* the value for argument requiredWithoutComposer is true (default)
*/
throw new BuildException("Can't load task {$this->name} at {$this->classname}");
} elseif (defined('PHING_COMPOSER_AUTOLOAD_FILE')) {
/**
* It's not mandatory if doesn't exists composer autoloader
* but yes if it exists.
*/
throw new BuildException("Can't autoload task {$this->name} at {$this->classname}. Try with composer update.");
}
unset($ce);
}
}