[], 'type' => 'type-1' ] ); $old_args = $args['html_atts']; $args['html_atts'] = [ 'class' => 'share-box', ]; $args['html_atts']['class'] .= ' ' . blocksy_visibility_classes( get_theme_mod('share_box_visibility', [ 'desktop' => true, 'tablet' => true, 'mobile' => false, ]) ); $args['html_atts'] = wp_parse_args($old_args, $args['html_atts']); $args['html_atts']['data-type'] = $args['type']; $social_urls = [ 'facebook' => str_replace( '{url}', $home_url, 'https://www.facebook.com/sharer/sharer.php?u={url}' ), 'twitter' => str_replace( '{url}', $home_url, 'https://twitter.com/share?url={url}' ), 'pinterest' => str_replace( '{url}', $home_url, '#' ), 'linkedin' => str_replace( '{url}', $home_url, 'https://www.linkedin.com/shareArticle?url={url}' ), 'reddit' => str_replace( '{url}', $home_url, 'http://www.reddit.com/submit?url={url}' ), 'vk' => str_replace( '{url}', $home_url, 'http://vk.com/share.php?url={url}' ), 'ok' => str_replace( '{url}', $home_url, 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl={url}' ), 'telegram' => str_replace( '{url}', $home_url, 'https://t.me/share/url?url={url}' ), ]; $all_links = []; $share_box_networks = [ [ 'for' => 'facebook', 'enabled' => get_theme_mod( 'share_facebook', 'yes' ) === 'yes' || $check_for_preview, 'name' => __( 'Facebook', 'blocksy' ), 'icon' => ' ', ], [ 'for' => 'twitter', 'enabled' => get_theme_mod( 'share_twitter', 'yes' ) === 'yes' || $check_for_preview, 'name' => __( 'Twitter', 'blocksy' ), 'icon' => ' ', ], [ 'enabled' => get_theme_mod( 'share_pinterest', 'yes' ) === 'yes' || $check_for_preview, 'for' => 'pinterest', 'name' => __( 'Pinterest', 'blocksy' ), 'icon' => ' ', ], [ 'enabled' => get_theme_mod( 'share_linkedin', 'yes' ) === 'yes' || $check_for_preview, 'for' => 'linkedin', 'name' => __( 'LinkedIn', 'blocksy' ), 'icon' => ' ', ], [ 'enabled' => false, 'for' => 'reddit', 'name' => __( 'Reddit', 'blocksy' ), 'icon' => ' ', ], [ 'enabled' => get_theme_mod( 'share_vk', 'no' ) === 'yes' || $check_for_preview, 'for' => 'vk', 'name' => __( 'VK', 'blocksy' ), 'icon' => ' ', ], [ 'enabled' => get_theme_mod( 'share_ok', 'no' ) === 'yes' || $check_for_preview, 'for' => 'ok', 'name' => __( 'Odnoklassniki', 'blocksy' ), 'icon' => ' ', ], [ 'enabled' => get_theme_mod( 'share_telegram', 'no' ) === 'yes' || $check_for_preview, 'for' => 'telegram', 'name' => __( 'Telegram', 'blocksy' ), 'icon' => ' ', ], ]; if ( ! is_array( $share_box_networks ) ) { return ''; } if ( count( $share_box_networks ) === 0 ) { return ''; } $has_enabled_network = 0; foreach ( $share_box_networks as $share_network ) { if ( $share_network['enabled'] ) { $has_enabled_network++; } } if ($args['type'] === 'type-2' || $check_for_preview) { $args['html_atts']['data-count'] = $has_enabled_network; } if ( ! $has_enabled_network ) { return ''; } ob_start(); ?>
'!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')', ]; return strtr( rawurlencode( $str ), $revert ); }