示例#1
0
function qtranxf_init_admin()
{
    global $q_config;
    qtranxf_admin_loadConfig();
    $next_thanks = get_option('qtranslate_next_thanks');
    if ($next_thanks !== false && $next_thanks < time()) {
        $messages = get_option('qtranslate_admin_notices');
        if (isset($messages['next_thanks'])) {
            unset($messages['next_thanks']);
            update_option('qtranslate_admin_notices', $messages);
        }
        $next_thanks = false;
    }
    if ($next_thanks === false) {
        $next_thanks = time() + rand(100, 300) * 24 * 60 * 60;
        update_option('qtranslate_next_thanks', $next_thanks);
    }
    // update Gettext Databases if on back-end
    if ($q_config['auto_update_mo']) {
        require_once dirname(__FILE__) . '/qtx_update_gettext_db.php';
        qtranxf_updateGettextDatabases();
    }
    // update definitions if necessary
    if (current_user_can('manage_categories')) {
        //qtranxf_updateTermLibrary();
        qtranxf_updateTermLibraryJoin();
    }
}
function qtranxf_admin_init()
{
    global $q_config, $pagenow;
    add_action('admin_notices', 'qtranxf_admin_notices_config');
    if (current_user_can('manage_options') && $pagenow == 'options-general.php' && isset($q_config['url_info']['query']) && strpos($q_config['url_info']['query'], 'page=qtranslate-x') !== false) {
        $q_config['url_info']['qtranslate-settings-url'] = admin_url('options-general.php?page=qtranslate-x');
        require_once QTRANSLATE_DIR . '/admin/qtx_admin_options_update.php';
        //call_user_func('qtranxf_editConfig');
        qtranxf_editConfig();
    }
    $next_thanks = get_option('qtranslate_next_thanks');
    if ($next_thanks !== false && $next_thanks < time()) {
        $messages = get_option('qtranslate_admin_notices');
        if (isset($messages['next_thanks'])) {
            unset($messages['next_thanks']);
            update_option('qtranslate_admin_notices', $messages);
        }
        $next_thanks = false;
    }
    if ($next_thanks === false) {
        $next_thanks = time() + rand(100, 300) * 24 * 60 * 60;
        update_option('qtranslate_next_thanks', $next_thanks);
    }
    if ($q_config['auto_update_mo']) {
        qtranxf_updateGettextDatabases();
    }
    // update definitions if necessary
    if (current_user_can('manage_categories')) {
        //qtranxf_updateTermLibrary();
        qtranxf_updateTermLibraryJoin();
        //qtranxf_updateSlug();
    }
}