[ 'title' => __( 'Facebook', 'bigshop' ), 'url' => wtbigshop_option( 'facebook' ), ], 'twitter' => [ 'title' => __( 'Twitter', 'bigshop' ), 'url' => wtbigshop_option( 'twitter' ), ], 'linkedin' => [ 'title' => __( 'Linkedin', 'bigshop' ), 'url' => wtbigshop_option( 'linkedin' ), ], 'youtube' => [ 'title' => __( 'Youtube', 'bigshop' ), 'url' => wtbigshop_option( 'youtube' ), ], 'pinterest' => [ 'title' => __( 'Pinterest', 'bigshop' ), 'url' => wtbigshop_option( 'pinterest' ), ], 'instagram' => [ 'title' => __( 'Instagram', 'bigshop' ), 'url' => wtbigshop_option( 'instagram' ), ], 'skype' => [ 'title' => __( 'Skype', 'bigshop' ), 'url' => wtbigshop_option( 'skype' ), ], 'tiktok' => [ 'title' => __( 'TikTok', 'bigshop' ), 'url' => wtbigshop_option( 'tiktok' ), ], ] ); } /** * Social icon for the site * @return mixed|null */ public static function get_team_socials() { return apply_filters( 'wtbigshop_team_socials', array( 'facebook' => array( 'label' => esc_html__( 'Facebook', 'bigshop' ), 'type' => 'text', 'icon' => 'icon-rt-facebook', ), 'twitter' => array( 'label' => esc_html__( 'Twitter', 'bigshop' ), 'type' => 'text', 'icon' => 'icon-rt-x-twitter', ), 'linkedin' => array( 'label' => esc_html__( 'Linkedin', 'bigshop' ), 'type' => 'text', 'icon' => 'icon-rt-linkedin', ), 'skype' => array( 'label' => esc_html__( 'Skype', 'bigshop' ), 'type' => 'text', 'icon' => 'icon-rt-skype', ), 'youtube' => array( 'label' => esc_html__( 'Youtube', 'bigshop' ), 'type' => 'text', 'icon' => 'icon-rt-youtube', ), 'pinterest' => array( 'label' => esc_html__( 'Pinterest', 'bigshop' ), 'type' => 'text', 'icon' => 'icon-rt-pinterest', ), 'instagram' => array( 'label' => esc_html__( 'Instagram', 'bigshop' ), 'type' => 'text', 'icon' => 'icon-rt-instagram', ), 'tiktok' => array( 'label' => esc_html__( 'TikTok', 'bigshop' ), 'type' => 'text', 'icon' => 'rticon-tiktok', ), ) ); } /** * Get Sidebar lists * * @return array */ public static function sidebar_lists( $default_title = null ) { $sidebar_fields = []; $sidebar_fields['default'] = $default_title ?? esc_html__( 'Choose Sidebar', 'bigshop' ); foreach ( self::default_sidebar() as $id => $sidebar ) { $sidebar_fields[ $sidebar['id'] ] = $sidebar['name']; } return $sidebar_fields; } /** * Get image presets * * @param $name * @param int $total * @param string $type * * @return array */ public static function image_placeholder( $name, $total = 1, $type = 'svg' ) { $presets = []; for ( $i = 1; $i <= $total; $i ++ ) { $image_name = "$name-$i.$type"; $presets[ $i ] = [ 'image' => wtbigshop_get_img( $image_name ), 'name' => __( 'Style', 'bigshop' ) . ' ' . $i, ]; } return apply_filters( 'wtbigshop_image_placeholder', $presets ); } /** * Convert HEX to RGB color * * @param $hex * * @return string */ public static function hex2rgb( $hex ) { $hex = str_replace( "#", "", $hex ); if ( strlen( $hex ) == 3 ) { $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) ); $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) ); $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) ); } else { $r = hexdec( substr( $hex, 0, 2 ) ); $g = hexdec( substr( $hex, 2, 2 ) ); $b = hexdec( substr( $hex, 4, 2 ) ); } $rgb = "$r, $g, $b"; return $rgb; } /** * Modify Color * Add positive or negative $steps. Ex: 30, -50 etc * * @param $hex * @param $steps * * @return string */ public static function modify_color( $hex, $steps ) { $steps = max( - 255, min( 255, $steps ) ); // Format the hex color string $hex = str_replace( '#', '', $hex ); if ( strlen( $hex ) == 3 ) { $hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 ); } // Get decimal values $r = hexdec( substr( $hex, 0, 2 ) ); $g = hexdec( substr( $hex, 2, 2 ) ); $b = hexdec( substr( $hex, 4, 2 ) ); // Adjust number of steps and keep it inside 0 to 255 $r = max( 0, min( 255, $r + $steps ) ); $g = max( 0, min( 255, $g + $steps ) ); $b = max( 0, min( 255, $b + $steps ) ); $r_hex = str_pad( dechex( $r ), 2, '0', STR_PAD_LEFT ); $g_hex = str_pad( dechex( $g ), 2, '0', STR_PAD_LEFT ); $b_hex = str_pad( dechex( $b ), 2, '0', STR_PAD_LEFT ); return '#' . $r_hex . $g_hex . $b_hex; } /** * Return Sidebar Column * @return string */ public static function sidebar_columns() { $columns = "col-xl-3"; return $columns; } /** * Return content columns * @return string */ public static function content_columns( $full_width_col = 'col-12' ) { $sidebar = Opt::$sidebar === 'default' ? 'rt-sidebar' : Opt::$sidebar; $columns = ! is_active_sidebar( $sidebar ) ? $full_width_col : 'col-xl-9'; if ( Opt::$layout === 'full-width' ) { $columns = $full_width_col; } return $columns; } public static function single_content_colums() { $sidebar = Opt::$sidebar === 'default' ? 'rt-single-sidebar' : Opt::$sidebar; $columns = is_active_sidebar( $sidebar ) ? "col-xl-9" : "col-xl-12"; if ( Opt::$layout === 'full-width' ) { $columns = "col-xl-12"; } return $columns; } public static function product_single_columns( $full_width_col = 'col-12' ) { $sidebar = Opt::$sidebar === 'default' ? 'rt-single-sidebar' : Opt::$sidebar; $columns = ! is_active_sidebar( $sidebar ) ? $full_width_col : 'col-xl-9'; if ( Opt::$layout === 'full-width' ) { $columns = $full_width_col; } return $columns; } /** * Get blog colum * @return mixed|string */ public static function blog_column() { if ( ! empty( $_REQUEST['column'] ) ) { return sanitize_text_field( $_REQUEST['column'] ); } $blog_colum_opt = wtbigshop_option( 'rt_blog_column' ) !== 'default' ? wtbigshop_option( 'rt_blog_column' ) : ''; $blog_sidebar = Opt::$sidebar === 'default' ? 'rt-sidebar' : Opt::$sidebar; $blog_layout = Opt::$layout ?? 'right-sidebar'; $output = 'col-lg-4'; if ( $blog_colum_opt ) { $output = $blog_colum_opt; } elseif ( wtbigshop_option( 'rt_blog_style' ) === 'list' ) { $output = 'col-lg-12'; } elseif ( in_array( $blog_layout, [ 'left-sidebar', 'right-sidebar' ] ) && is_active_sidebar( $blog_sidebar ) ) { $output = 'col-lg-6'; } return $output; } /** * Get all post type * @return array */ public static function get_post_types() { $post_types = get_post_types( [ 'public' => true, ], 'objects' ); $post_types = wp_list_pluck( $post_types, 'label', 'name' ); $exclude = apply_filters( 'wtbigshop_exclude_post_type', [ 'attachment', 'revision', 'nav_menu_item', 'elementor_library', 'tpg_builder', 'e-landing-page', 'elementor-wtbigshop' ] ); foreach ( $exclude as $ex ) { unset( $post_types[ $ex ] ); } return $post_types; } /** * Meta Style * @return array */ public static function meta_style( $exclude = [] ) { $meta_style = [ 'meta-style-default' => __( 'Default From Theme', 'bigshop' ), 'meta-style-border' => __( 'Border Style', 'bigshop' ), 'meta-style-dash' => __( 'Before Dash ( — )', 'bigshop' ), 'meta-style-dash-bg' => __( 'Before Dash with BG ( — )', 'bigshop' ), 'meta-style-pipe' => __( 'After Pipe ( | )', 'bigshop' ), ]; if ( ! empty( $exclude ) && is_array( $exclude ) ) { foreach ( $exclude as $item ) { unset( $meta_style[ $item ] ); } } return $meta_style; } /** * Single Style * @return array */ public static function single_post_style( $exclude = [] ) { $meta_style = [ '1' => __( 'Style 1 (Default From Theme)', 'bigshop' ), '2' => __( 'Style 2 (Full-width Thumbnail)', 'bigshop' ), '4' => __( 'Style 3 (Content over on Thumb)', 'bigshop' ), '5' => __( 'Style 4 (Meta over on Thumb)', 'bigshop' ), ]; if ( ! empty( $exclude ) && is_array( $exclude ) ) { foreach ( $exclude as $item ) { unset( $meta_style[ $item ] ); } } return $meta_style; } /** * Blog Meta Style * @return array */ public static function blog_meta_list() { return [ 'author' => __( 'Author', 'bigshop' ), 'date' => __( 'Date', 'bigshop' ), 'category' => __( 'Category', 'bigshop' ), 'tag' => __( 'Tag', 'bigshop' ), 'comment' => __( 'Comment', 'bigshop' ), 'reading' => __( 'Reading', 'bigshop' ), 'views' => __( 'Views', 'bigshop' ), ]; } /** * Post Social Meta * @return array */ public static function post_share_list() { return [ 'facebook' => __( 'Facebook', 'bigshop' ), 'twitter' => __( 'Twitter X', 'bigshop' ), 'linkedin' => __( 'Linkedin', 'bigshop' ), 'pinterest' => __( 'Pinterest', 'bigshop' ), 'whatsapp' => __( 'Whatsapp', 'bigshop' ), 'youtube' => __( 'Youtube', 'bigshop' ), ]; } public static function is_single_fullwidth() { if ( in_array( Opt::$single_style, [ 'rt-single-top-thumb', 'rt-single-transparent', 'rt-single-content-on-thumb' ] ) ) { return true; } return false; } public static function single_meta_lists() { $meta_list = wtbigshop_option( 'rt_single_meta', '', true ); return $meta_list; } /** * Class list * * @param $clsses * * @return string */ public static function class_list( $clsses ): string { return implode( ' ', $clsses ); } /** * Get all default sidebar args for theme * * @param $id * * @return array|mixed|null */ public static function default_sidebar( $id = '' ) { $sidebar_lists = [ 'main' => [ 'id' => 'rt-sidebar', 'name' => __( 'Main Sidebar', 'bigshop' ), 'class' => 'rt-sidebar', ], 'single' => [ 'id' => 'rt-single-sidebar', 'name' => __( 'Single Sidebar', 'bigshop' ), 'class' => 'rt-single-sidebar', ], 'footer' => [ 'id' => 'rt-footer-sidebar', 'name' => 'Footer Sidebar', 'class' => 'footer-sidebar col-lg-3 col-md-6', ], ]; if ( class_exists( 'WooCommerce' ) ) { $sidebar_lists['woo-archive'] = [ 'id' => 'rt-woo-archive-sidebar', 'name' => __( 'WooCommerce Archive Sidebar', 'bigshop' ), 'class' => 'woo-archive-sidebar', ]; $sidebar_lists['woo-single'] = [ 'id' => 'rt-woo-single-sidebar', 'name' => __( 'WooCommerce Single Sidebar', 'bigshop' ), 'class' => 'woo-single-sidebar', ]; } $sidebar_lists = apply_filters( 'wtbigshop_sidebar_lists', $sidebar_lists ); if ( ! $id ) { return $sidebar_lists; } if ( isset( $sidebar_lists[ $id ] ) ) { return $sidebar_lists[ $id ]['id']; } return []; } /*shop archive grid action*/ public static function shop_grid_page_url() { global $wp; $current_url = add_query_arg($wp->query_string, '&displayview=grid', home_url($wp->request)); return $current_url; } public static function shop_list_page_url() { global $wp; $current_url = add_query_arg($wp->query_string, '&displayview=list', home_url($wp->request)); return $current_url; } public static function wtbigshop_action_icons_enable( ) { return wtbigshop_option( 'rt_header_login_link' ) || wtbigshop_option( 'rt_header_wishlist' ) || wtbigshop_option( 'rt_header_add_to_cart' ) ? true:false; } }