Exemple #1
0
<!DOCTYPE html>
<html>
<head>
    <title>FutureLink-Protocol, Demo of Future Article linking to a PastLink</title>
</head>
<body><?php 
require_once "vendor/autoload.php";
$title = 'The FutureLink-Protocol, An explanation';
$source = <<<Source
<p>One of my neatest projects is working with Abratech, creating the FutureLink-Protocol.
@FLP(%7B%22websiteTitle%22%3A%22FutureLink-Protocol%20Demo%22%2C%22websiteSubtitle%22%3A%22In%20php%22%2C%22moderator%22%3A%22Robert%20Plummer%22%2C%22moderatorInstitution%22%3A%22Visual%20Interop%20Development%20llc%22%2C%22moderatorProfession%22%3A%22Software%20Engineer%22%2C%22hash%22%3A%22cf6beb29b1735773528298c4a24f5244%22%2C%22author%22%3A%22Don%20Jewett%22%2C%22authorInstitution%22%3A%22%22%2C%22authorProfession%22%3A%22Brain%20Scientist%22%2C%22href%22%3A%22http%3A%2F%2Flocalhost%2Fp%2Fflp-php%2Fdefault-ui%2F%22%2C%22answers%22%3A%5B%5D%2C%22dateLastUpdated%22%3A1384892798%2C%22dateOriginated%22%3A1384892798%2C%22language%22%3A%22English%22%2C%22count%22%3A0%2C%22keywords%22%3A%5B%5D%2C%22categories%22%3A%5B%5D%2C%22scientificField%22%3A%22%22%2C%22minimumMathNeeded%22%3A%22%22%2C%22minimumStatisticsNeeded%22%3A%22%22%2C%22text%22%3A%22an%20%5C%22enhanced%20Link%5C%22%20we'll%20call%20it%20a%20%5C%22PastLink%5C%22%2C%20and%20an%20%5C%22enhanced%20Backlink%5C%22%20will%20be%20called%20a%20%5C%22FutureLink%5C%22%22%7D)The FutureLink-Protocol is interesting as it creates a dynamic link, one that updates through time!@)
But there are many other projects that I enjoy as well.
</p>
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";
Exemple #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;
 }
Exemple #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));
Exemple #4
0
 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;
 }
Exemple #5
0
<?php

require_once "vendor/autoload.php";
use WikiLingo\Event;
use WikiLingo\Expression;
$original = "{TABS()}{TAB(title=`Misc.`)}\n||item1|item2\nitem3|item4||\n # <> &\n''Test'' %argument%\n!!!Test\n/*Comments ''Parsed?''*/\n~~blue:hello world~~\n<a href='http://google.com'>This is a link to Google</a>\n<script>alert('test');</script>\n-~This ''Is a test'' ~-\n{TAB}{TAB(title=`Unordered List`)}\n*1.1\n*1.2\n**2.1\n**2.2\n*****5.1\n*****5.2\n*****5.3\n**2.3\n*1.3\n{TAB}{TAB(title=`Ordered List`)}\n#__Test__\n#__Test__\n##__Test__\n##__Test__\n#####__Test__\n#####__Test__\n#####__Test__\n##__Test__\n#__Test__\n{TAB}{TABS}\n\n!+Header\n{ILLEGAL()}\n    <script>alert('t');</script>\n{ILLEGAL}\n\n{ACCORDIONS()}\n\t{ACCORDION(title=`Thumb Wars`)}{flash movie=`https://youtube.googleapis.com/v/lJ06RKGcPBI`}{ACCORDION}\n\t{ACCORDION(title=`ThumbTanic`)}{flash movie=`http://www.youtube.com/v/Rgdd8kMeaj0`}{ACCORDION}\n\t{ACCORDION(title=`BatThumb`)}{flash movie=`https://www.youtube.com/v/HUlbfmKtKcw`}{ACCORDION}\n{ACCORDIONS}\n\n";
$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");
$wikiLingo = new WikiLingo\Parser($scripts);
$wikiLingoWYSIWYG = new WikiLingoWYSIWYG\Parser($scripts);
$wYSIWYGWikiLingo = new WYSIWYGWikiLingo\Parser();
/*
    Type::Events($wikiLingo->events)
        ->bind(new Event\Expression\Tag\Allowed(function(&$expression) {
            if (!$expression->allowed) {

            }
        }))

        ->bind(new Event\Parsed\RenderPermission(function(Parsed &$parsed) {
            if (
                $parsed->type == "Plugin"
                && $parsed->expression->type == "illegal"
            ) {
                $parsed->expressionPermissible = false;
            }
        }))
        ->bind(new Event\Parsed\RenderBlocked(function(Parsed &$parsed, &$return) {
            $return = '';
        }))

        ->bind(new Event\Expression\Variable\Lookup(function($key, &$element) {