本文整理汇总了PHP中FrmAppHelper::prepare_and_encode方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::prepare_and_encode方法的具体用法?PHP FrmAppHelper::prepare_and_encode怎么用?PHP FrmAppHelper::prepare_and_encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::prepare_and_encode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: migrate_email_settings_to_action
private static function migrate_email_settings_to_action($form_options, $form_id, $post_type, &$imported, $switch)
{
// No old notifications or autoresponders to carry over
if (!isset($form_options['auto_responder']) && !isset($form_options['notification']) && !isset($form_options['email_to'])) {
return;
}
// Initialize notifications array
$notifications = array();
// Migrate regular notifications
self::migrate_notifications_to_action($form_options, $form_id, $notifications);
// Migrate autoresponders
self::migrate_autoresponder_to_action($form_options, $form_id, $notifications);
if (empty($notifications)) {
return;
}
foreach ($notifications as $new_notification) {
$new_notification['post_type'] = $post_type;
$new_notification['post_excerpt'] = 'email';
$new_notification['post_title'] = __('Email Notification', 'formidable');
$new_notification['menu_order'] = $form_id;
$new_notification['post_status'] = 'publish';
// Switch field IDs and keys, if needed
if ($switch) {
// Switch field IDs in email conditional logic
self::switch_email_contition_field_ids($new_notification['post_content']);
// Switch all other field IDs in email
$new_notification['post_content'] = FrmFieldsHelper::switch_field_ids($new_notification['post_content']);
}
$new_notification['post_content'] = FrmAppHelper::prepare_and_encode($new_notification['post_content']);
$exists = get_posts(array('name' => $new_notification['post_name'], 'post_type' => $new_notification['post_type'], 'post_status' => $new_notification['post_status'], 'numberposts' => 1));
if (empty($exists)) {
FrmAppHelper::save_json_post($new_notification);
$imported['imported']['actions']++;
}
unset($new_notification);
}
}
示例2: save_settings
/**
* Prepare and save settings in styles and actions
*
* @param array $settings
* @param string $group
*
* @since 2.0.6
*/
public static function save_settings($settings, $group)
{
$settings = (array) $settings;
$settings['post_content'] = FrmAppHelper::prepare_and_encode($settings['post_content']);
if (empty($settings['ID'])) {
unset($settings['ID']);
}
// delete all caches for this group
self::cache_delete_group($group);
return self::save_json_post($settings);
}