PageRenderTime 25ms CodeModel.GetById 16ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/shared/shortcodes/shortcodes/social.php

https://github.com/deltafactory/landing-pages
PHP | 94 lines | 81 code | 6 blank | 7 comment | 8 complexity | ef1a99705db3934288b5ea5614067ebd MD5 | raw file
 1<?php
 2/**
 3*	Social Links Shortcode
 4*/
 5
 6/* 	Shortcode generator config
 7 * 	----------------------------------------------------- */
 8	$shortcodes_config['social_links'] = array(
 9		'no_preview' => true,
10		'options' => array(
11			'facebook' => array(
12				'name' => __('Facebook', 'leads'),
13				'desc' => __('Enter your facebook profile URL', 'leads'),
14				'type' => 'text',
15				'std' => ''
16			),
17			'twitter' => array(
18				'name' => __('Twitter', 'leads'),
19				'desc' => __('Enter your twitter profile URL', 'leads'),
20				'type' => 'text',
21				'std' => ''
22			),
23			'google_plus' => array(
24				'name' => __('Google+', 'leads'),
25				'desc' => __('Enter your google plus profile URL', 'leads'),
26				'type' => 'text',
27				'std' => ''
28			),
29			'linkedin' => array(
30				'name' => __('Linkedin', 'leads'),
31				'desc' => __('Enter your linkedin profile URL', 'leads'),
32				'type' => 'text',
33				'std' => ''
34			),
35			'github' => array(
36				'name' => __('Github', 'leads'),
37				'desc' => __('Enter your github profile URL', 'leads'),
38				'type' => 'text',
39				'std' => ''
40			),
41			'pinterest' => array(
42				'name' => __('Instagram', 'leads'),
43				'desc' => __('Enter your instagram profile URL', 'leads'),
44				'type' => 'text',
45				'std' => ''
46			),
47			'pinterest' => array(
48				'name' => __('Pinterest', 'leads'),
49				'desc' => __('Enter your pinterest profile URL', 'leads'),
50				'type' => 'text',
51				'std' => ''
52			),
53			'rss' => array(
54				'name' => __('RSS', 'leads'),
55				'desc' => __('Enter your RSS feeds URL', 'leads'),
56				'type' => 'text',
57				'std' => ''
58			)
59		),
60		'shortcode' => '[social_links facebook="{{facebook}}" twitter="{{twitter}}" google_plus="{{google_plus}}" linkedin="{{linkedin}}" github="{{github}}" pinterest="{{pinterest}}" /]',
61		'popup_title' => 'Insert Social Link Shortcode'
62	);
63
64/* 	Add shortcode
65 * 	----------------------------------------------------- */
66	add_shortcode('social_links', 'inbound_shortcode_social_links');
67
68	function inbound_shortcode_social_links( $atts, $content = null ) {
69		extract(shortcode_atts(array(
70			'facebook' => '',
71			'twitter' => '',
72			'google_plus' => '',
73			'linkedin' => '',
74			'github' => '',
75			'instagram' => '',
76			'pinterest' => '',
77			'rss' => ''
78		), $atts));
79
80		$out = '';
81
82		$out .= '<ul class="social-links">';
83		if( $facebook ) { $out .= '<li class="facebook"><a href="'. $facebook .'"><i class="icon-facebook icon-large"></i></a></li>'; }
84		if( $twitter ) { $out .= '<li class="twitter"><a href="'. $twitter .'"><i class="icon-twitter icon-large"></i></a></li>'; }
85		if( $google_plus ) { $out .= '<li class="google-plus"><a href="'. $google_plus .'"><i class="icon-google-plus icon-large"></i></a></li>'; }
86		if( $linkedin ) { $out .= '<li class="linkedin"><a href="'. $linkedin .'"><i class="icon-linkedin icon-large"></i></a></li>'; }
87		if( $github ) { $out .= '<li class="github"><a href="'. $github .'"><i class="icon-github icon-large"></i></a></li>'; }
88		if( $instagram ) { $out .= '<li class="instagram"><a href="'. $instagram .'"><i class="icon-camera-retro icon-large"></i></a></li>'; }
89		if( $pinterest ) { $out .= '<li class="pinterest"><a href="'. $pinterest .'"><i class="icon-pinterest icon-large"></i></a></li>'; }
90		if( $rss ) { $out .= '<li class="rss"><a href="'. $rss .'"><i class="icon-rss icon-large"></i></a></li>'; }
91		$out .= '</ul>';
92
93		return $out;
94	}