本文整理汇总了PHP中update_page_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP update_page_cache函数的具体用法?PHP update_page_cache怎么用?PHP update_page_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_page_cache函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
//.........这里部分代码省略.........
$expages = wp_parse_id_list($exclude);
if (!empty($expages)) {
foreach ($expages as $expage) {
if (empty($exclusions)) {
$exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage);
} else {
$exclusions .= $wpdb->prepare(' AND ID <> %d ', $expage);
}
}
}
}
if (!empty($exclusions)) {
$exclusions .= ')';
}
$author_query = '';
if (!empty($authors)) {
$post_authors = preg_split('/[\\s,]+/', $authors);
if (!empty($post_authors)) {
foreach ($post_authors as $post_author) {
//Do we have an author id or an author login?
if (0 == intval($post_author)) {
$post_author = get_userdatabylogin($post_author);
if (empty($post_author)) {
continue;
}
if (empty($post_author->ID)) {
continue;
}
$post_author = $post_author->ID;
}
if ('' == $author_query) {
$author_query = $wpdb->prepare(' post_author = %d ', $post_author);
} else {
$author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author);
}
}
if ('' != $author_query) {
$author_query = " AND ({$author_query})";
}
}
}
$join = '';
$where = "{$exclusions} {$inclusions} ";
if (!empty($meta_key) || !empty($meta_value)) {
$join = " LEFT JOIN {$wpdb->postmeta} ON ( {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id )";
// meta_key and meta_value might be slashed
$meta_key = stripslashes($meta_key);
$meta_value = stripslashes($meta_value);
if (!empty($meta_key)) {
$where .= $wpdb->prepare(" AND {$wpdb->postmeta}.meta_key = %s", $meta_key);
}
if (!empty($meta_value)) {
$where .= $wpdb->prepare(" AND {$wpdb->postmeta}.meta_value = %s", $meta_value);
}
}
if ($parent >= 0) {
$where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
}
$where_post_type = $wpdb->prepare("post_type = '%s' AND post_status = '%s'", $post_type, $post_status);
$query = "SELECT * FROM {$wpdb->posts} {$join} WHERE ({$where_post_type}) {$where} ";
$query .= $author_query;
$query .= " ORDER BY " . $sort_column . " " . $sort_order;
if (!empty($number)) {
$query .= ' LIMIT ' . $offset . ',' . $number;
}
$pages = $wpdb->get_results($query);
if (empty($pages)) {
$pages = apply_filters('get_pages', array(), $r);
return $pages;
}
// Sanitize before caching so it'll only get done once
$num_pages = count($pages);
for ($i = 0; $i < $num_pages; $i++) {
$pages[$i] = sanitize_post($pages[$i], 'raw');
}
// Update cache.
update_page_cache($pages);
if ($child_of || $hierarchical) {
$pages =& get_page_children($child_of, $pages);
}
if (!empty($exclude_tree)) {
$exclude = (int) $exclude_tree;
$children = get_page_children($exclude, $pages);
$excludes = array();
foreach ($children as $child) {
$excludes[] = $child->ID;
}
$excludes[] = $exclude;
$num_pages = count($pages);
for ($i = 0; $i < $num_pages; $i++) {
if (in_array($pages[$i]->ID, $excludes)) {
unset($pages[$i]);
}
}
}
$cache[$key] = $pages;
wp_cache_set('get_pages', $cache, 'posts');
$pages = apply_filters('get_pages', $pages, $r);
return $pages;
}
示例2: array
//.........这里部分代码省略.........
* @return array List of pages matching defaults or $args
*/
function &get_pages($args = '')
{
global $wpdb;
$defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');
$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
$key = md5(serialize($r));
if ($cache = wp_cache_get('get_pages', 'posts')) {
if (isset($cache[$key])) {
return apply_filters('get_pages', $cache[$key], $r);
}
}
$inclusions = '';
if (!empty($include)) {
$child_of = 0;
//ignore child_of, exclude, meta_key, and meta_value params if using include
$exclude = '';
$meta_key = '';
$meta_value = '';
$hierarchical = false;
$incpages = preg_split('/[\\s,]+/', $include);
if (count($incpages)) {
foreach ($incpages as $incpage) {
if (empty($inclusions)) {
$inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage);
} else {
$inclusions .= $wpdb->prepare(' OR ID = %d ', $incpage);
}
}
}
}
if (!empty($inclusions)) {
$inclusions .= ')';
}
$exclusions = '';
if (!empty($exclude)) {
$expages = preg_split('/[\\s,]+/', $exclude);
if (count($expages)) {
foreach ($expages as $expage) {
if (empty($exclusions)) {
$exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage);
} else {
$exclusions .= $wpdb->prepare(' AND ID <> %d ', $expage);
}
}
}
}
if (!empty($exclusions)) {
$exclusions .= ')';
}
$author_query = '';
if (!empty($authors)) {
$post_authors = preg_split('/[\\s,]+/', $authors);
if (count($post_authors)) {
foreach ($post_authors as $post_author) {
//Do we have an author id or an author login?
if (0 == intval($post_author)) {
$post_author = get_userdatabylogin($post_author);
if (empty($post_author)) {
continue;
}
if (empty($post_author->ID)) {
continue;
}
$post_author = $post_author->ID;
}
if ('' == $author_query) {
$author_query = $wpdb->prepare(' post_author = %d ', $post_author);
} else {
$author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author);
}
}
if ('' != $author_query) {
$author_query = " AND ({$author_query})";
}
}
}
$query = "SELECT * FROM {$wpdb->posts} ";
$query .= empty($meta_key) ? "" : ", {$wpdb->postmeta} ";
$query .= " WHERE (post_type = 'page' AND post_status = 'publish') {$exclusions} {$inclusions} ";
// expected_slashed ($meta_key, $meta_value) -- also, it looks funky
$query .= empty($meta_key) | empty($meta_value) ? "" : " AND ({$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '{$meta_key}' AND {$wpdb->postmeta}.meta_value = '{$meta_value}' )";
$query .= $author_query;
$query .= " ORDER BY " . $sort_column . " " . $sort_order;
$pages = $wpdb->get_results($query);
if (empty($pages)) {
return apply_filters('get_pages', array(), $r);
}
// Update cache.
update_page_cache($pages);
if ($child_of || $hierarchical) {
$pages =& get_page_children($child_of, $pages);
}
$cache[$key] = $pages;
wp_cache_set('get_pages', $cache, 'posts');
$pages = apply_filters('get_pages', $pages, $r);
return $pages;
}
示例3: flt_get_pages
//.........这里部分代码省略.........
// will still be teased. This is a slight design compromise to satisfy potentially conflicting user goals without yet another option
$pages = apply_filters('objects_results_rs', $pages, 'post', (array) $post_type, array('request' => $query, 'force_teaser' => true, 'object_type' => $post_type));
// restore buffered titles in case they were filtered previously
scoper_restore_property_array($pages, $titles, 'ID', 'post_title');
$pages = apply_filters('objects_teaser_rs', $pages, 'post', $post_type, array('request' => $query, 'force_teaser' => true));
if ($frontend_list_private) {
if (!scoper_get_otype_option('teaser_hide_private', 'post', $post_type)) {
$tease_all = true;
}
}
} else {
$_args = array('skip_teaser' => true);
if (in_array($GLOBALS['pagenow'], array('post.php', 'post-new.php'))) {
if ($post_type_obj = get_post_type_object($post_type)) {
$plural_name = plural_name_from_cap_rs($post_type_obj);
$_args['alternate_reqd_caps'][0] = array("create_child_{$plural_name}");
}
}
// Pass query through the request filter
$query = apply_filters('objects_request_rs', $query, 'post', $post_type, $_args);
// Execute the filtered query
$pages = scoper_get_results($query);
// restore buffered titles in case they were filtered previously
scoper_restore_property_array($pages, $titles, 'ID', 'post_title');
}
if (empty($pages)) {
// alternate hook name (WP core already applied get_pages filter)
return apply_filters('get_pages_rs', array(), $r);
}
//
// === END Role Scoper MODIFICATION ===
// ====================================
// Role Scoper note: WP core get_pages has already updated wp_cache and pagecache with unfiltered results.
update_page_cache($pages);
// === BEGIN Role Scoper MODIFICATION: Support a disjointed pages tree with some parents hidden ========
if ($child_of || empty($tease_all)) {
// if we're including all pages with teaser, no need to continue thru tree remapping
$ancestors = ScoperAncestry::get_page_ancestors();
// array of all ancestor IDs for keyed page_id, with direct parent first
$orderby = $sort_column;
if ($parent > 0 || !$hierarchical) {
$remap_parents = false;
} else {
// if these settings were passed into this get_pages call, use them
if (-1 === $remap_parents) {
$remap_parents = scoper_get_option('remap_page_parents');
}
if ($remap_parents) {
if (-1 === $enforce_actual_depth) {
$enforce_actual_depth = scoper_get_option('enforce_actual_page_depth');
}
if (-1 === $remap_thru_excluded_parent) {
$remap_thru_excluded_parent = scoper_get_option('remap_thru_excluded_page_parent');
}
}
}
$remap_args = compact('child_of', 'parent', 'exclude', 'depth', 'orderby', 'remap_parents', 'enforce_actual_depth', 'remap_thru_excluded_parent');
// one or more of these args may have been modified after extraction
ScoperHardway::remap_tree($pages, $ancestors, 'ID', 'post_parent', $remap_args);
}
// === END Role Scoper MODIFICATION ===
// ====================================
if (!empty($exclude_tree)) {
$exclude = array();
$exclude = (int) $exclude_tree;
$children = get_page_children($exclude, $pages);
示例4: array
function &get_pages($args = '') {
global $wpdb;
if ( is_array($args) )
$r = &$args;
else
parse_str($args, $r);
$defaults = array('child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title',
'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '');
$r = array_merge($defaults, $r);
extract($r);
$key = md5( serialize( $r ) );
if ( $cache = wp_cache_get( 'get_pages', 'page' ) )
if ( isset( $cache[ $key ] ) )
return apply_filters('get_pages', $cache[ $key ], $r );
$inclusions = '';
if ( !empty($include) ) {
$child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
$exclude = '';
$meta_key = '';
$meta_value = '';
$incpages = preg_split('/[\s,]+/',$include);
if ( count($incpages) ) {
foreach ( $incpages as $incpage ) {
if (empty($inclusions))
$inclusions = ' AND ( ID = ' . intval($incpage) . ' ';
else
$inclusions .= ' OR ID = ' . intval($incpage) . ' ';
}
}
}
if (!empty($inclusions))
$inclusions .= ')';
$exclusions = '';
if ( !empty($exclude) ) {
$expages = preg_split('/[\s,]+/',$exclude);
if ( count($expages) ) {
foreach ( $expages as $expage ) {
if (empty($exclusions))
$exclusions = ' AND ( ID <> ' . intval($expage) . ' ';
else
$exclusions .= ' AND ID <> ' . intval($expage) . ' ';
}
}
}
if (!empty($exclusions))
$exclusions .= ')';
$author_query = '';
if (!empty($authors)) {
$post_authors = preg_split('/[\s,]+/',$authors);
if ( count($post_authors) ) {
foreach ( $post_authors as $post_author ) {
//Do we have an author id or an author login?
if ( 0 == intval($post_author) ) {
$post_author = get_userdatabylogin($post_author);
if ( empty($post_author) )
continue;
if ( empty($post_author->ID) )
continue;
$post_author = $post_author->ID;
}
if ( '' == $author_query )
$author_query = ' post_author = ' . intval($post_author) . ' ';
else
$author_query .= ' OR post_author = ' . intval($post_author) . ' ';
}
if ( '' != $author_query )
$author_query = " AND ($author_query)";
}
}
$query = "SELECT * FROM $wpdb->posts " ;
$query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
$query .= " WHERE (post_type = 'page' AND post_status = 'publish') $exclusions $inclusions " ;
$query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ;
$query .= $author_query;
$query .= " ORDER BY " . $sort_column . " " . $sort_order ;
$pages = $wpdb->get_results($query);
$pages = apply_filters('get_pages', $pages, $r);
if ( empty($pages) )
return array();
// Update cache.
update_page_cache($pages);
if ( $child_of || $hierarchical )
$pages = & get_page_children($child_of, $pages);
$cache[ $key ] = $pages;
wp_cache_set( 'get_pages', $cache, 'page' );
//.........这里部分代码省略.........
示例5: array
//.........这里部分代码省略.........
}
}
}
$join = '';
$where = "{$exclusions} {$inclusions} ";
if (!empty($meta_key) || !empty($meta_value)) {
$join = " LEFT JOIN {$nxtdb->postmeta} ON ( {$nxtdb->posts}.ID = {$nxtdb->postmeta}.post_id )";
// meta_key and meta_value might be slashed
$meta_key = stripslashes($meta_key);
$meta_value = stripslashes($meta_value);
if (!empty($meta_key)) {
$where .= $nxtdb->prepare(" AND {$nxtdb->postmeta}.meta_key = %s", $meta_key);
}
if (!empty($meta_value)) {
$where .= $nxtdb->prepare(" AND {$nxtdb->postmeta}.meta_value = %s", $meta_value);
}
}
if ($parent >= 0) {
$where .= $nxtdb->prepare(' AND post_parent = %d ', $parent);
}
if (1 == count($post_status)) {
$where_post_type = $nxtdb->prepare("post_type = %s AND post_status = %s", $post_type, array_shift($post_status));
} else {
$post_status = implode("', '", $post_status);
$where_post_type = $nxtdb->prepare("post_type = %s AND post_status IN ('{$post_status}')", $post_type);
}
$orderby_array = array();
$allowed_keys = array('author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'name', 'post_name', 'modified', 'post_modified', 'modified_gmt', 'post_modified_gmt', 'menu_order', 'parent', 'post_parent', 'ID', 'rand', 'comment_count');
foreach (explode(',', $sort_column) as $orderby) {
$orderby = trim($orderby);
if (!in_array($orderby, $allowed_keys)) {
continue;
}
switch ($orderby) {
case 'menu_order':
break;
case 'ID':
$orderby = "{$nxtdb->posts}.ID";
break;
case 'rand':
$orderby = 'RAND()';
break;
case 'comment_count':
$orderby = "{$nxtdb->posts}.comment_count";
break;
default:
if (0 === strpos($orderby, 'post_')) {
$orderby = "{$nxtdb->posts}." . $orderby;
} else {
$orderby = "{$nxtdb->posts}.post_" . $orderby;
}
}
$orderby_array[] = $orderby;
}
$sort_column = !empty($orderby_array) ? implode(',', $orderby_array) : "{$nxtdb->posts}.post_title";
$sort_order = strtoupper($sort_order);
if ('' !== $sort_order && !in_array($sort_order, array('ASC', 'DESC'))) {
$sort_order = 'ASC';
}
$query = "SELECT * FROM {$nxtdb->posts} {$join} WHERE ({$where_post_type}) {$where} ";
$query .= $author_query;
$query .= " ORDER BY " . $sort_column . " " . $sort_order;
if (!empty($number)) {
$query .= ' LIMIT ' . $offset . ',' . $number;
}
$pages = $nxtdb->get_results($query);
if (empty($pages)) {
$pages = apply_filters('get_pages', array(), $r);
return $pages;
}
// Sanitize before caching so it'll only get done once
$num_pages = count($pages);
for ($i = 0; $i < $num_pages; $i++) {
$pages[$i] = sanitize_post($pages[$i], 'raw');
}
// Update cache.
update_page_cache($pages);
if ($child_of || $hierarchical) {
$pages =& get_page_children($child_of, $pages);
}
if (!empty($exclude_tree)) {
$exclude = (int) $exclude_tree;
$children = get_page_children($exclude, $pages);
$excludes = array();
foreach ($children as $child) {
$excludes[] = $child->ID;
}
$excludes[] = $exclude;
$num_pages = count($pages);
for ($i = 0; $i < $num_pages; $i++) {
if (in_array($pages[$i]->ID, $excludes)) {
unset($pages[$i]);
}
}
}
$cache[$key] = $pages;
nxt_cache_set('get_pages', $cache, 'posts');
$pages = apply_filters('get_pages', $pages, $r);
return $pages;
}
示例6: parse_str
function &get_pages($args = '')
{
global $wpdb;
parse_str($args, $r);
if (!isset($r['child_of'])) {
$r['child_of'] = 0;
}
if (!isset($r['sort_column'])) {
$r['sort_column'] = 'post_title';
}
if (!isset($r['sort_order'])) {
$r['sort_order'] = 'ASC';
}
$exclusions = '';
if (!empty($r['exclude'])) {
$expages = preg_split('/[\\s,]+/', $r['exclude']);
if (count($expages)) {
foreach ($expages as $expage) {
$exclusions .= ' AND ID <> ' . intval($expage) . ' ';
}
}
}
$pages = $wpdb->get_results("SELECT * " . "FROM {$wpdb->posts} " . "WHERE post_status = 'static' " . "{$exclusions} " . "ORDER BY " . $r['sort_column'] . " " . $r['sort_order']);
if (empty($pages)) {
return array();
}
// Update cache.
update_page_cache($pages);
if ($r['child_of']) {
$pages =& get_page_children($r['child_of'], $pages);
}
return $pages;
}
示例7: array
//.........这里部分代码省略.........
if ( isset( $cache[ $key ] ) )
return apply_filters('get_pages', $cache[ $key ], $r );
$inclusions = '';
if ( !empty($include) ) {
$child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
$exclude = '';
$meta_key = '';
$meta_value = '';
$hierarchical = false;
$incpages = preg_split('/[\s,]+/',$include);
if ( count($incpages) ) {
foreach ( $incpages as $incpage ) {
if (empty($inclusions))
$inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage);
else
$inclusions .= $wpdb->prepare(' OR ID = %d ', $incpage);
}
}
}
if (!empty($inclusions))
$inclusions .= ')';
$exclusions = '';
if ( !empty($exclude) ) {
$expages = preg_split('/[\s,]+/',$exclude);
if ( count($expages) ) {
foreach ( $expages as $expage ) {
if (empty($exclusions))
$exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage);
else
$exclusions .= $wpdb->prepare(' AND ID <> %d ', $expage);
}
}
}
if (!empty($exclusions))
$exclusions .= ')';
$author_query = '';
if (!empty($authors)) {
$post_authors = preg_split('/[\s,]+/',$authors);
if ( count($post_authors) ) {
foreach ( $post_authors as $post_author ) {
//Do we have an author id or an author login?
if ( 0 == intval($post_author) ) {
$post_author = get_userdatabylogin($post_author);
if ( empty($post_author) )
continue;
if ( empty($post_author->ID) )
continue;
$post_author = $post_author->ID;
}
if ( '' == $author_query )
$author_query = $wpdb->prepare(' post_author = %d ', $post_author);
else
$author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author);
}
if ( '' != $author_query )
$author_query = " AND ($author_query)";
}
}
$join = '';
$where = "$exclusions $inclusions ";
if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) {
$join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
// meta_key and met_value might be slashed
$meta_key = stripslashes($meta_key);
$meta_value = stripslashes($meta_value);
if ( ! empty( $meta_key ) )
$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key);
if ( ! empty( $meta_value ) )
$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
}
$query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where ";
$query .= $author_query;
$query .= " ORDER BY " . $sort_column . " " . $sort_order ;
$pages = $wpdb->get_results($query);
if ( empty($pages) )
return apply_filters('get_pages', array(), $r);
// Update cache.
update_page_cache($pages);
if ( $child_of || $hierarchical )
$pages = & get_page_children($child_of, $pages);
$cache[ $key ] = $pages;
wp_cache_set( 'get_pages', $cache, 'posts' );
$pages = apply_filters('get_pages', $pages, $r);
return $pages;
}
示例8: redo_search
function redo_search($the_posts = array())
{
global $wpdb;
global $wp_query;
if (is_search()) {
$GLOBALS['sem_s'] = get_query_var('s');
preg_match_all("/((\\w|-)+)/", $GLOBALS['sem_s'], $out);
$keywords = current($out);
if (empty($keywords)) {
return array();
}
$query_string = "";
$keyword_filter = "";
foreach ($keywords as $keyword) {
$query_string .= ($query_string ? " " : "") . $keyword;
$reg_one_present .= ($reg_one_present ? "|" : "") . $keyword;
}
$paged = $wp_query->get('paged');
if (!$paged) {
$paged = 1;
}
$posts_per_page = $wp_query->get('posts_per_page');
if (!$posts_per_page) {
$posts_per_page = get_settings('posts_per_page');
}
$offset = ($paged - 1) * $posts_per_page;
$now = gmdate('Y-m-d H:i:00', strtotime("+1 minute"));
if (isset($GLOBALS['sem_static_front'])) {
$GLOBALS['sem_static_front']->init();
}
if (isset($GLOBALS['sem_sidebar_tile'])) {
$GLOBALS['sem_sidebar_tile']->init();
}
$search_query = "\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tDISTINCT posts.*,\r\n\t\t\t\t\tCASE\r\n\t\t\t\t\t\tWHEN posts.post_title REGEXP '{$reg_one_present}'\r\n\t\t\t\t\t\t\tTHEN 1\r\n\t\t\t\t\t\t\tELSE 0\r\n\t\t\t\t\t\tEND AS keyword_in_title,\r\n\t\t\t\t\tMATCH ( posts.post_title, posts.post_content )\r\n\t\t\t\t\t\tAGAINST ( '" . addslashes($query_string) . "' ) AS mysql_score\r\n\t\t\t\tFROM\r\n\t\t\t\t\t{$wpdb->posts} as posts\r\n\t\t\t\tLEFT JOIN {$wpdb->postmeta} as postmeta\r\n\t\t\t\t\tON postmeta.post_id = posts.ID\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tposts.post_date_gmt <= '" . $now . "'" . (defined('sem_home_page_id') && sem_home_page_id ? "\r\n\t\t\t\t\tAND posts.ID <> " . intval(sem_home_page_id) : "") . (defined('sem_sidebar_tile_id') && sem_sidebar_tile_id ? "\r\n\t\t\t\t\tAND posts.ID <> " . intval(sem_sidebar_tile_id) : "") . "\r\n\t\t\t\t\tAND ( posts.post_password = '' )\r\n\t\t\t\t\tAND ( " . (function_exists('get_site_option') ? "( post_status = 'publish' AND ( post_type = 'post' OR ( post_type = 'page' AND postmeta.meta_value = 'article.php' ) ) )" : "( post_status = 'publish' OR ( post_status = 'static' AND postmeta.meta_value = 'article.php' ) )") . " )\r\n\t\t\t\t\tAND ( posts.post_title REGEXP '{$reg_one_present}' OR posts.post_content REGEXP '{$reg_one_present}' )\r\n\t\t\t\tGROUP BY\r\n\t\t\t\t\tposts.ID\r\n\t\t\t\tORDER BY\r\n\t\t\t\t\tkeyword_in_title DESC, mysql_score DESC, posts.post_date DESC\r\n\t\t\t\tLIMIT " . intval($offset) . ", " . intval($posts_per_page);
$request_query = "\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tDISTINCT posts.*\r\n\t\t\t\tFROM\r\n\t\t\t\t\t{$wpdb->posts} as posts\r\n\t\t\t\tLEFT JOIN {$wpdb->postmeta} as postmeta\r\n\t\t\t\t\tON postmeta.post_id = posts.ID\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tposts.post_date_gmt <= '" . $now . "'" . (defined('sem_home_page_id') && sem_home_page_id ? "\r\n\t\t\t\t\tAND posts.ID <> " . intval(sem_home_page_id) : "") . (defined('sem_sidebar_tile_id') && sem_sidebar_tile_id ? "\r\n\t\t\t\t\tAND posts.ID <> " . intval(sem_sidebar_tile_id) : "") . "\r\n\t\t\t\t\tAND ( posts.post_password = '' )\r\n\t\t\t\t\tAND ( " . (function_exists('get_site_option') ? "( post_status = 'publish' AND ( post_type = 'post' OR ( post_type = 'page' AND postmeta.meta_value = 'article.php' ) ) )" : "( post_status = 'publish' OR ( post_status = 'static' AND postmeta.meta_value = 'article.php' ) )") . " )\r\n\t\t\t\t\tAND ( posts.post_title REGEXP '{$reg_one_present}' OR posts.post_content REGEXP '{$reg_one_present}' )\r\n\t\t\t\tGROUP BY\r\n\t\t\t\t\tposts.ID\r\n\t\t\t\tLIMIT " . intval($offset) . ", " . intval($posts_per_page);
$the_posts = $wpdb->get_results($search_query);
$GLOBALS['request'] = ' ' . preg_replace("/[\n\r\\s]+/", " ", $request_query) . ' ';
if (function_exists('update_post_cache')) {
update_post_cache($the_posts);
}
if (function_exists('update_page_cache')) {
update_page_cache($the_posts);
}
}
return $the_posts;
}