Countdown Timer – Widget Countdown - Version 2.0.1

Version Description

  • Integrated Gutenberg editor.

=

Download this release

Release Info

Developer wpdevart
Plugin Icon 128x128 Countdown Timer – Widget Countdown
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.1

images/icon.png ADDED
Binary file
images/post_example.jpg CHANGED
Binary file
includes/admin_menu.php CHANGED
@@ -7,6 +7,7 @@ class wpdevart_countdown_admin_menu{
7
  private $menu_name;
8
  private $databese_parametrs;
9
  private $plugin_url;
 
10
  private $text_parametrs;
11
 
12
  /*###################### Constract parameters function ##################*/
@@ -19,16 +20,31 @@ class wpdevart_countdown_admin_menu{
19
  $this->plugin_url=$params['plugin_url'];
20
  else
21
  $this->plugin_url=trailingslashit(dirname(plugins_url('',__FILE__)));
22
-
23
-
 
 
 
 
24
  // Insert button code
25
  add_action('media_buttons_context', array($this,'wpdevart_countdown_button'));
26
  add_action( 'wp_ajax_wpdevart_countdown_window_manager', array($this,'wpdevart_countdown_window_insert_content') );
27
 
28
  add_action( 'wp_ajax_wpdevart_countdown_page_save', array($this,'save_in_databese') );
29
  add_action( 'wp_ajax_wpdevart_countdown_send_mail', array($this,'sending_mail') );
 
 
 
 
 
 
 
 
30
  }
31
 
 
 
 
32
  /*############################### Insert button function ########################################*/
33
 
34
  public function wpdevart_countdown_button($context) {
7
  private $menu_name;
8
  private $databese_parametrs;
9
  private $plugin_url;
10
+ private $plugin_path;
11
  private $text_parametrs;
12
 
13
  /*###################### Constract parameters function ##################*/
20
  $this->plugin_url=$params['plugin_url'];
21
  else
22
  $this->plugin_url=trailingslashit(dirname(plugins_url('',__FILE__)));
23
+ if(isset($params['plugin_path']))
24
+ $this->plugin_path=$params['plugin_url'];
25
+ else
26
+ $this->plugin_path=trailingslashit(dirname( plugin_dir_path( __FILE__ )));
27
+ // include requered files
28
+ $this->include_files();
29
  // Insert button code
30
  add_action('media_buttons_context', array($this,'wpdevart_countdown_button'));
31
  add_action( 'wp_ajax_wpdevart_countdown_window_manager', array($this,'wpdevart_countdown_window_insert_content') );
32
 
33
  add_action( 'wp_ajax_wpdevart_countdown_page_save', array($this,'save_in_databese') );
34
  add_action( 'wp_ajax_wpdevart_countdown_send_mail', array($this,'sending_mail') );
35
+ /*gutenberg editor integration*/
36
+ $this->integrete_gutenberg();
37
+ }
38
+
39
+ /*############################### Insert button function ########################################*/
40
+
41
+ private function include_files(){
42
+ require_once($this->plugin_path.'includes/gutenberg/gutenberg.php');
43
  }
44
 
45
+ private function integrete_gutenberg(){
46
+ $wpdevart_countdown = new wpda_countdown_gutenberg($this->plugin_url);
47
+ }
48
  /*############################### Insert button function ########################################*/
49
 
50
  public function wpdevart_countdown_button($context) {
includes/gutenberg/block.js ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( blocks, editor, i18n, element, components, _ ) {
2
+ var el = element.createElement;
3
+ var RichText = editor.RichText;
4
+ var MediaUpload = editor.MediaUpload;
5
+ var currentdate = new Date();
6
+ var pro_feature_text="If you want to use this feature upgrade to Countdown Pro";
7
+
8
+ blocks.registerBlockType( 'wpdevart-countdown/countdown', {
9
+ title: 'WpDevArt Countdown',
10
+ icon: "clock" ,
11
+ category: 'common',
12
+ keywords:['countdown','timer'],
13
+ attributes: {
14
+ open_or_close: {
15
+ type: 'boolean',
16
+ value: true,
17
+ default: true
18
+ },
19
+ countdown_days_text:{
20
+ type: 'string',
21
+ value: "",
22
+ default: "Days",
23
+ },
24
+ countdown_hourse_text:{
25
+ type: 'string',
26
+ value: "Hours",
27
+ default: "Hours"
28
+ },
29
+ countdown_minuts_text:{
30
+ type: 'string',
31
+ value: "Minutes",
32
+ default: "Minutes"
33
+ },
34
+ countdown_seconds_text:{
35
+ type: 'string',
36
+ value: "Seconds",
37
+ default: "Seconds"
38
+ },
39
+ countdown_experet_type:{
40
+ type: 'string',
41
+ value: "time",
42
+ default: "time"
43
+ },
44
+ countdown_experet_date:{
45
+ type: 'string',
46
+ value:"",
47
+ default:""
48
+ },
49
+ countdownday:{
50
+ type: 'string',
51
+ value: "0",
52
+ default: "0"
53
+ },
54
+ countdownhour:{
55
+ type: 'string',
56
+ value: "1",
57
+ default: "1"
58
+ },
59
+ countdownminute:{
60
+ type: 'string',
61
+ value: "1",
62
+ default: "1"
63
+ },
64
+ countdown_start_date:{
65
+ type: 'string',
66
+ value: "",
67
+ default: ""
68
+ },
69
+ countdownstart_on:{
70
+ type: 'string',
71
+ value: "hide",
72
+ default: "hide"
73
+ },
74
+ expeiret_text:{
75
+ type: 'string',
76
+ value: "",
77
+ default: ""
78
+ },
79
+ countdown_in_content_position:{
80
+ type: 'string',
81
+ value: "center",
82
+ default: "center"
83
+ },
84
+ countdown_top_distance:{
85
+ type: 'string',
86
+ value: "10",
87
+ default: "10"
88
+ },
89
+ countdown_bottom_distance:{
90
+ type: 'string',
91
+ value: "10",
92
+ default: "10"
93
+ },
94
+ countdown_type:{
95
+ type: 'string',
96
+ value: "button",
97
+ default: "button"
98
+ },
99
+ countdown_font_color:{
100
+ type: 'string',
101
+ value: "#000000",
102
+ default: "#000000"
103
+ },
104
+ countdown_button_color:{
105
+ type: 'string',
106
+ value: "#3DA8CC",
107
+ default: "#3DA8CC"
108
+ },
109
+ countdown_circle_size:{
110
+ type: 'string',
111
+ value: "130",
112
+ default: "130"
113
+ },
114
+ countdown_circle_border:{
115
+ type: 'string',
116
+ value: "5",
117
+ default: "5"
118
+ },
119
+ countdown_border_radius:{
120
+ type: 'string',
121
+ value: "8",
122
+ default: "8"
123
+ },
124
+ countdown_font_size:{
125
+ type: 'string',
126
+ value: "30",
127
+ default: "30"
128
+ },
129
+ countdown_font_famaly:{
130
+ type: 'string',
131
+ value: "monospace",
132
+ default: "monospace"
133
+ },
134
+ countdown_animation_type:{
135
+ type: 'string',
136
+ value: "",
137
+ default: ""
138
+ }
139
+ },
140
+ edit: function( props ) {
141
+ if(props.attributes.countdown_start_date===""){
142
+ props.setAttributes({countdown_start_date:(parseInt(Date.now()/1000)+"")})
143
+ }
144
+ return el( 'span', { },create_open_hide_block()
145
+
146
+ );
147
+
148
+ function create_open_hide_block(){
149
+ var open_or_close_class="";
150
+ if(props.attributes.open_or_close===false){
151
+ open_or_close_class=" closed_params";
152
+ }
153
+ return el("div",{className:"wpdevart_countdown_main_collapsible_element"+open_or_close_class},create_head(),create_content())
154
+ }
155
+ function create_head(){
156
+ return el("div",{className:"head_block",onClick:function(value){open_close_element(value)}},
157
+ el("span",{className:"title_image"},
158
+ el("img",{src:wpda_countdown_gutenberg['other_data']['content_icon']})
159
+ ),
160
+ el("span",{className:"title fdghdfg"},"WpDevArt Countdown"
161
+
162
+ ),
163
+ el("span",{className:"head_block"},
164
+
165
+ ),
166
+ el("span",{className:"open_or_closed"},
167
+
168
+ ),
169
+ );
170
+ }
171
+ function create_content(){
172
+ var wpda_countdown_fields=new Array();
173
+ var aditional_css_for_countdownday={};
174
+ var aditional_css_countdown_experet_date={};
175
+ var font_familis={"Arial,Helvetica Neue,Helvetica,sans-serif":"Arial *","Arial Black,Arial Bold,Arial,sans-serif":"Arial Black *","Arial Narrow,Arial,Helvetica Neue,Helvetica,sans-serif":"Arial Narrow *","Courier,Verdana,sans-serif":"Courier *","Georgia,Times New Roman,Times,serif":"Georgia *","Times New Roman,Times,Georgia,serif":"Times New Roman *","Trebuchet MS,Lucida Grande,Lucida Sans Unicode,Lucida Sans,Arial,sans-serif":"Trebuchet MS *","Verdana,sans-serif":"Verdana *","American Typewriter,Georgia,serif":"American Typewriter","Andale Mono,Consolas,Monaco,Courier,Courier New,Verdana,sans-serif":"Andale Mono","Baskerville,Times New Roman,Times,serif":"Baskerville","Bookman Old Style,Georgia,Times New Roman,Times,serif":"Bookman Old Style","Calibri,Helvetica Neue,Helvetica,Arial,Verdana,sans-serif":"Calibri","Cambria,Georgia,Times New Roman,Times,serif":"Cambria","Candara,Verdana,sans-serif":"Candara","Century Gothic,Apple Gothic,Verdana,sans-serif":"Century Gothic","Century Schoolbook,Georgia,Times New Roman,Times,serif":"Century Schoolbook","Consolas,Andale Mono,Monaco,Courier,Courier New,Verdana,sans-serif":"Consolas","Constantia,Georgia,Times New Roman,Times,serif":"Constantia","Corbel,Lucida Grande,Lucida Sans Unicode,Arial,sans-serif":"Corbel","Franklin Gothic Medium,Arial,sans-serif":"Franklin Gothic Medium","Garamond,Hoefler Text,Times New Roman,Times,serif":"Garamond","Gill Sans MT,Gill Sans,Calibri,Trebuchet MS,sans-serif":"Gill Sans MT","Helvetica Neue,Helvetica,Arial,sans-serif":"Helvetica Neue","Hoefler Text,Garamond,Times New Roman,Times,sans-serif":"Hoefler Text","Lucida Bright,Cambria,Georgia,Times New Roman,Times,serif":"Lucida Bright","Lucida Grande,Lucida Sans,Lucida Sans Unicode,sans-serif":"Lucida Grande","monospace":"monospace","Palatino Linotype,Palatino,Georgia,Times New Roman,Times,serif":"Palatino Linotype","Tahoma,Geneva,Verdana,sans-serif":"Tahoma","Rockwell, Arial Black, Arial Bold, Arial, sans-serif":"Rockwell"};
176
+ var animation_efects={"none":"none","random":"random","bounce":"bounce","flash":"flash","pulse":"pulse","rubberBand":"rubberBand","shake":"shake","swing":"swing","tada":"tada","wobble":"wobble","bounceIn":"bounceIn","bounceInDown":"bounceInDown","bounceInLeft":"bounceInLeft","bounceInRight":"bounceInRight","bounceInUp":"bounceInUp","fadeIn":"fadeIn","fadeInDown":"fadeInDown","fadeInDownBig":"fadeInDownBig","fadeInLeft":"fadeInLeft","fadeInLeftBig":"fadeInLeftBig","fadeInRight":"fadeInRight","fadeInRightBig":"fadeInRightBig","fadeInUp":"fadeInUp","fadeInUpBig":"fadeInUpBig","flip":"flip","flipInX":"flipInX","flipInY":"flipInY","lightSpeedIn":"lightSpeedIn","rotateIn":"rotateIn","rotateInDownLeft":"rotateInDownLeft","rotateInDownRight":"rotateInDownRight","rotateInUpLeft":"rotateInUpLeft","rotateInUpRight":"rotateInUpRight","rollIn":"rollIn","zoomIn":"zoomIn","zoomInDown":"zoomInDown","zoomInLeft":"zoomInLeft","zoomInRight":"zoomInRight","zoomInUp":"zoomInUp"};
177
+
178
+ if(props.attributes.countdown_experet_type=="time"){
179
+ aditional_css_countdown_experet_date["display"]="none";
180
+ }else{
181
+ aditional_css_for_countdownday["display"]="none";
182
+ }
183
+
184
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input("countdown_days_text","Day field text","Type here text for Day field."));
185
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input("countdown_hourse_text","Hour field text","Type here text for Hour field."));
186
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input("countdown_minuts_text","Minute field text","Type here text for Minute field."));
187
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input("countdown_seconds_text","Second field text","Type here text for Second field."));
188
+ wpda_countdown_fields.push(wpda_countdown_lb_select_open_hide_params("countdown_experet_type",{"time":"Time","date":"Date"},["countdownday","countdown_experet_date"],"Countdown date picker type","Select the Countdown date picker type."));
189
+ wpda_countdown_fields.push(wpda_countdown_lb_days_hourse_minutes("countdownday","countdownhour","countdownminute","Countdown expire time","Type the Countdown expire time.",false,aditional_css_for_countdownday));
190
+ wpda_countdown_fields.push(wpda_countdown_lb_calendar_input("countdown_experet_date","Countdown expire date","Type the Countdown expire date.",false,aditional_css_countdown_experet_date));
191
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdownstart_on",{"hide":"Hide countdown","show_text":"Show text"},"After Countdown expire","Select the action you prefere after Countdown time expire.",false,{color:'red'}));
192
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_textarea("expeiret_text","Message after countdown expire","Type the message that will appear after countdown time expire."));
193
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdown_in_content_position",{"left":"Left","center":"Center","right":"Right"},"Countdown timer position","Select the Countdown Timer position."));
194
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input_with_small("countdown_top_distance","Countdown distance from top","Type the Countdown distance from top(px).","(px)"));
195
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input_with_small("countdown_bottom_distance","Countdown distance from bottom","Type the Countdown distance from bottom(px).","(px)"));
196
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdown_type",{"button":"Button","circle":"Circle","vertical_slide":"Vertical Slider"},"Countdown timer buttons type","Choose the Countdown buttons type.",true));
197
+ wpda_countdown_fields.push(wpda_countdown_lb_color_input("timer_text_color","Countdown timer text color","Choose the Countdown text color.",true));
198
+ wpda_countdown_fields.push(wpda_countdown_lb_color_input("timer_bg_color","Countdown timer background color","Select the Countdown background color.",true));
199
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input_with_small("countdown_border_radius","Countdown timer border radius","Type the Countdown border radius(px).","(px)",true));
200
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_input_with_small("countdown_font_size","Countdown timer font size","Type the Countdown font-size(px).","(px)",true));
201
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdown_font_famaly",font_familis,"Countdown timer Font Family","Select the Countdown Font family.",true));
202
+ wpda_countdown_fields.push(wpda_countdown_lb_simple_select("countdown_type",animation_efects,"Countdown animation type","Select the Countdown animation type.",true));
203
+ wpda_countdown_fields.push(wpdevart_countdown_upgrate_pro_version());
204
+ var table=el("tabel",{className:"wpdevart_countdown_content_block"},wpda_countdown_fields)
205
+ return el("div",{className:"wpdevart_countdown_content_block"},table)
206
+ }
207
+ function open_close_element(colapsible_element){
208
+ var target=colapsible_element.target;
209
+ var head_element;
210
+ if(target.parentNode.classList[0]=="wpdevart_countdown_main_collapsible_element"){
211
+ head_element=target.parentNode;
212
+ }
213
+ if(target.parentNode.parentNode.classList[0]=="wpdevart_countdown_main_collapsible_element"){
214
+ head_element=target.parentNode.parentNode;
215
+ }
216
+ if(target.parentNode.parentNode.parentNode.classList[0]=="wpdevart_countdown_main_collapsible_element"){
217
+ head_element=target.parentNode.parentNode.parentNode;
218
+ }
219
+ if(target.parentNode.parentNode.parentNode.parentNode.classList[0]=="wpdevart_countdown_main_collapsible_element"){
220
+ head_element=target.parentNode.parentNode.parentNode.parentNode;
221
+ }
222
+ if(typeof(head_element.classList[1])=="undefined"){
223
+ props.setAttributes( { open_or_close:false } );
224
+ head_element.classList.add("closed_params");
225
+ }else{
226
+ props.setAttributes( { open_or_close:true } );
227
+ head_element.classList.remove("closed_params");
228
+ }
229
+ }
230
+ function wpda_countdown_lb_simple_input(element_name,element_title,element_description,pro_feature=false,aditional_css={},){
231
+ return el('tr',{className:"wpda_simple_input_tr "+"wpda_countdown_"+element_name,style:aditional_css},
232
+ wpda_countdown_title_and_description(element_title,element_description,pro_feature),
233
+ el('td',{className:"wpda_simple_input_td"},
234
+ el('input',{type:"text",Value:props.attributes[element_name],onMouseDown:function(){if(pro_feature){alert(pro_feature_text); return false;}},className:'wpda_simple_input',onChange: function( value ) {var select=value.target; var params={}; params[element_name]=select.value; props.setAttributes(params)}})
235
+ )
236
+
237
+ );
238
+
239
+ }
240
+ function wpda_countdown_lb_simple_input_with_small(element_name,element_title,element_description,small_text,pro_feature=false,aditional_css={},){
241
+ return el('tr',{className:"wpda_simple_input_tr "+"wpda_countdown_"+element_name,style:aditional_css},
242
+ wpda_countdown_title_and_description(element_title,element_description,pro_feature),
243
+ el('td',{className:"wpda_simple_input_td"},
244
+ el('input',{type:"text",Value:props.attributes[element_name],onMouseDown:function(){if(pro_feature){alert(pro_feature_text); return false;}},className:'wpda_simple_input',onChange: function( value ) {var select=value.target; var params={}; params[element_name]=select.value; props.setAttributes(params)}}),
245
+ el('small',{className:'wpda_countdown_small_text'},small_text)
246
+ )
247
+
248
+ );
249
+
250
+ }
251
+
252
+ function wpda_countdown_lb_simple_textarea(element_name,element_title,element_description,pro_feature=false,aditional_css={}){
253
+ return el('tr',{className:"wpda_simple_input_tr "+"wpda_countdown_"+element_name,style:aditional_css},
254
+ wpda_countdown_title_and_description(element_title,element_description,pro_feature),
255
+ el('td',{className:"wpda_simple_input_td"},
256
+ el('textarea',{type:"text",className:'wpda_simple_input',onChange: function( value ) {var select=value.target; var params={}; params[element_name]=select.value; props.setAttributes(params)}},props.attributes[element_name])
257
+ )
258
+
259
+ );
260
+
261
+ }
262
+ function wpda_countdown_lb_simple_select(element_name,options_list,element_title,element_description,pro_feature=false,aditional_css={}){
263
+ var created_options=new Array();
264
+ for(var key in options_list) {
265
+ selected_option=false;
266
+ if(props.attributes[element_name]==key){
267
+ selected_option=true;
268
+ }
269
+ created_options.push(el('option',{value:''+key+'',selected:selected_option},options_list[key]))
270
+ }
271
+ return el('tr',{className:"wpda_simple_input_tr "+"wpda_countdown_"+element_name, style:aditional_css},
272
+ wpda_countdown_title_and_description(element_title,element_description,pro_feature),
273
+ el('td',{className:"wpda_simple_input_td"},
274
+ el( 'select', { className: "wpda_countdown_select",onMouseDown:function(){if(pro_feature){alert(pro_feature_text); return false;}},onChange: function( value ) {var select=value.target; var params={}; params[element_name]=select.options[select.selectedIndex].value; props.setAttributes( params)}},created_options),
275
+ )
276
+ );
277
+
278
+ }
279
+
280
+ function wpda_countdown_lb_select_open_hide_params(element_name,options_list,open_closed_ids,element_title,element_description,pro_feature=false,aditional_css=""){
281
+ var created_options=new Array();
282
+
283
+ for(var key in options_list) {
284
+ selected_option=false;
285
+ if(props.attributes[element_name]==key){
286
+ selected_option=true;
287
+ }
288
+ created_options.push(el('option',{value:''+key+'',selected:selected_option},options_list[key]))
289
+ }
290
+ return el('tr',{className:"wpda_simple_input_tr "+"wpda_countdown_"+element_name},
291
+ wpda_countdown_title_and_description(element_title,element_description,pro_feature),
292
+ el('td',{className:"wpda_simple_input_td"},
293
+ el( 'select', { className: "wpda_countdown_select",onChange: function( value ) {
294
+ var select=value.target;
295
+ var curent_element_parent_div=select.parentNode.parentNode.parentNode;
296
+ var params={};
297
+ params[element_name]=select.options[select.selectedIndex].value;
298
+
299
+ for(var i=0;i<open_closed_ids.length;i++){
300
+
301
+ curent_element_parent_div.getElementsByClassName("wpda_countdown_"+open_closed_ids[i])[0].style.display="none";
302
+ }
303
+ curent_element_parent_div.getElementsByClassName("wpda_countdown_"+open_closed_ids[select.selectedIndex])[0].style.display="initial";
304
+ props.setAttributes( params );
305
+ }
306
+ },created_options),
307
+ )
308
+ );
309
+
310
+ }
311
+
312
+ function wpda_countdown_lb_days_hourse_minutes(element_day_name,element_hour_name,element_minut_name,element_title,element_description,pro_feature=false,aditional_css={}){
313
+ return el('tr',{className:"wpda_simple_input_tr "+"wpda_countdown_"+element_day_name, style:aditional_css},
314
+ wpda_countdown_title_and_description(element_title,element_description,pro_feature),
315
+ el('td',{className:"wpda_simple_input_td"},
316
+ el('span',{className:'wpda_simple_span_time'},
317
+ el('input',{seze:"3",type:"text",Value:props.attributes[element_day_name],className:'wpda_simple_input_time',onChange: function( value ) {var select=value.target; var params={}; params[element_day_name]=select.value; props.setAttributes(params)}}),
318
+ el("small",{className:"wpda_simple_input_time_small"},"Day")
319
+ ),
320
+ el('span',{className:'wpda_simple_span_time'},
321
+ el('input',{seze:"3",type:"text",Value:props.attributes[element_hour_name],className:'wpda_simple_input_time',onChange: function( value ) {var select=value.target; var params={}; params[element_hour_name]=select.value; props.setAttributes(params)}}),
322
+ el("small",{className:"wpda_simple_input_time_small"},"Hour")
323
+ ),
324
+ el('span',{className:'wpda_simple_span_time'},
325
+ el('input',{seze:"3",type:"text",Value:props.attributes[element_minut_name],className:'wpda_simple_input_time',onChange: function( value ) {var select=value.target; var params={}; params[element_minut_name]=select.value; props.setAttributes(params)}}),
326
+ el("small",{className:"wpda_simple_input_time_small"},"Minut")
327
+ )
328
+ )
329
+
330
+ );
331
+
332
+ }
333
+
334
+ function wpda_countdown_lb_calendar_input(element_name,element_title,element_description,pro_feature=false,aditional_css={}){
335
+ var date="";
336
+
337
+ if(props.attributes[element_name]===""){
338
+ var params={};
339
+ params[element_name]=moment().format("YYYY-MM-DDTHH:mm:ss");
340
+ props.setAttributes(params[element_name]);
341
+ }
342
+ if(props.attributes[element_name]===""){
343
+ date=moment().format("YYYY-MM-DDTHH:mm:ss");
344
+ }else{
345
+ date=props.attributes[element_name];
346
+ }
347
+ return el('tr',{className:"wpda_simple_input_tr "+"wpda_countdown_"+element_name, style:aditional_css},
348
+ wpda_countdown_title_and_description(element_title,element_description,pro_feature),
349
+ el('td',{className:"wpda_simple_input_td"},
350
+
351
+ el(components.DateTimePicker,{type:"input",currentDate:date, onChange: function( value ) { var params={}; params[element_name]=value; props.setAttributes(params)}})
352
+ )
353
+
354
+ );
355
+
356
+ }
357
+
358
+ function wpda_countdown_lb_color_input(element_name,element_title,element_description,pro_feature=false,aditional_css={}){
359
+ return el('tr',{className:"wpda_simple_input_tr "+"wpda_countdown_"+element_name,style:aditional_css},
360
+ wpda_countdown_title_and_description(element_title,element_description,pro_feature),
361
+ el('td',{className:"wpda_color_input_td"},
362
+ el('input',{type:"color",onMouseDown:function(){if(pro_feature){alert(pro_feature_text); return false;}},Value:props.attributes[element_name],className:'wpda_simple_input',onChange: function( value ) {var select=value.target; var params={}; params[element_name]=select.value; props.setAttributes(params)}})
363
+ )
364
+
365
+ );
366
+
367
+ }
368
+
369
+ function wpda_countdown_title_and_description(element_title,element_description,pro_feature=false){
370
+ if(pro_feature){
371
+ var pro_element=el("span",{className:"pro_feature"}," (pro)");
372
+ }else{
373
+ var pro_element="";
374
+ }
375
+ return el('td',{className:"wpda_title_description_td"},
376
+ el('span',{className:"wpda_countdown_element_title"},element_title
377
+
378
+ ),
379
+
380
+ pro_element,
381
+
382
+ el('span',{className:"wpda_countdown_element_description",title:element_description},"?"
383
+ )
384
+ )
385
+ }
386
+ function wpdevart_countdown_upgrate_pro_version(){
387
+ return el("tr",{},
388
+ el("td",{colspan:"2",className:"wpdevart_countdown_upgrate_pro_link_td"},
389
+ el("a",{href:"https://wpdevart.com/wordpress-countdown-plugin",target:"_blank",style:{'text-align':'center','color': 'rgba(10, 154, 62, 1)','font-weight': 'bold','font-size':'18px', 'text-decoration': 'none'}},'Upgrade to Pro Version')
390
+ )
391
+ )
392
+ }
393
+
394
+ },
395
+
396
+ save: function( props ) {
397
+ var shortcode_atributes="";
398
+ start_time="";
399
+ start_time=props.attributes.countdown_start_date+"";
400
+ var end_date=""
401
+ var datetime=new Array();
402
+ var date=new Array();
403
+ var time=new Array();
404
+ if(props.attributes.countdown_experet_date.length!=0){
405
+ datetime=props.attributes.countdown_experet_date.split('T');
406
+ date=datetime[0].split('-');
407
+ time=datetime[1].split(':');
408
+ end_date=date[2]+"-"+date[1]+"-"+date[0]+" "+time[0]+":"+time[1];
409
+ }
410
+
411
+
412
+ shortcode_atributes = shortcode_atributes + 'text_for_day="' + props.attributes.countdown_days_text + '"';
413
+ shortcode_atributes = shortcode_atributes + ' text_for_hour="' + props.attributes.countdown_hourse_text + '"';
414
+ shortcode_atributes = shortcode_atributes + ' text_for_minut="' + props.attributes.countdown_minuts_text + '"';
415
+ shortcode_atributes = shortcode_atributes + ' text_for_second="' + props.attributes.countdown_seconds_text + '"';
416
+ shortcode_atributes = shortcode_atributes + ' countdown_end_type="' + props.attributes.countdown_experet_type + '"';
417
+ shortcode_atributes = shortcode_atributes + ' end_date="' + end_date + '"';
418
+ shortcode_atributes = shortcode_atributes + ' start_time="' + start_time + '"';
419
+ shortcode_atributes = shortcode_atributes + ' end_time="' + props.attributes.countdownday + ',' + props.attributes.countdownhour + ',' + props.attributes.countdownminute +'"';
420
+ shortcode_atributes = shortcode_atributes + ' action_end_time="' + props.attributes.countdownstart_on + '"';
421
+ shortcode_atributes = shortcode_atributes + ' content_position="' + props.attributes.countdown_in_content_position + '"';
422
+ shortcode_atributes = shortcode_atributes + ' top_ditance="' + props.attributes.countdown_top_distance + '"';
423
+ shortcode_atributes = shortcode_atributes + ' bottom_distance="' + props.attributes.countdown_bottom_distance + '"';
424
+ shortcode_atributes = shortcode_atributes + ' countdown_type="button"';
425
+ shortcode_atributes = shortcode_atributes + ' font_color="#000000"';
426
+ shortcode_atributes = shortcode_atributes + ' button_bg_color="#3DA8CC"';
427
+ shortcode_atributes = shortcode_atributes + ' circle_size="130"';
428
+ shortcode_atributes = shortcode_atributes + ' circle_border="5"';
429
+ shortcode_atributes = shortcode_atributes + ' border_radius="8"';
430
+ shortcode_atributes = shortcode_atributes + ' font_size="30"';
431
+ shortcode_atributes = shortcode_atributes + ' countdown_font_famaly="monospace"';
432
+ shortcode_atributes = shortcode_atributes + ' animation_type=""';
433
+ return "[wpdevart_countdown "+shortcode_atributes+"]"+props.attributes.expeiret_text+"[/wpdevart_countdown]";
434
+ }
435
+
436
+ } )
437
+ } )(
438
+ window.wp.blocks,
439
+ window.wp.editor,
440
+ window.wp.i18n,
441
+ window.wp.element,
442
+ window.wp.components,
443
+ window._,
444
+ );
445
+
includes/gutenberg/gutenberg.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class wpda_countdown_gutenberg{
3
+ private $plugin_url;
4
+ function __construct($plugin_url){
5
+ $this->plugin_url=$plugin_url;
6
+ $this->hooks_for_gutenberg();
7
+ }
8
+ private function hooks_for_gutenberg(){
9
+ add_action( 'init', array($this,'guthenberg_init') );
10
+ }
11
+ public function guthenberg_init(){
12
+ if ( ! function_exists( 'register_block_type' ) ) {
13
+ // Gutenberg is not active.
14
+ return;
15
+ }
16
+ register_block_type( 'wpdevart-countdown/countdown', array(
17
+ 'style' => 'wpda_countdown_gutenberg_css',
18
+ 'editor_script' => 'wpda_countdown_gutenberg_js',
19
+ ) );
20
+ wp_add_inline_script(
21
+ 'wpda_countdown_gutenberg_js',
22
+ sprintf('var wpda_countdown_gutenberg = { other_data: %s};',json_encode($this->other_dates(),JSON_PRETTY_PRINT)),
23
+ 'before'
24
+ );
25
+ }
26
+
27
+ private function other_dates(){
28
+ $array=array('icon_src'=>$this->plugin_url."images/icon.svg","content_icon"=>$this->plugin_url."images/icon.png");
29
+ return $array;
30
+ }
31
+
32
+ }
33
+
includes/gutenberg/style.css ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Note that these styles are loaded *before* editor styles, so that
3
+ * editor-specific styles using the same selectors will take precedence.
4
+ */
5
+
6
+ .wpdevart_gutenberg_timer_main_div label{
7
+ min-width: 120px;
8
+ display: inline-block;
9
+ }
10
+ .wpdevart_gutenberg_timer_main_div select{
11
+ min-width: 120px;
12
+ }
13
+ .wpdevart_gutenberg_timer_main_div > span{
14
+ font-weight: bold;
15
+ color: #0085ba;
16
+ }
17
+ .wpdevart_countdown_content_block{
18
+ display: block;
19
+ }
20
+
21
+ .wpdevart_countdown_content_block > tr{
22
+ min-height: 40px;
23
+ }
24
+ .wpdevart_countdown_main_collapsible_element{
25
+ background-color: #fafafa;
26
+ display: inline-block;
27
+ width: 100%;
28
+ box-sizing: border-box !important;
29
+ position: relative;
30
+ min-width: 430px;
31
+ border: 1px solid #e5e5e5;
32
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
33
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
34
+ margin-bottom: 20px;
35
+ padding: 0;
36
+ line-height: 1;
37
+ padding-left: 3px;
38
+ }
39
+ .wpdevart_countdown_main_collapsible_element.closed_params .wpdevart_countdown_content_block{
40
+ display: none;
41
+ }
42
+ .wpdevart_countdown_main_collapsible_element .title_image img{
43
+ height: 34px;
44
+ float: left;
45
+ padding-top: 2px;
46
+
47
+ }
48
+ .wpdevart_countdown_content_block > tr:nth-child(odd) {
49
+ background-color: rgba(176, 176, 176, 0.07);
50
+ }
51
+ .wpdevart_countdown_main_collapsible_element .title{
52
+ display: inline-block;
53
+ -webkit-user-select: none;
54
+ -moz-user-select: none;
55
+ -ms-user-select: none;
56
+ user-select: none;
57
+ font-weight: bold;
58
+ font-size: 15px;
59
+ padding: 8px 12px;
60
+ margin: 0;
61
+ line-height: 1.4;
62
+ }
63
+ .wpdevart_countdown_main_collapsible_element .head_block{
64
+ cursor: pointer;
65
+ border-bottom: 1px solid #e5e5e5;
66
+ }
67
+ .wpdevart_countdown_main_collapsible_element .head_block .open_or_closed {
68
+ float: right;
69
+ height: 20px;
70
+ right: 10px;
71
+ color: #aaa;
72
+ font: 400 20px/1 dashicons;
73
+ speak: none;
74
+ display: inline-block;
75
+ top: 8px;
76
+ position: relative;
77
+ -webkit-font-smoothing: antialiased;
78
+ -moz-osx-font-smoothing: grayscale;
79
+ text-decoration: none!important;
80
+ }
81
+ .wpdevart_countdown_main_collapsible_element .head_block:hover .open_or_closed{
82
+ color:#777
83
+ }
84
+ .wpdevart_countdown_main_collapsible_element .head_block .open_or_closed:before{
85
+ content: '\f142';
86
+ }
87
+ .wpdevart_countdown_main_collapsible_element.closed_params .head_block .open_or_closed:before{
88
+ content: '\f140';
89
+ }
90
+ .wpdevart_countdown_content_block .wpda_simple_input_td,.wpdevart_countdown_content_block .wpda_color_input_td{
91
+ width:100%;
92
+ vertical-align: middle;
93
+ padding-left: 3px;
94
+ }
95
+ .wpdevart_countdown_content_block .wpda_title_description_td{
96
+ min-width: 320px;
97
+ line-height: 21px;
98
+ vertical-align: middle;
99
+ height: 45px;
100
+ font-size: 14px;
101
+ font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
102
+ }
103
+
104
+ .wpda_countdown_element_description{
105
+ float: right;
106
+ cursor: default;
107
+ color: #0074a2;
108
+ font-size: 18px;
109
+ font-weight: bold;
110
+ border: 1px solid #000000;
111
+ border-radius: 200px;
112
+ height: 23px;
113
+ padding-left: 6px;
114
+ padding-right: 6px;
115
+ margin-left: 15px;
116
+ }
117
+
118
+ .wpda_simple_input_time{
119
+ width:50px;
120
+ }
121
+ .wpda_simple_span_time{
122
+ display: inline-block;
123
+ margin-right: 3px;
124
+ width: 55px;
125
+ }
126
+ .wpdevart_countdown_content_block .components-datetime__date-help-button,
127
+ .wpdevart_countdown_content_block .components-datetime__date{
128
+ display:none !important;
129
+ }
130
+ .wpda_simple_input_td fieldset{
131
+ display: inline-block;
132
+ }
133
+ .wpda_simple_input_td .components-datetime__time .components-datetime__time-wrapper .components-datetime__time-field input[type=number] {
134
+ width: 30px;
135
+ padding: 0px;
136
+ }
137
+ .wpda_simple_input_td .components-datetime__time {
138
+ margin-bottom: 5px;
139
+ }
140
+ .wpda_color_input_td input{
141
+ padding: 0px !important;
142
+ width: 105px;
143
+ height: 30px;
144
+ }
145
+ .pro_feature {
146
+ font-size: 13px;
147
+ font-weight: bold;
148
+ color: rgba(10, 154, 62, 1);
149
+ }
150
+ .wpdevart_countdown_upgrate_pro_link_td{
151
+ text-align: center;
152
+ height: 31px;
153
+ vertical-align: middle;
154
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: wpdevart
3
  Donate link: http://wpdevart.com/wordpress-countdown-plugin
4
  Tags: countdown, countdown widget, countdown timer, countdown system, countdown generator
5
  Requires at least: 3.3.0
6
- Tested up to: 4.9.8
7
- Stable tag: 2.0.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -442,6 +442,10 @@ Yes dear users, you need to pay only one time for pro version, it's lifetime pla
442
 
443
  * Changed featured plugins text in admin menu.
444
 
 
 
 
 
445
  == Step by step guide ==
446
 
447
  ### Options
3
  Donate link: http://wpdevart.com/wordpress-countdown-plugin
4
  Tags: countdown, countdown widget, countdown timer, countdown system, countdown generator
5
  Requires at least: 3.3.0
6
+ Tested up to: 5.0.0
7
+ Stable tag: 2.0.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
442
 
443
  * Changed featured plugins text in admin menu.
444
 
445
+ = 2.0.1 =
446
+
447
+ * Integrated Gutenberg editor.
448
+
449
  == Step by step guide ==
450
 
451
  ### Options
wpdevart-countdown.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Countdown Wpdevart
4
  Plugin URI: http://wpdevart.com/wordpress-countdown-plugin/
5
  Description: Countdown plugin is an nice tool to create and insert countdown timers into your posts/pages and widgets .
6
- Version: 2.0.0
7
  Author: wpdevart
8
  Author URI: http://wpdevart.com
9
  License: GPL3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -18,8 +18,6 @@ class wpdevart_countdown_main{
18
  private $wpdevart_countdown_plugin_path;
19
 
20
  private $wpdevart_countdown_version;
21
-
22
- public $wpdevart_countdown_options;
23
 
24
  /*###################### Construct function ##################*/
25
 
@@ -45,7 +43,7 @@ class wpdevart_countdown_main{
45
 
46
  require_once($this->wpdevart_countdown_plugin_path.'includes/admin_menu.php');
47
 
48
- $wpdevart_countdown_admin_menu = new wpdevart_countdown_admin_menu(array('menu_name' => 'Countdown','databese_parametrs'=>$this->wpdevart_countdown_options));
49
 
50
  add_action('admin_menu', array($wpdevart_countdown_admin_menu,'create_menu'));
51
 
@@ -58,7 +56,7 @@ class wpdevart_countdown_main{
58
  require_once($this->wpdevart_countdown_plugin_path.'includes/front_end.php');
59
  require_once($this->wpdevart_countdown_plugin_path.'includes/widget.php');
60
 
61
- $wpdevart_countdown_front_end = new wpdevart_countdown_front_end(array('menu_name' => 'countdown','databese_parametrs'=>$this->wpdevart_countdown_options));
62
 
63
  }
64
 
@@ -72,6 +70,11 @@ class wpdevart_countdown_main{
72
  // datepicker
73
  wp_register_script('foundation-datepicker',$this->wpdevart_countdown_plugin_url.'includes/javascript/foundation-datepicker.min.js');
74
  wp_register_style('foundation-datepicker',$this->wpdevart_countdown_plugin_url.'includes/style/foundation-datepicker.min.css');
 
 
 
 
 
75
  }
76
 
77
  /*###################### Call base filters function ##################*/
3
  Plugin Name: Countdown Wpdevart
4
  Plugin URI: http://wpdevart.com/wordpress-countdown-plugin/
5
  Description: Countdown plugin is an nice tool to create and insert countdown timers into your posts/pages and widgets .
6
+ Version: 2.0.1
7
  Author: wpdevart
8
  Author URI: http://wpdevart.com
9
  License: GPL3 http://www.gnu.org/licenses/gpl-3.0.html
18
  private $wpdevart_countdown_plugin_path;
19
 
20
  private $wpdevart_countdown_version;
 
 
21
 
22
  /*###################### Construct function ##################*/
23
 
43
 
44
  require_once($this->wpdevart_countdown_plugin_path.'includes/admin_menu.php');
45
 
46
+ $wpdevart_countdown_admin_menu = new wpdevart_countdown_admin_menu(array('menu_name' => 'Countdown'));
47
 
48
  add_action('admin_menu', array($wpdevart_countdown_admin_menu,'create_menu'));
49
 
56
  require_once($this->wpdevart_countdown_plugin_path.'includes/front_end.php');
57
  require_once($this->wpdevart_countdown_plugin_path.'includes/widget.php');
58
 
59
+ $wpdevart_countdown_front_end = new wpdevart_countdown_front_end(array('menu_name' => 'countdown'));
60
 
61
  }
62
 
70
  // datepicker
71
  wp_register_script('foundation-datepicker',$this->wpdevart_countdown_plugin_url.'includes/javascript/foundation-datepicker.min.js');
72
  wp_register_style('foundation-datepicker',$this->wpdevart_countdown_plugin_url.'includes/style/foundation-datepicker.min.css');
73
+
74
+ // gutenberg
75
+ wp_register_script('wpda_countdown_gutenberg_js',$this->wpdevart_countdown_plugin_url.'includes/gutenberg/block.js',array( 'wp-element', 'wp-blocks', 'wp-i18n', 'wp-editor', 'underscore' ));
76
+ wp_register_style('wpda_countdown_gutenberg_css',$this->wpdevart_countdown_plugin_url.'includes/gutenberg/style.css');
77
+
78
  }
79
 
80
  /*###################### Call base filters function ##################*/