コード例 #1
0
function PaypalDigitalDownload_init($file)
{
    require_once 'PaypalDigitalDownload_Plugin.php';
    $aPlugin = new PaypalDigitalDownload_Plugin();
    // Install the plugin
    // NOTE: this file gets run each time you *activate* the plugin.
    // So in WP when you "install" the plugin, all that does it dump its files in the plugin-templates directory
    // but it does not call any of its code.
    // So here, the plugin tracks whether or not it has run its install operation, and we ensure it is run only once
    // on the first activation
    if (!$aPlugin->isInstalled()) {
        $aPlugin->install();
    } else {
        // Perform any version-upgrade activities prior to activation (e.g. database changes)
        $aPlugin->upgrade();
    }
    // Add callbacks to hooks
    $aPlugin->addActionsAndFilters();
    if (!$file) {
        $file = __FILE__;
    }
    // Register the Plugin Activation Hook
    register_activation_hook($file, array(&$aPlugin, 'activate'));
    // Register the Plugin Deactivation Hook
    register_deactivation_hook($file, array(&$aPlugin, 'deactivate'));
}
コード例 #2
0
/**
 * @param array $paymentInfoArray
 */
function fulfill_order($paymentInfoArray)
{
    $plugin = new PaypalDigitalDownload_Plugin();
    ?>
<html>
<body>
<p>This CFDB Editor download link will be good for 24 hours:</p>
<p><a href="<?php 
    echo $plugin->generateDownloadLink();
    ?>
">contact-form-to-database-extension-edit.zip</a></p>
<p>If you have any problems with the download, please contact <a href="mailto:info@cfdbplugin.com">info@cfdbplugin.com</a></p>
</body>
</html>
<?php 
    try {
        $cfdb_data = (object) array('title' => 'Paypal', 'posted_data' => $paymentInfoArray, 'uploaded_files' => null);
        do_action_ref_array('cfdb_submit', array(&$cfdb_data));
    } catch (Exception $ex) {
        error_log(sprintf('CFDB Error: %s:%s %s  %s', $ex->getFile(), $ex->getLine(), $ex->getMessage(), $ex->getTraceAsString()), 1, '*****@*****.**');
    }
}