Commit 982fce48 authored by jonnybradley's avatar jonnybradley
parent f9437a0b
......@@ -1964,6 +1964,7 @@ installer/schema/20170207_iefix_rem_tiki.sql -text
installer/schema/20170213_footnotearea_tiki.sql -text
installer/schema/20170218_schedulers_menu_tiki.sql -text
installer/schema/20170305_webservices_menu_tiki.sql -text
installer/schema/20170307_kill_wikilingo_tiki.sql -text
installer/schema/999999991_decode_pages_sources_tiki.php -text
installer/schema/99999999_image_plugins_kill_tiki.php -text
installer/schema/index.php -text
......@@ -4863,17 +4864,6 @@ lib/wiki/renderlib.php -text
lib/wiki/semanticlib.php -text
lib/wiki/wikilib.php -text
lib/wiki/xmllib.php -text
lib/wikiLingo_tiki/WikiEvents.php -text
lib/wikiLingo_tiki/WikiLingoEvents.php -text
lib/wikiLingo_tiki/WikiLingoTikiEvents.php -text
lib/wikiLingo_tiki/WikiLingoWYSIWYGEvents.php -text
lib/wikiLingo_tiki/WikiMetadataLookup.php -text
lib/wikiLingo_tiki/WikiPluginBridge.php -text
lib/wikiLingo_tiki/WikiPluginStub.php -text
lib/wikiLingo_tiki/index.php -text
lib/wikiLingo_tiki/tiki_flp.Link.js -text
lib/wikiLingo_tiki/tiki_wikiLingo_edit.js -text
lib/wikiLingo_tiki/tiki_wikiLingo_flp_view.js -text
lib/wizard/index.php -text
lib/wizard/pages/admin_advanced.php -text
lib/wizard/pages/admin_auto_toc.php -text
......
......@@ -334,9 +334,6 @@
<service id="tiki.lib.wizard" class="WizardLib">
<file>%kernel.root_dir%/lib/wizard/wizardlib.php</file>
</service>
<service id="tiki.lib.wlte" class="WikiLingoTikiEvents">
<file>%kernel.root_dir%/lib/wikiLingo_tiki/WikiLingoTikiEvents.php</file>
</service>
<service id="tiki.lib.wysiwyg" class="WYSIWYGLib">
<file>%kernel.root_dir%/lib/ckeditor_tiki/wysiwyglib.php</file>
</service>
......
DELETE FROM `tiki_preferences` WHERE `name` = 'feature_wikilingo';
......@@ -215,127 +215,6 @@ $(window).on("load", function(){
}
}
function action_wikiLingo(JitFilter $input)
{
global $user, $prefs, $page;
$tikilib = TikiLib::lib('tiki');
$globalPerms = Perms::get();
$page = urldecode($input->page->none());
if (!self::page_editable($input->autoSaveId->text(), $page)) {
return array();
}
$scripts = new WikiLingo\Utilities\Scripts("vendor/wikilingo/wikilingo/");
$wikiLingo = new WikiLingo\Parser($scripts);
require_once("lib/wikiLingo_tiki/WikiLingoEvents.php");
(new WikiLingoEvents($wikiLingo));
if ($input->wysiwyg->int() == 1) {
$toWikiLingo = new WYSIWYGWikiLingo\Parser();
$data = $input->data->none();
$source = $toWikiLingo->parse($data);
} else {
$source = $input->data->none();
}
$result = array();
//save a wiki page
if ($input->save->int() === 1) {
$wysiwyg = $input->wysiwyg->int();
$info = $tikilib->get_page_info($page, false);
$exists = $tikilib->page_exists($page);
$wiki_authors_style = '';
if ( $prefs['wiki_authors_style_by_page'] === 'y' ) {
$wiki_authors_style_updated = $input->wiki_authors_style->text();
if ( $globalPerms->admin_wiki && !empty($wiki_authors_style_updated)) {
$wiki_authors_style = $wiki_authors_style_updated;
} elseif ( isset($info['wiki_authors_style']) ) {
$wiki_authors_style = $info['wiki_authors_style'];
}
}
$hash = array(
'lock_it' => (!$input->lock_it->text() === 'on' ? 'y' : 'n'),
'comments_enabled' => ($input->comments_enabled->text() === 'on' ? 'y' : 'n'),
'contributions' => $input->contributions->text(),
'contributors' => $input->contributors->text()
);
if ($exists) {
$tikilib->update_page(
$page,
$source,
$input->comment->text() ?: $info['comment'],
$user,
$tikilib->get_ip_address(),
$input->description->text() ?: $info['description'],
($input->isminor->text() === 'on' ? 1 : 0),
$input->lang->text() ?: $info['lang'],
false,
$hash,
null,
($wysiwyg == 0 ? 'n' : 'y'),
$wiki_authors_style
);
$result['status'] = 'updated';
} else {
$tikilib->create_page(
$page,
0,
$source,
$tikilib->now,
$input->comment->text(),
$user,
$tikilib->get_ip_address(),
$input->description->text(),
$input->lang->text(),
false,
$hash,
($wysiwyg == 0 ? 'n' : 'y'),
$wiki_authors_style
);
$result['status'] = 'created';
}
}
$version = $result['version'] = $tikilib->getOne("SELECT version FROM `tiki_pages` WHERE pageName=? ORDER BY `version` DESC", array($page));
$tikilib->query("INSERT INTO tiki_output (entityId, objectType, outputType, version) VALUES (?,?,?,?)", array($page, 'wikiPage', 'wikiLingo', $version));
if ($input->preview->bool()) {
$result['parsed'] = $wikiLingo->parse($source);
$result['script'] = $scripts->renderScript();
$result['css'] = $scripts->renderCss();
}
return $result;
}
function action_update_output_type(JitFilter $input)
{
$page = $input->page->text();
$output_type = $input->output_type->text();
if (self::page_editable(null, $page)) {
$tikilib = TikiLib::lib('tiki');
//delete colums from tiki_output if they're already created so new values can be inserted to use wikiLingo as the parser
$version = $tikilib->getOne("SELECT version FROM `tiki_pages` WHERE pageName=? ORDER BY `version` DESC", array($page));
$tikilib->query("DELETE FROM `tiki_output` WHERE `entityId` = ? AND `objectType` = ? AND `version` = ?", array($page, 'wikiPage', $version));
if (!empty($output_type)){
$tikilib->query("INSERT INTO tiki_output (entityId, objectType, outputType, version) VALUES (?,?,?,?)", array($page, 'wikiPage', $output_type, $version));
}
return array(
'updated' => true,
'value' => $output_type
);
}
return false;
}
public static function page_editable($autoSaveId = null, &$page = null)
{
global $user;
......
......@@ -68,25 +68,11 @@ class ModLib extends TikiLib
$query = "delete from `tiki_user_modules` where `name`=?";
$result = $this->query($query, array($name), -1, -1, false);
$query = "insert into `tiki_user_modules`(`name`,`title`,`data`, `parse`) values(?,?,?,?)";
//BEGIN wikiLingo integration
if ($prefs['feature_wikilingo'] == 'y') {
$this->query("DELETE FROM `tiki_output` WHERE `objectType` = ? AND `entityId` = ?", array("userModule", $name));
switch (strtolower($parse))
{
case 'wikilingo':
$this->query("INSERT INTO `tiki_output` (`objectType`, `entityId`, `version`) VALUES (?, ?, ?)", array("userModule", $name, 1));
$parse = 'y';
}
}
//END wikiLingo integration
$result = $this->query($query, array($name,$title,$data,$parse));
$cachelib = TikiLib::lib('cache');
$cachelib->invalidate("user_modules_$name");
$wikilib = TikiLib::lib('wiki');
$converter = new convertToTiki9();
$converter->saveObjectStatus($name, 'tiki_user_modules', 'new9.0+');
......@@ -1211,26 +1197,8 @@ class ModLib extends TikiLib
{
global $prefs, $headerlib;
$tikilib = TikiLib::lib('tiki');
//allow for wikiLingo parsing, will only return 'y' if turned on AND enabled for this particular module
if (isset($info['wikiLingo']) && $info['wikiLingo'] == 'y' && $prefs['feature_wikilingo'] == 'y') {
//TODO: correct the paths for scripts and output them to the header
$scripts = new WikiLingo\Utilities\Scripts();
$parser = new WikiLingo\Parser($scripts);
$info['data'] = $parser->parse($info['data']);
$info['title'] = $parser->parse($info['title']);
/* output css from wikiLingo in a literal so smarty doesn't throw up.
* NOTE: this is not added to headerlib because it has already passed the opportunity to get more css
*/
$info['data'] = '{literal}' . $scripts->renderCss() . '{/literal}' . $info['data'];
//output js to headerlib, because js is at bottom and has not yet been output
foreach ( $scripts->scriptLocations as $scriptLocation ) {
$headerlib->add_jsfile($scriptLocation);
}
$headerlib->add_js(implode($scripts->scripts));
} else if (isset($info['parse']) && $info['parse'] == 'y') {
if (isset($info['parse']) && $info['parse'] == 'y') {
$info['data'] = $tikilib->parse_data($info['data'], array('is_html' => true, 'suppress_icons' => true));
$info['title'] = $tikilib->parse_data($info['title'], array('noparseplugins' => true, 'is_html' => true));
}
......@@ -1436,18 +1404,7 @@ class ModLib extends TikiLib
*/
function get_user_module($name)
{
global $prefs;
$info = $this->table('tiki_user_modules')
->fetchFullRow(array('name' => $name));
if ($prefs['feature_wikilingo'] == 'y') {
if ($this->getOne('SELECT 1 FROM `tiki_output` WHERE `objectType` = ? AND `entityId` = ?', array('userModule', $name)) != null) {
$info['wikiLingo'] = 'y';
}
}
return $info;
return $this->table('tiki_user_modules')->fetchFullRow(array('name' => $name));
}
/**
......
......@@ -2701,16 +2701,6 @@ function prefs_feature_list($partial = false)
),
'default' => 'off',
),
'feature_wikilingo' => array(
'name' => tra('wikiLingo'),
'description' => tra('A wiki content platform'),
'type' => 'flag',
'help' => 'wikiLingo',
'keywords' => 'parser',
'default' => 'n',
'warning' => tra('Experimental'),
'tags' => array('experimental'),
),
'feature_dummy' => array(
'name' => tra('Dummy preference'),
'description' => tra('This is useful for developers to learn how to create a new preference.'),
......
......@@ -230,9 +230,10 @@ class RatingLib extends TikiDb_Bridge
if ( is_string($value) && strpos($value, '=') !== false ){
$hasLabels = true;
$parser = new WikiLingo\Utilities\Parameters\Parser();
$parsedPref = $parser->parse($value);
return $parsedPref;
// FIXME? No idea what this was supposed to do
//$parser = new WikiLingo\Utilities\Parameters\Parser();
//$parsedPref = $parser->parse($value);
//return $parsedPref;
}
$result = $tikilib->get_preference($pref, range(1, 5), ($expectedArray && is_array($value)));
......
......@@ -62,34 +62,26 @@ if ($_SESSION['wysiwyg'] == 'y') {
}
}
}
if (
$prefs['feature_wikilingo'] == 'n'
|| (
$prefs['feature_wikilingo'] == 'y'
&& isset($_REQUEST['prevent_wikilingo'])
)
) {
if (isset($jitRequest['edit'])) {
// Restore the property for the rest of the script
if ($is_html) {
$data = $jitRequest->edit->none();
$parserlib = TikiLib::lib('parser');
$noparsed = array();
$parserlib->plugins_remove($data, $noparsed);
if (isset($jitRequest['edit'])) {
// Restore the property for the rest of the script
if ($is_html) {
$data = $jitRequest->edit->none();
$parserlib = TikiLib::lib('parser');
$noparsed = array();
$parserlib->plugins_remove($data, $noparsed);
$data = TikiFilter::get('xss')->filter($data);
$data = TikiFilter::get('xss')->filter($data);
$parserlib->isEditMode = true;
$parserlib->plugins_replace($data, $noparsed, true);
$parserlib->isEditMode = false;
$_REQUEST['edit'] = $data;
} else {
$_REQUEST['edit'] = $jitRequest->edit->wikicontent();
}
$parserlib->isEditMode = true;
$parserlib->plugins_replace($data, $noparsed, true);
$parserlib->isEditMode = false;
$_REQUEST['edit'] = $data;
} else {
$_REQUEST['edit'] = $jitRequest->edit->wikicontent();
}
//html is stored encoded in wysiwyg
if (isset($jitRequest['wysiwyg']) && $jitRequest['wysiwyg'] == 'y') {
$_REQUEST['edit'] = html_entity_decode($_REQUEST['edit'], ENT_QUOTES, 'UTF-8');
}
}
}
\ No newline at end of file
//html is stored encoded in wysiwyg
if (isset($jitRequest['wysiwyg']) && $jitRequest['wysiwyg'] == 'y') {
$_REQUEST['edit'] = html_entity_decode($_REQUEST['edit'], ENT_QUOTES, 'UTF-8');
}
}
......@@ -154,13 +154,8 @@ function tiki_setup_events()
}
if ($prefs['feature_futurelinkprotocol'] == 'y') {
if ($prefs['feature_wikilingo'] == 'y') {
$events->bind("tiki.wiki.view", $defer('wlte', 'wikilingo_flp_view'));
$events->bind("tiki.wiki.save", $defer('wlte', 'wikilingo_flp_save'));
} else {
$events->bind("tiki.wiki.view", $defer('wlte', 'tiki_wiki_view_pastlink'));
$events->bind("tiki.wiki.save", $defer('wlte', 'tiki_wiki_save_pastlink'));
}
$events->bind("tiki.wiki.view", $defer('wlte', 'tiki_wiki_view_pastlink'));
$events->bind("tiki.wiki.save", $defer('wlte', 'tiki_wiki_save_pastlink'));
}
if ($prefs['goal_enabled'] == 'y') {
......
......@@ -155,128 +155,41 @@ function smarty_block_textarea($params, $content, $smarty, $repeat)
$wysiwyglib = TikiLib::lib('wysiwyg');
// set up wikiLingo wysiwyg
if ($prefs['feature_wikilingo'] != 'y' || $params['useWikiLingo'] != true) {
if (!isset($params['name'])) {
$params['name'] = 'edit';
}
$ckoptions = $wysiwyglib->setUpEditor($params['_is_html'], $as_id, $params, $auto_save_referrer);
$html .= '<input type="hidden" name="wysiwyg" value="y" />';
$html .= '<textarea class="wikiedit" name="'.$params['name'].'" id="'.$as_id.'" style="visibility:hidden;'; // missing closing quotes, closed in condition
if (empty($params['cols'])) {
$html .= 'width:100%;'. (empty($params['rows']) ? 'height:500px;' : '') .'"';
} else {
$html .= '" cols="'.$params['cols'].'"';
}
if (!empty($params['rows'])) {
$html .= ' rows="'.$params['rows'].'"';
}
$html .= '>'.htmlspecialchars($content).'</textarea>';
$headerlib->add_jq_onready(
'
if (!isset($params['name'])) {
$params['name'] = 'edit';
}
$ckoptions = $wysiwyglib->setUpEditor($params['_is_html'], $as_id, $params, $auto_save_referrer);
$html .= '<input type="hidden" name="wysiwyg" value="y" />';
$html .= '<textarea class="wikiedit" name="'.$params['name'].'" id="'.$as_id.'" style="visibility:hidden;'; // missing closing quotes, closed in condition
if (empty($params['cols'])) {
$html .= 'width:100%;'. (empty($params['rows']) ? 'height:500px;' : '') .'"';
} else {
$html .= '" cols="'.$params['cols'].'"';
}
if (!empty($params['rows'])) {
$html .= ' rows="'.$params['rows'].'"';
}
$html .= '>'.htmlspecialchars($content).'</textarea>';
$headerlib->add_jq_onready(
'
CKEDITOR.replace( "'.$as_id.'",' . $ckoptions . ');
CKEDITOR.on("instanceReady", function(event) {
if (typeof ajaxLoadingHide == "function") { ajaxLoadingHide(); }
this.instances.'.$as_id.'.resetDirty();
});
',
20
); // after dialog tools init (10)
}
//setup wikiLingo without wysiwyg
else
{
$scripts = new WikiLingo\Utilities\Scripts("vendor/wikilingo/wikilingo/editor/");
$parserWYSIWYG = new WikiLingoWYSIWYG\Parser($scripts);
require_once('lib/wikiLingo_tiki/WikiLingoWYSIWYGEvents.php');
(new WikiLingoWYIWYGEvents($parserWYSIWYG));
$contentSafe = $parserWYSIWYG->parse($content);
$expressionSyntaxes = new WikiLingoWYSIWYG\ExpressionSyntaxes($scripts);
//register expression types so that they can be turned into json and sent to browser
$expressionSyntaxes->registerExpressionTypes();
$expressionSyntaxesJson = json_encode($expressionSyntaxes->parsedExpressionSyntaxes);
$wLPlugins = json_encode($parserWYSIWYG->plugins);
$name = $params['name'];
$parserWYSIWYG->scripts
->addCssLocation("vendor/mediumjs/mediumjs/medium.css")
->addCssLocation("vendor/wikilingo/wikilingo/editor/bubble.css")
->addCssLocation("vendor/wikilingo/wikilingo/editor/pastLink.css")
->addCssLocation("vendor/wikilingo/wikilingo/editor/IcoMoon/sprites/sprites.css")
->addCss(".wikiedit.wikilingo{min-height:500px;}");
$css = $parserWYSIWYG->scripts->renderCss();
$html .= <<<HTML
$css
<div
id="$as_id-ui"
class="wikiedit wikilingo ui-widget-content"
contenteditable="true"
onchange="this.input.value = this.innerHTML">$contentSafe</div>
<input type="hidden" name="$name" id="$as_id"/>
<script>
var ui = document.getElementById('$as_id-ui'),
input = document.getElementById('$as_id');
ui.input = input;
input.value = ui.innerHTML;
window.expressionSyntaxes = $expressionSyntaxesJson;
window.wLPlugins = $wLPlugins;
</script>
HTML
;
$headerlib
//->add_jsfile("vendor/wikilingo/wikilingo/editor/editor.js")
//add some javascript
->add_jsfile("vendor/undojs/undojs/undo.js")
->add_jsfile("vendor/rangy/rangy/uncompressed/rangy-core.js")
->add_jsfile("vendor/rangy/rangy/uncompressed/rangy-cssclassapplier.js")
->add_jsfile("vendor/mediumjs/mediumjs/medium.js")
->add_jsfile("vendor/wikilingo/wikilingo/editor/WLExpressionUI.js")
->add_jsfile("vendor/wikilingo/wikilingo/editor/WLPluginEditor.js")
->add_jsfile("vendor/wikilingo/wikilingo/editor/WLPluginAssistant.js")
->add_jsfile("vendor/wikilingo/wikilingo/editor/bubble.js")
->add_jsfile("lib/wikiLingo_tiki/tiki_wikiLingo_edit.js")
->add_js(<<<JS
(new WikiLingoEdit(document.getElementById('$as_id-ui'), document.getElementById('$as_id')));
$(function() {
$('#$as_id-ui').after(
$('<a class="ui-button" style="float:right;" href="' + document.location + '&wysiwyg=n">' + tr('Edit Source') + '</a>')
.button()
);
});
JS
);
//join wikiLingo's scripts with tiki's
foreach($scripts->scriptLocations as $scriptLocation) {
$headerlib->add_jsfile($scriptLocation);
}
foreach($scripts->scripts as $script) {
$headerlib->add_js($script);
}
}
20
); // after dialog tools init (10)
} else {
// end of if ( $params['_wysiwyg'] == 'y' && $params['_simple'] == 'n')
// setup for wiki editor
//when wikiLingo enabled
if ($prefs['feature_wikilingo'] === 'y') {
$headerlib->add_jsfile("lib/wikiLingo_tiki/tiki_wikiLingo_edit.js");
}
$params['rows'] = !empty($params['rows']) ? $params['rows'] : 20;
// $params['cols'] = !empty($params['cols']) ? $params['cols'] : 80;
......
......@@ -47,7 +47,7 @@ class TikiLib extends TikiDb_Bridge
/** Gets a library reference
*
* @param $name
* @return \ActivityLib|\AdminLib|\AreasLib|\ArtLib|\AttributeLib|\AutoSaveLib|\BannerLib|\BigBlueButtonLib|\BlogLib|\CacheLib|\CalendarLib|\Captcha|\CartLib|\CategLib|\Comments|\ContactLib|\ContributionLib|\CreditsLib|\CryptLib|\cssLib|\DCSLib|\EditLib|\ErrorReportLib|\FaqLib|\FederatedSearchLib|\FileGalBatchLib|\FileGalLib|\FlaggedRevisionLib|\FreetagLib|\GeoLib|\GoalEventLib|\GoalLib|\GoalRewardLib|\GroupAlertLib|\HeaderLib|\HistLib|\IconsetLib|\ImageGalsLib|\KalturaLib|\KalturaLib|\Language|\LanguageTranslations|\LdapLib|\LoginLib|\LogsLib|\LogsQueryLib|\MailinLib|\Memcachelib|\MenuLib|\Messu|\MimeLib|\ModLib|\MonitorLib|\MonitorMailLib|\MultilingualLib|\NotificationLib|\OAuthLib|\ObjectLib|\PageContentLib|\ParserLib|\PaymentLib|\PerspectiveLib|\PollLib|\PreferencesLib|\QuantifyLib|\QueueLib|\QuizLib|\RatingConfigLib|\RatingLib|\ReferencesLib|\RegistrationLib|\RelationLib|\RSSLib|\SchedulersLib|\ScoreLib|\ScormLib|\SearchStatsLib|\SemanticLib|\ServiceLib|\SheetLib|\Smarty_Tiki|\SocialLib|\StatsLib|\StoredSearchLib|\StructLib|\TemplatesLib|\ThemeControlLib|\ThemeLib|\Tiki_Connect_Client|\Tiki_Connect_Server|\Tiki_Event_Manager|\Tiki_Profile_SymbolLoader|\Tiki\Object\Selector|\Tiki\Recommendation\BatchProcessor|\Tiki\Wiki\SlugManager|\TikiAccessLib|\TikiCalendarLib|\TikiDate|\TodoLib|\Tracker\Tabular\Manager|\TrackerLib|\UnifiedSearchLib|\UserMailinLib|\UserModulesLib|\UserPrefsLib|\UsersLib|\Validators|\VimeoLib|\WikiLib|\WikiLingoTikiEvents|\WizardLib|\WYSIWYGLib|\ZoteroLib
* @return \ActivityLib|\AdminLib|\AreasLib|\ArtLib|\AttributeLib|\AutoSaveLib|\BannerLib|\BigBlueButtonLib|\BlogLib|\CacheLib|\CalendarLib|\Captcha|\CartLib|\CategLib|\Comments|\ContactLib|\ContributionLib|\CreditsLib|\CryptLib|\cssLib|\DCSLib|\EditLib|\ErrorReportLib|\FaqLib|\FederatedSearchLib|\FileGalBatchLib|\FileGalLib|\FlaggedRevisionLib|\FreetagLib|\GeoLib|\GoalEventLib|\GoalLib|\GoalRewardLib|\GroupAlertLib|\HeaderLib|\HistLib|\IconsetLib|\ImageGalsLib|\KalturaLib|\KalturaLib|\Language|\LanguageTranslations|\LdapLib|\LoginLib|\LogsLib|\LogsQueryLib|\MailinLib|\Memcachelib|\MenuLib|\Messu|\MimeLib|\ModLib|\MonitorLib|\MonitorMailLib|\MultilingualLib|\NotificationLib|\OAuthLib|\ObjectLib|\PageContentLib|\ParserLib|\PaymentLib|\PerspectiveLib|\PollLib|\PreferencesLib|\QuantifyLib|\QueueLib|\QuizLib|\RatingConfigLib|\RatingLib|\ReferencesLib|\RegistrationLib|\RelationLib|\RSSLib|\SchedulersLib|\ScoreLib|\ScormLib|\SearchStatsLib|\SemanticLib|\ServiceLib|\SheetLib|\Smarty_Tiki|\SocialLib|\StatsLib|\StoredSearchLib|\StructLib|\TemplatesLib|\ThemeControlLib|\ThemeLib|\Tiki_Connect_Client|\Tiki_Connect_Server|\Tiki_Event_Manager|\Tiki_Profile_SymbolLoader|\Tiki\Object\Selector|\Tiki\Recommendation\BatchProcessor|\Tiki\Wiki\SlugManager|\TikiAccessLib|\TikiCalendarLib|\TikiDate|\TodoLib|\Tracker\Tabular\Manager|\TrackerLib|\UnifiedSearchLib|\UserMailinLib|\UserModulesLib|\UserPrefsLib|\UsersLib|\Validators|\VimeoLib|\WikiLib|\WizardLib|\WYSIWYGLib|\ZoteroLib
* @throws Exception
*/
public static function lib($name)
......@@ -4351,10 +4351,7 @@ class TikiLib extends TikiDb_Bridge
unset($this->cache_page_info[$keys[$num]]);
}
}
$row['outputType'] = '';
if ($prefs['feature_wikilingo'] == 'y') {
$row['outputType'] = $this->getOne ("SELECT `outputType` FROM `tiki_output` WHERE `entityId` = ? AND `objectType` = ? AND `version` = ?", array($row['pageName'], 'wikiPage', $row['version']));
}
$row['outputType'] = ''; // TODO remove as redundant?
$this->cache_page_info[$pageNameEncode] = $row;
return $this->cache_page_info[$pageNameEncode];
......@@ -5781,22 +5778,9 @@ class TikiLib extends TikiDb_Bridge
if ($prefs['search_parsed_snippet'] == 'y') {
$data = preg_replace('/{(:?make)?toc[^}]*}/', '', $data);
//standard wiki parse
if ($outputType == '') {
$_REQUEST['redirectpage'] = 'y'; //do not interpret redirect
$data = $this->parse_data($data, array('is_html' => $is_html, 'stripplugins' => true, 'parsetoc' => true));
}
//wikiLingo parse
else if (strtolower($outputType) == 'wikilingo' && $prefs['feature_wikilingo'] == 'y') {
$_REQUEST['redirectpage'] = 'y'; //do not interpret redirect
if ($this->wikiLingo == null) {
$this->wikiLingo = new WikiLingo\Parser();
require_once('lib/wikiLingo_tiki/WikiLingoEvents.php');
(new WikiLingoEvents($this->wikiLingo, false));
}
$data = $this->wikiLingo->parse($data);
}
$_REQUEST['redirectpage'] = 'y'; //do not interpret redirect
$data = $this->parse_data($data, array('is_html' => $is_html, 'stripplugins' => true, 'parsetoc' => true));
}
......
......@@ -791,10 +791,6 @@ class ToolbarBlock extends ToolbarInline // Will change in the future
{
global $prefs;
$isWikiLingo = false;
if ($prefs['feature_wikilingo'] === 'y') {
$isWikiLingo = true;
}
$isFutureLinkProtocol = false;
if ($prefs['feature_futurelinkprotocol'] === 'y') {
$isFutureLinkProtocol = true;
......@@ -822,7 +818,7 @@ class ToolbarBlock extends ToolbarInline // Will change in the future
$syntax = '---';
break;
case 'pastlink':
if ($isWikiLingo && $isFutureLinkProtocol) {
if ($isFutureLinkProtocol) {
$label = tra('PastLink');
$iconname = 'copy';
$wysiwyg = 'PastLink';
......@@ -833,20 +829,12 @@ class ToolbarBlock extends ToolbarInline // Will change in the future
return;
}
case 'pagebreak':
if ($isWikiLingo) {
return;
}
$label = tra('Page Break');
$iconname = 'page-break';
$wysiwyg = 'PageBreak';
$syntax = '...page...';
break;
case 'box':
if ($isWikiLingo) {
return;
}
$label = tra('Box');
$iconname = 'box';
$wysiwyg = 'Box';
......@@ -873,9 +861,6 @@ class ToolbarBlock extends ToolbarInline // Will change in the future
$syntax = '-=text=-';
break;
case 'toc':
if ($isWikiLingo) {
return;
}
$label = tra('Table of contents');
$iconname = 'book';
$wysiwyg = 'TOC';
......@@ -971,11 +956,6 @@ class ToolbarPicker extends Toolbar
global $section, $prefs;
$headerlib = TikiLib::lib('header');
$isWikiLingo = false;
if ($prefs['feature_wikilingo'] === 'y') {
$isWikiLingo = true;
}
$tool_prefs = array();
$styleType = '';
......@@ -989,9 +969,6 @@ class ToolbarPicker extends Toolbar
$list = array_combine($list, $list);
break;
case 'smiley':
if ($isWikiLingo) {
return;
}
$wysiwyg = 'Smiley';
$label = tra('Smileys');
......
......@@ -1917,76 +1917,15 @@ class WikiLibOutput
public $parsedValue;
public $options;
private static $init = false;
private static $wikiLingo;
private static $wikiLingoScripts;
public function __construct($info, $originalValue, $options = array())
{
$tikilib = TikiLib::lib('tiki');
$prefslib = TikiLib::lib('prefs');
$headerlib = TikiLib::lib('header');
//TODO: info may have an override, we need to build it in using MYSQL
$this->info = $info;
$this->originalValue = $originalValue;
$this->options = $options;
$feature_wikilingo = $prefslib->getPreference('feature_wikilingo')['value'];
if($feature_wikilingo === 'y'
&& isset($info['outputType']) && $info['outputType'] == 'wikiLingo') {
if (self::$init) {
$scripts = self::$wikiLingoScripts;
$wikiLingo = self::$wikiLingo;
} else {
self::$init = true;
$scripts = self::$wikiLingoScripts = new WikiLingo\Utilities\Scripts(TikiLib::tikiUrl() . "vendor/wikilingo/wikilingo/");
$wikiLingo = self::$wikiLingo = new WikiLingo\Parser($scripts);
require_once('lib/wikiLingo_tiki/WikiLingoEvents.php');
(new WikiLingoEvents($wikiLingo));
}
if (isset($_POST['protocol']) && $_POST['protocol'] === 'futurelink')
{
$this->parsedValue = '';
} else {
$this->parsedValue = $wikiLingo->parse($this->originalValue);
//recover from failure, but DO NOT just output
if ($this->parsedValue === null)
{
$possibleCause = '';
if (!empty($wikiLingo->pluginStack)) {
foreach ($wikiLingo->pluginStack as $pluginName) {
$possibleCause .= "<li>" . tr('Unclosed Plugin: ') . $pluginName . "</li>";
}
}
$errors = htmlspecialchars(implode($wikiLingo->lexerErrors + $wikiLingo->parserErrors, "\n"));
$this->parsedValue = '<pre><code>' . htmlspecialchars($this->originalValue) . '</code></pre>' .
'<div class="ui-state-error">' . tr("wikiLingo markup could not be parsed.") .
'<br />' .
(!empty($possibleCause) ? "<ul>" . $possibleCause . "</ul>" : '') .
tr('Error Details: ') . '<pre><code>' . $errors . '</code></pre>' .
'</div>';
}
//transfer scripts over to headerlib
//css is already processed at this point, as it is in the header, at the top, so we expose it here
$this->parsedValue .= $scripts->renderCss();
//js
foreach($scripts->scripts as $script) {
$headerlib->add_js($script);
}
//js files
foreach($scripts->scriptLocations as $scriptLocation) {
$headerlib->add_jsfile($scriptLocation);
}
}
} else {
$this->parsedValue = $tikilib->parse_data($this->originalValue, $this->options = $options);
}
$this->parsedValue = $tikilib->parse_data($this->originalValue, $this->options = $options);
}
}
<?php
include_once 'lib/wikiLingo_tiki/WikiMetadataLookup.php';
/**