File: Logaty/Helpers/Config.php

Recommend this page to a friend!
  Classes of mohammad anzawi  >  PHP Multilingual Support Library  >  Logaty/Helpers/Config.php  >  Download  
File: Logaty/Helpers/Config.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Multilingual Support Library
Translate texts for Web sites from JSON or DB
Author: By
Last change:
Date: 8 days ago
Size: 716 bytes
 

Contents

Class file image Download
<?php

namespace PHPtricks\Logaty\Helpers;
/**
 * Class Config
 */
class Config
{
   
/**
     * get config value from file
     * @param $path
     * @return mixed|null
     */
   
public function get($path)
    {
       
$path = explode(".", $path);
        if( !
is_array($path) ) {
            return
null;
        }
       
// get target config file
        // we store config file in (config/[config-name].php)
        // for example : language direction -> (config/direction.php)
       
if(!file_exists(__DIR__ . "/../../Config/{$path[0]}.php"))
            return
null;

       
$file = include (__DIR__ . "/../../Config/{$path[0]}.php");


        foreach (
$path as $item ) {
            if( isset(
$file[$item]) ) {
               
$file = $file[$item];
            }
        }

        return
$file;
    }
}


For more information send a message to info at phpclasses dot org.