magic /wp-content/themes/nonus/theme/shortcodes/boxes/ctPersonBoxShortcode.class.php

Language PHP Lines 143
MD5 Hash c1e2cdcdd1812c6afe4ea33576db25ca
Repository https://github.com/alniko009/magic.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
/**
 * Person Box shortcode
 */
class ctPersonBoxShortcode extends ctShortcode {

	/**
	 * Returns name
	 * @return string|void
	 */
	public function getName() {
		return 'Person box';
	}

	/**
	 * Shortcode name
	 * @return string
	 */
	public function getShortcodeName() {
		return 'person_box';
	}

	/**
	 * Shortcode type
	 * @return string
	 */
	public function getShortcodeType() {
		return self::TYPE_SHORTCODE_ENCLOSING;
	}


	/**
	 * Handles shortcode
	 * @param $atts
	 * @param null $content
	 * @return string
	 */

	public function handle($atts, $content = null) {
		extract(shortcode_atts($this->extractShortcodeAttributes($atts), $atts));

		$preLink = '';
		$postLink = '';
		$br = '';
		if ($link) {
			$preLink = '<a href="' . $link . '">';
			$postLink = '</a>';
		}

		$linksHtml = '';
		if ($prezi) {
			$linksHtml .= '<a href="http://prezi.com/' . $prezi . '" target="_blank" data-toggle="tooltip" title="Prezi">' . $prezilabel . '</a>';
		}
		if ($fb) {
			$linksHtml .= '<a href="http://www.facebook.com/' . $fb . '" target="_blank" data-toggle="tooltip" title="Facebook">Facebook</a>';
		}
		if ($twit) {
			$linksHtml .= '<a href="http://www.twitter.com/' . $twit . '" target="_blank" data-toggle="tooltip" title="Twitter">Twitter</a>';
		}
		if ($google) {
			$linksHtml .= '<a href="http://plus.google.com/' . $google . '" target="_blank" data-toggle="tooltip" title="Google+">Google+</a>';
		}
		if ($linkedin) {
			$linksHtml .= '<a href="http://www.linkedin.com/' . $linkedin . '" target="_blank" data-toggle="tooltip" title="LinkedIn">LinkedIn</a>';
		}
		if ($pinterest) {
			$linksHtml .= '<a href="http://www.pinterest.com/' . $pinterest . '" target="_blank" data-toggle="tooltip" title="Pinterest">Pinterest</a>';
		}
		if ($dribbble) {
			$linksHtml .= '<a href="http://dribbble.com/' . $dribbble . '" target="_blank" data-toggle="tooltip" title="Dribbble">Dribbble</a>';
		}
		if ($flickr) {
			$linksHtml .= '<a href="http://www.flickr.com/photos/' . $flickr . '" target="_blank" data-toggle="tooltip" title="Flickr">Flickr</a>';
		}
		if ($tumblr) {
			$linksHtml .= '<a href="http://' . $tumblr . '.tumblr.com" target="_blank" data-toggle="tooltip" title="Tumblr">Tumblr</a>';
		}
		if ($instagram) {
			$linksHtml .= '<a href="http://instagram.com/' . $instagram . '" target="_blank" data-toggle="tooltip" title="Instagram">Instagram</a>';
		}
		if ($youtube) {
			$linksHtml .= '<a href="http://www.youtube.com/' . $youtube . '" target="_blank" data-toggle="tooltip" title="Youtube">Youtube</a>';
		}
		if ($vimeo) {
			$linksHtml .= '<a href="http://vimeo.com/' . $vimeo . '" target="_blank" data-toggle="tooltip" title="Vimeo">Vimeo</a>';
		}
		if ($phone) {
			$linksHtml .= '<a href="callto://+' . $phone . '" target="_blank" data-toggle="tooltip" title="'.$phonelabel.'">'.$phonelabel.'</a>';
		}
		if ($skype) {
			$linksHtml .= '<a href="skype:' . $skype . '?call" target="_blank" data-toggle="tooltip" title="Skype">Skype</a>';
		}
		if ($email) {
			$linksHtml .= '<a href="mailto:' . $email . '" target="_blank" data-toggle="tooltip" title="'.$emaillabel.'">'.$emaillabel.'</a>';
		}

		//if($link && $linksHtml != ""){
			$br = "<br />";
		//}
		return do_shortcode('<div class="person-box">
			                    ' . $preLink . '<img src="' . $imgsrc . '" alt="">' . $postLink . '
			                    <h4>' . $header . '</h4>
			                    <h5>' . $subheader . '</h5>
			                    ' . $preLink . $emaillabel . $postLink . $br . $linksHtml . '
			                </div>');
	}



	/**
	 * Returns config
	 * @return null
	 */
	public function getAttributes() {
		return array(
			'imgsrc' => array('label' => __("source", 'ct_theme'), 'default' => '', 'type' => 'image', 'help' => __("Image", 'ct_theme')),
			'header' => array('label' => __('header', 'ct_theme'), 'default' => '', 'type' => 'input', 'help' => __("Header text", 'ct_theme')),
			'subheader' => array('label' => __('subheader', 'ct_theme'), 'default' => '', 'type' => 'input', 'help' => __("Subheader text", 'ct_theme')),
			'link' => array('label' => __('link', 'ct_theme'), 'default' => '', 'type' => 'input', 'help' => __("Link", 'ct_theme')),
			'content' => array('label' => __('content', 'ct_theme'), 'default' => '', 'type' => "textarea"),
			'fb' => array('label' => __("Facebook username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'twit' => array('label' => __("Twitter username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'dribbble' => array('label' => __("Dribbble username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'google' => array('label' => __("Google+ username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'linkedin' => array('label' => __("LinkedIn username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'pinterest' => array('label' => __("Pinterest username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'flickr' => array('label' => __("Flickr username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'tumblr' => array('label' => __("Tumblr username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'instagram' => array('label' => __("Instagram username", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'youtube' => array('label' => __("Youtube movie", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'vimeo' => array('label' => __("Vimeo movie", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'phone' => array('label' => __("Phone number to call by Skype", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'phonelabel' => array('label' => __("Phone tooltip label", 'ct_theme'), 'default' => __("Phone",'ct_theme'), 'type' => 'input'),
			'skype' => array('label' => __("Skype user", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'email' => array('label' => __("Email address", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'emaillabel' => array('label' => __("Email tooltip label", 'ct_theme'), 'default' => __("Email",'ct_theme'), 'type' => 'input'),
			'prezi' => array('label' => __("Prezi link", 'ct_theme'), 'default' => '', 'type' => 'input'),
			'prezilabel' => array('label' => __("Prezi tooltip label", 'ct_theme'), 'default' => __("Prezi",'ct_theme'), 'type' => 'input'),
		);
	}
}

new ctPersonBoxShortcode();
Back to Top