Wiki

Clone wiki

ppaste / Extensions

Extensions

If you'll need some extra functions, you can easily make an extension. Since ppaste has a one-php-file paradigm all config variables are set in the main file ppaste.php and not in an extra config file.

You can read out thoses settings by setting $PPASTE_CONFIG_INC to True and including ppaste.php. Take a look a extensions/example.php for best practices on how to write extensions:

<?php
    // Set this to only get the config variables
    $PPASTE_CONFIG_INC = true;
    // Now load config
    require_once('ppaste.php');

    // Make sure the right php file was included
    if($PPASTE)
    {
        // Now do something ...

        echo 'ppaste; version is ' . $PPASTE_VERSION . '; ';

        $pics = scandir($PPASTE_PICTURE_DIR);
        echo count($pics) . ' uploads; ';

        echo 'do something else ...';
    }
?>

Updated