Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (10 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Config.php

    r593 r738  
    11<?php
    22
    3 class Config 
     3class Config
    44{
    55  var $Data;
    6  
     6
    77  function __construct()
    88  {
    9         $this->Data = array();
     9    $this->Data = array();
    1010  }
    11  
     11
    1212  function ReadValue($Name)
    1313  {
    14         if(!is_array($Name)) $Name = explode('/', $Name);
    15         $Last = array_pop($Name);
    16         $Data = &$this->Data;
    17         foreach($Name as $Item)
    18         {
    19                 $Data = &$Data[$Item];
    20         }
    21     return($Data[$Last]); 
     14    if(!is_array($Name)) $Name = explode('/', $Name);
     15    $Last = array_pop($Name);
     16    $Data = &$this->Data;
     17    foreach($Name as $Item)
     18    {
     19      $Data = &$Data[$Item];
     20    }
     21    return($Data[$Last]);
    2222  }
    23  
     23
    2424  function WriteValue($Name, $Value)
    2525  {
    26         if(!is_array($Name)) $Name = explode('/', $Name);
    27         $Last = array_pop($Name);
    28         $Data = &$this->Data;
    29         foreach($Name as $Item)
    30         {
    31                 $Data = &$Data[$Item];
    32         }
     26    if(!is_array($Name)) $Name = explode('/', $Name);
     27    $Last = array_pop($Name);
     28    $Data = &$this->Data;
     29    foreach($Name as $Item)
     30    {
     31      $Data = &$Data[$Item];
     32    }
    3333    $Data[$Item] = $Value;
    3434  }
    35  
     35
    3636  function LoadFromFile($FileName)
    3737  {
    38         $ConfigData = array();
     38    $ConfigData = array();
    3939    include $FileName;
    4040    foreach($this->Data as $Index => $Item)
    4141    {
    42         if(array_key_exits($Index, $ConfigData))
     42      if(array_key_exits($Index, $ConfigData))
    4343        $this->Data[$Index] = $ConfigData[$Index];
    4444    }
    45   } 
    46  
     45  }
     46
    4747  function SaveToFile($FileName)
    4848  {
    4949    file_put_contents($FileName, "<?php \n\n\$ConfigData = ".var_export($this->Data, true).";\n");
    5050  }
    51  
     51
    5252  function GetAsArray()
    5353  {
    54         return($this->Data);
     54    return($this->Data);
    5555  }
    5656}
Note: See TracChangeset for help on using the changeset viewer.