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


PHP wpcf_init_custom_types_taxonomies函数代码示例

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


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

示例1: wpcf_embedded_init

/**
 * Main init hook.
 */
function wpcf_embedded_init()
{
    $locale = get_locale();
    load_textdomain('wpcf', WPCF_EMBEDDED_ABSPATH . '/locale/types-' . $locale . '.mo');
    if (!defined('WPV_VERSION')) {
        load_textdomain('wpv-views', WPCF_EMBEDDED_ABSPATH . '/locale/locale-views/views-' . $locale . '.mo');
    }
    // Define necessary constants if plugin is not present
    if (!defined('WPCF_VERSION')) {
        define('WPCF_VERSION', '1.0.4');
        define('WPCF_META_PREFIX', 'wpcf-');
        define('WPCF_EMBEDDED_RELPATH', icl_get_file_relpath(__FILE__));
    } else {
        define('WPCF_EMBEDDED_RELPATH', WPCF_RELPATH . '/embedded');
    }
    define('WPCF_EMBEDDED_INC_RELPATH', WPCF_EMBEDDED_RELPATH . '/includes');
    define('WPCF_EMBEDDED_RES_RELPATH', WPCF_EMBEDDED_RELPATH . '/resources');
    if (is_admin()) {
        require_once WPCF_EMBEDDED_ABSPATH . '/admin.php';
        wpcf_embedded_admin_init_hook();
    } else {
        require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
    }
    wpcf_init_custom_types_taxonomies();
    if (defined('DOING_AJAX')) {
        require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
    }
    wpcf_embedded_check_import();
}
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:32,代码来源:types.php

示例2: sync

 /**
  * Compare checksums of types and import accordingly
  */
 public function sync()
 {
     $index = array();
     $configs = $this->getConfigs();
     $current = get_option('types-manager-index', array());
     $_POST['overwrite-groups'] = $_POST['overwrite-types'] = $_POST['overwrite-fields'] = $_POST['overwrite-tax'] = 1;
     $import = array();
     foreach ($configs as $export_type => $types) {
         if (empty($types['__key'])) {
             continue;
         }
         $__key = $types['__key'];
         foreach ($types as $id => $data) {
             if ($id == '__key') {
                 continue;
             }
             $index[$export_type][$id] = md5(serialize($data));
             if (!isset($current[$export_type][$id]) || $current[$export_type][$id] != $index[$export_type][$id]) {
                 // Import function checks for this
                 $_POST[$export_type][$id] = array('add' => true, 'update' => true);
                 $import[$export_type]['__key'] = $__key;
                 $import[$export_type][$id] = $data;
             }
         }
     }
     if (count($import)) {
         require_once WPCF_INC_ABSPATH . '/fields.php';
         require_once WPCF_INC_ABSPATH . '/import-export.php';
         $xml = self::toXml($import, 'types');
         foreach ($import as $export_type => $_) {
             wpcf_admin_import_data($xml, false, $export_type);
         }
         wpcf_init_custom_types_taxonomies();
         flush_rewrite_rules();
         update_option('types-manager-index', $index);
     }
     unset($_POST['overwrite-groups'], $_POST['overwrite-types'], $_POST['overwrite-fields'], $_POST['overwrite-tax']);
 }
开发者ID:wemakecustom,项目名称:wp-config-manager,代码行数:41,代码来源:Types.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_embedded_init


//.........这里部分代码省略.........
        require_once WPCF_EMBEDDED_INC_ABSPATH . '/cred.php';
    }
    /*
     *
     *
     * TODO This is a must for now.
     * See if any fields need to be loaded.
     *
     * 1. Checkboxes - may be missing when submitted
     */
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields/checkbox.php';
    /*
     *
     *
     * Use this call to load basic scripts and styles if necesary
     * wpcf_enqueue_scripts();
     */
    require_once WPCF_EMBEDDED_ABSPATH . '/usermeta-init.php';
    // Include frontend or admin code
    if (is_admin()) {
        require_once WPCF_EMBEDDED_ABSPATH . '/admin.php';
        /*
         * TODO Check if called twice
         *
         * Watch this! This is actually called twice everytime
         * in both modes (plugin or embedded)
         */
        wpcf_embedded_admin_init_hook();
    } else {
        require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
    }
    global $wpcf;
    // TODO since Types 1.2 Continue adding new functionalities HERE
    /*
     * Consider code already there as core.
     * Use hooks to add new functionalities
     *
     * Introduced new global object $wpcf
     * Holds useful objects like:
     * $wpcf->field - Field object (base item object)
     * $wpcf->repeater - Repetitive field object
     */
    // Set debugging
    if (!defined('WPCF_DEBUG')) {
        define('WPCF_DEBUG', false);
    } else {
        if (WPCF_DEBUG) {
            wp_enqueue_script('jquery');
        }
    }
    $wpcf->debug = new stdClass();
    require WPCF_EMBEDDED_INC_ABSPATH . '/debug.php';
    add_action('wp_footer', 'wpcf_debug', PHP_INT_MAX);
    add_action('admin_footer', 'wpcf_debug', PHP_INT_MAX);
    // Set field object
    $wpcf->field = new WPCF_Field();
    // Set fields object
    $wpcf->fields = new WPCF_Fields();
    // Set usermeta field object
    $wpcf->usermeta_field = new WPCF_Usermeta_Field();
    // Set repeater object
    $wpcf->usermeta_repeater = new WPCF_Usermeta_Repeater();
    // Set repeater object
    $wpcf->repeater = new WPCF_Repeater();
    // Set relationship object
    $wpcf->relationship = new WPCF_Relationship();
    // Set conditional object
    $wpcf->conditional = new WPCF_Conditional();
    // Set validate object
    $wpcf->validation = new WPCF_Validation();
    // Set import export objects
    $wpcf->import = new WPCF_Import_Export();
    $wpcf->export = new WPCF_Import_Export();
    // Set post object
    $wpcf->post = new stdClass();
    // Set post types object
    $wpcf->post_types = new WPCF_Post_Types();
    // Define exceptions - privileged plugins and their data
    $wpcf->toolset_post_types = array('view', 'view-template', 'cred-form');
    // 'attachment' = Media
    //
    $wpcf->excluded_post_types = array('revision', 'view', 'view-template', 'cred-form', 'nav_menu_item', 'mediapage');
    // Init loader
    WPCF_Loader::init();
    // Init custom types and taxonomies
    wpcf_init_custom_types_taxonomies();
    /*
     * TODO Check why we enabled this
     *
     * I think because of CRED or Views using Types admin functions on frontend
     * Does this need review?
     */
    if (defined('DOING_AJAX')) {
        require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
    }
    // Check if import/export request is going on
    wpcf_embedded_check_import();
    do_action('types_after_init');
    do_action('wpcf_after_init');
}
开发者ID:MiquelAdell,项目名称:miqueladell,代码行数:101,代码来源:bootstrap.php

示例6: wpcf_embedded_init


//.........这里部分代码省略.........
    // Validation
    require_once WPCF_EMBEDDED_ABSPATH . '/classes/validation.php';
    // Post Types
    require_once WPCF_EMBEDDED_ABSPATH . '/classes/class.wpcf-post-types.php';
    // Import Export
    require_once WPCF_EMBEDDED_ABSPATH . '/classes/class.wpcf-import-export.php';
    // Incubator
    require_once WPCF_EMBEDDED_ABSPATH . '/incubator/index.php';
    // Module manager
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/module-manager.php';
    // WPML specific code
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/wpml.php';
    /*
     * 
     * 
     * TODO This is a must for now.
     * See if any fields need to be loaded.
     */
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields/checkbox.php';
    /*
     * 
     * 
     * Use this call to load basic scripts and styles if necesary
     * wpcf_enqueue_scripts();
     */
    // Include frontend or admin code
    if (is_admin()) {
        require_once WPCF_EMBEDDED_ABSPATH . '/admin.php';
        /*
         * TODO Check if called twice
         * 
         * Watch this! This is actually called twice everytime
         * in both modes (plugin or embedded)
         */
        wpcf_embedded_admin_init_hook();
    } else {
        require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
    }
    global $wpcf;
    // TODO since Types 1.2 Continue adding new functionalities HERE
    /*
     * Consider code already there as core.
     * Use hooks to add new functionalities
     * 
     * Introduced new global object $wpcf
     * Holds useful objects like:
     * $wpcf->field - Field object (base item object)
     * $wpcf->repeater - Repetitive field object
     */
    // Set field object
    $wpcf->field = new WPCF_Field();
    // Set fields object
    $wpcf->fields = new WPCF_Fields();
    // Set template object
    $wpcf->template = new WPCF_Template();
    // Set repeater object
    $wpcf->repeater = new WPCF_Repeater();
    // Set relationship object
    $wpcf->relationship = new WPCF_Relationship();
    // Set conditional object
    $wpcf->conditional = new WPCF_Conditional();
    // Set validate object
    $wpcf->validation = new WPCF_Validation();
    // Set import export objects
    $wpcf->import = new WPCF_Import_Export();
    $wpcf->export = new WPCF_Import_Export();
    // Set API object
    $wpcf->api = new WPCF_Api();
    // Set post object
    $wpcf->post = new stdClass();
    // Set post types object
    $wpcf->post_types = new WPCF_Post_Types();
    // Define exceptions - privileged plugins and their data
    $wpcf->toolset_post_types = array('view', 'view-template', 'cred-form');
    $wpcf->excluded_post_types = array('revision', 'view', 'view-template', 'cred-form', 'nav_menu_item', 'attachment', 'mediapage');
    // Init custom types and taxonomies
    wpcf_init_custom_types_taxonomies();
    /*
     * TODO Check why we enabled this
     * 
     * I think because of CRED or Views using Types admin functions on frontend
     * Does this need review?
     */
    if (defined('DOING_AJAX')) {
        require_once WPCF_EMBEDDED_ABSPATH . '/frontend.php';
    }
    // Check if import/export request is going on
    wpcf_embedded_check_import();
    // Set debugging
    if (!defined('WPCF_DEBUG')) {
        define('WPCF_DEBUG', false);
    }
    if (WPCF_DEBUG) {
        $wpcf->debug = new stdClass();
        require WPCF_INC_ABSPATH . '/debug.php';
        add_action('wp_footer', 'wpcf_debug', 1.0E+32);
        add_action('admin_footer', 'wpcf_debug', 9.999999999999999E+28);
    }
    do_action('wpcf_after_init');
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:bootstrap.php

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