Пример #1
0
 function _lift_deactivate()
 {
     if (class_exists('Left_Search')) {
         $domain_manager = Lift_Search::get_domain_manager();
         if ($domain_name = Lift_Search::get_search_domain_name()) {
             TAE_Async_Event::Unwatch('lift_domain_created_' . $domain_name);
             TAE_Async_Event::Unwatch('lift_needs_indexing_' . $domain_name);
         }
         //clean up options
         delete_option(Lift_Search::INITIAL_SETUP_COMPLETE_OPTION);
         delete_option(Lift_Search::SETTINGS_OPTION);
         delete_option('lift_db_version');
         delete_option(Lift_Document_Update_Queue::QUEUE_IDS_OPTION);
         if (class_exists('Voce_Error_Logging')) {
             Voce_Error_Logging::delete_logs(array('lift-search'));
         }
         Lift_Batch_Handler::_deactivation_cleanup();
         Lift_Document_Update_Queue::_deactivation_cleanup();
     }
 }
 function voce_error_log($title, $error, $tags = array())
 {
     return Voce_Error_Logging::error_log($title, $error, $tags);
 }
Пример #3
0
<?php

if (defined('ABSPATH') && function_exists('add_action')) {
    if (!has_action('init', array('Voce_Error_Logging', 'create_post_type'))) {
        Voce_Error_Logging::init();
        require __DIR__ . '/functions.php';
    }
}
Пример #4
0
 public function action__wp_ajax_lift_error_log()
 {
     $response = (object) array('error' => false, 'nonce' => wp_create_nonce('lift_error_log'));
     if (Lift_Search::error_logging_enabled()) {
         $response->view_all_url = esc_url(admin_url(sprintf('edit.php?post_type=%s', Voce_Error_Logging::POST_TYPE)));
         if ($_SERVER['REQUEST_METHOD'] === 'POST') {
             check_ajax_referer('lift_error_log', 'nonce');
             $response = Voce_Error_Logging::delete_logs(array('lift-search'));
         } else {
             $args = array('post_type' => Voce_Error_Logging::POST_TYPE, 'posts_per_page' => 5, 'post_status' => 'any', 'orderby' => 'date', 'order' => 'DESC', 'tax_query' => array(array('taxonomy' => Voce_Error_Logging::TAXONOMY, 'field' => 'slug', 'terms' => array('error', 'lift-search'), 'operator' => 'AND')));
             $query = new WP_Query($args);
             $response->current_page = $query->get('paged');
             $response->per_page = $query->get('posts_per_page');
             $response->found_rows = $query->found_posts;
             $response->errors = array();
             foreach ($query->posts as $post) {
                 $response->errors[] = array('error_html' => sprintf('<strong>%s</strong><pre>%s</pre>', esc_html($post->post_title), wpautop($post->post_content)), 'date' => mysql2date('D. M d Y g:ia', $post->post_date));
             }
         }
     } else {
         status_header(400);
         $response->view_all_url = '';
         $response->error = array('code' => 'logging_disabled', 'Error Logging is Disabled');
     }
     header('Content-Type: application/json');
     die(json_encode($response));
 }