本文整理匯總了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);
}