" . __("Please select the forms to be exported", "gravityforms") . ""; return; } $forms = RGFormsModel::get_forms_by_id($selected_forms); //removing the inputs for checkboxes (choices will be used during the import) foreach($forms as &$form){ foreach($form["fields"] as &$field){ $inputType = RGFormsModel::get_input_type($field); if(isset($field["pageNumber"])) unset($field["pageNumber"]); if($inputType == "checkbox") unset($field["inputs"]); if($inputType != "address") unset($field["addressType"]); if($inputType != "date"){ unset($field["calendarIconType"]); unset($field["dateType"]); } if($inputType != "creditcard") unset($field["creditCards"]); if($field["type"] == rgar($field, "inputType")) unset($field["inputType"]); if(in_array($inputType, array("checkbox", "radio", "select")) && !rgar($field,"enableChoiceValue")){ foreach($field["choices"] as &$choice) unset($choice["value"]); } } } require_once("xml.php"); $options = array( "version" => GFCommon::$version, "forms/form/id" => array("is_hidden" => true), "forms/form/nextFieldId" => array("is_hidden" => true), "forms/form/notification/routing" => array("array_tag" => "routing_item"), "forms/form/useCurrentUserAsAuthor" => array("is_attribute" => true), "forms/form/postAuthor" => array("is_attribute" => true), "forms/form/postCategory" => array("is_attribute" => true), "forms/form/postStatus" => array("is_attribute" => true), "forms/form/postAuthor" => array("is_attribute" => true), "forms/form/postFormat" => array("is_attribute" => true), "forms/form/labelPlacement" => array("is_attribute" => true), "forms/form/confirmation/type" => array("is_attribute" => true), "forms/form/lastPageButton/type" => array("is_attribute" => true), "forms/form/pagination/type" => array("is_attribute" => true), "forms/form/pagination/style" => array("is_attribute" => true), "forms/form/button/type" => array("is_attribute" => true), "forms/form/button/conditionalLogic/actionType" => array("is_attribute" => true), "forms/form/button/conditionalLogic/logicType" => array("is_attribute" => true), "forms/form/button/conditionalLogic/rules/rule/fieldId" => array("is_attribute" => true), "forms/form/button/conditionalLogic/rules/rule/operator" => array("is_attribute" => true), "forms/form/button/conditionalLogic/rules/rule/value" => array("allow_empty" => true), "forms/form/fields/field/id" => array("is_attribute" => true), "forms/form/fields/field/type" => array("is_attribute" => true), "forms/form/fields/field/inputType" => array("is_attribute" => true), "forms/form/fields/field/displayOnly" => array("is_attribute" => true), "forms/form/fields/field/size" => array("is_attribute" => true), "forms/form/fields/field/isRequired" => array("is_attribute" => true), "forms/form/fields/field/noDuplicates" => array("is_attribute" => true), "forms/form/fields/field/inputs/input/id" => array("is_attribute" => true), "forms/form/fields/field/inputs/input/name" => array("is_attribute" => true), "forms/form/fields/field/formId" => array("is_hidden" => true), "forms/form/fields/field/descriptionPlacement" => array("is_hidden" => true), "forms/form/fields/field/allowsPrepopulate" => array("is_attribute" => true), "forms/form/fields/field/adminOnly" => array("is_attribute" => true), "forms/form/fields/field/enableChoiceValue" => array("is_attribute" => true), "forms/form/fields/field/enableEnhancedUI" => array("is_attribute" => true), "forms/form/fields/field/conditionalLogic/actionType" => array("is_attribute" => true), "forms/form/fields/field/conditionalLogic/logicType" => array("is_attribute" => true), "forms/form/fields/field/conditionalLogic/rules/rule/fieldId" => array("is_attribute" => true), "forms/form/fields/field/conditionalLogic/rules/rule/operator" => array("is_attribute" => true), "forms/form/fields/field/conditionalLogic/rules/rule/value" => array("allow_empty" => true), "forms/form/fields/field/previousButton/type" => array("is_attribute" => true), "forms/form/fields/field/nextButton/type" => array("is_attribute" => true), "forms/form/fields/field/nextButton/conditionalLogic/actionType" => array("is_attribute" => true), "forms/form/fields/field/nextButton/conditionalLogic/logicType" => array("is_attribute" => true), "forms/form/fields/field/nextButton/conditionalLogic/rules/rule/fieldId" => array("is_attribute" => true), "forms/form/fields/field/nextButton/conditionalLogic/rules/rule/operator" => array("is_attribute" => true), "forms/form/fields/field/nextButton/conditionalLogic/rules/rule/value" => array("allow_empty" => true), "forms/form/fields/field/choices/choice/isSelected" => array("is_attribute" => true), "forms/form/fields/field/choices/choice/text" => array("allow_empty" => true), "forms/form/fields/field/choices/choice/value" => array("allow_empty" => true), "forms/form/fields/field/rangeMin" => array("is_attribute" => true), "forms/form/fields/field/rangeMax" => array("is_attribute" => true), "forms/form/fields/field/numberFormat" => array("is_attribute" => true), "forms/form/fields/field/calendarIconType" => array("is_attribute" => true), "forms/form/fields/field/dateFormat" => array("is_attribute" => true), "forms/form/fields/field/dateType" => array("is_attribute" => true), "forms/form/fields/field/nameFormat" => array("is_attribute" => true), "forms/form/fields/field/phoneFormat" => array("is_attribute" => true), "forms/form/fields/field/addressType" => array("is_attribute" => true), "forms/form/fields/field/hideCountry" => array("is_attribute" => true), "forms/form/fields/field/hideAddress2" => array("is_attribute" => true), "forms/form/fields/field/disableQuantity" => array("is_attribute" => true), "forms/form/fields/field/productField" => array("is_attribute" => true), "forms/form/fields/field/enablePrice" => array("is_attribute" => true), "forms/form/fields/field/displayTitle" => array("is_attribute" => true), "forms/form/fields/field/displayCaption" => array("is_attribute" => true), "forms/form/fields/field/displayDescription" => array("is_attribute" => true), "forms/form/fields/field/displayAllCategories" => array("is_attribute" => true), "forms/form/fields/field/postCustomFieldName" => array("is_attribute" => true) ); $serializer = new RGXML($options); $xml = $serializer->serialize("forms", $forms); if ( !seems_utf8( $xml ) ) $value = utf8_encode( $xml ); $filename = "gravityforms-export-" . 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); echo $xml; die(); } } public static function export_page(){ if(!GFCommon::ensure_wp_version()) return; echo GFCommon::get_remote_message(); $view = RGForms::get("view"); switch($view){ case "import_form" : self::import_form_page(); break; case "export_form" : self::export_form_page(); break; default: self::export_lead_page(); break; } } public static function export_links(){ $view = RGForms::get("view"); ?>