1: <?php
2: /**
3: * EPL Author Class. Allows for overriding.
4: *
5: * @package EPL
6: * @subpackage Classes/AuthorMeta
7: * @copyright Copyright (c) 2022, Merv Barrett
8: * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9: * @since 1.3.0
10: * @since 3.4.39 Allows for overriding.
11: */
12:
13: // Exit if accessed directly.
14: if ( ! defined( 'ABSPATH' ) ) {
15: exit;
16: }
17:
18: /**
19: * EPL_Author Class
20: *
21: * @since 1.3.0
22: */
23: if ( ! class_exists( 'EPL_Author' ) ) :
24:
25: /**
26: * EPL_Author Class
27: *
28: * @since 1.3.0
29: */
30: class EPL_Author {
31:
32: /**
33: * The user ID
34: *
35: * @since 1.3.0
36: * @var string $author_id User ID.
37: */
38: public $author_id;
39:
40: /**
41: * The username
42: *
43: * @since 1.3.0
44: * @var string $name User name.
45: */
46: public $name;
47:
48: /**
49: * The user mobile phone number
50: *
51: * @since 1.3.0
52: * @var string $mobile User mobile number.
53: */
54: public $mobile;
55:
56: /**
57: * The user office phone number
58: *
59: * @since 3.3.0
60: * @var string $office_phone User office phone.
61: */
62: public $office_phone;
63:
64: /**
65: * The user website
66: *
67: * @since 3.5.15
68: * @var string $website User website.
69: */
70: public $website;
71:
72: /**
73: * The user Facebook URL
74: *
75: * @since 1.3.0
76: * @var string $facebook User Facebook profile URL.
77: */
78: public $facebook;
79:
80: /**
81: * The user LinkedIn URL
82: *
83: * @since 1.3.0
84: * @var string $linkedin User LinkedIn profile URL.
85: */
86: public $linkedin;
87:
88: /**
89: * The user Google Plus URL
90: *
91: * @since 1.3.0
92: * @var string $google User Google Plus profile URL.
93: */
94: public $google;
95:
96: /**
97: * The user Twitter URL
98: *
99: * @since 1.3.0
100: * @var string $twitter User Twitter ID.
101: */
102: public $twitter;
103:
104: /**
105: * The user Instagram URL
106: *
107: * @since 3.3.0
108: * @var string $instagram User Instagram profile URL.
109: */
110: public $instagram;
111:
112: /**
113: * The user Pinterest URL
114: *
115: * @since 3.3.0
116: * @var string $pinterest User Pinterest profile URL.
117: */
118: public $pinterest;
119:
120: /**
121: * The user YouTube URL
122: *
123: * @since 3.3.0
124: * @var string $youtube User YouTube profile URL.
125: */
126: public $youtube;
127:
128: /**
129: * The user email address
130: *
131: * @since 1.3.0
132: * @var string $email User email address.
133: */
134: public $email;
135:
136: /**
137: * The user Skype name
138: *
139: * @since 1.3.0
140: * @var string $skype User Skype ID.
141: */
142: public $skype;
143:
144: /**
145: * The user text slogan
146: *
147: * @since 1.3.0
148: * @var string $slogan User Slogan text string.
149: */
150: public $slogan;
151:
152: /**
153: * The user position
154: *
155: * @since 1.3.0
156: * @var string $position User position text string.
157: */
158: public $position;
159:
160: /**
161: * The user video profile
162: *
163: * @since 1.3.0
164: * @var string $video User video profile URL.
165: */
166: public $video;
167:
168: /**
169: * The user contact form shortcode
170: *
171: * @since 1.3.0
172: * @var string $contact_form User contact shortcode.
173: */
174: public $contact_form;
175:
176: /**
177: * The user bio
178: *
179: * @since 1.3.0
180: * @var string $description User bio textarea.
181: */
182: public $description;
183:
184: /**
185: * Get things started
186: *
187: * @param string $author_id The author WordPress user ID.
188: *
189: * @since 1.3.0
190: * @since 3.5.15 Added website (url)
191: */
192: public function __construct( $author_id ) {
193: $this->author_id = $author_id;
194: $this->name = get_the_author_meta( 'display_name', $this->author_id );
195: $this->mobile = get_the_author_meta( 'mobile', $this->author_id );
196: $this->office_phone = get_the_author_meta( 'office_phone', $this->author_id );
197: $this->website = get_the_author_meta( 'url', $this->author_id );
198: $this->facebook = get_the_author_meta( 'facebook', $this->author_id );
199: $this->linkedin = get_the_author_meta( 'linkedin', $this->author_id );
200: $this->google = get_the_author_meta( 'google', $this->author_id );
201: $this->twitter = get_the_author_meta( 'twitter', $this->author_id );
202: $this->instagram = get_the_author_meta( 'instagram', $this->author_id );
203: $this->pinterest = get_the_author_meta( 'pinterest', $this->author_id );
204: $this->youtube = get_the_author_meta( 'youtube', $this->author_id );
205: $this->email = get_the_author_meta( 'email', $this->author_id );
206: $this->skype = get_the_author_meta( 'skype', $this->author_id );
207: $this->slogan = get_the_author_meta( 'slogan', $this->author_id );
208: $this->position = get_the_author_meta( 'position', $this->author_id );
209: $this->video = get_the_author_meta( 'video', $this->author_id );
210: $this->contact_form = get_the_author_meta( 'contact-form', $this->author_id );
211: $this->description = get_the_author_meta( 'description', $this->author_id );
212: }
213:
214: /**
215: * Get the global property object
216: *
217: * @param string $property Name of the property to retrieve.
218: *
219: * @return bool|mixed $return Array of values.
220: * @since 1.3.0
221: */
222: public function __get( $property ) {
223: $prop_val = ! empty( $this->{$property} ) ? $this->{$property} : false;
224: $prop_meta = get_user_meta( $this->author_id, $property, true );
225:
226: if ( ! empty( $prop_val ) ) {
227: return $prop_val;
228:
229: } elseif ( ! empty( $prop_meta ) ) {
230: return $prop_meta;
231: }
232: }
233:
234: /**
235: * Author Name
236: *
237: * @since 1.3.0
238: */
239: public function get_author_name() {
240: if ( ! empty( $this->name ) ) {
241: return apply_filters( 'epl_author_name', $this->name, $this );
242: }
243: }
244:
245: /**
246: * Get Email
247: *
248: * @since 3.2.0
249: */
250: public function get_email() {
251: if ( ! empty( $this->email ) ) {
252: return apply_filters( 'epl_author_email', $this->email, $this );
253: }
254: }
255:
256: /**
257: * Escape a social/contact profile URL for use in an href attribute.
258: *
259: * Non http(s) schemes used by the contact methods (mailto, skype, tel) are
260: * whitelisted explicitly, everything else falls back to the WordPress
261: * allowed protocol list. Values that sanitise away to nothing are returned
262: * as an empty string so the caller can skip rendering the link entirely.
263: *
264: * @param string $url The raw profile URL.
265: *
266: * @return string
267: * @since 3.5.25
268: */
269: protected function esc_profile_url( $url ) {
270:
271: if ( ! is_string( $url ) || '' === $url ) {
272: return '';
273: }
274:
275: $protocols = function_exists( 'epl_get_profile_link_protocols' )
276: ? epl_get_profile_link_protocols()
277: : array_values( array_unique( array_merge( wp_allowed_protocols(), array( 'skype' ) ) ) );
278:
279: return esc_url( $url, $protocols );
280: }
281:
282: /**
283: * Build an escaped title attribute for a contact icon.
284: *
285: * @param string $prefix Leading label, eg. "Follow".
286: * @param string $suffix Trailing label, eg. "on Facebook".
287: *
288: * @return string
289: * @since 3.5.25
290: */
291: protected function get_icon_title( $prefix, $suffix ) {
292: return esc_attr( $prefix . ' ' . $this->get_author_name() . ' ' . $suffix );
293: }
294:
295: /**
296: * Author Email html Box
297: *
298: * @param string $html String of html.
299: * @param string $style Option of returntype.
300: *
301: * @return mixed|string|void
302: * @since 1.3.0
303: * @since 3.5.25 Escaped the href and title attributes.
304: */
305: public function get_email_html( $html = '', $style = 'i' ) {
306:
307: $href = esc_url( 'mailto:' . $this->get_email(), array( 'mailto' ) );
308:
309: if ( ! empty( $this->email ) && '' !== $href ) {
310:
311: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
312: $title = $this->get_icon_title( __( 'Contact', 'easy-property-listings' ), __( 'by Email', 'easy-property-listings' ) );
313:
314: if ( 'i' === $style ) {
315: $html = '
316: <a class="epl-author-icon author-icon email-icon-24"
317: href="' . $href . '" title="' . $title . '">' .
318: apply_filters( 'epl_author_icon_email', __( 'Email', 'easy-property-listings' ) ) .
319: '</a>';
320: } else {
321: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-email"><use xlink:href="#epl-icon-svg-email"></use></svg>';
322: $html =
323: '<div class="epl-icon-svg-container epl-icon-container-email">
324: <a class="epl-author-icon-svg author-icon-svg email-icon"
325: href="' . $href . '" title="' . $title . '">' . $svg .
326: '</a>
327: </div>';
328: }
329: }
330: $html = apply_filters( 'epl_author_email_html', $html, $this );
331: return $html;
332: }
333:
334: /**
335: * Get website
336: *
337: * @since 3.5.15
338: */
339: public function get_website() {
340: if ( ! empty( $this->website ) ) {
341: return apply_filters( 'epl_author_website', $this->website, $this );
342: }
343: }
344:
345: /**
346: * Author website html Box
347: *
348: * @param string $html String of html.
349: * @param string $style Option of returntype.
350: *
351: * @return mixed|string|void
352: *
353: * @since 3.5.15
354: * @since 3.5.25 Escaped the href and title attributes.
355: */
356: public function get_website_html( $html = '', $style = 'i' ) {
357:
358: $href = $this->esc_profile_url( $this->get_website() );
359:
360: if ( '' !== $href ) {
361:
362: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
363: $title = $this->get_icon_title( __( 'Contact', 'easy-property-listings' ), __( 'by Website', 'easy-property-listings' ) );
364:
365: if ( 'i' === $style ) {
366: $html = '
367: <a class="epl-author-icon author-icon website-icon-24"
368: href="' . $href . '" title="' . $title . '">' .
369: apply_filters( 'epl_author_icon_website', __( 'Website', 'easy-property-listings' ) ) .
370: '</a>';
371: } else {
372: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-website"><use xlink:href="#epl-icon-svg-website"></use></svg>';
373: $html =
374: '<div class="epl-icon-svg-container epl-icon-container-website">
375: <a class="epl-author-icon-svg author-icon-svg website-icon"
376: href="' . $href . '" title="' . $title . '">' . $svg .
377: '</a>
378: </div>';
379: }
380: }
381: $html = apply_filters( 'epl_author_website_html', $html, $this );
382: return $html;
383: }
384:
385: /**
386: * Get Twitter
387: *
388: * @since 3.2.0
389: */
390: public function get_twitter() {
391:
392: $twitter = '';
393: if ( ! empty( $this->twitter ) ) {
394:
395: if ( ( strpos( $this->twitter, 'http://' ) === 0 ) || ( strpos( $this->twitter, 'https://' ) === 0 ) ) {
396: // Absolute url.
397: $twitter = $this->twitter;
398:
399: } else {
400: // Relative url.
401: $twitter = 'http://twitter.com/' . $this->twitter;
402: }
403: }
404: return apply_filters( 'epl_author_twitter', $twitter, $this );
405: }
406:
407: /**
408: * Get Instagram
409: *
410: * @since 3.3.0
411: */
412: public function get_instagram() {
413:
414: $instagram = '';
415: if ( ! empty( $this->instagram ) ) {
416:
417: if ( ( strpos( $this->instagram, 'http://' ) === 0 ) || ( strpos( $this->instagram, 'https://' ) === 0 ) ) {
418: // Absolute url.
419: $instagram = $this->instagram;
420:
421: } else {
422: // Relative url.
423: $instagram = 'http://instagram.com/' . $this->instagram;
424: }
425: }
426: return apply_filters( 'epl_author_instagram', $instagram, $this );
427: }
428:
429: /**
430: * Get YouTube
431: *
432: * @since 3.3.0
433: */
434: public function get_youtube() {
435:
436: $youtube = '';
437: if ( ! empty( $this->youtube ) ) {
438:
439: if ( ( strpos( $this->youtube, 'http://' ) === 0 ) || ( strpos( $this->youtube, 'https://' ) === 0 ) ) {
440: // Absolute url.
441: $youtube = $this->youtube;
442:
443: } else {
444: // Relative url.
445: $youtube = 'http://youtube.com/' . $this->youtube;
446: }
447: }
448: return apply_filters( 'epl_author_youtube', $youtube, $this );
449: }
450:
451: /**
452: * Get Pinterest
453: *
454: * @since 3.3.0
455: */
456: public function get_pinterest() {
457:
458: $pinterest = '';
459: if ( ! empty( $this->pinterest ) ) {
460:
461: if ( ( strpos( $this->pinterest, 'http://' ) === 0 ) || ( strpos( $this->pinterest, 'https://' ) === 0 ) ) {
462: // Absolute url.
463: $pinterest = $this->pinterest;
464:
465: } else {
466: // Relative url.
467: $pinterest = 'http://pinterest.com/' . $this->pinterest;
468: }
469: }
470: return apply_filters( 'epl_author_pinterest', $pinterest, $this );
471: }
472:
473: /**
474: * Author Twitter html Box
475: *
476: * @param string $html String of html.
477: * @param string $style Option of returntype.
478: *
479: * @return mixed|string|void
480: * @since 1.3.0
481: * @since 3.5.0 Switched to Twitter X icon.
482: * @since 3.5.25 Escaped the href and title attributes.
483: */
484: public function get_twitter_html( $html = '', $style = 'i' ) {
485:
486: $link_target = defined( 'EPL_SOCIAL_LINK_TARGET_BLANK' ) && EPL_SOCIAL_LINK_TARGET_BLANK ? 'target="_blank" ' : '';
487:
488: $href = $this->esc_profile_url( $this->get_twitter() );
489:
490: if ( '' !== $href ) {
491:
492: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
493: $title = $this->get_icon_title( __( 'Follow', 'easy-property-listings' ), __( 'on Twitter', 'easy-property-listings' ) );
494:
495: if ( 'i' === $style ) {
496: $html = '
497: <a class="epl-author-icon author-icon twitter-icon-24"
498: href="' . $href . '" title="' . $title . '"' . $link_target . '>' .
499: apply_filters( 'epl_author_icon_twitter', __( 'Twitter', 'easy-property-listings' ) ) .
500: '</a>';
501: } else {
502: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-twitter-x"><use xlink:href="#epl-icon-svg-twitter-x"></use></svg>';
503: $html =
504: '<div class="epl-icon-svg-container epl-icon-container-twitter">
505: <a class="epl-author-icon-svg author-icon-svg twitter-icon"
506: href="' . $href . '" title="' . $title . '"' . $link_target . '>' . $svg .
507: '</a>
508: </div>';
509: }
510: }
511: $html = apply_filters( 'epl_author_twitter_html', $html, $this );
512: return $html;
513: }
514:
515: /**
516: * Author Instagram html Box
517: *
518: * @param string $html String of html.
519: * @param string $style Option of returntype.
520: *
521: * @return mixed|string|void
522: * @since 3.3.0
523: * @since 3.5.25 Escaped the href and title attributes.
524: */
525: public function get_instagram_html( $html = '', $style = 'i' ) {
526:
527: $link_target = defined( 'EPL_SOCIAL_LINK_TARGET_BLANK' ) && EPL_SOCIAL_LINK_TARGET_BLANK ? 'target="_blank" ' : '';
528:
529: $href = $this->esc_profile_url( $this->get_instagram() );
530:
531: if ( '' !== $href ) {
532:
533: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
534: $title = $this->get_icon_title( __( 'Follow', 'easy-property-listings' ), __( 'on Instagram', 'easy-property-listings' ) );
535:
536: if ( 'i' === $style ) {
537: $html = '
538: <a class="epl-author-icon author-icon instagram-icon-24"
539: href="' . $href . '" title="' . $title . '"' . $link_target . '>' .
540: apply_filters( 'epl_author_icon_instagram', __( 'Instagram', 'easy-property-listings' ) ) .
541: '</a>';
542: } else {
543: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-instagram"><use xlink:href="#epl-icon-svg-instagram"></use></svg>';
544: $html =
545: '<div class="epl-icon-svg-container epl-icon-container-instagram">
546: <a class="epl-author-icon-svg author-icon-svg instagram-icon"
547: href="' . $href . '" title="' . $title . '"' . $link_target . '>' . $svg .
548: '</a>
549: </div>';
550: }
551: }
552: $html = apply_filters( 'epl_author_instagram_html', $html, $this );
553: return $html;
554: }
555:
556: /**
557: * Author YouTube html Box
558: *
559: * @param string $html String of html.
560: * @param string $style Option of returntype.
561: *
562: * @return mixed|string|void
563: * @since 3.3.0
564: * @since 3.5.25 Escaped the href and title attributes.
565: */
566: public function get_youtube_html( $html = '', $style = 'i' ) {
567:
568: $link_target = defined( 'EPL_SOCIAL_LINK_TARGET_BLANK' ) && EPL_SOCIAL_LINK_TARGET_BLANK ? 'target="_blank" ' : '';
569:
570: $href = $this->esc_profile_url( $this->get_youtube() );
571:
572: if ( '' !== $href ) {
573:
574: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
575: $title = $this->get_icon_title( __( 'Follow', 'easy-property-listings' ), __( 'on YouTube', 'easy-property-listings' ) );
576:
577: if ( 'i' === $style ) {
578: $html = '
579: <a class="epl-author-icon author-icon youtube-icon-24"
580: href="' . $href . '" title="' . $title . '"' . $link_target . '>' .
581: apply_filters( 'epl_author_icon_youtube', __( 'YouTube', 'easy-property-listings' ) ) .
582: '</a>';
583: } else {
584: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-youtube"><use xlink:href="#epl-icon-svg-youtube"></use></svg>';
585: $html =
586: '<div class="epl-icon-svg-container epl-icon-container-youtube">
587: <a class="epl-author-icon-svg author-icon-svg youtube-icon"
588: href="' . $href . '" title="' . $title . '"' . $link_target . '>' . $svg .
589: '</a>
590: </div>';
591: }
592: }
593: $html = apply_filters( 'epl_author_youtube_html', $html, $this );
594: return $html;
595: }
596:
597: /**
598: * Author Pinterest html Box
599: *
600: * @param string $html String of html.
601: * @param string $style Option of returntype.
602: *
603: * @return mixed|string|void
604: * @since 3.3.0
605: * @since 3.5.25 Escaped the href and title attributes. Fixed the SVG variant linking to Instagram.
606: */
607: public function get_pinterest_html( $html = '', $style = 'i' ) {
608:
609: $link_target = defined( 'EPL_SOCIAL_LINK_TARGET_BLANK' ) && EPL_SOCIAL_LINK_TARGET_BLANK ? 'target="_blank" ' : '';
610:
611: $href = $this->esc_profile_url( $this->get_pinterest() );
612:
613: if ( '' !== $href ) {
614:
615: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
616: $title = $this->get_icon_title( __( 'Follow', 'easy-property-listings' ), __( 'on Pinterest', 'easy-property-listings' ) );
617:
618: if ( 'i' === $style ) {
619: $html = '
620: <a class="epl-author-icon author-icon pinterest-icon-24"
621: href="' . $href . '" title="' . $title . '"' . $link_target . '>' .
622: apply_filters( 'epl_author_icon_pinterest', __( 'Pinterest', 'easy-property-listings' ) ) .
623: '</a>';
624: } else {
625: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-pinterest"><use xlink:href="#epl-icon-svg-pinterest"></use></svg>';
626: $html =
627: '<div class="epl-icon-svg-container epl-icon-container-pinterest">
628: <a class="epl-author-icon-svg author-icon-svg pinterest-icon"
629: href="' . $href . '" title="' . $title . '"' . $link_target . '>' . $svg .
630: '</a>
631: </div>';
632: }
633: }
634: $html = apply_filters( 'epl_author_pinterest_html', $html, $this );
635: return $html;
636: }
637:
638: /**
639: * Get Google
640: *
641: * @since 3.2.0
642: * @since 3.3.0 Depreciated as Google Plus no longer exists.
643: */
644: public function get_google() {
645:
646: $google = '';
647: if ( ! empty( $this->google ) ) {
648:
649: if ( ( strpos( $this->google, 'http://' ) === 0 ) || ( strpos( $this->google, 'https://' ) === 0 ) ) {
650: // absolute url.
651: $google = $this->google;
652:
653: } else {
654: // relative url.
655: $google = 'http://plus.google.com/' . $this->google;
656: }
657: }
658: return apply_filters( 'epl_author_google', $google, $this );
659: }
660:
661: /**
662: * Author Google html Box
663: *
664: * @param string $html String of html.
665: * @param string $style Option of returntype.
666: *
667: * @return mixed|string|void
668: *
669: * @since 1.3.0
670: * @since 3.3.0 Depreciated as Google Plus no longer exists.
671: * @since 3.5.25 Escaped the href and title attributes.
672: */
673: public function get_google_html( $html = '', $style = 'i' ) {
674:
675: $link_target = defined( 'EPL_SOCIAL_LINK_TARGET_BLANK' ) && EPL_SOCIAL_LINK_TARGET_BLANK ? 'target="_blank" ' : '';
676:
677: $href = $this->esc_profile_url( $this->get_google() );
678:
679: if ( '' !== $href ) {
680:
681: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
682: $title = $this->get_icon_title( __( 'Follow', 'easy-property-listings' ), __( 'on Google', 'easy-property-listings' ) );
683:
684: if ( 'i' === $style ) {
685: $html = '
686: <a class="epl-author-icon author-icon google-icon-24"
687: href="' . $href . '" title="' . $title . '"' . $link_target . '>' .
688: apply_filters( 'epl_author_icon_google', __( 'Google', 'easy-property-listings' ) ) .
689: '</a>';
690: } else {
691: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-google-plus"><use xlink:href="#epl-icon-svg-google-plus"></use></svg>';
692: $html =
693: '<div class="epl-icon-svg-container epl-icon-container-google-plus">
694: <a class="epl-author-icon-svg author-icon-svg google-plus-icon"
695: href="' . $href . '" title="' . $title . '"' . $link_target . '>' . $svg .
696: '</a>
697: </div>';
698: }
699: }
700: $html = apply_filters( 'epl_author_google_html', $html, $this );
701: return $html;
702: }
703:
704: /**
705: * Get Facebook
706: *
707: * @since 3.2.0
708: */
709: public function get_facebook() {
710:
711: $facebook = '';
712:
713: if ( ! empty( $this->facebook ) ) {
714:
715: if ( ( strpos( $this->facebook, 'http://' ) === 0 ) || ( strpos( $this->facebook, 'https://' ) === 0 ) ) {
716: // absolute url.
717: $facebook = $this->facebook;
718:
719: } else {
720: // relative url.
721: $facebook = 'http://facebook.com/' . $this->facebook;
722: }
723: }
724: return apply_filters( 'epl_author_facebook', $facebook, $this );
725: }
726:
727: /**
728: * Author Facebook html Box
729: *
730: * @param string $html String of html.
731: * @param string $style Option of returntype.
732: *
733: * @return mixed|string|void
734: * @since 1.3.0
735: * @since 3.5.25 Escaped the href and title attributes.
736: */
737: public function get_facebook_html( $html = '', $style = 'i' ) {
738:
739: $link_target = defined( 'EPL_SOCIAL_LINK_TARGET_BLANK' ) && EPL_SOCIAL_LINK_TARGET_BLANK ? 'target="_blank" ' : '';
740:
741: $href = $this->esc_profile_url( $this->get_facebook() );
742:
743: if ( '' !== $href ) {
744:
745: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
746: $title = $this->get_icon_title( __( 'Follow', 'easy-property-listings' ), __( 'on Facebook', 'easy-property-listings' ) );
747:
748: if ( 'i' === $style ) {
749: $html = '
750: <a class="epl-author-icon author-icon facebook-icon-24"
751: href="' . $href . '" title="' . $title . '"' . $link_target . '>' .
752: apply_filters( 'epl_author_icon_facebook', __( 'Facebook', 'easy-property-listings' ) ) .
753: '</a>';
754: } else {
755: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-facebook"><use xlink:href="#epl-icon-svg-facebook"></use></svg>';
756: $html =
757: '<div class="epl-icon-svg-container epl-icon-container-facebook">
758: <a class="epl-author-icon-svg author-icon-svg facebook-icon"
759: href="' . $href . '" title="' . $title . '"' . $link_target . '>' . $svg .
760: '</a>
761: </div>';
762: }
763: }
764: $html = apply_filters( 'epl_author_facebook_html', $html, $this );
765: return $html;
766: }
767:
768: /**
769: * Get linkedin
770: *
771: * @since 3.2.0
772: */
773: public function get_linkedin() {
774:
775: $linkedin = '';
776:
777: if ( ! empty( $this->linkedin ) ) {
778:
779: if ( ( strpos( $this->linkedin, 'http://' ) === 0 ) || ( strpos( $this->linkedin, 'https://' ) === 0 ) ) {
780: // absolute url.
781: $linkedin = $this->linkedin;
782:
783: } else {
784: // relative url.
785: $linkedin = 'http://linkedin.com/pub/' . $this->linkedin;
786: }
787: }
788: return apply_filters( 'epl_author_linkedin', $linkedin, $this );
789: }
790:
791: /**
792: * Author LinkedIn html Box
793: *
794: * @param string $html String of html.
795: * @param string $style Option of returntype.
796: *
797: * @return mixed|string|void
798: * @since 1.3.0
799: * @since 3.5.25 Escaped the href and title attributes.
800: */
801: public function get_linkedin_html( $html = '', $style = 'i' ) {
802:
803: $link_target = defined( 'EPL_SOCIAL_LINK_TARGET_BLANK' ) && EPL_SOCIAL_LINK_TARGET_BLANK ? 'target="_blank" ' : '';
804:
805: $href = $this->esc_profile_url( $this->get_linkedin() );
806:
807: if ( '' !== $href ) {
808:
809: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
810: $title = $this->get_icon_title( __( 'Follow', 'easy-property-listings' ), __( 'on LinkedIn', 'easy-property-listings' ) );
811:
812: if ( 'i' === $style ) {
813:
814: $html = '
815: <a class="epl-author-icon author-icon linkedin-icon-24"
816: href="' . $href . '" title="' . $title . '"' . $link_target . '>' .
817: apply_filters( 'epl_author_icon_linkedin', __( 'LinkedIn', 'easy-property-listings' ) ) .
818: '</a>';
819: } else {
820: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-linkedin"><use xlink:href="#epl-icon-svg-linkedin"></use></svg>';
821: $html =
822: '<div class="epl-icon-svg-container epl-icon-container-linkedin">
823: <a class="epl-author-icon-svg author-icon-svg linkedin-icon"
824: href="' . $href . '" title="' . $title . '"' . $link_target . '>' . $svg .
825: '</a>
826: </div>';
827: }
828: }
829: $html = apply_filters( 'epl_author_linkedin_html', $html, $this );
830: return $html;
831: }
832:
833: /**
834: * Get skype
835: *
836: * @since 3.2.0
837: */
838: public function get_skype() {
839:
840: $skype = '';
841: if ( ! empty( $this->skype ) ) {
842:
843: if ( ( strpos( $this->skype, 'skype:' ) === 0 ) ) {
844: // Absolute url.
845: $skype = $this->skype;
846:
847: } else {
848: // Relative url.
849: $skype = 'skype:' . $this->skype;
850: }
851: }
852: return apply_filters( 'epl_author_skype', $skype, $this );
853: }
854:
855: /**
856: * Author Skype html Box
857: *
858: * @param string $html String of html.
859: * @param string $style Option of returntype.
860: *
861: * @return mixed|string|void
862: * @since 1.3.0
863: * @since 3.5.25 Escaped the href and title attributes.
864: */
865: public function get_skype_html( $html = '', $style = 'i' ) {
866:
867: $link_target = defined( 'EPL_SOCIAL_LINK_TARGET_BLANK' ) && EPL_SOCIAL_LINK_TARGET_BLANK ? 'target="_blank" ' : '';
868:
869: $href = $this->esc_profile_url( $this->get_skype() );
870:
871: if ( '' !== $href ) {
872:
873: $style = 'i' === $style && 'on' === epl_get_option( 'epl_icons_svg_author' ) ? 's' : $style;
874: $title = $this->get_icon_title( __( 'Follow', 'easy-property-listings' ), __( 'on Skype', 'easy-property-listings' ) );
875:
876: if ( 'i' === $style ) {
877:
878: $html = '
879: <a class="epl-author-icon author-icon skype-icon-24"
880: href="' . $href . '" title="' . $title . '"' . $link_target . '>' .
881: apply_filters( 'epl_author_icon_skype', __( 'Skype', 'easy-property-listings' ) ) .
882: '</a>';
883: } else {
884: $svg = '<svg viewBox="0 0 100 100" class="epl-icon-svg-skype"><use xlink:href="#epl-icon-svg-skype"></use></svg>';
885: $html =
886: '<div class="epl-icon-svg-container epl-icon-container-skype">
887: <a class="epl-author-icon-svg author-icon-svg skype-icon"
888: href="' . $href . '" title="' . $title . '"' . $link_target . '>' . $svg .
889: '</a>
890: </div>';
891: }
892: }
893: $html = apply_filters( 'epl_author_skype_html', $html, $this );
894: return $html;
895: }
896:
897: /**
898: * Author video html Box
899: *
900: * @param string $html String of video embed.
901: *
902: * @return mixed|void
903: * @since 1.3.0
904: * @since 3.5.25 The profile video URL is sanitised before it is embedded.
905: */
906: public function get_video_html( $html = '' ) {
907: if ( ! empty( $this->video ) ) {
908: $video = apply_filters( 'epl_author_video_html', $this->video, $this );
909: $video = esc_url_raw( $video, array( 'http', 'https' ) );
910:
911: if ( '' !== $video ) {
912: $html = wp_oembed_get( $video );
913: }
914: }
915: return apply_filters( 'epl_author_video', $html, $this );
916: }
917:
918: /**
919: * Get description
920: *
921: * @since 3.2.0
922: */
923: public function get_description() {
924: if ( ! empty( $this->description ) ) {
925: return apply_filters( 'epl_author_description', $this->description, $this );
926: }
927: }
928:
929: /**
930: * Author description html
931: *
932: * @param string $html String of html output.
933: *
934: * @return mixed|void
935: * @since 1.3.0
936: * @since 3.5.25 The bio is run through wp_kses_post() and the permalink through esc_url().
937: */
938: public function get_description_html( $html = '' ) {
939:
940: $desc_html = $this->get_description();
941:
942: if ( ! empty( $desc_html ) ) {
943:
944: $permalink = apply_filters( 'epl_author_profile_link', get_author_posts_url( $this->author_id ), $this );
945:
946: $html = '
947: <div class="epl-author-content author-content">' . wp_kses_post( $desc_html ) . '</div>
948: <span class="bio-more">
949: <a href="' . esc_url( $permalink ) . '">' .
950: apply_filters( 'epl_author_read_more_label', __( 'Read More', 'easy-property-listings' ) ) . '
951: </a>
952: </span>
953: ';
954: }
955: return apply_filters( 'epl_author_description_html', $html, $this );
956: }
957:
958: /**
959: * Author mobile
960: *
961: * @since 1.3.0
962: */
963: public function get_author_mobile() {
964: if ( ! empty( $this->mobile ) ) {
965: return apply_filters( 'epl_author_mobile', $this->mobile, $this );
966: }
967: }
968:
969: /**
970: * Author office phone
971: *
972: * @since 3.3.0
973: */
974: public function get_author_office_phone() {
975: if ( ! empty( $this->office_phone ) ) {
976: return apply_filters( 'epl_author_office_phone', $this->office_phone, $this );
977: }
978: }
979:
980: /**
981: * Author ID
982: *
983: * @since 1.3.0
984: */
985: public function get_author_id() {
986: if ( ! empty( $this->author_id ) ) {
987: return apply_filters( 'epl_author_id', $this->author_id, $this );
988: }
989: }
990:
991: /**
992: * Author Slogan
993: *
994: * @since 1.3.0
995: */
996: public function get_author_slogan() {
997: if ( ! empty( $this->slogan ) ) {
998: return apply_filters( 'epl_author_slogan', $this->slogan, $this );
999: }
1000: }
1001:
1002: /**
1003: * Author Position
1004: *
1005: * @since 1.3.0
1006: */
1007: public function get_author_position() {
1008: if ( ! empty( $this->position ) ) {
1009: return apply_filters( 'epl_author_position', $this->position, $this );
1010: }
1011: }
1012:
1013: /**
1014: * Author Contact Form
1015: *
1016: * @since 1.3.0
1017: */
1018: public function get_author_contact_form() {
1019: if ( ! empty( $this->contact_form ) ) {
1020: $contact_form = apply_filters( 'epl_author_contact_form', $this->contact_form, $this );
1021: return do_shortcode( $contact_form );
1022: }
1023: }
1024: }
1025: endif;
1026: