PHP Classes

File: inc/classes/Libs/Phptricks_Database/config_function.php

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Multilingual Support Library   inc/classes/Libs/Phptricks_Database/config_function.php   Download  
File: inc/classes/Libs/Phptricks_Database/config_function.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Multilingual Support Library
Translate texts for Web sites from JSON or DB
Author: By
Last change:
Date: 7 years ago
Size: 1,063 bytes
 

Contents

Class file image Download
<?php

/*function config($name = '')
{
    $config = include(dirname(__FILE__) . '/database_config.php');

    if(isset($config[$name]))
        return $config[$name];

    $configValue = isset($config['connections'][$config['default']][$name]) ?
            $config['connections'][$config['default']][$name] : null;
    if($name)
    {
        if(!is_null($configValue))
        {
            return $configValue;
        }
    }

    return $config['default'];
}*/

function DBConfig($path = "")
{
   
$config = include(dirname(__FILE__) . '/database_config.php');
    if(
strpos($path, ".") !== false)
       
$path = explode(".", $path);

    if(
is_array($path) && count($path))
    {
        foreach (
$path as $setting)
        {
            if (isset(
$config[$setting]))
            {
               
$config = $config[$setting];
            }
        }

        return
$config;
    }
    else
    {
        if(isset(
$config[$path]))
            return
$config[$path];

       
$configValue = isset($config['connections'][$config['default']][$path]) ?
           
$config['connections'][$config['default']][$path] : null;
        if(
$path)
        {
            if(!
is_null($configValue))
            {
                return
$configValue;
            }
        }
    }

    return
$config['default'];
}