本文整理汇总了PHP中FrmForm::clear_form_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmForm::clear_form_cache方法的具体用法?PHP FrmForm::clear_form_cache怎么用?PHP FrmForm::clear_form_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmForm
的用法示例。
在下文中一共展示了FrmForm::clear_form_cache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_migrate_from_12_to_17
/**
* @covers FrmDb::migrate_to_17
*/
function test_migrate_from_12_to_17()
{
$this->frm_install();
update_option('frm_db_version', 12);
$form = FrmForm::getOne('contact-db12');
$this->assertNotEmpty($form);
$this->assertTrue(is_numeric($form->id));
$notification = array(0 => array('email_to' => 'emailto@test.com', 'also_email_to' => array(1, 2), 'reply_to' => 'replyto@test.com', 'reply_to_name' => 'Reply to me', 'cust_reply_to' => '', 'cust_reply_to_name' => '', 'plain_text' => 1, 'email_message' => 'This is my email message. [default-message]', 'email_subject' => 'The subject', 'update_email' => 2, 'inc_user_info' => 1));
$form->options['notification'] = $notification;
global $wpdb;
$updated = $wpdb->update($wpdb->prefix . 'frm_forms', array('options' => maybe_serialize($form->options)), array('id' => $form->id));
FrmForm::clear_form_cache();
$this->assertEquals($updated, 1);
$form = FrmForm::getOne('contact-db12');
$this->assertNotEmpty($form->options, 'The form settings are empty');
$this->assertTrue(isset($form->options['notification']), 'The old notification settings are missing');
$this->assertEquals($form->options['notification'][0]['email_to'], 'emailto@test.com');
// migrate data
FrmAppController::install();
$form_actions = FrmFormAction::get_action_for_form($form->id, 'email');
foreach ($form_actions as $action) {
$this->assertTrue(strpos($action->post_content['email_to'], 'emailto@test.com') !== false);
}
}
示例2: migrate_to_2
/**
* Migrate settings from form->options into new action.
*/
public function migrate_to_2($form, $update = 'update')
{
$action = $this->prepare_new($form->id);
$form->options = maybe_unserialize($form->options);
// fill with existing options
foreach ($action->post_content as $name => $val) {
if (isset($form->options[$name])) {
$action->post_content[$name] = $form->options[$name];
unset($form->options[$name]);
}
}
$action = $this->migrate_values($action, $form);
// check if action already exists
$post_id = get_posts(array('name' => $action->post_name, 'post_type' => FrmFormActionsController::$action_post_type, 'post_status' => $action->post_status, 'numberposts' => 1));
if (empty($post_id)) {
// create action now
$post_id = $this->save_settings($action);
}
if ($post_id && 'update' == $update) {
global $wpdb;
$form->options = maybe_serialize($form->options);
// update form options
$wpdb->update($wpdb->prefix . 'frm_forms', array('options' => $form->options), array('id' => $form->id));
FrmForm::clear_form_cache();
}
return $post_id;
}