本文整理汇总了PHP中BYT_Theme_Utils::string_contains方法的典型用法代码示例。如果您正苦于以下问题:PHP BYT_Theme_Utils::string_contains方法的具体用法?PHP BYT_Theme_Utils::string_contains怎么用?PHP BYT_Theme_Utils::string_contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BYT_Theme_Utils
的用法示例。
在下文中一共展示了BYT_Theme_Utils::string_contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_pager
public static function display_pager($max_num_pages, $custom_byt_paged = false)
{
$pattern = '#(www\\.|https?:\\/\\/){1}[a-zA-Z0-9\\-]{2,254}\\.[a-zA-Z0-9]{2,20}[a-zA-Z0-9.?&=_/]*#i';
$big = 999999999;
// need an unlikely integer
$pager_settings = array('base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'total' => $max_num_pages, 'prev_text' => __('<', 'bookyourtravel'), 'next_text' => __('>', 'bookyourtravel'), 'type' => 'array');
if ($custom_byt_paged) {
$pager_settings['format'] = '?paged-byt=%#%';
$pager_settings['current'] = max(1, get_query_var('paged-byt'));
} else {
$pager_settings['format'] = '?paged=%#%';
$pager_settings['current'] = max(1, get_query_var('paged'));
}
$pager_links = paginate_links($pager_settings);
$count_links = count($pager_links);
if ($count_links > 0) {
$first_link = $pager_links[0];
$last_link = $first_link;
preg_match_all($pattern, $first_link, $matches, PREG_PATTERN_ORDER);
echo '<span><a href="' . get_pagenum_link(1) . '">' . __('First page', 'bookyourtravel') . '</a></span>';
for ($i = 0; $i < $count_links; $i++) {
$pager_link = $pager_links[$i];
if (!BYT_Theme_Utils::string_contains($pager_link, 'current')) {
echo '<span>' . $pager_link . '</span>';
} else {
echo $pager_link;
}
$last_link = $pager_link;
}
preg_match_all($pattern, $last_link, $matches, PREG_PATTERN_ORDER);
echo '<span><a href="' . get_pagenum_link($max_num_pages) . '">' . __('Last page', 'bookyourtravel') . '</a></span>';
}
}