PluginProbe
Uji Countdown / 2.2
Uji Countdown v2.2
3.0 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 36 releases
uji-countdown / src / block / save.js

save.js in Uji Countdown 2.2, at src/block/save.js

62 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * WordPress dependencies
3 */
4
5 import { RawHTML } from '@wordpress/element';
6
7 const save = ({ attributes }) => {
8 const {
9 countStyles,
10 timerType,
11 datetime,
12 thour,
13 tmin,
14 tsec,
15 hide,
16 url,
17 unitNum,
18 unitTime,
19 repeats,
20 news,
21 } = attributes;
22
23 const isHide = hide ? 'true' : 'false';
24
25 const tim = timerType === 'repeat' && thour && tmin && tsec ? true : false;
26 const exp = datetime ? datetime.replace(/\//g, '-') : '';
27 const expTime =
28 timerType === 'onetime' && exp && !tim ? 'expire="' + exp + '"' : '';
29 const timerTime = tim
30 ? 'timer="' + thour + ':' + tmin + ':' + tsec + '"'
31 : '';
32 const isNews = news ? ' subscr="' + news : ' subscr="undefined"';
33
34 const rectype = unitNum && repeats ? unitTime : '';
35
36 // [ujicountdown id="test" expire="2020/04/30 06:04" hide="true" url="" subscr="undefined" recurring="" rectype="second" repeats=""]
37 const myShortcode =
38 '[ujicountdown id="' +
39 countStyles +
40 '" ' +
41 expTime +
42 ' ' +
43 timerTime +
44 ' hide="' +
45 isHide +
46 '" url="' +
47 url +
48 '"' +
49 isNews +
50 '" recurring="' +
51 repeats +
52 '" rectype="' +
53 rectype +
54 '" repeats="' +
55 repeats +
56 '"]';
57
58 return <RawHTML>{myShortcode}</RawHTML>;
59 };
60
61 export default save;
62