} $cache_data = $data['data']; $cache_data['data'] = empty( $cache_data['data'] ) ? [] : $cache_data['data']; $cache_data['data']['settings'] = empty( $cache_data['data']['settings'] ) ? [] : $cache_data['data']['settings']; $cache_data['data']['settings']['ajax_submit'] = '1'; // Strip the word "Template" from the end of the template name and form title setting. $cache_data['name'] = preg_replace( '/\sTemplate$/', '', $cache_data['name'] ); $cache_data['data']['settings']['form_title'] = $cache_data['name']; // Unset `From Name` field of the notification settings. // By default, the builder will use the `blogname` option value. unset( $cache_data['data']['settings']['notifications'][1]['sender_name'] ); return $cache_data; } /** * Wipe cache of an empty templates. * * @since 1.7.5 */ public function wipe_empty_templates_cache() { $cache_dir = $this->get_cache_dir(); $files = glob( $cache_dir . '*.json' ); foreach ( $files as $filename ) { $content = file_get_contents( $filename ); if ( empty( $content ) || trim( $content ) === '[]' ) { unlink( $filename ); } } } }