static function filterQuery($query) { if (!$query->Get('suppress_filters') && Core::isGlossaryArchive($query) || Core::isGlossarySearch($query)) { # Order the terms in the backend by title, ASC. if (!$query->Get('order')) { $query->Set('order', 'asc'); } if (!$query->Get('orderby')) { $query->Set('orderby', 'title'); } # Take an eye on the filter if (!$query->Get('post_title_like') && !$query->Get('ignore_filter_request') && Get_Query_Var('filter')) { $query->Set('post_title_like', RawUrlDecode(Get_Query_Var('filter')) . '%'); } # Change the number of terms per page if (!Is_Admin()) { $query->Set('posts_per_page', Options::Get('terms_per_page')); } } }
static function generate($depth = False) { # Get current Filter string $filter = RawUrlDecode(Get_Query_Var('filter')); if (!empty($filter)) { $str_filter = $filter; } elseif (Is_Singular()) { $str_filter = StrToLower(Get_The_Title()); } else { $str_filter = ''; } # Explode Filter string $arr_current_filter = empty($str_filter) ? array() : PReg_Split('/(?<!^)(?!$)/u', $str_filter); Array_UnShift($arr_current_filter, ''); $arr_filter = array(); # This will be the function result $filter_part = ''; # Check if we are inside a taxonomy archive $taxonomy_term = Is_Tax() ? Get_Queried_Object() : Null; foreach ($arr_current_filter as $filter_letter) { $filter_part .= $filter_letter; $arr_available_filters = self::getFilters($filter_part, $taxonomy_term); if (Count($arr_available_filters) <= 1) { break; } $active_filter_part = MB_SubStr(Implode($arr_current_filter), 0, MB_StrLen($filter_part) + 1); $arr_filter_line = array(); foreach ($arr_available_filters as $available_filter) { $arr_filter_line[$available_filter] = (object) array('filter' => MB_StrToUpper(MB_SubStr($available_filter, 0, 1)) . MB_SubStr($available_filter, 1), 'link' => Post_Type::getArchiveLink($available_filter, $taxonomy_term), 'active' => $active_filter_part == $available_filter, 'disabled' => False); } $arr_filter[] = $arr_filter_line; # Check filter depth limit if ($depth && Count($arr_filter) >= $depth) { break; } } # Run a filter $arr_filter = Apply_Filters('glossary_prefix_filter_links', $arr_filter, $depth); return $arr_filter; }