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


PHP icl_st_register_user_strings_all函数代码示例

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


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

示例1: icl_st_init

function icl_st_init()
{
    global $sitepress_settings, $sitepress, $wpdb, $icl_st_err_str;
    if ($GLOBALS['pagenow'] === 'site-new.php' && isset($_REQUEST['action']) && 'add-site' === $_REQUEST['action']) {
        return;
    }
    add_action('icl_update_active_languages', 'icl_update_string_status_all');
    add_action('update_option_blogname', 'icl_st_update_blogname_actions', 5, 2);
    add_action('update_option_blogdescription', 'icl_st_update_blogdescription_actions', 5, 2);
    if (isset($_GET['icl_action']) && $_GET['icl_action'] == 'view_string_in_page') {
        icl_st_string_in_page($_GET['string_id']);
        exit;
    }
    if (isset($_GET['icl_action']) && $_GET['icl_action'] == 'view_string_in_source') {
        icl_st_string_in_source($_GET['string_id']);
        exit;
    }
    if (get_magic_quotes_gpc() && isset($_GET['page']) && $_GET['page'] === WPML_ST_FOLDER . '/menu/string-translation.php') {
        $_POST = stripslashes_deep($_POST);
    }
    if (!isset($sitepress_settings['existing_content_language_verified']) || !$sitepress_settings['existing_content_language_verified']) {
        return;
    }
    if (!isset($sitepress_settings['st']['sw'])) {
        $sitepress_settings['st']['sw'] = array();
        //no settings for now
        $sitepress->save_settings($sitepress_settings);
        $init_all = true;
    }
    if (!isset($sitepress_settings['st']['strings_per_page'])) {
        $sitepress_settings['st']['strings_per_page'] = 10;
        $sitepress->save_settings($sitepress_settings);
    } elseif (isset($_GET['strings_per_page']) && $_GET['strings_per_page'] > 0) {
        $sitepress_settings['st']['strings_per_page'] = $_GET['strings_per_page'];
        $sitepress->save_settings($sitepress_settings);
    }
    if (!isset($sitepress_settings['st']['icl_st_auto_reg'])) {
        $sitepress_settings['st']['icl_st_auto_reg'] = 'disable';
        $sitepress->save_settings($sitepress_settings);
    }
    if (empty($sitepress_settings['st']['strings_language'])) {
        $iclsettings['st']['strings_language'] = $sitepress_settings['st']['strings_language'] = 'en';
        $sitepress->save_settings($iclsettings);
    }
    if (!isset($sitepress_settings['st']['translated-users'])) {
        $sitepress_settings['st']['translated-users'] = array();
    }
    if (isset($_POST['iclt_st_sw_save']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_sw_form') || isset($init_all)) {
        if (isset($init_all)) {
            icl_register_string('WP', __('Blog Title', 'wpml-string-translation'), get_option('blogname'));
            icl_register_string('WP', __('Tagline', 'wpml-string-translation'), get_option('blogdescription'));
            __icl_st_init_register_widget_titles();
            // create a list of active widgets
            $active_text_widgets = array();
            $widgets = (array) get_option('sidebars_widgets');
            foreach ($widgets as $k => $w) {
                if ('wp_inactive_widgets' != $k && $k != 'array_version') {
                    if (is_array($widgets[$k])) {
                        foreach ($widgets[$k] as $v) {
                            if (preg_match('#text-([0-9]+)#i', $v, $matches)) {
                                $active_text_widgets[] = $matches[1];
                            }
                        }
                    }
                }
            }
            $widget_text = get_option('widget_text');
            if (is_array($widget_text)) {
                foreach ($widget_text as $k => $w) {
                    if (!empty($w) && isset($w['title']) && in_array($k, $active_text_widgets)) {
                        icl_register_string('Widgets', 'widget body - ' . md5($w['text']), $w['text']);
                    }
                }
            }
        }
        if (isset($_POST['iclt_st_sw_save'])) {
            $updat_string_statuses = false;
            $sitepress_settings['st']['sw'] = $_POST['icl_st_sw'];
            if ($sitepress_settings['st']['strings_language'] != $_POST['icl_st_sw']['strings_language']) {
                $updat_string_statuses = true;
            }
            $sitepress_settings['st']['strings_language'] = $_POST['icl_st_sw']['strings_language'];
            $sitepress->save_settings($sitepress_settings);
            $wpdb->query($wpdb->prepare("UPDATE {$wpdb->prefix}icl_strings SET language=%s WHERE language <> %s", $sitepress_settings['st']['strings_language'], $sitepress_settings['st']['strings_language']));
            if ($updat_string_statuses) {
                icl_update_string_status_all();
            }
            //register author strings
            if (!empty($sitepress_settings['st']['translated-users'])) {
                icl_st_register_user_strings_all();
            }
            wp_redirect(admin_url('admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&updated=true'));
        }
    }
    // handle po file upload
    if (isset($_POST['icl_po_upload']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_po_form')) {
        global $icl_st_po_strings;
        if ($_FILES['icl_po_file']['size'] == 0) {
            $icl_st_err_str = __('File upload error', 'wpml-string-translation');
        } else {
//.........这里部分代码省略.........
开发者ID:edgarter,项目名称:wecare,代码行数:101,代码来源:functions.php

示例2: icl_st_init

function icl_st_init()
{
    global $sitepress_settings, $sitepress, $wpdb, $icl_st_err_str;
    if (isset($_GET['icl_action']) && $_GET['icl_action'] == 'view_string_in_page') {
        icl_st_string_in_page($_GET['string_id']);
        exit;
    }
    if (isset($_GET['icl_action']) && $_GET['icl_action'] == 'view_string_in_source') {
        icl_st_string_in_source($_GET['string_id']);
        exit;
    }
    if (get_magic_quotes_gpc() && isset($_GET['page']) && $_GET['page'] == WPML_ST_FOLDER . '/menu/string-translation.php') {
        $_POST = stripslashes_deep($_POST);
    }
    if (!isset($sitepress_settings['existing_content_language_verified']) || !$sitepress_settings['existing_content_language_verified']) {
        return;
    }
    if (!isset($sitepress_settings['st']['sw'])) {
        $sitepress_settings['st']['sw'] = array();
        //no settings for now
        $sitepress->save_settings($sitepress_settings);
        $init_all = true;
    }
    if (!isset($sitepress_settings['st']['strings_per_page'])) {
        $sitepress_settings['st']['strings_per_page'] = 10;
        $sitepress->save_settings($sitepress_settings);
    } elseif (isset($_GET['strings_per_page']) && $_GET['strings_per_page'] > 0) {
        $sitepress_settings['st']['strings_per_page'] = $_GET['strings_per_page'];
        $sitepress->save_settings($sitepress_settings);
    }
    if (!isset($sitepress_settings['st']['translated-users'])) {
        $sitepress_settings['st']['translated-users'] = array();
    }
    if (isset($_POST['iclt_st_sw_save']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_sw_form') || isset($init_all)) {
        if (isset($init_all)) {
            icl_register_string('WP', __('Blog Title', 'wpml-string-translation'), get_option('blogname'));
            icl_register_string('WP', __('Tagline', 'wpml-string-translation'), get_option('blogdescription'));
            __icl_st_init_register_widget_titles();
            // create a list of active widgets
            $active_text_widgets = array();
            $widgets = (array) get_option('sidebars_widgets');
            foreach ($widgets as $k => $w) {
                if ('wp_inactive_widgets' != $k && $k != 'array_version') {
                    foreach ($widgets[$k] as $v) {
                        if (preg_match('#text-([0-9]+)#i', $v, $matches)) {
                            $active_text_widgets[] = $matches[1];
                        }
                    }
                }
            }
            $widget_text = get_option('widget_text');
            if (is_array($widget_text)) {
                foreach ($widget_text as $k => $w) {
                    if (!empty($w) && isset($w['title']) && in_array($k, $active_text_widgets)) {
                        icl_register_string('Widgets', 'widget body - ' . md5(apply_filters('widget_text', $w['text'])), apply_filters('widget_text', $w['text']));
                    }
                }
            }
        }
        if (isset($_POST['iclt_st_sw_save'])) {
            $updat_string_statuses = false;
            $sitepress_settings['st']['sw'] = $_POST['icl_st_sw'];
            if ($sitepress_settings['st']['strings_language'] != $_POST['icl_st_sw']['strings_language']) {
                $updat_string_statuses = true;
            }
            $sitepress_settings['st']['strings_language'] = $_POST['icl_st_sw']['strings_language'];
            $sitepress->save_settings($sitepress_settings);
            if ($updat_string_statuses) {
                icl_update_string_status_all();
            }
            //register author strings
            if (!empty($sitepress_settings['st']['translated-users'])) {
                icl_st_register_user_strings_all();
            }
            wp_redirect($_SERVER['REQUEST_URI'] . '&updated=true');
        }
    }
    // handle po file upload
    if (isset($_POST['icl_po_upload']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_po_form')) {
        global $icl_st_po_strings;
        if ($_FILES['icl_po_file']['size'] == 0) {
            $icl_st_err_str = __('File upload error', 'wpml-string-translation');
        } else {
            $lines = file($_FILES['icl_po_file']['tmp_name']);
            $icl_st_po_strings = array();
            $fuzzy = 0;
            for ($k = 0; $k < count($lines); $k++) {
                if (0 === strpos($lines[$k], '#, fuzzy')) {
                    $fuzzy = 1;
                    $k++;
                }
                $int = preg_match('#msgid "(.+)"#im', trim($lines[$k]), $matches);
                if ($int) {
                    $string = str_replace('\\"', '"', $matches[1]);
                    $int = preg_match('#msgstr "(.+)"#im', trim($lines[$k + 1]), $matches);
                    if ($int) {
                        $translation = str_replace('\\"', '"', $matches[1]);
                    } else {
                        $translation = "";
                    }
//.........这里部分代码省略.........
开发者ID:envickery,项目名称:staging.xylemwatermark.org,代码行数:101,代码来源:functions.php

示例3: foreach

     break;
 case 'icl_st_track_strings':
     foreach ($_POST['icl_st'] as $k => $v) {
         $iclsettings['st'][$k] = $v;
     }
     if (isset($iclsettings)) {
         $this->save_settings($iclsettings);
     }
     echo 1;
     break;
 case 'icl_st_more_options':
     $iclsettings['st']['translated-users'] = !empty($_POST['users']) ? array_keys($_POST['users']) : array();
     $this->save_settings($iclsettings);
     if (!empty($iclsettings['st']['translated-users'])) {
         $sitepress_settings['st']['translated-users'] = $iclsettings['st']['translated-users'];
         icl_st_register_user_strings_all();
     }
     echo 1;
     break;
 case 'icl_st_ar_form':
     // Auto register string settings.
     $iclsettings['st']['icl_st_auto_reg'] = $_POST['icl_auto_reg_type'];
     $this->save_settings($iclsettings);
     echo 1;
     break;
 case 'affiliate_info_check':
     if ($this->icl_account_configured() && ($iclq = new ICanLocalizeQuery($this->get_setting('site_id'), $this->get_setting('access_key'))) && $iclq->test_affiliate_info($_POST['icl_affiliate_id'], $_POST['icl_affiliate_key'])) {
         $error = array('error' => 0);
     } else {
         $error = array('error' => 1);
     }
开发者ID:PHQ-Design,项目名称:souza-lima,代码行数:31,代码来源:ajax.php

示例4: icl_st_init

function icl_st_init()
{
    global $sitepress_settings, $sitepress, $wpdb, $icl_st_err_str;
    if ($GLOBALS['pagenow'] === 'site-new.php' && isset($_REQUEST['action']) && 'add-site' === $_REQUEST['action']) {
        return;
    }
    add_action('icl_update_active_languages', 'icl_update_string_status_all');
    add_action('update_option_blogname', 'icl_st_update_blogname_actions', 5, 2);
    add_action('update_option_blogdescription', 'icl_st_update_blogdescription_actions', 5, 2);
    if (isset($_GET['icl_action']) && $_GET['icl_action'] == 'view_string_in_page') {
        icl_st_string_in_page($_GET['string_id']);
        exit;
    }
    if (isset($_GET['icl_action']) && $_GET['icl_action'] == 'view_string_in_source') {
        icl_st_string_in_source($_GET['string_id']);
        exit;
    }
    if (get_magic_quotes_gpc() && isset($_GET['page']) && $_GET['page'] === WPML_ST_FOLDER . '/menu/string-translation.php') {
        $_POST = stripslashes_deep($_POST);
    }
    if (!isset($sitepress_settings['existing_content_language_verified']) || !$sitepress_settings['existing_content_language_verified']) {
        return;
    }
    if (!isset($sitepress_settings['st']['sw'])) {
        $sitepress_settings['st']['sw'] = array();
        //no settings for now
        $sitepress->save_settings($sitepress_settings);
        $init_all = true;
    }
    if (!isset($sitepress_settings['st']['strings_per_page'])) {
        $sitepress_settings['st']['strings_per_page'] = 10;
        $sitepress->save_settings($sitepress_settings);
    } elseif (isset($_GET['strings_per_page']) && $_GET['strings_per_page'] > 0) {
        $sitepress_settings['st']['strings_per_page'] = $_GET['strings_per_page'];
        $sitepress->save_settings($sitepress_settings);
    }
    if (!isset($sitepress_settings['st']['icl_st_auto_reg'])) {
        $sitepress_settings['st']['icl_st_auto_reg'] = 'disable';
        $sitepress->save_settings($sitepress_settings);
    }
    if (empty($sitepress_settings['st']['strings_language'])) {
        $iclsettings['st']['strings_language'] = $sitepress_settings['st']['strings_language'] = 'en';
        $sitepress->save_settings($iclsettings);
    }
    if (!isset($sitepress_settings['st']['translated-users'])) {
        $sitepress_settings['st']['translated-users'] = array();
    }
    if (isset($_POST['iclt_st_sw_save']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_sw_form') || isset($init_all)) {
        if (isset($init_all)) {
            global $WPML_String_Translation;
            $WPML_String_Translation->initialize_wp_and_widget_strings();
        }
        if (isset($_POST['iclt_st_sw_save'])) {
            $updat_string_statuses = false;
            $sitepress_settings['st']['sw'] = $_POST['icl_st_sw'];
            if ($sitepress_settings['st']['strings_language'] != $_POST['icl_st_sw']['strings_language']) {
                $updat_string_statuses = true;
            }
            $sitepress_settings['st']['strings_language'] = $_POST['icl_st_sw']['strings_language'];
            $sitepress->save_settings($sitepress_settings);
            $wpdb->query($wpdb->prepare("UPDATE {$wpdb->prefix}icl_strings SET language=%s WHERE language <> %s", $sitepress_settings['st']['strings_language'], $sitepress_settings['st']['strings_language']));
            if ($updat_string_statuses) {
                icl_update_string_status_all();
            }
            //register author strings
            if (!empty($sitepress_settings['st']['translated-users'])) {
                icl_st_register_user_strings_all();
            }
            wp_redirect(admin_url('admin.php?page=' . WPML_ST_FOLDER . '/menu/string-translation.php&updated=true'));
        }
    }
    // handle po file upload
    if (isset($_POST['icl_po_upload']) && wp_verify_nonce($_POST['_wpnonce'], 'icl_po_form')) {
        if ($_FILES['icl_po_file']['size'] == 0) {
            $icl_st_err_str = __('File upload error', 'wpml-string-translation');
        } else {
            global $po_importer;
            require_once WPML_ST_PATH . '/inc/gettext/wpml-po-import.class.php';
            $po_importer = new WPML_PO_Import($_FILES['icl_po_file']['tmp_name']);
            $icl_st_err_str = $po_importer->get_errors();
        }
    } elseif (isset($_POST['action']) && 'icl_st_save_strings' == $_POST['action']) {
        $arr = array_intersect_key($_POST['icl_strings'], array_flip($_POST['icl_strings_selected']));
        //$arr = array_map('html_entity_decode', $arr);
        if (isset($_POST['icl_st_po_language'])) {
            $arr_t = array_intersect_key($_POST['icl_translations'], array_flip($_POST['icl_strings_selected']));
            $arr_f = array_intersect_key($_POST['icl_fuzzy'], array_flip($_POST['icl_strings_selected']));
            //$arr_t = array_map('html_entity_decode', $arr_t);
        }
        $arr_c = array_intersect_key($_POST['icl_context'], array_flip($_POST['icl_strings_selected']));
        foreach ($arr as $k => $string) {
            $string = str_replace('\\n', "\n", $string);
            $name = isset($_POST['icl_name'][$k]) && $_POST['icl_name'][$k] ? $_POST['icl_name'][$k] : md5($string);
            $string_id = icl_register_string(array('domain' => $_POST['icl_st_domain_name'], 'context' => $arr_c[$k]), $name, $string);
            if ($string_id && isset($_POST['icl_st_po_language'])) {
                if ($arr_t[$k] != "") {
                    if ($arr_f[$k]) {
                        $_status = ICL_TM_NOT_TRANSLATED;
                    } else {
                        $_status = ICL_TM_COMPLETE;
//.........这里部分代码省略.........
开发者ID:crazyyy,项目名称:octagram,代码行数:101,代码来源:functions.php


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