PluginProbe
Powerkit – Supercharge your WordPress Site / 2.2.9
Powerkit – Supercharge your WordPress Site v2.2.9
3.1.1 3.1.0 3.0.9 3.0.8 trunk 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 All 87 releases
powerkit / modules / share-buttons / public / class-powerkit-share-buttons-shortcode.php

class-powerkit-share-buttons-shortcode.php in Powerkit – Supercharge your WordPress Site 2.2.9, at modules/share-buttons/public/class-powerkit-share-buttons-shortcode.php

59 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Shortcode Share Buttons
4 *
5 * @link https://codesupply.co
6 * @since 1.0.0
7 *
8 * @package PowerKit
9 * @subpackage PowerKit/shortcodes
10 */
11
12 /**
13 * Share Buttons Shortcode
14 *
15 * @param array $atts User defined attributes in shortcode tag.
16 * @param string $content Shorcode tag content.
17 * @return string Shortcode result HTML.
18 */
19 function powerkit_share_buttons_shortcode( $atts, $content = '' ) {
20
21 $params = powerkit_shortcode_atts( shortcode_atts( array(
22 'accounts' => '',
23 'total' => true,
24 'icons' => true,
25 'labels' => true,
26 'counts' => true,
27 'titles' => false,
28 'title_location' => 'inside',
29 'label_location' => 'inside',
30 'count_location' => 'inside',
31 'mode' => 'mixed',
32 'layout' => 'default',
33 'scheme' => 'default',
34 ), $atts ) );
35
36 $params['total'] = filter_var( $params['total'], FILTER_VALIDATE_BOOLEAN );
37 $params['labels'] = filter_var( $params['labels'], FILTER_VALIDATE_BOOLEAN );
38 $params['counts'] = filter_var( $params['counts'], FILTER_VALIDATE_BOOLEAN );
39
40 ob_start();
41
42 // Accounts.
43 if ( $params['accounts'] ) {
44 $params['accounts'] = explode( ',', $params['accounts'] );
45
46 if ( $params['accounts'] ) {
47 foreach ( $params['accounts'] as $key => $val ) {
48 $params['accounts'][ $key ] = trim( $val );
49 }
50 }
51 }
52
53 // Get Shares.
54 powerkit_share_buttons( $params['accounts'], $params['total'], $params['icons'], $params['titles'], $params['labels'], $params['counts'], $params['title_location'], $params['label_location'], $params['count_location'], $params['mode'], $params['layout'], $params['scheme'], '' );
55
56 return ob_get_clean();
57 }
58 add_shortcode( 'powerkit_share_buttons', 'powerkit_share_buttons_shortcode' );
59