Ejemplo n.º 1
0
/**
* Advanced array_merge_recursive()
* http://ru2.php.net/manual/en/function.array-merge-recursive.php
* @param array $arr
* @param array $ins
* @return
* @static
*/
function my_array_merge_recursive($arr, $ins)
{
    if (is_array($arr)) {
        if (is_array($ins)) {
            foreach ($ins as $k => $v) {
                if (isset($arr[$k]) && is_array($v) && is_array($arr[$k])) {
                    $arr[$k] = my_array_merge_recursive($arr[$k], $v);
                } else {
                    $arr[$k] = $v;
                }
            }
        }
    } elseif (!is_array($arr) && (strlen($arr) == 0 || $arr == 0)) {
        $arr = $ins;
    }
    return $arr;
}
Ejemplo n.º 2
0
 /**
  * setTranslator() wrapper
  */
 protected function _loadTranslator()
 {
     // load global conf
     $translate = (require PATH_MY . 'Zx/application/translate/main.php');
     // load project conf (optional)
     $translate_project = @(include '../application/translate/main.php');
     if (!empty($translate_project)) {
         $translate = my_array_merge_recursive($translate, $translate_project);
     }
     if (!empty($translate)) {
         //--< wrong way!
         #$conf = Zend_Registry::get('conf');
         #$translator = new Zend_Translate_Adapter_Array($translate, $conf->translate->locale);//@todo Zend_Locale
         //-->
         // Zend_Locale
         $locale = Zend_Registry::get('Zend_Locale');
         #d($locale);
         $translator = new Zend_Translate_Adapter_Array($translate, $locale);
         #d($translator);
         $this->setTranslator($translator);
     }
 }
Ejemplo n.º 3
0
define('PATH_M', PATH_ROOT . 'application/models/');
define('PATH_V', PATH_ROOT . 'application/views/');
define('PATH_C', PATH_ROOT . 'application/controllers/');
// Базовый URL. Если вы хотите положить сайт в отдельную папку а не в корень виртуального хоста, этот параметр необходимо  изменить на /dir_name/
$baseUrl = '/';
$config_general = array('routes' => true, 'url' => array('base' => $baseUrl, 'public' => $baseUrl . 'public', 'img' => $baseUrl . 'images', 'css' => $baseUrl . 'css'), 'path' => array('root' => $root, 'models' => $root . 'application/models/', 'controllers' => $root . 'application/controllers/', 'controllersCommon' => PATH_MY . 'Zx/application/controllers/', 'views' => $root . 'application/views/', 'viewsCommon' => PATH_MY . 'Zx/application/views/', 'layouts' => $root . 'application/views/layouts/', 'system' => $root . 'application/system/', 'configs' => $root . 'application/configs/', 'settings' => $root . 'application/settings/'), 'common' => array('charset' => 'utf-8'), 'debug' => array('on' => false), 'plugins' => array('Template'), 'support' => array('email' => '*****@*****.**', 'title' => 'Support informproject.info'));
//--< NLS configuration
if (!empty($config_project['load_messages'])) {
    $msg = (require PATH_MY . 'Zx/application/translate/msg_' . $config_project['load_messages'] . '.php');
} else {
    $msg = (require PATH_MY . 'Zx/application/translate/msg_ru.php');
}
$config_general['msg'] = $msg;
//-->
if (empty($config)) {
    $config = my_array_merge_recursive($config_general, $config_project);
}
if (empty($config['site']['admin']['email'])) {
    $config['site']['admin']['title'] = 'Support (' . $config['site']['url'] . ')';
    $config['site']['admin']['email'] = $config['support']['email'];
}
if (!empty($config['site']['url']) && !strpos(ini_get('error_log'), '-php.log')) {
    ini_set('error_log', $root . 'logs/' . $config['site']['url'] . '-php.log');
}
#$paths = implode(PATH_SEPARATOR, array('.', PATH_FW, PATH_MY, $config['path']['controllers'], $config['path']['models'], $config['path']['system']));
#if (defined('PATH_MY')) {$paths .= PATH_SEPARATOR . PATH_MY;}
if (PATH_FW == PATH_MY) {
    set_include_path(implode(PATH_SEPARATOR, array('.', PATH_FW, $config['path']['controllers'], $config['path']['models'], $config['path']['system'])));
} else {
    set_include_path(implode(PATH_SEPARATOR, array('.', PATH_FW, PATH_MY, $config['path']['controllers'], $config['path']['models'], $config['path']['system'])));
}