Follow-up to #17735: Class 'tx_em_XmlException' not found when Retrieve / Update
[Packages/TYPO3.CMS.git] / typo3 / sysext / em / classes / parser / class.tx_em_parser_mirrorxmlabstractparser.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010 Marcus Krause <marcus#exp2010@t3sec.info>
6 * Steffen Kamper <info@sk-typo3.de>
7 * All rights reserved
8 *
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 *
18 * This script is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * This copyright notice MUST APPEAR in all copies of the script!
24 ***************************************************************/
25 /**
26 * class.tx_em_parser_mirrorxmlabstractparser.php
27 *
28 * Module: Extension manager - mirror.xml abstract parser
29 *
30 * $Id: class.tx_em_parser_mirrorxmlabstractparser.php 1913 2010-02-21 15:47:37Z mkrause $
31 *
32 * @author Marcus Krause <marcus#exp2010@t3sec.info>
33 * @author Steffen Kamper <info@sk-typo3.de>
34 */
35
36
37 /**
38 * Abstract parser for TYPO3's mirror.xml file.
39 *
40 * @author Marcus Krause <marcus#exp2010@t3sec.info>
41 * @author Steffen Kamper <info@sk-typo3.de>
42 *
43 * @since 2010-02-09
44 * @package TYPO3
45 * @subpackage EM
46 */
47 abstract class tx_em_Parser_MirrorXmlAbstractParser extends tx_em_Parser_XmlAbstractParser {
48
49
50 /**
51 * Keeps country of currently processed mirror.
52 *
53 * @var string
54 */
55 protected $country = NULL;
56
57 /**
58 * Keeps hostname of currently processed mirror.
59 *
60 * @var string
61 */
62 protected $host = NULL;
63
64 /**
65 * Keeps path to mirrored TER of currently processed mirror.
66 *
67 * @var string
68 */
69 protected $path = NULL;
70
71 /**
72 * Keeps sponsor link of currently processed mirror.
73 *
74 * @var string
75 */
76 protected $sponsorlink = NULL;
77
78 /**
79 * Keeps sponsor logo location of currently processed mirror.
80 *
81 * @var string
82 */
83 protected $sponsorlogo = NULL;
84
85 /**
86 * Keeps sponsor name of currently processed mirror.
87 *
88 * @var string
89 */
90 protected $sponsorname = NULL;
91
92 /**
93 * Keeps title of currently processed mirror.
94 *
95 * @var string
96 */
97 protected $title = NULL;
98
99
100 /**
101 * Returns an assoziative array of all mirror properties.
102 *
103 * Valid array keys of returned array are:
104 * country, host, path, sponsorlink, sponsorlogo, sponsorname, title
105 *
106 * @access public
107 * @return array assoziative array of a mirror's properties
108 * @see $country, $host, $path, $sponsorlink, $sponsorlogo, $sponsorname, $title
109 */
110 public function getAll() {
111 $mirrorProperties = array();
112 $mirrorProperties['title'] = $this->title;
113 $mirrorProperties['host'] = $this->host;
114 $mirrorProperties['path'] = $this->path;
115 $mirrorProperties['country'] = $this->country;
116 $mirrorProperties['sponsorname'] = $this->sponsorname;
117 $mirrorProperties['sponsorlink'] = $this->sponsorlink;
118 $mirrorProperties['sponsorlogo'] = $this->sponsorlogo;
119 return $mirrorProperties;
120 }
121
122 /**
123 * Returns country of currently processed mirror.
124 *
125 * @access public
126 * @return string name of country a mirror is located in
127 * @see $country, getAll()
128 */
129 public function getCountry() {
130 return $this->country;
131 }
132
133 /**
134 * Returns host of currently processed mirror.
135 *
136 * @access public
137 * @return string host name
138 * @see $host, getAll()
139 */
140 public function getHost() {
141 return $this->host;
142 }
143
144 /**
145 * Returns path to mirrored TER of currently processed mirror.
146 *
147 * @access public
148 * @return string path name
149 * @see $path, getAll()
150 */
151 public function getPath() {
152 return $this->path;
153 }
154
155 /**
156 * Returns sponsor link of currently processed mirror.
157 *
158 * @access public
159 * @return string URL of a sponsor's website
160 * @see $sponsorlink, getAll()
161 */
162 public function getSponsorlink() {
163 return $this->sponsorlink;
164 }
165
166 /**
167 * Returns sponsor logo location of currently processed mirror.
168 *
169 * @access public
170 * @return string a sponsor's logo location
171 * @see $sponsorlogo, getAll()
172 */
173 public function getSponsorlogo() {
174 return $this->sponsorlogo;
175 }
176
177 /**
178 * Returns sponsor name of currently processed mirror.
179 *
180 * @access public
181 * @return string name of sponsor
182 * @see $sponsorname, getAll()
183 */
184 public function getSponsorname() {
185 return $this->sponsorname;
186 }
187
188 /**
189 * Returns title of currently processed mirror.
190 *
191 * @access public
192 * @return string title of mirror
193 * @see $title, get All()
194 */
195 public function getTitle() {
196 return $this->title;
197 }
198
199 /**
200 * Method resets version class properties.
201 *
202 * @access protected
203 * @return void
204 * @see $country, $host, $path, $sponsorlink, $sponsorlogo, $sponsorname, $title
205 */
206 protected function resetProperties() {
207 $this->title = $this->host = $this->path =
208 $this->country = $this->sponsorname = $this->sponsorlink =
209 $this->sponsorlogo;
210 }
211
212 /**
213 * Method provides a wrapper for an exception call
214 *
215 * @access protected
216 * @param string $message the exception message to throw.
217 * @param integer $code the exception code.
218 * @return void
219 */
220 protected function throwException($message = "", $code = 0) {
221 throw new tx_em_MirrorXmlException(get_class($this) . ': ' . $message, $code);
222 }
223 }
224
225 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/parser/class.tx_em_parser_mirrorxmlabstractparser.php'])) {
226 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/parser/class.tx_em_parser_mirrorxmlabstractparser.php']);
227 }
228
229 ?>