summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a8e86b7)
raw | patch | inline | side by side (parent: a8e86b7)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Jul 2010 09:17:25 +0000 (09:17 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 27 Jul 2010 09:17:25 +0000 (09:17 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19148 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpOption.inc | patch | blob | history |
diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpOption.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpOption.inc
index 8db57ff545f796d9a2ea74006cf0ba0f87eb4661..d9b3821dd8fab3d049722883a62ccd2ec114f19c 100644 (file)
<?php
- /* This class represents a set of dhcpOptions, which are used over several dhcp plugins.
- * E.g. 'dhcpHost' includes 'dhcpAdvanced', both use the same options.
- * In other words, they use a references to an instance of this class.
- */
+/* This class represents a set of dhcpOptions, which are used over several dhcp plugins.
+ * E.g. 'dhcpHost' includes 'dhcpAdvanced', both use the same options.
+ * In other words, they use a references to an instance of this class.
+ */
class dhcpOption{
- var $options = array();
+ var $options = array();
- function getAll(){
- return($this->options);
- }
-
- function get($name){
- if(isset($this->options[$name])){
- if(count($this->options[$name]) == 0){
- return("");
- }elseif(count($this->options[$name]) == 1){
- return($this->options[$name][0]);
- }else{
- return($this->options[$name]);
- }
- }
- }
-
- function removeAll($name){
- if(isset($this->options[$name])){
- unset($this->options[$name]);
+ function getAll(){
+ return($this->options);
}
- }
- function remove($name,$entry = 0){
- if(!isset($this->options[$name])){
- return;
- }
- if(isset($this->options[$name][$entry])){
- unset($this->options[$name][$entry]);
+ function get($name){
+ if(isset($this->options[$name])){
+ if(count($this->options[$name]) == 0){
+ return("");
+ }elseif(count($this->options[$name]) == 1){
+ return($this->options[$name][0]);
+ }else{
+ return($this->options[$name]);
+ }
+ }
}
- if(count($this->options[$name]) == 0){
- unset($this->options[$name]);
- }else{
- $this->options[$name] = array_unique($this->options[$name]);
- $this->options[$name] = array_values($this->options[$name]);
- }
- }
- function set($name,$value = null){
- if($value == null){
- $value = trim(preg_replace("/^[^ ]*/",'',$name));
- $name = trim(preg_replace("/ .*$/",'',$name));
+ function removeAll($name){
+ if(isset($this->options[$name])){
+ unset($this->options[$name]);
+ }
}
- if(!isset($this->options[$name])){
- $this->options[$name] = array();
+ function remove($name,$entry = 0){
+ if(!isset($this->options[$name])){
+ return;
+ }
+ if(isset($this->options[$name][$entry])){
+ unset($this->options[$name][$entry]);
+ }
+ if(count($this->options[$name]) == 0){
+ unset($this->options[$name]);
+ }else{
+ $this->options[$name] = array_unique($this->options[$name]);
+ $this->options[$name] = array_values($this->options[$name]);
+ }
}
-
- $this->options[$name] = array($value);
- }
- function add($name,$value = null){
- if($value == null){
- $value = trim(preg_replace("/^[^ ]*/",'',$name));
- $name = trim(preg_replace("/ .*$/",'',$name));
+ function set($name,$value = null){
+ if($value == null){
+ $value = trim(preg_replace("/^[^ ]*/",'',$name));
+ $name = trim(preg_replace("/ .*$/",'',$name));
+ }
+
+ if(!isset($this->options[$name])){
+ $this->options[$name] = array();
+ }
+
+ $this->options[$name] = array($value);
}
- if(!isset($this->options[$name])){
- $this->options[$name] = array();
+ function add($name,$value = null){
+ if($value == null){
+ $value = trim(preg_replace("/^[^ ]*/",'',$name));
+ $name = trim(preg_replace("/ .*$/",'',$name));
+ }
+
+ if(!isset($this->options[$name])){
+ $this->options[$name] = array();
+ }
+
+ $this->options[$name][] = $value;
+ $this->options[$name] = array_unique($this->options[$name]);
+ $this->options[$name] = array_values($this->options[$name]);
}
-
- $this->options[$name][] = $value;
- $this->options[$name] = array_unique($this->options[$name]);
- $this->options[$name] = array_values($this->options[$name]);
- }
-
- function save(){
- $res = array();
- foreach($this->options as $key => $values){
- foreach($values as $value){
- $res[] = $key." ".$value;
- }
+
+ function save(){
+ $res = array();
+ foreach($this->options as $key => $values){
+ foreach($values as $value){
+ $res[] = $key." ".$value;
+ }
+ }
+ $res=array_unique($res);
+ return($res);
}
- $res=array_unique($res);
- return($res);
- }
-
- function exists($name){
- if(isset($this->options[$name]) && count($this->options[$name]) == 0){
- return(false);
+
+ function exists($name){
+ if(isset($this->options[$name]) && count($this->options[$name]) == 0){
+ return(false);
+ }
+ return(isset($this->options[$name]));
}
- return(isset($this->options[$name]));
- }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: