Exemplo n.º 1
0
function tdomf_export_form()
{
    $form_id = $_GET['tdomf_export'];
    $ok = true;
    if (!tdomf_form_exists($form_id)) {
        $ok = false;
    }
    if (!current_user_can('manage_options')) {
        $ok = false;
    }
    if ($ok) {
        check_admin_referer('tdomf-export-' . $form_id);
    }
    if ($ok) {
        $form_data = array();
        $form_data['options'] = tdomf_get_options_form($form_id);
        $form_data['options'][TDOMF_OPTION_NAME] = tdomf_get_option_form(TDOMF_OPTION_NAME, $form_id);
        $form_data['widgets'] = tdomf_get_widgets_form($form_id);
        $form_data['caps'] = array();
        if (!isset($wp_roles)) {
            $wp_roles = new WP_Roles();
        }
        $roles = $wp_roles->role_objects;
        foreach ($roles as $role) {
            if (isset($role->capabilities[TDOMF_CAPABILITY_CAN_SEE_FORM . '_' . $form_id])) {
                $form_data['caps'][] = $role->name;
            }
        }
        $form_export = serialize($form_data);
    }
    @ignore_user_abort();
    @set_time_limit(600);
    if ($ok) {
        header("Content-Type: text/plain");
        header("Content-Disposition: attachment; filename=\"form_export_{$form_id}.txt\"");
        header("Content-Length: " . strlen($form_export));
        sleep(1);
        echo $form_export;
    } else {
        header("HTTP/1.0 404 Not Found");
    }
    exit;
}
Exemplo n.º 2
0
function tdomfinfo_text_display()
{
    ?>
    <pre>
^**Option** ^ **Value** ^ <?php 
    $alloptions = wp_load_alloptions();
    foreach ($alloptions as $id => $val) {
        if (preg_match('#^tdomf_.+#', $id) && $id != TDOMF_LOG) {
            ?>
 
| <?php 
            echo $id;
            ?>
 | <?php 
            echo htmlentities(strval($val));
            ?>
 | <?php 
        }
    }
    $form_ids = tdomf_get_form_ids();
    foreach ($form_ids as $form_id) {
        $name = tdomf_get_option_form(TDOMF_OPTION_NAME, $form_id->form_id);
        ?>

        
== Form <?php 
        echo $form_id->form_id;
        ?>
 ==

= Name = 
<?php 
        echo $name;
        ?>

<?php 
        $options = tdomf_get_options_form($form_id->form_id);
        foreach ($options as $option => $value) {
            ?>
= <?php 
            echo $option;
            ?>
 =
<?php 
            echo htmlentities(var_export($value, true));
            ?>

<?php 
        }
        $widgets = tdomf_get_widgets_form($form_id->form_id);
        if (!empty($widgets)) {
            ?>
          
== Widgets for Form ==

<?php 
            foreach ($widgets as $widget) {
                ?>
= <?php 
                echo $widget->widget_key;
                ?>
 =
<?php 
                echo htmlentities($widget->widget_value);
                ?>


<?php 
            }
        }
    }
    ?>
      </pre> <?php 
}