Advertisement
SirSpamModz

Untitled

Jul 31st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.29 KB | None | 0 0
  1. <?php
  2.  
  3. class Config
  4. {
  5.     /**
  6.     * local_variables
  7.     *
  8.     * An array of all the local variables
  9.     */
  10.     private static $local_variables = array(
  11.         ['name' => 'SQL_USERNAME',        'data' => 'username'],
  12.         ['name' => 'SQL_PASSWORD',        'data' => 'password'],
  13.         ['name' => 'SQL_HOSTNAME',        'data' => 'hostname'],
  14.         ['name' => 'SQL_DATABASE',        'data' => 'database'],
  15.     );
  16.  
  17.  
  18.     /**
  19.     * GetConfig
  20.     *
  21.     * Gets a public config variable
  22.     *
  23.     * @param string $name The name of the config you wish you get.
  24.     */
  25.     public static function GetConfig($name)
  26.     {
  27.         $serverVariable = GetServerVariable($name);
  28.         if($serverVariable !== false) {
  29.             return $serverVariable;
  30.         }
  31.  
  32.         $localVariable = GetLocalVariable($name);
  33.         if($localVariable !== false) {
  34.             return $localVariable;
  35.         }
  36.  
  37.         return false;
  38.     }
  39.  
  40.     /**
  41.     * GetServerVariable
  42.     *
  43.     * Gets a variable that's stored on the sql database.
  44.     *
  45.     * @param string $name The name of the variable you wish to get from the server.
  46.     */
  47.     private static function GetServerVariable($name)
  48.     {
  49.         if(!DoesServerVariableExist($name)) {
  50.             return false;
  51.         }
  52.     }
  53.  
  54.     /**
  55.     * DoesServerVariableExist
  56.     *
  57.     * Checks of a variable exists on the database.
  58.     *
  59.     * @param string $name The name of the variable you wish to lookup.
  60.     */
  61.     private static function DoesServerVariableExist($name)
  62.     {
  63.  
  64.     }
  65.  
  66.     /**
  67.     * GetLocalVariable
  68.     *
  69.     * Gets a variable from local storag.
  70.     *
  71.     * @param string $name The name of the variable you wish to get.
  72.     */
  73.     private static function GetLocalVariable($name)
  74.     {
  75.         if(!DoesLocalVariableExist($name)) {
  76.             return false;
  77.         }
  78.     }
  79.  
  80.     /**
  81.     * DoesLocalVariableExist
  82.     *
  83.     * Checks if a local variable exists
  84.     *
  85.     * @param string $name The name of the variable you wish to lookup.
  86.     */
  87.     private static function DoesLocalVariableExist($name)
  88.     {
  89.         for($i = 0; $i < count($local_variables); $i++) {
  90.             if($local_variables[$i]['name'] === $name) {
  91.                 return true;
  92.             }
  93.         }
  94.  
  95.         return false;
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement