/** * Add Custom Styles with WP wp_add_inline_style Method * * @since 1.0 * * @return string */ function mashsb_styles_method() { global $mashsb_options; isset($mashsb_options['small_buttons']) ? $smallbuttons = true : ($smallbuttons = false); /* VARS */ isset($mashsb_options['share_color']) ? $share_color = $mashsb_options['share_color'] : ($share_color = ''); isset($mashsb_options['custom_css']) ? $custom_css = $mashsb_options['custom_css'] : ($custom_css = ''); isset($mashsb_options['button_width']) ? $button_width = $mashsb_options['button_width'] : ($button_width = ''); /* STYLES */ $mashsb_custom_css = "\n .mashsb-count {\n color: {$share_color};\n }"; if (!empty($mashsb_options['border_radius']) && $mashsb_options['border_radius'] != 'default') { $mashsb_custom_css .= ' [class^="mashicon-"], .onoffswitch-label, .onoffswitch2-label { border-radius: ' . $mashsb_options['border_radius'] . 'px; }'; } if (!empty($mashsb_options['mash_style']) && $mashsb_options['mash_style'] == 'shadow') { $mashsb_custom_css .= ' .mashsb-buttons a, .onoffswitch, .onoffswitch2, .onoffswitch-inner:before, .onoffswitch2-inner:before { -webkit-transition: all 0.07s ease-in; -moz-transition: all 0.07s ease-in; -ms-transition: all 0.07s ease-in; -o-transition: all 0.07s ease-in; transition: all 0.07s ease-in; box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.2),inset 0 -1px 0 0 rgba(0, 0, 0, 0.3); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); border: none; -moz-user-select: none; -webkit-font-smoothing: subpixel-antialiased; -webkit-transition: all linear .25s; -moz-transition: all linear .25s; -o-transition: all linear .25s; -ms-transition: all linear .25s; transition: all linear .25s; }'; } if (!empty($mashsb_options['mash_style']) && $mashsb_options['mash_style'] == 'gradiant') { $mashsb_custom_css .= ' .mashsb-buttons a { background-image: -webkit-linear-gradient(bottom,rgba(0, 0, 0, 0.17) 0%,rgba(255, 255, 255, 0.17) 100%); background-image: -moz-linear-gradient(bottom,rgba(0, 0, 0, 0.17) 0%,rgba(255, 255, 255, 0.17) 100%); background-image: linear-gradient(bottom,rgba(0,0,0,.17) 0%,rgba(255,255,255,.17) 100%); }'; } if (mashsb_hide_shares() === true) { $mashsb_custom_css .= ' .mashsb-box .mashsb-count { display: none; }'; } if ($smallbuttons === true) { $mashsb_custom_css .= '[class^="mashicon-"] .text, [class*=" mashicon-"] .text{ text-indent: -9999px !important; line-height: 0px; display: block; } [class^="mashicon-"] .text:after, [class*=" mashicon-"] .text:after { content: "" !important; text-indent: 0; font-size:13px; display: block !important; } [class^="mashicon-"], [class*=" mashicon-"] { width:25%; text-align: center !important; } [class^="mashicon-"] .icon:before, [class*=" mashicon-"] .icon:before { float:none; margin-right: 0; } .mashsb-buttons a{ margin-right: 3px; margin-bottom:3px; min-width: 0; width: 41px; } .onoffswitch, .onoffswitch-inner:before, .onoffswitch-inner:after .onoffswitch2, .onoffswitch2-inner:before, .onoffswitch2-inner:after { margin-right: 0px; width: 41px; line-height: 41px; }'; } else { $mashsb_custom_css .= ' .mashsb-buttons a { min-width: ' . $button_width . 'px;}'; } $mashsb_custom_css .= $custom_css; // ----------- Hook into existed 'mashsb-style' at /templates/mashsb.min.css ----------- wp_add_inline_style('mashsb-styles', $mashsb_custom_css); }
/** * Render the sharecount template * * @param string $customurl default empty * @param string alignment default left * @return string html */ function mashsb_render_sharecounts($customurl = '', $align = 'left') { global $mashsb_options; if (isset($mashsb_options['disable_sharecount']) || !mashsb_curl_installed() || !mashsb_is_enabled_permalinks()) { return; } $url = empty($customurl) ? mashsb_get_url() : $customurl; $sharetitle = isset($mashsb_options['sharecount_title']) ? $mashsb_options['sharecount_title'] : __('SHARES', 'mashsb'); $shares = getSharedcount($url); $sharecount = isset($mashsb_options['mashsharer_round']) ? roundshares($shares) : $shares; // do not show shares after x shares if (mashsb_hide_shares($shares)) { return; } // Get class names for buttons size $class_size = isset($mashsb_options['buttons_size']) ? ' ' . $mashsb_options['buttons_size'] : ''; $html = '<div class="mashsb-count' . $class_size . '" style="float:' . $align . ';"><div class="counts mashsbcount">' . $sharecount . '</div><span class="mashsb-sharetext">' . $sharetitle . '</span></div>'; return apply_filters('mashsb_share_count', $html); }