Skip to content
Snippets Groups Projects
plugin.inc.php 1.58 KiB
Newer Older
  • Learn to ignore specific revisions
  • Jared Hancock's avatar
    Jared Hancock committed
    <?php
    
    $info=array();
    if($plugin && $_REQUEST['a']!='add') {
    
        $config = $plugin->getConfig();
    
        if (!($page = $config->hasCustomConfig())) {
            if ($config)
                $form = $config->getForm();
            if ($form && $_POST)
                $form->isValid();
        }
    
        $title = __('Update Plugin');
    
    Jared Hancock's avatar
    Jared Hancock committed
        $action = 'update';
    
        $submit_text = __('Save Changes');
    
    Jared Hancock's avatar
    Jared Hancock committed
        $info = $plugin->ht;
    }
    $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
    ?>
    
    <form action="?id=<?php echo urlencode($_REQUEST['id']); ?>" method="post" id="save">
        <?php csrf_token(); ?>
        <input type="hidden" name="do" value="<?php echo $action; ?>">
        <input type="hidden" name="id" value="<?php echo $info['id']; ?>">
    
        <h2><?php echo __('Manage Plugin'); ?>
    
    Jared Hancock's avatar
    Jared Hancock committed
            <br/><small><?php echo $plugin->getName(); ?></small></h2>
    
    
        <h3><?php echo __('Configuration'); ?></h3>
    
    <?php
    if ($page)
        $config->renderCustomConfig();
    elseif ($form) { ?>
    
    Jared Hancock's avatar
    Jared Hancock committed
        <table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
        <tbody>
    
    <?php $form->render(); ?>
        </tbody></table>
    
    Jared Hancock's avatar
    Jared Hancock committed
    <?php
    
    else { ?>
    
        <tr><th><?php echo __('This plugin has no configurable settings'); ?><br>
            <em><?php echo __('Every plugin should be so easy to use.'); ?></em></th></tr>
    
    <?php }
    
    Jared Hancock's avatar
    Jared Hancock committed
    ?>
    <p class="centered">
    
    <?php if ($page || $form) { ?>
    
    Jared Hancock's avatar
    Jared Hancock committed
        <input type="submit" name="submit" value="<?php echo $submit_text; ?>">
    
        <input type="reset"  name="reset"  value="<?php echo __('Reset'); ?>">
    
    <?php } ?>
    
        <input type="button" name="cancel" value="<?php echo __('Cancel'); ?>" onclick='window.location.href="?"'>
    
    Jared Hancock's avatar
    Jared Hancock committed
    </p>
    </form>