本文整理汇总了PHP中serendipity_strftime函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_strftime函数的具体用法?PHP serendipity_strftime怎么用?PHP serendipity_strftime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serendipity_strftime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extendedVisitorStatistics
//.........这里部分代码省略.........
<?php
$i = 1;
if (is_array($top_refs)) {
echo '<ol>';
foreach ($top_refs as $key => $row) {
echo '<li><a href="http://' . $row['refs'] . '" target="_blank">' . $row['refs'] . '</a> (' . $row['count'] . ')</li>';
}
echo '</ol>';
} else {
echo "<span class='msg_notice'><span class='icon-info-circled'></span> " . PLUGIN_EVENT_STATISTICS_EXT_TOPREFS_NONE . "</span>";
}
?>
</section>
<section class="wide_box">
<h3><?php
echo PLUGIN_EVENT_STATISTICS_EXT_MONTHGRAPH;
?>
</h3>
<?php
if ($visitors_count[0] > 0) {
?>
<table>
<tbody>
<tr>
<th scope="row"><?php
echo MONTHS;
?>
</th>
<?php
$mon = array('1' => 'Jan', '2' => 'Feb', '3' => 'Mar', '4' => 'Apr', '5' => 'May', '6' => 'Jun', '7' => 'Jul', '8' => 'Aug', '9' => 'Sep', '10' => 'Oct', '11' => 'Nov', '12' => 'Dec');
for ($i = 1; $i < 13; $i++) {
echo '<td>' . serendipity_strftime('%b', mktime(0, 0, 0, $i, 1, 2000)) . '</td>';
}
?>
</tr>
<tr>
<th scope="row">Visits</th>
<?php
$num = $this->statistics_getmonthlystats();
for ($i = 1; $i < 13; $i++) {
echo '<td>' . $num[$i] . '</td>';
}
?>
</tr>
<tr>
<th scope="row">+/~/-</th>
<?php
$num = $this->statistics_getmonthlystats();
$rep = $num;
rsort($rep);
for ($i = 1; $i < 13; $i++) {
$maxVisHeigh = 100 / $rep[0] * 2;
$monthHeight = round($num[$i] * $maxVisHeigh);
echo '<td class="stats_imagecell"><img src="plugins/serendipity_event_statistics/';
if ($num[$i] * $maxVisHeigh / 2 <= 33) {
echo 'red.png';
} else {
if ($num[$i] * $maxVisHeigh / 2 > 33 && $num[$i] * $maxVisHeigh / 2 < 66) {
echo 'yellow.png';
} else {
echo 'green.png';
}
}
echo '" width="8" height="' . $monthHeight . '" style="height:' . $monthHeight . 'px" alt="';
示例2: printComments
function printComments($comments)
{
if (!is_array($comments) || count($comments) < 1) {
return;
}
foreach ($comments as $i => $comment) {
$comment['comment'] = function_exists('serendipity_specialchars') ? serendipity_specialchars(strip_tags($comment['body'])) : htmlspecialchars(strip_tags($comment['body']), ENT_COMPAT, LANG_CHARSET);
if (!empty($comment['url']) && substr($comment['url'], 0, 7) != 'http://' && substr($comment['url'], 0, 8) != 'https://') {
$comment['url'] = 'http://' . $comment['url'];
}
serendipity_plugin_api::hook_event('frontend_display', $comment);
$name = empty($comment['username']) ? ANONYMOUS : $comment['username'];
$body = $comment['comment'];
$this->pdf->SetFont('Arial', '', 9);
$html = $this->prep_out($body . "\n" . ' ' . $name . ' ' . ON . ' ' . serendipity_mb('ucfirst', $this->prep_out(serendipity_strftime('%b %e %Y, %H:%M', $comment['timestamp'])))) . "\n";
if (serendipity_db_bool($this->get_config('html2pdf'))) {
$this->pdf->WriteHTML($html);
} else {
$this->pdf->Write(3, $html);
}
$this->pdf->Ln();
$this->pdf->Ln();
}
}
示例3: serendipity_generateCommentList
/**
* Create a HTML SELECT dropdown field which represents all hierarchical comments
*
* @access public
* @param int The entry ID to show comments for
* @param array The existing comments for this entry
* @param int The ID of the comment that is being referred to (last selection)
* @param int The parent ID of the last comment [for recursive usage]
* @param int The current nesting/hierarchy level [for recursive usage]
* @param string The HTML indention string that gets prepended to a comment [for recursive usage]
* @return string The HTML SELECT code
*/
function serendipity_generateCommentList($id, $comments = NULL, $selected = 0, $parent = 0, $level = 0, $indent = '')
{
global $serendipity;
if (!is_array($comments)) {
if (empty($id)) {
$comments = array();
} else {
$comments = serendipity_fetchComments($id);
}
}
$retval = $parent ? '' : '<select id="serendipity_replyTo" onchange="' . (!empty($serendipity['plugindata']['onchange']) ? $serendipity['plugindata']['onchange'] : '') . '" name="serendipity[replyTo]"><option value="0">[ ' . TOP_LEVEL . ' ]</option>';
$i = 0;
foreach ($comments as $comment) {
if ($comment['parent_id'] == $parent) {
$i++;
$retval .= '<option value="' . $comment['id'] . '"' . ($selected == $comment['id'] || isset($serendipity['POST']['replyTo']) && $comment['id'] == $serendipity['POST']['replyTo'] ? ' selected="selected"' : '') . '>' . str_repeat(' ', $level * 2) . '#' . $indent . $i . ': ' . (empty($comment['author']) ? ANONYMOUS : htmlspecialchars($comment['author'])) . ' ' . ON . ' ' . serendipity_mb('ucfirst', serendipity_strftime(DATE_FORMAT_SHORT, $comment['timestamp'])) . "</option>\n";
$retval .= serendipity_generateCommentList($id, $comments, $selected, $comment['id'], $level + 1, $indent . $i . '.');
}
}
$retval .= $parent ? '' : '</select>';
return $retval;
}
示例4: makeDate
function makeDate($created_at, $dateformat)
{
if (serendipity_db_bool($this->get_config('use_time_ago'))) {
return Twitter::create_status_ago_string($created_at);
}
$old_date = explode(" ", $created_at);
$old_time = explode(":", $old_date[3]);
switch ($old_date[1]) {
case 'Jan':
$old_date[1] = 1;
break;
case 'Feb':
$old_date[1] = 2;
break;
case 'Mar':
$old_date[1] = 3;
break;
case 'Apr':
$old_date[1] = 4;
break;
case 'May':
$old_date[1] = 5;
break;
case 'Jun':
$old_date[1] = 6;
break;
case 'Jul':
$old_date[1] = 7;
break;
case 'Aug':
$old_date[1] = 8;
break;
case 'Sep':
$old_date[1] = 9;
break;
case 'Oct':
$old_date[1] = 10;
break;
case 'Nov':
$old_date[1] = 11;
break;
case 'Dec':
$old_date[1] = 12;
break;
}
$timestamp = mktime($old_time[0], $old_time[1], $old_time[2], $old_date[1], $old_date[2], $old_date[5]);
if (LANG_CHARSET == 'UTF-8') {
return serendipity_strftime($dateformat, $timestamp);
} else {
return utf8_encode(serendipity_strftime($dateformat, $timestamp));
}
}
示例5: serveComments
function serveComments()
{
global $serendipity;
$serendipity['view'] = 'comments';
$uri = $_SERVER['REQUEST_URI'];
$_args = serendipity_getUriArguments($uri, true);
// Need to also match "." character
$timedesc = array();
/* Attempt to locate hidden variables within the URI */
foreach ($_args as $k => $v) {
if ($v == PATH_COMMENTS) {
continue;
}
if (preg_match('@^(last|f|t|from|to)[\\s_-]*([\\d-/ ]+)$@', strtolower(urldecode($v)), $m)) {
if ($m[1] == 'last') {
$usetime = time() - $m[2] * 86400;
$serendipity['GET']['commentStartTime'] = $usetime;
$timedesc['start'] = serendipity_strftime(DATE_FORMAT_SHORT, $usetime);
continue;
}
$date = strtotime($m[2]);
if ($date < 1) {
continue;
}
if ($m[1] == 'f' || $m[1] == 'from') {
$serendipity['GET']['commentStartTime'] = $date;
$timedesc['start'] = serendipity_strftime(DATE_FORMAT_SHORT, $date);
} else {
$serendipity['GET']['commentEndTime'] = $date;
$timedesc['end'] = serendipity_strftime(DATE_FORMAT_SHORT, $date);
}
} elseif ($v == 'trackbacks' || $v == 'comments_and_trackbacks' || $v == 'comments') {
$serendipity['GET']['commentMode'] = $v;
} elseif (!empty($v)) {
$serendipity['GET']['viewCommentAuthor'] .= urldecode($v);
}
}
$serendipity['head_title'] = COMMENTS_FROM . ' ' . serendipity_specialchars($serendipity['GET']['viewCommentAuthor']);
if (isset($timedesc['start']) && isset($timedesc['end'])) {
$serendipity['head_title'] .= ' (' . $timedesc['start'] . ' - ' . $timedesc['end'] . ')';
} elseif (isset($timedesc['start'])) {
$serendipity['head_title'] .= ' (> ' . $timedesc['start'] . ')';
} elseif (isset($timedesc['end'])) {
$serendipity['head_title'] .= ' (< ' . $timedesc['end'] . ')';
}
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
$serendipity['GET']['action'] = 'comments';
include S9Y_INCLUDE_PATH . 'include/genpage.inc.php';
}
示例6: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$intro = $this->get_config('intro');
$outro = $this->get_config('outro');
$maxlength = $this->get_config('maxlength');
$max_entries = $this->get_config('max_entries');
$min_age = $this->get_config('min_age');
$max_age = $this->get_config('max_age');
$specialage = $this->get_config('specialage');
$displaydate = $this->get_config('displaydate', 'true');
$dateformat = $this->get_config('dateformat');
$full = serendipity_db_bool($this->get_config('full'));
$displayauthor = serendipity_db_bool($this->get_config('displayauthor', false));
if (!is_numeric($min_age) || $min_age < 0 || $specialage == 'year') {
$min_age = 365 + date('L', serendipity_serverOffsetHour());
}
if (!is_numeric($max_age) || $max_age < 1 || $specialage == 'year') {
$max_age = 365 + date('L', serendipity_serverOffsetHour());
}
if (!is_numeric($max_entries) || $max_entries < 1) {
$max_entries = 5;
}
if (!is_numeric($maxlength) || $maxlength < 0) {
$maxlength = 30;
}
if (strlen($dateformat) < 1) {
$dateformat = '%a, %d.%m.%Y %H:%M';
}
$oldLim = $serendipity['fetchLimit'];
$nowts = serendipity_serverOffsetHour();
$maxts = mktime(23, 59, 59, date('m', $nowts), date('d', $nowts), date('Y', $nowts));
$mints = mktime(0, 0, 0, date('m', $nowts), date('d', $nowts), date('Y', $nowts));
$e = serendipity_fetchEntries(array($mints - $max_age * 86400, $maxts - $min_age * 86400), $full, $max_entries);
$serendipity['fetchLimit'] = $oldLim;
echo empty($intro) ? '' : '<div class="serendipity_history_intro">' . $intro . '</div>' . "\n";
if (!is_array($e)) {
return false;
}
if (($e_c = count($e)) == 0) {
return false;
}
for ($x = 0; $x < $e_c; $x++) {
$url = serendipity_archiveURL($e[$x]['id'], $e[$x]['title'], 'serendipityHTTPPath', true, array('timestamp' => $e[$x]['timestamp']));
$date = $displaydate == '0' ? '' : serendipity_strftime($dateformat, $e[$x]['timestamp']);
$author = $displayauthor ? $e[$x]['author'] . ': ' : '';
echo '<div class="serendipity_history_info">';
if ($displayauthor) {
echo '<span class="serendipity_history_author">' . $author . ' </span>';
}
if ($displaydate) {
echo '<span class="serendipity_history_date">' . $date . ' </span>';
}
$t = $maxlength == 0 || strlen($e[$x]['title']) <= $maxlength ? $e[$x]['title'] : trim(serendipity_mb('substr', $e[$x]['title'], 0, $maxlength - 3)) . ' [...]';
echo '<a href="' . $url . '" title="' . str_replace("'", "`", serendipity_specialchars($e[$x]['title'])) . '">"' . serendipity_specialchars($t) . '"</a></div>';
if ($full) {
echo '<div class="serendipity_history_body">' . strip_tags($e[$x]['body']) . '</div>';
}
}
echo empty($outro) ? '' : '<div class="serendipity_history_outro">' . $outro . '</div>';
}
示例7: inspectConfig
//.........这里部分代码省略.........
echo $elcount;
?>
" name="serendipity[plugin][<?php
echo $config_item;
?>
]" rows="20" cols="80"><?php
echo $hvalue;
?>
</textarea>
</div>
<?php
if (!$is_smarty) {
?>
</td>
</tr>
<?php
}
if ($type == 'html') {
$this->htmlnugget[] = $elcount;
if (version_compare(preg_replace('@[^0-9\\.]@', '', $serendipity['version']), '0.9', '<')) {
serendipity_emit_htmlarea_code('nuggets' . $elcount, 'nuggets' . $elcount);
} else {
serendipity_emit_htmlarea_code('nuggets', 'nuggets', true);
}
}
break;
case 'content':
if (!$is_smarty) {
?>
<tr><td colspan="2"><?php
echo $default;
?>
</td></tr><?php
} else {
echo $default;
}
break;
case 'hidden':
if (!$is_smarty) {
?>
<tr><td colspan="2"><?php
}
?>
<input class="direction_<?php
echo $lang_direction;
?>
" type="hidden" name="serendipity[plugin][<?php
echo $config_item;
?>
]" value="<?php
echo $value;
?>
" /><?php
if (!$is_smarty) {
?>
</td></tr><?php
}
break;
case 'timestamp':
if (!$is_smarty) {
?>
<tr>
<td style="border-bottom: 1px solid #000000">
<strong><?php
echo $cname;
?>
</strong>
<br><span style="color: #5E7A94; font-size: 8pt;"> <?php
echo $cdesc;
?>
</span>
</td>
<td style="border-bottom: 1px solid #000000" width="250">
<div>
<?php
}
?>
<input class="input_textbox direction_<?php
echo $lang_direction;
?>
" type="text" name="serendipity[plugin][<?php
echo $config_item;
?>
]" value="<?php
echo serendipity_strftime(DATE_FORMAT_SHORT, $hvalue);
?>
" size="30" />
<?php
if (!$is_smarty) {
?>
</div>
</td>
</tr>
<?php
}
break;
}
}
示例8: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'backend_sidebar_entries':
if ($serendipity['version'][0] < 2) {
?>
<li class="serendipitySideBarMenuLink serendipitySideBarMenuEntryLinks"><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=adminnotes"><?php
echo PLUGIN_ADMINNOTES_TITLE;
?>
</a></li>
<?php
}
// Serendipity 2.0 now uses the new backend_sidebar_admin hook
break;
case 'backend_sidebar_admin':
if ($serendipity['version'][0] > 1) {
?>
<li><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=adminnotes"><?php
echo PLUGIN_ADMINNOTES_TITLE;
?>
</a></li>
<?php
}
break;
case 'backend_sidebar_entries_event_display_adminnotes':
$this->shownotes();
break;
case 'js_backend':
?>
/* serendipity_event_adminnotes (quicknotes) start */
function fulltext_toggle(id) {
if ( document.getElementById(id + '_full').style.display == '' ) {
document.getElementById(id + '_full').style.display='none';
document.getElementById(id + '_summary').style.display='';
document.getElementById(id + '_text').innerHTML = '<?php
echo TOGGLE_ALL;
?>
';
} else {
document.getElementById(id + '_full').style.display='';
document.getElementById(id + '_summary').style.display='none';
document.getElementById(id + '_text').innerHTML = '<?php
echo HIDE;
?>
';
}
return false;
}
/* serendipity_event_adminnotes (quicknotes) end */
<?php
break;
case 'backend_frontpage_display':
if ($serendipity['version'][0] > 1) {
break;
}
?>
<script type="text/javascript">
function fulltext_toggle(id) {
if ( document.getElementById(id + '_full').style.display == '' ) {
document.getElementById(id + '_full').style.display='none';
document.getElementById(id + '_summary').style.display='';
document.getElementById(id + '_text').innerHTML = '<?php
echo TOGGLE_ALL;
?>
';
} else {
document.getElementById(id + '_full').style.display='';
document.getElementById(id + '_summary').style.display='none';
document.getElementById(id + '_text').innerHTML = '<?php
echo HIDE;
?>
';
}
return false;
}
</script>
<?php
$cutoff = $this->get_config('cutoff');
$notes = $this->getMyNotes();
$zoom = serendipity_getTemplateFile('admin/img/zoom.png');
if (is_array($notes)) {
foreach ($notes as $id => $note) {
echo '<div class="serendipity_note note_' . $this->output($note['notetype']) . ' note_owner_' . $note['authorid'] . ($serendipity['COOKIE']['lastnote'] < $note['noteid'] ? ' note_new' : '') . '">' . "\n";
echo ' <div class="note_subject"><strong>' . $this->output($note['subject']) . '</strong> ' . POSTED_BY . ' ' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($note['realname']) : htmlspecialchars($note['realname'], ENT_COMPAT, LANG_CHARSET)) . ' ' . ON . ' ' . serendipity_strftime(DATE_FORMAT_SHORT, $note['notetime']) . '</div>' . "\n";
if (strlen($note['body']) > $cutoff) {
$output = $this->output($note['body']);
echo ' <div id="' . $id . '_full" style="display: none" class="note_body">' . $output . '</div>' . "\n";
echo ' <div id="' . $id . '_summary" class="note_body">' . serendipity_mb('substr', $output, 0, $cutoff) . '...</div>' . "\n";
echo ' <div class="note_summarylink"><a href="#' . $id . '_full" onclick="fulltext_toggle(' . $id . '); return false;" title="' . VIEW . '" class="serendipityIconLink"><img src="' . $zoom . '" alt="' . TOGGLE_ALL . '" /><span id="' . $id . '_text">' . TOGGLE_ALL . '</span></a></div>';
} else {
echo ' <div class="note_body">' . $this->output($note['body']) . '</div>' . "\n";
}
echo "</div>\n";
//.........这里部分代码省略.........
示例9: showEntries
function showEntries()
{
global $serendipity;
if ($serendipity['GET']['custom_sortyears'] == 'all') {
$range = null;
} else {
$range = array(mktime(0, 0, 0, 1, 1, $serendipity['GET']['custom_sortyears']), mktime(0, 0, 0, 1, 1, $serendipity['GET']['custom_sortyears'] + 1));
}
if ($serendipity['GET']['custom_sortauthors'] != 'all') {
$serendipity['GET']['viewAuthor'] = (int) $serendipity['GET']['custom_sortauthors'];
}
switch ($serendipity['GET']['custom_sortfield']) {
case 'category':
$sql_order = 'c.category_name';
break;
case 'timestamp':
$sql_order = 'e.timestamp';
break;
case 'title':
$sql_order = 'e.title';
break;
}
if ($serendipity['GET']['custom_sortorder'] == 'desc') {
$sql_order = $sql_order . ' DESC';
}
$entries = serendipity_fetchEntries($range, false, '', false, false, $sql_order);
$pool = array();
if (is_array($entries)) {
foreach ($entries as $entry) {
$entryLink = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
$entryHTML = '<a href="' . $entryLink . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['title']) : htmlspecialchars($entry['title'], ENT_COMPAT, LANG_CHARSET)) . '">' . $entry['title'] . '</a><br />';
$key = '';
switch ($serendipity['GET']['custom_sortfield']) {
case 'category':
if (isset($entry['categories'][0])) {
$key = $entry['categories'][0]['category_name'];
} else {
$key = $entry['category_name'];
}
break;
case 'timestamp':
$key = serendipity_strftime('%B %Y', $entry['timestamp']);
break;
case 'title':
$key = strtoupper(substr($entry['title'], 0, 1));
break;
}
$pool[$key][] = $entryHTML;
}
}
foreach ($pool as $key => $content) {
echo '<dl>';
echo '<dt>' . $key . '</dt>' . "\n";
foreach ($content as $HTML) {
echo '<dd>' . $HTML . '</dd>' . "\n";
}
echo '</dl>';
}
}
示例10: template_option
$template_config_groups = NULL;
$template_config = NULL;
$template_loaded_config = NULL;
}
}
if (is_array($template_config)) {
serendipity_plugin_api::hook_event('backend_templates_configuration_top', $template_config);
$data["has_config"] = true;
if ($serendipity['POST']['adminAction'] == 'configure' && serendipity_checkFormToken()) {
$storage = new template_option();
$storage->import($template_config);
foreach ($serendipity['POST']['template'] as $option => $value) {
$storage->set_config($option, $value);
}
$data["adminAction"] = "configure";
$data["save_time"] = sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S'));
}
$data["form_token"] = serendipity_setFormToken();
include_once S9Y_INCLUDE_PATH . 'include/functions_plugins_admin.inc.php';
$template_vars =& serendipity_loadThemeOptions($template_config);
$template_options = new template_option();
$template_options->import($template_config);
$template_options->values =& $template_vars;
$data["configuration"] = serendipity_plugin_config($template_options, $template_vars, $serendipity['template'], $serendipity['template'], $template_options->keys, true, true, true, true, 'template', $template_config_groups);
serendipity_plugin_api::hook_event('backend_templates_configuration_bottom', $template_config);
} else {
serendipity_plugin_api::hook_event('backend_templates_configuration_none', $template_config);
}
$i = 0;
$stack = array();
serendipity_plugin_api::hook_event('backend_templates_fetchlist', $stack);
示例11: serendipity_uploadSecure
}
$use_dir = serendipity_uploadSecure($serendipity['GET']['dir']);
$checkpath = array(array('relpath' => $use_dir));
if (!serendipity_directoryACL($checkpath, 'write')) {
return;
}
if (!empty($serendipity['POST']['save'])) {
$newDir = serendipity_uploadSecure($serendipity['POST']['newDir']);
$oldDir = serendipity_uploadSecure($serendipity['POST']['oldDir']);
if ($oldDir != $newDir) {
serendipity_moveMediaDirectory($oldDir, $newDir);
$use_dir = $newDir;
}
serendipity_ACLGrant(0, 'directory', 'read', $serendipity['POST']['read_authors'], $use_dir);
serendipity_ACLGrant(0, 'directory', 'write', $serendipity['POST']['write_authors'], $use_dir);
echo '<div>' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) . '</div>';
}
$groups = serendipity_getAllGroups();
$read_groups = serendipity_ACLGet(0, 'directory', 'read', $use_dir);
$write_groups = serendipity_ACLGet(0, 'directory', 'write', $use_dir);
if (!empty($serendipity['POST']['update_children'])) {
$dir_list = serendipity_traversePath($serendipity['serendipityPath'] . $serendipity['uploadPath'], $use_dir, true, NULL, 1, NULL, 'write', NULL);
foreach ($dir_list as $f => $dir) {
// Apply parent ACL to children.
serendipity_ACLGrant(0, 'directory', 'read', $serendipity['POST']['read_authors'], $dir['relpath']);
serendipity_ACLGrant(0, 'directory', 'write', $serendipity['POST']['write_authors'], $dir['relpath']);
}
}
?>
<div class="image_directory_edit"><strong><?php
示例12: showBackend
function showBackend()
{
global $serendipity;
if (!empty($serendipity['POST']['action'])) {
$serendipity['GET']['action'] =& $serendipity['POST']['action'];
}
echo '<strong>' . FAQs . '</strong><hr />';
switch ($serendipity['GET']['action']) {
case 'faqs':
if ($serendipity['POST']['typeSave'] == "true" && !empty($serendipity['POST']['SAVECONF'])) {
$serendipity['POST']['typeSubmit'] = true;
$bag = new serendipity_property_bag();
$this->introspect($bag);
$name = function_exists('serendipity_specialchars') ? serendipity_specialchars($bag->get('name')) : htmlspecialchars($bag->get('name'), ENT_COMPAT, LANG_CHARSET);
$desc = function_exists('serendipity_specialchars') ? serendipity_specialchars($bag->get('description')) : htmlspecialchars($bag->get('description'), ENT_COMPAT, LANG_CHARSET);
$config_faq = $bag->get('configuration_faq');
foreach ($config_faq as $config_item) {
$cbag = new serendipity_property_bag();
if ($this->introspect_faq_item($config_item, $cbag)) {
$this->faq[$config_item] = serendipity_get_bool($serendipity['POST']['plugin'][$config_item]);
}
}
$result = $this->updateFAQ();
if (is_bool($result)) {
echo '<div class="serendipityAdminMsgSuccess"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . DONE . ': ' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) . '</div>';
} else {
echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />' . ERROR . ': ' . $result . '</div>';
}
}
if (!empty($serendipity['POST']['id'])) {
$serendipity['GET']['id'] =& $serendipity['POST']['id'];
}
if (is_numeric($serendipity['GET']['id'])) {
$this->fetchFAQ($serendipity['GET']['id']);
}
if (!is_numeric($serendipity['GET']['cid'])) {
$cid =& $this->faq['cid'];
} else {
$cid =& $serendipity['GET']['cid'];
}
echo '<p><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=faq">' . FAQ_CATEGORIES . '</a> <a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=faq&serendipity[action]=show_faqs&serendipity[cid]=' . $cid . '">' . FAQS . '</a></p>';
echo '<form action="serendipity_admin.php" method="post" name="serendipityEntry">';
echo '<input type="hidden" name="serendipity[adminModule]" value="event_display" />';
echo '<input type="hidden" name="serendipity[adminAction]" value="faq" />';
echo '<input type="hidden" name="serendipity[action]" value="faqs" />';
echo '<div>';
echo '<input type="hidden" name="serendipity[typeSave]" value="true" />';
$this->showFAQForm();
echo '</div>';
echo '</form>';
break;
case 'categories':
echo '<p><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=faq">' . FAQ_CATEGORIES . '</a></p>';
if (!empty($serendipity['GET']['id'])) {
$serendipity['POST']['id'] =& $serendipity['GET']['id'];
}
if (is_numeric($serendipity['POST']['id'])) {
$this->fetchCategory($serendipity['POST']['id']);
}
if ($serendipity['POST']['categorySave'] == "true" && !empty($serendipity['POST']['SAVECONF'])) {
$serendipity['POST']['categorySubmit'] = true;
$bag = new serendipity_property_bag();
$this->introspect($bag);
$name = function_exists('serendipity_specialchars') ? serendipity_specialchars($bag->get('name')) : htmlspecialchars($bag->get('name'), ENT_COMPAT, LANG_CHARSET);
$desc = function_exists('serendipity_specialchars') ? serendipity_specialchars($bag->get('description')) : htmlspecialchars($bag->get('description'), ENT_COMPAT, LANG_CHARSET);
$config_faq = $bag->get('configuration_category');
foreach ($config_faq as $config_item) {
$cbag = new serendipity_property_bag();
if ($this->introspect_category_item($config_item, $cbag)) {
$this->category[$config_item] = serendipity_get_bool($serendipity['POST']['plugin'][$config_item]);
}
}
$result = $this->updateCategory();
if (is_bool($result)) {
echo '<div class="serendipityAdminMsgSuccess"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . DONE . ': ' . sprintf(SETTINGS_SAVED_AT, serendipity_strftime('%H:%M:%S')) . '</div>';
} else {
echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />ERROR: ' . $result . '</div>';
}
}
echo '<form action="serendipity_admin.php" method="post" name="serendipityEntry">';
echo '<input type="hidden" name="serendipity[adminModule]" value="event_display" />';
echo '<input type="hidden" name="serendipity[adminAction]" value="faq" />';
echo '<input type="hidden" name="serendipity[action]" value="categories" />';
echo '<div>';
echo '<input type="hidden" name="serendipity[categorySave]" value="true" />';
$this->showCategoryForm();
echo '</div>';
echo '</form>';
break;
case 'show_faqs':
echo '<p><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=faq">' . FAQ_CATEGORIES . '</a> ' . FAQS . '</p>';
if (!empty($serendipity['POST']['faqDelete']) && is_numeric($serendipity['POST']['id'])) {
$result = $this->deleteFAQ($serendipity['POST']['id']);
if (is_bool($result)) {
echo '<div class="serendipityAdminMsgSuccess"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . DONE . ': ' . sprintf(RIP_ENTRY, $serendipity['POST']['id']) . '</div>';
} else {
echo '<div class="serendipityAdminMsgError"><img style="width: 22px; height: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_error.png') . '" alt="" />ERROR: ' . $result . '</div>';
}
}
if ($serendipity['GET']['actiondo'] == 'faqMoveUp') {
//.........这里部分代码省略.........
示例13: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
$comic_cat = $this->get_config('category', '');
$show_t = $this->get_config('show_title', 'true');
$show_raw = $this->get_config('raw', 'true');
$hide_fp = $this->get_config('hide', 'true');
if ($event == 'css') {
if (stristr('.serendipity_comics', $addData)) {
// class exists in CSS, so a user has customized it and we don't need default
return true;
}
?>
.serendipity_comics {
font-size: 15px;
font-weight: bold;
text-align: center;
margin-top: 5px;
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
border: 0px;
display: block;
}
<?php
return true;
} elseif ($event == 'entries_header' || $event == 'frontend_fetchentries') {
// determine location and show on the front page only
$geturi = serendipity_getUriArguments($GLOBALS['uri']);
if (!isset($geturi[0]) && !isset($serendipity['GET']['id']) && !isset($serendipity['GET']['category']) && $comic_cat) {
$comic = serendipity_db_query("SELECT e.id, e.title, e.timestamp, e.body\n\t\t\t\t\tFROM {$serendipity['dbPrefix']}entries e\n\t\t\t\t\tINNER JOIN {$serendipity['dbPrefix']}entrycat\n\t\t\t\t\t\tON e.id = {$serendipity['dbPrefix']}entrycat.entryid\n\t\t\t\t\tWHERE e.isdraft = 'false'\n\t\t\t\t\t\tAND e.timestamp <= " . $this->timeOffset(time()) . "\n\t\t\t\t\t\tAND {$serendipity['dbPrefix']}entrycat.categoryid = {$comic_cat}\n\t\t\t\t\tORDER BY e.timestamp DESC\n\t\t\t\t\tLIMIT 1");
if ($event == 'entries_header' && $serendipity['GET']['page'] == '1') {
if ($show_t == 'true') {
echo '<h4 class="serendipity_title"><a href="' . serendipity_archiveURL($comic[0]['id'], $comic[0]['title'], 'baseURL', true, array('timestamp' => $comic[0]['timestamp'])) . '">';
echo PLUGIN_COMICS_LATEST . (function_exists('serendipity_specialchars') ? serendipity_specialchars(serendipity_strftime(DATE_FORMAT_ENTRY, $comic['0']['timestamp'])) : htmlspecialchars(serendipity_strftime(DATE_FORMAT_ENTRY, $comic['0']['timestamp']), ENT_COMPAT, LANG_CHARSET)) . '</a></h4>';
}
if ($show_raw == 'true') {
echo $comic['0']['body'];
} else {
echo '<div class="serendipity_entry"><div class="serendipity_entry_body">';
$entry = array('html_nugget' => $comic['0']['body']);
serendipity_plugin_api::hook_event('frontend_display', $entry);
echo $entry['html_nugget'];
echo '</div></div>';
}
echo $this->jumplinks($comic['0']['id'], $comic_cat);
} elseif ($event == 'frontend_fetchentries' && !$serendipity['GET']['page'] && !isset($serendipity['GET']['adminModule'])) {
if ($hide_fp == 'true') {
$cond = " INNER JOIN {$serendipity['dbPrefix']}entrycat ON e.id = {$serendipity['dbPrefix']}entrycat.entryid ";
if (empty($eventData['joins'])) {
$eventData['joins'] = $cond;
} else {
$eventData['joins'] .= $cond;
}
$cond = "{$serendipity['dbPrefix']}entrycat.categoryid != {$comic_cat}";
} else {
$cond = "e.id != {$comic['0']['id']}";
}
if (empty($eventData['and'])) {
$eventData['and'] = " WHERE {$cond} ";
} else {
$eventData['and'] .= " AND {$cond} ";
}
}
}
return true;
} elseif ($event == 'entry_display' && isset($serendipity['GET']['id']) && $comic_cat) {
$thiscat = serendipity_fetchEntryCategories($serendipity['GET']['id']);
if ($thiscat['0']['0'] == $comic_cat) {
$elements = count($eventData);
for ($i = 0; $i < $elements; $i++) {
unset($eventData[$i]['properties']['ep_cache_extended']);
$eventData[$i]['exflag'] = 1;
$eventData[$i]['extended'] .= sprintf($this->jumplinks($serendipity['GET']['id'], $comic_cat));
}
}
return true;
} else {
return false;
}
}
示例14: ob_end_clean
ob_end_clean();
}
}
if (isset($_POST['REMOVE']) && serendipity_checkFormToken()) {
if (is_array($_POST['serendipity']['plugin_to_remove'])) {
foreach ($_POST['serendipity']['plugin_to_remove'] as $key) {
$plugin =& serendipity_plugin_api::load_plugin($key);
if ($plugin->serendipity_owner == '0' || $plugin->serendipity_owner == $serendipity['authorid'] || serendipity_checkPermission('adminPluginsMaintainOthers')) {
serendipity_plugin_api::remove_plugin_instance($key);
}
}
}
}
if (isset($_POST['SAVE'])) {
$data['save'] = true;
$data['timestamp'] = serendipity_strftime('%H:%M:%S');
}
ob_start();
serendipity_plugin_api::hook_event('backend_pluginlisting_header', $null);
$data['backend_pluginlisting_header'] = ob_get_contents();
ob_end_clean();
ob_start();
serendipity_plugin_api::hook_event('backend_plugins_sidebar_header', $serendipity);
$data['backend_plugins_sidebar_header'] = ob_get_contents();
ob_end_clean();
$data['sidebar_plugins'] = show_plugins(false, $sidebars);
ob_start();
serendipity_plugin_api::hook_event('backend_plugins_event_header', $serendipity);
$data['backend_plugins_event_header'] = ob_get_contents();
ob_end_clean();
$data['event_plugins'] = show_plugins(true);
示例15: time
if ($m[1] == 'last') {
$usetime = time() - $m[2] * 86400;
$serendipity['GET']['commentStartTime'] = $usetime;
$timedesc['start'] = serendipity_strftime(DATE_FORMAT_SHORT, $usetime);
continue;
}
$date = strtotime($m[2]);
if ($date < 1) {
continue;
}
if ($m[1] == 'f' || $m[1] == 'from') {
$serendipity['GET']['commentStartTime'] = $date;
$timedesc['start'] = serendipity_strftime(DATE_FORMAT_SHORT, $date);
} else {
$serendipity['GET']['commentEndTime'] = $date;
$timedesc['end'] = serendipity_strftime(DATE_FORMAT_SHORT, $date);
}
} elseif ($v == 'trackbacks' || $v == 'comments_and_trackbacks' || $v == 'comments') {
$serendipity['GET']['commentMode'] = $v;
} elseif (!empty($v)) {
$serendipity['GET']['viewCommentAuthor'] .= urldecode($v);
}
}
$serendipity['head_title'] = COMMENTS_FROM . ' ' . htmlspecialchars($serendipity['GET']['viewCommentAuthor']);
if (isset($timedesc['start']) && isset($timedesc['end'])) {
$serendipity['head_title'] .= ' (' . $timedesc['start'] . ' - ' . $timedesc['end'] . ')';
} elseif (isset($timedesc['start'])) {
$serendipity['head_title'] .= ' (> ' . $timedesc['start'] . ')';
} elseif (isset($timedesc['end'])) {
$serendipity['head_title'] .= ' (< ' . $timedesc['end'] . ')';
}