当前位置: 首页>>代码示例>>PHP>>正文


PHP fn_get_rel_dir函数代码示例

本文整理汇总了PHP中fn_get_rel_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_rel_dir函数的具体用法?PHP fn_get_rel_dir怎么用?PHP fn_get_rel_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fn_get_rel_dir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDirCommerceML

 public static function getDirCommerceML()
 {
     self::$path_commerceml = fn_get_files_dir_path() . 'exim/1C_' . date('dmY') . '/';
     self::$url_commerceml = Registry::get('config.http_location') . '/' . fn_get_rel_dir(self::$path_commerceml);
     self::$url_images = Storage::instance('images')->getAbsolutePath('from_1c/');
     return array(self::$path_commerceml, self::$url_commerceml, self::$url_images);
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:7,代码来源:RusEximCommerceml.php

示例2: fn_rus_tovary_mailru_url_auto

function fn_rus_tovary_mailru_url_auto()
{
    $key = Registry::get('addons.rus_tovary_mailru.cron_key');
    $company_id = Registry::get('runtime.simple_ultimate') ? Registry::get('runtime.forced_company_id') : Registry::get('runtime.company_id');
    $url = fn_url('exim.mailru_cron_export?cron_key=' . urlencode($key) . '&switch_company_id=' . $company_id, 'A');
    $text = __('mailru_export_auto_info') . '<br/ >' . $url;
    $text = '<br/ ><br/ >' . __('mailru_export_auto_info_header') . '<br/ ><br/ >' . $text . '<br /><br/ >' . __('mailru_export_auto_info_end') . '<br /><br/ >' . __('mailru_export_auto_info_bottom');
    $file = fn_get_files_dir_path() . Registry::get('addons.rus_tovary_mailru.cron_filename');
    $url_to_file = Registry::get('config.current_location') . '/' . fn_get_rel_dir($file);
    $text .= '<br/ ><br/ >' . __('mailru_export_auto_info_file') . '<br/ >' . $file . '<br/ ><a href =' . $url_to_file . '>' . $url_to_file . '</a>';
    return $text;
}
开发者ID:ambient-lounge,项目名称:site,代码行数:12,代码来源:func.php

示例3: getLangPacksMeta

 /**
  * Gets meta information from the PO file
  *
  * @param  string $base_path Root dir
  * @param  string $pack_file PO file name (without .po extension)
  * @param  bool   $reinstall Use this flag, if pack was alread installed before to get META information
  * @return array  List of lang pack meta information
  */
 public static function getLangPacksMeta($base_path = '', $pack_file = '', $reinstall = false, $check_installed = true)
 {
     $installed_languages = $check_installed ? self::getAll(true) : array();
     $path = empty($base_path) ? Registry::get('config.dir.lang_packs') : $base_path;
     $return = array();
     if (empty($pack_file)) {
         $po_file_list = array();
         foreach (fn_get_dir_contents($path, true, false) as $pack_directory) {
             if (is_dir($path . $pack_directory)) {
                 $po_file_list[] = $pack_directory . '/core.po';
             }
         }
     } else {
         $po_file_list = array($pack_file);
     }
     foreach ($po_file_list as $po_file_name) {
         $po_file_path = $path . $po_file_name;
         if (!file_exists($po_file_path)) {
             fn_set_notification('E', __('error'), __('incorrect_po_pack_structure', array('[pack_path]' => fn_get_rel_dir(dirname($po_file_path)))));
             continue;
         }
         $metadata = Po::getMeta($po_file_path);
         if (is_array($metadata)) {
             if (!self::isValidMeta($metadata)) {
                 fn_set_notification('E', __('error'), __('po_file_is_incorrect', array('[file]' => fn_get_rel_dir($po_file_path))));
                 continue;
             }
         } else {
             fn_set_notification('E', __('error'), $metadata);
             continue;
         }
         if (isset($installed_languages[$metadata['lang_code']]) && !$reinstall) {
             continue;
         }
         $return[] = $metadata;
     }
     if (!empty($pack_file) && !empty($return)) {
         return reset($return);
     }
     return $return;
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:49,代码来源:Languages.php

示例4: fn_get_dir_contents

        }
    }
    // Get export files
    $export_files = fn_get_dir_contents(fn_get_files_dir_path(), false, true);
    $result = array();
    foreach ($export_files as $file) {
        $result[] = array('name' => $file, 'size' => filesize(fn_get_files_dir_path() . $file));
    }
    // Export languages
    foreach (fn_get_translation_languages() as $lang_code => $lang_data) {
        $export_langs[$lang_code] = $lang_data['name'];
    }
    Registry::set('navigation.dynamic.sections', $sections);
    Registry::set('navigation.dynamic.active_section', $_REQUEST['section']);
    Tygh::$app['view']->assign('export_files', $result);
    Tygh::$app['view']->assign('files_rel_dir', fn_get_rel_dir(fn_get_files_dir_path()));
    Tygh::$app['view']->assign('pattern', $patterns[$pattern_id]);
    Tygh::$app['view']->assign('layouts', $layouts);
    Tygh::$app['view']->assign('export_langs', $export_langs);
} elseif ($mode == 'import') {
    if (empty($_REQUEST['section'])) {
        $_REQUEST['section'] = 'products';
    }
    list($sections, $patterns) = fn_get_patterns($_REQUEST['section'], 'import');
    if (empty($sections) && empty($patterns) || isset($_REQUEST['section']) && empty($sections[$_REQUEST['section']])) {
        return array(CONTROLLER_STATUS_DENIED);
    }
    $pattern_id = empty($_REQUEST['pattern_id']) ? key($patterns) : $_REQUEST['pattern_id'];
    foreach ($patterns as $p_id => $p) {
        Registry::set('navigation.tabs.' . $p_id, array('title' => $p['name'], 'href' => "exim.import?pattern_id=" . $p_id . '&section=' . $_REQUEST['section'], 'ajax' => true));
    }
开发者ID:arpad9,项目名称:bygmarket,代码行数:31,代码来源:exim.php

示例5: fn_log_event

function fn_log_event($type, $action, $data = array())
{
    $object_primary_keys = array('users' => 'user_id', 'orders' => 'order_id', 'products' => 'product_id', 'categories' => 'category_id');
    $update = false;
    $content = array();
    $actions = Registry::get('settings.Logging.log_type_' . $type);
    $cut_log = Registry::ifGet('log_cut', false);
    Registry::del('log_cut');
    $cut_data = Registry::ifGet('log_cut_data', false);
    Registry::del('log_cut_data');
    if (empty($actions) || $action && !empty($actions) && empty($actions[$action]) || !empty($cut_log)) {
        return false;
    }
    if (!empty($_SESSION['auth']['user_id'])) {
        $user_id = $_SESSION['auth']['user_id'];
    } else {
        $user_id = 0;
    }
    if ($type == 'users' && $action == 'logout' && !empty($data['user_id'])) {
        $user_id = $data['user_id'];
    }
    if ($user_id) {
        $udata = db_get_row("SELECT firstname, lastname, email FROM ?:users WHERE user_id = ?i", $user_id);
    }
    $event_type = 'N';
    // notice
    if (!empty($data['backtrace'])) {
        $_btrace = array();
        $func = '';
        foreach (array_reverse($data['backtrace']) as $v) {
            if (!empty($v['file'])) {
                $v['file'] = fn_get_rel_dir($v['file']);
            }
            if (empty($v['file'])) {
                $func = $v['function'];
                continue;
            } elseif (!empty($func)) {
                $v['function'] = $func;
                $func = '';
            }
            $_btrace[] = array('file' => !empty($v['file']) ? $v['file'] : '', 'line' => !empty($v['line']) ? $v['line'] : '', 'function' => $v['function']);
        }
        $data['backtrace'] = serialize($_btrace);
    } else {
        $data['backtrace'] = '';
    }
    if ($type == 'general') {
        if ($action == 'deprecated') {
            $content['deprecated_function'] = $data['function'];
        }
        $content['message'] = $data['message'];
    } elseif ($type == 'orders') {
        $order_status_descr = fn_get_simple_statuses(STATUSES_ORDER, true, true);
        $content = array('order' => '# ' . $data['order_id'], 'id' => $data['order_id']);
        if ($action == 'status') {
            $content['status'] = $order_status_descr[$data['status_from']] . ' -> ' . $order_status_descr[$data['status_to']];
        }
    } elseif ($type == 'products') {
        $product = db_get_field("SELECT product FROM ?:product_descriptions WHERE product_id = ?i AND lang_code = ?s", $data['product_id'], Registry::get('settings.Appearance.backend_default_language'));
        $content = array('product' => $product . ' (#' . $data['product_id'] . ')', 'id' => $data['product_id']);
        if ($action == 'low_stock') {
            // log stock - warning
            $event_type = 'W';
        }
    } elseif ($type == 'categories') {
        $category = db_get_field("SELECT category FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s", $data['category_id'], Registry::get('settings.Appearance.backend_default_language'));
        $content = array('category' => $category . ' (#' . $data['category_id'] . ')', 'id' => $data['category_id']);
    } elseif ($type == 'database') {
        if ($action == 'error') {
            $content = array('error' => $data['error']['message'], 'query' => $data['error']['query']);
            $event_type = 'E';
        }
    } elseif ($type == 'requests') {
        if (!empty($cut_data)) {
            $data['data'] = preg_replace("/\\<(" . implode('|', $cut_data) . ")\\>(.*?)\\<\\/(" . implode('|', $cut_data) . ")\\>/s", '<${1}>******</${1}>', $data['data']);
            $data['data'] = preg_replace("/%3C(" . implode('|', $cut_data) . ")%3E(.*?)%3C%2F(" . implode('|', $cut_data) . ")%3E/s", '%3C${1}%3E******%3C%2F${1}%3E', $data['data']);
            $data['data'] = preg_replace("/(" . implode('|', $cut_data) . ")=(.*?)(&)/s", '${1}=******${3}', $data['data']);
        }
        $content = array('url' => $data['url'], 'request' => fn_strlen($data['data']) < LOG_MAX_DATA_LENGTH && preg_match('//u', $data['data']) ? $data['data'] : '', 'response' => fn_strlen($data['response']) < LOG_MAX_DATA_LENGTH && preg_match('//u', $data['response']) ? $data['response'] : '');
    } elseif ($type == 'users') {
        if (!empty($data['time'])) {
            if (empty($_SESSION['log']['login_log_id'])) {
                return false;
            }
            $content = db_get_field('SELECT content FROM ?:logs WHERE log_id = ?i', $_SESSION['log']['login_log_id']);
            $content = unserialize($content);
            $minutes = ceil($data['time'] / 60);
            $hours = floor($minutes / 60);
            if ($hours) {
                $minutes -= $hours * 60;
            }
            if ($hours || $minutes) {
                $content['loggedin_time'] = ($hours ? $hours . ' |hours| ' : '') . ($minutes ? $minutes . ' |minutes|' : '');
            }
            if (!empty($data['timeout']) && $data['timeout']) {
                $content['timeout'] = true;
            }
            $update = $_SESSION['log']['login_log_id'];
        } else {
            if (!empty($data['user_id'])) {
//.........这里部分代码省略.........
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:101,代码来源:fn.log.php

示例6: die

****************************************************************************/
use Tygh\Registry;
use Tygh\Storage;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if (Registry::get('config.demo_mode')) {
    // ElFinder should not work in demo mode
    $message = json_encode(array('error' => __('error_demo_mode')));
    exit($message);
}
include Registry::get('config.dir.root') . '/js/lib/elfinder/connectors/php/elFinder.class.php';
$opts = array('rootAlias' => __('home'), 'tmbDir' => '', 'dirSize' => false, 'fileMode' => DEFAULT_FILE_PERMISSIONS, 'dirMode' => DEFAULT_DIR_PERMISSIONS, 'uploadDeny' => Registry::get('config.forbidden_mime_types'), 'disabled' => array('mkfile', 'rename', 'paste', 'read', 'edit', 'archive', 'extract'));
$company_id = Registry::get('runtime.simple_ultimate') ? Registry::get('runtime.forced_company_id') : Registry::get('runtime.company_id');
if ($mode == 'files') {
    $files_path = fn_get_files_dir_path();
    fn_mkdir($files_path);
    $opts = array('root' => $files_path, 'URL' => Registry::get('config.current_location') . '/' . fn_get_rel_dir($files_path));
    $fm = new \elFinder($opts);
    $fm->run();
} elseif ($mode == 'images') {
    $extra_path = '';
    if (!empty($company_id)) {
        $extra_path .= 'companies/' . $company_id . '/';
    }
    fn_mkdir(Storage::instance('images')->getAbsolutePath($extra_path));
    $opts = array('root' => Storage::instance('images')->getAbsolutePath($extra_path), 'URL' => Storage::instance('images')->getUrl($extra_path));
    $fm = new elFinder($opts);
    $fm->run();
}
exit;
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:elf_connector.php

示例7: getStyleImage

 /**
  * Gets a style preview image
  * @param  string $style_id style ID
  * @return string preview image URL
  */
 public function getStyleImage($style_id)
 {
     $url = '';
     $path = $this->getStyleFile($style_id, 'png');
     if (file_exists($path)) {
         $url = Registry::get('config.current_location') . '/' . fn_get_rel_dir($path);
     }
     return $url;
 }
开发者ID:askzap,项目名称:ask-zap,代码行数:14,代码来源:Styles.php

示例8: fn_get_http_files_dir_path

/**
 * Gets HTTP path user is allowed to put files to
 * @return string files path
 */
function fn_get_http_files_dir_path()
{
    $path = fn_get_rel_dir(fn_get_files_dir_path());
    $path = Registry::get('config.http_location') . '/' . $path;
    return $path;
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:10,代码来源:fn.fs.php

示例9: backupDatabase

 /**
  * Makes DB backup
  *  db_filename - string name of result pack. Will be stored in Registry::get('config.dir.database') . $db_filename;
  *  db_tables - array List of tables to be backuped
  *  db_schema - bool Backup tables schema
  *  db_data - bool Backup data from tables
  * @param array $params
  *
  * @return string Path to backuped DB sql/tgz file
  */
 public static function backupDatabase($params = array())
 {
     $default_params = array('db_tables' => array(), 'db_schema' => false, 'db_data' => false, 'db_compress' => false, 'move_progress' => true);
     $params = array_merge($default_params, $params);
     $db_filename = empty($params['db_filename']) ? 'dump_' . date('mdY') . '.sql' : fn_basename($params['db_filename']);
     if (!fn_mkdir(Registry::get('config.dir.backups'))) {
         fn_set_notification('E', __('error'), __('text_cannot_create_directory', array('[directory]' => fn_get_rel_dir(Registry::get('config.dir.backups')))));
         return false;
     }
     $dump_file = Registry::get('config.dir.backups') . $db_filename;
     if (is_file($dump_file)) {
         if (!is_writable($dump_file)) {
             fn_set_notification('E', __('error'), __('dump_file_not_writable'));
             return false;
         }
     }
     $result = db_export_to_file($dump_file, $params['db_tables'], $params['db_schema'], $params['db_data'], true, true, $params['move_progress']);
     if (!empty($params['db_compress'])) {
         fn_set_progress('echo', __('compress_dump'), false);
         $ext = $params['db_compress'] == 'tgz' ? '.tgz' : '.zip';
         $result = fn_compress_files($db_filename . $ext, $db_filename, dirname($dump_file));
         unlink($dump_file);
         $dump_file .= $ext;
     }
     if ($result) {
         return $dump_file;
     }
     return false;
 }
开发者ID:askzap,项目名称:ultimate,代码行数:39,代码来源:DataKeeper.php

示例10: fn_exim_export_file

function fn_exim_export_file($product_id, $path)
{
    $path = fn_get_files_dir_path() . fn_normalize_path($path);
    $files = db_get_array("SELECT file_path, preview_path, pfolder.folder_id FROM ?:product_files as pfiles" . " LEFT JOIN ?:product_file_folders as pfolder ON pfolder.folder_id = pfiles.folder_id" . " WHERE pfiles.product_id = ?i", $product_id);
    if (!empty($files)) {
        // If backup path is set, check if it exists and copy files there
        if (!empty($path)) {
            if (!fn_mkdir($path)) {
                fn_set_notification('E', __('error'), __('text_cannot_create_directory', array('[directory]' => fn_get_rel_dir($path))));
                return '';
            }
        }
        $_data = array();
        foreach ($files as $file) {
            Storage::instance('downloads')->export($product_id . '/' . $file['file_path'], $path . '/' . $file['file_path']);
            if (!empty($file['preview_path'])) {
                Storage::instance('downloads')->export($product_id . '/' . $file['preview_path'], $path . '/' . $file['preview_path']);
            }
            $file_data = $file['file_path'];
            if (!empty($file['folder_id'])) {
                $file_data = $file['folder_id'] . '/' . $file_data;
            }
            if (!empty($file['preview_path'])) {
                $file_data = $file_data . '#' . $file['preview_path'];
            }
            $_data[] = $file_data;
        }
        return implode(', ', $_data);
    }
    return '';
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:products.functions.php

示例11: fn_te_get_root

/**
 * Gets section root
 * @param string $type path type: full - full path, rel - relative path from root directory, repo - repository path
 * @return string path
 */
function fn_te_get_root($type, $section = 'themes')
{
    if ($section == 'themes') {
        if (fn_allowed_for('MULTIVENDOR') || Registry::get('runtime.company_id')) {
            $extra_path = '[theme]/';
        } else {
            $extra_path = '';
        }
        if ($type == 'full') {
            $path = fn_get_theme_path('[themes]/' . $extra_path, 'C');
        } elseif ($type == 'rel') {
            $path = fn_get_theme_path('/[relative]/' . $extra_path, 'C');
        } elseif ($type == 'repo') {
            $path = fn_get_theme_path('[repo]/' . $extra_path, 'C');
        }
    } elseif ($section == 'files') {
        if ($type == 'full') {
            $path = fn_get_files_dir_path();
            if (!is_dir($path)) {
                fn_mkdir($path);
            }
        } elseif ($type == 'rel') {
            $path = '/' . fn_get_rel_dir(fn_get_files_dir_path());
        }
    } elseif ($section == 'images') {
        if ($type == 'full') {
            $path = Storage::instance('images')->getAbsolutePath('');
        } elseif ($type == 'rel') {
            $path = '/' . fn_get_rel_dir(Storage::instance('images')->getAbsolutePath(''));
        }
    }
    fn_set_hook('te_get_root', $type, $section, $path);
    return $path;
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:39,代码来源:file_editor.php

示例12: getUrl

 /**
  * Gets pattern URL
  * @param  string  $style_id style ID
  * @param  boolean $root     get style root directory if set to true
  * @return string  pattern URL
  */
 public function getUrl($style_id, $root = false)
 {
     $patterns = $this->getPath($style_id);
     $url = Registry::get('config.current_location') . '/' . fn_get_rel_dir($patterns) . '/';
     if ($root == true) {
         $url = str_replace('/' . $this->getRelPath($style_id), '', $url);
     }
     return $url;
 }
开发者ID:askzap,项目名称:ultimate,代码行数:15,代码来源:Patterns.php

示例13: fn_get_dir_contents

    }
    Registry::get('view')->assign('database_size', $database_size);
    Registry::get('view')->assign('all_tables', $all_tables);
    $files = fn_get_dir_contents(Registry::get('config.dir.database'), false, true, array('.sql', '.tgz'), '', true);
    sort($files, SORT_STRING);
    $backup_files = array();
    $date_format = Registry::get('settings.Appearance.date_format') . ' ' . Registry::get('settings.Appearance.time_format');
    if (is_array($files)) {
        foreach ($files as $file) {
            $backup_files[$file]['size'] = filesize(Registry::get('config.dir.database') . $file);
            $backup_files[$file]['type'] = strpos($file, '.tgz') === false ? 'sql' : 'tgz';
            $backup_files[$file]['create'] = fn_date_format(filemtime(Registry::get('config.dir.database') . $file), $date_format);
        }
    }
    Registry::get('view')->assign('backup_files', $backup_files);
    Registry::get('view')->assign('backup_dir', fn_get_rel_dir(Registry::get('config.dir.database')));
} elseif ($mode == 'delete') {
    if (!empty($_REQUEST['backup_file'])) {
        fn_rm(Registry::get('config.dir.database') . fn_basename($_REQUEST['backup_file']));
    }
    return array(CONTROLLER_STATUS_REDIRECT, "database.manage?selected_section=restore");
}
function fn_restore_dump($files)
{
    if (empty($files)) {
        return false;
    }
    fn_set_progress('parts', sizeof($files));
    foreach ($files as $file) {
        $is_archive = false;
        $list = array($file);
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:database.php

示例14: fn_get_file_ext

            $ext = fn_get_file_ext($backup_dir . $file);
            $backup_files[$file]['size'] = filesize($backup_dir . $file);
            $backup_files[$file]['create'] = fn_date_format(filemtime($backup_dir . $file), $date_format);
            if ($ext == 'tgz') {
                $backup_files[$file]['type'] = DataKeeper::BACKUP_TYPE_UNKNOWN;
            } else {
                $backup_files[$file]['type'] = DataKeeper::getBackupType($backup_dir . $file);
            }
            $backup_files[$file]['can_be_restored'] = true;
            if ($ext == 'tgz' && !$validators->isPharDataAvailable()) {
                $backup_files[$file]['can_be_restored'] = false;
                $required_phardata = true;
            }
            if ($ext == 'zip' && !$validators->isZipArchiveAvailable()) {
                $backup_files[$file]['can_be_restored'] = false;
            }
        }
    }
    if ($required_phardata) {
        fn_set_notification('E', __('error'), __('error_class_phar_data_not_found'));
    }
    $backup_create_allowed = true;
    if (!$validators->isZipArchiveAvailable()) {
        $backup_create_allowed = false;
        fn_set_notification('E', __('error'), __('error_unable_to_create_backups'));
        fn_set_notification('E', __('error'), __('error_zip_php_extension_not_installed'));
    }
    /** @var \Tygh\SmartyEngine\Core $view */
    $view = Tygh::$app['view'];
    $view->assign('database_size', $database_size)->assign('all_tables', $all_tables)->assign('backup_create_allowed', $backup_create_allowed)->assign('backup_files', $backup_files)->assign('backup_dir', fn_get_rel_dir(Registry::get('config.dir.backups')));
}
开发者ID:ambient-lounge,项目名称:site,代码行数:31,代码来源:datakeeper.php

示例15: installLanguagePack

 /**
  * Installs new language from PO pack
  *
  * @param string $pack_path Path to PO file
  * @param array  $params
  *  reinstall: Skip adding new language
  *  validate_lang_code:Check meta information (lang_code) with updated language data (lang_code) and forbid to update if does not match
  *  force_lang_code: Skip meta lang code and use this one in all laguage variables
  * @return int Language ID
  */
 public static function installLanguagePack($pack_path, $params = array())
 {
     $default_params = array('reinstall' => false, 'validate_lang_code' => '', 'force_lang_code' => '');
     $params = array_merge($default_params, $params);
     if (!file_exists($pack_path)) {
         fn_set_notification('E', __('error'), __('unable_to_read_resource', array('[file]' => fn_get_rel_dir($pack_path))));
         return false;
     }
     $lang_meta = self::getLangPacksMeta(dirname($pack_path) . '/', basename($pack_path), $params['reinstall']);
     if (!self::isValidMeta($lang_meta)) {
         // Failed to read meta data of new language
         fn_set_notification('E', __('error'), __('check_po_file'));
         return false;
     }
     if (!empty($params['validate_lang_code']) && $lang_meta['lang_code'] != $params['validate_lang_code']) {
         fn_set_notification('E', __('error'), __('po_meta_error_validating_lang_code'));
         return false;
     }
     $lc = false;
     if (!Registry::get('runtime.company_id')) {
         if (!$params['reinstall']) {
             $language_data = array('lang_code' => $lang_meta['lang_code'], 'name' => $lang_meta['name'], 'country_code' => $lang_meta['country_code']);
             $lc = self::update($language_data, 0);
         } else {
             $lc = true;
         }
         if ($lc !== false) {
             fn_save_languages_integrity();
             $query = array();
             $original_values_query = array();
             $iteration = 0;
             $max_vars_in_query = 500;
             if (!empty($params['force_lang_code'])) {
                 $lang_meta['lang_code'] = $params['force_lang_code'];
             }
             $lang_data = Po::getValues($pack_path, 'Languages');
             if (!is_array($lang_data)) {
                 fn_set_notification('E', __('error'), $lang_data);
                 return array();
             }
             foreach ($lang_data as $var_name => $var_data) {
                 if (!empty($var_name)) {
                     $id = $var_data['id'];
                     $value = implode('', $var_data['msgstr']);
                     $original_value = $var_data['msgid'];
                     $value = empty($value) ? $original_value : $value;
                     $query[] = db_quote('(?s, ?s, ?s)', $lang_meta['lang_code'], trim($id), trim($value));
                     $original_values_query[] = db_quote('(?s, ?s)', $var_name, trim($original_value));
                 }
                 if ($iteration > $max_vars_in_query) {
                     self::executeLangQueries('language_values', array('lang_code', 'name', 'value'), $query);
                     self::executeLangQueries('original_values', array('msgctxt', 'msgid'), $original_values_query);
                     $query = array();
                     $iteration = 0;
                 }
                 $iteration++;
             }
             self::executeLangQueries('language_values', array('lang_code', 'name', 'value'), $query);
             self::executeLangQueries('original_values', array('msgctxt', 'msgid'), $original_values_query);
             $settings_sections = Po::getValues($pack_path, 'SettingsSections');
             $query = array();
             $original_values_query = array();
             $iteration = 0;
             foreach ($settings_sections as $var_name => $var_data) {
                 if (!empty($var_name)) {
                     $value = implode('', $var_data['msgstr']);
                     $original_value = $var_data['msgid'];
                     $value = empty($value) ? $original_value : $value;
                     if (!empty($var_data['parent'])) {
                         $parent_id = db_get_field('SELECT section_id FROM ?:settings_sections WHERE name = ?s AND type = ?s', $var_data['parent'], Settings::ADDON_SECTION);
                         $section_id = db_get_field('SELECT section_id FROM ?:settings_sections WHERE name = ?s AND parent_id = ?i', $var_data['id'], $parent_id);
                     } else {
                         $section_id = db_get_field('SELECT section_id FROM ?:settings_sections WHERE name = ?s', $var_data['id']);
                     }
                     if (empty($section_id)) {
                         continue;
                     }
                     $query[] = db_quote('(?i, ?s, ?s, ?s)', $section_id, 'S', $lang_meta['lang_code'], trim($value), trim($original_value));
                     $original_values_query[] = db_quote('(?s, ?s)', trim($var_name), trim($original_value));
                 }
                 if ($iteration > $max_vars_in_query) {
                     self::executeLangQueries('settings_descriptions', array('object_id', 'object_type', 'lang_code', 'value'), $query);
                     self::executeLangQueries('original_values', array('msgctxt', 'msgid'), $original_values_query);
                     $query = array();
                     $iteration = 0;
                 }
                 $iteration++;
             }
             self::executeLangQueries('settings_descriptions', array('object_id', 'object_type', 'lang_code', 'value'), $query);
             self::executeLangQueries('original_values', array('msgctxt', 'msgid'), $original_values_query);
//.........这里部分代码省略.........
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:101,代码来源:Languages.php


注:本文中的fn_get_rel_dir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。