本文整理汇总了PHP中GFExport::start_export方法的典型用法代码示例。如果您正苦于以下问题:PHP GFExport::start_export方法的具体用法?PHP GFExport::start_export怎么用?PHP GFExport::start_export使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFExport
的用法示例。
在下文中一共展示了GFExport::start_export方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: maybe_export
public static function maybe_export()
{
if (isset($_POST['export_lead'])) {
check_admin_referer('rg_start_export', 'rg_start_export_nonce');
//see if any fields chosen
if (empty($_POST['export_field'])) {
GFCommon::add_error_message(__('Please select the fields to be exported', 'gravityforms'));
return;
}
$form_id = $_POST['export_form'];
$form = RGFormsModel::get_form_meta($form_id);
$filename = sanitize_title_with_dashes($form['title']) . '-' . gmdate('Y-m-d', GFCommon::get_local_timestamp(time())) . '.csv';
$charset = get_option('blog_charset');
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: text/csv; charset=' . $charset, true);
$buffer_length = ob_get_length();
//length or false if no buffer
if ($buffer_length > 1) {
ob_clean();
}
GFExport::start_export($form);
die;
} else {
if (isset($_POST['export_forms'])) {
check_admin_referer('gf_export_forms', 'gf_export_forms_nonce');
$selected_forms = rgpost('gf_form_id');
if (empty($selected_forms)) {
GFCommon::add_error_message(__('Please select the forms to be exported', 'gravityforms'));
return;
}
$forms = RGFormsModel::get_form_meta_by_id($selected_forms);
$forms = self::prepare_forms_for_export($forms);
$forms['version'] = GFForms::$version;
$forms_json = json_encode($forms);
$filename = 'gravityforms-export-' . date('Y-m-d') . '.json';
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
echo $forms_json;
die;
}
}
}
示例2: start_export
public static function start_export()
{
require_once GFCommon::get_base_path() . '/export.php';
GFExport::start_export();
}
示例3: maybe_export
public static function maybe_export()
{
if (isset($_POST['export_lead'])) {
check_admin_referer('rg_start_export', 'rg_start_export_nonce');
//see if any fields chosen
if (empty($_POST['export_field'])) {
GFCommon::add_error_message(__('Please select the fields to be exported', 'gravityforms'));
return;
}
$form_id = $_POST['export_form'];
$form = RGFormsModel::get_form_meta($form_id);
$filename = sanitize_title_with_dashes($form['title']) . '-' . gmdate('Y-m-d', GFCommon::get_local_timestamp(time())) . '.csv';
$charset = get_option('blog_charset');
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: text/csv; charset=' . $charset, true);
$buffer_length = ob_get_length();
//length or false if no buffer
if ($buffer_length > 1) {
ob_clean();
}
GFExport::start_export($form);
die;
} else {
if (isset($_POST['export_forms'])) {
check_admin_referer('gf_export_forms', 'gf_export_forms_nonce');
$selected_forms = rgpost('gf_form_id');
if (empty($selected_forms)) {
GFCommon::add_error_message(__('Please select the forms to be exported', 'gravityforms'));
return;
}
$forms = RGFormsModel::get_form_meta_by_id($selected_forms);
// clean up a bit before exporting
foreach ($forms as &$form) {
foreach ($form['fields'] as &$field) {
$inputType = RGFormsModel::get_input_type($field);
if (isset($field->pageNumber)) {
unset($field->pageNumber);
}
if ($inputType != 'address') {
unset($field->addressType);
}
if ($inputType != 'date') {
unset($field->calendarIconType);
unset($field->dateType);
}
if ($inputType != 'creditcard') {
unset($field->creditCards);
}
if ($field->type == $field->inputType) {
unset($field->inputType);
}
// convert associative array to indexed
if (isset($form['confirmations'])) {
$form['confirmations'] = array_values($form['confirmations']);
}
if (isset($form['notifications'])) {
$form['notifications'] = array_values($form['notifications']);
}
}
/**
* Allows you to filter and modify the Export Form
*
* @param array $form Assign which Gravity Form to change the export form for
*/
$form = gf_apply_filters('gform_export_form', $form['id'], $form);
}
$forms['version'] = GFForms::$version;
$forms_json = json_encode($forms);
$filename = 'gravityforms-export-' . date('Y-m-d') . '.json';
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: application/json; charset=' . get_option('blog_charset'), true);
echo $forms_json;
die;
}
}
}
示例4: maybe_export
public static function maybe_export()
{
if (isset($_POST["export_lead"])) {
check_admin_referer("rg_start_export", "rg_start_export_nonce");
$form_id = $_POST["export_form"];
$form = RGFormsModel::get_form_meta($form_id);
$filename = sanitize_title_with_dashes($form["title"]) . "-" . date("Y-m-d") . ".csv";
$charset = get_option('blog_charset');
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: text/plain; charset=' . $charset, true);
ob_clean();
GFExport::start_export($form);
die;
} else {
if (isset($_POST["export_forms"])) {
check_admin_referer("gf_export_forms", "gf_export_forms_nonce");
$selected_forms = $_POST["gf_form_id"];
if (empty($selected_forms)) {
echo "<div class='error' style='padding:15px;'>" . __("Please select the forms to be exported", "gravityforms") . "</div>";
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);
unset($field["pageNumber"]);
if ($inputType == "checkbox") {
unset($field["inputs"]);
} else {
if ($inputType != "address") {
unset($field["addressType"]);
} else {
if ($inputType != "date") {
unset($field["calendarIconType"]);
} else {
if ($field["type"] == $field["inputType"]) {
unset($field["inputType"]);
}
}
}
}
if (in_array($inputType, array("checkbox", "radio", "select")) && !$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/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/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/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/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/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;
}
}
}
示例5: maybe_export
public static function maybe_export()
{
if (isset($_POST["export_lead"])) {
check_admin_referer("rg_start_export", "rg_start_export_nonce");
//see if any fields chosen
if (empty($_POST["export_field"])) {
GFCommon::add_error_message(__('Please select the fields to be exported', 'gravityforms'));
return;
}
$form_id = $_POST["export_form"];
$form = RGFormsModel::get_form_meta($form_id);
$filename = sanitize_title_with_dashes($form["title"]) . "-" . gmdate("Y-m-d", GFCommon::get_local_timestamp(time())) . ".csv";
$charset = get_option('blog_charset');
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename={$filename}");
header('Content-Type: text/plain; charset=' . $charset, true);
$buffer_length = ob_get_length();
//length or false if no buffer
if ($buffer_length > 1) {
ob_clean();
}
GFExport::start_export($form);
die;
} else {
if (isset($_POST["export_forms"])) {
check_admin_referer("gf_export_forms", "gf_export_forms_nonce");
$selected_forms = rgpost("gf_form_id");
if (empty($selected_forms)) {
GFCommon::add_error_message(__('Please select the forms to be exported', 'gravityforms'));
return;
}
$forms = RGFormsModel::get_form_meta_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"]);
}
}
// convert associative array to indexed
if (isset($form['confirmations'])) {
$form['confirmations'] = array_values($form['confirmations']);
}
if (isset($form['notifications'])) {
$form['notifications'] = array_values($form['notifications']);
}
}
}
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), "forms/form/confirmations/confirmation/id" => array("is_attribute" => true), "forms/form/confirmations/confirmation/type" => array("is_attribute" => true), "forms/form/confirmations/confirmation/isDefault" => array("is_attribute" => true), "forms/form/confirmations/confirmation/disableAutoformatting" => array("is_attribute" => true), "forms/form/notifications/notification/id" => 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;
}
}
}