本文整理汇总了PHP中serendipity_archiveURL函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_archiveURL函数的具体用法?PHP serendipity_archiveURL怎么用?PHP serendipity_archiveURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serendipity_archiveURL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'entry_display':
if (!is_array($eventData)) {
return false;
}
$elements = count($eventData);
for ($i = 0; $i < $elements; $i++) {
if (empty($eventData[$i]['body'])) {
continue;
}
$eventData[$i]['add_footer'] .= '<script src="http://feeds.feedburner.com/~s/' . $this->get_config('feedburnerid', '') . '?i=' . serendipity_archiveURL($eventData[$i]['id'], $eventData[$i]['title'], 'baseURL', true, array('timestamp' => $entry['timestamp'])) . '" type="text/javascript" charset="utf-8"></script>';
}
return true;
break;
default:
return false;
}
} else {
return false;
}
}
示例2: generate_content
function generate_content(&$title)
{
global $serendipity;
$number = $this->get_config('number');
$showpicsonly = $this->get_config('showpicsonly');
if (!$number || !is_numeric($number) || $number < 1) {
$number = 5;
}
$title = PLUGIN_PHOTOBLOG_TITLE;
if (!isset($serendipity['GET']['id']) || !is_numeric($serendipity['GET']['id'])) {
$number = $number * $number + 1;
$entries = serendipity_db_query("SELECT id,\n title,\n timestamp\n FROM {$serendipity['dbPrefix']}entries\n WHERE isdraft = 'false'\n ORDER BY timestamp DESC\n LIMIT {$number}");
} else {
$id = serendipity_db_escape_string($serendipity['GET']['id']);
$entries1 = serendipity_db_query("SELECT id,\n title,\n timestamp\n FROM {$serendipity['dbPrefix']}entries\n WHERE isdraft = 'false'\n AND id > {$id}\n ORDER BY timestamp ASC\n LIMIT {$number}");
$number++;
$entries2 = serendipity_db_query("SELECT id,\n title,\n timestamp\n FROM {$serendipity['dbPrefix']}entries\n WHERE isdraft = 'false'\n AND id <= {$id}\n ORDER BY timestamp DESC\n LIMIT {$number}");
if (isset($entries1) && is_array($entries1) && isset($entries2) && is_array($entries2)) {
$entries = array_merge(array_reverse($entries1), $entries2);
} elseif (isset($entries1) && is_array($entries1)) {
$entries = array_reverse($entries1);
} elseif (isset($entries2) && is_array($entries2)) {
$entries = $entries2;
}
}
if (isset($entries) && is_array($entries)) {
foreach ($entries as $k => $entry) {
$entryLink = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
$photo = $this->getPhoto($entry['id']);
if ($showpicsonly == 'true' && isset($photo) || $showpicsonly != 'true') {
if (isset($photo)) {
$file = serendipity_fetchImageFromDatabase($photo['photoid']);
$imgsrc = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
$thumbbasename = $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
$thumbName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $thumbbasename;
$thumbsize = @getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $thumbbasename);
}
echo '<a href="' . $entryLink . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['title']) : htmlspecialchars($entry['title'], ENT_COMPAT, LANG_CHARSET)) . '">';
if (isset($photo)) {
echo '<img style="margin:5px;" src="' . $imgsrc . '" width=' . $thumbsize[0] . ' height=' . $thumbsize[1];
if (isset($id) && $id == $entry['id']) {
echo ' border=4';
}
echo ' />';
} else {
if (isset($id) && $id == $entry['id']) {
echo '<b>';
}
echo $entry['title'];
if (isset($id) && $id == $entry['id']) {
echo '</b>';
}
}
echo '</a><br />';
}
}
}
}
示例3: showSearch
function showSearch()
{
global $serendipity;
$this->setupDB();
$term = serendipity_db_escape_string($serendipity['GET']['searchTerm']);
if ($serendipity['dbType'] == 'postgres') {
$group = '';
$distinct = 'DISTINCT';
$find_part = "(c.title ILIKE '%{$term}%' OR c.body ILIKE '%{$term}%')";
} elseif ($serendipity['dbType'] == 'sqlite') {
$group = 'GROUP BY id';
$distinct = '';
$term = serendipity_mb('strtolower', $term);
$find_part = "(lower(c.title) LIKE '%{$term}%' OR lower(c.body) LIKE '%{$term}%')";
} else {
$group = 'GROUP BY id';
$distinct = '';
$term = str_replace('"', '"', $term);
if (preg_match('@["\\+\\-\\*~<>\\(\\)]+@', $term)) {
$find_part = "MATCH(c.title,c.body) AGAINST('{$term}' IN BOOLEAN MODE)";
} else {
$find_part = "MATCH(c.title,c.body) AGAINST('{$term}')";
}
}
$querystring = "SELECT c.title AS ctitle, c.body, c.author, c.entry_id, c.timestamp AS ctimestamp, c.url, c.type,\n e.id, e.title, e.timestamp\n FROM {$serendipity['dbPrefix']}comments AS c\n LEFT OUTER JOIN {$serendipity['dbPrefix']}entries AS e\n ON e.id = c.entry_id\n WHERE c.status = 'approved'\n AND {$find_part}\n {$group}\n ORDER BY c.timestamp DESC";
$results = serendipity_db_query($querystring, false, 'assoc');
if (!is_array($results)) {
if ($results !== 1 && $results !== true) {
echo function_exists('serendipity_specialchars') ? serendipity_specialchars($results) : htmlspecialchars($results, ENT_COMPAT, LANG_CHARSET);
}
$results = array();
}
$myAddData = array("from" => "serendipity_plugin_commentsearch:generate_content");
foreach ($results as $idx => $result) {
$results[$idx]['permalink'] = serendipity_archiveURL($result['id'], $result['title'], 'baseURL', true, $result);
$results[$idx]['comment'] = $result['body'];
//(function_exists('serendipity_specialchars') ? serendipity_specialchars(strip_tags($result['body'])) : htmlspecialchars(strip_tags($result['body']), ENT_COMPAT, LANG_CHARSET));
serendipity_plugin_api::hook_event('frontend_display', $results[$idx], $myAddData);
// let the template decide, if we want to have tags or not
$results[$idx]['commenthtml'] = $results[$idx]['comment'];
$results[$idx]['comment'] = strip_tags($results[$idx]['comment']);
}
$serendipity['smarty']->assign(array('comment_searchresults' => count($results), 'comment_results' => $results));
$filename = 'plugin_commentsearch_searchresults.tpl';
$tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
if (!$tfile) {
$tfile = dirname(__FILE__) . '/' . $filename;
}
$inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
$serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
$content = $serendipity['smarty']->fetch('file:' . $tfile);
$serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;
echo $content;
}
示例4: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = THUMBPAGE_TITLE;
if ($serendipity['GET']['page'] != 'thumbs') {
return true;
}
if (!headers_sent()) {
header('HTTP/1.0 200');
header('Status: 200 OK');
}
$entries = serendipity_db_query("SELECT id,\n title,\n timestamp\n FROM {$serendipity['dbPrefix']}entries\n WHERE isdraft = 'false'\n ORDER BY timestamp DESC");
if (isset($entries) && is_array($entries)) {
$count = 0;
echo '<table><tr>';
foreach ($entries as $k => $entry) {
echo '<td align="center">';
$entryLink = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
$photo = $this->getPhoto($entry['id']);
if (isset($photo)) {
$file = serendipity_fetchImageFromDatabase($photo['photoid']);
$imgsrc = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
$thumbbasename = $file['path'] . $file['name'] . '.' . $file['thumbnail_name'] . '.' . $file['extension'];
$thumbName = $serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath'] . $thumbbasename;
$thumbsize = @getimagesize($serendipity['serendipityPath'] . $serendipity['uploadPath'] . $thumbbasename);
}
echo '<a href="' . $entryLink . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['title']) : htmlspecialchars($entry['title'], ENT_COMPAT, LANG_CHARSET)) . '">';
if (isset($photo)) {
echo '<img style="margin:5px;" src="' . $imgsrc . '" width=' . $thumbsize[0] . ' height=' . $thumbsize[1];
if (isset($id) && $id == $entry['id']) {
echo ' border=4';
}
echo ' />';
} else {
if (isset($id) && $id == $entry['id']) {
echo '<b>';
}
echo $entry['title'];
if (isset($id) && $id == $entry['id']) {
echo '</b>';
}
}
echo '</a></td>';
if ($count++ >= $this->get_config('number') - 1) {
$count = 0;
echo "</tr><tr>";
}
}
echo "</tr></table>";
}
}
示例5: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$timespan = $this->get_config('timespan', 30);
$type = $this->get_config('type', 'IMDB');
$q = "SELECT ep.entryid AS id, e.title, e.timestamp, ep.value as rating\n\n\t\t\t\t FROM {$serendipity['dbPrefix']}entryproperties AS ep\n\t\t\t\t JOIN {$serendipity['dbPrefix']}entries AS e\n\t\t\t\t ON e.id = ep.entryid\n\n\t\t\t\t WHERE ep.property = 'cr_{$type}_rating'\n\t\t\t\t AND e.timestamp > " . (time() - 86700 * (int) $timespan) . "\n\t\t\t\t ORDER BY ep.value DESC\n\t\t\t\t LIMIT 5";
$rows = serendipity_db_query($q);
if (!is_array($rows)) {
echo "No movies during the last {$timespan} days! Maybe I dropped dead.";
}
echo '<ol class="movie {$type}">';
foreach ($rows as $row) {
$url = serendipity_archiveURL($row['id'], $row['title'], 'serendipityHTTPPath', true, array('timestamp' => $row['timestamp']));
echo '<li><a href="' . $url . '">' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($row['title']) : htmlspecialchars($row['title'], ENT_COMPAT, LANG_CHARSET)) . '</a> (' . $row['rating'] . ')</li>';
}
echo '</ol>';
}
示例6: serendipity_smarty_init
$serendipity['head_subtitle'] = COMMENTS;
$serendipity['smarty_file'] = 'commentpopup.tpl';
serendipity_smarty_init();
if ($id == 0) {
return false;
} else {
$serendipity['smarty']->assign('entry_id', $id);
}
if (isset($_GET['success']) && $_GET['success'] == 'true') {
$serendipity['smarty']->assign(array('is_comment_added' => true, 'comment_url' => serendipity_specialchars($_GET['url']) . '&serendipity[entry_id]=' . $id, 'comment_string' => explode('%s', COMMENT_ADDED_CLICK)));
} else {
if (!isset($serendipity['POST']['submit'])) {
if ($serendipity['GET']['type'] == 'trackbacks') {
$query = "SELECT title, timestamp FROM {$serendipity['dbPrefix']}entries WHERE id = '" . $id . "'";
$entry = serendipity_db_query($query);
$entry = serendipity_archiveURL($id, $entry[0]['title'], 'baseURL', true, array('timestamp' => $entry[0]['timestamp']));
$serendipity['smarty']->assign(array('is_showtrackbacks' => true, 'comment_url' => $serendipity['baseURL'] . 'comment.php?type=trackback&entry_id=' . $id, 'comment_entryurl' => $entry));
} else {
$query = "SELECT id, last_modified, timestamp, allow_comments, moderate_comments FROM {$serendipity['dbPrefix']}entries WHERE id = '" . $id . "'";
$ca = serendipity_db_query($query, true);
$comment_allowed = serendipity_db_bool($ca['allow_comments']) || !is_array($ca) ? true : false;
$serendipity['smarty']->assign(array('is_showcomments' => true, 'is_comment_allowed' => $comment_allowed));
if ($comment_allowed) {
serendipity_displayCommentForm($id, '?', NULL, $serendipity['POST'], true, serendipity_db_bool($ca['moderate_comments']), $ca);
}
}
} else {
$comment['url'] = $serendipity['POST']['url'];
$comment['comment'] = trim($serendipity['POST']['comment']);
$comment['name'] = $serendipity['POST']['name'];
$comment['email'] = $serendipity['POST']['email'];
示例7: serendipity_iframe
/**
* Prints the content of the iframe.
*
* Called by serendipity_is_iframe, when preview is requested. Fetches data from session.
* An iframe is used so that a single s9y page must not timeout on intensive operations,
* and so that the frontend stylesheet can be embedded without screwing up the backend.
*
* @access private
* @see serendipity_is_iframe()
* @param mixed The entry array (comes from session variable)
* @param string Indicates whether an entry is previewed or saved. Save performs XML-RPC calls.
* @param boolean Use smarty templating?
* @return boolean Indicates whether iframe data was printed
*/
function serendipity_iframe(&$entry, $mode = null)
{
global $serendipity;
if (empty($mode) || !is_array($entry)) {
return false;
}
$data = array();
$data['is_preview'] = true;
$data['mode'] = $mode;
switch ($mode) {
case 'save':
ob_start();
$res = serendipity_updertEntry($entry);
$data['updertHooks'] = ob_get_contents();
ob_end_clean();
if (is_string($res)) {
$data['res'] = $res;
}
if (!empty($serendipity['lastSavedEntry'])) {
$data['lastSavedEntry'] = $serendipity['lastSavedEntry'];
}
$data['entrylink'] = serendipity_archiveURL($res, $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
break;
case 'preview':
$serendipity['smarty_preview'] = true;
$data['preview'] = serendipity_printEntries(array($entry), $entry['extended'] != '' ? 1 : 0, true);
break;
}
return serendipity_smarty_show('preview_iframe.tpl', $data);
}
示例8: event_hook
//.........这里部分代码省略.........
})();
/* ]]> */
</script>
<?php
break;
case 'frontend_display':
if (empty($eventData['properties'])) {
$eventData['properties'] =& serendipity_fetchEntryProperties($eventData['id']);
}
if ($eventData['properties']['ep_flattr_active'] == '-1') {
return true;
}
if (empty($eventData['body']) && empty($eventData['extended'])) {
return true;
}
$flattr_uid = $this->_addslashes($this->get_config('userid'));
$flattr_tle = $this->_addslashes($eventData['title']);
$flattr_pop = (int) $this->get_config('flattr_pop');
$flattr_dsc = $this->_addslashes($eventData['properties']['ep_flattr_dsc']);
$flattr_cat = $this->_addslashes($eventData['properties']['ep_flattr_cat']);
$flattr_lng = $this->_addslashes($eventData['properties']['ep_flattr_lng']);
$flattr_tag = $this->_addslashes($eventData['properties']['ep_flattr_tag']);
if (empty($flattr_dsc)) {
$flattr_dsc = $this->_addslashes($eventData['body']);
}
$flattr_dsc = strip_tags($flattr_dsc);
if (empty($flattr_cat)) {
$flattr_cat = $this->get_config('flattr_cat');
}
if (empty($flattr_lng)) {
$flattr_lng = $this->get_config('flattr_lng');
}
if (empty($flattr_tag) && class_exists('serendipity_event_freetag')) {
$_tags = serendipity_event_freetag::getTagsForEntries(array($eventData['id']));
$tags = is_array($_tags) ? array_pop($_tags) : array();
$flattr_tag = implode(',', $tags);
}
$flattr_url = $this->_addslashes(serendipity_archiveURL($eventData['id'], $eventData['title'], 'baseURL', true, array('timestamp' => $eventData['timestamp'])));
$flattr_btn = $this->_addslashes($this->get_config('flattr_btn'));
$flattr_uid = substr($flattr_uid, 0, 500);
$flattr_tle = substr($flattr_tle, 0, 500);
$flattr_dsc = substr($flattr_dsc, 0, 1000);
$flattr_cat = substr($flattr_cat, 0, 255);
$flattr_lng = substr($flattr_lng, 0, 255);
$flattr_tag = substr($flattr_tag, 0, 255);
$flattr_url = substr($flattr_url, 0, 2048);
$flattr_btn = substr($flattr_btn, 0, 255);
if ($flattr_btn != 'default' && $flattr_btn != 'compact') {
$flattr = "<a href=\"https://flattr.com/submit/auto?" . "user_id=" . urlencode($flattr_uid) . "&" . "url=" . urlencode($flattr_url) . "&" . "title=" . urlencode($flattr_tle) . "&" . "description=" . urlencode($flattr_dsc) . "&" . "category=" . urlencode($flattr_cat) . "&" . "popout=" . urlencode($flattr_pop) . "&" . "language=" . urlencode($flattr_lng) . "\">" . $flattr_btn . "</a>";
} else {
$flattr_tle2 = stripslashes($flattr_tle2);
$flattr_tle2 = function_exists('serendipity_specialchars') ? serendipity_specialchars($flattr_tle2) : htmlspecialchars($flattr_tle2, ENT_COMPAT, LANG_CHARSET);
$flattr = "\r\n<a class='FlattrButton' style='display:none;'\r\n title=\"" . $flattr_tle2 . "\"\r\n data-flattr-uid='" . $flattr_uid . "'\r\n data-flattr-tags='" . $flattr_tag . "'\r\n data-flattr-category='" . $flattr_cat . "'\r\n data-flattr-language='" . $flattr_lng . "'\r\n href='" . $flattr_url . "'>\r\n\r\n " . stripslashes($flattr_dsc) . "\r\n</a>\r\n ";
}
$field = $this->get_config('placement');
if ($addData['from'] == 'functions_entries:updertEntry') {
} elseif ($addData['from'] == 'functions_entries:printEntries_rss') {
$entryText =& $this->getFieldReference($field, $eventData);
$entryText .= function_exists('serendipity_specialchars') ? serendipity_specialchars($flattr) : htmlspecialchars($flattr, ENT_COMPAT, LANG_CHARSET);
} else {
$entryText =& $this->getFieldReference($field, $eventData);
$entryText .= $flattr;
}
if ($field == 'extended') {
$eventData['is_extended'] = true;
}
break;
case 'frontend_display:rss-1.0:namespace':
case 'frontend_display:rss-2.0:namespace':
if ($this->get_config('add_to_feed')) {
$eventData['display_dat'] .= '
xmlns:atom="http://www.w3.org/2005/Atom"';
}
return true;
break;
case 'frontend_display:rss-1.0:per_entry':
case 'frontend_display:rss-2.0:per_entry':
if ($this->get_config('add_to_feed')) {
$flattr_uid = $this->_addslashes($this->get_config('userid'));
$flattr_uid = substr($flattr_uid, 0, 500);
$flattr_url = $this->_addslashes(serendipity_archiveURL($eventData['id'], $eventData['title'], 'baseURL', true, array('timestamp' => $eventData['timestamp'])));
$flattr_url = substr($flattr_url, 0, 2048);
$eventData['display_dat'] .= '
<atom:link rel="payment" href="https://flattr.com/submit/auto?url=' . urlencode($flattr_url) . '&user_id=' . $flattr_uid . '" type="text/html" />';
}
return true;
break;
case 'frontend_display:atom-1.0:per_entry':
if ($this->get_config('add_to_feed')) {
$flattr_uid = $this->_addslashes($this->get_config('userid'));
$flattr_uid = substr($flattr_uid, 0, 500);
$flattr_url = $this->_addslashes(serendipity_archiveURL($eventData['id'], $eventData['title'], 'baseURL', true, array('timestamp' => $eventData['timestamp'])));
$flattr_url = substr($flattr_url, 0, 2048);
$eventData['display_dat'] .= '
<link rel="payment" href="https://flattr.com/submit/auto?url=' . $flattr_url . '&user_id=' . $flattr_uid . '" type="text/html" />';
}
return true;
break;
}
}
示例9: event_hook
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'css':
if (stristr($eventData, '.serendipity_babelfish')) {
// class exists in CSS, so a user has customized it and we don't need default
return true;
}
?>
.serendipity_babelfish {
margin-left: auto;
margin-right: 0px;
text-align: right;
font-size: 7pt;
display: block;
margin-top: 5px;
margin-bottom: 0px;
}
.serendipity_babelfish a {
font-size: 7pt;
text-decoration: none;
}
.serendipity_babelfish a:hover {
color: green;
}
<?php
return true;
break;
case 'frontend_display':
if ($bag->get('scrambles_true_content') && is_array($addData) && isset($addData['no_scramble'])) {
return true;
}
case 'frontend_display_cache':
$pairs = explode(',', $this->get_config('TranslationPairs'));
$msg = '';
foreach ($pairs as $pair) {
list($src_lang, $dst_lang) = explode('->', $pair);
if ($src_lang == $serendipity['lang']) {
if ($msg == '') {
$msg = '<div class="serendipity_babelfish">' . PLUGIN_BABELFISH_TRANSLATE;
}
$bfURL = urlencode(serendipity_archiveURL($eventData['id'], $eventData['title'], 'baseURL', true, array('timestamp' => $eventData['timestamp'])));
$bfFromLang = $src_lang;
$bfToLang = $dst_lang;
$line = $this->get_config('EngineURL');
eval("\$line = \"{$line}\";");
// dirrrrrrty
$msg .= ' <a href="' . $line . '">' . $dst_lang . '</a>';
}
}
$msg .= '</div>';
$eventData['body'] .= $msg;
break;
default:
return false;
}
}
}
示例10: serendipity_sendComment
/**
* Send a comment notice to the admin/author of an entry
*
* @access public
* @param int ID of the comment that has been made
* @param string Author's email address to send the mail to
* @param string The name of the sender
* @param string The URL of the sender
* @param int The ID of the entry that has been commented
* @param string The title of the entry that has been commented
* @param string The text of the comment
* @param string The type of the comment (normal|trackback)
* @param boolean Toggle Whether comments to this entry need approval
* @return boolean Return success of sending the mails
*/
function serendipity_sendComment($comment_id, $to, $fromName, $fromEmail, $fromUrl, $id, $title, $comment, $type = 'NORMAL', $moderate_comment = false)
{
global $serendipity;
if (empty($fromName)) {
$fromName = ANONYMOUS;
}
$entryURI = serendipity_archiveURL($id, $title, 'baseURL');
$path = $type == 'TRACKBACK' ? 'trackback' : 'comment';
// Check for using Tokens
if ($serendipity['useCommentTokens']) {
$token = md5(uniqid(rand(), 1));
$path = $path . "_token_" . $token;
//Delete any comment tokens older than 1 week.
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options\n WHERE okey LIKE 'comment_%' AND name < " . (time() - 604800));
// Issue new comment moderation hash
serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}options (name, value, okey)\n VALUES ('" . time() . "', '" . $token . "', 'comment_" . $comment_id . "')");
}
$deleteURI = serendipity_rewriteURL(PATH_DELETE . '/' . $path . '/' . $comment_id . '/' . $id . '-' . serendipity_makeFilename($title) . '.html', 'baseURL');
$approveURI = serendipity_rewriteURL(PATH_APPROVE . '/' . $path . '/' . $comment_id . '/' . $id . '-' . serendipity_makeFilename($title) . '.html', 'baseURL');
if ($type == 'TRACKBACK') {
/******************* TRACKBACKS *******************/
$subject = ($moderate_comment ? '[' . REQUIRES_REVIEW . '] ' : '') . NEW_TRACKBACK_TO . ' ' . $title;
$text = sprintf(A_NEW_TRACKBACK_BLAHBLAH, $title) . "\n" . "\n" . REQUIRES_REVIEW . ': ' . ($moderate_comment ? YES : NO) . (isset($serendipity['moderate_reason']) ? ' (' . $serendipity['moderate_reason'] . ')' : '') . "\n" . LINK_TO_ENTRY . ': ' . $entryURI . "\n" . 'Weblog ' . NAME . ': ' . stripslashes($fromName) . "\n" . LINK_TO_REMOTE_ENTRY . ': ' . $fromUrl . "\n" . "\n" . EXCERPT . ':' . "\n" . strip_tags($comment) . "\n" . "\n" . '----' . "\n" . YOU_HAVE_THESE_OPTIONS . ($moderate_comment ? "\n" . str_repeat(' ', 2) . THIS_TRACKBACK_NEEDS_REVIEW : '') . "\n" . str_repeat(' ', 3) . str_pad(VIEW_ENTRY, 15) . ' -- ' . $entryURI . "\n" . str_repeat(' ', 3) . str_pad(DELETE_TRACKBACK, 15) . ' -- ' . $deleteURI . ($moderate_comment ? "\n" . str_repeat(' ', 3) . str_pad(APPROVE_TRACKBACK, 15) . ' -- ' . $approveURI : '');
} else {
/******************* COMMENTS *********************/
$subject = ($moderate_comment ? '[' . REQUIRES_REVIEW . '] ' : '') . NEW_COMMENT_TO . ' ' . $title;
$text = sprintf(A_NEW_COMMENT_BLAHBLAH, $serendipity['blogTitle'], $title) . "\n" . LINK_TO_ENTRY . ': ' . $entryURI . "\n" . "\n" . REQUIRES_REVIEW . ': ' . ($moderate_comment ? YES : NO) . (isset($serendipity['moderate_reason']) ? ' (' . $serendipity['moderate_reason'] . ')' : '') . "\n" . USER . ' ' . IP_ADDRESS . ': ' . $_SERVER['REMOTE_ADDR'] . "\n" . USER . ' ' . NAME . ': ' . $fromName . "\n" . USER . ' ' . EMAIL . ': ' . $fromEmail . "\n" . USER . ' ' . HOMEPAGE . ': ' . $fromUrl . "\n" . "\n" . COMMENTS . ': ' . "\n" . strip_tags($comment) . "\n" . "\n" . '----' . "\n" . YOU_HAVE_THESE_OPTIONS . ($moderate_comment ? "\n" . str_repeat(' ', 2) . THIS_COMMENT_NEEDS_REVIEW : '') . "\n" . str_repeat(' ', 3) . str_pad(VIEW_COMMENT, 15) . ' -- ' . $entryURI . '#c' . $comment_id . "\n" . str_repeat(' ', 3) . str_pad(DELETE_COMMENT, 15) . ' -- ' . $deleteURI . ($moderate_comment ? "\n" . str_repeat(' ', 3) . str_pad(APPROVE_COMMENT, 15) . ' -- ' . $approveURI : '');
}
return serendipity_sendMail($to, $subject, $text, $fromEmail, null, $fromName);
}
示例11: print_entry
function print_entry($x, &$entry, $header = false)
{
if ($header) {
$this->pdf->AddPage();
$this->pdf->SetFont('Courier', '', 12);
$this->pdf->TOC_Add($header);
$this->pdf->Cell(0, 10, $header, 1);
$this->pdf->Ln();
$this->pdf->Ln();
}
$entryLink = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp']));
serendipity_plugin_api::hook_event('frontend_display', $entry, array('no_scramble' => true));
$posted_by = ' ' . POSTED_BY . ' ' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($entry['author']) : htmlspecialchars($entry['author'], ENT_COMPAT, LANG_CHARSET));
if (is_array($entry['categories']) && sizeof($entry['categories']) > 0) {
$posted_by .= ' ' . IN . ' ';
$cats = array();
foreach ($entry['categories'] as $cat) {
$cats[] = $cat['category_name'];
}
$posted_by .= implode(', ', $cats);
}
$posted_by .= ' ' . AT . ' ' . serendipity_strftime('%H:%M', $entry['timestamp']);
$this->pdf->SetFont('Arial', 'B', 11);
$this->pdf->Write(4, $this->prep_out($entry['title']) . "\n");
$this->pdf->Ln();
$this->pdf->SetFont('Arial', '', 10);
$html = $this->prep_out($entry['body'] . $entry['extended']) . "\n";
if (serendipity_db_bool($this->get_config('html2pdf'))) {
$this->pdf->WriteHTML($html);
} else {
$this->pdf->Write(4, $html);
}
$this->pdf->Ln();
$this->pdf->SetFont('Courier', '', 9);
$this->pdf->Write(4, $this->prep_out($posted_by) . "\n");
$this->pdf->Ln();
if ($this->single) {
$this->printComments(serendipity_fetchComments($entry['id']));
}
}
示例12: showInterface
function showInterface()
{
global $serendipity;
if (isset($_POST['submitdopost'])) {
$postid = $_POST['id'];
$pbuserno = $_POST[pbuserid];
$postinfo = $this->phoneblogz_post($postid, $pbuserno);
if ($postinfo['error'] != false) {
echo "ERROR: " . $postinfo['error'];
}
}
$arr = getPostsForAccount($this->get_config("phoneblogz_accesscode"), $this->get_config("phoneblogz_password"));
if (!empty($arr["error"])) {
echo "ERROR: " . $arr["error"];
} else {
echo '<h3 style="text-align:center;">' . PLUGIN_EVENT_PHONEBLOGZ_SEEBELOW . '</h3>';
echo "<table border='1'>";
// TODO: i18n
echo "<tr>\n";
echo "<th>Date Posted</th>";
echo "<th>Caller ID</th>";
echo "<th>Left by</th>";
echo "<th>Listen</th>";
echo "<th>Download link</th>";
echo "<th>Status</th>";
echo "<th>Action</th>";
echo "</tr>";
for ($i = 0; $i < count($arr); ++$i) {
$msg = $arr[$i];
$status = "available";
$action = "";
$postid = $this->get_config("phoneblogz_status_" . $msg["messageid"]);
if (!isset($postid)) {
$status = "not posted";
$action = "<form action='?serendipity[adminModule]=event_display&serendipity[adminAction]=phoneblogz' method='POST'>" . "<input type='hidden' name='pbuserid' value='" . $msg["userno"] . "'>" . "<input type='hidden' name='id' value='" . $msg["messageid"] . "'><input class='serendipityPrettyButton input_button' type='submit' name='submitdopost' value='post now'></form>";
} else {
$status = "posted";
if ($postid > 0) {
$status .= " - <a href='" . serendipity_archiveURL($postid, 'preview') . "'>" . PREVIEW . "</a>";
}
$action = "<form action='?serendipity[adminModule]=event_display&serendipity[adminAction]=phoneblogz' method='POST'>" . "<input type='hidden' name='pbuserid' value='" . $msg["userno"] . "'>" . "<input type='hidden' name='id' value='" . $msg["messageid"] . "'><input class='serendipityPrettyButton input_button' type='submit' name='submitdopost' value='repost'></form>";
}
$posturl = "<a href='http://www.phoneblogz.com/listen.php?user=" . $this->get_config("phoneblogz_accesscode") . "&id=" . $msg["messageid"] . "'>Click here</a>";
$flashhtml = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ' . 'width="141" height="15" id="player" align="middle">';
$flashhtml .= '<param name="allowScriptAccess" value="sameDomain" />';
$flashhtml .= '<param name="FlashVars" value="msgid=' . $msg["messageid"] . '&userid=' . $this->get_config("phoneblogz_accesscode") . '" />';
$flashhtml .= '<param name="movie" value="http://www.phoneblogz.com/player2.swf?msgid=' . $msg["messageid"] . '&userid=' . $this->get_config("phoneblogz_accesscode") . '" />' . '<param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />';
$flashhtml .= '<embed src="http://www.phoneblogz.com/player2.swf" flashvars="msgid=' . $msg["messageid"] . '&userid=' . $this->get_config("phoneblogz_accesscode") . '" ' . 'quality="high" bgcolor="#ffffff" width="141" height="15" name="player" align="middle" ' . 'allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
$flashhtml .= '</object>';
echo "<tr><td>" . $msg["timeleft"] . "</td><td>" . $msg["callerid"] . "</td><td>" . $msg["username"] . "</td><td>{$flashhtml}</td><td>{$posturl}</td><td>{$status}</td><td>{$action}</td></tr>";
}
echo "</table>";
}
}
示例13: serendipity_handle_references
/**
* Search through link body, and automagically send a trackback ping.
*
* This is the trackback starter function that searches your text and sees if any
* trackback URLs are in there
*
* @access public
* @param int The ID of our entry
* @param string The author of our entry
* @param string The title of our entry
* @param string The text of our entry
* @param boolean Dry-Run, without performing trackbacks?
* @return
*/
function serendipity_handle_references($id, $author, $title, $text, $dry_run = false)
{
global $serendipity;
static $old_references = array();
static $saved_references = array();
static $saved_urls = array();
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug("serendipity_handle_references");
}
if ($dry_run) {
// Store the current list of references. We might need to restore them for later user.
$old_references = serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}references WHERE (type = '' OR type IS NULL) AND entry_id = " . (int) $id, false, 'assoc');
if (is_string($old_references)) {
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug($old_references);
}
}
if (is_array($old_references) && count($old_references) > 0) {
$current_references = array();
foreach ($old_references as $idx => $old_reference) {
// We need the current reference ID to restore it later.
$saved_references[$old_reference['link'] . $old_reference['name']] = $current_references[$old_reference['link'] . $old_reference['name']] = $old_reference;
$saved_urls[$old_reference['link']] = true;
}
}
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug("Got references in dry run: " . print_r($current_references, true));
}
} else {
// A dry-run was called previously and restorable references are found. Restore them now.
$del = serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}references WHERE (type = '' OR type IS NULL) AND entry_id = " . (int) $id);
if (is_string($del)) {
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug($del);
}
}
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug("Deleted references");
}
if (is_array($old_references) && count($old_references) > 0) {
$current_references = array();
foreach ($old_references as $idx => $old_reference) {
// We need the current reference ID to restore it later.
$current_references[$old_reference['link'] . $old_reference['name']] = $old_reference;
$q = serendipity_db_insert('references', $old_reference, 'show');
$cr = serendipity_db_query($q);
if (is_string($cr)) {
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug($cr);
}
}
}
}
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug("Got references in final run:" . print_r($current_references, true));
}
}
if (!preg_match_all('@<a[^>]+?href\\s*=\\s*["\']?([^\'" >]+?)[ \'"][^>]*>(.+?)</a>@i', $text, $matches)) {
$matches = array(0 => array(), 1 => array());
} else {
// remove full matches
array_shift($matches);
}
// Make trackback URL
$url = serendipity_archiveURL($id, $title, 'baseURL');
// Make sure that the trackback-URL does not point to https
$url = str_replace('https://', 'http://', $url);
// Add URL references
$locations = $matches[0];
$names = $matches[1];
$checked_locations = array();
serendipity_plugin_api::hook_event('backend_trackbacks', $locations);
for ($i = 0, $j = count($locations); $i < $j; ++$i) {
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug("Checking {$locations[$i]}...");
}
if ($locations[$i][0] == '/') {
$locations[$i] = 'http' . (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $locations[$i];
}
if (isset($checked_locations[$locations[$i]])) {
if (is_object($serendipity['logger'])) {
$serendipity['logger']->debug("Already checked");
}
continue;
}
if (preg_match_all('@<img[^>]+?alt=["\']?([^\'">]+?)[\'"][^>]+?>@i', $names[$i], $img_alt)) {
//.........这里部分代码省略.........
示例14: generate_content_custom
function generate_content_custom(&$title)
{
global $serendipity;
$update = true;
$rotate_time = $this->get_config('media_rotate_time');
$next_update = $this->get_config('media_next_update', '');
if (@(include_once "Cache/Lite.php")) {
$cache_obj = new Cache_Lite(array('cacheDir' => $serendipity['serendipityPath'] . 'templates_c/', 'automaticSerialization' => true));
$cache_output = $cache_obj->get('mediasidebar_cache');
} else {
$cache_output = $this->get_config('media_cache_output', '');
}
if ($rotate_time != 0) {
if ($next_update > time()) {
$update = false;
} else {
$next_update = $this->calc_update_time($rotate_time, $next_update);
$this->set_config('media_next_update', $next_update);
}
}
$title = $this->get_config('title', $this->title);
if ($update || $cache_output == '') {
$output_str = '';
if ($this->get_config('media_image_strict') == 'yes') {
$strict = true;
} else {
$strict = false;
}
if ($this->get_config('media_hotlinks_only', 'no') == 'yes') {
$dir_extension = $this->get_config('media_hotlink_base', '');
if ($dir_extension != '') {
$dir_extension = $dir_extension . '%';
}
$directory = "http://%" . $dir_extension;
$strict = false;
} else {
$directory = $this->get_config('media_base_directory');
}
if (version_compare((double) $serendipity['version'], '1.1', '>=')) {
if ($directory == 'gallery') {
$directory = '';
}
$images_all = serendipity_fetchImagesFromDatabase(0, 0, $total, false, false, $directory, '', '', array(), $strict);
} else {
$images_all = $this->mediasidebar_getimage($directory, $strict);
}
$number = $this->get_config('media_number_images');
$total_count = count($images_all);
if ($total_count < $number) {
$number = $total_count;
}
$images = array();
$random_check = array();
for ($counter = 0; $counter < $number; $counter += 1) {
$checkit = rand(0, $total_count - 1);
while (in_array($checkit, $random_check)) {
$checkit = rand(0, $total_count);
}
$random_check[] = $checkit;
$images[] = $images_all[$checkit];
}
$width_test = $this->get_config('media_fixed_width');
if ($width_test > 0) {
$width_str = 'width:' . $width_test . 'px;';
}
if (is_array($images)) {
$output_str .= $this->get_config('media_intro');
foreach ($images as $image) {
if (isset($image['name'])) {
if ($image['hotlink'] == 1) {
$thumb_path = $image_path = $image['path'];
} else {
$image_path = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $image['path'] . $image['name'] . '.' . $image['extension'];
$thumb_path = $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $image['path'] . $image['name'] . '.' . $image['thumbnail_name'] . '.' . $image['extension'];
if (!serendipity_isImage($image)) {
$thumb_path = serendipity_getTemplateFile('admin/img/mime_unknown.png');
$width_str = '';
}
}
$output_str .= '<div style="padding-top: 5px;">';
switch ($this->get_config("media_linkbehavior")) {
case 'entry':
$e = $this->fetchLinkedEntries($image['id'], $image_path, $thumb_path, true);
if (is_array($e)) {
$link = serendipity_archiveURL($e[0]['id'], $e[0]['title'], 'serendipityHTTPPath', true, array('timestamp' => $e[0]['timestamp']));
} else {
$link = $image_path;
}
$output_str .= '<a href="' . $link . '" title="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($e[0]['title']) : htmlspecialchars($e[0]['title'], ENT_COMPAT, LANG_CHARSET)) . '"><img style="border: 0px; ' . $width_str . '" src="' . $thumb_path . '" alt="" /></a>';
break;
case 'popup':
$output_str .= '<a href="' . $image_path . '" onclick="F1 = window.open(\'' . $image_path . '\',\'Zoom\',\'height=' . $image['dimensions_height'] . ',width=' . $image['dimensions_width'] . ',top=298,left=354,toolbar=no,menubar=no,location=no,resize=1,resizable=1,scrollbars=yes\'); return false;"><img style="border: 0px; ' . $width_str . '" src="' . $thumb_path . '" alt="" /></a>';
break;
case 'url':
$output_str .= '<a href="' . $this->get_config('media_url') . '"><img style="border: 0px; ' . $width_str . '" src="' . $thumb_path . '" alt="" /></a>';
break;
case 'gallery':
$gallery_str = $this->get_config('media_gal_permalink');
if (strstr($gallery_str, '?')) {
$gallery_str = $gallery_str . '&serendipity[image]=' . $image['id'];
//.........这里部分代码省略.........
示例15: metaWeblog_createPostRpcValue
/**
* This is not a XML RPC function. metaWeblog_getPost and metaWeblog_getRecentPosts produce exactly the same structure.
* @param unknown_type $entry
*/
function metaWeblog_createPostRpcValue($entry)
{
global $serendipity;
$values = array('dateCreated' => new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp'], $serendipity['XMLRPC_GMT']) . ($serendipity['XMLRPC_GMT'] ? 'Z' : ''), 'dateTime.iso8601'), 'postid' => new XML_RPC_Value($entry['id'], 'string'), 'userid' => new XML_RPC_Value($entry['authorid'], 'string'), 'description' => new XML_RPC_Value($entry['body'], 'string'), 'mt_excerpt' => new XML_RPC_Value('', 'string'), 'mt_allow_comments' => new XML_RPC_Value($entry['allow_comments'] ? 1 : 0, 'int'), 'mt_text_more' => new XML_RPC_Value($entry['extended'], 'string'), 'mt_allow_pings' => new XML_RPC_Value($entry['allow_comments'] ? 1 : 0, 'int'), 'mt_convert_breaks' => new XML_RPC_Value('', 'string'), 'mt_keywords' => new XML_RPC_Value(isset($entry['mt_keywords']) ? $entry['mt_keywords'] : '', 'string'), 'title' => new XML_RPC_Value($entry['title'], 'string'), 'permaLink' => new XML_RPC_Value(serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp'])), 'string'), 'link' => new XML_RPC_Value(serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp'])), 'string'));
// Add geo coords if given:
if (isset($entry['properties'])) {
if (isset($entry['properties']['geo_lat']) && isset($entry['properties']['geo_long'])) {
$geo_lat = new XML_RPC_Value(array('key' => new XML_RPC_Value('geo_latitude', 'string'), 'value' => new XML_RPC_Value($entry['properties']['geo_lat'], 'double')), 'struct');
$geo_long = new XML_RPC_Value(array('key' => new XML_RPC_Value('geo_longitude', 'string'), 'value' => new XML_RPC_Value($entry['properties']['geo_long'], 'double')), 'struct');
$values['custom_fields'] = new XML_RPC_Value(array($geo_lat, $geo_long), 'array');
}
}
// Add Categories. metaWeblog supports names only.
if (isset($entry['categories'])) {
$rpc_categories = array();
foreach ($entry['categories'] as $category) {
$rpc_categories[] = new XML_RPC_Value($category['category_name'], 'string');
}
$values['categories'] = new XML_RPC_Value($rpc_categories, 'array');
}
if (XMLRPC_WP_COMPATIBLE) {
$values['wp_slug'] = new XML_RPC_Value(serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', true, array('timestamp' => $entry['timestamp'])), 'string');
$values['wp_author_id'] = new XML_RPC_Value($entry['authorid'], 'string');
$values['wp_author_display_name'] = new XML_RPC_Value($entry['author'], 'string');
$values['wp_post_format'] = new XML_RPC_Value('standard', 'string');
$draft = isset($entry['isdraft']) && serendipity_db_bool($entry['isdraft']);
$values['post_status'] = new XML_RPC_Value($draft ? 'draft' : 'publish', 'string');
$values['date_created_gmt'] = new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp'], 1) . 'Z', 'dateTime.iso8601');
$modified = empty($entry['last_modified']) ? $entry['timestamp'] : $entry['last_modified'];
$values['date_modified'] = new XML_RPC_Value(XML_RPC_iso8601_encode($modified, 1) . 'Z', 'dateTime.iso8601');
$values['date_modified_gmt'] = new XML_RPC_Value(XML_RPC_iso8601_encode($modified, 1) . 'Z', 'dateTime.iso8601');
// Extended Article Properties supports passwords.
$entry_properties = serendipity_fetchEntryProperties($entry['id']);
if (is_array($entry_properties)) {
$values['wp_password'] = new XML_RPC_Value($entry_properties['ep_entrypassword'], 'string');
} else {
$values['wp_password'] = new XML_RPC_Value('', 'string');
}
}
return new XML_RPC_Value($values, 'struct');
}