Advertisement
pbowers

Classes/Config.php from UserSpice - return false if no match

Sep 1st, 2016
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2. /*
  3. UserSpice 4
  4. An Open Source PHP User Management System
  5. by the UserSpice Team at http://UserSpice.com
  6.  
  7. This program is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19. */
  20.  
  21. //if you are ever questioning if your classes are being included, uncomment the line above and the words "config included" should show at the top of your page.
  22. class Config {
  23.     public static function get($path = null){
  24.         if($path){
  25.             $config = $GLOBALS['config'];
  26.             $path = explode('/', $path);
  27.  
  28.             foreach ($path as $bit) {
  29.                 if(isset($config[$bit])){
  30.                     $config = $config[$bit];
  31.                 } else {
  32.                     return false;
  33.                 }
  34.             }
  35.  
  36.             return $config;
  37.         }
  38.  
  39.         return false;
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement