Example #1
0
    public function wpdevart_countdown_window_insert_content()
    {
        //wp_enqueue_script('jquery-ui-slider');
        ?>
        <style>
        #miain_wpdevart_countdown_window_manager > tbody > tr:nth-child(odd) {
		  background-color: rgba(176, 176, 176, 0.07);
		}
		#miain_wpdevart_countdown_window_manager>tfoot>tr>td{
			border-top:1px solid #ccc;
		}
		#TB_window{  
			overflow-y: auto;
		}
		#TB_ajaxContent{
			width:95% !important;
		}
		.wp-picker-holder{
			position: absolute;
 			z-index: 100000;
		}
		.desription_class{
			float: right;
			cursor: default;
			color: #0074a2;
			font-size: 18px;
			font-weight: bold;
			border: 1px solid #000000;
			border-radius: 200px;
			height: 20px;
			padding-left: 6px;
			padding-right: 6px;
			margin-left: 15px;
		}
		.pro_feature {
		  font-size: 13px;
		  font-weight: bold;
		  color: rgba(10, 154, 62, 1);
		}
        </style>
			<table id="miain_wpdevart_countdown_window_manager" class="wp-list-table widefat fixed posts section_parametrs_table">  
                <tbody> 
                    <tr>
						<td>
							Day field text <span title="Type here Day field text." class="desription_class">?</span>
						</td>
						<td>
							<input type="text" name="countdown_days_text"  id="countdown_days_text" value="Days">
						</td>                
					</tr>
                     <tr>
						<td>
							Hour field text  <span title="Type here Hour field text." class="desription_class">?</span>
						</td>
						<td>
							<input type="text" name="countdown_hourse_text"   id="countdown_hourse_text" value="Hours">
						</td>                
					</tr>
                     <tr>
						<td>
							Minute field text <span title="Type here Minute field text." class="desription_class">?</span>
						</td>
						<td>
							<input type="text" name="countdown_minuts_text"  id="countdown_minuts_text" value="Minutes">
						</td>                
					</tr>
                     <tr>
						<td>
							Second field text <span title="Type here Second field text." class="desription_class">?</span>
						</td>
						<td>
							<input type="text" name="countdown_seconds_text"   id="countdown_seconds_text" value="Seconds">
						</td>                
					</tr>
                	<tr>
						<td>
							Countdown expire time <span title="Type the Countdown expire time." class="desription_class">?</span>
						</td>
						<td style="vertical-align: top !important;">
                            <span style="display:inline-block; margin-right:3px; width:55px;">
                            	<input type="text" placeholder="Day"   id="countdownday" size="3" value="0"/>
                            	<small style="display:block">Day</small>
                            </span>
                           	<span style="display:inline-block; width:55px;">
                                 <input type="text"  placeholder="Hour" id="countdownhour" size="3" value="1"/>
                                 <small>Hour</small>
                            </span>
                          	<span style="display:inline-block; width:55px;"> 
                            	<input type="text"  placeholder="Minut"  id="countdownminute" size="3" value="1"/>
                            	<small>minute</small>
                            </span>
                            <input type="hidden" value='<?php 
        echo mktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y"));
        ?>
' id="countdown_start_date" name="countdown_start_date" />
                         </td>                
					</tr>                            
					<tr>
						<td>
							<span style="color:red">After Countdown expired</span> <span title="Select the action after Countdown time expired." class="desription_class">?</span>
						</td>
						<td>
                           <select id="countdownstart_on" >
                                <option selected="selected" value="hide">Hide countdown</option>
                                <option value="show_text">Show text</option>
                        	</select>
                         </td>                
					</tr>
                    </tr>
                     <tr>
						<td>
							Message after countdown expired<span title="Type the message after countdown expired. " class="desription_class">?</span>
						</td>
						<td>
							<textarea type="text" name="expeiret_text"   id="expeiret_text"></textarea>   
                         </td>                
					</tr>
                    <tr>
						<td>
							Countdown timer position <span title="Select the Countdown position." class="desription_class">?</span>
						</td>
						<td>
                           <select  id="countdown_in_content_position">
                                <option  value="left">Left</option>
                                <option selected="selected"  value="center">Center</option>
                                <option  value="right">Right</option>
                        	</select>
                         </td>                
					</tr>
                    <tr>
						<td>
							Distance from top <span title="Type the Countdown distance from top." class="desription_class">?</span>
						</td>
						<td>
							<input type="text" name="countdown_top_distance"  id="countdown_top_distance" value="10">(Px)
						</td>                
					</tr>
					<tr>
						<td>
							Distance from bottom <span title="Type the Countdown distance from bottom." class="desription_class">?</span>
						</td>
						<td>
							<input type="text" name="countdown_bottom_distance"  id="countdown_bottom_distance" value="10">(Px)
						</td>                
					</tr>
                    <tr>
						<td>
							Countdown timer Buttons type<span class="pro_feature"> (pro)</span> <span title="Select the Countdown buttons type." class="desription_class">?</span>
						</td>
						<td>
                           <select onChange="alert(countdown_pro_text)" id="countdown_type" class="coming_set_hiddens">
                                <option selected="selected" value="button">button</option>
                                <option value="circle">Circle</option>
                                <option value="vertical_slide">Vertical Slider</option>
                        	</select>
                         </td>                
					</tr>
                   
                    <tr class="tr_button tr_circle tr_vertical_slide">
                        <td>
                        	Countdown timer text color<span class="pro_feature"> (pro)</span> <span title="Choose the Countdown text color." class="desription_class">?</span>
                        </td>
                        <td>
                          <div onClick="alert(countdown_pro_text)">
                                <div class="wp-picker-container"><a tabindex="0" class="wp-color-result" title="Select Color" data-current="Current Color" style="background-color: rgb(0, 0, 0);"></a></div>
                            </div>
                         </td>                
                    </tr>
                    <tr class="tr_button tr_circle tr_vertical_slide">
                        <td>
                           Countdown timer background color<span class="pro_feature"> (pro)</span> <span title=" Choose the Countdown background color." class="desription_class">?</span>
                        </td>
                        <td>
                            <div onClick="alert(countdown_pro_text)">
                                <div class="wp-picker-container"><a tabindex="0" class="wp-color-result" title="Select Color" data-current="Current Color" style="background-color: rgb(62, 89, 165);"></a></div>
                            </div>
                         </td>                
                    </tr>
                       <tr  class="tr_circle">
						<td>
							Countdown timer Size<span class="pro_feature"> (pro)</span> <span title="Type the Countdown size." class="desription_class">?</span>
						</td>
						<td>
							<input onClick="alert(countdown_pro_text)" type="text" name="countdown_circle_size"  id="countdown_circle_size" value="130">(Px)
						</td>                
					</tr>
                 
                     <tr  class="tr_circle">
						<td>
							Countdown timer border width<span class="pro_feature"> (pro)</span> <span title="Type the Countdown border width." class="desription_class">?</span>
						</td>
						<td>
                        	<input onClick="alert(countdown_pro_text)" type="text" size="3" name="countdown_circle_border" value="5" id="countdown_circle_border" style="font-weight:bold; width:35px" >(0-100)%
                           
						</td>                
					</tr>
                     <tr class="tr_button">
						<td>
							Countdown timer border radius<span class="pro_feature"> (pro)</span> <span title="Type the Countdown border radius." class="desription_class">?</span>
						</td>
						<td>
							<input onClick="alert(countdown_pro_text)" type="text" name="countdown_border_radius"  id="countdown_border_radius" value="8">(Px)
						</td>                
					</tr>
                     <tr  class="tr_button tr_vertical_slide">
						<td>
							Countdown timer font-size<span class="pro_feature"> (pro)</span> <span title="Type the Countdown font-size." class="desription_class">?</span>
						</td>
						<td>
							<input onClick="alert(countdown_pro_text)" type="text" name="countdown_font_size" id="countdown_font_size" value="30">(Px)
						</td>                
					</tr>
                  
                     <tr  class="tr_button tr_circle tr_vertical_slide">
						<td>
							Countdown timer Font family<span class="pro_feature"> (pro)</span> <span title="Choose the Countdown Font family." class="desription_class">?</span>
						</td>
						<td>
							<?php 
        wpdevart_countdown_setting::generete_fonts('countdown_font_famaly', "monospace");
        ?>
						</td>                
					</tr> 
                    <tr>
						<td>
							Countdown animation type<span class="pro_feature"> (pro)</span> <span title="Choose the Countdown animation type." class="desription_class">?</span>
						</td>
						<td>
							<?php 
        wpdevart_countdown_setting::generete_animation_select('countdown_animation_type', 'none');
        ?>
						</td>                
					</tr>
                </tbody>
                <tfoot>
                	<tr>                      
                        <td colspan="2">
                        	 <div style="display:inline-block; float:left;" class="mceActionPanel"><input type="button" id="cancel" name="cancel" value="Insert Countdown" class="button button-primary" onClick="insert_countdown();"/></div>
                        	<span style="float:right"><a href="http://wpdevart.com/wordpress-countdown-plugin/" target="_blank" style="color: rgba(10, 154, 62, 1);; font-weight: bold; font-size: 18px; text-decoration: none;">Upgrade to Pro Version</a><br></span>
                        </td>                
                    </tr>
                </tfoot>
            </table>         
    
                   
    
    <script type="text/javascript">
	
	 	var countdown_pro_text="If you want to use this feature upgrade to Countdown Pro"
       jQuery('#TB_window').css('max-height',(jQuery('#miain_wpdevart_countdown_window_manager').height()+66)+'px');
	   jQuery('#TB_ajaxContent').css('max-height',(jQuery('#miain_wpdevart_countdown_window_manager').height()+16)+'px');
	   jQuery('#miain_wpdevart_countdown_window_manager').ready(function(e) {
                jQuery(".color_option").wpColorPicker();
        });
		jQuery('.coming_set_hiddens').change(function(){
			jQuery(this).find('option').each(function(index, element) {
				jQuery('.tr_'+jQuery(this).val()).hide();
			});
			 jQuery('.tr_'+jQuery(this).val()).show();
		})
		jQuery('.coming_set_hiddens option').each(function(index, element) {
			jQuery('.tr_'+jQuery(this).val()).hide();
		});
		jQuery('.coming_set_hiddens').each(function(index, element) {
			jQuery('.tr_'+jQuery(this).val()).show();
		});
		
		
		jQuery( '.slider_div' ).slider({
			orientation: "horizontal",
			range: "min",
			value: 5,
			min: 0,
			max: 100,
			slide: function( event, ui ) {
				jQuery( loc_this ).val( ui.value );
			}
		});
        function insert_countdown() {          
			
                var tagtext;
				var variables='';
				
				if(jQuery('#countdown_days_text').length)
					variables=variables+'text_for_day="'+jQuery('#countdown_days_text').val()+'" ';
					
				if(jQuery('#countdown_hourse_text').length)
					variables=variables+'text_for_hour="'+jQuery('#countdown_hourse_text').val()+'" ';
					
				if(jQuery('#countdown_minuts_text').length)
					variables=variables+'text_for_minut="'+jQuery('#countdown_minuts_text').val()+'" ';
					
				if(jQuery('#countdown_seconds_text').length)
					variables=variables+'text_for_second="'+jQuery('#countdown_seconds_text').val()+'" ';
				
				if(jQuery('#countdown_start_date').length)
					variables=variables+'start_time="'+jQuery('#countdown_start_date').val()+'" ';
				
					variables=variables+'end_time="'+jQuery('#countdownday').val()+','+jQuery('#countdownhour').val()+','+jQuery('#countdownminute').val()+'" ';
					
				if(jQuery('#countdownstart_on').length)
					variables=variables+'action_end_time="'+jQuery('#countdownstart_on').val()+'" ';
				
				if(jQuery('#countdown_in_content_position').length)
					variables=variables+'content_position="'+jQuery('#countdown_in_content_position').val()+'" ';
					
				if(jQuery('#countdown_top_distance').length)
					variables=variables+'top_ditance="'+jQuery('#countdown_top_distance').val()+'" ';
					
				if(jQuery('#countdown_bottom_distance').length)
					variables=variables+'bottom_distance="'+jQuery('#countdown_bottom_distance').val()+'" ';					
                tagtext = '[wpdevart_countdown '+variables+']'+jQuery('#expeiret_text').val()+'[/wpdevart_countdown]';
                window.send_to_editor(tagtext);
              	tb_remove()
        }

    </script>
    </body>
    </html>
<?php 
        die;
    }
Example #2
0
    function form($instance)
    {
        $defaults = array('title' => '', 'text_for_day' => 'Days', 'text_for_hour' => 'Hours', 'text_for_minut' => 'Minuts', 'text_for_second' => 'Seconds', 'start_time' => mktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y")), 'end_time' => '0,1,5', 'action_end_time' => 'hide', 'content' => '', 'content_position' => 'center', 'top_ditance' => '10', 'bottom_distance' => '10');
        $instance = wp_parse_args((array) $instance, $defaults);
        ?>
        

        <p class="flb_field">
          <label for="title">Title:</label>
          <br>
          <input id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $instance['title'];
        ?>
" class="widefat">
        </p>
        
        <p class="flb_field">
          <label for="<?php 
        echo $this->get_field_id('text_for_day');
        ?>
">Day field text:</label>
          <br>
          <input id="<?php 
        echo $this->get_field_id('text_for_day');
        ?>
" name="<?php 
        echo $this->get_field_name('text_for_day');
        ?>
" type="text" value="<?php 
        echo $instance['text_for_day'];
        ?>
" class="widefat">
        </p>
          
        <p class="flb_field">
          <label for="<?php 
        echo $this->get_field_id('text_for_hour');
        ?>
">Hour field text:</label>
          <br>
          <input id="<?php 
        echo $this->get_field_id('text_for_hour');
        ?>
" name="<?php 
        echo $this->get_field_name('text_for_hour');
        ?>
" type="text" value="<?php 
        echo $instance['text_for_hour'];
        ?>
" class="widefat">
        </p>
          
        <p class="flb_field">
          <label for="<?php 
        echo $this->get_field_id('text_for_minut');
        ?>
">Minute field text:</label>
          <br>
          <input id="<?php 
        echo $this->get_field_id('text_for_minut');
        ?>
" name="<?php 
        echo $this->get_field_name('text_for_minut');
        ?>
" type="text" value="<?php 
        echo $instance['text_for_minut'];
        ?>
" class="widefat">
        </p>
          
        <p class="flb_field">
          <label for="<?php 
        echo $this->get_field_id('text_for_second');
        ?>
">Second field text:</label>
          <br>
          <input id="<?php 
        echo $this->get_field_id('text_for_second');
        ?>
" name="<?php 
        echo $this->get_field_name('text_for_second');
        ?>
" type="text" value="<?php 
        echo $instance['text_for_second'];
        ?>
" class="widefat">
        </p>
        
        <p class="flb_field"> 
        <?php 
        $time_end = explode(',', $instance['end_time']);
        if (isset($time_end[0]) && isset($time_end[1]) && isset($time_end[2])) {
            $time_diferent_seconds = $time_end[0] * 24 * 3600 + $time_end[1] * 3600 + $time_end[2] * 60;
            $ancac_jamanaky = mktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y")) - $instance['start_time'];
            $time_diferent_seconds = $time_diferent_seconds - $ancac_jamanaky;
            if ($time_diferent_seconds < 0) {
                $time_diferent_seconds = 0;
            }
        } else {
            $time_diferent_seconds = 0;
        }
        $day_of_end = (int) ($time_diferent_seconds / (24 * 3600));
        $day_of_end = $day_of_end >= 0 ? $day_of_end : 0;
        $hour_of_end = (int) (($time_diferent_seconds - $day_of_end * 24 * 3600) / 3600);
        $hour_of_end = $hour_of_end >= 0 ? $hour_of_end : 0;
        $minute_of_end = (int) (($time_diferent_seconds - $day_of_end * 24 * 3600 - $hour_of_end * 3600) / 60);
        $minute_of_end = $minute_of_end >= 0 ? $minute_of_end : 0;
        ?>
  
        <script> var countdown_pro_text="If you want to use this feature upgrade to Countdown Pro"</script>
        <style>.pro_feature {
			  font-size: 13px;
			  font-weight: bold;
			  color: rgba(10, 154, 62, 1);
			}</style>
        <label>Countdown expire time :</label>
          <br>     
            <span style="display:inline-block; margin-right:3px; width:55px;">
                <input onChange="insert_in_input();" type="text" placeholder="Day"   class="countdownday" size="3" value="<?php 
        echo $day_of_end;
        ?>
"/><small style="display:block">Day</small>                
            </span>
            
            <span style="display:inline-block; width:55px;">
                <input onChange="insert_in_input();" type="text"  placeholder="Hour" class="countdownhour" size="3" value="<?php 
        echo $hour_of_end;
        ?>
"/><small>Hour</small>                
            </span>
            
            <span style="display:inline-block; width:55px;"> 
                <input onChange="insert_in_input();" type="text"  placeholder="Minut"  class="countdownminute" size="3" value="<?php 
        echo $minute_of_end;
        ?>
"/><small>minute</small>                
            </span>
            <script>function insert_in_input(){
				document.getElementById('<?php 
        echo $this->get_field_id('end_time');
        ?>
').value=document.getElementById('<?php 
        echo $this->get_field_id('end_time');
        ?>
').parentNode.getElementsByClassName('countdownday')[0].value+','+document.getElementById('<?php 
        echo $this->get_field_id('end_time');
        ?>
').parentNode.getElementsByClassName('countdownhour')[0].value+','+document.getElementById('<?php 
        echo $this->get_field_id('end_time');
        ?>
').parentNode.getElementsByClassName('countdownminute')[0].value
			}</script>
            <input type="hidden" value='<?php 
        echo $day_of_end . ',' . $hour_of_end . ',' . $minute_of_end;
        ?>
' id="<?php 
        echo $this->get_field_id('end_time');
        ?>
" name="<?php 
        echo $this->get_field_name('end_time');
        ?>
"/>
            <input type="hidden" value='<?php 
        echo mktime(date("H"), date("i"), date("s"), date("n"), date("j"), date("Y"));
        ?>
' id="<?php 
        echo $this->get_field_id('start_time');
        ?>
" name="<?php 
        echo $this->get_field_name('start_time');
        ?>
" />
        </p>
        
        <p class="flb_field">
            <label>After Countdown expired: </label>
            <br>
            <select id="<?php 
        echo $this->get_field_id('action_end_time');
        ?>
" name="<?php 
        echo $this->get_field_name('action_end_time');
        ?>
">
                <option <?php 
        selected('show_text', $instance['action_end_time']);
        ?>
 value="show_text">Show text</option>
                <option <?php 
        selected('hide', $instance['action_end_time']);
        ?>
 value="hide">Hide</option>
            </select>
        </p>
        
        <p class="flb_field">
          <label for="<?php 
        echo $this->get_field_id('content');
        ?>
">Message after countdown expired:</label>
          <br>
          <textarea type="text" id="<?php 
        echo $this->get_field_id('content');
        ?>
" name="<?php 
        echo $this->get_field_name('content');
        ?>
"><?php 
        echo $instance['content'];
        ?>
</textarea>   
        </p>
        
         <p class="flb_field">
            <label>Countdown timer position: </label>
            <br>
            <select id="<?php 
        echo $this->get_field_id('content_position');
        ?>
" name="<?php 
        echo $this->get_field_name('content_position');
        ?>
">
                <option <?php 
        selected('left', $instance['content_position']);
        ?>
 value="left">Left</option>
                <option <?php 
        selected('center', $instance['content_position']);
        ?>
 value="center">Center</option>
                <option <?php 
        selected('right', $instance['content_position']);
        ?>
 value="right">Right</option>                
            </select>
        </p>
        
         <p class="flb_field">
            <label for="<?php 
        echo $this->get_field_id('top_ditance');
        ?>
">Distance from top:</label>
            <br>
            <input id="<?php 
        echo $this->get_field_id('top_ditance');
        ?>
" name="<?php 
        echo $this->get_field_name('top_ditance');
        ?>
" type="text" value="<?php 
        echo $instance['top_ditance'];
        ?>
" class="widefat">
        </p>
        
        <p class="flb_field">
            <label for="<?php 
        echo $this->get_field_id('bottom_distance');
        ?>
">Distance from bottom:</label>
            <br>
            <input id="<?php 
        echo $this->get_field_id('bottom_distance');
        ?>
" name="<?php 
        echo $this->get_field_name('bottom_distance');
        ?>
" type="text" value="<?php 
        echo $instance['bottom_distance'];
        ?>
" class="widefat">
        </p>
        
        <p class="flb_field">
            <label>Countdown timer Buttons type:<span class="pro_feature"> (pro)</span> </label>
            <br>
            <select onChange="alert(countdown_pro_text)">
                <option selected="selected" value="button">Button</option>
                <option value="circle">Circle</option>
                <option value="vertical_slide">Vertical Slider</option>                
            </select>
        </p>
        
        <p class="flb_field tr_button tr_circle tr_vertical_slide">
            <label>Countdown timer text color:<span class="pro_feature"> (pro)</span></label>
            <br>
            <div onClick="alert(countdown_pro_text)">
                <div class="wp-picker-container"><a tabindex="0" class="wp-color-result" title="Select Color" data-current="Current Color" style="background-color: rgb(0, 0, 0);"></a></div>
            </div>
        </p>
        
        <p class="flb_field tr_button tr_circle tr_vertical_slide">
            <label> Countdown timer background color:<span class="pro_feature"> (pro)</span></label>
            <br>
            <div onClick="alert(countdown_pro_text)">
                <div class="wp-picker-container"><a tabindex="0" class="wp-color-result" title="Select Color" data-current="Current Color" style="background-color: rgb(62, 89, 165);"></a></div>
            </div>
        </p>
        
         <p class="flb_field tr_circle">
          <label >Countdown timer Size:<span class="pro_feature"> (pro)</span></label>
          <br>
          <input onClick="alert(countdown_pro_text)" type="text" value="50" class="widefat">(Px)
        </p>
        
         <p class="flb_field tr_circle">
          <label>Countdown timer border width:<span class="pro_feature"> (pro)</span></label>
          <br>
          <input onClick="alert(countdown_pro_text)"  type="text" value="5" class="widefat">%(0-100)
        </p>
        
         <p class="flb_field tr_button">
          <label>Countdown timer border radius:<span class="pro_feature"> (pro)</span></label>
          <br>
          <input onClick="alert(countdown_pro_text)"  type="text" value="8" class="widefat">
        </p>
        
         <p class="flb_field tr_button tr_vertical_slide">
          <label>Countdown timer font-size:<span class="pro_feature"> (pro)</span></label>
          <br>
          <input onClick="alert(countdown_pro_text)"  type="text" value="20" class="widefat">(Px)
        </p>
       
        <p class="flb_field tr_button tr_circle tr_vertical_slide">
          <label>Countdown timer Font family:<span class="pro_feature"> (pro)</span></label>
          <br>
          <?php 
        wpdevart_countdown_setting::generete_fonts('font_famely', 'monospace');
        ?>
        </p>
         <p class="flb_field">
          <label for="animation">Countdown animation type:<span class="pro_feature"> (pro)</span></label>
          <br>
          <?php 
        wpdevart_countdown_setting::generete_animation_select('animation', 'monospace');
        ?>
        </p>
        <br>
        <input type="hidden" id="flb-submit" name="flb-submit" value="1">
        <a href="http://wpdevart.com/wordpress-countdown-plugin/" target="_blank" style="color: rgba(10, 154, 62, 1);; font-weight: bold; font-size: 18px; text-decoration: none;">Upgrade to Pro Version</a>
		<?php 
    }