'custom', 'type' => 'simple', 'size' => 'custom', 'fill' => false, 'label_attr' => [], 'label_visibility' => [ 'desktop' => false, 'tablet' => false, 'mobile' => false, ], 'links_target' => false, 'links_rel' => false, 'enable_shortcut' => false ] ); $attr = [ 'data-color' => $args['icons-color'] ]; if (! empty($args['size'])) { $attr['data-icon-size'] = $args['size']; } // 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, 'label_attr' => $args['label_attr'], 'label_visibility' => $args['label_visibility'], 'links_target' => $args['links_target'], 'links_rel' => $args['links_rel'], 'enable_shortcut' => $args['enable_shortcut'] ]); } } /** * 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' => [], 'links_wrapper_attr' => [], 'type' => 'type-1', 'custom_share_url' => '', 'strategy' => [ 'strategy' => 'customizer', 'prefix' => blocksy_manager()->screen->get_prefix() ], 'enable_shortcut' => false ] ); if (! isset($args['html_atts']['data-type'])) { $args['html_atts']['data-type'] = $args['type']; } $before_content = ''; $after_content = ''; $module_title = blocksy_akg_or_customizer('share_box_title', $args['strategy'], __('Share your love', 'blocksy')); $module_title_tag = blocksy_akg_or_customizer('share_box_title_tag', $args['strategy'], 'span'); if (!empty($module_title) || is_customize_preview()) { $before_content = blocksy_html_tag( $module_title_tag, [ 'class' => 'ct-module-title' ], $module_title ); } if ($args['type'] === 'type-1') { $args['links_wrapper_attr']['data-icons-type'] = 'simple'; } if ($args['type'] === 'type-2') { $args['links_wrapper_attr']['data-icons-type'] = 'custom:solid'; } return blocksy_get_social_box([ 'type' => 'share', 'root_class' => 'ct-share-box', 'class' => blocksy_visibility_classes( blocksy_akg_or_customizer( 'share_box_visibility', $args['strategy'], [ 'desktop' => true, 'tablet' => true, 'mobile' => false, ] ) ), // 'has_count' => $args['type'] === 'type-2', 'attr' => $args['html_atts'], // 'links_wrapper' => $args['type'] === 'type-1' ? 'div' : null, 'links_wrapper' => 'div', 'links_wrapper_attr' => $args['links_wrapper_attr'], 'before_links_content' => $before_content, 'after_links_content' => $after_content, 'custom_share_url' => $args['custom_share_url'], 'links_rel' => blocksy_akg_or_customizer( 'share_links_nofollow', $args['strategy'], 'yes' ) === 'yes' ? 'noopener noreferrer nofollow' : 'noopener', 'strategy' => $args['strategy'], 'enable_shortcut' => $args['enable_shortcut'] ]); } } if (! function_exists('blocksy_get_dynamic_social_networks')) { function blocksy_get_dynamic_social_networks() { $networks = apply_filters( 'blocksy:social-box:dynamic-social-networks', [] ); foreach ($networks as $network) { blocksy_assert_args($network, ['id', 'name', 'icon']); } return $networks; } } if (! function_exists('blocksy_get_social_metadata')) { function blocksy_get_social_metadata($args = []) { $args = wp_parse_args( $args, [ // url | share 'type' => 'url', 'custom_url' => '', 'social' => null, ] ); $metadata = [ 'facebook' => [ 'name' => 'Facebook', 'icon' => ' ' ], 'twitter' => [ 'name' => 'X (Twitter)', 'icon' => ' ' ], 'instagram' => [ 'name' => 'Instagram', 'icon' => ' ' ], 'threads' => [ 'name' => 'Threads', 'icon' => ' ' ], 'pinterest' => [ 'name' => 'Pinterest', 'icon' => ' ' ], 'dribbble' => [ 'name' => 'Dribbble', 'icon' => ' ' ], 'deviantart' => [ 'name' => 'Deviantart', 'icon' => ' ' ], 'behance' => [ 'name' => 'Behance', 'icon' => ' ' ], 'unsplash' => [ 'name' => 'Unsplash', 'icon' => ' ' ], 'five-hundred-px' => [ 'name' => '500px', 'icon' => ' ' ], 'linkedin' => [ 'name' => 'LinkedIn', 'icon' => ' ' ], 'wordpress' => [ 'name' => 'WordPress', 'icon' => ' ' ], 'parler' => [ 'name' => 'Parler', 'icon' => ' ' ], 'mastodon' => [ 'name' => 'Mastodon', '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' => ' ' ], 'soundcloud' => [ 'name' => 'SoundCloud', 'icon' => ' ' ], 'bandcamp' => [ 'name' => 'Bandcamp', 'icon' => ' ' ], 'apple_podcast' => [ 'name' => __( 'Apple Podcasts', 'blocksy' ), 'icon' => ' ' ], 'patreon' => [ 'name' => 'Patreon', 'icon' => ' ' ], 'alignable' => [ 'name' => 'Alignable', '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', 'blocksy' ), 'icon' => ' ' ], 'ok' => [ 'name' => __( 'Odnoklassniki', 'blocksy' ), 'icon' => ' ' ], 'rss' => [ 'name' => 'RSS', 'icon' => ' ' ], 'facebook_group' => [ 'name' => __( 'Facebook Group', 'blocksy' ), 'icon' => ' ' ], 'facebook_messenger' => [ 'name' => __( 'Facebook Messenger', 'blocksy' ), 'icon' => ' ' ], 'discord' => [ 'name' => 'Discord', 'icon' => ' ' ], 'tripadvisor' => [ 'name' => 'TripAdvisor', 'icon' => ' ' ], 'foursquare' => [ 'name' => 'Foursquare', 'icon' => ' ' ], 'yelp' => [ 'name' => 'Yelp', 'icon' => ' ' ], 'hacker_news' => [ 'name' => 'Hacker News', 'icon' => ' ' ], 'xing' => [ 'name' => 'Xing', 'icon' => ' ' ], 'whatsapp' => [ 'name' => 'WhatsApp', 'icon' => ' ' ], 'flipboard' => [ 'name' => 'Flipboard', 'icon' => ' ' ], 'viber' => [ 'name' => 'Viber', 'icon' => ' ' ], 'telegram' => [ 'name' => 'Telegram', 'icon' => ' ' ], 'line' => [ 'name' => 'Line', 'icon' => ' ' ], 'weibo' => [ 'name' => 'Weibo', 'icon' => ' ' ], 'tumblr' => [ 'name' => 'Tumblr', 'icon' => ' ' ], 'qq' => [ 'name' => 'QQ', 'icon' => ' ' ], 'wechat' => [ 'name' => 'WeChat', 'icon' => ' ' ], 'strava' => [ 'name' => 'Strava', 'icon' => ' ' ], 'flickr' => [ 'name' => 'Flickr', 'icon' => ' ' ], 'phone' => [ 'name' => __( 'Phone', 'blocksy' ), 'icon' => ' ' ], 'email' => [ 'name' => __( 'Email', 'blocksy' ), 'icon' => ' ' ], ]; foreach (blocksy_get_dynamic_social_networks() as $dynamic_network) { $metadata[$dynamic_network['id']] = [ 'name' => $dynamic_network['name'], 'icon' => $dynamic_network['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'] = blocksy_get_theme_mod($args['social'], '#'); if (empty(trim($single_metadata['url']))) { $single_metadata['url'] = '#'; } if ( $args['social'] === 'email' && strpos($single_metadata['url'], 'mailto:') === false && strpos($single_metadata['url'], '@') !== false ) { $single_metadata['url'] = 'mailto:' . $single_metadata['url']; } } if ($args['type'] === 'share') { $home_url = blocksy_encode_uri_component( get_the_permalink() ); if (! empty($args['custom_url'])) { $home_url = blocksy_encode_uri_component($args['custom_url']); } $social_urls = [ 'facebook' => 'https://www.facebook.com/sharer/sharer.php?u={url}', 'twitter' => 'https://twitter.com/intent/tweet?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?text={url}', 'whatsapp' => 'whatsapp://send?text={url}', 'flipboard' => 'https://share.flipboard.com/bookmarklet/popout?v=2&title={text}&url={url}', 'email' => 'mailto:?subject={text}&body={url}' ]; if (isset($social_urls[$args['social']])) { $single_metadata['url'] = str_replace( '{url}', $home_url, str_replace( '{text}', blocksy_encode_uri_component( strip_tags(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($args = []) { $args = wp_parse_args( $args, [ 'strategy' => [ 'strategy' => 'customizer', 'prefix' => blocksy_manager()->screen->get_prefix() ] ] ); return [ [ 'id' => 'facebook', 'enabled' => blocksy_akg_or_customizer( 'share_facebook', $args['strategy'], 'yes' ) === 'yes' ], [ 'id' => 'twitter', 'enabled' => blocksy_akg_or_customizer( 'share_twitter', $args['strategy'], 'yes' ) === 'yes', ], [ 'id' => 'pinterest', 'enabled' => blocksy_akg_or_customizer( 'share_pinterest', $args['strategy'], 'yes' ) === 'yes' ], [ 'id' => 'linkedin', 'enabled' => blocksy_akg_or_customizer( 'share_linkedin', $args['strategy'], 'yes' ) === 'yes', ], [ 'id' => 'reddit', 'enabled' => blocksy_akg_or_customizer( 'share_reddit', $args['strategy'], 'no' ) === 'yes', ], [ 'id' => 'hacker_news', 'enabled' => blocksy_akg_or_customizer( 'share_hacker_news', $args['strategy'], 'no' ) === 'yes', ], [ 'id' => 'vk', 'enabled' => blocksy_akg_or_customizer( 'share_vk', $args['strategy'], 'no' ) === 'yes', ], [ 'id' => 'ok', 'enabled' => blocksy_akg_or_customizer( 'share_ok', $args['strategy'], 'no' ) === 'yes', ], [ 'id' => 'telegram', 'enabled' => blocksy_akg_or_customizer( 'share_telegram', $args['strategy'], 'no' ) === 'yes', ], [ 'id' => 'viber', 'enabled' => blocksy_akg_or_customizer( 'share_viber', $args['strategy'], 'no' ) === 'yes', ], [ 'id' => 'whatsapp', 'enabled' => blocksy_akg_or_customizer( 'share_whatsapp', $args['strategy'], 'no' ) === 'yes', ], [ 'id' => 'flipboard', 'enabled' => blocksy_akg_or_customizer( 'share_flipboard', $args['strategy'], 'no' ) === 'yes', ], [ 'id' => 'email', 'enabled' => blocksy_akg_or_customizer( 'share_email', $args['strategy'], 'no' ) === 'yes', ], ]; } } 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, 'links_wrapper_attr' => [], 'after_links_content' => '', 'has_count' => false, 'label_attr' => [], 'label_visibility' => [ 'desktop' => false, 'tablet' => false, 'mobile' => false, ], 'root_class' => 'ct-social-box', 'force_output' => false, 'custom_share_url' => '', 'links_target' => false, 'links_rel' => false, 'icon_source' => 'default', 'url_source' => 'default', 'icon' => '', 'custom_url' => '', 'strategy' => [ 'prefix' => blocksy_manager()->screen->get_prefix(), 'strategy' => 'customizer' ], 'enable_shortcut' => false ] ); if ($args['type'] === 'share') { $args['socials'] = blocksy_get_social_share_items([ 'strategy' => $args['strategy'] ]); } if ($args['socials'] === null) { $args['socials'] = []; foreach (blocksy_get_social_networks_list() as $network_id => $network) { $args['socials'][] = [ 'id' => $network_id, 'enabled' => true ]; } } $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']); $official_colors = [ 'facebook' => '#557dbc', 'facebook_group' => '#3d87fb', 'facebook_messenger' => '#1887FC', 'discord' => '#7187d4', 'tripadvisor' => '#40dfa3', 'foursquare' => '#f84a7a', 'yelp' => '#ca252a', 'twitter' => '#000000', 'instagram' => '#ed1376', 'threads' => '#101010', 'pinterest' => '#ea575a', 'dribbble' => '#d77ea6', 'deviantart' => '#00e59b', 'behance' => '#1b64f6', 'unsplash' => '#000000', 'five-hundred-px' => '#000000', 'linkedin' => '#1c86c6', 'parler' => '#bc2131', 'mastodon' => '#368ad2', 'medium' => '#292929', 'slack' => '#4e1850', 'codepen' => '#000000', 'reddit' => '#fc471e', 'twitch' => '#9150fb', 'tiktok' => '#000000', 'snapchat' => '#f9d821', 'spotify' => '#2ab859', 'soundcloud' => '#fd561f', 'bandcamp' => '#4C9EBF', 'apple_podcast' => '#933ac3', 'patreon' => '#e65c4b', 'alignable' => '#4a396f', 'vk' => '#5382b6', 'youtube' => '#FF0000', 'dtube' => '#233253', 'vimeo' => '#8ecfde', 'rss' => '#f09124', 'whatsapp' => '#5bba67', 'viber' => '#7f509e', 'telegram' => '#229cce', 'line' => '#20be60', 'xing' => '#0a5c5d', 'weibo' => '#e41c34', 'tumblr' => '#314255', 'qq' => '#487fc8', 'wechat' => '#2dc121', 'strava' => '#2dc121', 'flickr' => '#0f64d1', 'phone' => '#244371', 'email' => '#392c44', 'github' => '#24292e', 'gitlab' => '#f8713f', 'skype' => '#1caae7', 'wordpress' => '#1074a8', 'hacker_news' => '#fd6721', 'ok' => '#eb7e2f', 'flipboard' => '#c40812', ]; $prefix = blocksy_manager()->screen->get_prefix(); $deep_link_args = [ 'prefix' => $prefix, 'suffix' => $prefix . '_has_share_box' ]; ob_start(); ?>
> '; } ?> $args['type'], 'social' => $single_social['id'], 'custom_url' => $args['custom_share_url'] ]); if (! $metadata) { continue; } $attr = [ 'href' => esc_url_raw( $metadata['url'], array_merge( wp_allowed_protocols(), [ 'viber', 'whatsapp', 'skype' ] ) ), // 'target' => '_blank', 'data-network' => $single_social['id'], 'aria-label' => $metadata['name'] ]; if (strpos($attr['href'], 'mailto:') !== false) { $attr['href'] = blocksy_safe_antispambot($attr['href']); } $url_source = blocksy_default_akg('url_source', $single_social, 'default'); if ( $url_source === 'custom' ) { $url = blocksy_default_akg('custom_url', $single_social, ''); $attr['href'] = sanitize_text_field($url); } if ( ( ( isset($args['links_wrapper_attr']['data-color']) && $args['links_wrapper_attr']['data-color'] === 'official' ) || ( isset($old_attr['data-color']) && $old_attr['data-color'] === 'official' ) ) && isset($official_colors[$single_social['id']]) ) { $attr['style'] = "--official-color: " . $official_colors[ $single_social['id'] ]; } if ($args['links_target']) { $attr['target'] = $args['links_target']; } if ($args['links_rel']) { $attr['rel'] = $args['links_rel']; } if (isset($attr['rel'])) { $attr['rel'] = trim($attr['rel']); } $class = 'ct-label'; if (isset($args['label_attr']['class'])) { if (! empty($args['label_attr']['class'])) { $class .= ' ' . $args['label_attr']['class']; } } $class .= ' ' . blocksy_visibility_classes( $args['label_visibility'] ); $label_attr = $args['label_attr']; $label_attr['class'] = $class; ?> > 'ct-icon-container' ], $metadata['icon'] ); if (function_exists('blc_get_icon')) { $icon_source = blocksy_default_akg('icon_source', $single_social, 'default'); if ( $icon_source === 'custom' ) { $icon = blc_get_icon([ 'icon_descriptor' => blocksy_akg( 'icon', $single_social, ['icon' => 'blc blc-email'] ), 'icon_html_atts' => [ 'aria-hidden' => 'true', ] ]); } } echo $icon; if ($args['type'] === 'url') { if ( blocksy_some_device($args['label_visibility']) || is_customize_preview() ) { echo blocksy_html_tag( 'span', $label_attr, $metadata['name'] ); } } } ?> '; } ?>
'!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')', ]; return strtr( rawurlencode( $str ), $revert ); } } if (! function_exists('blocksy_get_social_networks_list')) { function blocksy_get_social_networks_list() { $networks = [ 'alignable' => [ 'label' => 'Alignable', ], 'apple_podcast' => [ 'label' => __( 'Apple Podcasts', 'blocksy' ), ], 'behance' => [ 'label' => 'Behance', ], 'codepen' => [ 'label' => 'CodePen', ], 'dtube' => [ 'label' => 'DTube', ], 'discord' => [ 'label' => 'Discord', ], 'dribbble' => [ 'label' => 'Dribbble', ], 'deviantart' => [ 'label' => 'Deviantart', ], 'email' => [ 'label' => __( 'Email', 'blocksy' ), ], 'facebook' => [ 'label' => 'Facebook', ], 'facebook_group' => [ 'label' => __( 'Facebook Group', 'blocksy' ), ], 'facebook_messenger' => [ 'label' => __( 'Facebook Messenger', 'blocksy' ), ], 'flickr' => [ 'label' => 'Flickr', ], 'foursquare' => [ 'label' => 'Foursquare', ], 'github' => [ 'label' => 'GitHub', ], 'gitlab' => [ 'label' => 'GitLab', ], 'instagram' => [ 'label' => 'Instagram', ], 'threads' => [ 'label' => 'Threads', ], 'line' => [ 'label' => 'Line', ], 'linkedin' => [ 'label' => 'LinkedIn', ], 'mastodon' => [ 'label' => 'Mastodon', ], 'medium' => [ 'label' => 'Medium', ], 'ok' => [ 'label' => __( 'Odnoklassniki', 'blocksy' ), ], 'parler' => [ 'label' => 'Parler', ], 'patreon' => [ 'label' => 'Patreon', ], 'phone' => [ 'label' => __( 'Phone', 'blocksy' ), ], 'pinterest' => [ 'label' => 'Pinterest', ], 'qq' => [ 'label' => 'QQ', ], 'rss' => [ 'label' => 'RSS', ], 'reddit' => [ 'label' => 'Reddit', ], 'skype' => [ 'label' => 'Skype', ], 'slack' => [ 'label' => 'Slack', ], 'snapchat' => [ 'label' => 'Snapchat', ], 'soundcloud' => [ 'label' => 'SoundCloud', ], 'bandcamp' => [ 'label' => 'Bandcamp', ], 'spotify' => [ 'label' => 'Spotify', ], 'strava' => [ 'label' => 'Strava', ], 'telegram' => [ 'label' => 'Telegram', ], 'tiktok' => [ 'label' => 'TikTok', ], 'tripadvisor' => [ 'label' => 'TripAdvisor', ], 'tumblr' => [ 'label' => 'Tumblr', ], 'twitch' => [ 'label' => 'Twitch', ], 'twitter' => [ 'label' => 'X (Twitter)', ], 'unsplash' => [ 'label' => 'Unsplash', ], 'vk' => [ 'label' => __( 'VK', 'blocksy' ), ], 'viber' => [ 'label' => 'Viber', ], 'vimeo' => [ 'label' => 'Vimeo', ], 'wechat' => [ 'label' => 'WeChat', ], 'weibo' => [ 'label' => 'Weibo', ], 'whatsapp' => [ 'label' => 'WhatsApp', ], 'wordpress' => [ 'label' => 'WordPress', ], 'xing' => [ 'label' => 'Xing', ], 'yelp' => [ 'label' => 'Yelp', ], 'youtube' => [ 'label' => 'YouTube', ], 'five-hundred-px' => [ 'label' => '500px', ], ]; $dynamic_networks = blocksy_get_dynamic_social_networks(); foreach ($dynamic_networks as $network) { $networks[$network['id']] = [ 'label' => $network['name'] ]; } return $networks; } }