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


PHP wpcf_admin_bulk_string_translation函数代码示例

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


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

示例1: wpcf_embedded_admin_init_hook

/**
 * admin_init hook.
 */
function wpcf_embedded_admin_init_hook()
{
    // Add callbacks for post edit pages
    add_action('load-post.php', 'wpcf_admin_post_page_load_hook');
    add_action('load-post-new.php', 'wpcf_admin_post_page_load_hook');
    // Add callback for 'media-upload.php'
    add_filter('get_media_item_args', 'wpcf_get_media_item_args_filter');
    // Add save_post callback
    add_action('save_post', 'wpcf_admin_save_post_hook', 10, 2);
    // Render messages
    wpcf_show_admin_messages();
    // Render JS settings
    add_action('admin_head', 'wpcf_admin_render_js_settings');
    // Media insert code
    if (isset($_GET['wpcf-fields-media-insert']) || isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'wpcf-fields-media-insert=1')) {
        require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields/file.php';
        // Add types button
        add_filter('attachment_fields_to_edit', 'wpcf_fields_file_attachment_fields_to_edit_filter', 10, 2);
        // Add JS
        add_action('admin_head', 'wpcf_fields_file_media_admin_head');
        // Filter media TABs
        add_filter('media_upload_tabs', 'wpcf_fields_file_media_upload_tabs_filter');
    }
    register_post_type('wp-types-group', array('public' => false, 'label' => 'Types Groups', 'can_export' => false));
    add_filter('icl_custom_fields_to_be_copied', 'wpcf_custom_fields_to_be_copied', 10, 2);
    // WPML editor filters
    add_filter('icl_editor_cf_name', 'wpcf_icl_editor_cf_name_filter');
    add_filter('icl_editor_cf_description', 'wpcf_icl_editor_cf_description_filter', 10, 2);
    add_filter('icl_editor_cf_style', 'wpcf_icl_editor_cf_style_filter', 10, 2);
    // Initialize translations
    if (function_exists('icl_register_string') && defined('WPML_ST_VERSION') && !get_option('wpcf_strings_translation_initialized', false)) {
        wpcf_admin_bulk_string_translation();
        update_option('wpcf_strings_translation_initialized', 1);
    }
}
开发者ID:sriram911,项目名称:pls,代码行数:38,代码来源:admin.php

示例2: wpcf_embedded_admin_init_hook

/**
 * admin_init hook.
 */
function wpcf_embedded_admin_init_hook()
{
    // Add callbacks for post edit pages
    add_action('load-post.php', 'wpcf_admin_edit_screen_load_hook');
    add_action('load-post-new.php', 'wpcf_admin_edit_screen_load_hook');
    // Meta boxes hook
    add_action('add_meta_boxes', 'wpcf_admin_add_meta_boxes', 10, 2);
    // Add callback for 'media-upload.php'
    add_filter('get_media_item_args', 'wpcf_get_media_item_args_filter');
    // Add save_post callback
    add_action('save_post', 'wpcf_admin_save_post_hook', 10, 2);
    // Add Media callback
    add_action('add_attachment', 'wpcf_admin_save_attachment_hook', 10);
    add_action('add_attachment', 'wpcf_admin_add_attachment_hook', 10);
    add_action('edit_attachment', 'wpcf_admin_save_attachment_hook', 10);
    // Render messages
    wpcf_show_admin_messages();
    // Render JS settings
    add_action('admin_head', 'wpcf_admin_render_js_settings');
    // Media insert code
    if (isset($_GET['context']) && $_GET['context'] == 'wpcf-fields-media-insert' || isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'context=wpcf-fields-media-insert') !== false) {
        require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields/file.php';
        // Add types button
        add_filter('attachment_fields_to_edit', 'wpcf_fields_file_attachment_fields_to_edit_filter', PHP_INT_MAX, 2);
        // Filter media TABs
        add_filter('media_upload_tabs', 'wpcf_fields_file_media_upload_tabs_filter');
    }
    register_post_type(TYPES_CUSTOM_FIELD_GROUP_CPT_NAME, array('public' => false, 'label' => 'Types Groups', 'can_export' => false));
    register_post_type(TYPES_USER_META_FIELD_GROUP_CPT_NAME, array('public' => false, 'label' => 'Types User Groups', 'can_export' => false));
    register_post_type(TYPES_TERM_META_FIELD_GROUP_CPT_NAME, array('public' => false, 'label' => 'Types Term Groups', 'can_export' => false));
    add_filter('icl_custom_fields_to_be_copied', 'wpcf_custom_fields_to_be_copied', 10, 2);
    // WPML editor filters
    add_filter('icl_editor_cf_name', 'wpcf_icl_editor_cf_name_filter');
    add_filter('icl_editor_cf_description', 'wpcf_icl_editor_cf_description_filter', 10, 2);
    add_filter('icl_editor_cf_style', 'wpcf_icl_editor_cf_style_filter', 10, 2);
    // Initialize translations
    if (function_exists('icl_register_string') && defined('WPML_ST_VERSION') && !get_option('wpcf_strings_translation_initialized', false)) {
        wpcf_admin_bulk_string_translation();
        update_option('wpcf_strings_translation_initialized', 1);
    }
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:44,代码来源:admin.php

示例3: wpcf_admin_import_data_from_xmlstring


//.........这里部分代码省略.........
        }
        // Insert types
        foreach ($types as $type_id => $type) {
            if (isset($type['add']) && !$type['add']) {
                continue;
            }
            if (isset($types_existing[$type_id])) {
                /*
                 *
                 * Compare checksum to see if updated
                 */
                $_checksum = $wpcf->import->checksum('custom_post_type', $type_id, $type['checksum']);
                if (!$_checksum) {
                    $result['updated'] += 1;
                }
            } else {
                $result['new'] += 1;
            }
            /*
             * Set type
             */
            unset($type['add'], $type['update'], $type['checksum']);
            $types_existing[$type_id] = $type;
            $types_check[] = $type_id;
        }
        update_option('wpcf-custom-types', $types_existing);
        // Add relationships
        /** EMERSON: Restore Types relationships when importing modules */
        if (!empty($data->post_relationships)) {
            $relationship_existing = get_option('wpcf_post_relationship', array());
            /**
             * be sure, $relationship_existing is a array!
             */
            if (!is_array($relationship_existing)) {
                $relationship_existing = array();
            }
            $relationship = json_decode($data->post_relationships->data, true);
            if (is_array($relationship)) {
                $relationship = array_merge($relationship_existing, $relationship);
                update_option('wpcf_post_relationship', $relationship);
            }
        }
    }
    // Process taxonomies
    if (!empty($data->taxonomies) && 'taxonomies' == $_type) {
        $imported = true;
        $taxonomies_existing = get_option('wpcf-custom-taxonomies', array());
        $taxonomies = array();
        $taxonomies_check = array();
        // Set insert data from XML
        foreach ($data->taxonomies->taxonomy as $taxonomy) {
            // TODO 1.2.1 Remove
            //            $_id = wpcf_modman_get_submitted_id( _TAX_MODULE_MANAGER_KEY_,
            //                    $taxonomy['__types_id'] );
            $_id = strval($taxonomy->__types_id);
            // If Types check if exists in $_POST
            if ($context == 'types' || $context == 'modman') {
                if (!isset($_POST['items']['taxonomies'][$_id])) {
                    continue;
                }
            }
            $taxonomy = wpcf_admin_import_export_simplexml2array($taxonomy);
            $taxonomies[$_id] = $taxonomy;
        }
        // Insert taxonomies
        foreach ($taxonomies as $taxonomy_id => $taxonomy) {
            if (isset($taxonomy['add']) && !$taxonomy['add'] && !$overwrite_tax) {
                continue;
            }
            if (isset($taxonomies_existing[$taxonomy_id])) {
                /*
                 *
                 * Compare checksum to see if updated
                 */
                $_checksum = $wpcf->import->checksum('custom_taxonomy', $taxonomy_id, $taxonomy['checksum']);
                if (!$_checksum) {
                    $result['updated'] += 1;
                }
            } else {
                $result['new'] += 1;
            }
            // Set tax
            unset($taxonomy['add'], $taxonomy['update'], $taxonomy['checksum']);
            $taxonomies_existing[$taxonomy_id] = $taxonomy;
            $taxonomies_check[] = $taxonomy_id;
        }
        update_option('wpcf-custom-taxonomies', $taxonomies_existing);
    }
    if ($imported) {
        // WPML bulk registration
        // TODO WPML move
        if (wpcf_get_settings('register_translations_on_import')) {
            wpcf_admin_bulk_string_translation();
        }
        // Flush rewrite rules
        wpcf_init_custom_types_taxonomies();
        flush_rewrite_rules();
    }
    return $result;
}
开发者ID:MiquelAdell,项目名称:miqueladell,代码行数:101,代码来源:module-manager.php

示例4: wpcf_admin_import_data


//.........这里部分代码省略.........
                unset($types_existing[$type_to_delete]);
            }
        }
    }
    update_option(WPCF_OPTION_NAME_CUSTOM_TYPES, $types_existing);
    // Process taxonomies
    $taxonomies_existing = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
    $taxonomies_check = array();
    if (!empty($data->taxonomies) && isset($data->taxonomies->taxonomy)) {
        $taxonomies = array();
        // Set insert data from XML
        foreach ($data->taxonomies->taxonomy as $taxonomy) {
            $taxonomy = wpcf_admin_import_export_simplexml2array($taxonomy);
            // Set if submitted in 'types' context
            if ($context == 'types') {
                if (isset($_POST['taxonomies'][$taxonomy['id']])) {
                    $taxonomies[$taxonomy['id']] = $taxonomy;
                }
            } else {
                $taxonomies[$taxonomy['id']] = $taxonomy;
            }
        }
        // Set insert data from POST
        if (!empty($_POST['taxonomies'])) {
            foreach ($_POST['taxonomies'] as $taxonomy_id => $taxonomy) {
                if (empty($taxonomies[$taxonomy_id])) {
                    continue;
                }
                $taxonomies[$taxonomy_id]['add'] = !empty($taxonomy['add']);
                $taxonomies[$taxonomy_id]['update'] = isset($taxonomy['update']) && $taxonomy['update'] == 'update' ? true : false;
            }
        }
        // Insert taxonomies
        foreach ($taxonomies as $taxonomy_id => $taxonomy) {
            if (isset($taxonomy['add']) && !$taxonomy['add'] && !$overwrite_tax) {
                continue;
            }
            unset($taxonomy['add'], $taxonomy['update']);
            $taxonomies_existing[$taxonomy_id] = $taxonomy;
            $taxonomies_check[] = $taxonomy_id;
            wpcf_admin_message_store(sprintf(__('Custom taxonomy "%s" added/updated', 'wpcf'), $taxonomy_id));
        }
    }
    /**
     * reset TOOLSET_EDIT_LAST
     */
    if ($data_installer) {
        $data_installer->reset_toolset_edit_last();
    }
    // Delete taxonomies
    if ($delete_tax) {
        foreach ($taxonomies_existing as $k => $v) {
            if (!in_array($k, $taxonomies_check)) {
                unset($taxonomies_existing[$k]);
                wpcf_admin_message_store(sprintf(__('Custom taxonomy "%s" deleted', 'wpcf'), $k));
            }
        }
    } else {
        if (!empty($_POST['taxonomies-to-be-deleted'])) {
            foreach ($_POST['taxonomies-to-be-deleted'] as $taxonomy_to_delete) {
                wpcf_admin_message_store(sprintf(__('Custom taxonomy "%s" deleted', 'wpcf'), $taxonomies_existing[$taxonomy_to_delete]['labels']['name']));
                unset($taxonomies_existing[$taxonomy_to_delete]);
            }
        }
    }
    update_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, $taxonomies_existing);
    // Add relationships
    if (!empty($data->post_relationships) && !empty($_POST['post_relationship'])) {
        $relationship_existing = get_option('wpcf_post_relationship', array());
        /**
         * be sure, $relationship_existing is a array!
         */
        if (!is_array($relationship_existing)) {
            $relationship_existing = array();
        }
        $relationship = json_decode($data->post_relationships->data, true);
        if (is_array($relationship)) {
            $relationship = array_merge($relationship_existing, $relationship);
            update_option('wpcf_post_relationship', $relationship);
            wpcf_admin_message_store(__('Post relationships created', 'wpcf'));
        } else {
            wpcf_admin_message_store(__('Post relationships settings were not imported because it contained unsecured data. You should re-export your Types settings using the latest version of Types', 'wpcf'), 'error');
        }
    }
    // WPML bulk registration
    if (wpcf_get_settings('register_translations_on_import')) {
        wpcf_admin_bulk_string_translation();
    }
    // Flush rewrite rules
    wpcf_init_custom_types_taxonomies();
    flush_rewrite_rules();
    if ($redirect) {
        echo '<script type="text/javascript">
<!--
window.location = "' . admin_url('admin.php?page=wpcf-import-export') . '"
//-->
</script>';
        die;
    }
}
开发者ID:aarongillett,项目名称:B22-151217,代码行数:101,代码来源:import-export.php

示例5: wpcf_admin_import_data


//.........这里部分代码省略.........
                continue;
            }
            unset($type['add'], $type['update']);
            $types_existing[$type_id] = $type;
            $types_check[] = $type_id;
            wpcf_admin_message_store(sprintf(__('Custom post type "%s" added/updated', 'wpcf'), $type_id));
        }
        // Delete types
        if ($delete_types) {
            foreach ($types_existing as $k => $v) {
                if (!in_array($k, $types_check)) {
                    unset($types_existing[$k]);
                    wpcf_admin_message_store(sprintf(__('Custom post type "%s" deleted', 'wpcf'), esc_html($k)));
                }
            }
        } else {
            if (!empty($_POST['types-to-be-deleted'])) {
                foreach ($_POST['types-to-be-deleted'] as $type_to_delete) {
                    wpcf_admin_message_store(sprintf(__('Custom post type "%s" deleted', 'wpcf'), $types_existing[$type_to_delete]['labels']['name']));
                    unset($types_existing[$type_to_delete]);
                }
            }
        }
        update_option('wpcf-custom-types', $types_existing);
    }
    // Process taxonomies
    if (!empty($data->taxonomies)) {
        $taxonomies_existing = get_option('wpcf-custom-taxonomies', array());
        $taxonomies = array();
        $taxonomies_check = array();
        // Set insert data from XML
        foreach ($data->taxonomies->taxonomy as $taxonomy) {
            $taxonomy = wpcf_admin_import_export_simplexml2array($taxonomy);
            $taxonomies[$taxonomy['id']] = $taxonomy;
        }
        // Set insert data from POST
        if (!empty($_POST['taxonomies'])) {
            foreach ($_POST['taxonomies'] as $taxonomy_id => $taxonomy) {
                if (empty($taxonomies[$taxonomy_id])) {
                    continue;
                }
                $taxonomies[$taxonomy_id]['add'] = !empty($taxonomy['add']);
                $taxonomies[$taxonomy_id]['update'] = isset($taxonomy['update']) && $taxonomy['update'] == 'update' ? true : false;
            }
        }
        // Insert taxonomies
        foreach ($taxonomies as $taxonomy_id => $taxonomy) {
            if (isset($taxonomy['add']) && !$taxonomy['add'] && !$overwrite_tax) {
                continue;
            }
            unset($taxonomy['add'], $taxonomy['update']);
            $taxonomies_existing[$taxonomy_id] = $taxonomy;
            $taxonomies_check[] = $taxonomy_id;
            wpcf_admin_message_store(sprintf(__('Custom taxonomy "%s" added/updated', 'wpcf'), $taxonomy_id));
        }
        // Delete taxonomies
        if ($delete_tax) {
            foreach ($taxonomies_existing as $k => $v) {
                if (!in_array($k, $taxonomies_check)) {
                    unset($taxonomies_existing[$k]);
                    wpcf_admin_message_store(sprintf(__('Custom taxonomy "%s" deleted', 'wpcf'), $k));
                }
            }
        } else {
            if (!empty($_POST['taxonomies-to-be-deleted'])) {
                foreach ($_POST['taxonomies-to-be-deleted'] as $taxonomy_to_delete) {
                    wpcf_admin_message_store(sprintf(__('Custom taxonomy "%s" deleted', 'wpcf'), $taxonomies_existing[$taxonomy_to_delete]['labels']['name']));
                    unset($taxonomies_existing[$taxonomy_to_delete]);
                }
            }
        }
        update_option('wpcf-custom-taxonomies', $taxonomies_existing);
    }
    // Add relationships
    if (!empty($data->post_relationships) && !empty($_POST['post_relationship'])) {
        $relationship_existing = get_option('wpcf_post_relationship', array());
        foreach ($data->post_relationships->post_relationship as $relationship) {
            $relationship = unserialize($relationship);
            $relationship = array_merge($relationship_existing, $relationship);
            update_option('wpcf_post_relationship', $relationship);
            wpcf_admin_message_store(__('Post relationships created', 'wpcf'));
            break;
        }
    }
    // WPML bulk registration
    if (wpcf_get_settings('register_translations_on_import')) {
        wpcf_admin_bulk_string_translation();
    }
    // Flush rewrite rules
    wpcf_init_custom_types_taxonomies();
    flush_rewrite_rules();
    if ($redirect) {
        echo '<script type="text/javascript">
<!--
window.location = "' . admin_url('admin.php?page=wpcf-import-export') . '"
//-->
</script>';
        die;
    }
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:101,代码来源:import-export.php


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