wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
class.XMLDataConverter.php
Go to the documentation of this file.
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2014 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of any of the following licenses
7  * at your choice:
8  *
9  * - GNU Lesser General Public License (LGPL)
10  * http://www.gnu.org/licenses/lgpl.html
11  * - Eclipse Public License (EPL)
12  * http://www.eclipse.org/org/documents/epl-v10.php
13  *
14  * See the license.txt file distributed with this work for
15  * additional information.
16  *
17  * $Id: class.XMLDataConverter.php 1462 2014-02-04 23:52:27Z iherwig $
18  */
19 require_once(BASE."wcmf/lib/util/class.Message.php");
20 require_once(BASE."wcmf/lib/persistence/converter/class.DataConverter.php");
21 
22 /**
23  * @class XMLDataConverter
24  * @ingroup Converter
25  * @brief XMLDataConverter converts data between storage and XML files.
26  *
27  * @author ingo herwig <ingo@wemove.com>
28  */
30 {
31  /**
32  * @see DataConverter::convertStorageToApplication()
33  */
34  function convertStorageToApplication($data, $type, $name)
35  {
36  if ($type == 'data_date' && $data != '')
37  {
38  list($year, $month, $day) = split('-', $data);
39  $data = date("d.m.Y", mktime(3, 0, 0, $month, $day, $year));
40  }
41  // convert htmlspecialchars that where stored in the db
42  $trans = get_html_translation_table(HTML_ENTITIES);
43  $trans = array_flip($trans);
44  $data = strtr(stripslashes(stripslashes($data)), $trans);
45 
46  return $data;
47  }
48  /**
49  * @see DataConverter::convertApplicationToStorage()
50  */
51  function convertApplicationToStorage($data, $type, $name)
52  {
53  if ($type == 'data_date' && $data != '')
54  {
55  list($day, $month, $year) = split('\.', $data);
56  $data = date("Y-m-d", mktime(3, 0, 0, $month, $day, $year));
57  }
58 
59  return htmlspecialchars($data);
60  }
61 }
62 ?>
convertStorageToApplication($data, $type, $name)
DataConverter is the base class for all converter classes. It defines the interface for converting da...
XMLDataConverter converts data between storage and XML files.
convertApplicationToStorage($data, $type, $name)