本文整理汇总了PHP中smarty_block_self_link函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_block_self_link函数的具体用法?PHP smarty_block_self_link怎么用?PHP smarty_block_self_link使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_block_self_link函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_block_add_help
function smarty_block_add_help($params, $content, $smarty, &$repeat)
{
global $prefs;
global $help_sections;
if (!isset($content)) {
return;
}
if ($prefs['javascript_enabled'] != 'y') {
return $content;
}
if (isset($params['title'])) {
$section['title'] = $params['title'];
}
if (isset($params['id'])) {
$section['id'] = $params['id'];
} else {
$section['id'] = $params['id'] = 'help_section_' . count($help_sections);
}
$section['content'] = $content;
$help_sections[$params['id']] = $section;
if (!isset($params['show']) or $params['show'] == 'y') {
global $headerlib;
$smarty->loadPlugin('smarty_block_self_link');
$self_link_params['_alt'] = tra('Click for Help');
$self_link_params['_icon'] = 'help';
$self_link_params['_ajax'] = 'n';
$title = tra('Help');
$headerlib->add_js('
var openEditHelp = function() {
var opts, edithelp_pos = getCookie("edithelp_position");
opts = { width: 460, height: 500, title: "' . $title . '", autoOpen: false, beforeclose: function(event, ui) {
var off = $(this).offsetParent().offset();
setCookie("edithelp_position", parseInt(off.left,10) + "," + parseInt(off.top,10) + "," + $(this).offsetParent().width() + "," + $(this).offsetParent().height());
}};
if (edithelp_pos) {edithelp_pos = edithelp_pos.split(",");}
if (edithelp_pos && edithelp_pos.length) {
opts["position"] = [parseInt(edithelp_pos[0],10), parseInt(edithelp_pos[1],10)];
opts["width"] = parseInt(edithelp_pos[2],10);
opts["height"] = parseInt(edithelp_pos[3],10);
}
try {
if ($("#help_sections").dialog) {
$("#help_sections").dialog("destroy");
}
} catch( e ) {
// IE throws errors destroying a non-existant dialog
}
$("#help_sections").dialog(opts).dialog("open");
};');
$self_link_params['_onclick'] = 'openEditHelp();return false;';
return smarty_block_self_link($self_link_params, "", $smarty);
} else {
return;
}
}
示例2: renderInnerOutput
function renderInnerOutput($context = array())
{
$att_id = $this->getValue();
if (empty($att_id)) {
return '';
}
if ($context['list_mode'] === 'csv') {
global $base_url;
return $base_url . 'tiki-download_item_attachment.php?attId=' . $att_id;
// should something to do with export_attachment() happen here?
}
$attachment = TikiLib::lib('trk')->get_item_attachment($att_id);
$smarty = TikiLib::lib('smarty');
$smarty->loadPlugin('smarty_block_self_link');
$smarty->loadPlugin('smarty_function_icon');
$link = smarty_block_self_link(array('_script' => 'tiki-download_item_attachment.php', 'attId' => $att_id), smarty_function_icon(array('_id' => 'disk', 'alt' => tra('Download')), $smarty) . ' ' . $attachment['filename'], $smarty);
return $link;
}
示例3: smarty_function_interactivetranslation
function smarty_function_interactivetranslation($params, $smarty)
{
global $headerlib, $smarty;
$strings = get_collected_strings();
if (count($strings) == 0) {
return;
}
usort($strings, 'sort_strings_by_length');
$strings = json_encode($strings);
// add wrench icon link
$smarty->loadPlugin('smarty_block_self_link');
$help .= smarty_block_self_link(array('_icon' => 'wrench', '_script' => 'tiki-edit_languages.php', '_title' => tra('Click here to go to Edit Languages')), '', $smarty);
$jq = <<<JS
\tvar data = {$strings};
JS;
$headerlib->add_jq_onready($jq);
$headerlib->add_jq_onready(file_get_contents('lib/language/js/interactive_translation.js'));
return $smarty->fetch('interactive_translation_box.tpl');
}
示例4: smarty_block_add_help
function smarty_block_add_help($params, $content, $smarty, &$repeat)
{
global $prefs;
global $help_sections;
if (!isset($content)) {
return;
}
if ($prefs['javascript_enabled'] != 'y') {
return $content;
}
if (isset($params['title'])) {
$section['title'] = $params['title'];
}
if (isset($params['id'])) {
$section['id'] = $params['id'];
} else {
$section['id'] = $params['id'] = 'help_section_' . count($help_sections);
}
$section['content'] = $content;
$help_sections[$params['id']] = $section;
if (!isset($params['show']) or $params['show'] == 'y') {
$smarty->loadPlugin('smarty_block_self_link');
$smarty->loadPlugin('smarty_function_icon');
$self_link_params['_alt'] = tra('Click for Help');
$self_link_params['_ajax'] = 'n';
$self_link_params['_anchor'] = $section['id'];
$self_link_params['_title'] = $section['title'];
$self_link_params['_class'] = 'help';
$self_link_params['_onclick'] = '$.openEditHelp(' . (count($help_sections) - 1) . ');return false;';
$link = '';
if (empty($params['icononly']) || $params['icononly'] === 'n') {
$link = $section['title'] . ' ';
}
$link .= smarty_function_icon(array('_id' => 'help'), $smarty);
return smarty_block_self_link($self_link_params, $link, $smarty);
} else {
return;
}
}
示例5: smarty_function_button
function smarty_function_button($params, $smarty)
{
if (!is_array($params) || !isset($params['_text'])) {
return;
}
global $tikilib, $prefs, $auto_query_args;
$class = null;
$smarty->loadPlugin('smarty_block_self_link');
$selected = false;
if (!empty($params['_selected'])) {
// Filter the condition
if (preg_match('/[a-zA-Z0-9 =<>!]+/', $params['_selected'])) {
$error_report = error_reporting(~E_ALL);
$return = eval('$selected =' . $params['_selected'] . ";");
error_reporting($error_report);
if ($return !== FALSE) {
if ($selected) {
if (!empty($params['_selected_class'])) {
$params['_class'] = $params['_selected_class'];
} else {
$params['_class'] = 'selected';
}
if (!empty($params['_selected_text'])) {
$params['_text'] = $params['_selected_text'];
}
if (!empty($params['_selected_title'])) {
$params['_title'] = $params['_selected_title'];
}
if (!empty($params['_selected_icon'])) {
$params['_icon'] = $params['_selected_icon'];
}
if (!empty($params['_selected_icon_name'])) {
$params['_icon_name'] = $params['_selected_icon_name'];
}
}
}
}
}
$disabled = false;
if (!empty($params['_disabled'])) {
// Filter the condition
if (preg_match('/[a-zA-Z0-9 =<>!]+/', $params['_disabled'])) {
$error_report = error_reporting(~E_ALL);
$return = eval('$disabled =' . $params['_disabled'] . ";");
error_reporting($error_report);
if ($return !== FALSE) {
if ($disabled) {
if (!empty($params['_disabled_class'])) {
$params['_class'] = $params['_disabled_class'];
} else {
$params['_class'] = 'disabled';
}
if (!empty($params['_disabled_text'])) {
$params['_text'] = $params['_disabled_text'];
}
if (!empty($params['_disabled_title'])) {
$params['_title'] = $params['_disabled_title'];
}
if (!empty($params['_disabled_icon'])) {
$params['_icon'] = $params['_disabled_icon'];
}
if (!empty($params['_disabled_icon_name'])) {
$params['_icon_name'] = $params['_disabled_icon_name'];
}
}
}
}
unset($params['_disabled']);
}
//apply class only to the button
if (!empty($params['_class'])) {
$class = $params['_class'];
}
if (!empty($params['_id'])) {
$id = ' id="' . $params['_id'] . '"';
} else {
$id = '';
}
unset($params['_class']);
if (!$disabled) {
$flip_id = '';
if (!empty($params['_flip_id'])) {
$params['_onclick'] = "javascript:flip('" . $params['_flip_id'] . "');flip('" . $params['_flip_id'] . "_close','inline');return false;";
if (!empty($params['_escape']) && $params['_escape'] === 'y') {
$params['_onclick'] = addslashes($params['_onclick']);
}
if (!isset($params['_flip_hide_text']) || $params['_flip_hide_text'] != 'n') {
$cookie_key = 'show_' . $params['_flip_id'];
$params['_text'] .= '<span id="' . $params['_flip_id'] . '_close" style="display:' . (isset($_SESSION['tiki_cookie_jar'][$cookie_key]) && $_SESSION['tiki_cookie_jar'][$cookie_key] == 'y' || isset($params['_flip_default_open']) && $params['_flip_default_open'] == 'y' ? 'inline' : 'none') . ';"> (' . tra('Hide') . ')</span>';
}
}
$auto_query_args_orig = $auto_query_args;
if (!empty($params['_auto_args'])) {
if ($params['_auto_args'] != '*') {
if (!isset($auto_query_args)) {
$auto_query_args = null;
}
$auto_query_args = explode(',', $params['_auto_args']);
}
} else {
//.........这里部分代码省略.........
示例6: header
header("Location: {$fromUrl}");
exit;
}
}
}
// remove image from an image field
if (isset($_REQUEST["removeImage"])) {
$img_field = array('data' => array());
$img_field['data'][] = array('fieldId' => $_REQUEST["fieldId"], 'type' => 'i', 'name' => $_REQUEST["fieldName"], 'value' => 'blank');
$trklib->replace_item($_REQUEST["trackerId"], $_REQUEST["itemId"], $img_field);
$_REQUEST['show'] = "mod";
}
// ************* return to list ***************************
if (isset($_REQUEST["returntracker"]) || isset($_REQUEST["save_return"])) {
require_once 'lib/smarty_tiki/block.self_link.php';
header('Location: ' . smarty_block_self_link(array('_script' => 'tiki-view_tracker.php', '_tag' => 'n', '_urlencode' => 'n', 'itemId' => 'NULL', 'trackerId' => $_REQUEST['trackerId']), '', $smarty));
die;
}
// ********************************************************
if (isset($tracker_info['useRatings']) and $tracker_info['useRatings'] == 'y' and $tiki_p_tracker_vote_ratings == 'y') {
if ($user and $tiki_p_tracker_vote_ratings == 'y' and isset($rateFieldId) and isset($_REQUEST['ins_' . $rateFieldId])) {
$trklib->replace_rating($_REQUEST['trackerId'], $_REQUEST['itemId'], $rateFieldId, $user, $_REQUEST['ins_' . $rateFieldId]);
header('Location: tiki-view_tracker_item.php?trackerId=' . $_REQUEST['trackerId'] . '&itemId=' . $_REQUEST['itemId']);
die;
}
}
if ($_REQUEST["itemId"]) {
$info = $trklib->get_tracker_item($_REQUEST["itemId"]);
$itemObject = Tracker_Item::fromInfo($info);
if (!isset($info['trackerId'])) {
$info['trackerId'] = $_REQUEST['trackerId'];
示例7: smarty_block_textarea
function smarty_block_textarea($params, $content, $smarty, $repeat)
{
static $included = false;
global $prefs, $headerlib, $smarty, $is_html;
if ($repeat) {
return;
}
if (!$included) {
$headerlib->add_js(<<<JS
function GetCurrentEditorAreaId(ob){
var p;
p=ob.parentNode;
while(p.className != "edit-zone"){p=p.parentNode;}
areaid=p.id.substring(10);
//alert ("areaid="+areaid);
return areaid;
}
JS
);
}
// some defaults
$params['_toolbars'] = isset($params['_toolbars']) ? $params['_toolbars'] : 'y';
if ($prefs['mobile_feature'] === 'y' && $prefs['mobile_mode'] === 'y') {
$params['_toolbars'] = 'n';
}
if ($prefs['javascript_enabled'] != 'y') {
$params['_toolbars'] = 'n';
}
$params['_simple'] = isset($params['_simple']) ? $params['_simple'] : 'n';
if (!isset($params['_wysiwyg'])) {
if ($params['_simple'] === 'n') {
// should not be set usually(?)
include_once 'lib/setup/editmode.php';
$params['_wysiwyg'] = $_SESSION['wysiwyg'];
} else {
$params['_wysiwyg'] = 'n';
}
}
if ($is_html === null) {
// sometimes $is_html has not been set, so take an educated guess
if ($params['_wysiwyg'] === 'y' && $prefs['wysiwyg_htmltowiki'] !== 'y') {
$is_html = true;
}
}
$params['_is_html'] = isset($params['_is_html']) ? $params['_is_html'] : $is_html;
$params['name'] = isset($params['name']) ? $params['name'] : 'edit';
$params['id'] = isset($params['id']) ? $params['id'] : 'editwiki';
$params['area_id'] = isset($params['area_id']) ? $params['area_id'] : $params['id'];
// legacy param for toolbars?
$params['class'] = isset($params['class']) ? $params['class'] : 'wikiedit';
$params['comments'] = isset($params['comments']) ? $params['comments'] : 'n';
$params['autosave'] = isset($params['autosave']) ? $params['autosave'] : 'y';
//codemirror integration
if ($prefs['feature_syntax_highlighter'] === 'y') {
$params['data-codemirror'] = isset($params['codemirror']) ? $params['codemirror'] : '';
$params['data-syntax'] = isset($params['syntax']) ? $params['syntax'] : '';
}
//keep params html5 friendly
unset($params['codemirror']);
unset($params['syntax']);
// mainly for modules admin - preview is for the module, not the custom module so don;t need to confirmExit
$params['_previewConfirmExit'] = isset($params['_previewConfirmExit']) ? $params['_previewConfirmExit'] : 'y';
if (!isset($params['section'])) {
global $section;
$params['section'] = $section ? $section : 'wiki page';
}
if (!isset($params['style']) && !isset($params['cols'])) {
$params['style'] = 'width:99%';
}
$html = '';
if (!$included) {
$html .= '<input type="hidden" name="mode_wysiwyg" value="" /><input type="hidden" name="mode_normal" value="" />';
}
$auto_save_referrer = '';
$auto_save_warning = '';
$as_id = $params['id'];
$smarty->loadPlugin('smarty_block_remarksbox');
$tmp_var = $smarty->getTemplateVars('page');
$editWarning = $prefs['wiki_timeout_warning'] === 'y' && isset($tmp_var) && $tmp_var !== 'sandbox';
if ($params['_simple'] === 'n' && $editWarning) {
$remrepeat = false;
$html .= smarty_block_remarksbox(array('type' => 'tip', 'title' => tra('Tip')), tra('This edit session will expire in') . ' <span id="edittimeout">' . ini_get('session.gc_maxlifetime') / 60 . '</span> ' . tra('minutes') . '. ' . tra('<strong>Preview</strong> (if available) or <strong>Save</strong> your work to restart the edit session timer'), $smarty, $remrepeat) . "\n";
if ($prefs['javascript_enabled'] === 'y') {
$html = str_replace('<div class="clearfix rbox tip">', '<div class="clearfix rbox tip" style="display:none;">', $html);
// quickfix to stop this box appearing before doc.ready
}
}
$smarty->assign('comments', $params['comments']);
// 3 probably removable assigns
$smarty->assign('switcheditor', isset($params['switcheditor']) ? $params['switcheditor'] : 'n');
$smarty->assign('toolbar_section', $params['section']);
if ($prefs['feature_ajax'] == 'y' && $prefs['ajax_autosave'] == 'y' && $params['_simple'] == 'n' && $params['autosave'] == 'y') {
// retrieve autosaved content
require_once "lib/ajax/autosave.php";
$smarty->loadPlugin('smarty_block_self_link');
$auto_save_referrer = ensureReferrer();
if (empty($_REQUEST['autosave'])) {
$_REQUEST['autosave'] = 'n';
}
if (has_autosave($as_id, $auto_save_referrer)) {
//.........这里部分代码省略.........
示例8: getTreeHTML
function getTreeHTML($galleryIdentifier = NULL)
{
global $prefs, $smarty;
require_once 'lib/tree/BrowseTreeMaker.php';
$galleryIdentifier = is_null($galleryIdentifier) ? $prefs['fgal_root_id'] : $galleryIdentifier;
$subGalleries = $this->getSubGalleries($galleryIdentifier);
$smarty->loadPlugin('smarty_function_icon');
$icon = ' ' . smarty_function_icon(array('_id' => 'folder'), $smarty) . ' ';
$smarty->loadPlugin('smarty_block_self_link');
$linkParameters = array('_script' => 'tiki-list_file_gallery.php', '_class' => 'fgalname');
if (!empty($_REQUEST['filegals_manager'])) {
$linkParameters['filegals_manager'] = $_REQUEST['filegals_manager'];
}
$nodes = array();
foreach ($subGalleries['data'] as $subGallery) {
$linkParameters['galleryId'] = $subGallery['id'];
$nodes[] = array('id' => $subGallery['id'], 'parent' => $subGallery['parentId'], 'data' => smarty_block_self_link($linkParameters, $icon . htmlspecialchars($subGallery['name']), $smarty));
}
$browseTreeMaker = new BrowseTreeMaker('Galleries');
return $browseTreeMaker->make_tree($this->getGallerySpecialRoot($galleryIdentifier), $nodes);
}
示例9: wikiplugin_snarf
function wikiplugin_snarf($data, $params)
{
global $prefs;
static $url = '';
static $snarf;
static $isFresh = true;
static $iSnarf = 0;
++$iSnarf;
if (empty($params['url'])) {
return '';
}
$smarty = TikiLib::lib('smarty');
$tikilib = TikiLib::lib('tiki');
if (!empty($params['ajax'])) {
$params['iSnarf'] = $iSnarf;
$params['href'] = '';
$params['link'] = '-';
foreach ($params as $key => $value) {
if ($key == 'ajax' || $key == 'href') {
continue;
}
if (!empty($params['href'])) {
$params['href'] .= '&';
}
$params['href'] .= $key . '=' . urlencode($value);
}
$smarty->assign('snarfParams', $params);
return $smarty->fetch('wiki-plugins/wikiplugin_snarf.tpl');
}
if ($url != $params['url']) {
// already fetch in the page
if (isset($_REQUEST['snarf_refresh']) && $_REQUEST['snarf_refresh'] == $params['url']) {
$cachetime = 0;
unset($_REQUEST['snarf_refresh']);
} elseif (isset($params['cache']) && $params['cache'] >= 0) {
$cachetime = $params['cache'] * 60;
} else {
$cachetime = $prefs['wikiplugin_snarf_cache'];
}
$info = $tikilib->get_cached_url($params['url'], $isFresh, $cachetime);
$snarf = $info['data'];
$url = $params['url'];
}
// If content is HTML, keep only the content of the body
if (isset($params['ishtml']) && $params['ishtml'] == 1) {
// Not using preg_replace due to its limitations to 100.000 characters
$snarf = preg_replace('/^.*<\\s*body[^>]*>/i', '', $snarf);
$snarf = preg_replace('/<\\s*\\/body[^>]*>.*$/i', '', $snarf);
}
// If the user specified a more specialized regex
if (isset($params['regex']) && isset($params['regexres'])) {
// fixes http://dev.tiki.org/item4059
$params['regex'] = str_replace("", "", $params['regex']);
if (preg_match('/^(.)(.)+\\1[^e]*$/', $params['regex'])) {
$snarf = preg_replace($params['regex'], $params['regexres'], $snarf);
}
}
if ($data == '') {
$data = NULL;
}
$code_defaults = array('caption' => $data, 'wrap' => '1', 'colors' => NULL, 'wiki' => '0', 'ln' => NULL, 'rtl' => NULL, 'ishtml' => NULL);
foreach ($code_defaults as $k => $v) {
if (isset($params[$k])) {
$code_defaults[$k] = $params[$k];
}
if ($code_defaults[$k] === NULL) {
unset($code_defaults[$k]);
}
}
include_once 'lib/wiki-plugins/wikiplugin_code.php';
$ret = wikiplugin_code($snarf, $code_defaults);
if (!$isFresh && empty($params['link'])) {
include_once 'lib/smarty_tiki/block.self_link.php';
$icon = '<div style="text-align:right">' . smarty_block_self_link(array('_icon' => 'arrow_refresh', 'snarf_refresh' => $params['url']), '', $smarty) . '</div>';
$ret = $icon . $ret;
}
return $ret;
}
示例10: getSelfLink
function getSelfLink($click, $title, $class)
{
// {{{
global $prefs;
$smarty = TikiLib::lib('smarty');
$params = array();
$params['_onclick'] = $click . (substr($click, strlen($click) - 1) != ';' ? ';' : '') . 'return false;';
$params['_class'] = 'toolbar btn btn-xs btn-link tips' . (!empty($class) ? ' ' . $class : '');
$params['_ajax'] = 'n';
$content = $title;
if ($this->iconname) {
$params['_icon_name'] = $this->iconname;
$colon = $prefs['javascript_enabled'] === 'y' ? ':' : '';
$params['_title'] = $colon . $title;
} else {
$params['_icon'] = $this->icon;
}
if (strpos($class, 'qt-plugin') !== false && ($this->iconname == 'plugin' || $this->icon == 'img/icons/plugin.png')) {
$params['_menu_text'] = 'y';
$params['_menu_icon'] = 'y';
}
return smarty_block_self_link($params, $content, $smarty);
}
示例11: getWikiHtml
function getWikiHtml( $areaId, $comments='' ) // {{{
{
global $tiki_p_admin, $tiki_p_admin_toolbars, $smarty, $section, $prefs, $headerlib;
$html = '';
// $.selection() is in jquery.autocomplete.min.js
if ($prefs['feature_jquery_autocomplete'] != 'y') {
$headerlib->add_jsfile('lib/jquery/jquery-autocomplete/jquery.autocomplete.min.js');
}
$c = 0;
foreach ( $this->lines as $line ) {
$lineHtml = '';
$right = '';
if (count($line) == 1) {
$line[1] = array();
}
// $line[0] is left part, $line[1] right floated section
for ($bitx = 0, $bitxcount_line = count($line); $bitx < $bitxcount_line; $bitx++ ) {
$lineBit = '';
if ($c == 0 && $bitx == 1 && ($tiki_p_admin == 'y' or $tiki_p_admin_toolbars == 'y')) {
$params = array('_script' => 'tiki-admin_toolbars.php', '_onclick' => 'needToConfirm = true;', '_class' => 'toolbar', '_icon' => 'wrench', '_ajax' => 'n');
if (isset($comments) && $comments == 'y')
$params['comments'] = 'on';
if (isset($section))
$params['section'] = $section;
$content = tra('Admin Toolbars');
$right .= smarty_block_self_link($params, $content, $smarty);
}
foreach ( $line[$bitx] as $group ) {
$groupHtml = '';
foreach ( $group as $tag ) {
$groupHtml .= $tag->getWikiHtml($areaId);
}
if ( !empty($groupHtml) ) {
$param = empty($lineBit) ? '' : ' class="toolbar-list"';
$lineBit .= "<span$param>$groupHtml</span>";
}
if ($bitx == 1) {
if (!empty($right)) {
$right = '<span class="toolbar-list">' . $right . '</span>';
}
$lineHtml = "<div class='helptool-admin'>$lineBit $right</div>" . $lineHtml;
} else {
$lineHtml = $lineBit;
}
}
// adding admin icon if no right part - messy - TODO better
if ($c == 0 && empty($lineBit) && !empty($right)) {
$lineHtml .= "<div class='helptool-admin'>$right</div>";
}
}
if ( !empty($lineHtml) ) {
$html .= "<div>$lineHtml</div>";
}
$c++;
}
return $html;
} // }}}
示例12: getSelfLink
function getSelfLink($click, $title, $class)
{
// {{{
global $smarty, $prefs;
$params = array();
$params['_onclick'] = $click . (substr($click, strlen($click) - 1) != ';' ? ';' : '') . 'return false;';
$params['_class'] = 'toolbar ' . (!empty($class) ? ' ' . $class : '');
$params['_ajax'] = 'n';
$content = $title;
$params['_icon'] = $this->icon;
if (strpos($class, 'qt-plugin') !== false && $this->icon == 'img/icons/plugin.png') {
$params['_menu_text'] = 'y';
$params['_menu_icon'] = 'y';
}
if ($prefs['mobile_mode'] !== 'y') {
return smarty_block_self_link($params, $content, $smarty);
} else {
return str_replace('<a ', '<a data-role="button" ', smarty_block_self_link($params, $content, $smarty));
}
}
示例13: smarty_block_textarea
function smarty_block_textarea($params, $content, $smarty, $repeat)
{
global $prefs, $is_html, $tiki_p_admin;
$headerlib = TikiLib::lib('header');
if ($repeat) {
return;
}
// some defaults
$params['_toolbars'] = isset($params['_toolbars']) ? $params['_toolbars'] : 'y';
if ($prefs['javascript_enabled'] != 'y') {
$params['_toolbars'] = 'n';
}
$params['_simple'] = isset($params['_simple']) ? $params['_simple'] : 'n';
if (!isset($params['_wysiwyg'])) {
if ($params['_simple'] === 'n') {
// should not be set usually(?)
include_once 'lib/setup/editmode.php';
$params['_wysiwyg'] = $_SESSION['wysiwyg'];
} else {
$params['_wysiwyg'] = 'n';
}
}
if ($is_html === null) {
// sometimes $is_html has not been set, so take an educated guess
if ($params['_wysiwyg'] === 'y' && $prefs['wysiwyg_htmltowiki'] !== 'y') {
$is_html = true;
}
}
$params['_is_html'] = isset($params['_is_html']) ? $params['_is_html'] : $is_html;
$params['name'] = isset($params['name']) ? $params['name'] : 'edit';
$params['id'] = isset($params['id']) ? $params['id'] : 'editwiki';
$params['area_id'] = isset($params['area_id']) ? $params['area_id'] : $params['id'];
// legacy param for toolbars?
$params['class'] = isset($params['class']) ? $params['class'] : 'wikiedit form-control';
$params['comments'] = isset($params['comments']) ? $params['comments'] : 'n';
$params['autosave'] = isset($params['autosave']) ? $params['autosave'] : 'y';
//codemirror integration
if ($prefs['feature_syntax_highlighter'] === 'y') {
$params['data-codemirror'] = isset($params['codemirror']) ? $params['codemirror'] : '';
$params['data-syntax'] = isset($params['syntax']) ? $params['syntax'] : '';
}
//keep params html5 friendly
unset($params['codemirror']);
unset($params['syntax']);
// mainly for modules admin - preview is for the module, not the custom module so don;t need to confirmExit
$params['_previewConfirmExit'] = isset($params['_previewConfirmExit']) ? $params['_previewConfirmExit'] : 'y';
if (!isset($params['section'])) {
global $section;
$params['section'] = $section ? $section : 'wiki page';
}
$html = '';
$html .= '<input type="hidden" name="mode_wysiwyg" value="" /><input type="hidden" name="mode_normal" value="" />';
$auto_save_referrer = '';
$auto_save_warning = '';
$as_id = $params['id'];
$smarty->loadPlugin('smarty_block_remarksbox');
$tmp_var = $smarty->getTemplateVars('page');
$editWarning = $prefs['wiki_timeout_warning'] === 'y' && isset($tmp_var) && $tmp_var !== 'sandbox';
if ($params['_simple'] === 'n' && $editWarning) {
$remrepeat = false;
$html .= smarty_block_remarksbox(array('type' => 'warning', 'title' => tra('Warning')), '<p>' . tra('This edit session will expire in') . ' <span id="edittimeout">' . ini_get('session.gc_maxlifetime') / 60 . '</span> ' . tra('minutes') . '. ' . tra('<strong>Preview</strong> (if available) or <strong>Save</strong> your work to restart the edit session timer') . '</p>', $smarty, $remrepeat) . "\n";
if ($prefs['javascript_enabled'] === 'y') {
$html = str_replace('<div class="alert alert-warning alert-dismissable">', '<div class="alert alert-warning alert-dismissable" style="display:none;">', $html);
// quickfix to stop this box appearing before doc.ready
}
}
$params['switcheditor'] = isset($params['switcheditor']) ? $params['switcheditor'] : 'y';
$smarty->assign('comments', $params['comments']);
// 3 probably removable assigns
$smarty->assign('switcheditor', $params['switcheditor']);
$smarty->assign('toolbar_section', $params['section']);
if ($prefs['feature_ajax'] == 'y' && $prefs['ajax_autosave'] == 'y' && $params['_simple'] == 'n' && $params['autosave'] == 'y') {
// retrieve autosaved content
$smarty->loadPlugin('smarty_block_self_link');
$auto_save_referrer = TikiLib::lib('autosave')->ensureReferrer();
if (empty($_REQUEST['autosave'])) {
$_REQUEST['autosave'] = 'n';
}
if (TikiLib::lib('autosave')->has_autosave($as_id, $auto_save_referrer)) {
// and $params['preview'] == 0 - why not?
$auto_saved = str_replace("\n", "\r\n", TikiLib::lib('autosave')->get_autosave($as_id, $auto_save_referrer));
if (strcmp($auto_saved, $content) === 0) {
$auto_saved = '';
}
if (empty($auto_saved) || isset($_REQUEST['mode_wysiwyg']) && $_REQUEST['mode_wysiwyg'] === 'y') {
// switching modes, ignore auto save
TikiLib::lib('autosave')->remove_save($as_id, $auto_save_referrer);
} else {
$msg = '<div class="mandatory_star"><span class="autosave_message">' . tra('There is an autosaved draft of your recent edits, to use it instead ') . '</span> ' . '<span class="autosave_message_2" style="display:none;">' . tra('If you want the original instead of the autosaved draft of your edits') . '</span>' . smarty_block_self_link(array('_ajax' => 'n', '_onclick' => 'toggle_autosaved(\'' . $as_id . '\',\'' . $auto_save_referrer . '\');return false;'), tra('click here'), $smarty) . "</div>";
$remrepeat = false;
$auto_save_warning = smarty_block_remarksbox(array('type' => 'info', 'title' => tra('AutoSave')), $msg, $smarty, $remrepeat) . "\n";
}
}
$headerlib->add_jq_onready("register_id('{$as_id}','" . addcslashes($auto_save_referrer, "'") . "');");
$headerlib->add_js("var autoSaveId = '" . addcslashes($auto_save_referrer, "'") . "';");
}
if ($params['_wysiwyg'] == 'y' && $params['_simple'] == 'n') {
// TODO cope with wysiwyg and simple
$wysiwyglib = TikiLib::lib('wysiwyg');
// set up wikiLingo wysiwyg
//.........这里部分代码省略.........