static function export($formName, $encoding, $options)
 {
     switch ($encoding) {
         case 'HTML':
             require_once 'ExportToHtmlTable.php';
             $exporter = new ExportToHtmlTable();
             $exporter->export($formName, $options);
             break;
         case 'HTMLBOM':
             // IQY callback
             require_once 'ExportToHtmlTable.php';
             $exporter = new ExportToHtmlTable();
             $exporter->setUseBom(true);
             $exporter->export($formName, $options);
             break;
         case 'DT':
             require_once 'ExportToHtmlTable.php';
             if (!is_array($options)) {
                 $options = array();
             }
             $options['useDT'] = true;
             if (!isset($options['printScripts'])) {
                 $options['printScripts'] = true;
             }
             if (!isset($options['printStyles'])) {
                 $options['printStyles'] = 'true';
             }
             $exporter = new ExportToHtmlTable();
             $exporter->export($formName, $options);
             break;
         case 'HTMLTemplate':
             require_once 'ExportToHtmlTemplate.php';
             $exporter = new ExportToHtmlTemplate();
             $exporter->export($formName, $options);
             break;
         case 'IQY':
             require_once 'ExportToIqy.php';
             $exporter = new ExportToIqy();
             $exporter->export($formName, $options);
             break;
         case 'CSVUTF8BOM':
             $options['unbuffered'] = 'true';
             require_once 'ExportToCsvUtf8.php';
             $exporter = new ExportToCsvUtf8();
             $exporter->setUseBom(true);
             $exporter->export($formName, $options);
             break;
         case 'TSVUTF16LEBOM':
             $options['unbuffered'] = 'true';
             require_once 'ExportToCsvUtf16le.php';
             $exporter = new ExportToCsvUtf16le();
             $exporter->export($formName, $options);
             break;
         case 'GLD':
             require_once 'ExportToGoogleLiveData.php';
             $exporter = new ExportToGoogleLiveData();
             $exporter->export($formName, $options);
             break;
         case 'GSS':
             $options['unbuffered'] = 'true';
             require_once 'ExportToGoogleSS.php';
             $exporter = new ExportToGoogleSS();
             $exporter->export($formName, $options);
             break;
         case 'JSON':
             require_once 'ExportToJson.php';
             $exporter = new ExportToJson();
             $exporter->export($formName, $options);
             break;
         case 'VALUE':
             require_once 'ExportToValue.php';
             $exporter = new ExportToValue();
             $exporter->export($formName, $options);
             break;
         case 'COUNT':
             require_once 'ExportToValue.php';
             if (!is_array($options)) {
                 $options = array();
             }
             $options['function'] = 'count';
             unset($options['show']);
             unset($options['hide']);
             $exporter = new ExportToValue();
             $exporter->export($formName, $options);
             break;
         case 'CSVSJIS':
             require_once 'ExportToCsvUtf8.php';
             $exporter = new ExportToCsvUtf8();
             $exporter->setUseBom(false);
             $exporter->setUseShiftJIS(true);
             $exporter->export($formName, $options);
             break;
         case 'RSS':
             require_once 'ExportToRSS.php';
             $exporter = new ExportToRSS();
             $exporter->export($formName, $options);
             break;
         case 'ENTRY':
             require_once 'ExportEntry.php';
             $exporter = new ExportEntry();
             $exporter->export($formName, $options);
             break;
         case 'CSVUTF8':
         default:
             require_once 'ExportToCsvUtf8.php';
             $exporter = new ExportToCsvUtf8();
             $exporter->setUseBom(false);
             $exporter->export($formName, $options);
             break;
     }
 }
Beispiel #2
0
    /**
     * Display the Admin page for this Plugin that show the form data saved in the database
     * @return void
     */
    public function whatsInTheDBPage()
    {
        if (isset($_REQUEST['submit_time'])) {
            $submitTime = htmlspecialchars($_REQUEST['submit_time']);
            require_once 'ExportEntry.php';
            $exp = new ExportEntry();
            if (isset($_REQUEST['form_name']) && !empty($_REQUEST['form_name'])) {
                $form = $_REQUEST['form_name'];
            } else {
                global $wpdb;
                $table = $this->getSubmitsTableName();
                $form = $wpdb->get_var($wpdb->prepare("SELECT form_name from {$table} where submit_time = %s LIMIT 1", $submitTime));
            }
            ?>
            <form action="<?php 
            echo get_admin_url() . 'admin.php?page=' . $this->getDBPageSlug() . "&form_name={$form}";
            ?>
" method="post">
                <input name="form_name" type="hidden" value="<?php 
            echo $form;
            ?>
"/>
                <input name="<?php 
            echo $submitTime;
            ?>
" type="hidden" value="row"/>
                <?php 
            wp_nonce_field('delete-from-' . htmlspecialchars($_REQUEST['form_name']));
            ?>
                <button id="delete" name="delete" onclick="this.form.submit();"><?php 
            _e('Delete', 'contact-form-7-to-database-extension');
            ?>
</button>
            </form>
            <?php 
            $exp->export($form, array('submit_time' => $submitTime));
        } else {
            require_once 'CFDBViewWhatsInDB.php';
            $view = new CFDBViewWhatsInDB();
            $view->display($this);
        }
    }
 /**
  * Display the Admin page for this Plugin that show the form data saved in the database
  * @return void
  */
 public function whatsInTheDBPage()
 {
     if (isset($_REQUEST['form_name']) && isset($_REQUEST['submit_time'])) {
         require_once 'ExportEntry.php';
         $exp = new ExportEntry();
         $exp->export($_REQUEST['form_name'], array('submit_time' => $_REQUEST['submit_time']));
     } else {
         require_once 'CFDBViewWhatsInDB.php';
         $view = new CFDBViewWhatsInDB();
         $view->display($this);
     }
 }