/wp-content/themes/nonus/theme/shortcodes/boxes/ctPersonBoxShortcode.class.php
PHP | 143 lines | 103 code | 13 blank | 27 comment | 16 complexity | c1e2cdcdd1812c6afe4ea33576db25ca MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
- <?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();