当前位置: 首页>>代码示例>>PHP>>正文


PHP day_translate函数代码示例

本文整理汇总了PHP中day_translate函数的典型用法代码示例。如果您正苦于以下问题:PHP day_translate函数的具体用法?PHP day_translate怎么用?PHP day_translate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了day_translate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: format_event_html

function format_event_html($ev)
{
    if (!(is_array($ev) && count($ev))) {
        return '';
    }
    $bd_format = t('l F d, Y \\@ g:i A');
    // Friday January 18, 2011 @ 8 AM
    $o = '<div class="vevent">' . "\r\n";
    $o .= '<p class="summary event-summary">' . bbcode($ev['summary']) . '</p>' . "\r\n";
    $o .= '<p class="description event-description">' . bbcode($ev['desc']) . '</p>' . "\r\n";
    $o .= '<p class="event-start">' . t('Starts:') . ' <abbr class="dtstart" title="' . datetime_convert('UTC', 'UTC', $ev['start'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\\TH:i:s') . '" >' . ($ev['adjust'] ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $ev['start'], $bd_format)) : day_translate(datetime_convert('UTC', 'UTC', $ev['start'], $bd_format))) . '</abbr></p>' . "\r\n";
    if (!$ev['nofinish']) {
        $o .= '<p class="event-end" >' . t('Finishes:') . ' <abbr class="dtend" title="' . datetime_convert('UTC', 'UTC', $ev['finish'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\\TH:i:s') . '" >' . ($ev['adjust'] ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $ev['finish'], $bd_format)) : day_translate(datetime_convert('UTC', 'UTC', $ev['finish'], $bd_format))) . '</abbr></p>' . "\r\n";
    }
    if (strlen($ev['location'])) {
        $o .= '<p class="event-location"> ' . t('Location:') . ' <span class="location">' . bbcode($ev['location']) . '</span></p>' . "\r\n";
        if (strpos($ev['location'], "[map") === False) {
            $map = generate_named_map($ev['location']);
            if ($map !== $ev['location']) {
                $o .= $map;
            }
        }
    }
    $o .= '</div>' . "\r\n";
    return $o;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:26,代码来源:event.php

示例2: format_event_obj

function format_event_obj($jobject)
{
    $event = array();
    $object = json_decode($jobject, true);
    //ensure compatibility with older items - this check can be removed at a later point
    if (array_key_exists('description', $object)) {
        $bd_format = t('l F d, Y \\@ g:i A');
        // Friday January 18, 2011 @ 8:01 AM
        $event['header'] = replace_macros(get_markup_template('event_item_header.tpl'), array('$title' => bbcode($object['title']), '$dtstart_label' => t('Starts:'), '$dtstart_title' => datetime_convert('UTC', 'UTC', $object['dtstart'], $object['adjust'] ? ATOM_TIME : 'Y-m-d\\TH:i:s'), '$dtstart_dt' => $object['adjust'] ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtstart'], $bd_format)) : day_translate(datetime_convert('UTC', 'UTC', $object['dtstart'], $bd_format)), '$finish' => $object['nofinish'] ? false : true, '$dtend_label' => t('Finishes:'), '$dtend_title' => datetime_convert('UTC', 'UTC', $object['dtend'], $object['adjust'] ? ATOM_TIME : 'Y-m-d\\TH:i:s'), '$dtend_dt' => $object['adjust'] ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $object['dtend'], $bd_format)) : day_translate(datetime_convert('UTC', 'UTC', $object['dtend'], $bd_format))));
        $event['content'] = replace_macros(get_markup_template('event_item_content.tpl'), array('$description' => bbcode($object['description']), '$location_label' => t('Location:'), '$location' => bbcode($object['location'])));
    }
    return $event;
}
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:13,代码来源:event.php

示例3: format_event_html

/**
 * @brief Returns an event as HTML
 *
 * @param array $ev
 * @return string
 */
function format_event_html($ev)
{
    require_once 'include/bbcode.php';
    if (!(is_array($ev) && count($ev))) {
        return '';
    }
    $bd_format = t('l F d, Y \\@ g:i A');
    // Friday January 18, 2011 @ 8:01 AM
    //todo: move this to template
    $o = '<div class="vevent">' . "\r\n";
    $o .= '<div class="event-title"><h3><i class="icon-calendar"></i>&nbsp;' . bbcode($ev['summary']) . '</h3></div>' . "\r\n";
    $o .= '<div class="event-start"><span class="event-label">' . t('Starts:') . '</span>&nbsp;<span class="dtstart" title="' . datetime_convert('UTC', 'UTC', $ev['start'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\\TH:i:s') . '" >' . ($ev['adjust'] ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $ev['start'], $bd_format)) : day_translate(datetime_convert('UTC', 'UTC', $ev['start'], $bd_format))) . '</span></div>' . "\r\n";
    if (!$ev['nofinish']) {
        $o .= '<div class="event-end" ><span class="event-label">' . t('Finishes:') . '</span>&nbsp;<span class="dtend" title="' . datetime_convert('UTC', 'UTC', $ev['finish'], $ev['adjust'] ? ATOM_TIME : 'Y-m-d\\TH:i:s') . '" >' . ($ev['adjust'] ? day_translate(datetime_convert('UTC', date_default_timezone_get(), $ev['finish'], $bd_format)) : day_translate(datetime_convert('UTC', 'UTC', $ev['finish'], $bd_format))) . '</span></div>' . "\r\n";
    }
    $o .= '<div class="event-description">' . bbcode($ev['description']) . '</div>' . "\r\n";
    if (strlen($ev['location'])) {
        $o .= '<div class="event-location"><span class="event-label"> ' . t('Location:') . '</span>&nbsp;<span class="location">' . bbcode($ev['location']) . '</span></div>' . "\r\n";
    }
    $o .= '</div>' . "\r\n";
    return $o;
}
开发者ID:bashrc,项目名称:hubzilla,代码行数:28,代码来源:event.php

示例4: advanced_profile

function advanced_profile(&$a)
{
    require_once 'include/text.php';
    if (!perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_profile')) {
        return '';
    }
    $o = '';
    $o .= '<h2>' . t('Profile') . '</h2>';
    if ($a->profile['name']) {
        $tpl = get_markup_template('profile_advanced.tpl');
        $profile = array();
        $profile['fullname'] = array(t('Full Name:'), $a->profile['name']);
        if ($a->profile['gender']) {
            $profile['gender'] = array(t('Gender:'), $a->profile['gender']);
        }
        $ob_hash = get_observer_hash();
        if ($ob_hash && perm_is_allowed($a->profile['profile_uid'], $ob_hash, 'post_like')) {
            $profile['canlike'] = true;
            $profile['likethis'] = t('Like this channel');
            $profile['profile_guid'] = $a->profile['profile_guid'];
        }
        $likers = q("select liker, xchan.*  from likes left join xchan on liker = xchan_hash where channel_id = %d and target_type = '%s' and verb = '%s'", intval($a->profile['profile_uid']), dbesc(ACTIVITY_OBJ_PROFILE), dbesc(ACTIVITY_LIKE));
        $profile['likers'] = array();
        $profile['like_count'] = count($likers);
        $profile['like_button_label'] = tt('Like', 'Likes', $profile['like_count'], 'noun');
        if ($likers) {
            foreach ($likers as $l) {
                $profile['likers'][] = array('name' => $l['xchan_name'], 'url' => zid($l['xchan_url']));
            }
        }
        if ($a->profile['dob'] && $a->profile['dob'] != '0000-00-00') {
            $val = '';
            if (substr($a->profile['dob'], 5, 2) === '00' || substr($a->profile['dob'], 8, 2) === '00') {
                $val = substr($a->profile['dob'], 0, 4);
            }
            $year_bd_format = t('j F, Y');
            $short_bd_format = t('j F');
            if (!$val) {
                $val = intval($a->profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format));
            }
            $profile['birthday'] = array(t('Birthday:'), $val);
        }
        if ($age = age($a->profile['dob'], $a->profile['timezone'], '')) {
            $profile['age'] = array(t('Age:'), $age);
        }
        if ($a->profile['marital']) {
            $profile['marital'] = array(t('Status:'), $a->profile['marital']);
        }
        if ($a->profile['with']) {
            $profile['marital']['with'] = bbcode($a->profile['with']);
        }
        if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== NULL_DATE) {
            $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
        }
        if ($a->profile['sexual']) {
            $profile['sexual'] = array(t('Sexual Preference:'), $a->profile['sexual']);
        }
        if ($a->profile['homepage']) {
            $profile['homepage'] = array(t('Homepage:'), linkify($a->profile['homepage']));
        }
        if ($a->profile['hometown']) {
            $profile['hometown'] = array(t('Hometown:'), linkify($a->profile['hometown']));
        }
        if ($a->profile['keywords']) {
            $profile['keywords'] = array(t('Tags:'), $a->profile['keywords']);
        }
        if ($a->profile['politic']) {
            $profile['politic'] = array(t('Political Views:'), $a->profile['politic']);
        }
        if ($a->profile['religion']) {
            $profile['religion'] = array(t('Religion:'), $a->profile['religion']);
        }
        if ($txt = prepare_text($a->profile['about'])) {
            $profile['about'] = array(t('About:'), $txt);
        }
        if ($txt = prepare_text($a->profile['interest'])) {
            $profile['interest'] = array(t('Hobbies/Interests:'), $txt);
        }
        if ($txt = prepare_text($a->profile['likes'])) {
            $profile['likes'] = array(t('Likes:'), $txt);
        }
        if ($txt = prepare_text($a->profile['dislikes'])) {
            $profile['dislikes'] = array(t('Dislikes:'), $txt);
        }
        if ($txt = prepare_text($a->profile['contact'])) {
            $profile['contact'] = array(t('Contact information and Social Networks:'), $txt);
        }
        if ($txt = prepare_text($a->profile['channels'])) {
            $profile['channels'] = array(t('My other channels:'), $txt);
        }
        if ($txt = prepare_text($a->profile['music'])) {
            $profile['music'] = array(t('Musical interests:'), $txt);
        }
        if ($txt = prepare_text($a->profile['book'])) {
            $profile['book'] = array(t('Books, literature:'), $txt);
        }
        if ($txt = prepare_text($a->profile['tv'])) {
            $profile['tv'] = array(t('Television:'), $txt);
        }
        if ($txt = prepare_text($a->profile['film'])) {
//.........这里部分代码省略.........
开发者ID:23n,项目名称:hubzilla,代码行数:101,代码来源:identity.php

示例5: cal

 function cal($y = 0, $m = 0, $links = false, $class = '')
 {
     // month table - start at 1 to match human usage.
     $mtab = array(' ', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
     $thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
     $thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
     if (!$y) {
         $y = $thisyear;
     }
     if (!$m) {
         $m = intval($thismonth);
     }
     $dn = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     $f = get_first_dim($y, $m);
     $l = get_dim($y, $m);
     $d = 1;
     $dow = 0;
     $started = false;
     if ($y == $thisyear && $m == $thismonth) {
         $tddate = intval(datetime_convert('UTC', date_default_timezone_get(), 'now', 'j'));
     }
     $str_month = day_translate($mtab[$m]);
     $o = '<table class="calendar' . $class . '">';
     $o .= "<caption>{$str_month} {$y}</caption><tr>";
     for ($a = 0; $a < 7; $a++) {
         $o .= '<th>' . mb_substr(day_translate($dn[$a]), 0, 3, 'UTF-8') . '</th>';
     }
     $o .= '</tr><tr>';
     while ($d <= $l) {
         if ($dow == $f && !$started) {
             $started = true;
         }
         $today = isset($tddate) && $tddate == $d ? "class=\"today\" " : '';
         $o .= "<td {$today}>";
         $day = str_replace(' ', '&nbsp;', sprintf('%2.2d', $d));
         if ($started) {
             if (is_array($links) && isset($links[$d])) {
                 $o .= "<a href=\"{$links[$d]}\">{$day}</a>";
             } else {
                 $o .= $day;
             }
             $d++;
         } else {
             $o .= '&nbsp;';
         }
         $o .= '</td>';
         $dow++;
         if ($dow == 7 && $d <= $l) {
             $dow = 0;
             $o .= '</tr><tr>';
         }
     }
     if ($dow) {
         for ($a = $dow; $a < 7; $a++) {
             $o .= '<td>&nbsp;</td>';
         }
     }
     $o .= '</tr></table>' . "\r\n";
     return $o;
 }
开发者ID:ZerGabriel,项目名称:friendica,代码行数:60,代码来源:datetime.php

示例6: posted_dates

function posted_dates($uid, $wall)
{
    $dnow = datetime_convert('', date_default_timezone_get(), 'now', 'Y-m-d');
    $dthen = first_post_date($uid, $wall);
    if (!$dthen) {
        return array();
    }
    // Set the start and end date to the beginning of the month
    $dnow = substr($dnow, 0, 8) . '01';
    $dthen = substr($dthen, 0, 8) . '01';
    $ret = array();
    // Starting with the current month, get the first and last days of every
    // month down to and including the month of the first post
    while (substr($dnow, 0, 7) >= substr($dthen, 0, 7)) {
        $dstart = substr($dnow, 0, 8) . '01';
        $dend = substr($dnow, 0, 8) . get_dim(intval($dnow), intval(substr($dnow, 5)));
        $start_month = datetime_convert('', '', $dstart, 'Y-m-d');
        $end_month = datetime_convert('', '', $dend, 'Y-m-d');
        $str = day_translate(datetime_convert('', '', $dnow, 'F Y'));
        $ret[] = array($str, $end_month, $start_month);
        $dnow = datetime_convert('', '', $dnow . ' -1 month', 'Y-m-d');
    }
    return $ret;
}
开发者ID:EmilienB,项目名称:friendica,代码行数:24,代码来源:items.php

示例7: events_content


//.........这里部分代码省略.........
        }
        $start = datetime_convert('UTC', 'UTC', $start);
        $finish = datetime_convert('UTC', 'UTC', $finish);
        $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
        $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
        if (x($_GET, 'id')) {
            $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan\n                                from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d limit 1", intval(local_channel()), intval($_GET['id']));
        } else {
            // fixed an issue with "nofinish" events not showing up in the calendar.
            // There's still an issue if the finish date crosses the end of month.
            // Noting this for now - it will need to be fixed here and in Friendica.
            // Ultimately the finish date shouldn't be involved in the query.
            $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan\n                              from event left join item on event_hash = resource_id \n\t\t\t\twhere resource_type = 'event' and event.uid = %d {$ignored}\n\t\t\t\tAND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' ) \n\t\t\t\tOR  (  `adjust` = 1 AND ( `finish` >= '%s' or nofinish = 1 ) AND `start` <= '%s' )) ", intval(local_channel()), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
        }
        $links = array();
        if ($r) {
            xchan_query($r);
            $r = fetch_post_tags($r, true);
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                if (!x($links, $j)) {
                    $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
                }
            }
        }
        $events = array();
        $last_date = '';
        $fmt = t('l, F j');
        if ($r) {
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                $d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
                $d = day_translate($d);
                $start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'c') : datetime_convert('UTC', 'UTC', $rr['start'], 'c');
                if ($rr['nofinish']) {
                    $end = null;
                } else {
                    $end = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['finish'], 'c') : datetime_convert('UTC', 'UTC', $rr['finish'], 'c');
                }
                $is_first = $d !== $last_date;
                $last_date = $d;
                // FIXME
                $edit = $rr['item_flags'] & ITEM_WALL ? array($a->get_baseurl() . '/events/event/' . $rr['event_hash'], t('Edit event'), '', '') : null;
                $drop = array($a->get_baseurl() . '/events/drop/' . $rr['event_hash'], t('Delete event'), '', '');
                $title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
                if (!$title) {
                    list($title, $_trash) = explode("<br", bbcode($rr['desc']), 2);
                    $title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
                }
                $html = format_event_html($rr);
                $rr['desc'] = bbcode($rr['desc']);
                $rr['location'] = bbcode($rr['location']);
                $events[] = array('id' => $rr['id'], 'hash' => $rr['event_hash'], 'start' => $start, 'end' => $end, 'drop' => $drop, 'allDay' => false, 'title' => $title, 'j' => $j, 'd' => $d, 'edit' => $edit, 'is_first' => $is_first, 'item' => $rr, 'html' => $html, 'plink' => array($rr['plink'], t('Link to Source'), '', ''));
            }
        }
        if ($export) {
            header('Content-type: text/calendar');
            header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"');
            echo ical_wrapper($r);
            killme();
        }
        if ($a->argv[1] === 'json') {
            echo json_encode($events);
            killme();
        }
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:67,代码来源:events.php

示例8: get_events

 function get_events()
 {
     require_once 'include/bbcode.php';
     $a = get_app();
     if (!local_user() || $a->is_mobile || $a->is_tablet) {
         return $o;
     }
     //		$mobile_detect = new Mobile_Detect();
     //		$is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
     //		if($is_mobile)
     //			return $o;
     $bd_format = t('g A l F d');
     // 8 AM Friday January 18
     $bd_short = t('F d');
     $r = q("SELECT `event`.* FROM `event`\n\t\t\t\tWHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `start` > '%s'\n\t\t\t\tORDER BY `start` ASC ", intval(local_user()), dbesc(datetime_convert('UTC', 'UTC', 'now + 6 days')), dbesc(datetime_convert('UTC', 'UTC', 'now - 1 days')));
     if ($r && count($r)) {
         $now = strtotime('now');
         $istoday = false;
         foreach ($r as $rr) {
             if (strlen($rr['name'])) {
                 $total++;
             }
             $strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start'], 'Y-m-d');
             if ($strt === datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d')) {
                 $istoday = true;
             }
         }
         $classtoday = $istoday ? 'event-today' : '';
         foreach ($r as &$rr) {
             if ($rr['adjust']) {
                 $md = datetime_convert('UTC', $a->timezone, $rr['start'], 'Y/m');
             } else {
                 $md = datetime_convert('UTC', 'UTC', $rr['start'], 'Y/m');
             }
             $md .= "/#link-" . $rr['id'];
             $title = substr(strip_tags(bbcode($rr['desc'])), 0, 32) . '... ';
             if (!$title) {
                 $title = t('[No description]');
             }
             $strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start']);
             $today = substr($strt, 0, 10) === datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d') ? true : false;
             $rr['link'] = $md;
             $rr['title'] = $title;
             $rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . ($today ? ' ' . t('[today]') : '');
             $rr['startime'] = $strt;
             $rr['today'] = $today;
         }
     }
     $tpl = get_markup_template("events_reminder.tpl");
     return replace_macros($tpl, array('$baseurl' => $a->get_baseurl(), '$classtoday' => $classtoday, '$count' => count($r), '$event_reminders' => t('Event Reminders'), '$event_title' => t('Events this week:'), '$events' => $r));
 }
开发者ID:ridcully,项目名称:friendica,代码行数:51,代码来源:boot.php

示例9: get


//.........这里部分代码省略.........
         }
         $nextyear = $y;
         $nextmonth = $m + 1;
         if ($nextmonth > 12) {
             $nextmonth = 1;
             $nextyear++;
         }
         $prevyear = $y;
         if ($m > 1) {
             $prevmonth = $m - 1;
         } else {
             $prevmonth = 12;
             $prevyear--;
         }
         $dim = get_dim($y, $m);
         $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
         $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
         if (argv(2) === 'json') {
             if (x($_GET, 'start')) {
                 $start = $_GET['start'];
             }
             if (x($_GET, 'end')) {
                 $finish = $_GET['end'];
             }
         }
         $start = datetime_convert('UTC', 'UTC', $start);
         $finish = datetime_convert('UTC', 'UTC', $finish);
         $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
         $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
         if (x($_GET, 'id')) {
             $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan\n\t                                from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d {$sql_extra} limit 1", intval($channel['channel_id']), intval($_GET['id']));
         } else {
             // fixed an issue with "nofinish" events not showing up in the calendar.
             // There's still an issue if the finish date crosses the end of month.
             // Noting this for now - it will need to be fixed here and in Friendica.
             // Ultimately the finish date shouldn't be involved in the query.
             $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan\n\t                              from event left join item on event_hash = resource_id \n\t\t\t\t\twhere resource_type = 'event' and event.uid = %d {$ignored} \n\t\t\t\t\tAND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' ) \n\t\t\t\t\tOR  (  adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) {$sql_extra} ", intval($channel['channel_id']), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
         }
         $links = array();
         if ($r) {
             xchan_query($r);
             $r = fetch_post_tags($r, true);
             $r = sort_by_date($r);
         }
         if ($r) {
             foreach ($r as $rr) {
                 $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'j') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'j');
                 if (!x($links, $j)) {
                     $links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j;
                 }
             }
         }
         $events = array();
         $last_date = '';
         $fmt = t('l, F j');
         if ($r) {
             foreach ($r as $rr) {
                 $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'j') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'j');
                 $d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], $fmt) : datetime_convert('UTC', 'UTC', $rr['dtstart'], $fmt);
                 $d = day_translate($d);
                 $start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c');
                 if ($rr['nofinish']) {
                     $end = null;
                 } else {
                     $end = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c');
                 }
                 $is_first = $d !== $last_date;
                 $last_date = $d;
                 $edit = false;
                 $drop = false;
                 $title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
                 if (!$title) {
                     list($title, $_trash) = explode("<br", bbcode($rr['desc']), 2);
                     $title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
                 }
                 $html = format_event_html($rr);
                 $rr['desc'] = bbcode($rr['desc']);
                 $rr['location'] = bbcode($rr['location']);
                 $events[] = array('id' => $rr['id'], 'hash' => $rr['event_hash'], 'start' => $start, 'end' => $end, 'drop' => $drop, 'allDay' => false, 'title' => $title, 'j' => $j, 'd' => $d, 'edit' => $edit, 'is_first' => $is_first, 'item' => $rr, 'html' => $html, 'plink' => array($rr['plink'], t('Link to Source'), '', ''));
             }
         }
         if (argv(2) === 'json') {
             echo json_encode($events);
             killme();
         }
         // links: array('href', 'text', 'extra css classes', 'title')
         if (x($_GET, 'id')) {
             $tpl = get_markup_template("event_cal.tpl");
         } else {
             $tpl = get_markup_template("events_cal-js.tpl");
         }
         $nick = $channel['channel_address'];
         $o = replace_macros($tpl, array('$baseurl' => z_root(), '$new_event' => array(z_root() . '/cal', $event_id ? t('Edit Event') : t('Create Event'), '', ''), '$previus' => array(z_root() . "/cal/{$nick}/{$prevyear}/{$prevmonth}", t('Previous'), '', ''), '$next' => array(z_root() . "/cal/{$nick}/{$nextyear}/{$nextmonth}", t('Next'), '', ''), '$export' => array(z_root() . "/cal/{$nick}/{$y}/{$m}/export", t('Export'), '', ''), '$calendar' => cal($y, $m, $links, ' eventcal'), '$events' => $events, '$upload' => t('Import'), '$submit' => t('Submit'), '$prev' => t('Previous'), '$next' => t('Next'), '$today' => t('Today'), '$form' => $form, '$expandform' => x($_GET, 'expandform') ? true : false, '$tabs' => $tabs));
         if (x($_GET, 'id')) {
             echo $o;
             killme();
         }
         return $o;
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:101,代码来源:Cal.php

示例10: advanced_profile

function advanced_profile(&$a)
{
    $o = '';
    $uid = $a->profile['uid'];
    $o .= replace_macros(get_markup_template('section_title.tpl'), array('$title' => t('Profile')));
    if ($a->profile['name']) {
        $tpl = get_markup_template('profile_advanced.tpl');
        $profile = array();
        $profile['fullname'] = array(t('Full Name:'), $a->profile['name']);
        if ($a->profile['gender']) {
            $profile['gender'] = array(t('Gender:'), $a->profile['gender']);
        }
        if ($a->profile['dob'] && $a->profile['dob'] != '0000-00-00') {
            $year_bd_format = t('j F, Y');
            $short_bd_format = t('j F');
            $val = intval($a->profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format));
            $profile['birthday'] = array(t('Birthday:'), $val);
        }
        if ($age = age($a->profile['dob'], $a->profile['timezone'], '')) {
            $profile['age'] = array(t('Age:'), $age);
        }
        if ($a->profile['marital']) {
            $profile['marital'] = array(t('Status:'), $a->profile['marital']);
        }
        if ($a->profile['with']) {
            $profile['marital']['with'] = $a->profile['with'];
        }
        if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
            $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
        }
        if ($a->profile['sexual']) {
            $profile['sexual'] = array(t('Sexual Preference:'), $a->profile['sexual']);
        }
        if ($a->profile['homepage']) {
            $profile['homepage'] = array(t('Homepage:'), linkify($a->profile['homepage']));
        }
        if ($a->profile['hometown']) {
            $profile['hometown'] = array(t('Hometown:'), linkify($a->profile['hometown']));
        }
        if ($a->profile['pub_keywords']) {
            $profile['pub_keywords'] = array(t('Tags:'), $a->profile['pub_keywords']);
        }
        if ($a->profile['politic']) {
            $profile['politic'] = array(t('Political Views:'), $a->profile['politic']);
        }
        if ($a->profile['religion']) {
            $profile['religion'] = array(t('Religion:'), $a->profile['religion']);
        }
        if ($txt = prepare_text($a->profile['about'])) {
            $profile['about'] = array(t('About:'), $txt);
        }
        if ($txt = prepare_text($a->profile['interest'])) {
            $profile['interest'] = array(t('Hobbies/Interests:'), $txt);
        }
        if ($txt = prepare_text($a->profile['likes'])) {
            $profile['likes'] = array(t('Likes:'), $txt);
        }
        if ($txt = prepare_text($a->profile['dislikes'])) {
            $profile['dislikes'] = array(t('Dislikes:'), $txt);
        }
        if ($txt = prepare_text($a->profile['contact'])) {
            $profile['contact'] = array(t('Contact information and Social Networks:'), $txt);
        }
        if ($txt = prepare_text($a->profile['music'])) {
            $profile['music'] = array(t('Musical interests:'), $txt);
        }
        if ($txt = prepare_text($a->profile['book'])) {
            $profile['book'] = array(t('Books, literature:'), $txt);
        }
        if ($txt = prepare_text($a->profile['tv'])) {
            $profile['tv'] = array(t('Television:'), $txt);
        }
        if ($txt = prepare_text($a->profile['film'])) {
            $profile['film'] = array(t('Film/dance/culture/entertainment:'), $txt);
        }
        if ($txt = prepare_text($a->profile['romance'])) {
            $profile['romance'] = array(t('Love/Romance:'), $txt);
        }
        if ($txt = prepare_text($a->profile['work'])) {
            $profile['work'] = array(t('Work/employment:'), $txt);
        }
        if ($txt = prepare_text($a->profile['education'])) {
            $profile['education'] = array(t('School/education:'), $txt);
        }
        //show subcribed forum if it is enabled in the usersettings
        if (feature_enabled($uid, 'forumlist_profile')) {
            $profile['forumlist'] = array(t('Forums:'), forumlist_profile_advanced($uid));
        }
        if ($a->profile['uid'] == local_user()) {
            $profile['edit'] = array($a->get_baseurl() . '/profiles/' . $a->profile['id'], t('Edit profile'), "", t('Edit profile'));
        }
        return replace_macros($tpl, array('$title' => t('Profile'), '$profile' => $profile));
    }
    return '';
}
开发者ID:vinzv,项目名称:friendica,代码行数:95,代码来源:identity.php

示例11: get_events

 function get_events()
 {
     require_once 'include/bbcode.php';
     $a = get_app();
     $o = '';
     if (!local_user()) {
         return $o;
     }
     $bd_format = t('g A l F d');
     // 8 AM Friday January 18
     $bd_short = t('F d');
     $r = q("SELECT `event`.* FROM `event` \n\t\tWHERE `event`.`uid` = %d AND `type` != 'birthday' AND `start` < '%s' AND `start` > '%s'\n\t\tORDER BY `start` ASC ", intval(local_user()), dbesc(datetime_convert('UTC', 'UTC', 'now + 6 days')), dbesc(datetime_convert('UTC', 'UTC', 'now - 1 days')));
     if ($r && count($r)) {
         $now = strtotime('now');
         $istoday = false;
         foreach ($r as $rr) {
             if (strlen($rr['name'])) {
                 $total++;
             }
             $strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start'], 'Y-m-d');
             if ($strt === datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d')) {
                 $istoday = true;
             }
         }
         $classtoday = $istoday ? ' event-today ' : '';
         $o .= '<div id="event-notice" class="birthday-notice fakelink' . $classtoday . '" onclick=openClose(\'event-wrapper\'); >' . t('Event Reminders') . ' ' . '(' . count($r) . ')' . '</div>';
         $o .= '<div id="event-wrapper" style="display: none;" ><div id="event-title">' . t('Events this week:') . '</div>';
         $o .= '<div id="event-title-end"></div>';
         foreach ($r as $rr) {
             if ($rr['adjust']) {
                 $md = datetime_convert('UTC', $a->timezone, $rr['start'], 'Y/m\\#\\l\\i\\n\\k\\-j');
             } else {
                 $md = datetime_convert('UTC', 'UTC', $rr['start'], 'Y/m\\#\\l\\i\\n\\k\\-j');
             }
             $title = substr(strip_tags(bbcode($rr['desc'])), 0, 32) . '... ';
             if (!$title) {
                 $title = t('[No description]');
             }
             $strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start']);
             $today = substr($strt, 0, 10) === datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d') ? true : false;
             $o .= '<div class="event-list" id="event-' . $rr['eid'] . '"></a> <a href="events/' . $md . '">' . $title . '</a>' . day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . ($today ? ' ' . t('[today]') : '') . '</div>';
         }
         $o .= '</div></div>';
     }
     return $o;
 }
开发者ID:nphyx,项目名称:friendica,代码行数:46,代码来源:boot.php

示例12: events_content

function events_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $o = "";
    // tabs
    $o .= profile_tabs($a, True);
    $o .= '<h2>' . t('Events') . '</h2>';
    $mode = 'view';
    $y = 0;
    $m = 0;
    if ($a->argc > 1) {
        if ($a->argc > 2 && $a->argv[1] == 'event') {
            $mode = 'edit';
            $event_id = intval($a->argv[2]);
        }
        if ($a->argv[1] === 'new') {
            $mode = 'new';
            $event_id = 0;
        }
        if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
            $mode = 'view';
            $y = intval($a->argv[1]);
            $m = intval($a->argv[2]);
        }
    }
    if ($mode == 'view') {
        $thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
        $thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
        if (!$y) {
            $y = intval($thisyear);
        }
        if (!$m) {
            $m = intval($thismonth);
        }
        // Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
        // An upper limit was chosen to keep search engines from exploring links millions of years in the future.
        if ($y < 1901) {
            $y = 1900;
        }
        if ($y > 2099) {
            $y = 2100;
        }
        $nextyear = $y;
        $nextmonth = $m + 1;
        if ($nextmonth > 12) {
            $nextmonth = 1;
            $nextyear++;
        }
        $prevyear = $y;
        if ($m > 1) {
            $prevmonth = $m - 1;
        } else {
            $prevmonth = 12;
            $prevyear--;
        }
        $dim = get_dim($y, $m);
        $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
        $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
        $start = datetime_convert('UTC', 'UTC', $start);
        $finish = datetime_convert('UTC', 'UTC', $finish);
        $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
        $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
        $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` \n\t\t\tWHERE `event`.`uid` = %d\n\t\t\tAND (( `adjust` = 0 AND `start` >= '%s' AND `start` <= '%s' ) \n\t\t\tOR  (  `adjust` = 1 AND `start` >= '%s' AND `start` <= '%s' )) ", intval(local_user()), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
        $links = array();
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                if (!x($links, $j)) {
                    $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
                }
            }
        }
        $o .= '<div id="new-event-link"><a href="' . $a->get_baseurl() . '/events/new' . '" >' . t('Create New Event') . '</a></div>';
        $o .= '<div id="event-calendar-wrapper">';
        $o .= '<a href="' . $a->get_baseurl() . '/events/' . $prevyear . '/' . $prevmonth . '" class="prevcal"><div id="event-calendar-prev" class="icon prev" title="' . t('Previous') . '"></div></a>';
        $o .= cal($y, $m, $links, ' eventcal');
        $o .= '<a href="' . $a->get_baseurl() . '/events/' . $nextyear . '/' . $nextmonth . '" class="nextcal"><div id="event-calendar-next" class="icon next" title="' . t('Next') . '"></div></a>';
        $o .= '</div>';
        $o .= '<div class="event-calendar-end"></div>';
        $last_date = '';
        $fmt = t('l, F j');
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                $d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
                $d = day_translate($d);
                if ($d !== $last_date) {
                    $o .= '<hr /><a name="link-' . $j . '" ><div class="event-list-date">' . $d . '</div></a>';
                }
                $last_date = $d;
                if ($rr['author-name']) {
                    $o .= '<a href="' . $rr['author-link'] . '" ><img src="' . $rr['author-avatar'] . '" height="32" width="32" />' . $rr['author-name'] . '</a>';
                }
                $o .= format_event_html($rr);
                $o .= !$rr['cid'] ? '<a href="' . $a->get_baseurl() . '/events/event/' . $rr['id'] . '" title="' . t('Edit event') . '" class="edit-event-link icon pencil"></a>' : '';
//.........这里部分代码省略.........
开发者ID:nphyx,项目名称:friendica,代码行数:101,代码来源:events.php

示例13: events_content


//.........这里部分代码省略.........
                $start = date("Y-m-d h:i:s", $_GET['start']);
            }
            if (x($_GET, 'end')) {
                $finish = date("Y-m-d h:i:s", $_GET['end']);
            }
        }
        $start = datetime_convert('UTC', 'UTC', $start);
        $finish = datetime_convert('UTC', 'UTC', $finish);
        $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
        $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
        if (x($_GET, 'id')) {
            $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event`\n\t\t\t\tLEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid`\n\t\t\t\tWHERE `event`.`uid` = %d AND `event`.`id` = %d", intval(local_user()), intval($_GET['id']));
        } else {
            $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event`\n\t\t\t\tLEFT JOIN `item` ON `item`.`event-id` = `event`.`id` AND `item`.`uid` = `event`.`uid`\n\t\t\t\tWHERE `event`.`uid` = %d and event.ignore = %d\n\t\t\t\tAND ((`adjust` = 0 AND (`finish` >= '%s' OR (nofinish AND start >= '%s')) AND `start` <= '%s')\n\t\t\t\tOR  (`adjust` = 1 AND (`finish` >= '%s' OR (nofinish AND start >= '%s')) AND `start` <= '%s')) ", intval(local_user()), intval($ignored), dbesc($start), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_start), dbesc($adjust_finish));
        }
        $links = array();
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                if (!x($links, $j)) {
                    $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
                }
            }
        }
        $events = array();
        $last_date = '';
        $fmt = t('l, F j');
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                $d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
                $d = day_translate($d);
                $start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'c') : datetime_convert('UTC', 'UTC', $rr['start'], 'c');
                if ($rr['nofinish']) {
                    $end = null;
                } else {
                    $end = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['finish'], 'c') : datetime_convert('UTC', 'UTC', $rr['finish'], 'c');
                }
                $is_first = $d !== $last_date;
                $last_date = $d;
                $edit = !$rr['cid'] ? array($a->get_baseurl() . '/events/event/' . $rr['id'], t('Edit event'), '', '') : null;
                $title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
                if (!$title) {
                    list($title, $_trash) = explode("<br", bbcode($rr['desc']), 2);
                    $title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
                }
                $html = format_event_html($rr);
                $rr['desc'] = bbcode($rr['desc']);
                $rr['location'] = bbcode($rr['location']);
                $events[] = array('id' => $rr['id'], 'start' => $start, 'end' => $end, 'allDay' => false, 'title' => $title, 'j' => $j, 'd' => $d, 'edit' => $edit, 'is_first' => $is_first, 'item' => $rr, 'html' => $html, 'plink' => array($rr['plink'], t('link to source'), '', ''));
            }
        }
        if ($a->argv[1] === 'json') {
            echo json_encode($events);
            killme();
        }
        // links: array('href', 'text', 'extra css classes', 'title')
        if (x($_GET, 'id')) {
            $tpl = get_markup_template("event.tpl");
        } else {
            //			if (get_config('experimentals','new_calendar')==1){
            $tpl = get_markup_template("events-js.tpl");
            //			} else {
            //				$tpl = get_markup_template("events.tpl");
开发者ID:vinzv,项目名称:friendica,代码行数:67,代码来源:events.php

示例14: advanced_profile

function advanced_profile(&$a)
{
    $o .= '';
    $o .= '<h2>' . t('Profile') . '</h2>';
    if ($a->profile['name']) {
        $tpl = get_markup_template('profile_advanced.tpl');
        $profile = array();
        $profile['fullname'] = array(t('Full Name:'), $a->profile['name']);
        if ($a->profile['gender']) {
            $profile['gender'] = array(t('Gender:'), $a->profile['gender']);
        }
        if ($a->profile['dob'] && $a->profile['dob'] != '0000-00-00') {
            $year_bd_format = t('j F, Y');
            $short_bd_format = t('j F');
            $val = intval($a->profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 6) . ' 00:00 +00:00', $short_bd_format));
            $profile['birthday'] = array(t('Birthday:'), $val);
        }
        if ($age = age($a->profile['dob'], $a->profile['timezone'], '')) {
            $profile['age'] = array(t('Age:'), $age);
        }
        if ($a->profile['marital']) {
            $profile['marital'] = array(t('Status:'), $a->profile['marital']);
        }
        if ($a->profile['with']) {
            $profile['marital']['with'] = $a->profile['with'];
        }
        if ($a->profile['sexual']) {
            $profile['sexual'] = array(t('Sexual Preference:'), $a->profile['sexual']);
        }
        if ($a->profile['homepage']) {
            $profile['homepage'] = array(t('Homepage:'), linkify($a->profile['homepage']));
        }
        if ($a->profile['pub_keywords']) {
            $profile['pub_keywords'] = array(t('Tags:'), $a->profile['pub_keywords']);
        }
        if ($a->profile['politic']) {
            $profile['politic'] = array(t('Political Views:'), $a->profile['politic']);
        }
        if ($a->profile['religion']) {
            $profile['religion'] = array(t('Religion:'), $a->profile['religion']);
        }
        if ($txt = prepare_text($a->profile['about'])) {
            $profile['about'] = array(t('About:'), $txt);
        }
        if ($txt = prepare_text($a->profile['interest'])) {
            $profile['interest'] = array(t('Hobbies/Interests:'), $txt);
        }
        if ($txt = prepare_text($a->profile['contact'])) {
            $profile['contact'] = array(t('Contact information and Social Networks:'), $txt);
        }
        if ($txt = prepare_text($a->profile['music'])) {
            $profile['music'] = array(t('Musical interests:'), $txt);
        }
        if ($txt = prepare_text($a->profile['book'])) {
            $profile['book'] = array(t('Books, literature:'), $txt);
        }
        if ($txt = prepare_text($a->profile['tv'])) {
            $profile['tv'] = array(t('Television:'), $txt);
        }
        if ($txt = prepare_text($a->profile['film'])) {
            $profile['film'] = array(t('Film/dance/culture/entertainment:'), $txt);
        }
        if ($txt = prepare_text($a->profile['romance'])) {
            $profile['romance'] = array(t('Love/Romance:'), $txt);
        }
        if ($txt = prepare_text($a->profile['work'])) {
            $profile['work'] = array(t('Work/employment:'), $txt);
        }
        if ($txt = prepare_text($a->profile['education'])) {
            $profile['education'] = array(t('School/education:'), $txt);
        }
    }
    return replace_macros($tpl, array('$title' => t('Profile'), '$profile' => $profile));
}
开发者ID:nextgensh,项目名称:friendica,代码行数:74,代码来源:profile_advanced.php

示例15: events_content

function events_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $htpl = get_markup_template('event_head.tpl');
    $a->page['htmlhead'] .= replace_macros($htpl, array('$baseurl' => $a->get_baseurl()));
    $o = "";
    // tabs
    $tabs = profile_tabs($a, True);
    $mode = 'view';
    $y = 0;
    $m = 0;
    if ($a->argc > 1) {
        if ($a->argc > 2 && $a->argv[1] == 'event') {
            $mode = 'edit';
            $event_id = intval($a->argv[2]);
        }
        if ($a->argv[1] === 'new') {
            $mode = 'new';
            $event_id = 0;
        }
        if ($a->argc > 2 && intval($a->argv[1]) && intval($a->argv[2])) {
            $mode = 'view';
            $y = intval($a->argv[1]);
            $m = intval($a->argv[2]);
        }
    }
    if ($mode == 'view') {
        $thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
        $thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
        if (!$y) {
            $y = intval($thisyear);
        }
        if (!$m) {
            $m = intval($thismonth);
        }
        // Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
        // An upper limit was chosen to keep search engines from exploring links millions of years in the future.
        if ($y < 1901) {
            $y = 1900;
        }
        if ($y > 2099) {
            $y = 2100;
        }
        $nextyear = $y;
        $nextmonth = $m + 1;
        if ($nextmonth > 12) {
            $nextmonth = 1;
            $nextyear++;
        }
        $prevyear = $y;
        if ($m > 1) {
            $prevmonth = $m - 1;
        } else {
            $prevmonth = 12;
            $prevyear--;
        }
        $dim = get_dim($y, $m);
        $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
        $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
        if ($a->argv[1] === 'json') {
            if (x($_GET, 'start')) {
                $start = date("Y-m-d h:i:s", $_GET['start']);
            }
            if (x($_GET, 'end')) {
                $finish = date("Y-m-d h:i:s", $_GET['end']);
            }
        }
        $start = datetime_convert('UTC', 'UTC', $start);
        $finish = datetime_convert('UTC', 'UTC', $finish);
        $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
        $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
        if (x($_GET, 'id')) {
            $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` \n\t\t\t\tWHERE `event`.`uid` = %d AND `event`.`id` = %d", intval(local_user()), intval($_GET['id']));
        } else {
            $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,\n\t\t\t\t`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` \n\t\t\t\tWHERE `event`.`uid` = %d\n\t\t\t\tAND (( `adjust` = 0 AND `start` >= '%s' AND `start` <= '%s' ) \n\t\t\t\tOR  (  `adjust` = 1 AND `start` >= '%s' AND `start` <= '%s' )) ", intval(local_user()), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
        }
        $links = array();
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                if (!x($links, $j)) {
                    $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j;
                }
            }
        }
        $events = array();
        $last_date = '';
        $fmt = t('l, F j');
        if (count($r)) {
            $r = sort_by_date($r);
            foreach ($r as $rr) {
                $j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'j') : datetime_convert('UTC', 'UTC', $rr['start'], 'j');
                $d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], $fmt) : datetime_convert('UTC', 'UTC', $rr['start'], $fmt);
                $d = day_translate($d);
                $start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['start'], 'c') : datetime_convert('UTC', 'UTC', $rr['start'], 'c');
                if ($rr['nofinish']) {
//.........这里部分代码省略.........
开发者ID:nextgensh,项目名称:friendica,代码行数:101,代码来源:events.php


注:本文中的day_translate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。