Example #1
0
    $plugin['help_raw'] .= "\n\n" . trim(file_get_contents($s . '.history.txt'));
    @(include 'classTextile.php');
    if (class_exists('Textile')) {
        $textile = new Textile();
        $plugin['help'] = $textile->TextileThis($plugin['help_raw']);
    }
    $code = file($s . '.php');
    $plugin['code'] = '';
    for ($i = 1; $i < count($code) - 1; $i++) {
        $plugin['code'] .= rtrim($code[$i]) . "\n";
    }
    $plugin['md5'] = md5($plugin['code']);
    $f = '../plugins/' . $_GET['plugin'] . '/current/' . $plugin['name'] . '.txt';
    //var_dump($plugin);
    $fp = fopen($f, 'w+');
    fwrite($fp, compile_plugin($plugin));
    fclose($fp);
    echo "Plugin compiled.";
}
?>
</div>
<table>
<tr>
<th>plugin</th>
<th>functions</th>
</tr>
<?php 
$dir = dirIndex('../plugins');
foreach ($dir as $plugin) {
    ?>
    <tr>
<?php

// Either copy classTextile.php to your plugin directory, or uncomment the following
// line and edit it to give the location where classTextile.php can be found
#ini_set('include_path', ini_get('include_path') . ':/full/path/to/textile');
if (empty($test)) {
    echo compile_plugin();
    exit;
}
// -----------------------------------------------------
function extract_section($lines, $section)
{
    $result = "";
    $start_delim = "# --- BEGIN PLUGIN {$section} ---";
    $end_delim = "# --- END PLUGIN {$section} ---";
    $start = array_search($start_delim, $lines) + 1;
    $end = array_search($end_delim, $lines);
    $content = array_slice($lines, $start, $end - $start);
    return join("\n", $content);
}
function compile_plugin($file = '')
{
    global $plugin;
    if (empty($file)) {
        $file = $_SERVER['SCRIPT_FILENAME'];
    }
    if (!isset($plugin['name'])) {
        $plugin['name'] = basename($file, '.php');
    }
    # Read the contents of this file, and strip line ends
    $content = file($file);
<?php

// Either copy classTextile.php to your plugin directory, or uncomment the following
// line and edit it to give the location where classTextile.php can be found
#ini_set('include_path', ini_get('include_path') . ':/full/path/to/textile');
if (empty($test)) {
    exit(compile_plugin());
}
// -----------------------------------------------------
function extract_section($lines, $section)
{
    $result = "";
    $start_delim = "# --- BEGIN PLUGIN {$section} ---";
    $end_delim = "# --- END PLUGIN {$section} ---";
    $start = array_search($start_delim, $lines) + 1;
    $end = array_search($end_delim, $lines);
    $content = array_slice($lines, $start, $end - $start);
    return join("\n", $content);
}
function compile_plugin($file = '')
{
    global $plugin;
    if (empty($file)) {
        $file = $_SERVER['SCRIPT_FILENAME'];
    }
    if (!isset($plugin['name'])) {
        $plugin['name'] = basename($file, '.php');
    }
    # Read the contents of this file, and strip line ends
    $content = file($file);
    for ($i = 0; $i < count($content); $i++) {