本文整理汇总了PHP中serendipity_getTemplateFile函数的典型用法代码示例。如果您正苦于以下问题:PHP serendipity_getTemplateFile函数的具体用法?PHP serendipity_getTemplateFile怎么用?PHP serendipity_getTemplateFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serendipity_getTemplateFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEmoticons
function getEmoticons()
{
global $serendipity;
/* Avoid multiple runs of serendipity_getTemplateFile(),
in other words - if we already have a list of smilies, don't bother looking for another */
if (isset($this->smilies) && sizeof($this->smilies) != 0) {
return $this->smilies;
}
/* Hijack global variable $serendipity['custom_emoticons'] if it exists */
$hijack_file = serendipity_getTemplateFile('emoticons.inc.php', 'serendipityPath', true);
if (@file_exists($hijack_file)) {
@(include $hijack_file);
// This file contains $serendipity['custom_emoticons'] and maybe $serendipity['custom_emoticons_regexp']
if (isset($serendipity['custom_emoticons']) && is_array($serendipity['custom_emoticons'])) {
$this->smilies = $serendipity['custom_emoticons'];
if (is_array($this->smilies) && (!isset($serendipity['custom_emoticons_regexp']) || !$serendipity['custom_emoticons_regexp'])) {
foreach ($this->smilies as $key => $val) {
unset($this->smilies[$key]);
$this->smilies[preg_quote($key, '/')] = $val;
}
}
}
}
if (!isset($this->smilies)) {
$ext = $this->get_config('extension', 'png');
$this->smilies = array("\\:'\\(" => serendipity_getTemplateFile('img/emoticons/cry.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?\\)' => serendipity_getTemplateFile('img/emoticons/smile.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?\\|' => serendipity_getTemplateFile('img/emoticons/normal.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?O' => serendipity_getTemplateFile('img/emoticons/eek.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?\\(' => serendipity_getTemplateFile('img/emoticons/sad.' . $ext, 'serendipityHTTPPath', true), '8\\-?\\)' => serendipity_getTemplateFile('img/emoticons/cool.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?D' => serendipity_getTemplateFile('img/emoticons/laugh.' . $ext, 'serendipityHTTPPath', true), '\\:\\-?P' => serendipity_getTemplateFile('img/emoticons/tongue.' . $ext, 'serendipityHTTPPath', true), ';\\-?\\)' => serendipity_getTemplateFile('img/emoticons/wink.' . $ext, 'serendipityHTTPPath', true));
}
return $this->smilies;
}
示例2: event_hook
function event_hook($event, &$bag, &$eventData)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'css_backend':
case 'css':
?>
img {
behavior: url("<?php
echo $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '');
?>
plugin/pngbehavior.htc");
}
<?php
return true;
break;
case 'external_plugin':
switch ($eventData) {
case 'pngbehavior.htc':
header('Content-Type: text/x-component');
echo str_replace('{blanksrc}', serendipity_getTemplateFile('img/blank.gif'), file_get_contents(dirname(__FILE__) . '/pngbehavior.htc'));
return true;
}
return true;
break;
default:
return false;
break;
}
} else {
return false;
}
}
示例3: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->title;
?>
<div class="serendipityPlug">
<?php
if (serendipity_db_bool($this->get_config('image', 'true'))) {
?>
<a title="<?php
echo $title;
?>
Serendipity" href="http://www.s9y.org/"><img src="<?php
echo serendipity_getTemplateFile('img/s9y_banner_small.png');
?>
" alt="Serendipity PHP Weblog" style="border: 0px" /></a>
<?php
}
if (serendipity_db_bool($this->get_config('text', 'false'))) {
?>
<div>
<a title="<?php
echo $title;
?>
Serendipity" href="http://www.s9y.org/">Serendipity PHP Weblog</a>
</div>
<?php
}
?>
</div>
<?php
}
示例4: fetchTemplate
static function fetchTemplate($filename, $oembed, $url)
{
global $serendipity;
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}
// Declare the oembed to smarty
$serendipity['smarty']->assign('oembedurl', $url);
$serendipity['smarty']->assign('oembed', (array) $oembed);
$tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
if (!$tfile || $filename == $tfile) {
$tfile = dirname(__FILE__) . '/' . $filename;
}
$inclusion = $serendipity['smarty']->security_settings[@INCLUDE_ANY];
$serendipity['smarty']->security_settings[@INCLUDE_ANY] = true;
if (version_compare($serendipity['version'], '1.7-alpha1') >= 0) {
$serendipity['smarty']->disableSecurity();
}
/* in earlier versions this is not needed.
else {
$serendipity['smarty']->security = false;
}
*/
// be smarty 3 compat including the serendipity_smarty class wrappers ->fetch and ->display methods and remove changed parameter number 4
$content = @$serendipity['smarty']->fetch('file:' . $tfile);
//, false
$serendipity['smarty']->security_settings[@INCLUDE_ANY] = $inclusion;
return $content;
}
示例5: get_file_from_template
static function get_file_from_template($filename, $plugin_rel_url)
{
$filenamebase = basename($filename);
$tfile = serendipity_getTemplateFile($filenamebase, 'serendipityPath');
if (!$tfile || $tfile == $filenamebase) {
return $plugin_rel_url . '/' . $filename;
} else {
return $tfile;
}
}
示例6: 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;
}
示例7: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$sort = $this->get_config('sort_order');
if ($sort == 'none') {
$sort = '';
} else {
$sort .= ' ' . $this->get_config('sort_method');
}
$is_form = serendipity_db_bool($this->get_config('allow_select'));
$is_count = serendipity_db_bool($this->get_config('showartcount'));
$mincount = (int) $this->get_config('mincount');
$authors = serendipity_fetchUsers(null, 'hidden', $is_count);
$html = '';
if ($is_form) {
$html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '?frontpage" method="post">';
}
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
$image = $image == "'none'" || $image == 'none' ? '' : $image;
$html .= '<ul class="plainList">' . "\n";
if (is_array($authors) && count($authors)) {
foreach ($authors as $auth) {
if ($is_count) {
if ($auth['artcount'] < $mincount) {
continue;
}
$entrycount = " ({$auth['artcount']})";
} else {
$entrycount = "";
}
$html .= '<li>';
if ($is_form) {
$html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiAuth][]" value="' . $auth['authorid'] . '" />';
}
if (!empty($image)) {
$html .= '<a class="serendipity_xml_icon" href="' . serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') . '"><img src="' . $image . '" alt="XML" style="border: 0px" /></a> ';
}
$html .= '<a href="' . serendipity_authorURL($auth, 'serendipityHTTPPath') . '" title="' . serendipity_specialchars($auth['realname']) . '">' . serendipity_specialchars($auth['realname']) . $entrycount . '</a>';
$html .= '</li>' . "\n";
}
}
$html .= '</ul>' . "\n";
if ($is_form) {
$html .= '<div><input type="submit" name="serendipity[isMultiAuth]" value="' . GO . '" /></div>';
}
$html .= sprintf('<div><a href="%s" title="%s">%s</a></div>', $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'], ALL_AUTHORS, ALL_AUTHORS);
if ($is_form) {
$html .= '</form>';
}
print $html;
}
示例8: test_serendipity_getTemplateFile
/**
* @test
*/
public function test_serendipity_getTemplateFile()
{
global $serendipity;
$serendipity['template'] = 'next';
$serendipity['template_engine'] = '2k11';
$serendipity['defaultTemplate'] = '2k11';
$serendipity['templatePath'] = '/templates/';
$serendipity['template_backend'] = '2k11';
$serendipity['serendipityPath'] = realpath('../');
$serendipity['serendipityHTTPPath'] = realpath('/');
$this->assertContains('next/index.tpl', serendipity_getTemplateFile('index.tpl'));
define('IN_serendipity_admin', true);
$this->assertContains('2k11/admin/index.tpl', serendipity_getTemplateFile('admin/index.tpl'));
$this->assertContains('next/index.tpl', serendipity_getTemplateFile('index.tpl', 'serendipityHTTPPath', true));
}
示例9: generate_content
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
$sort = $this->get_config('sort_order');
if ($sort == 'none') {
$sort = '';
} else {
$sort .= ' ' . $this->get_config('sort_method');
}
$is_count = serendipity_db_bool($this->get_config('showartcount', 'false'));
$mincount = (int) $this->get_config('mincount');
$authors = serendipity_fetchUsers(null, 'hidden', $is_count);
$html = '';
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
$image = $image == "'none'" || $image == 'none' ? '' : $image;
$html .= '<ul class="plainList">' . "\n";
if (is_array($authors) && count($authors)) {
foreach ($authors as $auth) {
if ($is_count) {
if ($auth['artcount'] < $mincount) {
continue;
}
$entrycount = " ({$auth['artcount']})";
} else {
$entrycount = "";
}
$html .= '<li>';
if (!empty($image)) {
$html .= ' <a class="serendipity_xml_icon" href="' . serendipity_feedAuthorURL($auth, 'serendipityHTTPPath') . '"><img src="' . $image . '" alt="XML" style="border: 0px" /></a> ';
}
$html .= ' <a href="' . serendipity_authorURL($auth, 'serendipityHTTPPath') . '" title="' . serendipity_specialchars($auth['realname']) . '">' . serendipity_specialchars($auth['realname']) . $entrycount . '</a>';
$html .= '</li>' . "\n";
}
}
$html .= '</ul>' . "\n";
$html .= sprintf('<div><a href="%s" title="%s">%s</a></div>' . "\n", $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'], ALL_AUTHORS, ALL_AUTHORS);
print $html;
}
示例10: glob
case 'frontend_footer':
echo '<!--PLUGIN API-->';
}
return true;
}
if ($serendipity['GET']['adminModule'] == 'templates' || $serendipity['POST']['adminModule'] == 'templates' || $serendipity['GET']['adminAction'] == 'cattemplate') {
$css_files = glob(dirname(__FILE__) . '/*_style.css');
foreach ($css_files as $css_file) {
$css_file = str_replace('_style.css', '', basename($css_file));
if (!isset($colorsets[$css_file])) {
$colorsets[$css_file] = $css_file;
}
}
}
$template_config_groups = array(THEME_COLORSET => array('colorset', 'layouttype', 'jscolumns'), THEME_HEADER => array('custheader', 'headerimage', 'headertype'));
$template_config = array(array('var' => 'infobp', 'name' => 'infobp', 'type' => 'custom', 'custom' => USER_STYLESHEET), array('var' => 'colorset', 'name' => THEME_COLORSET, 'type' => 'select', 'default' => 'default', 'select_values' => $colorsets), array('var' => 'layouttype', 'name' => LAYOUT_TYPE, 'type' => 'select', 'default' => '3sbs', 'select_values' => array('3sbs' => LAYOUT_SBS, '3bss' => LAYOUT_BSS, '3ssb' => LAYOUT_SSB, '2sb' => LAYOUT_SB, '2bs' => LAYOUT_BS, '1col' => LAYOUT_SC, '2sbf' => LAYOUT_SBF, '2bsf' => LAYOUT_BSF)), array('var' => 'jscolumns', 'name' => JAVASCRIPT_COLUMNS, 'type' => 'boolean', 'default' => 'false'), array('var' => 'custheader', 'name' => BP_CUSTOM_HEADER, 'type' => 'boolean', 'default' => 'false'), array('var' => 'headerimage', 'name' => BP_HEADER_IMAGE, 'type' => 'media', 'default' => serendipity_getTemplateFile('header.png')), array('var' => 'headertype', 'name' => BP_HEADER_TYPE, 'type' => 'select', 'default' => 'banner', 'select_values' => array('banner' => BP_HEADER_BANNER, 'htiled' => BP_HEADER_HTILED, 'vtiled' => BP_HEADER_VTILED, 'btiled' => BP_HEADER_BTILED)), array('var' => 'headerposhor', 'name' => BP_HEADER_POSHOR, 'type' => 'select', 'default' => 'left', 'select_values' => array('left' => LEFT, 'center' => BP_CENTER, 'right' => RIGHT)), array('var' => 'headerposver', 'name' => BP_HEADER_POSVER, 'type' => 'select', 'default' => 'top', 'select_values' => array('top' => BP_TOP, 'center' => BP_CENTER, 'bottom' => BP_BOTTOM)), array('var' => 'firbtitle', 'name' => FIR_BTITLE, 'type' => 'boolean', 'default' => 'true'), array('var' => 'firbdescr', 'name' => FIR_BDESCR, 'type' => 'boolean', 'default' => 'true'), array('var' => 'date_format', 'name' => GENERAL_PLUGIN_DATEFORMAT . " (http://php.net/strftime)", 'type' => 'select', 'default' => DATE_FORMAT_ENTRY, 'select_values' => array(DATE_FORMAT_ENTRY => DATE_FORMAT_ENTRY, '%a, %e. %B %Y' => '%a, %e. %B %Y', '%d-%m-%y' => '%d-%m-%y', '%m-%d-%y' => '%m-%d-%y', '%a %d-%m-%y' => '%a %d-%m-%y', '%a %m-%d-%y' => '%a %m-%d-%y', '%b %d' => '%b %d', "%b %d '%y" => "%b %d '%y")), array('var' => 'entryfooterpos', 'name' => ENTRY_FOOTER_POS, 'type' => 'select', 'default' => 'belowentry', 'select_values' => array('belowentry' => BELOW_ENTRY, 'belowtitle' => BELOW_TITLE, 'splitfoot' => SPLIT_FOOTER)), array('var' => 'footerauthor', 'name' => FOOTER_AUTHOR, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footercategories', 'name' => FOOTER_CATEGORIES, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footertimestamp', 'name' => FOOTER_TIMESTAMP, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footercomments', 'name' => FOOTER_COMMENTS, 'type' => 'boolean', 'default' => 'true'), array('var' => 'footertrackbacks', 'name' => FOOTER_TRACKBACKS, 'type' => 'boolean', 'default' => 'true'), array('var' => 'altcommtrack', 'name' => ALT_COMMTRACK, 'type' => 'boolean', 'default' => 'false'), array('var' => 'addthiswidget', 'name' => SHOW_ADDTHIS_WIDGET, 'type' => 'boolean', 'default' => 'false'), array('var' => 'addthisaccount', 'name' => ADDTHIS_ACCOUNT, 'type' => 'string', 'default' => ''), array('var' => 'show_sticky_entry_footer', 'name' => SHOW_STICKY_ENTRY_FOOTER, 'type' => 'boolean', 'default' => 'true'), array('var' => 'show_sticky_entry_heading', 'name' => SHOW_STICKY_ENTRY_HEADING, 'type' => 'boolean', 'default' => 'true'), array('var' => 'cocommentactive', 'name' => COCOMMENT_ACTIVE, 'type' => 'boolean', 'default' => 'false'), array('var' => 'prev_next_style', 'name' => PREV_NEXT_STYLE, 'type' => 'select', 'default' => 'text', 'select_values' => array('text' => PREV_NEXT_TEXT, 'texticon' => PREV_NEXT_TEXT_ICON, 'icon' => PREV_NEXT_ICON, 'none' => NONE)), array('var' => 'show_pagination', 'name' => SHOW_PAGINATION, 'type' => 'boolean', 'default' => 'false'), array('var' => 'counter_code', 'name' => COUNTER_CODE, 'type' => 'text', 'default' => ''), array('var' => 'counter_code_toggle', 'name' => USE_COUNTER, 'type' => 'boolean', 'default' => 'false'), array('var' => 'footer_text', 'name' => FOOTER_TEXT, 'type' => 'text', 'default' => ''), array('var' => 'footer_text_toggle', 'name' => USE_FOOTER_TEXT, 'type' => 'boolean', 'default' => 'false'), array('var' => 'sitenavpos', 'name' => SITENAV_POSITION, 'type' => 'select', 'default' => 'none', 'select_values' => array('none' => SITENAV_NONE, 'above' => SITENAV_ABOVE, 'below' => SITENAV_BELOW, 'left' => SITENAV_LEFT, 'right' => SITENAV_RIGHT)), array('var' => 'sitenav_footer', 'name' => SITENAV_FOOTER, 'type' => 'boolean', 'default' => 'true'), array('var' => 'sitenav_quicksearch', 'name' => SITENAV_QUICKSEARCH, 'type' => 'boolean', 'default' => 'true'), array('var' => 'sitenav_sidebar_title', 'name' => SITENAV_TITLE, 'type' => 'string', 'default' => SITENAV_TITLE_TEXT));
$template_global_config = array('navigation' => true);
$template_loaded_config = serendipity_loadThemeOptions($template_config, $serendipity['smarty_vars']['template_option']);
serendipity_loadGlobalThemeOptions($template_config, $template_loaded_config, $template_global_config);
if ($template_loaded_config['headerimage'] != '' && is_dir($_SERVER['DOCUMENT_ROOT'] . '/' . $template_loaded_config['headerimage'])) {
$files = array();
if ($d = opendir($_SERVER['DOCUMENT_ROOT'] . '/' . $template_loaded_config['headerimage'])) {
while (($file = readdir($d)) !== false) {
if (preg_match('@(\\.jpe?g|\\.png|\\.gif)$@i', $file) && !preg_match('@' . preg_quote($serendipity['thumbSuffix']) . '@i', $file)) {
$files[] = $file;
}
}
}
if (count($files) > 0) {
shuffle($files);
$serendipity['smarty']->assign('random_headerimage', $template_loaded_config['headerimage'] . '/' . $files[0]);
示例11: show_plugins
<?php
serendipity_plugin_api::hook_event('backend_plugins_sidebar_header', $serendipity);
?>
<?php
show_plugins(false, $sidebars);
?>
<br />
<br />
<h3><?php
echo EVENT_PLUGINS;
?>
</h3>
<a href="?serendipity[adminModule]=plugins&serendipity[adminAction]=addnew&serendipity[type]=event" class="serendipityIconLink"><img src="<?php
echo serendipity_getTemplateFile('admin/img/install.png');
?>
" style="border: 0px none ; vertical-align: middle; display: inline;" alt="" /><?php
echo sprintf(CLICK_HERE_TO_INSTALL_PLUGIN, EVENT_PLUGIN);
?>
</a>
<?php
serendipity_plugin_api::hook_event('backend_plugins_event_header', $serendipity);
?>
<?php
show_plugins(true);
?>
<?php
if (count($serendipity['memSnaps']) > 0) {
?>
示例12: elseif
}
if ($ajax) {
// if that is an ajax request we can stop here, since we by convention don't want to wrap the content in the usual backend code
echo $main_content;
} elseif (!$use_installer) {
$poll_admin_vars = array('main_content', 'no_banner', 'no_sidebar', 'no_footer', 'post_action', 'is_logged_in', 'admin_installed', 'self_info', 'use_installer', 'title');
$admin_vars = array();
foreach ($poll_admin_vars as $poll_admin_var) {
$admin_vars[$poll_admin_var] =& ${$poll_admin_var};
}
$admin_vars['out'] = array();
$admin_vars['no_create'] = $serendipity['no_create'];
$admin_vars['title'] = $admin_section;
if ($serendipity['expose_s9y']) {
$admin_vars['version_info'] = sprintf(ADMIN_FOOTER_POWERED_BY, $serendipity['versionInstalled'], phpversion());
} else {
$admin_vars['version_info'] = sprintf(ADMIN_FOOTER_POWERED_BY, '', '');
}
if (!is_object($serendipity['smarty'])) {
serendipity_smarty_init();
}
$serendipity['smarty']->assignByRef('admin_vars', $admin_vars);
$serendipity['smarty']->display(serendipity_getTemplateFile('admin/index.tpl', 'serendipityPath'));
} else {
if (IS_installed === false) {
$file = 'include/admin/installer.inc.php';
} elseif (IS_up2date === false) {
$file = 'include/admin/upgrader.inc.php';
}
require S9Y_INCLUDE_PATH . $file;
}
示例13: serendipity_set_config_var
serendipity_set_config_var($item['var'], $_POST[$item['var']], $serendipity['authorid']);
}
}
$pl_data = array('id' => $serendipity['POST']['authorid'], 'authorid' => $serendipity['POST']['authorid'], 'username' => $_POST['username'], 'realname' => $_POST['realname'], 'email' => $_POST['email']);
serendipity_updatePermalink($pl_data, 'author');
serendipity_plugin_api::hook_event('backend_users_edit', $pl_data);
}
if ($serendipity['authorid'] === $_SESSION['serendipityAuthorid']) {
if (is_null($serendipity['detected_lang'])) {
$_SESSION['serendipityLanguage'] = $serendipity['lang'];
}
}
$from = $_POST;
?>
<div class="serendipityAdminMsgSuccess"><img width="22px" height="22px" style="border: 0px; padding-right: 4px; vertical-align: middle" src="<?php
echo serendipity_getTemplateFile('admin/img/admin_msg_success.png');
?>
" alt="" /><?php
echo sprintf(MODIFIED_USER, htmlspecialchars($_POST['realname']));
?>
</div>
<?php
}
}
?>
<form action="?serendipity[adminModule]=personal&serendipity[adminAction]=save" method="post">
<?php
echo serendipity_setFormToken();
$template = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE);
$user = serendipity_fetchUsers($serendipity['authorid']);
示例14: event_hook
function event_hook($event, &$bag, &$eventData, $addlData)
{
global $serendipity;
$hooks =& $bag->get('event_hooks');
if (isset($hooks[$event])) {
switch ($event) {
case 'backend_header':
// Output the JavaScript, if we must
$getModule = $serendipity['GET']['adminModule'];
$postModule = $serendipity['POST']['adminModule'];
if ($getModule == 'templates' || $postModule == 'templates' || $getModule == 'plugins' || $postModule == 'plugins') {
// Includes copied from include/admin/plugins.inc.php
echo '<script src="' . serendipity_getTemplateFile('dragdrop.js') . '" type="text/javascript"></script>';
//echo '<div class="warning js_warning"><em>' . PREFERENCE_USE_JS_WARNING . '</em></div>';
$media_js = serendipity_getTemplateFile('media_input.js');
if ($serendipity['version'][0] < 2) {
print <<<EOS
<script type="text/javascript" language="JavaScript" src="serendipity_editor.js"></script>
EOS;
}
print <<<EOS
<script type="text/javascript">
function change_preview(id)
{
var text_box = document.getElementById("serendipity[template][" + id + "]");
var image_box = document.getElementById(id + "_preview");
var filename = text_box.value;
image_box.style.backgroundImage = "url(" + filename + ")";
}
function choose_media(id)
{
window.open('serendipity_admin_image_selector.php?serendipity[htmltarget]=' + id + '&serendipity[filename_only]=true', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
}
</script>
EOS;
}
break;
case 'backend_pluginconfig_media':
// Print the HTML to display the popup media selector
$postKey = $eventData['postKey'];
$var = $eventData['config_item'];
$savedValue = $eventData['value'];
$cbag = $eventData['cbag'];
$cname = $cbag->get('name');
$cdesc = $cbag->get('description');
$preview_width = $cbag->get('preview_width');
if (!$preview_width || $preview_width == "") {
$preview_width = '400px';
}
$preview_height = $cbag->get('preview_height');
if (!$preview_height || $preview_height == "") {
$preview_height = '100px';
}
$media_link_text = MEDIA_LIBRARY;
print <<<EOS
<tr><td colspan="2">
<strong>{$cname}</strong>
<br /><span style="color: #5E7A94; font-size: 8pt;">{$cdesc}</span>
</td> </tr>
<tr>
<td style="border-bottom: 1px solid #000000">
<!-- <img id="{$var}_preview" src="{$savedValue}"> -->
<div id="{$var}_preview" style="background-image: url({$savedValue}); width:{$preview_width}; height: {$preview_height};"> </div>
</td>
<td style="border-bottom: 1px solid #000000">
<input class="input_textbox" type="text" id="serendipity[{$postKey}][{$var}]" name="serendipity[{$postKey}][{$var}]" value="{$savedValue}" onchange="change_preview('{$var}')"/>
<br /><a href="#" onclick="choose_media('serendipity[{$postKey}][{$var}]')">{$media_link_text}</a>
</td>
</tr>
EOS;
return true;
break;
case 'backend_pluginconfig_sequence':
//
// Print the HTML to display the [drag-n-drop] orderable list
//
// For the drag-n-drop to work, the list must be included in
// a container (probably an <ol>) that JavaScript can access
// (easiest by ID), with <li> children that have unique IDs,
// and handles with ids of 'g'.$li_id.
// I can't get it to work unless there's a class of
// pluginmanager_container on the ol, either.
// The drag-n-drop returns the list of IDs in order.
//
// I want this generic sequence widget to hide the ID, but
// display a name or description with an optional picture.
// (This would allow users to identify choices by thumbnail.)
// Therefore, I need an array with keys 'id', 'display', and
// 'imgurl' (or similar) to generate each list item.
// Data sent by include/functions_plugins_admin.inc.php
// It also passes bag and plugin, but we don't need those
$postKey = $eventData['postKey'];
$var = $eventData['config_item'];
$savedValue = $eventData['value'];
$cbag = $eventData['cbag'];
// Get the data we need to display the list
if (!$savedValue) {
$savedValue = $eventData['default'];
}
//.........这里部分代码省略.........
示例15: array
$permalinkOld = array($oldConfig['serendipityHTTPPath'], $oldConfig['serendipityPath'], $oldConfig['baseURL'], $oldConfig['indexFile'], $oldConfig['rewrite']);
$permalinkNew = array($serendipity['serendipityHTTPPath'], $serendipity['serendipityPath'], $serendipity['baseURL'], $serendipity['indexFile'], $serendipity['rewrite']);
// Compare all old permalink section values against new one. A change in any of those
// will force to update the .htaccess for rewrite rules.
$permconf = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE);
if (is_array($permconf) && is_array($permconf['permalinks']['items'])) {
foreach ($permconf['permalinks']['items'] as $permitem) {
$permalinkOld[] = $oldConfig[$permitem['var']];
$permalinkNew[] = $serendipity[$permitem['var']];
}
}
if (serendipity_checkPermission('siteConfiguration') && serialize($permalinkOld) != serialize($permalinkNew)) {
printf(ATTEMPT_WRITE_FILE, $serendipity['serendipityPath'] . '.htaccess');
$res = serendipity_installFiles($serendipity['serendipityPath']);
if (is_array($res)) {
echo implode('<br />', $res);
} else {
echo DONE . '<br />';
}
serendipity_buildPermalinks();
}
echo '<br /><div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . WRITTEN_N_SAVED . '</div>';
}
break;
default:
$from =& $serendipity;
$t = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE);
serendipity_printConfigTemplate($t, $from, false, true);
break;
}
/* vim: set sts=4 ts=4 expandtab : */