Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 39 |
|
0.00% |
0 / 2 |
CRAP | n/a |
0 / 0 |
|
| zeroBSCRM_getSocialLink | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
42 | |||
| show_social_links | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 | |||
| 1 | <?php |
| 2 | /* |
| 3 | * Jetpack CRM |
| 4 | * https://jetpackcrm.com |
| 5 | * V2.2 |
| 6 | * |
| 7 | * Copyright 2020 Automattic |
| 8 | * |
| 9 | * Date: 16/11/16 |
| 10 | */ |
| 11 | |
| 12 | defined( 'ZEROBSCRM_PATH' ) || exit( 0 ); |
| 13 | |
| 14 | /* |
| 15 | ====================================================== |
| 16 | Hard Coded Social Types |
| 17 | ====================================================== */ |
| 18 | |
| 19 | global $zbsSocialAccountTypes; |
| 20 | |
| 21 | /* |
| 22 | WH added 2.2 - this drives what "social accounts" are shown everywhere for contacts etc. |
| 23 | |
| 24 | */ |
| 25 | |
| 26 | $zbsSocialAccountTypes = array( |
| 27 | |
| 28 | 'tw' => array( |
| 29 | 'name' => 'Twitter', |
| 30 | 'slug' => 'twitter', |
| 31 | 'placeholder' => 'example', |
| 32 | 'fa' => 'fa-twitter', |
| 33 | 'urlprefix' => 'https://twitter.com/', |
| 34 | ), |
| 35 | 'li' => array( |
| 36 | 'name' => 'Linked In', |
| 37 | 'slug' => 'linked-in', |
| 38 | 'placeholder' => 'example', |
| 39 | 'fa' => 'fa-linkedin', |
| 40 | 'urlprefix' => 'https://www.linkedin.com/in/', |
| 41 | ), |
| 42 | 'fb' => array( |
| 43 | 'name' => 'Facebook', |
| 44 | 'slug' => 'facebook', |
| 45 | 'placeholder' => 'example', |
| 46 | 'fa' => 'fa-facebook', |
| 47 | 'urlprefix' => 'https://fb.com/', |
| 48 | ), |
| 49 | |
| 50 | ); |
| 51 | |
| 52 | /* |
| 53 | ====================================================== |
| 54 | / Hard Coded Social Types |
| 55 | ====================================================== |
| 56 | */ |
| 57 | |
| 58 | /* |
| 59 | ====================================================== |
| 60 | Social helper funcs |
| 61 | ====================================================== |
| 62 | */ |
| 63 | |
| 64 | // returns an url (E.g. https://twitter.com/woodyhayday) from a social acc obj |
| 65 | function zeroBSCRM_getSocialLink( $key, $userSocialAccs ) { |
| 66 | |
| 67 | if ( isset( $key ) && isset( $userSocialAccs ) && is_array( $userSocialAccs ) ) { |
| 68 | |
| 69 | global $zbsSocialAccountTypes; |
| 70 | |
| 71 | // got acc? |
| 72 | if ( isset( $userSocialAccs[ $key ] ) && ! empty( $userSocialAccs[ $key ] ) ) { |
| 73 | |
| 74 | // get prefix |
| 75 | $URL = $zbsSocialAccountTypes[ $key ]['urlprefix']; |
| 76 | |
| 77 | // finish it off + return |
| 78 | return $URL . $userSocialAccs[ $key ]; |
| 79 | |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | return '#'; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Shows business social links |
| 88 | * |
| 89 | * @returns {string} A string with all filled out Social links. |
| 90 | */ |
| 91 | function show_social_links() { |
| 92 | $social_links_string = ''; |
| 93 | if ( '' !== zeroBSCRM_getSetting( 'facebook' ) ) { |
| 94 | $social_links_string = 'Facebook: ' . zeroBSCRM_getSetting( 'facebook' ) . '<br/>'; |
| 95 | } |
| 96 | if ( '' !== zeroBSCRM_getSetting( 'twitter' ) ) { |
| 97 | $social_links_string .= 'Twitter: ' . zeroBSCRM_getSetting( 'twitter' ) . '<br/>'; |
| 98 | } |
| 99 | if ( '' !== zeroBSCRM_getSetting( 'linkedin' ) ) { |
| 100 | $social_links_string .= 'LinkedIn: ' . zeroBSCRM_getSetting( 'linkedin' ); |
| 101 | } |
| 102 | return $social_links_string; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * End of Social helper funcs |
| 107 | */ |