本文整理汇总了PHP中WPFB_Core::file_browser_search方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::file_browser_search方法的具体用法?PHP WPFB_Core::file_browser_search怎么用?PHP WPFB_Core::file_browser_search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPFB_Core
的用法示例。
在下文中一共展示了WPFB_Core::file_browser_search方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PostsSearch
static function PostsSearch($sql)
{
global $wp_query, $wpdb;
if (empty($sql)) {
return $sql;
}
wpfb_loadclass('File');
$is_wp_search = !empty($_GET['s']) && empty($_GET['wpfb_s']);
$search_id3 = WPFB_Core::$settings->search_id3;
$no_matches = false;
$where = self::SearchWhereSql($search_id3);
$where = "({$where} AND (" . WPFB_File::GetReadPermsWhere() . "))";
// check if there are matching files, if there are, include the filebrowser page/post in the resulst!
// if we have file pages, only include the file browser if file search widget was used!
$file_browser_id = intval(WPFB_Core::$settings->file_browser_post_id);
if ($file_browser_id > 0 && WPFB_File::GetNumFiles2($where, true) > 0) {
$where = "({$where} OR ({$wpdb->posts}.ID = {$file_browser_id}))";
// TODO!
wpfb_loadclass('Output');
WPFB_Core::$file_browser_search = true;
}
// OR' the $where to existing search conditions
$p = strpos($sql, "(");
$sql = substr($sql, 0, $p) . "( " . substr($sql, $p);
$p = strrpos($sql, ")))");
$sql = substr($sql, 0, $p + 3) . " OR {$where})" . substr($sql, $p + 3);
//echo "<br>".$sql;
return $sql;
}
示例2: ParseQuery
static function ParseQuery(&$query)
{
// conditional loading of the search hooks
global $wp_query;
if (!empty($wp_query->query_vars['s'])) {
wpfb_loadclass('Search');
}
if (!empty($_GET['wpfb_s']) || !empty($_GET['s'])) {
WPFB_Core::$file_browser_search = true;
add_filter('the_excerpt', array(__CLASS__, 'SearchExcerptFilter'), 100);
// must be lower than 11 (before do_shortcode) and after wpautop (>9)
}
// check if current post is file browser
if (($id = self::GetPostId($query)) == WPFB_Core::$settings->file_browser_post_id) {
wpfb_loadclass('File', 'Category');
if (!empty($_GET['wpfb_file'])) {
self::$file_browser_item = WPFB_File::GetFile($_GET['wpfb_file']);
} elseif (!empty($_GET['wpfb_cat'])) {
self::$file_browser_item = WPFB_Category::GetCat($_GET['wpfb_cat']);
} else {
$url = (is_ssl() ? 'https' : 'http') . '://' . $_SERVER["HTTP_HOST"] . stripslashes($_SERVER['REQUEST_URI']);
if (($qs = strpos($url, '?')) !== false) {
$url = substr($url, 0, $qs);
}
// remove query string
$path = trim(substr($url, strlen(WPFB_Core::GetPostUrl($id))), '/');
if (!empty($path)) {
self::$file_browser_item = WPFB_Item::GetByPath(urldecode($path));
if (is_null(self::$file_browser_item)) {
self::$file_browser_item = WPFB_Item::GetByPath($path);
}
}
}
}
}