forked from WPGov/wp-spid-italia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frontend-ui.php
123 lines (97 loc) · 6.18 KB
/
frontend-ui.php
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
<?php
function spid_get_idp_list( $showinfo = false ) {
$return = '';
$plugin_dir = plugin_dir_url( __FILE__ );
$spid_ico_circle_svg = $plugin_dir . '/img/spid-ico-circle-bb.svg';
$spid_ico_circle_png = $plugin_dir . '/img/spid-ico-circle-bb.png';
if ( spid_option('enable_validator') ) {
$provider = array(
array(
'SPID validator',
'https://validator.spid.gov.it',
'test',
0
)
);
$provider[] = array( 'SPID Local', 'http://localhost:8080', 'localhost', 'local' );
$provider[] = array( 'SPID TEST', 'https://demo.spid.gov.it/samlsso', 'demo', 'demo' );
} else {
$provider = array();
}
$shuffle = array();
$shuffle[] = array( 'Infocert ID', 'https://identity.infocert.it', 'infocertid', 1 );
$shuffle[] = array( 'Tim ID', 'https://login.id.tim.it/affwebservices/public/saml2sso', 'timid', 3 );
$shuffle[] = array( 'Poste ID', 'https://posteid.poste.it', 'posteid', 2 );
$shuffle[] = array( 'Sielte ID', 'https://identity.sieltecloud.it', 'sielteid', 4 );
$shuffle[] = array( 'Aruba ID', 'https://loginspid.aruba.it', 'arubaid', 5 );
$shuffle[] = array( 'Namirial ID', 'https://idp.namirialtsp.com/idp', 'namirialid', 6 );
$shuffle[] = array( 'SpidItalia ID', 'https://spid.register.it', 'spiditalia', 7 );
$shuffle[] = array( 'Intesa ID', 'https://spid.intesa.it', 'intesaid', 8 );
$shuffle[] = array( 'Lepida ID', 'https://id.lepida.it/idp/shibboleth', 'lepidaid', 9 );
shuffle( $shuffle );
$provider = array_merge( $provider, $shuffle );
$return .= '<ul id="spid-idp-list-small-root-get" class="spid-idp-button-menu" aria-labelledby="spid-idp">';
foreach ( $provider as $p ) {
$return .= '<li class="spid-idp-button-link" data-idp="infocertid"><a href="'.esc_url( wp_login_url().'?spid_sso=in&spid_idp='.$p[3] ).'" alt="'.$p[0].'"><img class="spid-provider" src="'.$plugin_dir.'img/idp/spid-idp-'.$p[2].'.svg" alt="'.$p[0].'" /></a></li>';
}
if ( $showinfo ) {
$return .= '<li class="spid-idp-support-link"><a href="https://www.spid.gov.it">Maggiori informazioni</a></li>';
$return .= '<li class="spid-idp-support-link"><a href="https://www.spid.gov.it/richiedi-spid">Non hai SPID?</a></li>';
$return .= '<li class="spid-idp-support-link"><a href="https://www.spid.gov.it/serve-aiuto">Serve aiuto?</a></li>';
}
$return .= '</ul>';
return $return;
}
function spid_get_loginform_button() {
$return = '';
$plugin_dir = plugin_dir_url( __FILE__ );
$spid_ico_circle_svg = $plugin_dir . '/img/spid-ico-circle-bb.svg';
$spid_ico_circle_png = $plugin_dir . '/img/spid-ico-circle-bb.png';
$return .= '<!-- Generato con WP SPID Italia v.' . sanitize_text_field( get_option('spid_version') ) . '-->';
$return .= '<div style="text-align:center;">';
$return .= '<a href="#" class="italia-it-button italia-it-button-size-m button-spid" aria-haspopup="true" aria-expanded="false" id="spid-toggle">';
$return .= '<span class="italia-it-button-icon"><img src="'.$spid_ico_circle_svg.'" onerror="this.src=\''.$spid_ico_circle_png.'\'; this.onerror=null;" alt="" /></span>';
$return .= '<span class="italia-it-button-text">Entra con SPID</span>';
$return .= '</a>';
$return .= '<div id="spid-login-desc">SPID è il sistema di accesso che consente di utilizzare, con un\'identità digitale unica, i servizi online della Pubblica Amministrazione e dei privati accreditati.</div>';
$return .= '<div style="font-size:0.8em;margin:0 0 10px 0;font-weight:bold;">';
$return .= '<a href="http://www.spid.gov.it/#registrati">Non hai SPID?</a> • <a href="http://www.spid.gov.it">Maggiori info</a>';
$return .= '</div>';
$return .= '<img src="'.$plugin_dir . '/img/spid-agid-logo-lb.png" width="200px" alt="Agenzia per l\'Italia Digitale" />';
$return .= '</div>';
return $return;
}
function spid_get_login_button_link( $size = 's' ) {
$return = '';
$plugin_dir = plugin_dir_url( __FILE__ );
$spid_ico_circle_svg = $plugin_dir . '/img/spid-ico-circle-bb.svg';
$spid_ico_circle_png = $plugin_dir . '/img/spid-ico-circle-bb.png';
$return .= '<!-- Generato con WP SPID Italia v.' . sanitize_text_field( get_option('spid_version') ) . '-->';
$return .= '<div class="spid-login-button">';
$return .= '<a href="'.esc_url( wp_login_url() ).'" class="italia-it-button italia-it-button-size-'.$size.' button-spid">';
$return .= '<span class="italia-it-button-icon"><img src="'.$spid_ico_circle_svg.'" onerror="this.src=\''.$spid_ico_circle_png.'\'; this.onerror=null;" alt="" /></span>';
$return .= '<span class="italia-it-button-text">Entra con SPID</span>';
$return .= '</a>';
$return .= '</div>';
return $return;
}
function spid_get_login_button( $size = 's' ) {
$return = '';
$plugin_dir = plugin_dir_url( __FILE__ );
$spid_ico_circle_svg = $plugin_dir . '/img/spid-ico-circle-bb.svg';
$spid_ico_circle_png = $plugin_dir . '/img/spid-ico-circle-bb.png';
$return .= '<!-- Generato con WP SPID Italia v.' . sanitize_text_field( get_option('spid_version') ) . '-->';
$return .= '<div class="spid-login-button">';
$return .= '<a href="#" class="italia-it-button italia-it-button-size-'.$size.' button-spid" spid-idp-button="#spid-idp-button-small-get" aria-haspopup="true" aria-expanded="false">';
$return .= '<span class="italia-it-button-icon"><img src="'.$spid_ico_circle_svg.'" onerror="this.src=\''.$spid_ico_circle_png.'\'; this.onerror=null;" alt="" /></span>';
$return .= '<span class="italia-it-button-text">Entra con SPID</span>';
$return .= '</a>';
$return .= '</div>';
$return .= '<div id="spid-idp-button-small-get" class="spid-idp-button spid-idp-button-tip spid-idp-button-relative">';
$return .= '<ul id="spid-idp-list-small-root-get" class="spid-idp-button-menu" aria-labelledby="spid-idp">';
$return .= spid_get_idp_list( true );
$return .= '</ul>';
$return .= '</div>';
return $return;
}
?>