示例#1
0
<?php

if (!isset($saving)) {
    header('Content-type: text/css');
    if (isset($css) && $css) {
        echo $css;
        die;
    }
}
if (!isset($frm_style)) {
    $frm_style = new FrmStyle();
}
$styles = $frm_style->get_all();
$default_style = $frm_style->get_default_style($styles);
$defaults = $default_style->post_content;
?>

.frm_hidden,
.with_frm_style .frm_button.frm_hidden{
    display:none;
}

legend.frm_hidden{
    display:none !important;
}

.frm_transparent{
	color:transparent;
}

.input[type=file].frm_transparent:focus, .with_frm_style input[type=file]{
 public static function custom_css($message = '', $style = null)
 {
     wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
     wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
     wp_enqueue_script('codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array('codemirror'), '4.7');
     if (!isset($style)) {
         $frm_style = new FrmStyle();
         $style = $frm_style->get_default_style();
     }
     include FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php';
 }
 public static function generate_xml($type, $args = array())
 {
     global $wpdb;
     self::prepare_types_array($type);
     $tables = array('items' => $wpdb->prefix . 'frm_items', 'forms' => $wpdb->prefix . 'frm_forms', 'posts' => $wpdb->posts, 'styles' => $wpdb->posts, 'actions' => $wpdb->posts);
     $defaults = array('ids' => false);
     $args = wp_parse_args($args, $defaults);
     $sitename = sanitize_key(get_bloginfo('name'));
     if (!empty($sitename)) {
         $sitename .= '.';
     }
     $filename = $sitename . 'formidable.' . date('Y-m-d') . '.xml';
     header('Content-Description: File Transfer');
     header('Content-Disposition: attachment; filename=' . $filename);
     header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
     //make sure ids are numeric
     if (is_array($args['ids']) && !empty($args['ids'])) {
         $args['ids'] = array_filter($args['ids'], 'is_numeric');
     }
     $records = array();
     foreach ($type as $tb_type) {
         $where = array();
         $join = '';
         $table = $tables[$tb_type];
         $select = $table . '.id';
         $query_vars = array();
         switch ($tb_type) {
             case 'forms':
                 //add forms
                 if ($args['ids']) {
                     $where[] = array('or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids']);
                 } else {
                     $where[$table . '.status !'] = 'draft';
                 }
                 break;
             case 'actions':
                 $select = $table . '.ID';
                 $where['post_type'] = FrmFormActionsController::$action_post_type;
                 if (!empty($args['ids'])) {
                     $where['menu_order'] = $args['ids'];
                 }
                 break;
             case 'items':
                 //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)";
                 if ($args['ids']) {
                     $where[$table . '.form_id'] = $args['ids'];
                 }
                 break;
             case 'styles':
                 // Loop through all exported forms and get their selected style IDs
                 $frm_style = new FrmStyle();
                 $default_style = $frm_style->get_default_style();
                 $form_ids = $args['ids'];
                 $style_ids = array();
                 foreach ($form_ids as $form_id) {
                     $form_data = FrmForm::getOne($form_id);
                     // For forms that have not been updated while running 2.0, check if custom_style is set
                     if (isset($form_data->options['custom_style'])) {
                         if ($form_data->options['custom_style'] == 1) {
                             $style_ids[] = $default_style->ID;
                         } else {
                             $style_ids[] = $form_data->options['custom_style'];
                         }
                     }
                     unset($form_id, $form_data);
                 }
                 $select = $table . '.ID';
                 $where['post_type'] = 'frm_styles';
                 // Only export selected styles
                 if (!empty($style_ids)) {
                     $where['ID'] = $style_ids;
                 }
                 break;
             default:
                 $select = $table . '.ID';
                 $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)';
                 $where['pm.meta_key'] = 'frm_form_id';
                 if (empty($args['ids'])) {
                     $where['pm.meta_value >'] = 1;
                 } else {
                     $where['pm.meta_value'] = $args['ids'];
                 }
                 break;
         }
         $records[$tb_type] = FrmDb::get_col($table . $join, $where, $select);
         unset($tb_type);
     }
     echo '<?xml version="1.0" encoding="' . esc_attr(get_bloginfo('charset')) . "\" ?>\n";
     include FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php';
 }