implode( '&family=', $font_families ),
'display' => 'swap',
), 'https://fonts.googleapis.com/css2' );
return esc_url_raw($fonts_url);
}
endif;
if( !function_exists( 'primebulletin_sanitize_sidebar_option_meta' ) ) :
// Sidebar Option Sanitize.
function primebulletin_sanitize_sidebar_option_meta( $input ){
$metabox_options = array( 'global-sidebar','left-sidebar','right-sidebar','no-sidebar' );
if( in_array( $input,$metabox_options ) ){
return $input;
}else{
return '';
}
}
endif;
if( !function_exists( 'primebulletin_page_lists' ) ) :
// Page List.
function primebulletin_page_lists(){
$page_lists = array();
$page_lists[''] = esc_html__( '-- Select Page --','primebulletin' );
$pages = get_pages(
array (
'parent' => 0, // replaces 'depth' => 1,
)
);
foreach( $pages as $page ){
$page_lists[$page->ID] = $page->post_title;
}
return $page_lists;
}
endif;
if( !function_exists( 'primebulletin_sanitize_post_layout_option_meta' ) ) :
// Sidebar Option Sanitize.
function primebulletin_sanitize_post_layout_option_meta( $input ){
$metabox_options = array( 'global-layout','layout-1','layout-2' );
if( in_array( $input,$metabox_options ) ){
return $input;
}else{
return '';
}
}
endif;
if( !function_exists( 'primebulletin_sanitize_header_overlay_option_meta' ) ) :
// Sidebar Option Sanitize.
function primebulletin_sanitize_header_overlay_option_meta( $input ){
$metabox_options = array( 'global-layout','enable-overlay' );
if( in_array( $input,$metabox_options ) ){
return $input;
}else{
return '';
}
}
endif;
/**
* PrimeBulletin SVG Icon helper functions
*
* @package PrimeBulletin
* @since 1.0.0
*/
if ( ! function_exists( 'primebulletin_the_theme_svg' ) ):
/**
* Output and Get Theme SVG.
* Output and get the SVG markup for an icon in the PrimeBulletin_SVG_Icons class.
*
* @param string $svg_name The name of the icon.
* @param string $group The group the icon belongs to.
* @param string $color Color code.
*/
function primebulletin_the_theme_svg( $svg_name, $return = false ) {
if( $return ){
return primebulletin_get_theme_svg( $svg_name ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in primebulletin_get_theme_svg();.
}else{
echo primebulletin_get_theme_svg( $svg_name ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in primebulletin_get_theme_svg();.
}
}
endif;
if ( ! function_exists( 'primebulletin_get_theme_svg' ) ):
/**
* Get information about the SVG icon.
*
* @param string $svg_name The name of the icon.
* @param string $group The group the icon belongs to.
* @param string $color Color code.
*/
function primebulletin_get_theme_svg( $svg_name ) {
// Make sure that only our allowed tags and attributes are included.
$svg = wp_kses(
PrimeBulletin_SVG_Icons::get_svg( $svg_name ),
array(
'svg' => array(
'class' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
),
'path' => array(
'fill' => true,
'fill-rule' => true,
'd' => true,
'transform' => true,
),
'polygon' => array(
'fill' => true,
'fill-rule' => true,
'points' => true,
'transform' => true,
'focusable' => true,
),
)
);
if ( ! $svg ) {
return false;
}
return $svg;
}
endif;
if ( ! function_exists( 'primebulletin_svg_escape' ) ):
/**
* Get information about the SVG icon.
*
* @param string $svg_name The name of the icon.
* @param string $group The group the icon belongs to.
* @param string $color Color code.
*/
function primebulletin_svg_escape( $input ) {
// Make sure that only our allowed tags and attributes are included.
$svg = wp_kses(
$input,
array(
'svg' => array(
'class' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
),
'path' => array(
'fill' => true,
'fill-rule' => true,
'd' => true,
'transform' => true,
),
'polygon' => array(
'fill' => true,
'fill-rule' => true,
'points' => true,
'transform' => true,
'focusable' => true,
),
)
);
if ( ! $svg ) {
return false;
}
return $svg;
}
endif;
if( !function_exists('primebulletin_post_format_icon') ):
// Post Format Icon.
function primebulletin_post_format_icon( $format ){
if( $format == 'video' ){
$icon = primebulletin_get_theme_svg( 'video' );
}elseif( $format == 'audio' ){
$icon = primebulletin_get_theme_svg( 'audio' );
}elseif( $format == 'gallery' ){
$icon = primebulletin_get_theme_svg( 'gallery' );
}elseif( $format == 'quote' ){
$icon = primebulletin_get_theme_svg( 'quote' );
}elseif( $format == 'image' ){
$icon = primebulletin_get_theme_svg( 'image' );
}else{
$icon = '';
}
return $icon;
}
endif;
if( !function_exists( 'primebulletin_social_menu_icon' ) ) :
function primebulletin_social_menu_icon( $item_output, $item, $depth, $args ) {
// Add Icon
if ( isset( $args->theme_location ) && 'primebulletin-social-menu' === $args->theme_location ) {
$svg = PrimeBulletin_SVG_Icons::get_theme_svg_name( $item->url );
if ( empty( $svg ) ) {
$svg = primebulletin_the_theme_svg( 'link',$return = true );
}
$item_output = str_replace( $args->link_after, '' . $svg, $item_output );
}
return $item_output;
}
endif;
add_filter( 'walker_nav_menu_start_el', 'primebulletin_social_menu_icon', 10, 4 );
if ( ! function_exists( 'primebulletin_sub_menu_toggle_button' ) ) :
function primebulletin_sub_menu_toggle_button( $args, $item, $depth ) {
// Add sub menu toggles to the main menu with toggles
if ( $args->theme_location == 'primebulletin-primary-menu' && isset( $args->show_toggles ) ) {
// Wrap the menu item link contents in a div, used for positioning
$args->before = '
';
$args->after = '';
// Add a toggle to items with children
if ( in_array( 'menu-item-has-children', $item->classes ) ) {
$toggle_target_string = '.menu-item.menu-item-' . $item->ID . ' > .sub-menu';
// Add the sub menu toggle
$args->after .= '';
}
// Close the wrapper
$args->after .= '
';
// Add sub menu icons to the main menu without toggles (the fallback menu)
} elseif ( $args->theme_location == 'primebulletin-primary-menu' ) {
if ( in_array( 'menu-item-has-children', $item->classes ) ) {
$args->before = '