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


PHP icl_st_scan_theme_files函数代码示例

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


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

示例1: filter_input

         $this->save_settings($iclsettings);
     }
     $filtered_id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT, FILTER_NULL_ON_FAILURE);
     $filtered_from_lang = filter_input(INPUT_POST, 'from_lang', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE);
     $filtered_to_lang = filter_input(INPUT_POST, 'to_lang', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_NULL_ON_FAILURE);
     echo '1|' . intval($filtered_id) . '|' . $this->get_language_status_text($filtered_from_lang, $filtered_to_lang);
     break;
 case 'icl_theme_localization_type':
     $theme_localization_type = @intval($_POST['icl_theme_localization_type']);
     icl_set_setting('theme_localization_type', $theme_localization_type, true);
     $theme_localization_load_td = @intval($_POST['icl_theme_localization_load_td']);
     icl_set_setting('theme_localization_load_textdomain', $theme_localization_load_td, true);
     $filtered_textdomain_value = filter_input(INPUT_POST, 'textdomain_value');
     icl_set_setting('gettext_theme_domain_name', $filtered_textdomain_value, true);
     if ($theme_localization_type == 1) {
         icl_st_scan_theme_files();
     } elseif ($theme_localization_type == 2) {
         $parent_theme = get_template_directory();
         $child_theme = get_stylesheet_directory();
         $languages_folders = array();
         if ($found_folder = icl_tf_determine_mo_folder($parent_theme)) {
             $languages_folders['parent'] = $found_folder;
         }
         if ($parent_theme != $child_theme && ($found_folder = icl_tf_determine_mo_folder($child_theme))) {
             $languages_folders['child'] = $found_folder;
         }
         icl_set_setting('theme_language_folders', $languages_folders, true);
     }
     echo '1|' . $theme_localization_type;
     break;
 case 'icl_ct_user_pref':
开发者ID:PHQ-Design,项目名称:souza-lima,代码行数:31,代码来源:ajax.php

示例2: tl_rescan

 function tl_rescan()
 {
     global $wpdb, $sitepress_settings;
     $scan_stats = icl_st_scan_theme_files();
     if (isset($_POST['icl_load_mo']) && $_POST['icl_load_mo']) {
         $mo_files = icl_st_get_mo_files(TEMPLATEPATH);
         foreach ((array) $mo_files as $m) {
             $i = preg_match('#[-]?([a-z_]+)\\.mo$#i', $m, $matches);
             if ($i && ($lang = $wpdb->get_var("SELECT code FROM {$wpdb->prefix}icl_locale_map WHERE locale='" . $matches[1] . "'"))) {
                 $tr_pairs = icl_st_load_translations_from_mo($m);
                 foreach ($tr_pairs as $original => $translation) {
                     foreach ($sitepress_settings['st']['theme_localization_domains'] as $tld) {
                         $string_id = icl_get_string_id($original, 'theme ' . $tld);
                         if ($string_id) {
                             break;
                         }
                     }
                     if (!$wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_string_translations WHERE string_id=%d AND language=%s", $string_id, $lang))) {
                         icl_add_string_translation($string_id, $lang, $translation, ICL_STRING_TRANSLATION_COMPLETE);
                     }
                 }
             }
         }
     }
     echo '1|' . $scan_stats;
     exit;
 }
开发者ID:Calraiser,项目名称:flux,代码行数:27,代码来源:wpml-string-translation.class.php

示例3: icl_st_scan_theme_files

function icl_st_scan_theme_files($dir = false, $recursion = 0)
{
    require_once ICL_PLUGIN_PATH . '/inc/potx.php';
    static $scan_stats = false;
    static $recursion, $scanned_files = array();
    global $icl_scan_theme_found_domains, $sitepress, $sitepress_settings;
    if ($dir === false) {
        $dir = TEMPLATEPATH;
    }
    if (!$scan_stats) {
        $scan_stats = sprintf(__('Scanning theme folder: %s', 'wpml-string-translation'), $dir) . PHP_EOL;
    }
    $dh = opendir($dir);
    while (false !== ($file = readdir($dh))) {
        if ($file == "." || $file == "..") {
            continue;
        }
        if (is_dir($dir . "/" . $file)) {
            $recursion++;
            $scan_stats .= str_repeat("\t", $recursion) . sprintf(__('Opening folder: %s', 'wpml-string-translation'), $dir . "/" . $file) . PHP_EOL;
            icl_st_scan_theme_files($dir . "/" . $file, $recursion);
            $recursion--;
        } elseif (preg_match('#(\\.php|\\.inc)$#i', $file)) {
            // THE potx way
            $scan_stats .= str_repeat("\t", $recursion) . sprintf(__('Scanning file: %s', 'wpml-string-translation'), $dir . "/" . $file) . PHP_EOL;
            $scanned_files[] = $dir . "/" . $file;
            _potx_process_file($dir . "/" . $file, 0, '__icl_st_scan_theme_files_store_results', '_potx_save_version', POTX_API_7);
        } else {
            $scan_stats .= str_repeat("\t", $recursion) . sprintf(__('Skipping file: %s', 'wpml-string-translation'), $dir . "/" . $file) . PHP_EOL;
        }
    }
    if ($dir == TEMPLATEPATH && TEMPLATEPATH != STYLESHEETPATH) {
        static $double_scan = true;
        icl_st_scan_theme_files(STYLESHEETPATH);
        $double_scan = false;
    }
    if (!$recursion && (empty($double_scan) || !$double_scan)) {
        global $__icl_registered_strings;
        $scan_stats .= __('Done scanning files', 'wpml-string-translation') . PHP_EOL;
        $sitepress_settings['st']['theme_localization_domains'] = array_keys($icl_scan_theme_found_domains);
        $sitepress->save_settings($sitepress_settings);
        closedir($dh);
        $scan_stats_all = __('= Your theme was scanned for texts =', 'wpml-string-translation') . '<br />' . __('The following files were processed:', 'wpml-string-translation') . '<br />' . '<ol style="font-size:10px;"><li>' . join('</li><li>', $scanned_files) . '</li></ol>' . sprintf(__('WPML found %s strings. They were added to the string translation table.', 'wpml-string-translation'), count($__icl_registered_strings)) . '<br /><a href="#" onclick="jQuery(this).next().toggle();return false;">' . __('More details', 'wpml-string-translation') . '</a>' . '<textarea style="display:none;width:100%;height:150px;font-size:10px;">' . $scan_stats . '</textarea>';
        return $scan_stats_all;
    }
}
开发者ID:besimhu,项目名称:LDF-site,代码行数:46,代码来源:functions.php

示例4: icl_translation_send_untranslated_strings

     break;
 case 'icl_st_send_strings_all':
     icl_translation_send_untranslated_strings(explode(',', $_POST['languages']));
     echo '1';
     break;
 case 'icl_save_theme_localization_type':
     $icl_tl_type = (int) $_POST['icl_theme_localization_type'];
     $iclsettings['theme_localization_type'] = $icl_tl_type;
     if ($icl_tl_type == 1) {
         icl_st_scan_theme_files();
     }
     $this->save_settings($iclsettings);
     echo '1|' . $icl_tl_type;
     break;
 case 'icl_tl_rescan':
     $scan_stats = icl_st_scan_theme_files();
     if ($_POST['icl_load_mo']) {
         $mo_files = icl_st_get_mo_files(TEMPLATEPATH);
         foreach ((array) $mo_files as $m) {
             $i = preg_match('#[-]?([a-z_]+)\\.mo$#i', $m, $matches);
             if ($i && ($lang = $wpdb->get_var("SELECT code FROM {$wpdb->prefix}icl_locale_map WHERE locale='" . $matches[1] . "'"))) {
                 $tr_pairs = icl_st_load_translations_from_mo($m);
                 foreach ($tr_pairs as $original => $translation) {
                     foreach ($this->settings['st']['theme_localization_domains'] as $tld) {
                         $string_id = icl_get_string_id($original, 'theme ' . $tld);
                         if ($string_id) {
                             break;
                         }
                     }
                     if (!$wpdb->get_var["SELECT id FROM {$wpdb->prefix}icl_string_translations WHERE string_id={$string_id} AND language='{$lang}'"]) {
                         icl_add_string_translation($string_id, $lang, $translation, ICL_STRING_TRANSLATION_COMPLETE);
开发者ID:winyatasenjaya,项目名称:sitepress-multilingual-cms,代码行数:31,代码来源:ajax.php


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