PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 5.1.1
Hustle – Email Marketing, Lead Generation, Optins, Popups v5.1.1
7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / lib / wpmu-lib / js / src / wpmu-binary.js
wordpress-popup / lib / wpmu-lib / js / src Last commit date
wpmu-ajaxdata.js 9 years ago wpmu-binary.js 9 years ago wpmu-card-list.js 9 years ago wpmu-ui-hooks.js 9 years ago wpmu-ui-progress.js 9 years ago wpmu-ui-window.js 9 years ago wpmu-ui.js 9 years ago wpmu-vnav.js 9 years ago
wpmu-binary.js
165 lines
1 /*!
2 * WPMU Dev UI library
3 * (Philipp Stracker for WPMU Dev)
4 *
5 * This module provides the WpmUiBinary object that is used to
6 * serialize/deserialize data in base64.
7 *
8 * @version 1.0.0
9 * @author Philipp Stracker for WPMU Dev
10 * @requires jQuery
11 */
12 /*global jQuery:false */
13 /*global window:false */
14 /*global document:false */
15 /*global XMLHttpRequest:false */
16
17 (function( wpmUi ) {
18
19 /*===============================*\
20 ===================================
21 == ==
22 == UTF8-DATA ==
23 == ==
24 ===================================
25 \*===============================*/
26
27
28
29
30 /**
31 * Handles conversions of binary <-> text.
32 *
33 * @type WpmUiBinary
34 * @since 1.0.0
35 */
36 wpmUi.WpmUiBinary = function() {
37 var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
38
39 wpmUi.WpmUiBinary.utf8_encode = function utf8_encode( string ) {
40 if ( typeof string !== 'string' ) {
41 return string;
42 } else {
43 string = string.replace(/\r\n/g, "\n");
44 }
45 var output = '', i = 0, charCode;
46
47 for ( i; i < string.length; i++ ) {
48 charCode = string.charCodeAt(i);
49
50 if ( charCode < 128 ) {
51 output += String.fromCharCode( charCode );
52 } else if ( (charCode > 127) && (charCode < 2048) ) {
53 output += String.fromCharCode( (charCode >> 6) | 192 );
54 output += String.fromCharCode( (charCode & 63) | 128 );
55 } else {
56 output += String.fromCharCode( (charCode >> 12) | 224 );
57 output += String.fromCharCode( ((charCode >> 6) & 63) | 128 );
58 output += String.fromCharCode( (charCode & 63) | 128 );
59 }
60 }
61
62 return output;
63 };
64
65 wpmUi.WpmUiBinary.utf8_decode = function utf8_decode( string ) {
66 if ( typeof string !== 'string' ) {
67 return string;
68 }
69
70 var output = '', i = 0, charCode = 0;
71
72 while ( i < string.length ) {
73 charCode = string.charCodeAt(i);
74
75 if ( charCode < 128 ) {
76 output += String.fromCharCode( charCode );
77 i += 1;
78 } else if ( (charCode > 191) && (charCode < 224) ) {
79 output += String.fromCharCode(((charCode & 31) << 6) | (string.charCodeAt(i + 1) & 63));
80 i += 2;
81 } else {
82 output += String.fromCharCode(((charCode & 15) << 12) | ((string.charCodeAt(i + 1) & 63) << 6) | (string.charCodeAt(i + 2) & 63));
83 i += 3;
84 }
85 }
86
87 return output;
88 };
89
90 /**
91 * Converts a utf-8 string into an base64 encoded string
92 *
93 * @since 1.0.15
94 * @param string input A string with any encoding.
95 * @return string
96 */
97 wpmUi.WpmUiBinary.base64_encode = function base64_encode( input ) {
98 if ( typeof input !== 'string' ) {
99 return input;
100 } else {
101 input = wpmUi.WpmUiBinary.utf8_encode( input );
102 }
103 var output = '', a, b, c, d, e, f, g, i = 0;
104
105 while ( i < input.length ) {
106 a = input.charCodeAt(i++);
107 b = input.charCodeAt(i++);
108 c = input.charCodeAt(i++);
109 d = a >> 2;
110 e = ((a & 3) << 4) | (b >> 4);
111 f = ((b & 15) << 2) | (c >> 6);
112 g = c & 63;
113
114 if ( isNaN( b ) ) {
115 f = g = 64;
116 } else if ( isNaN( c ) ) {
117 g = 64;
118 }
119
120 output += map.charAt( d ) + map.charAt( e ) + map.charAt( f ) + map.charAt( g );
121 }
122
123 return output;
124 };
125
126 /**
127 * Converts a base64 string into the original (binary) data
128 *
129 * @since 1.0.15
130 * @param string input Base 64 encoded text
131 * @return string
132 */
133 wpmUi.WpmUiBinary.base64_decode = function base64_decode( input ) {
134 if ( typeof input !== 'string' ) {
135 return input;
136 } else {
137 input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
138 }
139 var output = '', a, b, c, d, e, f, g, i = 0;
140
141 while ( i < input.length ) {
142 d = map.indexOf( input.charAt( i++ ) );
143 e = map.indexOf( input.charAt( i++ ) );
144 f = map.indexOf( input.charAt( i++ ) );
145 g = map.indexOf( input.charAt( i++ ) );
146
147 a = (d << 2) | (e >> 4);
148 b = ((e & 15) << 4) | (f >> 2);
149 c = ((f & 3) << 6) | g;
150
151 output += String.fromCharCode( a );
152 if ( f !== 64 ) {
153 output += String.fromCharCode( b );
154 }
155 if ( g !== 64 ) {
156 output += String.fromCharCode( c );
157 }
158 }
159
160 return wpmUi.WpmUiBinary.utf8_decode( output );
161 };
162
163 }; /* ** End: WpmUiBinary ** */
164
165 }( window.wpmUi = window.wpmUi || {} ));