'custom', 'type' => 'simple', 'size' => 'custom', 'fill' => false, 'hide_labels' => true ] ); $attr = [ 'data-type' => $args['type'], 'data-size' => $args['size'], 'data-color' => $args['icons-color'] ]; if ($args['fill']) { if ($args['type'] !== 'simple') { $attr['data-fill'] = $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($check_for_preview = false, $args = []) { $args = wp_parse_args( $args, [ 'html_atts' => [], 'type' => 'type-1' ] ); $old_args = $args['html_atts']; $args['html_atts'] = wp_parse_args($old_args, $args['html_atts']); $args['html_atts']['data-type'] = $args['type']; $after_content = ''; if ($args['type'] === 'type-2' || $check_for_preview) { $after_content = ' '; } return blocksy_get_social_box([ 'type' => 'share', 'root_class' => 'ct-share-box', 'class' => blocksy_visibility_classes( get_theme_mod('share_box_visibility', [ 'desktop' => true, 'tablet' => true, 'mobile' => false, ]) ), 'has_count' => $args['type'] === 'type-2' || $check_for_preview, 'attr' => $args['html_atts'], 'after_links_content' => $after_content, 'force_output' => $check_for_preview ]); } } 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' => ' ', ], 'medium' => [ 'name' => 'Medium', 'icon' => ' ' ], 'slack' => [ 'name' => 'Slack', 'icon' => ' ' ], 'reddit' => [ 'name' => __( 'Reddit', 'blocksy' ), 'icon' => ' ', ], 'spotify' => [ 'name' => __( 'Spotify', 'blocksy' ), 'icon' => ' ', ], 'patreon' => [ 'name' => 'Patreon', 'icon' => ' ' ], 'github' => [ 'name' => 'GitHub', 'icon' => ' ' ], 'youtube' => [ 'name' => 'YouTube', 'icon' => ' ' ], 'vimeo' => [ 'name' => 'Vimeo', 'icon' => ' ' ], 'vk' => [ 'name' => __( 'VK', 'blocksy' ), 'icon' => ' ', ], 'ok' => [ 'name' => __( 'Odnoklassniki', 'blocksy' ), 'icon' => ' ', ], 'rss' => [ 'name' => 'RSS', 'icon' => ' ' ], 'facebook_group' => [ 'name' => __( 'Facebook Group', 'blocksy' ), 'icon' => ' ', ], 'hacker_news' => [ 'name' => __( 'Hacker News', 'blocksy' ), 'icon' => ' ', ], 'xing' => [ 'name' => 'Xing', 'icon' => ' ' ], 'whatsapp' => [ 'name' => __( 'WhatsApp', 'blocksy' ), 'icon' => ' ', ], 'viber' => [ 'name' => __( 'Viber', 'blocksy' ), 'icon' => ' ', ], 'telegram' => [ 'name' => __( 'Telegram', 'blocksy' ), 'icon' => ' ', ], 'weibo' => [ 'name' => 'Weibo', 'icon' => ' ' ], 'tumblr' => [ 'name' => 'Tumblr', 'icon' => ' ' ], 'qq' => [ 'name' => 'QQ', 'icon' => ' ' ], 'wechat' => [ 'name' => 'WeChat', '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}', 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() { return [ [ 'id' => 'facebook', 'enabled' => get_theme_mod('share_facebook', 'yes') === 'yes', ], [ 'id' => 'twitter', 'enabled' => get_theme_mod('share_twitter', 'yes') === 'yes', ], [ 'enabled' => get_theme_mod('share_pinterest', 'yes') === 'yes', 'id' => 'pinterest', ], [ 'enabled' => get_theme_mod('share_linkedin', 'yes') === 'yes', 'id' => 'linkedin', ], [ 'enabled' => get_theme_mod('share_reddit', 'no') === 'yes', 'id' => 'reddit', ], [ 'enabled' => get_theme_mod('share_hacker_news', 'no') === 'yes', 'id' => 'hacker_news', ], [ 'enabled' => get_theme_mod('share_vk', 'no') === 'yes', 'id' => 'vk', ], [ 'enabled' => get_theme_mod('share_ok', 'no') === 'yes', 'id' => 'ok', ], [ 'enabled' => get_theme_mod('share_telegram', 'no') === 'yes', 'id' => 'telegram', ], [ 'enabled' => get_theme_mod('share_viber', 'no') === 'yes', 'id' => 'viber', ], [ 'enabled' => get_theme_mod('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' => 'medium', 'enabled' => true, ], [ 'id' => 'slack', 'enabled' => true, ], [ 'id' => 'reddit', 'enabled' => true, ], [ 'id' => 'spotify', 'enabled' => true, ], [ 'id' => 'patreon', 'enabled' => true, ], [ 'id' => 'github', 'enabled' => true, ], [ 'id' => 'youtube', 'enabled' => true, ], [ 'id' => 'vimeo', 'enabled' => true, ], [ 'id' => 'facebook_group', '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, ], ]; } } 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' => '', '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']) { $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(); ?>
> $args['type'], 'social' => $single_social['id'] ]); $label_attr = ['class' => 'ct-label']; if ($args['hide_labels']) { $label_attr['hidden'] = ''; } ?> >
'!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')', ]; return strtr( rawurlencode( $str ), $revert ); } }