<?php /************************************************************* * * stats.class.php * * Various searches on worker * * * Copyright (c) 2011 Prelovac Media * www.prelovac.com **************************************************************/ if ($_SERVER['SCRIPT_FILENAME'] == __FILE__) { exit; } mmb_add_action('search_posts_by_term', 'search_posts_by_term'); function search_posts_by_term($params = false) { global $wpdb, $current_user; $search_type = trim($params['search_type']); $search_term = strtolower(trim($params['search_term'])); switch ($search_type) { case 'page_post': $num_posts = 10; $num_content_char = 30; $term_orig = trim($params['search_term']); $term_base = addslashes(trim($params['search_term'])); $query = "SELECT *\r\n\t\t \t\t\t FROM {$wpdb->posts} \r\n\t\t \t\t\t WHERE {$wpdb->posts}.post_status = 'publish'\r\n\t\t \t\t\t AND ({$wpdb->posts}.post_title LIKE '%{$term_base}%'\r\n\t\t \t\t\t \t\tOR {$wpdb->posts}.post_content LIKE '%{$term_base}%')\r\n\t\t \t\t\t ORDER BY {$wpdb->posts}.post_modified DESC\r\n\t\t \t\t\t LIMIT 0, {$num_posts}\r\n\t\t \t\t\t "; $posts_array = $wpdb->get_results($query); $ret_posts = array(); foreach ($posts_array as $post) {
exit; } add_filter('mmb_stats_filter', 'mmb_get_extended_info'); function mmb_get_extended_info($stats) { global $mmb_core; $params = get_option('mmb_stats_filter'); $filter = isset($params['plugins']['cleanup']) ? $params['plugins']['cleanup'] : array(); $stats['num_revisions'] = mmb_num_revisions($filter['revisions']); //$stats['num_revisions'] = 5; $stats['overhead'] = mmb_handle_overhead(false); $stats['num_spam_comments'] = mmb_num_spam_comments(); return $stats; } /* Revisions */ mmb_add_action('cleanup_delete', 'cleanup_delete_worker'); function cleanup_delete_worker($params = array()) { global $mmb_core; $revision_params = get_option('mmb_stats_filter'); $revision_filter = isset($revision_params['plugins']['cleanup']) ? $revision_params['plugins']['cleanup'] : array(); $params_array = explode('_', $params['actions']); $return_array = array(); foreach ($params_array as $param) { switch ($param) { case 'revision': if (mmb_delete_all_revisions($revision_filter['revisions'])) { $return_array['revision'] = 'OK'; } else { $return_array['revision_error'] = 'OK, nothing to do'; }