Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 59
0.00% covered (danger)
0.00%
0 / 6
CRAP
n/a
0 / 0
zeroBSCRM_UI2_label
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
20
zeroBSCRM_faSocialToSemantic
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
30
zeroBSCRM_getSocialIcon
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
12
zeroBSCRM_UI2_messageHTML
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
30
jpcrm_loading_container
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
zeroBSCRM_UI2_squareFeedbackUpsell
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
30
1<?php
2/*
3 * Jetpack CRM
4 * https://jetpackcrm.com
5 */
6
7#} Outputs html label
8/*
9    $labelClass = yellow image etc.
10
11    https://semantic-ui.com/elements/label.html
12*/
13function zeroBSCRM_UI2_label( $labelClass = '', $imgHTML = '', $html = '', $detailHTML = '', $id = '' ) {
14
15    $ret = '<div class="ui ' . $labelClass . ' label"';
16    if ( ! empty( $id ) ) {
17        $ret .= ' id="' . $id . '"';
18    }
19    $ret .= '>';
20    if ( ! empty( $imgHTML ) ) {
21        $ret .= $imgHTML;
22    }
23    $ret .= $html;
24    if ( ! empty( $detailHTML ) ) {
25        $ret .= '<div class="detail">' . $detailHTML . '</div>';
26    }
27    $ret .= '</div>';
28
29    return $ret;
30}
31function zeroBSCRM_faSocialToSemantic( $faClass = '' ) {
32
33    switch ( $faClass ) {
34
35        case 'fa-twitter':
36            return 'twitter icon';
37            break;
38
39        case 'fa-facebook':
40            return 'facebook icon';
41            break;
42
43        case 'fa-linkedin':
44            return 'linkedin icon';
45            break;
46
47        default:
48            return $faClass;
49            break;
50
51    }
52}
53
54    #} To match the key to the flag (for button class) the above one pops "icon" on the end
55function zeroBSCRM_getSocialIcon( $key = '' ) {
56    if ( $key != '' ) {
57            $socials = array(
58                'fb' => 'facebook',
59                'tw' => 'twitter',
60                'li' => 'linkedin',
61                'vk' => 'vk',
62                'gp' => 'google plus',
63                'in' => 'instagram',
64                'yt' => 'youtube',
65            );
66
67            if ( array_key_exists( $key, $socials ) ) {
68                return $socials[ $key ];
69            }
70    }
71        return false;
72}
73
74/**
75 * Generates HTML markup for a message box.
76 *
77 * @param string $msg_class CSS class for the message box.
78 * @param string $msg_header Optional. Header text for the message box.
79 * @param string $msg Main content of the message box.
80 * @param string $icon_class Optional. CSS class for an icon to be displayed in the message box.
81 * @param string $id Optional. ID attribute for the message box element.
82 *
83 * @return string HTML markup for the message box.
84 * @link https://semantic-ui.com/collections/message.html Semantic UI Message Documentation.
85 */
86function zeroBSCRM_UI2_messageHTML( $msg_class = '', $msg_header = '', $msg = '', $icon_class = '', $id = '' ) {
87    if ( ! empty( $icon_class ) ) {
88        $msg_class .= ' icon';
89    }
90
91    $ret = '<div style="box-shadow:unset; color:black;" class="ui ' . $msg_class . ' icon message jpcrm-div-message-box"';
92    if ( ! empty( $id ) ) {
93        $ret .= ' id="' . $id . '"';
94    }
95    $ret .= '>';
96    if ( ! empty( $icon_class ) ) {
97        $ret .= '<i class="' . $icon_class . ' icon"></i>';
98    }
99    $ret .= '<div class="content">';
100    if ( ! empty( $msg_header ) ) {
101        $ret .= '<div style="color:black;" class="header">' . $msg_header . '</div>';
102    }
103    $ret .= '<p>' . $msg . '</p></div></div>';
104
105    return $ret;
106}
107
108/**
109 * Return HTML for a spinner centered in a container
110 */
111function jpcrm_loading_container() {
112    return '<div class="empty-container-with-spinner"><div class="ui active centered inline loader"></div></div>';
113}
114
115function zeroBSCRM_UI2_squareFeedbackUpsell( $title = '', $desc = '', $linkStr = '', $linkTarget = '', $extraClasses = '' ) {
116
117    $html = '';
118
119        $html .= '<div class="zbs-upgrade-banner ' . $extraClasses . '">';
120    if ( ! empty( $title ) ) {
121        $html .= '<h4>' . $title . '</h4>';
122    }
123    if ( ! empty( $desc ) ) {
124        $html .= '<p>' . $desc . '</p>';
125    }
126    if ( ! empty( $linkTarget ) && ! empty( $linkStr ) ) {
127        $html .= '<a class="btn" href="' . $linkTarget . '" target="_blank">' . $linkStr . '</a>';
128    }
129        $html .= '</div>';
130
131    return $html;
132}