本文整理汇总了PHP中FrmFormsHelper::setup_new_vars方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFormsHelper::setup_new_vars方法的具体用法?PHP FrmFormsHelper::setup_new_vars怎么用?PHP FrmFormsHelper::setup_new_vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmFormsHelper
的用法示例。
在下文中一共展示了FrmFormsHelper::setup_new_vars方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_create
/**
* @covers FrmForm::create
*/
function test_create()
{
$values = FrmFormsHelper::setup_new_vars(false);
$form_id = FrmForm::create($values);
$this->assertTrue(is_numeric($form_id));
$this->assertNotEmpty($form_id);
}
示例2: duplicate
public static function duplicate($old_form_id, $form_id, $copy_keys = false, $blog_id = false)
{
global $frm_duplicate_ids;
$fields = self::getAll(array('fi.form_id' => $old_form_id), 'field_order', '', $blog_id);
foreach ((array) $fields as $field) {
$new_key = $copy_keys ? $field->field_key : '';
if ($copy_keys && substr($field->field_key, -1) == 2) {
$new_key = rtrim($new_key, 2);
}
$values = array();
FrmFieldsHelper::fill_field($values, $field, $form_id, $new_key);
// If this is a repeating section, create new form
if ($field->type == 'divider' && self::is_option_true($field, 'repeat')) {
// create the repeatable form
$repeat_form_values = FrmFormsHelper::setup_new_vars(array('parent_form_id' => $form_id));
$new_repeat_form_id = FrmForm::create($repeat_form_values);
// Save old form_select
$old_repeat_form_id = $field->field_options['form_select'];
// Update form_select for repeating field
$values['field_options']['form_select'] = $new_repeat_form_id;
}
// If this is a field inside of a repeating section, associate it with the correct form
if ($field->form_id != $old_form_id && isset($old_repeat_form_id) && isset($new_repeat_form_id) && $field->form_id == $old_repeat_form_id) {
$values['form_id'] = $new_repeat_form_id;
}
$values = apply_filters('frm_duplicated_field', $values);
$new_id = self::create($values);
$frm_duplicate_ids[$field->id] = $new_id;
$frm_duplicate_ids[$field->field_key] = $new_id;
unset($field);
}
}
示例3: test_create_form
function test_create_form()
{
FrmAppController::install();
$frm_form = new FrmForm();
$values = FrmFormsHelper::setup_new_vars(false);
$id = $frm_form->create($values);
$this->assertGreaterThan(0, $id);
}
示例4: __construct
function __construct($factory = null)
{
parent::__construct($factory);
global $wpdb;
$this->default_generation_definitions = FrmFormsHelper::setup_new_vars(false);
}
示例5: add_default_templates
public static function add_default_templates($path, $default = true, $template = true)
{
_deprecated_function(__FUNCTION__, '1.07.05', 'FrmXMLController::add_default_templates()');
global $frm_field;
$path = untrailingslashit(trim($path));
$templates = glob($path . "/*.php");
$frm_form = new FrmForm();
for ($i = count($templates) - 1; $i >= 0; $i--) {
$filename = str_replace('.php', '', str_replace($path . '/', '', $templates[$i]));
$template_query = array('form_key' => $filename);
if ($template) {
$template_query['is_template'] = 1;
}
if ($default) {
$template_query['default_template'] = 1;
}
$form = $frm_form->getAll($template_query, '', 1);
$values = FrmFormsHelper::setup_new_vars();
$values['form_key'] = $filename;
$values['is_template'] = $template;
$values['status'] = 'published';
if ($default) {
$values['default_template'] = 1;
}
include $templates[$i];
//get updated form
if (isset($form) && $form) {
$form = $frm_form->getOne($form->id);
} else {
$form = $frm_form->getAll($template_query, '', 1);
}
if ($form) {
do_action('frm_after_duplicate_form', $form->id, (array) $form);
}
}
}
示例6: add_default_templates
function add_default_templates($path, $default = true, $template = true)
{
global $frm_form, $frm_field;
$templates = glob($path . "/*.php");
for ($i = count($templates) - 1; $i >= 0; $i--) {
$filename = str_replace('.php', '', str_replace($path . '/', '', $templates[$i]));
$template_query = array('form_key' => $filename);
if ($template) {
$template_query['is_template'] = 1;
}
if ($default) {
$template_query['default_template'] = 1;
}
$form = $frm_form->getAll($template_query, '', 1);
$values = FrmFormsHelper::setup_new_vars();
$values['form_key'] = $filename;
$values['is_template'] = $template;
$values['status'] = 'published';
if ($default) {
$values['default_template'] = 1;
}
include_once $templates[$i];
}
}
示例7: create_repeat_form
/**
* Create the form for a repeating section
*
* @since 2.0.12
*
* @param int $form_id
* @param array $atts
* @return int $form_id
*/
public static function create_repeat_form($form_id, $atts)
{
$form_values = array('parent_form_id' => $atts['parent_form_id'], 'name' => $atts['field_name'], 'status' => 'published');
$form_values = FrmFormsHelper::setup_new_vars($form_values);
$form_id = (int) FrmForm::create($form_values);
return $form_id;
}