function check_post($content)
{
    $custom_fields = get_post_custom($post->ID);
    if (is_single()) {
        if (isset($custom_fields['date'])) {
            $my_custom_field = $custom_fields['date'];
            foreach ($my_custom_field as $key => $value) {
                $expired_timestamp = convert_datetime($value) . "<br />";
                $current_timestamp = convert_datetime(date("Y-m-d H:i:s")) - timezone_offset($timezone);
            }
            if ($expired_timestamp > $current_timestamp) {
                if (date("H", $expired_timestamp) < 12) {
                    $content = $content . $activeMessage . "<br />";
                }
            } else {
                $content = $expiredMessage . "<br />" . $content;
            }
        } else {
            $content = $content . "<br />Date not set" . "<br />";
        }
    } else {
    }
    return $content;
}
Beispiel #2
0
/**
 * Display time and day.
 *
 * Part of punchclock.php program.
 */
/* TODO: Text substitutions on the Javascript Date.toLocaleString() method is used to display
 * the time on the browser. The Date.toLocaleString() does not return the same string in all
 * browders. Safari and Chrome should have times adjusted to 12hr format if specified by $timefmt.
 *	Firefox:	Monday, March 08, 2010 3:22:01 PM
 *	IE8:		Monday, March 08, 2010 3:22:01 PM
 *	Safari:		Monday, March 08, 2010 15:22:01
 *	Chrome:		Mon Mar 08 2010 15:22:01 GMT-0700 (Mountain Standard Time)
 *	Opera:		3/8/10  3:22:01 PM
 */
require_once "lib.common.php";
$timestamp = utm_timestamp() + timezone_offset();
$timeclock = date('l F j, Y H:i', $timestamp);
// initial display
// Define javascript replacement function for changing Date.toLocaleString() text according to $timefmt config option.
switch ($timefmt) {
    case 'G:i':
        // 24 hour w/o leading 0
        $replace_func = "function(p0,p1,p2,p3,p4,p5) { return timer.time.getHours().toString().replace(/^0(!:0)/,'')+':'+p2+':'+p3; }";
        break;
    case 'H:i':
        // 24 hour
        $replace_func = "function(p0,p1,p2,p3,p4,p5) { return ((timer.time.getHours() < 10) ? '0' : '')+timer.time.getHours()+':'+p2+':'+p3; }";
        break;
    case 'g:i A':
        // 12 hour AM/PM
        $replace_func = "function(p0,p1,p2,p3,p4,p5) { return p1+':'+p2+':'+p3+p4+p5; }";
Beispiel #3
0
        if (!$_REQUEST['raw'] && $_REQUEST['callback']) {
            echo "\nif(" . $_REQUEST['callback'] . ")\n   " . $_REQUEST['callback'] . "(";
        }
        if (!$_REQUEST['raw'] && !$_REQUEST['callback']) {
            echo "if(typeof(BloggerRecentComments) != 'object') BloggerRecentComments = {};\nBloggerRecentComments.comments = ";
        }
        echo '[';
    }
    //end if format == json
    $urls = array();
    foreach ($items as $comment) {
        if (in_array($comment->my->url, $urls)) {
            continue;
        }
        $urls[] = $comment->my->url;
        $time = timezone_offset($comment->my->time, $_GET['tz']);
        $comment->my->content = str_replace('<BR/>', '<br />', $comment->my->content);
        if ($_GET['format'] == 'rss20') {
            ?>

<item>
<title>Comment on <?php 
            echo htmlspecialchars($comment->my->posttitle);
            ?>
 by <?php 
            echo htmlspecialchars($comment->my->authorname);
            ?>
</title>
<link><?php 
            echo htmlspecialchars($comment->my->url);
            ?>
Beispiel #4
0
function day_timestamp($local_timestamp = null)
{
    // Local timestamp for the beginning of the day, default is current local time.
    if ($local_timestamp == null) {
        $local_timestamp = time() - server_timezone_offset() + timezone_offset();
    }
    $month = date('m', $local_timestamp);
    $day = date('d', $local_timestamp);
    $year = date('Y', $local_timestamp);
    return mktime(0, 0, 0, $month, $day, $year);
}