'custom', 'type' => 'simple', 'size' => 'custom', 'fill' => false, 'hide_labels' => true ] ); $attr = [ 'data-icon-size' => $args['size'], 'data-color' => $args['icons-color'] ]; // if ($args['type'] !== 'simple') { $attr['data-icons-type'] = $args['type']; // } if ($args['fill']) { if ($args['type'] !== 'simple') { $attr['data-icons-type'] .= ':' . $args['fill']; } } return blocksy_get_social_box([ 'attr' => $attr, 'socials' => $socials_descriptor, 'hide_labels' => $args['hide_labels'] ]); } } /** * Get social share box. */ if (! function_exists('blocksy_get_social_share_box')) { function blocksy_get_social_share_box($args = []) { $args = wp_parse_args( $args, [ 'html_atts' => [], 'type' => 'type-1' ] ); $prefix = blocksy_manager()->screen->get_prefix(); $old_args = $args['html_atts']; $args['html_atts'] = wp_parse_args($old_args, $args['html_atts']); $args['html_atts']['data-type'] = $args['type']; $before_content = ''; $after_content = ''; if ( $args['type'] === 'type-1' && get_theme_mod($prefix . '_has_share_box_title', 'no') === 'yes' ) { $before_content = blocksy_html_tag( 'span', [ 'class' => 'ct-module-title' ], get_theme_mod( $prefix . '_share_box_title', __('Share your love', 'blocksy') ) ); } if ($args['type'] === 'type-2') { $after_content = ' '; } return blocksy_get_social_box([ 'type' => 'share', 'root_class' => 'ct-share-box', 'class' => blocksy_visibility_classes( get_theme_mod($prefix . '_share_box_visibility', [ 'desktop' => true, 'tablet' => true, 'mobile' => false, ]) ), 'has_count' => $args['type'] === 'type-2', 'attr' => $args['html_atts'], 'links_wrapper' => $args['type'] === 'type-1' ? 'div' : null, 'before_links_content' => $before_content, 'after_links_content' => $after_content ]); } } if (! function_exists('blocksy_get_social_metadata')) { function blocksy_get_social_metadata($args = []) { $args = wp_parse_args( $args, [ // url | share 'type' => 'url', 'social' => null, ] ); $metadata = [ 'facebook' => [ 'name' => __( 'Facebook', 'blocksy' ), 'icon' => ' ', ], 'twitter' => [ 'name' => __( 'Twitter', 'blocksy' ), 'icon' => ' ', ], 'instagram' => [ 'name' => 'Instagram', 'icon' => ' ' ], 'pinterest' => [ 'name' => __( 'Pinterest', 'blocksy' ), 'icon' => ' ', ], 'dribbble' => [ 'name' => 'Dribbble', 'icon' => ' ' ], 'behance' => [ 'name' => 'Behance', 'icon' => ' ' ], 'linkedin' => [ 'name' => __( 'LinkedIn', 'blocksy' ), 'icon' => ' ', ], 'wordpress' => [ 'name' => 'WordPress', 'icon' => ' ', ], 'parler' => [ 'name' => __( 'Parler', 'blocksy' ), 'icon' => ' ', ], 'medium' => [ 'name' => 'Medium', 'icon' => ' ' ], 'slack' => [ 'name' => 'Slack', 'icon' => ' ' ], 'codepen' => [ 'name' => 'CodePen', 'icon' => ' ' ], 'reddit' => [ 'name' => 'Reddit', 'icon' => ' ', ], 'twitch' => [ 'name' => 'Twitch', 'icon' => ' ', ], 'tiktok' => [ 'name' => 'TikTok', 'icon' => ' ', ], 'snapchat' => [ 'name' => 'Snapchat', 'icon' => ' ', ], 'spotify' => [ 'name' => 'Spotify', 'icon' => ' ', ], 'patreon' => [ 'name' => 'Patreon', 'icon' => ' ' ], 'skype' => [ 'name' => 'Skype', 'icon' => ' ' ], 'github' => [ 'name' => 'GitHub', 'icon' => ' ' ], 'gitlab' => [ 'name' => 'GitLab', 'icon' => ' ' ], 'youtube' => [ 'name' => 'YouTube', 'icon' => ' ' ], 'vimeo' => [ 'name' => 'Vimeo', 'icon' => ' ' ], 'dtube' => [ 'name' => 'DTube', 'icon' => ' ' ], 'vk' => [ 'name' => 'VK', 'icon' => ' ', ], 'ok' => [ 'name' => 'Odnoklassniki', 'icon' => ' ', ], 'rss' => [ 'name' => 'RSS', 'icon' => ' ' ], 'facebook_group' => [ 'name' => 'Facebook Group', 'icon' => ' ', ], 'discord' => [ 'name' => 'Discord', 'icon' => ' ', ], 'hacker_news' => [ 'name' => 'Hacker News', 'icon' => ' ', ], 'xing' => [ 'name' => 'Xing', 'icon' => ' ' ], 'whatsapp' => [ 'name' => 'WhatsApp', 'icon' => ' ', ], 'viber' => [ 'name' => 'Viber', 'icon' => ' ', ], 'telegram' => [ 'name' => 'Telegram', 'icon' => ' ', ], 'weibo' => [ 'name' => 'Weibo', 'icon' => ' ' ], 'tumblr' => [ 'name' => 'Tumblr', 'icon' => ' ' ], 'qq' => [ 'name' => 'QQ', 'icon' => ' ' ], 'wechat' => [ 'name' => 'WeChat', 'icon' => ' ' ], 'strava' => [ 'name' => 'Strava', 'icon' => ' ' ], 'phone' => [ 'name' => 'Phone', 'icon' => ' ' ], 'email' => [ 'name' => 'Email', 'icon' => ' ' ], ]; if (! $args['social']) { return null; } if (! isset($metadata[$args['social']])) { return null; } $single_metadata = $metadata[$args['social']]; $single_metadata['url'] = ''; if ($args['type'] === 'url') { $single_metadata['url'] = get_theme_mod($args['social'], '#'); if (empty(trim($single_metadata['url']))) { $single_metadata['url'] = '#'; } } if ($args['type'] === 'share') { $home_url = blocksy_encode_uri_component( get_the_permalink() ); $social_urls = [ 'facebook' => 'https://www.facebook.com/sharer/sharer.php?u={url}', 'twitter' => 'https://twitter.com/share?url={url}&text={text}', 'pinterest' => '#', 'linkedin' => 'https://www.linkedin.com/shareArticle?url={url}&title={text}', 'reddit' => 'https://reddit.com/submit?url={url}&title={text}', 'hacker_news' => 'https://news.ycombinator.com/submitlink?u={url}&t={text}', 'vk' => 'http://vk.com/share.php?url={url}&title={text}', 'ok' => 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl={url}', 'telegram' => 'https://t.me/share/url?url={url}&text={text}', 'viber' => 'viber://forward?{url}=This+is+the+content', 'whatsapp' => 'whatsapp://send?text={url}' ]; if (isset($social_urls[$args['social']])) { $single_metadata['url'] = str_replace( '{url}', $home_url, str_replace( '{text}', blocksy_encode_uri_component(get_the_title()), $social_urls[$args['social']] ) ); } else { $single_metadata['url'] = '#'; } } return $single_metadata; } } if (! function_exists('blocksy_get_social_share_items')) { function blocksy_get_social_share_items() { $prefix = blocksy_manager()->screen->get_prefix(); return [ [ 'id' => 'facebook', 'enabled' => get_theme_mod( $prefix . '_share_facebook', 'yes' ) === 'yes', ], [ 'id' => 'twitter', 'enabled' => get_theme_mod( $prefix . '_share_twitter', 'yes' ) === 'yes', ], [ 'enabled' => get_theme_mod( $prefix . '_share_pinterest', 'yes' ) === 'yes', 'id' => 'pinterest', ], [ 'enabled' => get_theme_mod( $prefix . '_share_linkedin', 'yes' ) === 'yes', 'id' => 'linkedin', ], [ 'enabled' => get_theme_mod( $prefix . '_share_reddit', 'no' ) === 'yes', 'id' => 'reddit', ], [ 'enabled' => get_theme_mod( $prefix . '_share_hacker_news', 'no' ) === 'yes', 'id' => 'hacker_news', ], [ 'enabled' => get_theme_mod( $prefix . '_share_vk', 'no' ) === 'yes', 'id' => 'vk', ], [ 'enabled' => get_theme_mod( $prefix . '_share_ok', 'no' ) === 'yes', 'id' => 'ok', ], [ 'enabled' => get_theme_mod( $prefix . '_share_telegram', 'no' ) === 'yes', 'id' => 'telegram', ], [ 'enabled' => get_theme_mod( $prefix . '_share_viber', 'no' ) === 'yes', 'id' => 'viber', ], [ 'enabled' => get_theme_mod( $prefix . '_share_whatsapp', 'no' ) === 'yes', 'id' => 'whatsapp', ], ]; } } if (! function_exists('blockst_get_social_url_items')) { function blockst_get_social_url_items() { return [ [ 'id' => 'facebook', 'enabled' => true, ], [ 'id' => 'twitter', 'enabled' => true, ], [ 'id' => 'instagram', 'enabled' => true, ], [ 'id' => 'pinterest', 'enabled' => true, ], [ 'id' => 'dribbble', 'enabled' => true, ], [ 'id' => 'behance', 'enabled' => true, ], [ 'id' => 'linkedin', 'enabled' => true, ], [ 'id' => 'wordpress', 'enabled' => true, ], [ 'id' => 'parler', 'enabled' => true, ], [ 'id' => 'medium', 'enabled' => true, ], [ 'id' => 'slack', 'enabled' => true, ], [ 'id' => 'codepen', 'enabled' => true, ], [ 'id' => 'reddit', 'enabled' => true, ], [ 'id' => 'twitch', 'enabled' => true, ], [ 'id' => 'tiktok', 'enabled' => true, ], [ 'id' => 'snapchat', 'enabled' => true, ], [ 'id' => 'spotify', 'enabled' => true, ], [ 'id' => 'patreon', 'enabled' => true, ], [ 'id' => 'skype', 'enabled' => true, ], [ 'id' => 'github', 'enabled' => true, ], [ 'id' => 'gitlab', 'enabled' => true, ], [ 'id' => 'youtube', 'enabled' => true, ], [ 'id' => 'vimeo', 'enabled' => true, ], [ 'id' => 'dtube', 'enabled' => true, ], [ 'id' => 'facebook_group', 'enabled' => true, ], [ 'id' => 'discord', 'enabled' => true, ], [ 'id' => 'vk', 'enabled' => true, ], [ 'id' => 'ok', 'enabled' => true, ], [ 'id' => 'rss', 'enabled' => true, ], [ 'id' => 'xing', 'enabled' => true, ], [ 'id' => 'whatsapp', 'enabled' => true, ], [ 'id' => 'viber', 'enabled' => true, ], [ 'id' => 'telegram', 'enabled' => true, ], [ 'id' => 'weibo', 'enabled' => true, ], [ 'id' => 'tumblr', 'enabled' => true, ], [ 'id' => 'qq', 'enabled' => true, ], [ 'id' => 'wechat', 'enabled' => true, ], [ 'id' => 'strava', 'enabled' => true, ], [ 'id' => 'phone', 'enabled' => true, ], [ 'id' => 'email', 'enabled' => true, ], ]; } } if (! function_exists('blocksy_get_social_box')) { function blocksy_get_social_box($args = []) { $args = wp_parse_args( $args, [ // url | share 'type' => 'url', 'socials' => null, 'attr' => [], 'class' => '', 'before_links_content' => '', 'links_wrapper' => null, 'after_links_content' => '', 'has_count' => false, 'hide_labels' => false, 'root_class' => 'ct-social-box', 'force_output' => false ] ); if ($args['type'] === 'share') { $args['socials'] = blocksy_get_social_share_items(); } if ($args['socials'] === null) { $args['socials'] = blockst_get_social_url_items(); } $has_any_social = 0; foreach ($args['socials'] as $single_social) { if ( ! isset($single_social['enabled']) || ( isset($single_social['enabled']) && $single_social['enabled'] ) || $args['force_output'] ) { $has_any_social++; } } if (! $has_any_social) { return ''; } $old_attr = []; $old_attr['class'] = $args['root_class']; if (! empty($args['class'])) { $old_attr['class'] .= ' ' . $args['class']; } if ($args['type'] === 'share') { // $old_attr['data-behavior'] = 'share'; } if ($args['has_count']) { $old_attr['data-count'] = $has_any_social; } $old_attr = array_merge($old_attr, $args['attr']); ob_start(); ?>