primary_content.php
134 lines
| 1 | <?php |
| 2 | |
| 3 | use WP_Social\App\Settings; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | |
| 8 | $uri_hash = md5($current_url); |
| 9 | |
| 10 | |
| 11 | if(!empty($styles[$selected_share_style]['package']) && $styles[$selected_share_style]['package'] == 'pro' && !WP_Social::is_pro_active()) { |
| 12 | |
| 13 | ?> |
| 14 | <div class="xs_social_share_widget xs_share_url"> |
| 15 | <ul> |
| 16 | <li class="xs-share-li wslu-no-extra-data">Pro plugin deactivated or invalid</li> |
| 17 | </ul> |
| 18 | </div> |
| 19 | <?php |
| 20 | |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | if(empty($wanted_providers)) { |
| 25 | |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | ?> |
| 30 | |
| 31 | <div class="xs_social_share_widget xs_share_url <?php echo esc_attr($widget_style) ?>"> |
| 32 | |
| 33 | <?php if($show_count_markup): ?> |
| 34 | |
| 35 | <div class="wslu-share-count"> |
| 36 | <span class="wslu-share-count--total"><?php echo esc_attr(xs_format_num($total_share_count)); ?></span> |
| 37 | <span class="wslu-share-count--text"><?php esc_html_e('Shares', 'wp-social') ?></span> |
| 38 | </div> |
| 39 | |
| 40 | <?php endif; ?> |
| 41 | |
| 42 | <ul> |
| 43 | <?php |
| 44 | $content = isset($styles[$selected_share_style]['content']) ? $styles[$selected_share_style]['content'] : ''; |
| 45 | |
| 46 | foreach($wanted_providers as $key => $inf) { |
| 47 | |
| 48 | $counter = $share_counting[$key]['count']; |
| 49 | |
| 50 | $label = isset($share_settings[$key]['data']['label']) ? $share_settings[$key]['data']['label'] : ucfirst($key); |
| 51 | $def = isset($share_settings[$key]['data']['value']) ? intval($share_settings[$key]['data']['value']) : 0; |
| 52 | $text = isset($share_settings[$key]['data']['text']) ? $share_settings[$key]['data']['text'] : ''; |
| 53 | |
| 54 | $getUrl = isset($core_provider[$key]['url']) ? $core_provider[$key]['url'] : ''; |
| 55 | $pData = isset($core_provider[$key]['params']) ? $core_provider[$key]['params'] : []; |
| 56 | |
| 57 | $urlCon = empty($core_provider[$key]['params']) ? [] : $core_provider[$key]['params']; |
| 58 | |
| 59 | $old_count = isset($share_settings[$key]['data']['old_count']) ? intval($share_settings[$key]['data']['old_count']) : 0; |
| 60 | $old_count = apply_filters('wp_social_pro/provider/share/old_count', $old_count, $key); |
| 61 | $counter = $counter + $old_count; |
| 62 | |
| 63 | foreach($urlCon as $k => $v) { |
| 64 | |
| 65 | $urlCon[$k] = str_replace( |
| 66 | ['[%url%]', '[%title%]', '[%author%]', '[%details%]', '[%source%]', '[%media%]', '[%app_id%]'], |
| 67 | [$current_url, $title, $author, $details, $source, $media, $app_id], |
| 68 | $v |
| 69 | ); |
| 70 | } |
| 71 | |
| 72 | $params = http_build_query($urlCon, '&'); |
| 73 | |
| 74 | $cls = $key . ' ' . $extra_data_cls; |
| 75 | |
| 76 | ?> |
| 77 | <li class="xs-share-li <?php echo esc_attr($cls) ?>"> |
| 78 | <a href="javascript:void();" |
| 79 | id="xs_feed_<?php echo esc_attr($key) ?>" |
| 80 | onclick="xs_social_sharer(this);" |
| 81 | data-pid="<?php echo esc_attr($postId) ?>" |
| 82 | data-uri_hash="<?php echo esc_attr($uri_hash) ?>" |
| 83 | data-key="<?php echo esc_attr($key); ?>" |
| 84 | data-xs-href="<?php echo esc_url($getUrl . '?' . $params); ?>"> |
| 85 | |
| 86 | <div class="xs-social-icon"> |
| 87 | <span class="met-social met-social-<?php echo esc_attr($key); ?>"> </span> |
| 88 | </div> |
| 89 | |
| 90 | <?php |
| 91 | |
| 92 | if(!empty($styles[$selected_share_style]['content']) != '') : ?> |
| 93 | <div class="wslu-both-counter-text "> |
| 94 | |
| 95 | <?php if(Settings::has_number_content_in_selected_style($selected_share_style, $styles)) : ?> |
| 96 | <div class="xs-social-follower"> |
| 97 | <?php echo esc_html(xs_format_num($counter)); ?> |
| 98 | </div> |
| 99 | <?php endif; ?> |
| 100 | |
| 101 | <?php if(Settings::has_text_content_in_selected_style($selected_share_style, $styles)) : ?> |
| 102 | <div class="xs-social-follower-text"> |
| 103 | <?php echo esc_html($text); ?> |
| 104 | </div> |
| 105 | <?php endif; ?> |
| 106 | |
| 107 | <?php if(Settings::has_label_content_in_selected_style($selected_share_style, $styles)) : ?> |
| 108 | <div class="xs-social-follower-label"> |
| 109 | <?php echo esc_html($label); ?> |
| 110 | </div> |
| 111 | <?php endif; ?> |
| 112 | </div> |
| 113 | <?php endif; ?> |
| 114 | |
| 115 | <div class="wslu-hover-content"> |
| 116 | <div class="xs-social-followers"> |
| 117 | <?php echo esc_html(xs_format_num($counter)); ?> |
| 118 | </div> |
| 119 | <div class="xs-social-follower-text"> |
| 120 | <?php echo esc_html($text); ?> |
| 121 | </div> |
| 122 | <div class="xs-social-follower-label"> |
| 123 | <?php echo esc_html($label); ?> |
| 124 | </div> |
| 125 | </div> |
| 126 | </a> |
| 127 | </li> |
| 128 | <?php |
| 129 | } ?> |
| 130 | </ul> |
| 131 | |
| 132 | </div> |
| 133 | <?php |
| 134 |