示例#1
0
<?php

include __DIR__ . '/../../include.php';
$example = new Raptor\Revision\JsonExample('Save JSON');
?>
<!doctype html>
<html>
<head>
    <?php 
echo $example->renderHead();
?>
    <script type="text/javascript">
        init(function($) {
            $('.editable').raptor(defaultOptions);
        });
    </script>
</head>
<body>
    <?php 
echo $example->renderNavigation();
?>
    <div class="source-watch center half" data-output="#source">
        <div class="full editable" data-id="header">
            <?php 
echo $example->renderContent('header', $example->getDefaultContent('header'));
?>
        </div>
        <div class="content editable" data-id="body">
            <?php 
echo $example->renderContent('body', $example->getDefaultContent('body'));
?>
<?php

include __DIR__ . '/../include.php';
try {
    $example = new Raptor\Revision\JsonExample('Save Content JSON');
    echo json_encode($example->save());
} catch (Raptor\ClientException $exception) {
    http_response_code(400);
    echo json_encode($exception->getMessage());
} catch (Raptor\ServerException $exception) {
    http_response_code(500);
    echo json_encode($exception->getMessage());
}
示例#3
0
<?php

include __DIR__ . '/../../include.php';
$example = new Raptor\Revision\JsonExample('Revisions');
?>
<!doctype html>
<html>
<head>
    <?php 
echo $example->renderHead();
?>
    <title>Raptor Editor - Revisions Example</title>
    <script type="text/javascript">
        init(function($) {
            $('#left').raptor(extendDefaults({
                preset: 'mammoth',
                plugins: {
                    revisions: {
                        url: function() {
                            var id = this.raptor.getElement().data('id');
                            if (id) {
                                return '../../actions/revisions.php?id=' + id;
                            }
                        }
                    }
                }
            }));
        });
    </script>
</head>
<body>