Plugin Directory

Changeset 1047430


Ignore:
Timestamp:
12/17/2014 07:25:39 PM (11 years ago)
Author:
freakingid
Message:

Datepicker sets date properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • content-scheduler/trunk/content-scheduler.php

    r1047429 r1047430  
    304304            ?>
    305305            <script type="text/javascript">
    306                 jQuery(function(){
    307                     jQuery( '#cs-expire-date' ).datetimepicker();
     306            jQuery(function(){
     307                jQuery( '#cs-expire-date' ).datetimepicker()
    308308                });
    309309            </script>
    310             <!-- .datetimepicker -->
    311310            <?php
    312311        }
     
    481480                return $post_id;
    482481            }
     482           
    483483            // OK, we're authenticated: we need to find and save the data
    484484            // First, let's make sure we'll do date operations in the right timezone for this blog
     
    496496            }
    497497            // Textbox for "expiration date"
    498             $dateString = $_POST['_cs-expire-date'];
     498            $dateString = $_POST['_cs-expire-date'];           
    499499            $offsetHours = 0;
    500500            // if it is empty then set it to tomorrow
     
    553553            else
    554554            {
    555                 $date = DateUtilities::getTimestampFromReadableDate( $dateString, $offsetHours );
     555                $expiration_date = DateUtilities::getTimestampFromReadableDate( $dateString, $offsetHours );
    556556            }
    557557            // We probably need to store the date differently,
     
    844844            }
    845845
    846             // We'll need the following if / when we allow formatting of the timestamp
    847             /*
    848             // we'll default to formats selected in Settings > General
    849             extract( shortcode_atts( array(
    850                 'dateformat' => get_option('date_format'),
    851                 'timeformat' => get_option('time_format')
    852                 ), $attributes ) );
    853             // We always show date and time together
    854             $format = $dateformat . ' ' . $timeformat;
    855             return date( "$format", $expirationdt );
    856             */
    857846            $return_string = sprintf( __("Expires: %s", 'contentscheduler'), $expirationdt );
    858847            return $return_string;
    859848        }
    860 
    861 
    862 
    863 
    864 
    865         // =======================================================================
    866         // == GENERAL UTILITY FUNCTIONS
    867         // =======================================================================
    868         // 11/17/2010 3:06:27 PM -pk
    869         // NOTE: We could add another parameter, '$format,' to support different date formats
    870         function check_date_format($date) {
    871             // match the format of the date
    872             // in this case, it is ####-##-##
    873             if (preg_match ("/^([0-9]{4})-([0-9]{2})-([0-9]{2})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/", $date, $parts))
    874             {
    875                 // check whether the date is valid or not
    876                 // $parts[1] = year; $parts[2] = month; $parts[3] = day
    877                 // $parts[4] = hour; [5] = minute; [6] = second
    878                 if(checkdate($parts[2],$parts[3],$parts[1]))
    879                 {
    880                     // NOTE: We are only checking the HOUR here, since we won't make use of Min and Sec anyway
    881                     if( $parts[4] <= 23 )
    882                     {
    883                         // time (24-hour hour) is okay
    884                         return true;
    885                     }
    886                     else
    887                     {
    888                         // not a valid 24-hour HOUR
    889                         return false;
    890                     }
    891                 }
    892                 else
    893                 {
    894                     // not a valid date by php checkdate()
    895                     return false;
    896                 }
    897             }
    898             else
    899             {
    900                 return false;
    901             }
    902         }
    903 
    904         // ================================================================
    905         // handle timezones
    906         function setup_timezone() {
    907             error_log( __FILE__ . " :: " . __FUNCTION__ . " was called, but we want to stop using it." );
    908             /*
    909             if ( ! $wp_timezone = get_option( 'timezone_string' ) )
    910             {
    911                 return false;
    912             }
    913             // 11/5/2010 10:14:14 AM -pk
    914             // Set the default timezone used by Content Scheduler
    915             date_default_timezone_set( $wp_timezone );
    916             */
    917         }
    918 
    919849} // end ContentScheduler Class
    920850} // End IF Class ContentScheduler
     
    932862// == For displaying the expiration date / time of the current post.
    933863// == Must be used within the loop
     864// We could do away with this and just advise people to use do_shortcode instead
    934865function cont_sched_show_expiration( $args = '' )
    935866{
Note: See TracChangeset for help on using the changeset viewer.