示例#1
0
Source;
$scripts = (new WikiLingo\Utilities\Scripts())->addCssLocation("//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css")->addScriptLocation("//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js")->addScriptLocation("http://code.jquery.com/ui/1.10.3/jquery-ui.js");
$parser = new WikiLingo\Parser($scripts);
$msg = '';
FLP\Events::bind(new FLP\Event\MetadataLookup(function ($linkType, &$value) {
    $value = new FLP\Metadata();
    $value->author = "Robert Plummer";
    $value->authorInstitution = "Visual Interop Development llc";
    $value->authorProfession = "Software Engineer";
    $value->moderator = "Robert Plummer";
    $value->moderatorInstitution = "Visual Interop Development llc";
    $value->moderatorProfession = "Software Engineer";
    $value->answers = array();
    $value->categories = array();
    $value->count = 0;
    $value->dateLastUpdated = time();
    $value->dateOriginated = time();
    $value->href = "http://www.github.com/FutureLink-Protocol/php";
    $value->keywords = array();
    $value->language = "English";
    $value->minimumMathNeeded = "";
    $value->minimumStatisticsNeeded = "";
    $value->scientificField = "";
    $value->websiteTitle = "FutureLink-Protocol Demo";
    $value->websiteSubtitle = "In php";
}));
$page = $parser->parse($source);
echo $page . $scripts->renderScript();
?>
</body>
</html>
示例#2
0
 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;
 }
示例#3
0
$plugins = null;
//trap any warnings
ob_start();
//instantiate a script collector
$scripts = new WikiLingo\Utilities\Scripts();
$reflection = isset($_REQUEST['reflect']) ? $_REQUEST['reflect'] : '';
switch ($reflection) {
    //manage wikiLingo to wysiwyg html
    case 'wikiLingoWYSIWYG':
        $parser = new WikiLingoWYSIWYG\Parser($scripts);
        $output = $parser->parse($_REQUEST['w']);
        $plugins = $parser->plugins;
        break;
        //manage wysiwyg html to wikiLingo
    //manage wysiwyg html to wikiLingo
    case 'WYSIWYGWikiLingo':
        $fake = new WikiLingo\Parser();
        $parser = new WYSIWYGWikiLingo\Parser($scripts);
        $output = $parser->parse($_REQUEST['w']);
        break;
        //manage wikiLingo to html
    //manage wikiLingo to html
    default:
        $parser = new WikiLingo\Parser($scripts);
        $output = $parser->parse($_REQUEST['w']);
        $plugins = $parser->plugins;
}
//collect output and return to client
$msg = ob_get_contents();
ob_end_clean();
echo json_encode(array('output' => $output, 'script' => $scripts->renderScript(), 'css' => $scripts->renderCss(), 'msg' => $msg, 'plugins' => $plugins));
示例#4
0
文件: modlib.php 项目: rjsmelo/tiki
 function parse($info)
 {
     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') {
             $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));
         }
     }
     return $info;
 }
示例#5
0
        }))



        ->bind(new Event\Expression\Plugin\PreRender(function(Expression\Plugin &$plugin) {
            $test = '';
        }));

    Type::Events($wikiLingoWYSIWYG->events)
        ->bind(new Event\Expression\Tag\Render(function(&$element, &$expression) {
            if (!$expression->allowed) {
                Type::Element($element)->attributes['style'] = 'background-color: red;';
            }
        }));
*/
$outputWikiLingo = $wikiLingo->parse($original);
$outputWikiLingoWYSIWYG = $wikiLingoWYSIWYG->parse($original);
$outputWYSIWYGWikiLingo = $wYSIWYGWikiLingo->parse($outputWikiLingoWYSIWYG);
$css = $scripts->renderCss();
$script = $scripts->renderScript();
?>
<!DOCTYPE html>
<html>
<head>
	<style>
		table.demo {
			width: 100%;
		}
		table.demo, table.demo td {
			border: 1px solid pink;
			vertical-align: top;