• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_defer_comment_counting函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: import_start

 /**
  * Parses the XML file and prepares us for the task of processing parsed data
  *
  * @param string $file Path to the WXR file for importing
  */
 function import_start($file)
 {
     if (!is_file($file)) {
         echo '<p><strong>' . __('Sorry, there has been an error.', 'anno') . '</strong><br />';
         echo __('The file does not exist, please try again.', 'anno') . '</p>';
         $this->footer();
         die;
     }
     $import_data = $this->parse($file);
     if (is_wp_error($import_data)) {
         echo '<p><strong>' . __('Sorry, there has been an error.', 'anno') . '</strong><br />';
         echo esc_html($import_data->get_error_message()) . '</p>';
         $this->footer();
         die;
     }
     $this->version = $import_data['version'];
     $this->get_authors_from_import($import_data);
     $this->posts = $import_data['posts'];
     $this->terms = $import_data['terms'];
     $this->categories = $import_data['categories'];
     $this->tags = $import_data['tags'];
     $this->base_url = esc_url($import_data['base_url']);
     wp_defer_term_counting(true);
     wp_defer_comment_counting(true);
     do_action('import_start');
 }
开发者ID:nameofname,项目名称:momo-wordpress-theme,代码行数:31,代码来源:dtd-importer.php


示例2: import_start

 function import_start($file)
 {
     if (!is_file($file)) {
         echo '<p><strong>' . __('Sorry, there has been an error.', 'wordpress-importer') . '</strong><br/>';
         echo __('The file does not exist, please try again.', 'wordpress-importer') . '</p>';
         $this->footer();
         die;
     }
     $import_data = $this->parse($file);
     if (is_wp_error($import_data)) {
         echo '<p><strong>' . __('Sorry, there has been an error.', 'wordpress-importer') . '</strong><br/>';
         echo esc_html($import_data->get_error_message()) . '</p>';
         $this->footer();
         die;
     }
     $this->version = $import_data['version'];
     $this->get_authors_from_import($import_data);
     $this->posts = $import_data['posts'];
     $this->terms = $import_data['terms'];
     $this->categories = $import_data['categories'];
     $this->tags = $import_data['tags'];
     $this->base_url = esc_url($import_data['base_url']);
     // fix for: 'http://localhost/justmarriedmarried' = str_replace('http://localhost/just', 'http://localhost/justmarried', 'http://localhost/justmarried')
     $this->wrong_replace = network_home_url() !== ($wrong_replace = str_replace($this->base_url, network_home_url(), network_home_url())) ? $wrong_replace : false;
     wp_defer_term_counting(true);
     wp_defer_comment_counting(true);
     do_action('import_start');
     // deprecated
     do_action('tf_ext_import_start');
 }
开发者ID:pinchpointer,项目名称:ppsitewordpress,代码行数:30,代码来源:TFUSE_WP_IMPORT.php


示例3: import_end

 function import_end()
 {
     // Switch off importing flag and flush rewrite cache
     wp_defer_term_counting(false);
     wp_defer_comment_counting(true);
     global $wp_rewrite;
     $wp_rewrite->flush_rules();
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:8,代码来源:ti_import.php


示例4: import_end

 /**
  * Performs post-import cleanup of files and the cache
  */
 function import_end()
 {
     wp_import_cleanup($this->id);
     wp_cache_flush();
     foreach (get_taxonomies() as $tax) {
         delete_option("{$tax}_children");
         _get_term_hierarchy($tax);
     }
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     do_action('import_end');
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:15,代码来源:class-dt-dummy-import.php


示例5: import_end

 public function import_end()
 {
     wp_cache_flush();
     foreach (get_taxonomies() as $tax) {
         delete_option("{$tax}_children");
         _get_term_hierarchy($tax);
     }
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     echo '<p>' . __('All done.', 'wordpress-importer') . ' <a href="' . admin_url() . '">' . __('Have fun!', 'wordpress-importer') . '</a>' . '</p>';
     echo '<p>' . __('Remember to update the passwords and roles of imported users.', 'wordpress-importer') . '</p>';
     do_action('import_end');
 }
开发者ID:purgesoftwares,项目名称:purges,代码行数:13,代码来源:class-circleflip-import.php


示例6: import_start

 /**
  * Parses the XML file and prepares us for the task of processing parsed data
  *
  * @param string $file Path to the WXR file for importing
  */
 function import_start($file)
 {
     if (!is_file($file)) {
         echo '<p><strong>' . __('Sorry, there has been an error.', 'anno') . '</strong><br />';
         echo __('The file does not exist, please try again.', 'anno') . '</p>';
         $this->footer();
         die;
     }
     $import_data = $this->parse($file);
     if (is_wp_error($import_data)) {
         echo '<p><strong>' . __('Sorry, there has been an error.', 'anno') . '</strong><br />';
         echo esc_html($import_data->get_error_message()) . '</p>';
         $this->footer();
         die;
     }
     // Validation error likely
     if (isset($import_data['status']) && $import_data['status'] == 'error') {
         echo '<h3>' . __('There were the following errors while trying to validate your XML. Please correct them and try again.', 'anno') . '</h3>';
         foreach ($import_data['errors'] as $error) {
             $error_lines[] = $error['line'];
             echo '<div class="error">' . $error['fullMessage'] . '.</div>';
         }
         $this->output_XML($import_data['content'], $error_lines);
         $this->footer();
         die;
     }
     $this->version = $import_data['version'];
     $this->get_authors_from_import($import_data);
     $this->posts = $import_data['posts'];
     $this->terms = $import_data['terms'];
     $this->categories = $import_data['categories'];
     $this->tags = $import_data['tags'];
     $this->base_url = esc_url($import_data['base_url']);
     wp_defer_term_counting(true);
     wp_defer_comment_counting(true);
     do_action('import_start');
 }
开发者ID:dregula,项目名称:Annotum,代码行数:42,代码来源:dtd-importer.php


示例7: cherry_plugin_import_end

function cherry_plugin_import_end()
{
    wp_cache_flush();
    foreach (get_taxonomies() as $tax) {
        delete_option("{$tax}_children");
        _get_term_hierarchy($tax);
    }
    wp_defer_term_counting(false);
    wp_defer_comment_counting(false);
    update_option('cherry_sample_data', 1);
    cherry_plugin_set_to_draft('hello-world');
    cherry_plugin_set_to_draft('sample-page');
    settings();
    do_action('cherry_plugin_import_end');
    session_name("import_xml");
    session_destroy();
    exit('import_json');
}
开发者ID:drupalninja,项目名称:schome_org,代码行数:18,代码来源:import-functions.php


示例8: import_end

 /**
  * Performs post-import cleanup of files and the cache
  */
 function import_end()
 {
     wp_import_cleanup($this->id);
     wp_cache_flush();
     foreach (get_taxonomies() as $tax) {
         delete_option("{$tax}_children");
         _get_term_hierarchy($tax);
     }
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     echo '<p>' . __('All done.', 'wordpress-importer') . ' <a href="' . admin_url() . '">' . __('Have fun!', 'wordpress-importer') . '</a></p>';
     echo '<p>' . __('Remember to update the passwords and roles of imported users.', 'wordpress-importer') . '</p>';
     do_action('import_end');
     // deprecated
     do_action('tf_ext_import_end', array('version' => @$this->version, 'authors' => @$this->authors, 'posts' => @$this->posts, 'terms' => @$this->terms, 'categories' => @$this->categories, 'tags' => @$this->tags, 'base_url' => @$this->base_url, 'processed_authors' => @$this->processed_authors, 'author_mapping' => @$this->author_mapping, 'processed_terms' => @$this->processed_terms, 'processed_posts' => @$this->processed_posts, 'post_orphans' => @$this->post_orphans, 'processed_menu_items' => @$this->processed_menu_items, 'menu_item_orphans' => @$this->menu_item_orphans, 'missing_menu_items' => @$this->missing_menu_items, 'fetch_attachments' => @$this->fetch_attachments, 'url_remap' => @$this->url_remap, 'featured_images' => @$this->featured_images, 'old_site_url' => @$this->old_site_url, 'new_site_url' => @$this->new_site_url, 'upload_url_old' => @$this->upload_url_old, 'install_url' => @$this->install_url, 'tfuse_options' => @$this->tfuse_options));
 }
开发者ID:pinchpointer,项目名称:ppsitewordpress,代码行数:19,代码来源:wordpress-importer.php


示例9: import_end

 /**
  * Performs post-import cleanup of files and the cache
  */
 public function import_end()
 {
     wp_cache_flush();
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     do_action('import_end');
 }
开发者ID:NerdyDillinger,项目名称:ovrride,代码行数:10,代码来源:class-wc-csv-coupon-import.php


示例10: import_end

 /**
  * Performs post-import cleanup of files and the cache
  */
 function import_end()
 {
     wp_import_cleanup($this->id);
     wp_cache_flush();
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     echo '<p>' . __('Import complete.', 'wc_customer_relationship_manager') . '</p>';
     echo '<p>' . sprintf(_n('%d Customer has been successfully added.', '%d Customers has been successfully added.', $this->row, 'wc_customer_relationship_manager'), $this->row) . '</p>';
     if (!empty($this->groups_added)) {
         echo '<p>' . sprintf(_n('%d Group has been successfully added.', '%d Groups has been successfully added.', count($this->groups_added), 'wc_customer_relationship_manager'), count($this->groups_added)) . ' (' . implode(', ', $this->groups_added) . ')</p>';
     }
     if (!empty($this->statuses_added)) {
         echo '<p>' . sprintf(_n('%d Customer status has been successfully added.', '%d Customer statuses has been successfully added.', count($this->statuses_added), 'wc_customer_relationship_manager'), count($this->statuses_added)) . ' (' . implode(', ', $this->statuses_added) . ')</p>';
     }
     if (!empty($this->not_import)) {
         echo '<p>' . sprintf(_n('%d Customer  was not added.', '%d Customers  was not added.', count($this->not_import), 'wc_customer_relationship_manager'), count($this->not_import)) . '</p>';
         echo '<code>';
         foreach ($this->not_import as $key => $value) {
             echo $value[0] . '<br>';
         }
         echo '</code>';
     }
     do_action('wcrm_import_end');
 }
开发者ID:sajidshah,项目名称:le-dolci,代码行数:27,代码来源:wc_crm_importer.php


示例11: import_end

 /**
  * Performs post-import cleanup of files and the cache
  */
 function import_end()
 {
     wp_import_cleanup($this->id);
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     wp_cache_flush();
     $taxonomies = get_taxonomies();
     foreach ($taxonomies as $tax) {
         delete_option("{$tax}_children");
         _get_term_hierarchy($tax);
         $args = array('hide_empty' => 0, 'fields' => 'ids');
         $terms = get_terms($tax, $args);
         if (is_array($terms) && !empty($terms)) {
             wp_update_term_count_now($terms, $tax);
         }
     }
     do_action('import_end');
 }
开发者ID:fjbeteiligung,项目名称:development,代码行数:21,代码来源:wordpress-importer.php


示例12: import_end

 /**
  * Performs post-import cleanup of files and the cache
  */
 function import_end()
 {
     wp_import_cleanup($this->id);
     wp_cache_flush();
     foreach (get_taxonomies() as $tax) {
         delete_option("{$tax}_children");
         _get_term_hierarchy($tax);
     }
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     echo '<p>' . __('All done.', 'wordpress-importer') . '</p>';
     do_action('import_end');
 }
开发者ID:anthonyeden,项目名称:prso-content-syndication-toolkit-reader,代码行数:16,代码来源:class.importer.php


示例13: enable_comment_counting

 public function enable_comment_counting()
 {
     wp_defer_comment_counting(false);
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:4,代码来源:ActionScheduler_wpCommentLogger.php


示例14: import_end

 /**
  * Performs post-import cleanup of files and the cache
  */
 public function import_end()
 {
     //wp_cache_flush(); Stops output in some hosting environments
     foreach (get_taxonomies() as $tax) {
         delete_option("{$tax}_children");
         _get_term_hierarchy($tax);
     }
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     do_action('import_end');
 }
开发者ID:Brandonsmith23,项目名称:behind,代码行数:14,代码来源:class-wc-pcsvis-product-import.php


示例15: status_changes_convert_questions

 function status_changes_convert_questions($n = 50, $offset = 0)
 {
     global $wpdb;
     wp_defer_comment_counting(true);
     $user_count_result = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->users} ");
     if (0 == $user_count_result) {
         return true;
     }
     // Calculate if this is the last page
     if (0 == $offset) {
         $current_page = 1;
     } else {
         $current_page = intval($offset / $n);
     }
     $total_pages = ceil($user_count_result / $n);
     $users_sql = "SELECT ID FROM {$wpdb->users} ORDER BY ID ASC LIMIT %d OFFSET %d";
     $answers_sql = "SELECT * FROM {$wpdb->comments} WHERE comment_type = 'sensei_user_answer' AND user_id = %d GROUP BY comment_post_ID ";
     $grades_sql = "SELECT comment_post_ID, comment_content FROM {$wpdb->comments} WHERE comment_type = 'sensei_user_grade' AND user_id = %d GROUP BY comment_post_ID ";
     $notes_sql = "SELECT comment_post_ID, comment_content FROM {$wpdb->comments} WHERE comment_type = 'sensei_answer_notes' AND user_id = %d GROUP BY comment_post_ID ";
     $user_ids = $wpdb->get_col($wpdb->prepare($users_sql, $n, $offset));
     foreach ($user_ids as $user_id) {
         $answer_grades = $answer_notes = array();
         // Pre-process the answer grades
         $_answer_grades = $wpdb->get_results($wpdb->prepare($grades_sql, $user_id), ARRAY_A);
         foreach ($_answer_grades as $answer_grade) {
             // This will overwrite existing entries with the newer ones
             $answer_grades[$answer_grade['comment_post_ID']] = $answer_grade['comment_content'];
         }
         unset($_answer_grades);
         // Pre-process the answer notes
         $_answer_notes = $wpdb->get_results($wpdb->prepare($notes_sql, $user_id), ARRAY_A);
         foreach ($_answer_notes as $answer_note) {
             // This will overwrite existing entries with the newer ones
             $answer_notes[$answer_note['comment_post_ID']] = $answer_note['comment_content'];
         }
         unset($_answer_notes);
         // Grab all the questions for the user
         $sql = $wpdb->prepare($answers_sql, $user_id);
         $answers = $wpdb->get_results($sql, ARRAY_A);
         foreach ($answers as $answer) {
             // Excape data
             $answer = wp_slash($answer);
             $comment_ID = $answer['comment_ID'];
             $meta_data = array();
             // Check if the question has been graded, add as meta
             if (!empty($answer_grades[$answer['comment_post_ID']])) {
                 $meta_data['user_grade'] = $answer_grades[$answer['comment_post_ID']];
             }
             // Check if there is an answer note, add as meta
             if (!empty($answer_notes[$answer['comment_post_ID']])) {
                 $meta_data['answer_note'] = $answer_notes[$answer['comment_post_ID']];
             }
             // Wipe the unnessary data from the main comment
             $data = array('comment_author' => '', 'comment_author_email' => '', 'comment_author_url' => '', 'comment_author_IP' => '', 'comment_agent' => '');
             $data = array_merge($answer, $data);
             $rval = $wpdb->update($wpdb->comments, $data, compact('comment_ID'));
             if ($rval) {
                 if (!empty($meta_data)) {
                     foreach ($meta_data as $key => $value) {
                         // Bypassing WP wp_insert_comment( $data ), so no actions/filters are run
                         if ($wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE comment_id = %d AND meta_key = %s ", $comment_ID, $key))) {
                             continue;
                             // Found the meta data already
                         }
                         $result = $wpdb->insert($wpdb->commentmeta, array('comment_id' => $comment_ID, 'meta_key' => $key, 'meta_value' => $value));
                     }
                 }
             }
         }
     }
     $wpdb->flush();
     if ($current_page == $total_pages) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:AlecBeltrami,项目名称:sensei,代码行数:77,代码来源:class-woothemes-sensei-updates.php


示例16: import_cpts

 /**
  * Parses the XML response, deletes existing CPTs, and imports CCB data
  *
  * @param     mixed    $full_response
  * @since     0.9.0
  * @access    protected
  * @return    void
  */
 protected function import_cpts($full_response)
 {
     global $wpdb;
     // temporarily disable counting for performance
     wp_defer_term_counting(true);
     wp_defer_comment_counting(true);
     // temporarily disable autocommit
     $wpdb->query('SET autocommit = 0;');
     // GROUP PROFILES
     if ($this->enabled_apis['group_profiles'] == true && isset($full_response['group_profiles']->response->groups->group) && !empty($full_response['group_profiles']->response->groups->group)) {
         $groups_taxonomy_map = CCB_Core_CPTs::get_groups_taxonomy_map();
         $groups_custom_fields_map = CCB_Core_CPTs::get_groups_custom_fields_map();
         // delete the existing taxonomy terms
         foreach ($groups_taxonomy_map as $taxonomy_name => $taxonomy) {
             $terms = get_terms($taxonomy_name, array('fields' => 'ids', 'hide_empty' => false));
             if (!empty($terms)) {
                 foreach ($terms as $term_value) {
                     wp_delete_term($term_value, $taxonomy_name);
                 }
             }
         }
         // delete existing custom posts
         $custom_posts = get_posts(array('post_type' => $this->plugin_name . '-groups', 'posts_per_page' => -1));
         foreach ($custom_posts as $custom_post) {
             wp_delete_post($custom_post->ID, true);
         }
         // commit the deletes now
         $wpdb->query('COMMIT;');
         foreach ($full_response['group_profiles']->response->groups->group as $group) {
             // only allow publicly listed and active groups to be imported
             if ($group->inactive == 'false' && $group->public_search_listed == 'true') {
                 $group_id = 0;
                 foreach ($group->attributes() as $key => $value) {
                     if ($key == 'id') {
                         $group_id = (int) $value;
                         break;
                     }
                 }
                 // insert group post
                 $group_post_atts = array('post_title' => $group->name, 'post_name' => $group->name, 'post_content' => $group->description, 'post_status' => 'publish', 'post_type' => $this->plugin_name . '-groups');
                 $post_id = wp_insert_post($group_post_atts);
                 // insert hierarchial taxonomy values (categories) and non-hierarchial taxonomy values (tags)
                 $taxonomy_atts = $this->get_taxonomy_atts($group, $groups_taxonomy_map);
                 if (!empty($taxonomy_atts)) {
                     foreach ($taxonomy_atts as $taxonomy_attribute) {
                         wp_set_post_terms($post_id, $taxonomy_attribute['terms'], $taxonomy_attribute['taxonomy'], true);
                     }
                 }
                 // insert custom fields
                 $custom_fields_atts = $this->get_custom_fields_atts($group, $groups_custom_fields_map);
                 if (!empty($custom_fields_atts)) {
                     foreach ($custom_fields_atts as $custom_fields_attribute) {
                         add_post_meta($post_id, $custom_fields_attribute['field_name'], $custom_fields_attribute['field_value']);
                     }
                 }
             }
         }
         // commit the inserts now
         $wpdb->query('COMMIT;');
     }
     // PUBLIC CALENDAR LISTING
     if ($this->enabled_apis['public_calendar_listing'] == true && isset($full_response['public_calendar_listing']->response->items->item) && !empty($full_response['public_calendar_listing']->response->items->item)) {
         $calendar_taxonomy_map = CCB_Core_CPTs::get_calendar_taxonomy_map();
         $calendar_custom_fields_map = CCB_Core_CPTs::get_calendar_custom_fields_map();
         // delete the existing taxonomy terms
         foreach ($calendar_taxonomy_map as $taxonomy_name => $taxonomy) {
             $terms = get_terms($taxonomy_name, array('fields' => 'ids', 'hide_empty' => false));
             if (!empty($terms)) {
                 foreach ($terms as $term_value) {
                     wp_delete_term($term_value, $taxonomy_name);
                 }
             }
         }
         // delete existing custom posts
         $custom_posts = get_posts(array('post_type' => $this->plugin_name . '-calendar', 'posts_per_page' => -1));
         foreach ($custom_posts as $custom_post) {
             wp_delete_post($custom_post->ID, true);
         }
         // commit the deletes now
         $wpdb->query('COMMIT;');
         foreach ($full_response['public_calendar_listing']->response->items->item as $event) {
             // insert event post
             $event_post_atts = array('post_title' => $event->event_name, 'post_name' => $event->event_name, 'post_content' => $event->event_description, 'post_status' => 'publish', 'post_type' => $this->plugin_name . '-calendar');
             $post_id = wp_insert_post($event_post_atts);
             // insert hierarchial taxonomy values (categories) and non-hierarchial taxonomy values (tags)
             $taxonomy_atts = $this->get_taxonomy_atts($event, $calendar_taxonomy_map);
             if (!empty($taxonomy_atts)) {
                 foreach ($taxonomy_atts as $taxonomy_attribute) {
                     wp_set_post_terms($post_id, $taxonomy_attribute['terms'], $taxonomy_attribute['taxonomy'], true);
                 }
             }
             // insert custom fields
//.........这里部分代码省略.........
开发者ID:Ravenna,项目名称:ccb-core,代码行数:101,代码来源:class-ccb-core-sync.php


示例17: import_end

        /**
         * Performs post-import cleanup of files and the cache
         */
        function import_end()
        {
            wp_import_cleanup($this->id);
            wp_cache_flush();
            foreach (get_taxonomies() as $tax) {
                delete_option("{$tax}_children");
                _get_term_hierarchy($tax);
            }
            wp_defer_term_counting(false);
            wp_defer_comment_counting(false);
            echo '<p>' . __('All done.', 'wordpress-importer') . ' <a href="' . admin_url() . '">' . __('Have fun!', 'wordpress-importer') . '</a>' . '</p>';
            echo '<p>' . __('Remember to update the passwords and roles of imported users.', 'wordpress-importer') . '</p>';
            if ($this->one_click) {
                $main_menu = get_term_by('slug', 'main-menu', 'nav_menu');
                $top_menu = get_term_by('slug', 'top-menu', 'nav_menu');
                $footer_menu = get_term_by('slug', 'menu-footer', 'nav_menu');
                $menu_locations = get_theme_mod('nav_menu_locations');
                if ($main_menu) {
                    $menu_locations['menu-header'] = $main_menu->term_id;
                }
                if ($top_menu) {
                    $menu_locations['menu-top'] = $top_menu->term_id;
                }
                if ($footer_menu) {
                    $menu_locations['menu-footer'] = $footer_menu->term_id;
                }
                set_theme_mod('nav_menu_locations', $menu_locations);
                if ($this->front_page) {
                    update_option('page_on_front', $this->processed_posts[intval($this->front_page)]);
                    update_option('show_on_front', 'page');
                }
                $quick_setup = admin_url('admin.php?page=wpv_import');
                echo <<<REDIRECT
\t\t\t<script>
\t\t\t\t/*<![CDATA[*/
\t\t\t\tsetTimeout(function() {
\t\t\t\t\twindow.location = '{$quick_setup}';
\t\t\t\t}, 3000);
\t\t\t\t/*]]>*/
\t\t\t</script>
REDIRECT;
            }
            do_action('import_end');
        }
开发者ID:amitmula,项目名称:amitandaastha.in,代码行数:47,代码来源:importer.php


示例18: import

 /**
  * Import the PHPDoc $data into WordPress posts and taxonomies
  *
  * @param array $data
  * @param bool  $skip_sleep               Optional; defaults to false. If true, the sleep() calls are skipped.
  * @param bool  $import_ignored_functions Optional; defaults to false. If true, functions marked `@ignore` will be imported.
  */
 public function import(array $data, $skip_sleep = false, $import_ignored_functions = false)
 {
     global $wpdb;
     $time_start = microtime(true);
     $num_queries = $wpdb->num_queries;
     $this->logger->info('Starting import. This will take some time…');
     $file_number = 1;
     $num_of_files = count($data);
     do_action('wp_parser_starting_import');
     // Defer term counting for performance
     wp_suspend_cache_invalidation(true);
     wp_defer_term_counting(true);
     wp_defer_comment_counting(true);
     // Remove actions for performance
     remove_action('transition_post_status', '_update_blog_date_on_post_publish', 10);
     remove_action('transition_post_status', '__clear_multi_author_cache', 10);
     delete_option('wp_parser_imported_wp_version');
     delete_option('wp_parser_root_import_dir');
     // Sanity check -- do the required post types exist?
     if (!post_type_exists($this->post_type_class) || !post_type_exists($this->post_type_function) || !post_type_exists($this->post_type_hook)) {
         $this->logger->error(sprintf('Missing post type; check that "%1$s", "%2$s", and "%3$s" are registered.', $this->post_type_class, $this->post_type_function, $this->post_type_hook));
         exit;
     }
     // Sanity check -- do the required taxonomies exist?
     if (!taxonomy_exists($this->taxonomy_file) || !taxonomy_exists($this->taxonomy_since_version) || !taxonomy_exists($this->taxonomy_package)) {
         $this->logger->error(sprintf('Missing taxonomy; check that "%1$s" is registered.', $this->taxonomy_file));
         exit;
     }
     $root = '';
     foreach ($data as $file) {
         $this->logger->info(sprintf('Processing file %1$s of %2$s "%3$s".', number_format_i18n($file_number), number_format_i18n($num_of_files), $file['path']));
         $file_number++;
         $this->import_file($file, $skip_sleep, $import_ignored_functions);
         if (empty($root) && (isset($file['root']) && $file['root'])) {
             $root = $file['root'];
         }
     }
     if (!empty($root)) {
         update_option('wp_parser_root_import_dir', $root);
         $this->logger->info('Updated option wp_parser_root_import_dir: ' . $root);
     }
     $last_import = time();
     $import_date = date_i18n(get_option('date_format'), $last_import);
     $import_time = date_i18n(get_option('time_format'), $last_import);
     update_option('wp_parser_last_import', $last_import);
     $this->logger->info(sprintf('Updated option wp_parser_last_import: %1$s at %2$s.', $import_date, $import_time));
     $wp_version = get_option('wp_parser_imported_wp_version');
     if ($wp_version) {
         $this->logger->info('Updated option wp_parser_imported_wp_version: ' . $wp_version);
     }
     /**
      * Workaround for a WP core bug where hierarchical taxonomy caches are not being cleared
      *
      * https://core.trac.wordpress.org/ticket/14485
      * http://wordpress.stackexchange.com/questions/8357/inserting-terms-in-an-hierarchical-taxonomy
      */
     delete_option("{$this->taxonomy_package}_children");
     delete_option("{$this->taxonomy_since_version}_children");
     /**
      * Action at the end of a complete import
      */
     do_action('wp_parser_ending_import');
     // Start counting again
     wp_defer_term_counting(false);
     wp_suspend_cache_invalidation(false);
     wp_cache_flush();
     wp_defer_comment_counting(false);
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $this->logger->info('Time: ' . $time);
     $this->logger->info('Queries: ' . ($wpdb->num_queries - $num_queries));
     if (empty($this->errors)) {
         $this->logger->notice('Import complete!');
     } else {
         $this->logger->info('Import complete, but some errors were found:');
         foreach ($this->errors as $error) {
             $this->logger->error($error);
         }
     }
 }
开发者ID:lkwdwrd,项目名称:phpdoc-parser,代码行数:87,代码来源:class-importer.php


示例19: import_end

 /**
  * Performs post-import cleanup of files and the cache
  */
 protected function import_end()
 {
     // Re-enable stuff in core
     wp_suspend_cache_invalidation(false);
     wp_cache_flush();
     foreach (get_taxonomies() as $tax) {
         delete_option("{$tax}_children");
         _get_term_hierarchy($tax);
     }
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
     /**
      * Complete the import.
      *
      * Fires after the import process has finished. If you need to update
      * your cache or re-enable processing, do so here.
      */
     do_action('import_end');
 }
开发者ID:kucrut,项目名称:WordPress-Importer,代码行数:22,代码来源:class-wxr-importer.php


示例20: import_end

 function import_end()
 {
     do_action('import_end');
     // clear the caches after backfilling
     foreach ($this->post_ids_processed as $post_id) {
         clean_post_cache($post_id);
     }
     wp_defer_term_counting(false);
     wp_defer_comment_counting(false);
 }
开发者ID:nishant368,项目名称:newlifeoffice-new,代码行数:10,代码来源:class.wordpress_importer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_defer_term_counting函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_default_styles函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap